text
stringlengths
2.85k
2.55M
label
class label
11 classes
Inferring Chemical Reaction Patterns Using Rule Composition in Graph Grammars Jakob L. Andersen,1 Christoph Flamm,2 Daniel Merkle,1∗ and Peter F. Stadler 2−7 arXiv:1208.3153v2 [cs.DM] 16 Aug 2012 1 Department for Mathematics and Computer Science University of Southern Denmark, Denmark 2 3 4 5 Institute for Theoretical Chemistry University of Vienna, Austria. Bioinformatics Group, Department of Computer Science and Interdisciplinary Center for Bioinformatics University of Leipzig, Germany. Max Planck Institute for Mathematics in the Sciences, Leipzig, Germany. Fraunhofer Institute for Cell Therapy and Immunology, Leipzig, Germany. 6 7 Center for non-coding RNA in Technology and Health University of Copenhagen, Denmark. Santa Fe Institute, 1399 Hyde Park Rd, Santa Fe, NM 87501, USA Abstract Modeling molecules as undirected graphs and chemical reactions as graph rewriting operations is a natural and convenient approach to modeling chemistry. Graph grammar rules are most naturally employed to model elementary reactions like merging, splitting, and isomerisation of molecules. It is often convenient, in particular in the analysis of larger systems, to summarize several subsequent reactions into a single composite chemical reaction. We use a generic approach for composing graph grammar rules to define a chemically useful rule compositions. We iteratively apply these rule compositions to elementary transformations in order to automatically infer complex transformation patterns. This is useful for instance to understand the net effect of complex catalytic cycles such as the Formose reaction. The automatically inferred graph grammar rule is a generic representative that also covers the overall reaction pattern of the Formose cycle, namely two carbonyl groups that can react with a bound glycolaldehyde to a second glycolaldehyde. Rule composition also can be used to study polymerization reactions as well as more complicated iterative reaction schemes. Terpenes and the polyketides, for instance, form two naturally occurring classes of compounds of utmost pharmaceutical interest that can be understood as “generalized polymers” consisting of five-carbon (isoprene) and two-carbon units, respectively. 1 Introduction Directed hypergraphs [8] are a suitable topological representation of (bio)chemical reaction networks where (catalytic) reactions are hyperedges connecting substrate nodes to product nodes. Such ∗ to whom correspondence should be addressed 1 networks require an underlying Artificial Chemistry [3] that describes how molecules and reactions are modeled. If molecules are treated as edge and vertex labeled graphs, where the vertex labels correspond to atom types and the edge labels denote bond types, then structural change of molecules during chemical reactions can be modeled as graph rewrite [2]. In contrast to many other Artificial Chemistries this approach allows for respecting fundamental rules of chemical transformations like mass conservation, atomic types, and cyclic shifts of electron pairs in reactions. In general, a graph rewrite (rule) transforms a set of substrate graphs into a set of product graphs. Hence the graph rewrite formalism allows not only to delimit an entire chemical universe in an abstract but compact form but also provides a methodology for its explicit construction. Most methods for the analysis of this network structure are directed towards this graph (or hypergraph) structure [1, 8], which is described by the stoichiometric matrix S of the chemical system. Since S is essentially the incidence matrix of the directed hypergraph, algebraic approaches such as Metabolic Flux Analysis and Flux Balance Analysis [10] have a natural interpretation in terms of the hypergraph. Indeed typical results are sets of possibly weighted reactions (i.e., hyperedges) such as elementary flux modes [12], extreme pathways [11], minimal metabolic behaviors [9] or a collection of reactions that maximize the production of a desired product in metabolic engineering. The net reaction of a given pathway is simply the linear combination of the participating hyperedges. In the setting of generative models of chemistry, each concrete reaction is not only associated with its stoichiometry but also with the transformation rule operating on the molecules that are involved in a particular reaction. Importantly, these rules are formulated in terms of reaction mechanisms that readily generalize to large sets of structurally related molecules. It is thus of interest to derive not only the stoichiometric net reaction of a pathway but also the corresponding “effective transformation rule”. Instead of attempting to address this issue a posteriori, we focus here on the possibility of composing the elementary rules of chemical transformations to new effective rules that encapsulate entire pathways. The motivation comes from the observation that string grammars are meaningfully characterized and understood by investigating the transformation rules. Consider, as a trivial example, the context-free grammar G with the starting symbol S and the rules S → aS 0 a, S 0 → aS 0 a | B and B →  | bB. Inspecting this grammar we see that we can summarize the effect of the productions as B → bk , k ≥ 0, and S → an Ban , n ≥ 1. The language generated from G is thus {an b∗ an |n ≥ 1}. Here we explore whether a similar reasoning, namely the systematic combination of transformation rules, can help to characterize the language of molecules that is generated by a particular graph rewriting chemistry. Similar to the example from term rewriting above, we should at the very least be able to recognize the regularities in polymerization reactions. We shall see below, however, that the rule based approach holds much higher promises. In this contribution we address two issues: First we establish the formal conditions under which chemical transformation rules can be meaningfully composed. To this end, we introduce in section 2 rule composition within the framework of concurrency theory. We then discuss the specific restrictions that apply to chemical systems, leading to the constructive approach to inferring composed rules in section 3. The basic computational task we envision starts from an unordered set R of reactions such as those forming a particular metabolic reaction pathway. To derive the effective transformation rule describing the pathway we need to find the correct ordering π in which the transformation rules pi , underlying the individual chemical reactions ρi , have to be composed. We illustrate this approach in some detail using the Formose reaction as an example in Section 4. 2 2 Graph Grammars and Rule Composition Graph grammars, or graph rewriting systems, are proper generalizations of term rewrite systems. A wide variety of formal frameworks have been explored, including several different algebraic ones rooted in category theory. As a model of chemical transformations the so-called double pushout (DPO) formulation appears to be best suited. We refer to [5] for the comprehensive treatise. In the following sections we first outline the basic setup and then introduce full and partial rule composition. 2.1 Double Pushout and Concurrency l The DPO formulation of graph transformations considers transformation rules of form p = (L ← − r K→ − R) where L, R, and K are called the left graph, right graph, and context graph, respectively. p,m The maps l and r are graph morphisms. The rule p transforms G to H, in symbols G ==⇒ H if there is a pushout graph D and a “matching morphism” m : L → G such that following diagram is valid: r l L K R m k G D ρ (1) n H λ The existence of D is equivalent to the so-called gluing condition, which determines whether the p rule p is applicable to a match in G. In the following we will also write G = ⇒ H and G ⇒ H for derivations, if the specific match or transformation rule is unimportant or clear from the context. Concurrency theory provides a canonical framework for the composition of two graph transforql qr li ri mations. Given two rules pi = (Li ← − Ki − → Ri ), i = 1, 2, a composition (L ← − K −→ R) = p1 ∗E p2 can be defined whenever a dependency graph E exists so that in the following diagram: L1 l1 ul L s1 K1 r1 v1 (1) C1 R1 L2 e1 e2 t1 E s2 w1 (3) w2 l2 K2 (2) v2 C2 r2 R2 u2 t2 R (2) K the cycles (1) and (2) are pushouts, and (3) is a pullback, see e.g., [7]. We then have ql = s1 ◦ w1 and qr = t2 ◦ w2 . The concurrency theorem [4] ensures that for any sequence of consecutive direct p1 ,m1 p2 ,m2 transformations G ===⇒ H ===⇒ G0 a graph E, a corresponding E-concurrent rule p1 ∗E p2 , and p1 ∗ p2 ,m a morphism m can be found such that G ===E===⇒ G0 . In order to use graph transformation as a model for chemical reactions additional conditions must be enforced. Most importantly, atoms are neither created, nor destroyed, nor transformed to other types. Thus only graph morphisms whose restriction to the vertex sets are bijective are valid in our context. In particular, the matching morphism m always corresponds to a subgraph isomorphism in our context. The context graph K thus is (isomorphic to) a subgraph of both L and R, describing the part of L that remains unchanged in R. Conservation of atoms means that the vertex sets of L, K, and R are linked by bijections known as the atom-mapping. When the atom mapping is clear, thus, we do not need to represent the context explicitly. It is important to note that the existence of the matching morphism m : L → G alone is not sufficient to guarantee the applicability of the transformation. In our context, we require in addition that the transformation rule does not attempt to introduce an edge in R that has been present already before the transformation is applied. Formally, the gluing condition requires that (l(x), l(y)) ∈ / L and (r(x), r(y)) ∈ R implies (m(l(x)), m(r(y))) ∈ / G. 3 p1 L1 R1 p2 L2 R2 =⇒ L1 p3 R3 R2 Fig. 1: Full composition of two rules requires that L2 is (isomorphic to) a subgraph of R1 . 2.2 Full Rule Composition In the following we will be concerned only with special, chemically motivated, types of rule compositions. In the simplest case the dependency graph E is isomorphic to R1 , later we will also consider a more general setting in which E is isomorphic to the disjoint union of R1 and some connected components of L2 . For the ease of notation from now on we only refer to a rule composition, and not to a composition of morphisms as in Section 2, i.e., p1 ∗E p2 will be denoted as p2 ◦ p1 (note the order of the arguments changes). If E ∼ = R1 , then L2 ∼ = e2 (L2 ) is a subgraph of R1 . Omitting the explicit references to the subgraph matching morphism e2 we can simply view L2 as subgraph of R1 as illustrated in Figure 1. p2 ,e2 The rule composition thus amounts to a rewriting R1 ===⇒ R, while the left side L1 is preserved. p2 ◦p1 We will use the notation p2 ◦ p1 and G0 ===⇒ G0 for this restricted type of rule composition, and call it full composition as the complete left side of p2 is a subgraph of R1 . Note that L2 may fit into R1 in more than one way so that there may be more than one composite rule. Formally, the alternative compositions are distinguished by different matching morphisms e2 in the diagram (2); we will return to this point below. 2.3 Partial Rule Composition An important issue for the application to chemical reactions is that the graphs involved in the rules are in general not connected. Typical chemical reactions combine molecules, split molecules or transfer groups of atoms from one molecule to another. The transformation rules for all these reactions therefore require multiple connected components. For the purpose of dealing with these rules, we introduce the following notation for graphs and derivations. L1 p1 R1 L12 p2 R2 L22 =⇒ L1 p3 R3 R2 L22 Fig. 2: Partial rule composition requires that at least one connected component (here L12 ) is isomorphic to R1 . Additional components of of the second rule may remain unmatched. 4 p3 H O O C H C C p1 H H O O C C C H O O C H C C H C H p1 ◦ p3 H O O C O C C H O H H C C C H H Fig. 3: Composition of two rules from the Formose reaction (p1 and p3 ); the following rule names will be used: p0 : forward keto-enol tautomerism (which corresponds to the reverse of p1 ), p1 : backward keto-enol tautomerism, p2 : forward aldol addition (which corresponds to the reverse of p3 ), and p3 : backward aldol addition. The atom mapping and matching morphism are implicitly given in these drawings by corresponding positions of the atoms. The context K thus consists of all the atoms as well as the chemical bonds (edges) shown in black in both the left and the right graph of each rule. Let Q be a graph with #Q connected components Qi , i = 1, . . . , #Q. It will be convenient to treat Q as the multiset of its components. A typical chemical graph derivation, corresponding p,m to a bi-molecular reaction can be written in the form {G1 , G2 } ==⇒ {H 1 , H 2 , H 3 }, where we take the notation to imply that all graphs Gi and H j are connected. We will furthermore insist that representations of chemical reactions are minimal in the following sense: If the left graph of the rule p = (L ← K → R) matches entirely within G1 , i.e., m(L) ∩ G2 = ∅, then G2 can be omitted. (In a chemical rewriting grammar, then, one of the H i must be isomorphic to G2 , becoming redundant p,m as well.) More formally, we say that a derivation {G1 , G2 , . . . , G#G } ==⇒ {H 1 , H 2 , . . . , H #H } is proper if ∀i, j : Gi ∼ = Hj ⇒ Gi ∩ m(L) 6= ∅ p That is, a proper derivation cannot be simplified. If the derivation G = ⇒ H is proper then #G ≤ #L. The inequality comes from that fact that multiple components of L may easily be matched to a single component of G while each component of L must match within a component of G. The conditions for the ◦ composition of rules are a bit too strict for our applications. We thus relax them respect the component structure of left and right graphs. More precisely, we require that E is isomorphic to a disjoint union of a copy of R1 and some connected components of L2 so that for every connected component Li2 of L2 holds that either e2 (Li2 ) ⊆ e1 (R1 ) or e2 (Li2 ) is a connected component of E isomorphic to Li2 . For a rule composition of this type to be well defined we need that ∃i such that e2 (Li2 ) ⊆ e1 (R1 ) holds. We remark that the latter condition could be relaxed further to lead to additional compositions for which left and right sides are disjoint unions. The composition of p1 = (L1 , K1 , R1 ) and p2 = (L2 , K2 , R2 ) now yields p2 ◦p1 = ({L1 , L22 }, K3 , R3 ) (cmp. Figure 2). Note that right graph R3 cannot no longer be regarded simply as a rewritten version of R1 because rule p2 now adds additional vertices to both the left and the right graph. The composite context K3 contains only subsets of K1 and K2 , but it is expanded by the vertices of L22 and the edges of L22 that remain unchanged under rule p2 . 5 e1 e2 µ R1 E L2 Fig. 4: The (partial) composition of two rules is mediated by the dependency graph E and the two matching morphisms e1 and e2 . Since these are subgraph isomorphisms in our case, E is simply the union e1 (R1 ) ∪ e2 (L2 ). The (partial) match e1 (R1 ) ∩ e2 (L2 ) can be understood as a matching µ between R1 and L2 , i.e., as a 1-1 relation of the matching nodes and edges. Whenever an edge is matched, then so are its incident vertices. An example of a full rule composition is shown in Fig. 3. The two rules in the example, which in this case are also chemical reactions, are part of the Formose grammar. The Formose grammar consists of two pairs of rules. The first pair of rules, (from now on denoted as p0 and p1 ), implements both directions of the keto-enol tautomerism. One direction, p1 , is visualized in Fig. 3. The second pair, (from now on denoted as p2 , p3 ) is the aldol-addition and its reverse respectively. The reverse (p3 ) is also visualized in Fig. 3. We see that the left side of p1 is isomorphic to a subgraph of one of the components of the right side of p3 . Composing the two rules by subgraph matching yields a third rule, p1 ◦ p3 . In general, we require here that the connected components of R1 and L2 satisfy either e2 (Li2 ) ⊆ e1 (R1j ) or e1 (R1j )∩e2 (Li2 ) = ∅. We furthermore exclude the trivial case of parallel rules in which only the second alternative is realized. In other extreme, if all components Li2 satisfy e1 (Li2 ) ⊆ e2 (R1 ), the partial composition becomes a full composition. Formally, these alternatives are described by different dependency graphs E and/or different morphisms e1 and e2 . Pragmatically we can understand this as a matching µ of L2 and R1 as in Fig. 4. Specifying µ of course removes the ambiguity from the definition of the rule composition; hence we write p2 ◦µ p1 to emphasize the matching µ. 3 Constructing Rule Compositions Given two rules, p1 and p2 , it is not only interesting to know if a partial composition is defined, but also to create the set of all possible compositions {p2 ◦µ1 p1 , p2 ◦µ2 p1 , . . . , p2 ◦µk p1 } explicitly. This set in particular contains also all full compositions. The following describes an algorithm for enumerating all partial compositions. 6 3.1 Enumerating the Matchings µ The key to finding all compositions is the enumeration of all matchings µ thatnrespect out restrico tions on overlaps between connected components. We thus start from the sets R11 , R12 , . . . , R1#R1 n o 2 and L12 , L22 , . . . , L#L of connected components of R1 and L2 , resp. In the first set we find all 2 subgraph matches Li2 ⊆ R1j (represented as the corresponding matchings µij ) and arrange the result in a matrix of lists of subgraph matches, Fig. 5a. The matching matrix is extended by a virtual column to account for the possibility that Li2 is not matched with any component of R1 . Every partial (and full) composition is now defined by a selection of one submatch from each row of the matrix, see Supplemental Material for an example. The converse is not true, however: Not every selection of matches correspond to a partial composition. In particular, we exclude the case that only entries from the virtual column are selected. In addition, the sub-matches must be disjoint to ensure that the combined match is injective. The latter conditions needs to be checked only when more than one submatch is selected from the same column. 3.2 Composing the Rules The construction of the composition p2 ◦µ p1 of two rules p1 and p2 does not explicitly depend on the component structure of R2 and L1 because it is uniquely defined by the matching µ and the bijections of the nodes of Li , Ki , and Ri for each of the two rules. We obtain L by extending L1 with unmatched components of L2 and R by extending R2 by the unmatched components of R1 . The corresponding extension of µ to a bijection µ̂ of the vertex sets of L and R is uniquely defined. The context K of the composite rule simply consists the common vertex set of L and R and all edges (x, y) of L for which (µ̂(x), µ̂(y)) is an edge in R. We note in passing that µ̂ defines the atom mapping of the composite transformation. The explicit construction of (R, K, L) is summarized as Algorithm 3.1. The implementation of the algorithm naturally depends heavily on the representation of transformation rules, which in our implementation is the representation from the Graph Grammar Library (GGL) [6]. The representation is a single graph, with attached vertex and edge properties defining membership of L, K and R, as well as the needed labels. Not all matchings define valid rule composition. For instance, consider an edge (u, v) that is present in R1 and R2 but not in L2 and both u and v are in L2 . This would amount to creating the edge by means of rule p2 which was already introduced by p1 . Since we do not allow parallel edges and thus regard such inconsistencies as undefined cases and reject the matching. Note that a parallel edge does not correspond to a “double bond” (which essentially is only an edge with a specific type). L12 L22 R11 1 R12 1 R13 2 1 (a) Match matrix L12 L22 R11 1 R12 1 R13 2 1 R1∅ 1 1 (b) Extended match matrix Fig. 5: Example of a match matrix and the same matrix with its virtual extension. The top row specifies 1 possibility for L12 ⊆ R11 and 2 for L12 ⊆ R13 . The extended matrix further specifies that L12 can be unmatched. The bottom rows can be interpreted similarly. We display the number of matchings instead of a representation of the matchings themselves. 7 Algorithm 3.1: Composing p1 and p2 to p, by a given partial mapping Input: p1 = (L1 , K1 , R1 ) Input: p2 = (L2 , K2 , R2 ) Input: µ, a partial matching between L2 and R1 Output: p = (L, K, R) 1 p ← empty rule 2 Copy vertices of p1 to p 3 foreach vertex v ∈ p2 do 4 if v is not mapped by µ then 5 Copy v to p 6 else 7 Change membership in L, K and R for vertex µ(v) 8 Copy edges of p1 to p 9 foreach Edge e ∈ p2 do 10 if e is not mapped by µ then 11 Copy e to p 12 else 13 Change membership in L, K and R for edge µ(e) 14 Delete edges and vertices created by p1 , but deleted by p2 15 if matching condition not satisfied then abort 16 return p 3.3 Graph Binding The composition of transformation rules, and thereby chemical reactions, makes it possible to create abstract meta-rules in a way that is similar to the combination of multiple functions into more abstract functions in functional programming. A related concept from (functional) programming that seems useful in the context of graph grammars is partial function application. Consider, for example, the binding of the number 2 to the exponentiation operator, yielding either the function f (x) = 2x or f (x) = x2 . In the framework of rule composition, we define graph binding as a special case. Let G be a graph and p2 = (L2 , K2 , R2 ) be a transformation rule. The binding of G to p2 results in the transformation rule p = (L, K, R) which implements the partial application of p2 on G. This is accomplished simply by regarding G as a rule p1 = (∅, ∅, G), and using partial composition; p = p2 ◦ p1 . Note that if p2 ◦ p1 is a full composition, then p can be regarded as a graph H and p2 G= ⇒ H holds. Graph binding allows a simplified representation of reactions. For instance, we can use this formal construction to omit uninteresting ubiquitously present molecules such as water by binding the graph of the water molecule to the transformation rule of a reaction that requires water. Similarly, graph unbinding can be defined as a transformation rule that destroys graphs. In a chemical application it can be used to avoid the explicit representation of uninteresting ubiquitous molecules such as the solvent. 3.4 Ordering Rules A wide variety of methods, including flux balance analysis, can be used to identify pathways or other subsets of reactions that are of interest. Adjacency of reactions in the original networks as well 8 H H O C 1 O C H H H O H O 2 OH O O OH C H H OH HO C C O H O C C O H H HO H H OH C C O O 3 5, p 2 O H 9, p1 O H H H 1 H H OH H 8, p 3 6, p 0 O C H 5 OH HO C C O O 7, p1 OH C OH H O H O H Li C H C O H H C C H C C O O C O H H H H O H OH O C C O C H H 9 C H H H OH OH O O O H C C C O H H H 8 O H O O O H C O O O C H C C OH C O H 7 O C H C H 4 C C HO H O O O OH O H O H H 2, p 0 C O H OH H C H CH 2 C O 6 3, p 2 O O H H H 4, p 0 H C C H C O H O Ri Li Ri Fig. 6: Above: Chemical reaction network for the Formose reaction; hyperedges are labeled with (i, pj ) where i is the i-th reaction ρi in the rule composition. pj , 0 ≤ j ≤ 3, refers to a specific rule from the Formose reaction; Right: Resulting composed rule after the composition of the first i rules along the Formose cycle, context shown in black. as their directionality can be used efficiently to prune the possible orders of rule compositions. The fact that multiple reactions are instantiations of the same transformation rule, as in the example discussed in detail in the next section, further reduces the search spaces. 4 Results and Discussion We illustrate the use of transformation rule composition by deriving of meta-rules from the graph grammar consisting of the four rules necessary to represent the complete Formose reaction, see Fig. 3. The overall reaction pattern of the Formose cycle is 2g0 + g1 → 2g1 with P9g0 being formaldehyde and g1 being glycolaldehyde. It amounts to the linear combination i=1 ρi of the eight reactions and the influx ρ1 of g0 listed in Fig. 3. It is important to notice that several of these reactions are instantiations of the same, well-known chemical transformations. We have forward keto-enol tautomerism (p0 : ρ2 , ρ4 , ρ6 ), backward keto-enol tautomerism (p1 : ρ7 , ρ9 ), forward al- 9 dol addition (p2 : ρ3 , ρ5 ), and backward aldol addition (p3 : ρ8 ). The composite rule models the complete autocatalytic cycle shown in Fig. 6 as a single meta-rule. Throughout this section we will not explicitly distinguish between partial composition and full composition, and we interpret the composition operator ◦ as right-associative to simplify the notation. Thus pi ◦ pj ◦ pk means pi ◦ (pj ◦ pk ). The rules are used in the autocatalytic cycle in the following order (starting with an keto-enol tautomerisation p0 ): p0 , p2 , p0 , p2 , p0 , p1 , p3 , p1 As it is not possible to compose this sequence of rules directly, we start by binding glycolaldehyde g1 to reaction p0 , as the before-mentioned keto-enol tautomerisation is applied to molecule g1 . The resulting rule is denoted as g1 . The hyperedges in the chemical reaction network depicted in Fig. 6 are numbered according to the sequence that reflects in which order the Formose reaction takes place and consequently the order in which the rule composition subsequently is done. The first composition refers to the binding operation. This binding of glycolaldehyde results in a graph grammar rule, which is depicted in row 1 in the table depicted in Fig. 6, i.e., the rule (∅, ∅, g1 ) (see “Graph Binding”). The numbers at the hyperedges (2, 3, . . . 9) refer to the second, third, . . ., ninth reaction in the sequence of reactions given above. The graph grammar rule pi , 0 ≤ i ≤ 3, used for the corresponding hyper-edge is given next to the sequence number. The rules inferred by a subsequent rule composition are given in rows 2 to 9 of the table. The application of the final rule results in the composed meta-rule p1 ◦ p3 ◦ . . . ◦ p0 ◦ g1 . This rule precisely covers the reaction pattern of the Formose reaction, namely how two formaldehyde molecules and one (bound) glycolaldehyde are transformed to two glycolaldehyde molecules. However note, that the rule is general enough such that any pair of molecules with aldehyde groups can be used, i.e., the inferred reaction pattern refers to a class of overall reactions and the product does not necessarily need to be glycolaldehyde. The practical computation of these compositions takes less than a second in the current implementation. Even for substantially more general composition sequences the running time remains manageable. For instance, it takes less than 1 minute to compute all composition sequences with a length k ≤ 10 of the form pi1 ◦ pi2 ◦ · · · ◦ pik ◦ gq with ij ∈ {0, 1, 2, 3}, based on the binding of one of the influx molecules g0 or g1 . This results in 1875 different inferred composite rules. Polymerization can also be viewed as a pathway in a chemical reaction network, albeit one of potentially infinite size. The same methods applied to the automatic inference of the overall reaction pattern of the Formose cycle can be directly applied to detecting composition rules for polymerization reactions. Importantly, even if a chemical reaction network is not given, the approaches presented in this paper can be used to automatically find sequences of reactions that will lead to polymerization. This can be realized by a straight-forward post-processing step: all that needs to be done is to check whether an inferred composite rule exhibits a replicated functional unit. Such polymerization meta-rules also enable the analysis of chemical systems with highly complex carbon skeletons such as the natural compound classes of the terpenes or the polyketides. 5 Conclusions Graph grammars provide a convenient framework for modeling chemistries on different levels of abstraction. A chemically valid approach is to see any chemical reaction as a bi-molecular reaction. This requires graph grammar rules that cover changes of molecules in an rather explicit and detailed way. Understanding chemical reaction patterns usually requires spanning the chemical reaction 10 networks based on such rules. Obviously, this approach suffers the inherent potential of an immense combinatorial explosion. In this paper we introduced the automatic inference of such higher-level chemical reaction pattern based on a formal approach for graph grammar rule combination. We analyzed the autocatalytic cycle of the Formose reaction and inferred its overall reaction pattern as a rule composition of nine rules. Rule composition is also naturally applicable to inferring patterns of polymerization reactions. Future work will include e.g. the analysis of terpene-based and hydrogen cyanide-based polymerization chemistry. Acknowledgments This work was supported in part by the Volkswagen Stiftung proj. no. I/82719, and the COSTAction CM0703 “Systems Chemistry” and by the Danish Council for Independent Research, Natural Sciences. References [1] Tero Aittokallio and Benno Schwikowski. Graph-based methods for analysing networks in cell biology. Brief Bioinform, 7(3):243–255, 2006. doi: 10.1093/bib/bbl022. [2] Gil Benkö, Christoph Flamm, and Peter F Stadler. A graph-based toy model of chemistry. J Chem Inf Comput Sci, 43(4):1085–1093, 2003. doi: 10.1021/ci0200570. [3] P. Dittrich, J. Ziegler, and W. Banzhaf. Artificial chemistries - a review. Artificial life, 7(3): 225–275, 2001. [4] H. Ehrig, A. Habel, H.-J. Kreowski, and F. Parisi-Presicce. Parallelism and concurrency in high-level replacement systems. Math. Struct. Comp. Science, 1:361–404, 1991. [5] Hartmut Ehrig, Karsten Ehrig, Ulrike Prange, and Gabriele Taenthzer. Fundamentals of Algebraic Graph Transformation. Springer-Verlag, Berlin, D, 2006. [6] C. Flamm, A. Ullrich, H. Ekker, M. Mann, D. Hogerl, M. Rohrschneider, S. Sauer, G. Scheuermann, K. Klemm, I. Hofacker, and P. F. Stadler. Evolution of metabolic networks: A computational frame-work. Journal of Systems Chemistry, 1(4), 2010. ISSN 1759-2208. doi: 10.1186/1759-2208-1-4. [7] Ulrike Golas. Analysis and Correctness of Algebraic Graph and Model Transformations. Vieweg+Teubner, Wiesbaden, D, 2010. [8] Steffen Klamt, Utz-Uwe Haus, and Fabian Theis. Hypergraphs and cellular networks. PLoS Comput Biol, 5(5):e1000385, 2009. doi: 10.1371/journal.pcbi.1000385. [9] A. Larhlimi and A. Bockmayr. A new constraint-based description of the steady-state flux cone of metabolic networks. Discr. Appl. Math., 157:2257–2266, 2009. [10] J. D. Orth, I. Thiele, and B. Ø. Palsson. What is flux balance analysis? Nature Biotech., 28: 245–248, 2010. [11] N. D. Price, J. L. Reed, J. A. Papin, S. J. Wiback, and B. Ø. Palsson. Network-based analysis of metabolic regulation in the human red blood cell. J. Theor. Biol., 225:185–194, 2003. 11 [12] S. Schuster, D. A. Fell, and T. Dandekar. A general definition of metabolic pathways useful for systematic organization and analysis of complex metabolic networks. Nature Biotech., 18: 326–332, 2000. 12 Supplemental Material: Example of Enumeration of Compositions In this Appendix we show the complete result of the composition of two (artificial) rules, p1 and p2 , including the selection of submatches from the match matrix. The two rules are depicted in Fig. 7 with the extended match matrix of the composition p2 ◦ p1 , that corresponds to the example of an extended match matrix as given in the paper. The rules in this section are all depicted with vertices that have an additional index. The numbering of the components is in increasing order wrt. to these indices, e.g., L12 denotes the component connecting nodes A, 0 and B, 1 and L22 denotes the component connecting nodes B, 2 and C, 3. B, 5 B, 5 C, 4 P, 3 A, 1 A, 1 Q, 0 B, 7 R, 6 B, 2 C, 10 C, 4 P, 3 Q, 0 A, 8 C, 10 B, 9 B, 7 R, 6 B, 2 C, 3 C, 3 B, 2 B, 2 B, 1 A, 8 A, 0 B, 9 (a) p1 L12 L22 B, 1 A, 0 (b) p2 R11 1 R12 1 R13 2 1 R1∅ 1 1 (c) Extended match matrix Fig. 7: The two rules p1 and p2 , and the extended match matrix of the composition p2 ◦ p1 . The components of both R1 and L2 are numbered in the same order as the vertex indices. In the following we will enumerate all valid selections of submatches based on the extended match matrix and give the corresponding resulting rule composition. The chosen matches are depicted as • in the extended match matrix. If several matches can be found (in our example this is true for the component L12 , that can be matched twice in R13 ), the • has an index. Composition 1 L12 L22 B, 2 A, 1 Q, 0 R11 • R12 R13 R1∅ • B, 5 B, 2 C, 4 A, 1 P, 3 Q, 0 B, 7 R, 6 B, 5 C, 4 P, 3 B, 7 R, 6 A, 8 C, 10 A, 8 C, 10 B, 9 B, 9 Result of composition 1 i Composition 2 R11 L12 L22 R12 R1∅ R13 •1 • C, 4 C, 4 B, 5 B, 5 P, 3 B, 2 P, 3 B, 7 B, 2 Q, 0 R, 6 Q, 0 A, 8 A, 1 B, 7 R, 6 A, 8 A, 1 B, 9 C, 10 B, 9 C, 10 Result of composition 2 Composition 3 R11 L12 L22 R12 R1∅ R13 •2 • C, 4 P, 3 A, 1 Q, 0 C, 4 B, 5 B, 7 P, 3 A, 1 A, 8 R, 6 B, 9 B, 2 B, 5 Q, 0 A, 8 R, 6 B, 9 B, 2 C, 10 C, 10 Result of composition 3 Composition 4 R11 L12 L22 R12 R1∅ • R13 • B, 12 A, 11 B, 12 B, 5 A, 11 B, 5 A, 1 P, 3 C, 4 A, 1 B, 2 Q, 0 C, 10 B, 9 C, 4 P, 3 B, 2 R, 6 Q, 0 C, 10 B, 7 B, 9 A, 8 R, 6 B, 7 A, 8 Result of composition 4 ii B, 7 Composition 5 R11 • L12 L22 R12 R1∅ R13 • B, 5 B, 5 C, 4 P, 3 A, 1 B, 2 P, 3 A, 1 Q, 0 Q, 0 R, 6 C, 10 B, 7 R, 6 C, 10 B, 2 A, 8 B, 9 C, 4 B, 7 A, 8 B, 9 Result of composition 5 Composition 6 R11 L12 L22 B, 5 R12 R1∅ R13 •1 • B, 5 C, 4 P, 3 A, 1 P, 3 A, 1 Q, 0 R, 6 B, 2 C, 10 B, 9 C, 4 B, 7 Q, 0 R, 6 B, 2 C, 10 A, 8 B, 9 B, 7 A, 8 Result of composition 6 Invalid Selection L12 L22 R11 R12 R13 •2 • R1∅ This selection of submatches is invalid, as they are not disjoint (node B, 9 would be matched twice). Composition 7 L12 L22 R11 R12 R13 R1∅ • • Composition 8 L12 L22 R11 • R12 R13 R1∅ • iii A, 11 C, 4 B, 5 B, 12 C, 10 R, 6 B, 9 P, 3 R, 6 A, 8 Q, 0 B, 2 B, 12 C, 10 B, 9 P, 3 A, 11 C, 4 B, 5 A, 8 Q, 0 B, 2 B, 7 B, 7 A, 1 A, 1 Result of composition 7 C, 12 C, 12 A, 1 B, 11 B, 2 Q, 0 C, 10 A, 1 B, 11 B, 2 C, 4 P, 3 C, 10 B, 5 R, 6 B, 7 B, 9 Q, 0 C, 4 B, 5 R, 6 B, 7 B, 9 A, 8 P, 3 A, 8 Result of composition 8 Composition 9 R11 L12 L22 R12 • C, 4 C, 4 B, 11 B, 5 B, 7 C, 12 P, 3 R, 6 Q, 0 C, 12 P, 3 B, 2 A, 8 Q, 0 A, 1 B, 11 B, 5 B, 7 B, 2 R1∅ R13 •1 R, 6 A, 1 B, 9 A, 8 B, 9 C, 10 C, 10 Result of composition 9 Composition 10 L12 L22 R11 R12 • C, 4 B, 5 C, 4 B, 5 B, 7 P, 3 B, 2 Q, 0 R1∅ R13 •2 A, 8 B, 2 R, 6 B, 9 A, 1 B, 7 P, 3 C, 12 Q, 0 B, 11 A, 1 C, 10 A, 8 C, 12 B, 9 B, 11 R, 6 C, 10 Result of composition 10 iv
5cs.CE
PARAMETRIZING ARF NUMERICAL SEMIGROUPS arXiv:1604.08929v2 [math.AC] 5 Aug 2016 P. A. GARCÍA-SÁNCHEZ, B. A. HEREDIA, H. İ. KARAKAŞ, AND J. C. ROSALES Abstract. We present procedures to calculate the set of Arf numerical semigroups with given genus, given conductor and given genus and conductor. We characterize the Kunz coordinates of an Arf numerical semigroup. We also describe Arf numerical semigroups with fixed Frobenius number and multiplicity up to six. Introduction Du Val showed in [12] how multiplicity sequences of the successive blow-ups of a curve can be used to classify singularities. His approach was geometric in nature and asked, while he was presenting his results in the University of Istambul, if there were an algebraic counterpart of his findings. Arf, who was attending Du Val’s lecture said that the computation of Du Val’s characters could be calculated by algebraic means, and after a week he showed how to do this. The results were published in [1] and later these characters were called Arf Characters of a curve. Arf’s idea was to calculate what Limpan called later in [16] the Arf ring closure of the coordinate ring of the curve, and then its value semigroup (which is an Arf numerical semigroup). The minimal generators of this semigroup are the Arf characters. The idea of using valuations and numerical semigroups to study curves was not new (this was already carried out by Zariski for plane algebraic curves [26]), nor the idea of producing successive blowing ups of the curve (in three dimensions, this was done already by Semple in [24]). Sertöz in [25] presents a historic overview and motivation of the problem (see also his appendix to [2]). Arf numerical semigroups are always of maximal embedding dimension (see [4] for this and other maximal properties on numerical semigroups and one dimensional local rings). This family of numerical semigroups has several nice properties; we summarize some of them. They are closed under finite intersections and if we adjoin to an Arf numerical semigroup its Frobenius number, then the resulting semigroup is again an Arf semigroup ([23]; in other words, the set of Arf numerical semigroups is a Frobenius variety, see [19]). Arf numerical semigroups can be also defined by the patterns [7, 8] x + y − z or 2x − y: for all x, y and z nonnegative integers in the semigroup, if x ≥ y ≥ z, then x+y−z is again in the semigroup. Moreover quotients (or fractions) by positive integers of Arf numerical semigroup are again Arf, see [11]. 2010 Mathematics Subject Classification. 20M14, 11D07, 05A17, 14E15. Key words and phrases. numerical semigroup, Arf, genus, Frobenius number, integer partition. The second author is supported by the Fundação para a Ciência e a Tecnologia (Portuguese Foundation for Science and Technology) through the project UID/MAT/00297/2013 (Centro de Matemática e Aplicações). The authors are supported by the projects MTM2014-55367-P, FQM-343, FQM-5849, and FEDER funds. 1 2 GARCÍA-SÁNCHEZ, HEREDIA, KARAKAŞ, AND ROSALES Also parameters of algebro-geometric codes associated to these semigroups are well understood [9]. Arf semigroups are acute semigroups, that is, the last interval of gaps before the conductor is smaller than the previous interval of gaps [6]. In this manuscript we describe a way to calculate all Arf numerical semigroups with a prescribed genus and/or conductor. This is accomplished by means of Arf sequences, associating to each of these sequences an Arf numerical semigroup. We also characterize the Kunz coordinates of an Arf numerical semigroup. In the last section, with the use of Apéry sets, we show how to parametrically describe all Arf numerical semigroups with fixed Frobenius number and multiplicity up to six. The algorithms presented have been implemented in GAP [13] and will appear in a forthcoming version of the accepted GAP package numericalsgps [10]. The development version of numericalsgps is freely available at https://bitbucket. org/gap-system/numericalsgps. The reader interested in the implementation may have a look at the manual and the file arf-med.gi in the gap folder of the package. 1. Notation We will follow the notation of [21]. The reader interested in plane curves and numerical semigroups can have a look at [3, Chapter 4]. A nice description of one dimensional analytically irreducible local rings and their value semigroups can be found in [4] (we also recommend this manuscript a good explanation on how the terminology used in numerical semigroups comes from Algebraic Geometry). A numerical semigroup S is a submonoid of N, the set of nonnegative integers, under addition and with finite complement in N. A nonnegative integer g not in S is known as a gap of S, and the cardinality of the set of gaps of S, N \ S, is the genus of S (or degree of singularity of S, [4]), denoted g(S). As N \ S has finitely many elements, the set Z \ S (with Z the set of integers) has a maximum, which is known as the Frobenius number of S, F(S). In fact, the conductor of S, denoted here by c(S), is the Frobenius number of S plus one ([4] explains the relationship with the conductor of the semigroup ring associated to S). For a nonempty set of nonnegative integers A we denote by nX o hAi = λa a | λa ∈ N for all a ∈ A , a∈A the submonoid of N generated by A, where the sums have all but finitely many λa equal to zero. We say that A generates S if hAi = S, and that A is a minimal generating system of S if A generates S and no proper subset of A has this property. Every numerical semigroup S has a unique minimal generating system: S ∗ \ (S ∗ + S ∗ ), where S ∗ = S \ {0} [21, Chapter 1]. This minimal generating system must contain the multiplicity of S, denoted m(S), which is the least positive integer in S. The cardinality of S ∗ \ (S ∗ + S ∗ ) is the embedding dimension of S. Since two minimal generators cannot be congruent modulo the multiplicity of S, it follows that the embedding dimension of S is less than or equal to its multiplicity. Numerical semigroups attaining this upper bound are called maximal embedding dimension numerical semigroups. There are many characterizations of the maximal embedding dimension property. One of them is the following (see for instance [4] PARAMETRIZING ARF NUMERICAL SEMIGROUPS 3 or [21, Chapter 2]): a numerical semigroup has maximal embedding dimension if and only if for every x, y ∈ S \ {0}, the integer x + y − m(S) is in S. We are interested in this manuscript in a subfamily of maximal embedding numerical semigroups, which is the set of Arf numerical semigroups. A numerical semigroup has the Arf property if for every x, y, z ∈ S with x ≥ y ≥ z, we have x + y − z ∈ S (from this definition it follows easily that Arf numerical semigroups have maximal embedding dimension). The Arf property on S is equivalent to: 2x − y ∈ S for every x, y ∈ S with x ≥ y. Let I ⊆ Z. We say that I is a relative ideal of S if I + S ⊆ I and there exists an integer i such that i + I ⊆ S. Given I and J ideals of S, the set I −Z J = {z ∈ Z | z + J ⊆ I} is again an ideal of S, as it is nI = {i1 + · · · + in | i1 , . . . , in ∈ I} [4]. The Lipman semigroup of S with respect to I is defined as [ L(S, I) = (nI −Z nI), n∈N and it is also called the semigroup obtained from S by blowing-up I [4, Section I.2]. An ideal I is proper if I ⊆ S. There is only a maximal proper ideal of S with respect to set inclusion, and this ideal is precisely M(S) = S ∗ (so numerical semigroups are “local”). We will refer to L(S) = L(S, S ∗ ) as the Lipman semigroup of S. It can be shown (see for instance [4, I.2.4]) that if {n1 , . . . , ne } = S ∗ \(S ∗ +S ∗ ) is the minimal generating set of S with n1 < · · · < ne , then L(S) = hn1 , n2 − n1 , . . . , ne − n1 i. Example 1. Let S = h3, 5, 7i = {0, 3, 5, →} (here → denotes that all integers larger than 5 are in the semigroup; we are denoting in this way that the conductor of S is 5). Then L(S) = h2, 3i and L(L(S)) = N. We obtain in this way a multiplicity sequence 3, 2, 1 of the successive blowing-ups with respect to the maximal ideal. Observe that in this setting S = {0, 3, 3 + 2, 3 + 2 + 1, →}. If we repeat this calculations with T = h3, 5i, then we have again L(S) = h2, 3i and L(L(S)) = N; whence the multiplicity sequence here is the same. However T is not the semigroup “spanned” by this multiplicity sequence, which in this case is S. The property that pops up in the above example is not accidental. Indeed by [4, Theorem I.3.4], a numerical semigroup S has the Arf property if and only if n o Xn (1) S = 0, m(S), m(S) + m(L(S)), . . . , m(Li (S)), → , i=1 i 0 where L (S) is defined recursively as follows: L (S) = S and for every positive integer i, Li (S) = L(Li−1 (S)). The integer n can be taken to be the minimum such that Ln+1 (S) = N; and so m(Ln (S)) ≥ 2. 2. Arf sequences We say that a sequence of integers (x1 , . . . , xn ) is an Arf sequence provided that • xn ≥ · · · ≥ x1 ≥ 2 and • xi+1 ∈ {xi , xi + xi−1 , . . . , xi + · · · + x1 , →}. The following result (rephrased to our needs) supports this notation. 4 GARCÍA-SÁNCHEZ, HEREDIA, KARAKAŞ, AND ROSALES Proposition 1 ([17, Corollary 39]). Let S be a nonempty proper subset of N. Then S is an Arf numerical semigroup if and only if there exists an Arf sequence (x1 , . . . , xn ) such that S = {0, xn , xn + xn−1 , . . . , xn + · · · + x1 , →}. Proof. Notice that in [17, Corollary 39] the condition on x1 is x1 ≥ 1. Notice that we can omit all xi = 1 in the sequence since in this way the resulting semigroup is the same, and we are considering the multiplicity sequence up to Ln (S) 6= N and Ln+1 (S) = N.  Given an Arf sequence (x1 , . . . , xn ), we will denote by S(x1 , . . . , xn ) the associated Arf numerical semigroup given in Proposition 1, and we will say that it is the Arf numerical semigroup associated to (x1 , . . . , xn ). Hence for every Arf sequence (x1 , . . . , xn ), S(x1 , . . . , xn ) is a numerical semigroup not equal to N and with the Arf property. And given an Arf numerical semigroup S 6= N, according to (1) and Proposition 1, if n is a positive integer such that Ln (S) ( Ln+1 (S) = N, the sequence (m(Ln (S)), m(Ln−1 (S)), . . . , m(S)) is an Arf sequence. This proves the following. Corollary 2. Let S be the set of Arf sequences, and let A be the set of all Arf numerical semigroups. The mapping S : S → A \ {N}, (x1 , . . . , xn ) 7→ S(x1 , . . . , xn ) is a bijection, and its inverse is the map S 7→ (m(Ln (S)), m(Ln−1 (S)), . . . , m(S)). It is then clear that counting Arf numerical semigroups is tightly related to counting Arf sequences. Moreover, if we are looking for numerical semigroups with a prescribed genus or Frobenius number, the following result will be of great help. Proposition 3. Let (x1 , . . . , xn ) be an Arf sequence. Then (i) F(S(x1 , . . . , xn )) = x1 +· · ·+xn −1 (and thus c(S(x1 , . . . , xn )) = x1 +· · ·+xn )), (ii) g(S(x1 , . . . , xn )) = x1 + · · · + xn − n. Proof. In order to ease the notation, set S = S(x1 , . . . , xx ), which by Proposition 1 we know it is an Arf numerical semigroup. From the very construction of S, we have that the conductor of S is at most x1 + · · · + xn . (i) From the above paragraph, it suffices to show that x1 + · · · + xn − 1 6∈ S. But this follows easily from the fact that x1 ≥ 2. (ii) We can explicitly write the set of gaps of S, N \ S = {1, . . . , xn − 1, xn + 1, . . . , xn + xn−1 − 1, . . . , xn + · · · + x2 − 1, xn + · · · + x2 + 1, . . . , xn + · · · + x1 − 1}. It follows that g(S) = (xn −1)+(xn−1 −1)+· · ·+(x1 −1) = x1 +· · ·+xn −n.  3. The set of Arf numerical semigroups with given conductor Let c be a positive integer. In light of Corollary 2 and Proposition 3, in order to calculate the set of Arf numerical semigroups with conductor c we only have to calculate some specific integer partitions of c, and then their images via the map S. We can compute the set of integer partitions of c with the help of [14] or the built-in GAP command partitions, and either filter those having 1’s or while constructing them avoid 1’s in the partition. However, the number of partitions PARAMETRIZING ARF NUMERICAL SEMIGROUPS 5 grows exponentially (for instance NrPartitions(100) in GAP yields 190569292), and then we must choose which partitions are Arf sequences. We do not have, as in the case of saturated numerical semigroups a “next” function that, given an Arf sequence, computes the next in a prescribed ordering [20]. In this section we present an alternative to the approach of computing all partitions and filter those that are Arf sequence. The procedure dynamically calculates the set of all Arf numerical semigroups with conductor less than or equal to C. The main idea is based on the following result, which allows to construct all Arf sequences of length k + 1 from the set of Arf sequences of length k. Its proof follows directly from the definition of Arf sequence. Proposition 4. Let S be the set of all Arf sequences and let k be a positive integer. (i) If (x1 , . . . , xk+1 ) ∈ S, then (x1 , . . . , xk ) ∈ S. (ii) If (x1 , . . . , xk ) ∈ S, then (x1 , . . . , xk , xk+1 ) ∈ S for all xk+1 ∈ S(x1 , . . . , xk )∗ . Let us denote by Sk the set of all Arf sequences of length k, and for a positive integer n, set Sk (n) = {(x1 , . . . , xk ) ∈ Sk | x1 + · · · + xk ≤ n}. As a consequence of the last result and that x1 ≥ 2 we obtain the following. We use (x, y], with x, y ∈ N, to denote the interval of real numbers r such that x < r ≤ y. Corollary 5. Let {bi }i∈N ⊆ N be such that 0 ≤ bi+1 − bi ≤ 2 for all i ∈ N.  (i) S1 (b1 ) = (x1 ) | x1 ∈ {2, . . . , b1 } . (ii) For k ∈ N∗ ,   (x1 , . . . , xk ) ∈ Sk (bk ) P Sk+1 (bk+1 ) = (x1 , . . . , xk+1 ) . k xk+1 ∈ S(x1 , . . . , xk ) ∩ (0, bk+1 − i=1 xi ] In light of Proposition 3 (i) and Corollary 5, for the calculation of set of Arf numerical semigroups with conductor less than or equal to c it is enough to calculate Sk (c) for k ∈ {1, . . . , bc/2c} (notice that the elements in an Arf sequence are greater than or equal to 2). This is described in Algorithm 1. Algorithm 1: ArfNumericalSemigroupsWithConductorUpTo Data: A positive integer c Result: The set of all Arf numerical semigroups with conductor less than or equal to c for k ∈ {1, . . . , bc/2c} do Compute Sk (c) ; /* use Corollary 5 */ Sbc/2c L = k=1 Sk (c); return {N} ∪ {S(x1 , . . . , xn ) | (x1 , . . . , xn ) ∈ L} Figure 1 shows the number of Arf numerical semigroups of Frobenius number up to 100. We already have many functions in the package numericalsgps computing families of numerical semigroups with a given Frobenius number, and thus we decided in our implementation of Arf numerical semigroups with given conductor to use the Frobenius number instead. The calculation of the table took 36 seconds on a laptop. However, we still do not know how many numerical semigroups there 6 GARCÍA-SÁNCHEZ, HEREDIA, KARAKAŞ, AND ROSALES F 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 na(F ) 1 1 2 2 4 3 7 6 10 9 17 12 25 20 32 27 49 34 68 49 80 66 118 77 145 F 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 na(F ) 111 176 138 239 150 298 211 341 268 440 279 535 389 616 448 778 490 936 642 1001 759 1300 808 1496 1028 F 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 na(F ) 1643 1196 2043 1289 2339 1563 2513 1854 3134 1852 3542 2414 3823 2726 4499 2809 5184 3501 5542 3866 6645 3936 7413 4992 7829 F 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 na(F ) 5494 9215 5707 10469 6709 10822 7698 12951 7705 14028 9399 15011 10395 17538 10381 19147 12425 20048 13988 23263 13876 25560 16839 26734 17903 Figure 1. Number of Arf numerical semigroups with Frobenius number up to 100 are with Frobenius number 100; so the approach of considering them all and filtering those that are Arf was rejected from the very beginning. For instance, for F = 35, there are 292081 numerical semigroups; among these, 8959 have maximal embedding dimension and only 440 have the Arf property. Figure 2 compares the number of numerical semigroups with given Frobenius number that are saturated (as calculated in [20]) with those that are Arf. Example 2. Let us compute the set of numerical semigroups with conductor less than or equal to six and with the Arf property. By Figure 1 we already know that we have ten of them (eleven counting N: 1+1+1+2+2+4; we have to go up to Frobenius number 5). As we have pointed above we must calculate Sk (6) for k ∈ {1, 2, 3}. • S1 (6) = {(2), (3), (4), (5), (6)}, • S2 (6) = {(2, 2), (3, 3), (2, 3), (2, 4)}, • S3 (6) = {(2, 2, 2)}. Now we have to translate these sequences to numerical semigroups via the map S. For instance S(2, 3) = {0, 3, 5, →} = h3, 5, 7i. We then obtain • h2, 3i, h3, 4, 5i, h4, 5, 6, 7i, h5, 6, 7, 8, 9i, h6, 7, 8, 9, 10, 11i, PARAMETRIZING ARF NUMERICAL SEMIGROUPS 7 ·104 saturated Arf # numerical semigroups 2.5 2 1.5 1 0.5 0 0 10 20 30 40 50 60 70 80 90 100 Frobenius number Figure 2. Comparison with the number of saturated numerical semigroups • h2, 5i, h3, 7, 8i, h3, 5, 7i, h4, 6, 7, 9i, • h2, 7i. Finally, we have to add N. In a GAP session with the package numericalsgps we would proceed as follows: gap> la5:=ArfNumericalSemigroupsWithFrobeniusNumberUpTo(5);; gap> List(la5,MinimalGeneratingSystem); [ [1], [ 2, 3 ], [ 3 .. 5 ], [ 4 .. 7 ], [ 5 .. 9 ], [ 6 .. 11 ], [ 2, 5 ], [ 3, 5, 7 ], [ 4, 6, 7, 9 ], [ 3, 7, 8 ], [ 2, 7 ] ] As we mentioned in the introduction, adjoining the Frobenius number to an Arf numerical semigroup yields another Arf numerical semigroup. Figure 3 represents the Hasse diagram of all numerical semigroups conductor less than or equal to 6 and with the Arf property. 4. Arf numerical semigroups with given genus As in the previous section we are again interested in Arf sequences with particular characteristics. In this case, by Proposition 3 (ii), the length of the sequence is also relevant. If we fix the genus g, we need to calculate, for every suitable k, Sk (g + k), and then take the union of all of them. Also, in contrast to the conductor case, k can range up to g, since g(S(x1 , . . . , xn )) = x1 + · · · + xn − n ≤ g and xi ≥ 2, forces 2n − n ≤ g, that is, n ≤ g. In order to use recursion we must be able to construct Sk+1 (g + k + 1) from Sk (g + k). We can do this by using Corollary 5 with bi = g + i for all i ∈ N. Algorithm 2 gathers the procedure to calculate all Arf numerical semigroups with genus up to g. 8 GARCÍA-SÁNCHEZ, HEREDIA, KARAKAŞ, AND ROSALES ����� �������� �������� �������� �������������� ����������� �������������� ����������������� ����������� ����������� ���������������������� Figure 3. Hasse diagram of Arf numerical semigroups with conductor up to six. Algorithm 2: ArfNumericalSemigroupsWithGenusUpTo Data: A positive integer g Result: The set of all Arf numerical semigroups with genus less than or equal to g for k ∈ {1, . . . , g} do Compute Sk (g + k) ; /* use Corollary 5 */ Sg L = k=1 Sk (g + k); return {N} ∪ {S(x1 , . . . , xn ) | (x1 , . . . , xn ) ∈ L} Example 3. Let us apply the procedure in this section to calculate all Arf numerical semigroups with genus less than or equal to 5. We have to compute Sg S (g + k). k=1 k • • • • • S1 (5 + 1) = {(2), (3), (4), (5), (6)}, S2 (5 + 2) = {(2, 2), (2, 3), (2, 4), (2, 5), (3, 3), (3, 4)}, S3 (5 + 3) = {(2, 2, 2), (2, 2, 4), (2, 3, 4)}, S4 (5 + 4) = {(2, 2, 2, 2)}, S5 (5 + 5) = {(2, 2, 2, 2, 2)}. Next, we have to compute the image of each of them under S, and finally add N. In GAP, we can do this with the package numericalsgps as follows. gap> lag5:=ArfNumericalSemigroupsWithGenusUpTo(5);; gap> List(lag5,MinimalGeneratingSystem); [ [ 1 ], [ 2, 3 ], [ 2, 5 ], [ 2, 7 ], [ 2, 9 ], [ 2, 11 ], [ 4, 6, 9, 11 ], [ 3, 5, 7 ], [ 3, 8, 10 ], [ 4, 6, 7, 9 ], [ 5, 7, 8, 9, 11 ], [ 3 .. 5 ], [ 3, 7, 8 ], [ 4, 7, 9, 10 ], [ 4 .. 7 ], [ 5 .. 9 ], [ 6 .. 11 ] ] PARAMETRIZING ARF NUMERICAL SEMIGROUPS g 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 na(g) 1 2 3 4 6 8 10 13 17 21 26 31 36 47 55 62 74 87 101 116 133 152 174 196 222 g 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 na(g) 251 284 317 355 393 433 487 538 594 658 721 793 866 946 1037 1138 1234 1338 1452 1584 1720 1861 2008 2164 2332 g 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 na(g) 2504 2694 2904 3131 3358 3605 3851 4112 4391 4699 5022 5365 5705 6074 6472 6881 7307 7767 8240 8740 9265 9813 10386 10999 11620 g 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 9 na(g) 12275 12979 13701 14468 15295 16114 16959 17840 18765 19738 20781 21864 22993 24163 25351 26581 27899 29246 30664 32139 33657 35228 36882 38602 40412 Figure 4. Number of Arf numerical semigroups with genus less than or equal to 100. Notice that in contrast to the sequence of the number of Arf numerical semigroups with given Frobenius number (Figure 1), we see in Figure 4, that in the case of counting with respect to the genus, the resulting sequence is increasing. From [23, Section 2], we know that the tree of Arf numerical semigroups is a binary tree. This tree is constructed as follows. Let A be a nonempty set of positive integers with greatest common divisor one. The intersection of all Arf numerical semigroups containing A is an Arf semigroup (every numerical semigroup containing A must also contain hAi; whence there are only finitely many containing A). We denote by Arf(A) this numerical semigroup. Given an Arf numerical semigroup S, we say that A is an Arf system of generators of S if Arf(A) = S; and it is a minimal Arf system of generators if no proper subset of A has this property. The elements of A are called minimal Arf generators of S. The tree of Arf numerical semigroups is constructed recursively by removing minimal Arf generators greater than the Frobenius number for each semigroup in the tree. Lemma 12 in [23] states that at most two minimal Arf generators are greater than the Frobenius number of an Arf semigroup, and according to its proof these are the Frobenius number plus one and plus two. This is why the tree is 10 GARCÍA-SÁNCHEZ, HEREDIA, KARAKAŞ, AND ROSALES Arf( 1 ) Arf( 2, 3 ) Arf( 2, 5 ) Arf( 2, 7 ) Arf( 2, 13 ) Arf( 3, 4 ) Arf( 4, 5 ) Arf( 2, 9 ) Arf( 4, 6, 7 ) Arf( 2, 11 ) Arf( 4, 6, 9 ) Arf( 4, 7 ) Arf( 4, 6, 11 ) Arf( 4, 9 ) Arf( 6, 8, 9 ) Arf( 3, 5 ) Arf( 5, 6 ) Arf( 6, 7 ) Arf( 7, 8 ) Arf( 3, 7 ) Arf( 5, 7, 8 ) Arf( 3, 8 ) Arf( 5, 7 ) Arf( 5, 8, 9 ) Arf( 3, 10 ) Figure 5. The binary tree of Arf numerical semigroups of genus up to 6. binary. Also, a leaf in this tree is an Arf numerical semigroup with no minimal Arf generators above its Frobenius number. The absence of leafs would explain the increasing of the sequence in Figure 4. However this is not the case, there are plenty of leaves in this tree. For instance, F(Arf(5, 7)) = 8, and consequently Arf(5, 7) is a leaf in the binary tree of Arf numerical semigroups (this example has genus 6, all the semigroups appearing in Example 3 have descendants in the tree). Figure 5 depicts the binary tree of Arf numerical semigroups up to genus 6; the shaded node corresponds to the unique leaf in the tree of all Arf numerical semigroups. Each layer corresponds to a different genus. 5. Fixing the genus and the conductor In this section we are interested in calculating the set of all Arf numerical semigroups with fixed genus g and conductor c. It is well known, and easy to prove, that if S is a numerical semigroup, then 2g(S) ≥ c(S) (see for instance [21, Lemma 2.14]). From the definition of genus and Frobenius number it also follows easily that g(S) ≤ F(S). The only numerical semigroup with genus equal to zero is N; so we may assume that 1 ≤ g ≤ c − 1 < 2g. As a consequence of Proposition 3, we have the following restriction on the lengths of Arf sequences yielding semigroups with prescribed genus g and conductor c. Corollary 6. Let (x1 , . . . , xn ) be an Arf sequence and let S = S(x1 , . . . , xn ). Then n = c(S) − g(S). The correctness of Algorithm 3 follows from the next two observations. If (x1 , . . . , xn ) is an Arf sequence and c(S(x1 , . . . , xn )) = c, then by Proposition 3, c = x1 + · · · + xn . (i) As xn ≥ · · · ≥ x1 , we deduce nx1 ≤ c. This implies x1 ≤ bc/nc. (ii) Also from xn ≥ · · · ≥ xk , we deduce x1 + · · · + xk−1 + (n − (k − 1))xk ≤ c. PARAMETRIZING ARF NUMERICAL SEMIGROUPS 11 Algorithm 3: ArfNumericalSemigroupsWithGenusAndFrobeniusNumber Data: Positive integers g and c with 1 ≤ g ≤ c − 1 < 2g Result: The set of all Arf numerical semigroups with genus g and conductor c n = c − g; L1 = {(x1 ) | x1 ∈ {2, . . . , bc/nc}; for k ∈ {2,  . . . , n} do  (x1 , . . . , xk−1 ) ∈ Lk−1 , xk ∈ S(x1 , . . . , xk−1 )∗ Lk = (x1 , . . . , xk ) ; x1 + · · · + xk−1 + (n − (k − 1))xk ≤ c L = {(x1 , . . . , xn ) ∈ Ln | x1 + · · · + xn = c}; return {S(x1 , . . . , xn ) | (x1 , . . . , xn ) ∈ L} Figure 6 depicts Arf numerical semigroups with genus g ranging from 1 to 20 and conductor from g + 1 to 2g. 6. Kunz coordinates of Arf numerical semigroups Let S be a numerical semigroup and s ∈ S ∗ . Recall that the Apéry set of s in S is defined as Ap(S, s) = {n ∈ S | n − s 6∈ S}. It is well known (see for instance [21, Chapter 1]) that (2) Ap(S, s) = {w(0) = 0, w(1), . . . , w(s − 1)}, w(i) = min{n ∈ S | n mod s = i}, i ∈ {1, . . . , s − 1}. Observe that for every z ∈ Z, there exists k ∈ N and i ∈ {0, . . . , s − 1} such that z = ks + w(i). Moreover, z ∈ S if and only if k ≥ 0 (see [21, Chapter 1]). We will use this well known fact implicitly in this section. If in addition S is an Arf numerical semigroup and m is its multiplicity, then we know that S has maximal embedding dimension and thus (Ap(S, m) \ {0}) ∪ {m} = {m, w(1), . . . , w(m − 1)} is the minimal generating system of S. For every k ∈ {1, . . . , m − 1}, w(k) = xk m + k for some positive integer xk . We say that (x1 , . . . , xm−1 ) are the Kunz coordinates of S [15]. Notice that in this definition we can take k = 0 and obtain x0 = 0. We are not including x0 in the sequence of Kunz coordinates because it is always 0. We will use this implicitly in what follows. We will fix the multiplicity, m, and for an integer i, we will write i = i mod m (the remainder of the division of i by m). Every Arf numerical semigroup has maximal embedding dimension, and thus its Kunz coordinates fulfill the following system of inequalities [22]. (3) xi ≥ 1 xi + xj − xi+j ≥ 1 xi + xj − xi+j ≥ 0 for all i ∈ {1, . . . , m − 1}, for all 1 ≤ i ≤ j ≤ m − 1, i + j ≤ m − 1, for all 1 ≤ i ≤ j ≤ m − 1, i + j > m. Notice also that for every i, j ∈ {0, . . . , m − 1}, w(i) + w(j) ∈ S and w(i) + w(j) ≡ i + j (mod m). Hence w(j) + w(j) = km + w(i + j). This implies that 12 GARCÍA-SÁNCHEZ, HEREDIA, KARAKAŞ, AND ROSALES g 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 1 0 2 2 3 3 6 5 8 8 11 11 15 14 19 19 23 23 1 0 1 1 3 1 5 4 6 5 12 8 16 13 19 18 29 1 0 1 0 3 1 3 2 5 3 10 4 10 8 18 9 1 0 1 1 0 1 0 1 0 1 2 0 1 0 1 2 0 1 4 0 2 0 0 4 0 2 5 1 3 0 2 4 1 3 6 1 5 0 4 7 0 5 11 1 7 1 3 10 1 6 13 4 8 1 conductor from 1 0 1 1 0 1 0 1 0 1 2 0 1 0 0 2 0 1 3 0 2 0 0 3 0 2 4 0 3 0 1 4 0 3 7 0 4 0 g + 1 to 2g 1 0 1 0 2 0 3 1 0 1 0 2 0 1 0 1 0 2 30 25 # Arf 20 15 10 40 5 30 0 2 4 6 20 8 10 12 g 14 16 c 10 18 20 Figure 6. Number of Arf numerical semigroups with genus g and conductor c (w(i) + w(j) − w(i + j))/m ∈ N. So we define the cocycle of S with respect to m as h(i, j) = w(i) + w(j) − w(i + j) . m Next we see how the Arf condition is written in terms of cocycles. Given a rational number q, denote by dqe = min(Z ∩ [q, ∞)), bqc = max(Z ∩ (−∞, q]). 1 0 1 0 1 0 1 1 0 1 PARAMETRIZING ARF NUMERICAL SEMIGROUPS 13 Lemma 7. Let S be a numerical semigroup with multiplicity m. Then S is an Arf numerical semigroup if and only if for every i, j ∈ {0, . . . , m − 1}, (i) if d(w(i) − w(j))/me ≥ 0,   w(i) − w(j) ≥ 0; (4) h(j, j) − h(2j − i, i) + 2 m (ii) if d(w(i) − w(j))/me < 0,   w(i) − w(j) h(j, j) − h(2j − i, i) + ≥ 0. m (5) Proof. Suppose S is an Arf numerical semigroup. For any i, j ∈ {0, . . . , m − 1}, e. Then w(j) + mt ≥ w(i). define t = d w(i)−w(j) m If w(i) ≥ w(j), then w(j) + mt, w(i) ∈ S. By the Arf property 2w(j) + 2mt − w(i) ∈ S. This element can be expressed as 2w(j) − w(i) + 2tm = w(2j − i) + (h(j, j) − h(2j − i, i) + 2t)m, and so it belongs to S if and only if h(j, j) − h(2j − i, i) + 2t ≥ 0. Now if w(i) < w(j), then w(j) ≥ w(i) − mt, and w(j), w(i) − mt ∈ S. By the Arf property we deduce in this case that 2w(j) + tm − w(i) ∈ S. Arguing as above we deduce that this occurs if and only if h(j, j) − h(2j − i, i) + t ≥ 0. For the converse, let x ≥ y ∈ S. We can write x = w(j) + am, y = w(i) + bm for some i, j ∈ {0, . . . , m − 1} and a, b ∈ N. Put again t = d w(i)−w(j) e. Then m 2x − y = 2w(j) + 2am − w(i) − bm = w(2j − i) + (h(j, j) − h(2j − i, i) + 2a − b)m. By the condition x ≥ y, we have w(j)+am ≥ w(i)+bm, and consequently a−b ≥ t. If t ≥ 0, as 2a − b ≥ 2(a − b) ≥ 2t, we deduce h(j, j) − h(2j − i, i) + 2a − b ≥ h(j, j) − h(2j − i, i) + 2t, which by (4) is nonnegative. This forces 2x − y ∈ S. If t < 0, then 2a − b = a + a − b ≥ a − b ≥ t. Arguing as in the preceding case, (4) ensures that 2x − y ∈ S.  Let us now translate cocycles to the language of Kunz coordinates. Lemma 8. Let S be a numerical semigroup with multiplicity m and Kunz coordinates (x1 , . . . , xm−1 ).   i+j h(i, j) = xi + xj − xi+j + . m Proof. By definition h(i, j) = (w(i) + w(j) − w(i + j))/m. This can be expressed in terms of Kunz coordinates as h(i, j) = (xi m + i + xj m + j − xi+j m − i + j)/m = xi + xj − xi+j + (i + j − i + j)/m. The proof now follows from the equality (i + j − i + j)/m = b(i + j)/mc.  Notice also that (6) d(w(i) − w(j))/me = xi − xj + d(i − j)/me With this and Lemma 8 we can translate Lemma 7 to Kunz coordinates. Proposition 9. Let S be sa numerical semigroup with multiplicity m and Kunz coordinates (x1 , . . . , xm−1 ). Then S has the Arf property if and only if for any i, j ∈ {0, . . . , m − 1}, 14 GARCÍA-SÁNCHEZ, HEREDIA, KARAKAŞ, AND ROSALES (i) if xi + d(i − j)/me ≥ xj ,  (7) xi − x2j−i + 2      2j − i + i 2j i−j + − ≥ 0; m m m (ii) if xi + d(i − j)/me < xj ,       2j 2j − i + i i−j + − ≥ 0. (8) xj − x2j−i + m m m Proof. From Lemma 8 and (6) we obtain   w(i) − w(j) h(j, j) − h(2j − i, i) + 2 = 2xj − x2j + b2j/mc m − x2j−i − xi + x2j − b(2j − i + i)/mc + 2(xi − xj ) + 2d(i − j)/me = xi − x2j−i + 2d(i − j)/me + b2j/mc − b(2j − i + i)/mc, and  w(i) − w(j) = 2xj − x2j + b2j/mc h(j, j) − h(2j − i, i) + m  − x2j−i − xi + x2j − b(2j − i + i)/mc + (xi − xj ) + d(i − j)/me = xj − x2j−i + d(i − j)/me + b2j/mc − b(2j − i + i)/mc. Now we apply Lemma 7 and we are done.  7. Arf numerical semigroups with low multiplicity In this section we focus on the parametrization of Arf numerical semigroups with multiplicity up to six and given conductor. To this end, we need some preliminary results. The following well known result will be used to provide upper bounds for the conductor of a numerical semigroup. Lemma 10 ([23]). Let S be an Arf numerical semigroup with conductor c, and let s be any element of S. If s + 1 ∈ S, then s + k ∈ S for all k ∈ N and thus c ≤ s. By Selmer’s formulas (see for instance [21, Chapter 1]), we know that the Frobenius number of S is max Ap(S, m) − m. Lemma 11. Let S be an Arf numerical semigroup with multiplicity m and conductor c. For each j ∈ {2, 3, . . . , m − 1}, we have (i) if w(j − 1) < w(j), then c ≤ w(j) − 1, (ii) if w(j) < w(j − 1), then c ≤ w(j − 1). Proof. (i) If w(j −1) < w(j), then w(j)−w(j −1)−1 is a nonnegative multiple of m and therefore it is an element of S. Thus w(j − 1) + (w(j) − w(j − 1) − 1) = w(j) − 1 and w(j) are both elements of S. Lemma 10 forces c ≤ w(j) − 1. PARAMETRIZING ARF NUMERICAL SEMIGROUPS 15 (ii) If w(j) < w(j − 1), then, as above, w(j − 1) − w(j) + 1 ∈ S. Thus w(j) + (w(j −1)−w(j)+1) = w(j −1)+1 and w(j) are both elements of S. So, c ≤ w(j −1) by Lemma 10.  This has the corresponding consequence on Kunz coordinates. Corollary 12. Let S be an Arf numerical semigroup with multiplicity m, conductor c and Kunz coordinates (x1 , . . . , xm−1 ). For every i ∈ {2, . . . , m − 1}, (i) if xi−1 ≤ xi , then (ii) if xi ≤ xi−1 , then c−i+1 m c−i+1 m ≤ xi ; ≤ xi−1 . Proof. If xi−1 ≤ xi , then xi−1 m + i − 1 ≤ xi m + i − 1, whence w(i − 1) < w(i). ≤ xi . The Therefore, c ≤ w(i) − 1 by Lemma 11. Hence c ≤ xi m + i − 1 and c−i+1 m proof of (ii) is similar.  Let S be a numerical semigroup with multiplicity m and conductor c. As every nonnegative multiple of m is in S and c − 1 6∈ S, it follows that c 6≡ 1 (mod m). The following lemma shows that w(1) and w(m − 1) are completely determined by the conductor and m in an Arf numerical semigroup. Lemma 13. Let S be an Arf numerical semigroup with multiplicity m and conductor c. ( c+1 if c ≡ 0 (mod m), (i) w(1) = c − c + m + 1 otherwise. (ii) w(m − 1) = c − c + m − 1. Proof. We know that c ∈ {0, 2, . . . , m − 1}. Let us first consider the case c = 0. Since ms ∈ S for all s ∈ N, ms + 1 6∈ S and c c ms + m − 1 6∈ S for s < m by Lemma 10. Hence w(1) = m · m + 1 = c + 1 and c w(m − 1) = m · m + m − 1 = c + m − 1. This proves (i) and (ii) when c = 0. It remains to prove (i) and (ii) for the case c 6= 0. Again since ms ∈ S for all s ∈ N, Lemma 10 implies that ms + 1 6∈ S for s ≤ c−c m and ms + m − 1 6∈ S for c−c s < c−c c + m + 1 and w(m − 1) = . Therefore, w(1) = m · ( + 1) + 1 = c − m m m · c−c + m − 1 = c − c + m − 1 when c = 6 0. This completes the proof.  m Let us translate Lemma 13 to the language of Kunz coordinates. Corollary 14. Let S be an Arf numerical semigroup with multiplicity m and conductor c. Then, lcm jck (9) x1 = , xm−1 = . m m Proof. If c = 0, then we know that w(1) = x1 m + 1 = c + 1, whence x1 = c/m. Also, w(m − 1) = xm−1 m + m − 1 = c + m − 1. Hence xm−1 = c/m. If c 6= 0, then w(1) = x1 m + 1 = c − c + m + 1. Thus, x1 = (c − c)/m + 1. In this setting, w(m − 1) = xm−1 m + m − 1 = c − c + m − 1. Hence xm−1 = (c − c)/m.  Lemma 15. Let S be an Arf numerical semigroup with multiplicity m > 2. For any integer k with 0 < k < m 2 , we have w(2k) ≤ w(k) + k and w(m − 2k) ≤ w(m − k) + m − k. 16 GARCÍA-SÁNCHEZ, HEREDIA, KARAKAŞ, AND ROSALES Proof. Let m > 2 and let 0 < k < m 2 . Note that w(k)−k is a (non negative) multiple of m and thus it is an element of S. Therefore 2w(k) − (w(k) − k) = w(k) + k ∈ S by the Arf property. This implies w(2k) ≤ w(k) + k since w(k) + k ≡ 2k (mod m). Similarly, 2w(m − k) − (w(m − k) − (m − k)) = w(m − k) + (m − k) ∈ S which implies w(m − 2k) ≤ w(m − k) + (m − k).  As a consequence of Lemma 15, in the Arf setting, we can add more inequalities to the above system of inequalities. Corollary 16. Let S be an Arf numerical semigroup with Kunz coordinates (x1 , . . . , xn ). Then for every integer k with 0 < k < m 2, (10) x2k ≤ xk and xm−2k ≤ xm−k + 1. Proof. Notice that w(2k) = x2k m+2k ≤ w(k)+k = (xk m+k)+k, and so x2k ≤ xk . For the other inequality, observe that w(m − 2k) = xm−2k m + m − 2k ≤ w(m − k) + m − k = (xm−k m + m − k) + m − k = (xm−k + 1)m + m − 2k, and consequently xm−2k ≤ xm−k + 1.  7.1. Arf numerical semigroups with multiplicity one. The only numerical semigroup with multiplicity one is N, which is trivially Arf. 7.2. Arf numerical semigroups with multiplicity two. Numerical semigroups with multiplicity 2 are completely determined by their conductor. In fact, if S is a numerical semigroup with multiplicity 2 and conductor c, then c is an even number and S = h2, c + 1i. It is easily seen by directly applying the Arf pattern that every numerical semigroup with multiplicity 2 is an Arf numerical semigroup. 7.3. Arf numerical semigroups with multiplicity three. Numerical semigroups with multiplicity 3 or more are not completely determined by their conductor alone. The genus is needed to completely determine them [18]. In that paper, formulas for the number of numerical semigroups with multiplicity 3 having a prescribed Frobenius number or genus are given. As we see next, if the Arf property is assumed, then the semigroup is fully determined by the multiplicity and the conductor. Proposition 17. Let c be an integer such that c ≥ 3 and c 6≡ 1 (mod 3). Then there is exactly one Arf numerical semigroup S with multiplicity 3 and conductor c given by (i) S = h3, c + 1, c + 2i if c ≡ 0 (mod 3), (ii) S = h3, c, c + 2i if c ≡ 2 (mod 3). Proof. (i) If c ≡ 0 (mod 3), then w(1) = c + 1 and w(2) = c + 2 by Lemma 13. Thus S = h3, c + 1, c + 2i. (ii) If c ≡ 2 (mod 3), then w(1) = c + 2 and w(2) = c by Lemma 13. Hence S = h3, c, c + 2i.  Example 4. The only Arf numerical semigroup with multiplicity 3 and Frobenius number 10 (conductor 11) is h3, 11, 13i = {0, 3, 6, 9, 11, →}. The only Arf numerical semigroup with multiplicity 3 and Frobenius number 11 (conductor 12) is h3, 13, 14i = {0, 3, 6, 9, 12, →}. PARAMETRIZING ARF NUMERICAL SEMIGROUPS 17 7.4. Arf numerical semigroups with multiplicity four. In [18], it is shown that numerical semigroups with multiplicity 4 are completely determined by their genus, Frobenius number and ratio (the least minimal generator greater than the multiplicity). Formulas for the number of numerical semigroups with multiplicity 4 and given genus and/or Frobenius number are also presented in that paper. Of course all those formulas can be expressed by using the conductor instead of the Frobenius number. Also in [5] formulas for the number of numerical semigroups with multiplicity 4 and fixed Frobenius number are given; these are obtained by means of short generating functions (also if we fix the genus and the Frobenius number). Let S be an Arf numerical semigroup with multiplicity 4 and conductor c. Then c ≡ 0, 2 or 3 (mod 4). The following proposition describes all Arf numerical semigroups with multiplicity 4 and conductor c. Proposition 18. Let conductor c. (i) If c ≡ 0 (mod 4), (ii) If c ≡ 2 (mod 4), (iii) If c ≡ 3 (mod 4), S be an Arf numerical semigroup with multiplicity 4 and then S = h4, 4t + 2, c + 1, c + 3i for some t ∈ {1, . . . , 4c }. then S = h4, 4t + 2, c + 1, c + 3i for some t ∈ {1, . . . , c−2 4 }. then S = h4, c, c + 2, c + 3i. Proof. We first note that all the semigroups given in the proposition are Arf numerical semigroups. Let S be an Arf numerical semigroup with multiplicity 4 and conductor c. As we have already noted, c ≡ k (mod m) where k ∈ {0, 2, 3}. We have w(3) = c − k + 3 and ( c+1 if k = 0, w(1) = c − k + 5 if k 6= 0, by Lemma 13. (i) If c ≡ 0 (mod 4), then w(1) = c + 1 and w(3) = c + 3, which by Selmer’s formulas is the largest element of Ap(S, 4). Since w(2) < c + 3, we conclude that w(2) = 4t + 2 with 1 ≤ t ≤ 4c . Thus we have S = h4, 4t + 2, c + 1, c + 3i, 1 ≤ t ≤ 4c . (ii) If c ≡ 2 (mod 4), then w(3) = c + 1 and w(1) = c + 3. In this setting, w(1) = c + 3 is the largest element of Ap(S, 4). Therefore w(2) < c + 3, which implies that w(2) = 4t+2 with 1 ≤ t ≤ c−2 4 . Thus we have S = h4, 4t+2, c+1, c+3i, c−2 for some integer t with 1 ≤ t ≤ 4 . (iii) If c ≡ 3 (mod 4), then w(3) = c and w(1) = c + 2. In this case c + 3 = w(2) is the largest element of Ap(S, 4). Thus S = h4, c, c + 2, c + 3i.  Proposition 18 can be used to count Arf numerical semigroups with multiplicity 4 and conductor c. Compare this result with the formula obtained for maximal embedding dimension numerical semigroups with fixed Frobenius number and genus, and multiplicity 4 given in [5]. Let nA (c, m) denote the number of Arf numerical semigroups with multiplicity m and conductor c. Corollary 19. Let c be an integer such  c  4 c−2 nA (c, 4) = 4   1 that c ≥ 4 and c 6≡ 1 (mod 4). Then if c ≡ 0 (mod 4), if c ≡ 2 (mod 4), if c ≡ 3 (mod 4). 18 GARCÍA-SÁNCHEZ, HEREDIA, KARAKAŞ, AND ROSALES Example 5. The five Arf numerical semigroups with multiplicity 4 and conductor 20 (Frobenius number 19) are h4, 6, 21, 23i = {0, 4, 6, 8, 10, 12, 14, 16, 18, 20, →}, h4, 10, 21, 23i = {0, 4, 8, 10, 12, 14, 16, 18, 20, →}, h4, 14, 21, 23i = {0, 4, 8, 12, 14, 16, 18, 20, →}, h4, 18, 21, 23i = {0, 4, 8, 12, 16, 18, 20, →}, h4, 21, 22, 23i = {0, 4, 8, 12, 16, 20, →i. The five Arf numerical semigroups with multiplicity 4 and conductor 22 (Frobenius number 21) are h4, 6, 23, 25i = {0, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, →}, h4, 10, 23, 25i = {0, 4, 8, 10, 12, 14, 16, 18, 20, 22, →}, h4, 14, 23, 25i = {0, 4, 8, 12, 14, 16, 18, 20, 22, →}, h4, 18, 23, 25i = {0, 4, 8, 12, 16, 18, 20, 22, →}, h4, 22, 23, 25i = {0, 4, 8, 12, 16, 20, 22, →}. The only Arf numerical semigroup with multiplicity 4 and conductor 23 (Frobenius number 22) is h4, 23, 25, 26i = {0, 4, 8, 12, 16, 20, 23, →}. 7.5. Arf Numerical Semigroups with multiplicity five. Let S be an Arf numerical semigroup with multiplicity 5 and conductor c. Then c ≡ 0, 2, 3 or 4 (mod 5)) and the following proposition describes all Arf numerical semigroups S with multiplicity 5 and conductor c. Proposition 20. Let S be an Arf numerical semigroup S with multiplicity 5 and conductor c. (i) If c ≡ 0 (mod 5), then either S = h5, c − 2, c + 1, c + 2, c + 4i or S = h5, c + 1, c + 2, c + 3, c + 4i. (ii) If c ≡ 2 (mod 5), then S = h5, c, c + 1, c + 2, c + 4i. (iii) If c ≡ 3 (mod 5), then S = h5, c, c + 1, c + 3, c + 4i. (iv) If c ≡ 4 (mod 5), then either S = h5, c − 2, c, c + 2, c + 4i or S = h5, c, c + 2, c + 3, c + 4i. Proof. We first note that all the semigroups given in the proposition are Arf numerical semigroups. Let S be an Arf numerical semigroup with multiplicity 5 and conductor c. As we have already noted, c − 1 cannot be a multiple of 5. So, c ≡ k (mod m) for some k ∈ {0, 2, 3, 4}. Lemma 13 asserts that w(4) = c − k + 4 and ( c+1 if k = 0, w(1) = c − k + 6 if k 6= 0. Moreover, applying Lemma 15 (11) w(4) ≤ w(2) + 2, and from w(1) = w(5 − 4) ≤ w(5 − 2) + (5 − 2) = w(3) + 3 we get (12) w(1) ≤ w(3) + 3. Let us also note that w(i) ≤ c + 4 for all i ∈ {1, 2, 3, 4}. PARAMETRIZING ARF NUMERICAL SEMIGROUPS 19 (i) If c ≡ 0 (mod 5), then w(1) = c + 1 and w(4) = c + 4. In light of inequality (11), we get c + 4 = w(4) ≤ w(2) + 2 ≤ c + 6 which implies w(2) = c + 2. Similarly, using (12), we get c+1 = w(1) ≤ w(3)+3 ≤ c+7, which yields c−2 ≤ w(3) ≤ c+4. This implies w(3) = c − 2 or w(3) = c + 3. It follows that S = h5, c − 2, c + 1, c + 2, c + 4i or S = h5, c + 1, c + 2, c + 3, c + 4i. (ii) If c ≡ 2 (mod 5), then w(1) = c + 4 and w(4) = c + 2. Using inequality (11), we get c + 2 = w(4) ≤ w(2) + 2 ≤ c + 6, which gives c ≤ w(2) ≤ c + 4. Consequently, w(2) = c. Analogously, from (12), we get c + 4 = w(1) ≤ w(3) + 3 ≤ c + 7, which yields c + 1 ≤ w(3) ≤ c + 4 and this implies w(3) = c + 1. It follows that S = h5, c, c + 1, c + 2, c + 4i. (iii) If c ≡ 3 (mod 5), then w(1) = c + 3 and w(4) = c + 1. In this case, c + 4 = w(2) is the largest element of Ap(S, 5). As before, (12) yields c + 3 = w(1) ≤ w(3) + 3 ≤ c + 7, and thus c ≤ w(3) ≤ c + 4. Hence w(3) = c, and S = h5, c, c + 1, c + 3, c + 4i. (iv) If c ≡ 4 (mod 5), then w(1) = c+2 and w(4) = c. In this case, c+4 = w(3) is the largest element of Ap(S, 5). Applying (11), we get c = w(4) ≤ w(2) + 2 ≤ c + 6, whence c − 2 ≤ w(2) ≤ c + 4. Thus w(2) = c − 2 or w(2) = c + 3. It follows that S = h5, c − 2, c, c + 2, c + 4i or S = h5, c, c + 2, c + 3, c + 4i.  As a consequence of Proposition 20, we can count the number of Arf numerical semigroups with multiplicity 5 and conductor c, with c an integer greater than or equal to five and c 6≡ 1 (mod 5). Corollary 21. Let c be an integer such that c ≥ 5 and c 6≡ 1 (mod 5)). Then ( 2 if c ≡ 0 (mod 5) or c ≡ 4 (mod 5), nA (c, 5) = 1 if c ≡ 2 (mod 5) or c ≡ 3 (mod 5). Example 6. The two Arf numerical semigroups with multiplicity 5 and conductor 30 (Frobenius number 29) are h5, 28, 31, 32, 34i = {0, 5, 10, 15, 20, 25, 28, 30, →} and h5, 31, 32, 33, 34i = {0, 5, 10, 15, 20, 25, 30 →}. gap> l:=NumericalSemigroupsWithFrobeniusNumber(29);; gap> l5:=Filtered(l,s->MultiplicityOfNumericalSemigroup(s)=5);; gap> Filtered(l5,IsArfNumericalSemigroup); [ <Numerical semigroup with 5 generators>, <Numerical semigroup with 5 generators> ] gap> List(last,MinimalGenerators); [ [ 5, 28, 31, 32, 34 ], [ 5, 31, 32, 33, 34 ] ] The only Arf numerical semigroup with multiplicity 5 and conductor 32 (Frobenius number 31) is h5, 32, 33, 34, 36i = {0, 5, 10, 15, 20, 25, 30, 32, →}. The only Arf numerical semigroup with multiplicity 5 and conductor 33 (Frobenius number 32) is h5, 33, 34, 36, 37i = {0, 5, 10, 15, 20, 25, 30, 33 →}. The two Arf numerical semigroups with multiplicity 5 and conductor 34 (Frobenius number 33) are h5, 32, 34, 36, 38i = {0, 5, 10, 15, 20, 25, 30, 32, 34, →}, h5, 34, 36, 37, 38i = {0, 5, 10, 15, 20, 25, 30, 34, →}. 20 GARCÍA-SÁNCHEZ, HEREDIA, KARAKAŞ, AND ROSALES 7.6. Arf Numerical Semigroups with multiplicity six. To determine all Arf numerical semigroups with multiplicity 6 and a given conductor c, we will make use of the ratio of a numerical semigroup. Recall that for a given numerical semigroup S, the ratio is the smallest integer in S that is not a multiple of its multiplicity, or in other words, the smallest minimal generator greater than the multiplicity [18]. We will use r to denote the ratio of S. Let S be an Arf numerical semigroup with multiplicity 6 and conductor c. Then c ≡ 0, 2, 3, 4 or 5 (mod 6)). Since c + 5 is the largest element of the minimal set of generators of S, as the second least element of the minimal set of generators for S, the ratio of S satisfies r ≤ c + 1. The following proposition describes all Arf numerical semigroups S with multiplicity 6 and conductor c. Proposition 22. Let S be an Arf numerical semigroup with multiplicity 6 and conductor c. (i) If c ≡ 0 (mod 6), then S equals one of the following numerical semigroups h6, c + 1, c + 2, c + 3, c + 4, c + 5i, h6, 6u + 2, 6u + 4, c + 1, c + 3, c + 5i, h6, 6u + 3, c + 1, c + 2, c + 4, c + 5i, h6, 6u + 4, 6u + 8, c + 1, c + 3, c + 5i, for some integer u such that 1 ≤ u ≤ 6c − 1. (ii) If c ≡ 2 (mod 6), then S is of one of the following forms h6, 6t + 2, 6t + 4, c + 1, c + 3, c + 5i, h6, 6u + 3, c, c + 2, c + 3, c + 5i, h6, 6u + 4, 6u + 8, c + 1, c + 3, c + 5i, for some integers t and u with 1 ≤ t ≤ (iii) If c ≡ 3 (mod 6), then c−2 6 and 1 ≤ u ≤ c−2 6 − 1. S = h6, 6t + 3, c + 1, c + 2, c + 4, c + 5i, for some integer t such that 1 ≤ t ≤ c−3 6 . (iv) If c ≡ 4 (mod 6), then S is equal to one of the following numerical semigroups h6, 6t + 2, 6t + 4, c + 1, c + 3, c + 5i, h6, 6t + 4, 6t + 8, c + 1, c + 3, c + 5i, for some integer t with 1 ≤ t ≤ c−4 6 . (v) If c ≡ 5 (mod 6)), then S is of one of the following forms h6, c, c + 2, c + 3, c + 4, c + 5i, h6, 6t + 3, c, c + 2, c + 3, c + 5i, for some integer t with 1 ≤ t ≤ c−5 6 . Proof. We first note that all the semigroups given in the proposition are Arf numerical semigroups. Let S be an Arf numerical semigroup with multiplicity 6 and conductor c. As we have already mentioned, c ≡ k (mod 6) for some k ∈ {0, 2, 3, 4, 5}. By Lemma PARAMETRIZING ARF NUMERICAL SEMIGROUPS 21 13, we have w(5) = c − k + 5 and ( c+1 if k = 0, w(1) = c − k + 7 if k 6= 0. (13) Also, w(4) ≤ w(2) + 2 and w(2) = w(6 − 4) ≤ w(6 − 2) + (6 − 2) = w(4) + 4 by Lemma 15. Combining these two inequalities we get w(4) − 2 ≤ w(2) ≤ w(4) + 4. (14) Let us also note that w(i) ≤ c + 5 for all i ∈ {1, 2, 3, 4, 5}. (i) If c ≡ 0 (mod 6), then w(1) = c + 1 and w(5) = c + 5 by (13). The ratio r of S is one of w(1) = c + 1, w(2), w(3) or w(4). – If r = c + 1, then w(2) = c + 2, w(3) = c + 3, w(4) = c + 4, and consequently S = h6, c + 1, c + 2, c + 3, c + 4, c + 5i. – If r = w(2), then w(2) < c, w(2) < w(3) and w(2) < w(4) by the definition of ratio. Hence w(3) = c + 3 by Lemma 11 and w(2) = w(4) − 2 or equivalently, w(4) = w(2) + 2 by (14). Write w(2) = 6u + 2. Then w(4) = 6u + 4 and S = h6, 6u + 2, 6u + 4, c + 1, c + 3, c + 5i, c 6 with 1 ≤ u ≤ − 1. – If r = w(3), then w(3) < c. Also w(3) < w(2) and w(3) < w(4) by the definition of ratio. Hence w(2) = c + 2 and w(4) = c + 4 by Lemma 11. By setting w(3) = 6u + 3, we get S = h6, 6u + 3, c + 1, c + 2, c + 4, c + 5i, with 1 ≤ u ≤ 6c − 1. – If r = w(4), then the definition of ratio forces w(4) < c, w(4) < w(3) and w(4) < w(2). Hence w(3) = c + 3 by Lemma 11 and w(2) = w(4) + 4 by (14). Put w(4) = 6u + 4. Then w(2) = 6u + 8 and we have S = h6, 6u + 4, 6u + 8, c + 1, c + 3, c + 5i, with 1 ≤ u ≤ c 6 − 1. (ii) If c ≡ 2 (mod 6), then w(1) = c + 5 and w(5) = c + 3 by (13). Also we have in this setting that r ∈ {w(2), w(3), w(4)}. – If r = w(2), the definition of ratio yields w(2) ≤ c, w(2) < w(3) and w(2) < w(4). Hence w(3) = c + 1 by Lemma 11, and w(2) = w(4) − 2, or equivalently, w(4) = w(2) + 2 by (14). Write w(2) = 6t + 2. Then w(4) = 6t + 4 and we obtain S = h6, 6t + 2, 6t + 4, c + 1, c + 3, c + 5i, with 1 ≤ t ≤ c−2 6 . – If r = w(3), then w(3) < w(2) and w(3) < w(4) by the definition of the ratio. Hence w(4) = c + 2 and w(2) = c by Lemma 11. Note also that w(3) ≤ c − 5, since w(3) < c and w(3) ≡ c + 1 (mod 6). By denoting w(3) = 6u + 3, we get S = h6, 6u + 3, c, c + 2, c + 3, c + 5i, where 1 ≤ u ≤ c−2 6 − 1. 22 GARCÍA-SÁNCHEZ, HEREDIA, KARAKAŞ, AND ROSALES – If r = w(4), then w(4) < c, w(4) < w(2) and w(4) < w(3) by the definition of ratio. Hence w(3) = c + 1 by Lemma 11, and w(2) = w(4) + 4 by (14). Put w(4) = 6u + 4. Then w(2) = 6u + 8, and we have S = h6, 6u + 4, 6u + 8, c + 1, c + 3, c + 5i, with 1 ≤ u ≤ c−2 6 − 1. (iii) If c ≡ 3 (mod 6), then w(1) = c + 4 and w(5) = c + 2 by (13). In this case, c + 5 = w(2) is the largest element in Ap(S, 6). Using (14), c + 5 = w(2) ≤ w(4) + 4 which implies c + 1 ≤ w(4) and thus w(4) = c + 1. Therefore, the only possibility for the ratio is r = w(3) and if we express w(3) = 6t + 3, we get S = h6, 6t + 3, c + 1, c + 2, c + 4, c + 5i, where 1 ≤ t ≤ c−3 6 . (iv) If c ≡ 4 (mod 6), then w(1) = c + 3 and w(5) = c + 1 by (13). In this case, c + 5 = w(3) is the largest element of Ap(S, 6). Since w(4) ≤ c, the ratio r of S is either w(2) or w(4). – If r = w(2), then w(2) < w(4) and thus w(4) = w(2) + 2 by (14). Write w(2) as w(2) = 6t + 2. Then w(4) = 6t + 4 and S = h6, 6t + 2, 6t + 4, c + 1, c + 3, c + 5i, with 1 ≤ t ≤ c−4 6 . – If r = w(4), then w(4) < w(2) and thus w(2) = w(4) + 4 by (6.2). Put w(4) = 6t + 4. Then w(2) = 6t + 8 and S = h6, 6t + 4, 6t + 8, c + 1, c + 3, c + 5i where 1 ≤ t ≤ c−4 6 . (v) If c ≡ 5 (mod 6), then w(1) = c + 2 and w(5) = c by (13). In this case, c + 5 = w(4) is the largest element of Ap(S, 6). Using (14), we obtain c + 5 = w(4) ≤ w(2) + 2 and then c + 3 ≤ w(2). This implies w(2) = c + 3. Therefore, either r = w(5) = c or r = w(3). – If r = c, then S = h6, c, c + 2, c + 3, c + 4, c + 5i. – If r = w(3) and if we put w(3) = 6t + 3, then S = h6, 6t + 3, c, c + 2, c + 3, c + 5i, where 1 ≤ t ≤ c−5 6 .  If c is an integer such that c ≥ 6 and c 6≡ 1 (mod 6)), then Proposition 22 can be used to count Arf numerical semigroups with multiplicity 6 and conductor c. Corollary 23. Let c be an integer such that  c  if  2 −2   c−2   − 2 if  2 c−3 nA (c, 6) = if 6    c−4 if  3    c+1 if 6 c ≥ 6 and c 6≡ 1 (mod 6)). Then c≡0 c≡2 c≡3 c≡4 c≡5 (mod (mod (mod (mod (mod 6), 6), 6), 6), 6). PARAMETRIZING ARF NUMERICAL SEMIGROUPS 23 Example 7. The 13 Arf numerical semigroups with multiplicity 6 and conductor 30 (Frobenius number 29) are h6, 31, 32, 33, 34, 35i = {0, 6, 12, 18, 24, 30, →}, h6, 8, 10, 31, 33, 35i = {0, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, →}, h6, 14, 16, 31, 33, 35i = {0, 6, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, →}, h6, 20, 22, 31, 33, 35i = {0, 6, 12, 18, 20, 22, 24, 26, 28, 30, →}, h6, 26, 28, 31, 33, 35i = {0, 6, 12, 18, 24, 26, 28, 30, →}, h6, 9, 31, 32, 34, 35i = {0, 6, 9, 12, 15, 18, 21, 24, 27, 30, →}, h6, 15, 31, 32, 34, 35i = {0, 6, 12, 15, 18, 21, 24, 27, 30, →}, h6, 21, 31, 32, 34, 35i = {0, 6, 12, 18, 21, 24, 27, 30, →}, h6, 27, 31, 32, 34, 35i = {0, 6, 12, 18, 24, 27, 30, →}, h6, 10, 14, 31, 33, 35i = {0, 6, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, →}, h6, 16, 20, 31, 33, 35i = {0, 6, 12, 16, 18, 20, 22, 24, 26, 28, 30, →}, h6, 22, 26, 31, 33, 35i = {0, 6, 12, 18, 22, 24, 26, 28, 30, →}, h6, 28, 32, 31, 33, 35i = {0, 6, 12, 18, 24, 28, 30, →}. References [1] C. Arf, Une interprétation algébrique de la suite des ordres de multiplicité d’une branche algébrique, Proc. London Math. Soc., Series 2, 50 (1949), 256 - 287. [2] The Collected Papers of Cahit Arf, Turkish Mathematical Society, 1990. [3] A. Assi, P. A. Garcı́a-Sánchez, Numerical semigroups and applications, arXiv:1411.6093. [4] V. Barucci, D. E. Dobbs, M. Fontana, Maximality Properties in Numerical Semigroups and Applications to One-Dimensional Analytically Irreducible Local Domains, Memoirs of the Amer. Math. Soc. 598 (1997). [5] V. Blanco, P. A. Garca-Snchez and J. Puerto, Counting numerical semigroups with short generating functions, Internat. J. Algebra Comput. 21 (2011), 1217-1235. [6] Bras-Amors, Maria Acute semigroups, the order bound on the minimum distance, and the Feng-Rao improvements. IEEE Trans. Inform. Theory 50 (2004), 1282-1289. [7] Maria, Bras-Amors, Improvements to evaluation codes and new characterizations of Arf semigroups. Applied algebra, algebraic algorithms and error-correcting codes (Toulouse, 2003), 204-215, Lecture Notes in Comput. Sci., 2643, Springer, Berlin, 2003. [8] M. Bras-Amorós, P. A. Garcı́a-Sánchez, Patterns on numerical semigroups, Linear Algebra Appl. 414 (2006), 652 - 669. [9] A. Campillo, J. I. Farrán, C. Munuera, On the parameters of algebraic-geometry codes related to Arf semigroups, IEEE Trans. Inform. Theory 46 (2000), no. 7, 2634 - 2638. [10] M. Delgado, P. A. Garcı́a-Sánchez, P. A. and J. Morais, NumericalSgps, A package for numerical semigroups, Version 1.0.1 (2015), (Refereed GAP package), http://www.fc.up.pt/ cmup/mdelgado/numericalsgps. [11] D. E. Dobbs, H. J. Smith, Numerical semigroups whose fractions are of maximal embedding dimension, Semigroup Forum 82 (2011), no. 3, 412 - 422. [12] P. Du Val, The Jacobian algorithm and the multiplicity sequence of an algebraic branch, Revue de la faculté des sciences de l’université d’İstanbul, série A, tome VII, (1942), 107 112. [13] GAP – Groups, Algorithms, and Programming, Version 4.7.8, The GAP Group (2014), http: //www.gap-system.org. [14] J. Kelleher, B. O’Sullivan, Generating All Partitions: A Comparison Of Two Encodings, arXiv:0909.2331. [15] E. Kunz, Über dir Klassifikation numerischer Halbgruppen. Regensburger matematische schriften 11 (1987). [16] J. Lipman, Stable ideals and Arf rings, Amer. J. Math., 93 (1971) 649 - 685. 24 GARCÍA-SÁNCHEZ, HEREDIA, KARAKAŞ, AND ROSALES [17] J. C. Rosales, Principal ideals of numerical semigroups, Bull. Belg. Math. Soc. Simon Stevin 10 (2003), 329 - 343. [18] J. C. Rosales, Numerical semigroups with multiplicity three and four, Semigroup Forum 71 (2005), 323-331. [19] J. C. Rosales, Families of numerical semigroups closed under finite intersections and for the Frobenius number, Houston J. Math. 34 (2008), 339 - 348. [20] J. C. Rosales, M. B. Branco, D. Torrão, On the enumeration of the set of saturated numerical semigroups with fixed Frobenius number, Applied Mathematics and Computation 236 (2014), 471 - 479. [21] J. C. Rosales y P. A. Garcı́a-Sánchez, Numerical semigroups, Developments in Mathematics, 20, Springer, New York, 2009. [22] J. C. Rosales, P. A. Garcı́a-Sánchez, J. I. Garcı́a-Garcı́a and M. B. Branco, Systems of inequalities and numerical semigroups, J. Lond. Math. Soc. 65 (2002), 611-623. [23] J. C. Rosales, P. A. Garcı́a-Sánchez, J. I. Garcı́a-Garcı́a, and M. B. Branco, Arf numerical semigroups, J. Algebra 276 (2004), 3 - 12. [24] J. G. Semple, Singularities of space algebraic curves, Proc. London Math. Soc., Series 2, 44 (1938) 149-174. [25] S. Sertöz, Arf Rings and Characters, Note Mat. 14 (1994), 251-261 (1997). [26] O. Zariski, Le problème des modules pour les courbes planes, Hermann, 1986. IEMath-GR and Departamento de Álgebra, Universidad de Granada, E-18071 Granada, España E-mail address: [email protected] Departamento de Matemática e Centro de Matemática e Aplicaçoes (CMA), FCT, Universidade Nova de Lisboa E-mail address: [email protected] Faculty of Commercial Sciences, Başkent University, Ankara, Turkey E-mail address: [email protected] Departamento de Álgebra, Universidad de Granada, E-18071 Granada, España E-mail address: [email protected]
0math.AC
Near Optimal Online Distortion Minimization for Energy Harvesting Nodes Ahmed Arafa Sennur Ulukus arXiv:1705.10305v1 [cs.IT] 29 May 2017 Department of Electrical and Computer Engineering University of Maryland, College Park, MD 20742 [email protected] [email protected] Abstract— We consider online scheduling for an energy harvesting communication system where a sensor node collects samples from a Gaussian source and sends them to a destination node over a Gaussian channel. The sensor is equipped with a finite-sized battery that is recharged by an independent and identically distributed (i.i.d.) energy harvesting process over time. The goal is to minimize the long term average distortion of the source samples received at the destination. We study two problems: the first is when sampling is cost-free, and the second is when there is a sampling cost incurred whenever samples are collected. We show that fixed fraction policies [1], in which a fixed fraction of the battery state is consumed in each time slot, are near-optimal in the sense that they achieve a long term average distortion that lies within a constant additive gap from the optimal solution for all energy arrivals and battery sizes. For the problem with sampling costs, the transmission policy is bursty; the sensor can collect samples and transmit for only a portion of the time. I. I NTRODUCTION A sensor node collects samples from an i.i.d. Gaussian source and sends them to a destination over a Gaussian channel. The sensor relies solely on energy harvested from nature and is equipped with a finite-sized battery to save its incoming energy. The goal is to characterize online power control policies that minimize the long term average distortion of the received samples at the destination. Offline power scheduling in energy harvesting communication systems has been extensively studied in the recent literature. Earlier works [2]–[5] consider the single-user setting. References [6]–[12] extend this to broadcast, multiple access, and interference settings; and [13]–[16] consider two-hop and relay channels. Energy sharing and energy cooperation concepts are studied in [17], [18]. References [19]–[24] study energy harvesting receivers, where energy harvested at the receiver is spent mainly for sampling and decoding. Other works [25]–[30] study the impact of processing costs, i.e., the power spent for circuitry, on energy harvesting communications. A source-channel coding problem with an energy harvesting transmitter is formulated in [31] to minimize the distortion of source samples sent to a destination. Impacts of processing and sampling costs are also studied, and twodimensional water-filling interpretations are presented. Recently, [1] has introduced an online power control policy for a single-user energy harvesting channel that maximizes the This work was supported by NSF Grants CNS 13-14733, CCF 14-22111, CCF 14-22129, and CNS 15-26608. long term average throughput. The proposed policy is near optimal in the sense that it performs within a constant gap from the optimal solution that is independent of energy arrivals and battery sizes. This is extended to broadcast channels in [32], multiple access channels in [33], [34], and systems with processing costs in [35], [36]. In this paper, we follow the approaches in [1], [32]–[36] to extend the offline results in [31] to online settings. We characterize near-optimal online power control policies that minimize the long term average distortion in a single-user energy harvesting channel, where a sensor node collects samples from an i.i.d. Gaussian source and sends them to a destination over a Gaussian channel. The sensor relies on energy harvested from nature to transmit its packets and is equipped with a finite-sized battery. Energy is harvested in packets following an i.i.d. distribution with amounts known causally at the sensor, and is consumed in sampling and transmission. We formulate two problems: one with and the other without sampling energy consumption costs. In both problems, we show that the policy introduced in [1] achieves a long term average distortion that lies within a constant additive gap from the optimal achieved distortion for all energy arrivals and battery sizes. II. S YSTEM M ODEL AND P ROBLEM F ORMULATION We consider a sensor node collecting i.i.d. Gaussian source samples, with zero-mean and variance σs2 , over a sequence of time slots. Without loss of generality, a slot duration is normalized to one time unit. Samples are compressed and sent over an additive white Gaussian noise channel, with variance σc2 , to an intended destination. We consider a strict delay scenario where samples need to be sent during the same time slot in which they are collected. With a mean squared error distortion criterion, the average distortion of the source samples in time slot t, Dt , is given by [37] Dt = σs2 exp (−2rt ) (1) where rt denotes the sampling rate at time slot t. The sensor uses energy harvested from nature to send its samples over the channel, with minimal distortion. Energy arrives (is harvested) in packets of amount Et at the beginning of time slot t, and follows an i.i.d. distribution with a given mean. Our setting is online, in the sense that the amounts of energy are known causally in time, i.e., after being harvested. Only the mean of the energy arrivals is known a priori. Energy is saved in a battery of finite size B. The sensor consumes energy in sampling and transmission. Depending on the physical settings, sampling energy can be a significant system aspect and needs to be taken into consideration [31]. We formulate two different problems for that matter: one without, and the other with sampling costs as follows. Let E t , {E1 , E2 , . . . , Et }, and let gt denote the the sensor’s transmission power in time slot t. A feasible online policy g is a sequence of mappings {gt : E t → R+ } satisfying ∀t (2) with b1 , B without loss of generality (using similar arguments as in [1, Appendix B]). We denote the feasible set above by F . By allocating power gt at time slot t to the Gaussian channel, the sensor achieves an instantaneous communication rate of [37]  1 (3) rt = log 1 + gt /σc2 2 Given a feasible policy g, and using (1) and (3), we define the n-horizon average distortion as # " n X σs2 1 (4) Dn (g) , E n 1 + gt /σc2 t=1 Our goal is to minimize the long term average distortion, subject to (online) energy causality constraints. That is, to characterize the following ∗ d , min lim Dn (g) g∈F n→∞ (5) whence our goal is to characterize d∗ǫ , min lim Dnǫ (θ, g) (θ,g)∈F ǫ n→∞ (9) In this section we discuss the main results of this paper regarding problems (5) and (9). We first note that both problems can be optimally solved via dynamic programming techniques, since the underling system evolves as a Markov decision process. However, the optimal solution is usually computationally demanding with few structural insights. Therefore, in the sequel, we aim at finding relatively simple online power control policies that are provably within a constant additive gap of the optimal solution. Towards that end, we derive lower and upper bounds on the optimal solution and bound the additive gap between them. We show that the proposed policy lies in between these bounds and is therefore of at most the same additive gap from the optimal solution. We assume that Et ≤ B ∀t a.s., since any excess energy above the battery capacity cannot be saved or used. Let µ = E[Et ], where E[·] is the expectation operator, and define E[Et ] (10) B Then, we have 0 ≤ q ≤ 1. For problem (5), we define the power control policy as follows [1] q, g̃t = qbt Next, we consider the case where sampling the source incurs an energy cost ǫ per unit time, that is a constant independent of the sampling rate. Due to the sampling cost, collecting all the source samples might not be optimal. Hence, we allow the sensor to be on during a θt ≤ 1 portion of time slot t, and turn off for the remainder of the time slot. The expected distortion achieved in time slot t under this setting is now given by (6) and the feasible set F ǫ is now given by the sequence of mappings {(θt , gt ) : E t → [0, 1] × R+ } satisfying θt (ǫ + gt ) ≤ bt , min{bt−1 − θt−1 (ǫ + gt−1 ) + Et , B}, ∀t (7) with b1 , B. We note that the problem with sampling costs is formulated slightly different in [31]. In our formulation, the expected distortion is interpreted by time sharing between not transmitting (and hence achieving σs2 ) and transmitting with rate rt (and hence achieving σs2 exp(−2rt )). Given a feasible policy (θ, g), and using (3) and (6), we define the n-horizon (11) and for problem (9), we define it as θ̃t (ǫ + g̃t ) = qbt B. The Case With Sampling Costs Dtǫ = (1 − θt )σs2 + θt σs2 exp (−2rt ) (8) III. M AIN R ESULTS A. No Sampling Costs Case gt ≤ bt , min{bt−1 − gt−1 + Et , B}, average distortion with sampling costs as # " n 2 X 1 θ σ t s Dnǫ (θ, g) , E (1 − θt )σs2 + n 1 + gt /σc2 t=1 (12) That is, for either problem, in each time slot, the sensor uses a fixed fraction of its available energy in the battery. Such policies were first introduced in [1], and coined fixed fraction policies (FFP). Clearly these policies are always feasible since q ≤ 1. We note that using (12) in problem (9) decouples the problem into multiple single-slot problems where the energy consumption in time slot t is qbt . In upcoming we   sections, show that solving that single-slot problem for θ̃t , g̃t gives ( ) qbt p θ̃t = min ,1 (13) ǫ + ǫσc2 n p o g̃t = max qbt − ǫ, ǫσc2 (14) Observe that in the above assignment, for a single energy arrival, either the transmission power or the on time decreases over slots in a fractional manner, i.e., whileone decreases the other one is fixed. Let d (g̃) and dǫ θ̃, g̃ denote the long term average distortion under {g̃t } in (11) and {(θ̃t , g̃t )} in (13) and (14), respectively. We now state the main results. Theorem 1 For all i.i.d. energy arrivals with mean µ, the optimal solution of problem (5) satisfies d∗ ≥ f (µ) , σs2 1 + µ/σc2 (15) and the FFP in (11) satisfies 1 f (µ) ≤ d (g̃) ≤ f (µ) + σs2 2 2 for all values of µ and σc . (16) θ,ḡ (1 − θ)σs2 + θ σs2 1 + θσḡ 2 θǫ + ḡ ≤ µ, 0≤θ≤1 c s.t. and the FFP in (13) and (14) satisfies   1 fǫ (µ) ≤ dǫ θ̃, g̃ ≤ fǫ (µ) + σs2 2 for all values of ǫ, µ, and σc2 . (17) (18) Note that the results in the theorems directly imply that the average long term distortion under the FFP proposed for both problems (9) and (5) lies within a constant additive gap from the optimal solution. We also observe that the additive gap indicated in Theorem 2 does not depend on the cost ǫ. We prove these two theorems in the upcoming sections. IV. N O S AMPLING C OSTS : P ROOF OF B. Upper Bounding d∗ : Bernoulli Energy Arrivals In this section, we derive an upper on d∗ . Towards that, we first the study a special energy harvesting i.i.d. process: the Bernoulli process. Let {Êt } be a Bernoulli energy arrival process with mean µ as follows Êt ∈ {0, B}, with P[Êt = B] = p, and pB = µ Theorem 2 For all i.i.d. energy arrivals with mean µ, the optimal solution of problem (9) satisfies d∗ǫ ≥ fǫ (µ) , min solution is given by f (µ + δ). We then have d∗ ≥ f (µ + δ). Since this is true ∀δ > 0, we can take δ down to 0 by taking n infinitely large. Therefore, (15) holds. T HEOREM 1 where P[A] denotes the probability of A. Note that under such specific energy arrival setting, whenever an energy packet arrives, it completely fills the battery, and resets the system. This constitutes a renewal. Then, by [39, Theorem 3.6.1] (see also [1]), the following holds for any power control policy g # " n X 1 σs2 lim D̂n (g) = lim E n→∞ n→∞ n 1 + gt /σc2 t=1 # " L X σs2 1 a.s. (23) E = E[L] 1 + gt /σc2 t=1 where D̂n (g) is the n-horizon average distortion under Bernoulli arrivals, and L is a random variable denoting the inter-arrival time between energy arrivals, which is geometric with parameter p, and E[L] = 1/p. Now, substituting by the FFP (11) gives an upper bound on d∗ . Note that by (22), the fraction q in (10) is now equal to p. Also note that in between energy arrivals, the battery state decays exponentially, and the FFP in (11) gives A. Lower Bounding d∗ g̃t = p(1 − p)t−1 B = (1 − p)t−1 µ In this section, we derive the lower bound in (15). Following [1] and [35], we first remove the battery capacity constraint setting B = ∞. This way, the feasible set F becomes n X gt ≤ t=1 n X Et , ∀n (19) t=1 Then, we remove the expectation and consider the offline setting of problem (5), i.e., when energy arrivals are known a priori. Since the energy arrivals are i.i.d., Pnthe strong law of large numbers indicates that limn→∞ n1 t=1 Et = µ a.s., i.e., for every δ > 0, there exists n large enough such that 1 Pn t=1 Et ≤ µ+δ a.s., which implies by (19) that the feasible n set, for such (δ, n) pair, is given by n 1X gt ≤ µ + δ n t=1 a.s. (20) Now fix such (δ, n) pair. The objective function is given by n n σs2 1X 1X = f (gt ) n t=1 1 + gt /σc2 n t=1 (21) It is direct to see that f is convex. Therefore, the optimal power allocation minimizing the objective function is gt = µ + δ, 1 ≤ t ≤ n [38] (see also [2]). Whence, the optimal offline (22) (24) for all time slots t, where the second equality follows since pB = µ. Therefore, using (23) and (24), we bound the distortion under the FFP as follows lim D̂n (g̃) n→∞ # " L X 1 σs2 = E E[L] 1 + (1 − p)t−1 µ/σc2 t=1 # " L X (a)  2 σs2 1 t−1 σs + 1 − (1 − p) E ≤ E[L] 1 + µ/σc2 t=1 #! " L X 1 2 t−1 = f (µ) + σs 1 − E (1 − p) E[L] t=1 = f (µ) + σs2 σs2 p(1 − p) (b) ≤ f (µ) + 1 − (1 − p)2 2 (25) 1 1 ≤ 1+x + (1 − λ) for 0 ≤ where (a) follows since 1+λx p(1−p) λ ≤ 1 and x ≥ 0; and (b) follows since 1−(1−p) 2 has a maximum value of 1/2 for 0 ≤ p ≤ 1. Next, we use the above result for Bernoulli arrivals to bound the distortion for general i.i.d. arrivals under the FFP in the following lemma; the proof follows by convexity and monotonicity of f , along the same lines of [1, Section VII-C], and is omitted for brevity. Lemma 1 Let {Êt } be a Bernoulli energy arrival process as in (22) with parameter q as in (10) and mean qB = µ. Then, the long term average distortion under the FFP for any general i.i.d. energy arrivals, d(g̃), satisfies d(g̃) ≤ lim D̂n (g̃) f (µ) ≤ d∗ ≤ d(g̃) ≤ f (µ) + OF σs2 (27) 2 θt ǫ + ḡt ≤ t=1 0.6 0.5 0.4 0.2 0.1 In this section, we derive the lower bound in (17). Following the same lines as in Section IV-A, we remove the battery limit and consider the offline setting. We also apply the change of variables: ḡt , θt gt ∀t. The feasible set F ǫ now becomes n X 0.7 0.3 T HEOREM 2 A. Lower Bounding d∗ǫ n X 0.8 distortion Using (15), (25), and Lemma 1, we have lower bound optimal FFP 0.9 (26) n→∞ V. S AMPLING C OSTS : P ROOF 1 Et , ∀n; 0 ≤ θt ≤ 1, ∀t (28) t=1 Next, we use the strong law of large numbers and apply the same (δ, n) argument as in Section IV-A. Fixing a (δ, n) pair, the objective function is given by n n 1X 1X θt σs2 (1 − θt )σs2 + h (θt , ḡt ) ḡt , n t=1 n t=1 1 + θt σ 2 (29) c It is direct to see that h is jointly convex in (θt , ḡt ) since the second added term is the perspective of the convex function f (ḡt ) [38]. Therefore, the optimal power allocation minimizing the objective function is θt ǫ + ḡt = µ + δ, 1 ≤ t ≤ n [38] (see also [2]). We denote this optimal offline solution by fǫ (µ + δ) as defined in (17). We then have d∗ǫ ≥ fǫ (µ + δ); we take δ down to 0 by taking n infinitely large. Therefore, (17) holds. B. Upper Bounding d∗ǫ : Bernoulli Energy Arrivals In this section, we derive an upper bound on d∗ǫ . Following the same steps as in Section IV-B, we first consider Bernoulli energy arrivals as in (22). In this case we have # " L X θt σs2 1 2 ǫ a.s. E (1 − θt )σs + lim D̂ (θ, g) = n→∞ n E[L] 1 + gt /σc2 t=1 (30) where D̂nǫ (θ, g) is the n-horizon average distortion under Bernoulli arrivals. Next, we upper bound the long term average distortion in this case by substituting the FFP in (12) setting θ̃t (ǫ + g̃t ) = p(1 − p)t−1 B = (1 − p)t−1 µ (31) for all time slots t. Note that the average  minimal distortion in time slot t is given by fǫ (1 − p)t−1 µ . We have the following lemma regarding fǫ . The proof follows by convexity of h and is omitted for space limits. Lemma 2 The function fǫ is convex and non-increasing. 0 10 -1 10 0 10 1 10 2 10 3 10 4 10 5 battery B Fig. 1. Performance of the FFP with no sampling costs. Next, following the same steps used in showing (25), by (30) and (31), we have   σ2 (32) lim D̂nǫ θ̃, g̃ ≤ fǫ (µ) + s n→∞ 2 where step (a) in (25) follows by Lemma 2. Finally, we use the above result to bound the distortion for general i.i.d. arrivals under the FFP. We basically extend the statement of Lemma 1 to the case with sampling costs since fǫ is convex and monotone. We then have     (33) dǫ θ̃, g̃ ≤ lim D̂nǫ θ̃, g̃ n→∞ Using (17), (32), and (33), we have   σ2 fǫ (µ) ≤ d∗ǫ ≤ dǫ θ̃, g̃ ≤ fǫ (µ) + s (34) 2 It now remains to show that the FFP corresponds to (13) and (14). Towards that end, we solve fǫ (qbt ) for θ and ḡ. We first make the substitution ḡ = qbt − θǫ into the objective function. The problem now becomes min 0≤θ≤min{1,qbt /ǫ} θ 1− ǫ σc2 + qbt θσc2 −θ (35) where the constraint θ ≤ qbt /ǫ ensures non-negativity of ḡ. One can show that the objective function above is convex in θ. Hence, we take the derivative, equate to 0, solve for θ, and then project the solution onto the feasible set to get the optimal solution of this problem [38]. This gives (13); while (14) is directly derived by substituting g = qbθt − ǫ. VI. N UMERICAL R ESULTS In this section we present some examples to illustrate our results. We set both σs2 and σc2 to unity, and consider a system with Bernoulli energy arrivals with probability p = 0.5. In Fig. 1, we plot the lower bound on the long term average distortion for the problem without sampling costs along with the FFP, against the battery size B. We also plot the optimal solution in this scenario. We see that the FFP performs very 1 lower bound FFP 0.9 0.8 distortion 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 10 -1 10 0 10 1 10 2 10 3 10 4 10 5 battery B Fig. 2. Performance of the FFP with sampling costs. close to the optimal policy. We note that the empirical gap between the optimal policy and the FFP is no larger than 0.03, while the empirical gap between the lower bound and the FFP is no larger than 0.15, which is lower than the theoretical gap of 0.5 in Theorem 1. In Fig. 2, we plot the same curves for the problem with sampling costs. We set the sampling cost ǫ = 1.5. We notice that the distortion levels are higher in general when compared to the case without sampling costs, which is mainly due to having some energy spent in sampling instead of reducing distortion. The empirical gap in this case is 0.22, which is lower than the theoretical gap of 0.5 in Theorem 2. R EFERENCES [1] D. Shaviv and A. Ozgur. Universally near optimal online power control for energy harvesting nodes. IEEE JSAC, 34(12):3620–3631, December 2016. [2] J. Yang and S. Ulukus. Optimal packet scheduling in an energy harvesting communication system. IEEE Trans. Comm., 60(1):220–230, January 2012. [3] K. Tutuncuoglu and A. Yener. Optimum transmission policies for battery limited energy harvesting nodes. IEEE Trans. Wireless Comm., 11(3):1180–1189, March 2012. [4] O. Ozel, K. Tutuncuoglu, J. Yang, S. Ulukus, and A. Yener. Transmission with energy harvesting nodes in fading wireless channels: Optimal policies. IEEE JSAC, 29(8):1732–1743, September 2011. [5] C. K. Ho and R. Zhang. Optimal energy allocation for wireless communications with energy harvesting constraints. IEEE Trans. Signal Proc., 60(9):4808–4818, September 2012. [6] J. Yang, O. Ozel, and S. Ulukus. Broadcasting with an energy harvesting rechargeable transmitter. IEEE Trans. Wireless Comm., 11(2):571–583, February 2012. [7] M. A. Antepli, E. Uysal-Biyikoglu, and H. Erkal. Optimal packet scheduling on an energy harvesting broadcast link. IEEE JSAC, 29(8):1721–1731, September 2011. [8] O. Ozel, J. Yang, and S. Ulukus. Optimal broadcast scheduling for an energy harvesting rechargebale transmitter with a finite capacity battery. IEEE Trans. Wireless Comm., 11(6):2193–2203, June 2012. [9] J. Yang and S. Ulukus. Optimal packet scheduling in a multiple access channel with energy harvesting transmitters. Journal of Comm. and Networks, 14(2):140–150, April 2012. [10] Z. Wang, V. Aggarwal, and X. Wang. Iterative dynamic water-filling for fading multiple-access channels with energy harvesting. IEEE JSAC, 33(3):382–395, March 2015. [11] N. Su, O. Kaya, S. Ulukus, and M. Koca. Cooperative multiple access under energy harvesting constraints. In IEEE Globecom, December 2015. [12] K. Tutuncuoglu and A. Yener. Sum-rate optimal power policies for energy harvesting transmitters in an interference channel. Journal Comm. Networks, 14(2):151–161, April 2012. [13] C. Huang, R. Zhang, and S. Cui. Throughput maximization for the Gaussian relay channel with energy harvesting constraints. IEEE JSAC, 31(8):1469–1479, August 2013. [14] D. Gunduz and B. Devillers. Two-hop communication with energy harvesting. In IEEE CAMSAP, December 2011. [15] Y. Luo, J. Zhang, and K. Ben Letaief. Optimal scheduling and power allocation for two-hop energy harvesting communication systems. IEEE Trans. Wireless Comm., 12(9):4729–4741, September 2013. [16] B. Gurakan and S. Ulukus. Cooperative diamond channel with energy harvesting nodes. IEEE JSAC, 34(5):1604–1617, May 2016. [17] B. Gurakan, O. Ozel, J. Yang, and S. Ulukus. Energy cooperation in energy harvesting communications. IEEE Trans. Comm., 61(12):4884– 4898, December 2013. [18] K. Tutuncuoglu and A. Yener. Energy harvesting networks with energy cooperation: Procrastinating policies. IEEE Trans. Comm., 63(11):4525– 4538, November 2015. [19] K. Tutuncuoglu and A. Yener. Communicating with energy harvesting transmitters and receivers. In UCSD ITA, February 2012. [20] H. Mahdavi-Doost and R. D. Yates. Energy harvesting receivers: Finite battery capacity. In IEEE ISIT, July 2013. [21] J. Rubio, A. Pascual-Iserte, and M. Payaró. Energy-efficient resource allocation techniques for battery management with energy harvesting nodes: a practical approach. In Euro. Wireless Conf., April 2013. [22] R. Nagda, S. Satpathi, and R. Vaze. Optimal offline and competitive online strategies for transmitter-receiver energy harvesting. In IEEE ICC, June 2015. Longer version available: arXiv:1412.2651v2. [23] A. Arafa and S. Ulukus. Optimal policies for wireless networks with energy harvesting transmitters and receivers: Effects of decoding costs. IEEE JSAC, 33(12):2611–2625, December 2015. [24] A. Arafa, A. Baknina, and S. Ulukus. Energy harvesting two-way channels with decoding and processing costs. IEEE Trans. Green Comm. and Networking, 1(1):3–16, March 2017. [25] J. Xu and R. Zhang. Throughput optimal policies for energy harvesting wireless transmitters with non-ideal circuit power. IEEE JSAC, 32(2):322–332, February 2014. [26] O. Orhan, D. Gunduz, and E. Erkip. Energy harvesting broadband communication systems with processing energy cost. IEEE Trans. Wireless Comm., 13(11):6095–6107, November 2014. [27] O. Ozel, K. Shahzad, and S. Ulukus. Optimal energy allocation for energy harvesting transmitters with hybrid energy storage and processing cost. IEEE Trans. Signal Proc., 62(12):3232–3245, June 2014. [28] M. Gregori and M. Payaró. Throughput maximization for a wireless energy harvesting node considering power consumption. In IEEE VTC, September 2012. [29] A. Baknina, O. Ozel, and S. Ulukus. Energy harvesting communications under temprature constraints. In UCSD ITA, February 2016. [30] A. Arafa, A. Baknina, and S. Ulukus. Optimal policies in energy harvesting two-way channels with processing costs. In IEEE WiOpt, May 2016. [31] O. Orhan, D. Gunduz, and E. Erkip. Source channel coding under energy, delay, and buffer constraints. IEEE Trans. Wireless Comm., 14(7):3836 – 3849, July 2015. [32] A. Baknina and S. Ulukus. Optimal and near-optimal online strategies for energy harvesting broadcast channels. IEEE JSAC, 34(12):3696– 3708, December 2016. [33] H. A. Inan and A. Ozgur. Online power control for the energy harvesting multiple access channel. In IEEE WiOpt, May 2016. [34] A. Baknina and S. Ulukus. Online policies for multiple access channel with common energy harvesting source. In IEEE ISIT, July 2016. [35] A. Baknina and S. Ulukus. Online scheduling for an energy harvesting link with processing costs. In IEEE Globecom, December 2016. [36] A. Baknina and S. Ulukus. Online scheduling for energy harvesting two-way channels with processing costs. In IEEE Globecom, December 2016. [37] T. Cover and J. A. Thomas. Elements of Information Theory. 2006. [38] S. P. Boyd and L. Vandenberghe. Convex Optimization. 2004. [39] S. M. Ross. Stochastic Processes. 1996.
7cs.IT
I+D Revista de Investigaciones ISSN 22561676 Volumen 11 Número 1 Año 06 enero-junio 2018 p.p Artículo de Investigación Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos 1 Evaluation of bioinspired algorithms for the solution of the job scheduling problem. Edson Flórez2, Nelson Díaz3, Wilfredo Gómez4, Lola Bautista5, Darío Delgado 6 Universidad Industrial de Santander, Bucaramanga, Colombia. Artículo recibido en agosto de 2017; artículo aceptado en septiembre de 2017 Citación del artículo: Flórez, E. & Díaz, N. & Gómez, W. & Bautista, L. & Delgado, D. (2018). Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos. I+D Revista de Investigaciones, 11(1), pp-pp. 1 Artículo de investigación científica e innovación, tipo de enfoque (experimental), resultado de un proyecto de investigación (culminado), perteneciente al área de Computación Bioinspirada, sub área de Gestión de Recursos, desarrollado en el grupo de investigación GIIB y fue financiado por la Universidad Industrial de Santander de la ciudad de Bucaramanga (Colombia). Dirección Calle 9 Carrera 27. Fecha de inicio: 2015, fecha de terminación: 2016. 2 Ingeniero de Sistemas, Universidad Industrial de Santander UIS. Magister en Ingeniería de Sistemas e Informática, Universidad Industrial de Santander UIS. Estudiante de Doctorado en Informática, Laboratoire d'Informatique, Signaux et Systèmes de Sophia-Antipolis (I3S), Université Nice Sophia Antipolis 2000, route des Lucioles. Les Algorithmes, bât. Euclide B. 06900, Sophia Antipolis, France. ORCID: N.D. Correo institucional: [email protected], [email protected]. 3 Ingeniero de Sistemas, Magister en Ingeniería de Sistemas e Informática, Estudiante de Doctorado en Ingeniería (Ing.Eléctrica, Electrónica y Gestión & Desarrollo) Universidad Industrial de Santander UIS. Bucaramanga, Colombia. Cra 27 Calle 9 Ciudad Universitaria. PBX: 6344000. ORCID: N.D. Correo institucional: [email protected] 4 Ingeniero de Sistemas e Informática, Universidad Industrial de Santander UIS. Magister en Ingeniería de Sistemas e Informática, Universidad Industrial de Santander UIS. Estudiante de Doctorado en Administración de Empresas, Universidad Politécnica de Valencia. Asesor técnico en innovación de la Iniciativa Apps.Co, Ministerio de Tecnologias de la Información y las Comunicaciones MINTIC, Cra. 8 #Entre Calles 12 y 13, Bogotá. ORCID: http://orcid.org/0000-0002-9332-7760 Correo institucional: [email protected]. 5 Ingeniero de Sistemas, Universidad Industrial de Santander UIS. Master of Science in Computer Engineering (Electrical and Computer Engineering), Universidad de Puerto Rico: Mayagüez, Puerto Rico. Doctor en Automatique et Traitement de Signaux et des Images (Ecole Doctorale des Sciences et Technologies de l'Information et de la Communication) Université de Nice Sophia Antipolis: Nice, ProvenceAlpes-Côte d'Azu, France. Docente planta de la Escuela de Ingeniería de Sistemas e Informática en la Universidad Industrial de Santander: Bucaramanga, Colombia. Cra 27 Calle 9 Ciudad Universitaria. PBX: 6344000. ORCID: orcid.org/0000-0002-3853-007X Correo institucional: [email protected] 6 Ingeniero de Sistemas, Magister en Ingeniería de Sistemas e Informática, Doctor en Ingeniería (Ing.Eléctrica, Electrónica y Gestión & Desarrollo) Universidad Industrial de Santander UIS. Investigador en la Universidad Nacional Abierta y a Distancia – UNAD, Calle 14S #14 23 Restrepo Bogotá PBX: (1) 3443700. ORCID: N.D. Correo institucional: [email protected] Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos _______________________________________________________________________ Resumen En el presente trabajo se utilizaron Metaheurísticas de inspiración biológica, como sistemas inmunes artificiales y los algoritmos de colonias de hormigas que se basan en características y comportamientos de los seres vivos aplicables en el área computacional. Se presenta una evaluación de soluciones bioinspiradas para el problema de optimización combinatoria de planificación de trabajos, denominado Job shop Scheduling, cuyo objetivo es encontrar una configuración o secuencia de trabajos que requiera la menor cantidad de tiempo para ser ejecutada en las máquinas disponibles. El desempeño de los algoritmos fue caracterizado y evaluado para instancias de referencia del problema de Job Shop Scheduling, comparando la calidad de las soluciones obtenidas respecto a la mejor solución conocida (BKS por sus siglas en inglés) de los métodos más eficaces. Las soluciones fueron valoradas en dos aspectos, en calidad tomando como referente el makespan, que corresponde al tiempo que tardan en realizarse todos los trabajos, y como métrica de desempeño se tomó el número de evaluaciones que realiza el algoritmo para obtener la mejor solución. Palabras clave: algoritmos bioinspirados, job shop scheduling, metaheurísticas, optimización combinatoria, planificación de tareas. Abstract. In this research we used bio-inspired metaheuristics, as artificial immune systems and ant colony algorithms that are based on a number of characteristics and behaviors of living things that are interesting in the computer science area. This paper presents an evaluation of bio-inspired solutions to combinatorial optimization problem, called the Job Shop Scheduling or planning work, in a simple way the objective is to find a configuration or job stream that has the least amount of time to be executed in machine settings. The performance of the algorithms was characterized and evaluated for reference instances of the job shop scheduling problem, comparing the quality of the solutions obtained with respect to the best known solution of the most effective methods. The solutions were evaluated in two aspects, first in relation of quality of solutions, taking as reference the makespan and secondly in relation of performance, taking the number evaluations performed by the algorithm to obtain the best solution. Key words: bio-inspired algorithms, job shop scheduling, metaheuristics, combinatorial optimization, scheduling Introducción Los problemas de secuenciación de tareas aparecen constantemente en la vida real en numerosos ambientes productivos y de servicios. Son problemas en los cuales se requiere organizar la ejecución de trabajos que compiten entre sí por el uso de un conjunto finito de recursos, y que a su vez están sujetos a un conjunto de restricciones. I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos Estos problemas son combinatorios y se caracterizan por pertenecer a la clase NP-Duro (M. R. Garey and D. S. Johnson,1979), en otras palabras, problemas en los que el tiempo de cómputo necesario para resolverlos crece de forma exponencial conforme aumenta el tamaño del problema. Por esta razón los investigadores han desarrollado distintos métodos o algoritmos que procuran soluciones efectivas, ya sea de forma determinística o no determinística (C. A. C. Coello, D. R. Cortés, and N. C. Cortés,2004). El objetivo de la optimización es maximizar o minimizar los criterios sujetos a las restricciones en donde cada trabajo es una secuencia de operaciones, cada una con una máquina y tiempo de procesamiento determinados. Las soluciones factibles deben cumplir con las restricciones a las que está sujeto el problema de Job Shop Sheduling, como es la de respetar la precedencia entre operaciones que determina la secuencia tecnológica sin interrumpir ninguna operación hasta su finalización (A. Manne,1960). Debido a su complejidad, los problemas de programación de tareas precisan de algoritmos de búsqueda eficientes para encontrar soluciones aceptables en tiempos razonables (M. R. Garey, D. S. Johnson, and R. Sethi,1976). En la literatura se pueden encontrar aproximaciones a los problemas de secuenciación de tareas basadas en los algoritmos de búsqueda heurística propios de áreas como la Investigación Operativa y la Inteligencia Artificial (F. Ghedjati,2010), (C. Blum and A. Roli,2003). Para la solución de este problema se han usado diferentes algoritmos que incluyen técnicas como: procesos de vuelta atrás (backtracking), ramificación y poda (branch and bound), programación dinámica [7], las heurísticas de construcción voraz o heurísticas greedy (M. G. C. Resende and C. C. Ribeiro,2010); adicionalmente en los últimos años se han usado metaheurísticas como son: Enfriamiento simulado, búsqueda tabú (D. De Inform, T. Universidad, and S. Mar,2006), búsqueda local iterativa (Iterated Local Search), algoritmos de búsqueda local con vecindario variable (Variable Neighborhood Search), GRASP (Greedy Randomized Adaptative Search Procedures) (M.Tupia,2005), (S. Binato, W. J. Hery, and D. M. Loewenstern,2000) y finalmente los algoritmos bioinspirados, entre los que destacamos las técnicas utilizadas en este artículo como lo son los algoritmos de colonia de hormigas (M. Ventresca and B. M. Ombuki,2004) y algoritmos inmunes (Z. Problemler, Y. Ba, and N. D. E. Yen,2007). En este desarrollo se destaca la caracterización de dos técnicas bioinspiradas, una probabilística y la otra evolutiva, lo que permite establecer un escenario común de comparación utilizando representaciones de las soluciones e instancias de evaluaciones que faciliten dicho contraste. Adicional se presenta una referencia actualizada para la configuración de los parámetros iniciales de los algoritmos en problemas de índole combinatoria y finalmente se detalla la experiencia de implementación de este tipo de técnicas bioinspiradas con la inclusión y modificación de operadores y la hibridación de metaheurística como en el caso de algoritmos de optimización de colonia de hormigas con búsqueda tabú y algoritmos voraces. Este desarrollo pretende enriquecer el panorama de documentación metodológica para la implementación de metaheurística y de esta manera I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos aportar y motivar al desarrollo de nuevos modelos bioinspirados en los que se pueda mejorar el desempeño de este tipo de técnicas. Este artículo se encuentra organizado de la siguiente forma: se inicia con una presentación de trabajos relacionados con Job Shop Scheduling (JSP) en la siguiente sección se realiza una descripción formal del problema Job Shop Scheduling. El artículo continúa con una descripción de las instancias del problema empleados para el presente estudio. En la siguiente sección se describe las técnicas desarrolladas como el algoritmo inmune y el algoritmo de colonia de hormigas, posteriormente se presentan y discuten los resultados. Este trabajo finaliza con las conclusiones generadas en el proceso de desarrollo e investigación. 1. JOB SHOP SCHEDULING Job Shop Scheduling Problem (JSP) es un problema de secuenciación de tareas, para el cual un conjunto finito de trabajos es procesado sobre un conjunto finito de máquinas. Cada trabajo se caracteriza por un orden fijo de las operaciones, cada una de las cuales será procesada en una máquina específica durante un tiempo determinado. Cada máquina puede procesar a lo más un trabajo en un tiempo y una vez que un trabajo ha iniciado sobre una máquina se debe completar su procesamiento sobre esa máquina por un tiempo ininterrumpido. Un Calendario es una asignación de operaciones en intervalos de tiempo sobre las máquinas. El objetivo de JSP es encontrar un calendario que minimice la función objetivo. Para el presente caso de estudio la función objetivo será el makespan, que es el tiempo en completar todos los trabajos, es decir, la longitud del calendario desde que empieza a ejecutarse el primer trabajo hasta que finaliza el último trabajo. Formalmente, JSP puede ser definido como se muestra en el trabajo de Witkowski et al(T. Witkowski, P. Antczak, and A. Antczak,2010). Dado un conjunto 𝑀 de máquinas (|𝑀| denota el tamaño de 𝑀) y un conjunto 𝐽 de trabajos ( |𝐽| denota el tamaño de 𝐽), sean 𝑗 𝑗 𝑗 𝑗 𝜎1 ≺ 𝜎2 ≺ ⋯ ≺ 𝜎|𝑀| el orden de un conjunto de|𝑀|operaciones del trabajo 𝑗, donde 𝜎𝑘 ≺ 𝑗 𝑗 𝜎𝑘+1 indica que la operación 𝜎𝑘+1 solo puede empezar el procesamiento después de 𝑗 completar la operación 𝜎𝑘 . Sea 𝑂 el conjunto de operaciones. Cada operación es definida 𝑗 𝑗 𝑗 𝑗 por dos parámetros: 𝑀𝑘 es la maquina sobre la cual 𝜎𝑘 es procesada y 𝑝𝑘 = 𝑝(𝜎𝑘 ) es el 𝑗 𝑗 tiempo de procesamiento de la operación 𝜎𝑘 . Se denota como 𝑡(𝜎𝑘 ) el tiempo de inicio de 𝑗 la 𝑘 − 𝑒𝑠𝑖𝑚𝑎 operación 𝜎𝑘 ∈ 𝑂.Una formulación de programación disyuntiva para el JSP se muestra a continuación: min 𝐶𝑚𝑎𝑥 sujeto a: 𝑗 𝑗 𝑗 𝐶𝑚𝑎𝑥 ≥ 𝑡(𝜎𝑘 ) + 𝑝(𝜎𝑘 ), para toda 𝜎𝑘 ∈ 𝑂, (1𝑎). 𝑡(𝜎𝑘𝑗 ) ≥ 𝑡(𝜎𝑙𝑗 ) + 𝑝(𝜎𝑙𝑗 ), para toda 𝜎𝑙𝑗 ≺ 𝜎𝑘𝑗 , I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos (1𝑏). 𝑡(𝜎 𝑗𝑘 ) ≥ 𝑡(𝜎𝑙𝑖 ) + 𝑝(𝜎𝑙𝑖 ) ∨ 𝑗 𝑗 𝑡(𝜎 𝑖𝑙 ) ≥ 𝑡(𝜎𝑘 ) + 𝑝(𝜎𝑘 ), para todo 𝑖, 𝑗 ∈ 𝐽 ∋ 𝑀𝜎𝑖 = 𝑀𝜎𝑖 , 𝑙 𝑗 𝑡(𝜎 𝑘 ) ≥ 0, para toda 𝑗 𝜎𝑘 𝑘 ∈𝑂 Donde 𝐶𝑚𝑎𝑥 es el makespan a ser minimizado. Una solución factible puede ser construida de una permutación de los trabajos del conjunto𝐽 sobre cada una de las máquinas del conjunto 𝑀, observando las restricciones de precedencia, la restricción de que cada máquina puede procesar solo una operación a la vez y la restricción que garantiza el procesamiento de una operación de manera ininterrumpida en una máquina hasta ser completada. Cada conjunto de permutaciones tiene un correspondiente calendario. Por tanto, el objetivo del JSP es encontrar un conjunto de permutaciones con el makespan mínimo. El presente trabajo aborda JSP mono-objetivo dado que solo minimiza el makespan. Para probar la implementación se usó la familia de instancias del problema de Job Shop Scheduling conocidas como instancias de Lawrence (LA) (S. R. Lawrence,1984). Consta de 40 problemas de 8 diferentes tamaños propuestos (M. Ventresca and B. M. Ombuki,2004): 10 x 5, 15 x 5, 20 x 5, 10 x 10, 15 x 10, 20 x 10, 30 x 10 y 15 x 15.LA (D. Applegate y W. Cook,1991) es una de las familias más comúnmente utilizadas para probar el desempeño de JSP. Cada instancia se compone de una fila de descripción y varias filas con valores enteros. Cada fila de valores enteros corresponde a un trabajo. El trabajo es un conjunto de parejas conocido como operaciones, la pareja es integrada por el número de la máquina y tiempo de procesamiento en dicha máquina. 2. ALGORITMOS BIOINSPIRADOS La computación bioinspirada se ha soportado en el creciente desarrollo tecnológico gracias a los grandes avances en la electrónica y hardware computacional, y ha venido avanzando sobre los métodos de computación clásicos, utilizando procedimientos que reproducen ciertas propiedades inspiradas en la biología con el fin de diversificar los resultados obtenidos en la medida que se obtengan mejores resultados. Esta disciplina, que está íntimamente vinculada al campo de la Inteligencia Artificial, engloba varios enfoques, tales como: los algoritmos evolutivos (AE) (A. E. Eiben and J. E. Smith,2003), la optimización de colonia de hormigas (ACO) (M. Dorigo and G. Di Caro,1999), la optimización de enjambre de partículas (PSO) (J. Kennedy and R. Eberhart,1995) entre otros. Particularmente en el presente trabajo se utilizaron 2 técnicas de diferentes características, primero un algoritmo de Colonia de Hormigas, que corresponde a una metaheurística probabilística que se basa en el comportamiento natural de las hormigas cuando estas se dirigen a buscar alimentos, y en segundo lugar un algoritmo inmune artificial que corresponde a un algoritmo evolutivo que se basa en la dinámica del sistema inmune de los vertebrados para detectar y eliminar posibles amenazas para el organismo. I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos 2.1. ALGORITMO ELITISTA DE COLONIA DE HORMIGAS (EAS) En los algoritmos de la familia Ant Colony Optimization, el comportamiento de las hormigas se simula con un agente virtual que tiene la capacidad de explorar un espacio de búsqueda limitado y obtener información acerca del entorno que lo rodea. La hormiga artificial (k) se mueve de un nodo a otro (del nodo origen i al nodo destino j), construyendo paso a paso una solución que se va guardando en la memoria Tabú (que almacena información sobre la secuencia de nodos o ruta seguida hasta el momento t), que termina cuando alcanza alguno de los estados de aceptación definidos por el objetivo del problema. Así, en cada iteración, las hormigas pueden construir soluciones aproximadas a problemas complejos como los de secuenciación, asignación, planificación o programación: 1) 𝜂𝑖𝑗 Información heurística que mide la preferencia heurística de moverse desde el nodo i hasta el nodo j, al recorrer la arista aij. Las hormigas no modifican esta información durante la ejecución del algoritmo. 2) 𝜏𝑖𝑗 Información de los rastros de feromona artificiales, que mide la “deseabilidad aprendida” del movimiento de i a j. Esta información se modifica durante la ejecución del algoritmo dependiendo de las soluciones encontradas por las hormigas para reflejar la experiencia adquirida por estos agentes. La versión de ACO desarrollada para el presente trabajo (E. Flórez, W. Gómez, and L. Bautista,2013) refuerza el rastro de feromona de la mejor ruta encontrada en cada iteración. A las aristas de la mejor solución generada por una de las hormigas, se tiene mayor probabilidad de depositar más feromona por medio de todas las otras hormigas. En este algoritmo las hormigas artificiales realizan una construcción probabilística de soluciones en cada ciclo, para lo cual se requiere representar el problema por medio de un grafo, en el que las hormigas se mueven a lo largo de cada arista de un nodo a otro para construir caminos que representan soluciones, desde un nodo inicial seleccionado aleatoriamente. Las siguientes elecciones del próximo nodo en este camino se hacen de acuerdo a la regla de transición de estado: 𝛼 𝑝𝑖𝑗 = (𝑖𝑗 ) (𝑖𝑗 ) 𝛽 𝛽 ∑𝑙 ∈ 𝑇𝑎𝑏𝑢 (𝑖𝑙 )𝛼 (𝑖𝑙 ) (2) 𝑘 𝑠𝑖 𝑗, 𝑙 ∉ 𝑇𝑎𝑏𝑢𝑘 Donde los parámetros 𝛼 y β determinan la influencia de los valores de la información de la feromona () y de la información heurística () respectivamente, sobre la decisión de I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos cada hormiga (𝑘). Se procura que las aristas con gran cantidad de feromona sean las más visibles, teniendo una probabilidad de transición mayor a las aristas de los otros nodos del conjunto de operaciones realizables. Para tener un algoritmo equilibrado (con un apropiado ajuste), los parámetros 𝛼 y 𝛽 deben tener valores adecuados, evitando valores cercanos a cero, porque si 𝛼 = 0, solo la información heurística indicaría que posibles elementos de la solución tendrán mayor probabilidad de ser seleccionados, lo que corresponde a un algoritmo greedy (voraz) estocástico, y si 𝛽 = 0, solo será relevante la cantidad de feromona. En ambos casos las hormigas podrían estancarse en un óptimo local, generando la misma solución en cada iteración, sin oportunidades de encontrar una mejor solución que sea la solución óptima global. Estos parámetros están configurados normalmente en valores enteros entre 1 y 5 (E. Flórez, W. Gómez, and L. Bautista, 2013), pero en este caso los relacionaremos de la siguiente forma 𝛽 = (1 − 𝛼) con 𝛼 ∈ (0,1], como una distribución probabilista uniforme. La cantidad de feromona 𝜏𝑖𝑗 (𝑡) presente en cada arista del camino en la generación 𝑡 está dada por la siguiente ecuación: 𝑖𝑗 (𝑡) = ∑𝑛𝑘=1 ∆𝑘𝑖𝑗 + 𝜌 ∗ 𝑖𝑗 (𝑡 − 1) (3) 𝑘 (𝑡) es la contribución de la hormiga 𝑘 a la feromona total en la generación 𝑡, Donde 𝜏𝑖𝑗 y 𝜌 es la tasa de evaporación de la feromona. La razón para incluir la tasa de evaporación es que la feromona antigua no debería tener mucha influencia en las decisiones futuras de las hormigas. La cantidad de feromona con la que contribuye cada hormiga depende de la calidad de la solución obtenida, siendo inversamente proporcional al costo de la función objetivo de la solución, así: 𝑄 ∆𝑘𝑖𝑗 = 𝐿 (4) 𝑘 Donde 𝑄 es una constante y 𝐿𝑘 es la longitud del makespan de la solución obtenida por la hormiga 𝑘. Hasta el punto anterior las ecuaciones son idénticas a las del Ant System, la modificación planteada por el mismo Dorigo (M. Dorigo and G. Di Caro,1999) permite acelerar la convergencia del algoritmo, aumentando la visibilidad del rastro de feromona en todas las aristas del camino más corto, pasando con todas las hormigas elitistas (𝑒) del sistema (E. Flórez, W. Gómez, and L. Bautista,2013) (Ver ecuación 5), que son un número determinado de hormigas destinadas solo a fortalecer el rastro de feromona en los mejores caminos. Por lo tanto, la ecuación 3 para el mejor camino construido en cada ciclo es reemplazada por: 𝑄 ∆𝑘𝑖𝑗 = 𝐿 ∗ 𝑒 (5) 𝑘 I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos 3.2. ALGORITMO INMUNE ARTIFICIAL DE SELECCIÓN CLONAL (CLONALG) Castro y Von Zuben (L. N. De Castro, C. Brazil, and F. J. Von Zuben,2000) desarrollaron un algoritmo inspirado en Sistemas Inmunes Artificiales basados en la abstracción de selección clonal, el cual ha sido utilizado para realizar tareas de emparejamiento de patrones (W. A. Gómez Bueno, M. I. Cuadrado Morad, and H. Arguello Fuentes,2012)(U. Garain, M. P. Chakraborty, and D. Dasgupta,2006) y optimización de funciones multimodal (N. C. Cortes and C. A. C. Coello,2003)(F. O. de França, F. J. Von Zuben, and L. N. de Castro,2005), entre otras aplicaciones (L. N. de Castro and F. J. Von Zuben,2002)(L. N. De Castro, C. Brazil, and F. J. Von Zuben,2000). Este algoritmo se conoce como Clonalg (J. Brownlee,2007) y la implementación computacional de este principio presenta la siguiente estructura general(N. E. D. DIAZ and L. J. L. Martínez,2012): 1) Generar aleatoriamente un conjunto (P= 𝐴𝑏𝑖 𝑖 = 1, … , 𝑛) donde 𝐴𝑏𝑖 es el conjunto de soluciones potenciales, dicho conjunto lo componen, haciendo la analogía a términos biológicos, la representación de los anticuerpos de las células de memoria M y la representación de los anticuerpos producidos por los demás linfocitos del organismo. En el algoritmo propuesto para la solución del problema Job Shop Scheduling (N. Diaz, J. Luna, W. Gomez, and L. Bautista,2013), cada anticuerpo corresponde a una sarta de valores enteros que representa a un calendario candidato a ser solución de la instancia que se está evaluando durante dicha ejecución. Cada uno de los anticuerpos o calendarios candidatos se crean de manera aleatoria, y se garantiza su factibilidad mediante la verificación de las restricciones del problema durante el proceso de generación. 2) Determinar los n mejores individuos de la población de anticuerpos, midiendo el grado de afinidad de cada uno con la representación del antígeno (evaluando cada solución con respecto a la función a optimizar). Para el algoritmo propuesto la afinidad 𝑓 de anticuerpos está dada por la siguiente ecuación: 𝑓 =1− makespan rango (6) Donde el rango está dado por: rango = max(makespan) − min(makespan) (7) I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos 3) Reproduzca los n mejores individuos (dependiendo qué tan bien cada solución se comporta en relación con el valor de la función), generando una población temporal de clones (C). Para el algoritmo propuesto, la cantidad 𝑛 de clones para cada anticuerpo corresponde a un parámetro del algoritmo, el cual está dado por la ecuación: 𝑁𝑐 = (𝛽 ∗ 𝑁) (8) Donde 𝛽 es un factor de clonación y 𝑁 es la cantidad de anticuerpos. Para el algoritmo desarrollado se tomó un rango entre 0 y 1 para realizar las pruebas del análisis de sensibilidad en lo referente al factor de clonación; después de dicho análisis se determinó como factor de clonación el valor de 0,1. 4) Someta a la población de clones a un proceso de hipermutación, haciendo que la variación sea inversamente proporcional al grado de afinidad del anticuerpo; este proceso da lugar a una nueva población de clones (C*). En el algoritmo propuesto los clones generados sufren un proceso de hipermutación la cual es inversamente proporcional a la afinidad del antígeno (entre mayor afinidad, menor es la tasa de mutación), dicha probabilidad de mutación está dada por: 𝑝 = 𝑒 (−𝜌∗𝑓) (9) Donde, 𝜌 es el factor de mutación y 𝑓 la afinidad. Al fijar este parámetro se confirmó la noción planteada por Cortés (N. C. Cortes and C. A. C. Coello,2003) donde “El impacto que tiene la mutación en un anticuerpo para generar un nuevo individuo es mínima, ya que se aplica de tal forma que sólo se realiza un cambio en la cadena”. 5) Seleccione los individuos mejorados del conjunto C* para estructurar un conjunto de “memoria”. 6) Reemplace con los mejores individuos del conjunto C* a los d anticuerpos con menos afinidad de la población inicial. Adicionalmente se cuenta con el parámetro denominado número randómico de células, que corresponde al porcentaje de individuos respecto a la población que serían generados I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos aleatoriamente con el fin de mantener la diversidad en la población. El rango se encuentra entre 0 y 100% respecto a la población. El valor calculado que optimiza el makespan para la mayoría de instancias fue del 10%. Este valor cobra sentido pues valores pequeños en este parámetro no alteran negativamente la diversidad en la población, lo cual haría que el algoritmo se estancara en una región del espacio de búsqueda. 3. METODOLOGÍA Para la realización del presente trabajo se plantearon las siguientes etapas: 1) Caracterización del Problema: En esta etapa se estudió la función objetivo del problema a resolver, se analizaron sus variables y la dinámica de comportamiento de las mismas. Con esto se pudo identificar cómo cada algoritmo, teniendo en cuenta sus características podría establecer soluciones parciales que pudiesen ser mejoradas en cada uno de los ciclos, recorridos o iteraciones. Para esto se revisó la literatura de metaheurísticas, y se establecieron los referentes de soluciones de problemas combinatorios y específicamente problemas de planificación. 2) Representación de la solución: Esta es una de las etapas fundamentales en el desarrollo, porque permite establecer cómo la inspiración biológica se puede caracterizar en las variables de los modelos matemáticos de los problemas de optimización. A partir de ahí en el caso del algoritmo inmune se logró la representación de los anticuerpos como sartas con valores reales que corresponden a la configuración de un calendario que es una solución candidata. Para el caso del algoritmo de hormigas, las hormigas construyen configuraciones posibles de calendarios como las rutas que se guardan en una memoria tabú, eso se codifica en sartas que se evalúan de acuerdo a las restricciones del problema. 3) Determinación de las instancias: Para la evaluación de este tipo de desarrollos se cuentan con familias de instancias creadas artificialmente para valorar el desempeño de algoritmos o metaheurísticas de optimización, la clave de esta etapa fue seleccionar una familia que brindara variedad, complejidad y buena difusión en la literatura para poder realizar contrastes con otros trabajos. De ahí que se valoraron 5 tipos distintos de familias y se seleccionaron las instancias de Lawrence, que son muy comunes para evaluar los algoritmos en este problema. 4) Implementación de los Algoritmos: Se analizaron las diferentes abstracciones de los algoritmos seleccionados y se determinaron como base dos técnicas, en el caso de los algoritmos inmunes artificiales se trabajó con el algoritmo de selección clonal al que se le realizaron las adaptaciones correspondientes en los operadores para que funcionara I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos adecuadamente en el problema seleccionado y con la codificación especificada. Para el caso de la metaheurística de colonia de hormigas se tomó como base el algoritmo de optimización por colonia de hormigas con algunas modificaciones como la inclusión del operador elitista y el apoyo de una búsqueda tabú que terminaron haciendo más eficiente al algoritmo genérico de optimización por colonia de hormigas. 5) Configuración de los algoritmos: Con un análisis de sensibilidad se establecieron los valores de los parámetros de entrada para los dos algoritmos (EAS, CLONALG), dichos valores se presentan en la Tabla 1 a continuación: TABLA 1. Parámetros iniciales algoritmo EAS Parámetro EAS Valor Influencia de la Feromona(𝛼) 0,2 Influencia de la heuristic information (𝛽) 0,8 Evaporación de la Feromona (𝜌) 0,7 Feromona Inicial(𝜏0 ) 0,002 Feromona Ganada (Q) 0,001 Número de Ciclos 1000 TABLA 2. Parámetros iniciales algoritmo CLONAG Parámetro CLONALG Valor Población anticuerpos 100 Numero de generaciones 300 Factor de mutación 0,1 Factor de clonación 0,1 Factor de generación 10% 6) Evaluación: Se establecieron dos criterios de evaluación, calidad y eficiencia de la solución. Para medir el desempeño de los algoritmos se realizaron comparaciones del número de evaluaciones de la función objetivo, que en el caso del problema corresponde al cálculo del makespan. Para medir la calidad de las soluciones, se realizó una comparación directa del makespan obtenido por el algoritmo propuesto en cada una de las instancias en 50 ejecuciones y se comparó con el mejor conocido (BKS) (Ver Tabla 3). Las medidas estadísticas que se reportan son el promedio 𝑥̅ , la varianza 𝑆 2 y la desviación estándar. De igual manera se valoró la cantidad de ciclos o iteraciones que necesitó cada algoritmo para llegar a la mejor solución, con esto se estableció una métrica de eficiencia, para estas se aplicaron de igual manera las medidas estadísticas mencionadas anteriormente. 4. PRUEBAS Y RESULTADOS I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos Las técnicas fueron programadas en lenguaje Java y las pruebas se desarrollaron en un equipo portátil con sistema operativo Windows 7, procesador Intel Core i5 primera generación a 2.53 Ghz y 4Gb de memoria RAM. Estas prestaciones fueron suficientes y no se requirió de apoyo adicional en procesamiento ni memoria. En la Tabla 3 y en la Figura 1, se observa el compendio de los resultados en cada instancia de Lawrence, se listan el mejor makespan 𝐶𝑚𝑎𝑥 obtenido por cada algoritmo, el error relativo frente al makespan de la mejor solución conocida (Best Known Solution, BKS) en la literatura (D. Cortés Rivera,2004), además se incluye la mejor solución conocida y el tamaño de cada instancia. TABLA 3. Resumen de errores relativos de los algoritmos para cada instancia del JSP (Best Known Solution [BKS], Algoritmo Colonia de Hormigas Elitista [EAS], Algoritmo de Selección Clonal [CLONALG]) Instancia Tamaño EAS BKS Cmax CLONALG Error relativo % Cmax Error relativo % LA01 666 666 0,00 666 0,00 LA02 655 669 2,14 655 0,00 597 617 3,35 603 1,01 LA04 590 595 0,85 590 0,00 LA05 593 593 0,00 593 0,00 LA06 926 926 0,00 926 0,00 LA07 890 890 0,00 890 0,00 863 863 0,00 863 0,00 LA09 951 951 0,00 951 0,00 LA10 958 958 0,00 958 0,00 LA11 1222 1222 0,00 1222 0,00 1039 1039 0,00 1039 0,00 1150 1150 0,00 1150 0,00 LA14 1292 1292 0,00 1292 0,00 LA15 1207 1212 0,41 1207 0,00 LA16 945 996 5,40 946 0,11 LA17 784 812 3,57 784 0,00 LA03 LA08 10 x 5 15 x 5 LA12 LA13 LA18 20 x 5 848 885 4,36 848 0,00 LA19 842 873 3,68 851 1,07 LA20 902 912 1,11 907 0,55 LA21 1046 1107 5,83 1102 5,35 927 995 7,34 974 5,07 1032 1049 1,65 1033 0,10 935 1008 7,81 987 5,56 LA22 LA23 LA24 10x 10 15 x 10 I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos LA25 977 1062 8,70 1028 5,22 LA26 1218 1296 6,40 1297 6,49 LA27 1235 1349 9,23 1342 8,66 1216 1322 8,72 1308 7,57 LA29 1157 1331 15,04 1286 11,15 LA30 1355 1410 4,06 1414 4,35 LA31 1784 1784 0,00 1784 0,00 1850 1860 0,54 1884 1,84 1719 1731 0,70 1723 0,23 LA34 1721 1778 3,31 1804 4,82 LA35 1888 1902 0,74 1918 1,59 LA36 1268 1396 10,09 1352 6,62 LA37 1397 1517 8,59 1508 7,95 LA28 20 x 10 LA32 LA33 LA38 30 x 10 1196 1315 9,95 1330 11,20 LA39 15 x 15 1233 1304 5,76 1331 7,95 LA40 1222 1300 6,38 1338 9,49 FIGURA 1. Comportamiento de los Makespan de los algoritmos para el JSP (Best Known Solution [BKS], Algoritmo Colonia de Hormigas Elitista [EAS], Algoritmo de Selección Clonal [CLONALG]) 2000 1750 Makespan 1500 1250 1000 BKS EAS CLONALG 750 LA01 LA03 LA05 LA07 LA09 LA11 LA13 LA15 LA17 LA19 LA21 LA23 LA25 LA27 LA29 LA31 LA33 LA35 LA37 LA39 500 Instancias En la figura 2 se observa el comportamiento del error a lo largo de las 40 instancias utilizando los 2 algoritmos, se observa cómo el algoritmo CLONALG presenta el comportamiento más estable de los dos durante las primeras 20 instancias, de ahí en adelante su comportamiento con base al error relativo es similar al algoritmo de colonia de hormigas EAS. Se observa que conforme las instancias son más grandes y de mayor complejidad los errores crecen en la mayoría de los casos haciendo una excepción en la I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos instancia 23 y el rango de la 30 a la 35, este comportamiento es similar en los 2 algoritmos. COMPARARLOS AQUÍ con BKS que no se hizo FIGURA 2. Comportamiento del error relativo para las instancias de Lawrence (Algoritmo Colonia de Hormigas Elitista [EAS], Algoritmo de Selección Clonal [CLONALG]) 18 EAS Error Relativo % 16 CLONALG 14 12 10 8 6 4 2 LA01 LA03 LA05 LA07 LA09 LA11 LA13 LA15 LA17 LA19 LA21 LA23 LA25 LA27 LA29 LA31 LA33 LA35 LA37 LA39 0 Instancias Fuente: Elaboración propia En la figura 3 se observa la clasificación de los promedios de los errores relativos de cada algoritmo para cada uno de los diferentes tamaños de las instancias de Lawrence, 5 instancias corresponden a cada tamaño y en total son 8 tamaños diferentes por las 40 instancias. Se observa que en los primeros cuatro tamaños se presentan los errores relativos promedios más bajos, siendo el tamaño 15X5 donde los dos algoritmos obtienen el promedio más bajo de los errores relativos y los promedios más altos de los errores relativos se encuentran en las instancias de 20X10 y 15X15. Es interesante observar que aunque en la mayoría de tamaños el mejor rendimiento lo obtuvo el algoritmo CLONALG para el caso de las instancias de mayor tamaño (30x10 y 15X15) presenta un mejor desempeño el algoritmo EAS. FIGURA 3. Representación del error relativo vs tamaño de las instancias para cada algoritmo en el JSP (Algoritmo Colonia de Hormigas Elitista [EAS], Algoritmo de Selección Clonal [CLONALG]) I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos EAS CLONALG Promedio Error Relativo % 10 9 8 7 6 5 4 3 2 1 0 10X5 15X5 20X5 10X10 15X10 20X10 30X10 15X15 Tamaño de las Instancias En la Tabla 4 se listan los errores relativos promedios, el mayor error la desviación estándar, y la varianza de cada uno de los algoritmos para el total de las 40 instancias. TABLA 4. Medidas de calidad respecto al error relativo de los algoritmos (Algoritmo Colonia de Hormigas Elitista [EAS], Algoritmo de Selección Clonal [CLONALG]) Algoritmos EAS CLONALG Promedio Error Relativo % 3,64 2,85 Mayor Error Relativo % 15,04 11,20 Desviación 3,90 3,66 Varianza 15,24 13,41 Fuente: Elaboración propia Se observa que el menor error y la menor dispersión de los datos fueron alcanzados por el algoritmo Inmune artificial, seguido muy cerca por el algoritmo de Hormigas. En la Tabla 5 se describen la cantidad de mejores soluciones alcanzadas por cada algoritmo y su porcentaje en referencia a las 40 instancias, se observa que el mejor rendimiento fue alcanzado por el algoritmo inmune artificial. TABLA 5. Cantidad de Mejores Soluciones alcanzadas por los algoritmos para el JSP (Algoritmo Colonia de Hormigas Elitista [EAS], Algoritmo de Selección Clonal [CLONALG]) Algoritmos EAS CLONALG I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos Cantidad de BKS alcanzados 12 17 Porcentaje BKS alcanzado % 30 42,5 Fuente: Elaboración propia En la Tabla 6 se comparan los desempeños de los 2 algoritmos respecto a la cantidad de evaluaciones promedio por cada algoritmo y algunas medidas estadísticas descriptivas con base a la dispersión de los datos, se observa que el algoritmo EAS presenta un numero de evaluaciones mucho menor al algoritmo CLONALG y la menor dispersión de datos, se observa que el comportamiento de los algoritmos CLONALG en función de las evaluaciones es muy variable y el consumo de iteraciones de evaluación es alto. TABLA 6. Medidas de desempeño respecto a las evaluaciones de los algoritmos (Algoritmo Colonia de Hormigas Elitista [EAS], Algoritmo de Selección Clonal [CLONALG]) Algoritmo EAS CLONALG Promedio Evaluaciones 3124,83 54542 Mayor número de Evaluaciones 8016 167801 Menor número de Evaluaciones 101 4 Desviación Evaluaciones 2557,49 47745,49 Varianza Evaluaciones 6540744,866 2279631831 Fuente: Elaboración propia 5. CONCLUSIONES El presente trabajo realizó una comparación entre los resultados de aplicación a problemas complejos de optimización de dos técnicas bio-inspiradas, que poseen características diferentes en relación a las estrategias de búsqueda que utilizan. Aunque dentro de los procesos de búsqueda de ambas técnicas existe un componente probabilístico, en la primera ese componente es más influyente/marcado durante dicho proceso, en la segunda, una técnica de búsqueda evolutiva, dicho componente permite diversificar la población de soluciones pero la búsqueda se realiza de manera evolutiva. En la comparación se pudo observar que el algoritmo Inmune Artificial presenta soluciones de mejor calidad que el algoritmo de Colonia de Hormigas para las instancias de Lawrence evaluadas, con un error relativo menor y un porcentaje mayor de mejores soluciones conocidas (BKS) alcanzadas, aunque el algoritmo de Optimización por Colonia de Hormigas presenta un mejor desempeño respecto a la cantidad de evaluaciones requeridas para encontrar la solución y desviación estándar de las mismas , donde la técnica de Optimización por Colonia de Hormigas requiere una menor cantidad de evaluaciones de soluciones que el algoritmo Inmune Artificial, generando soluciones con una búsqueda más eficiente, al converger hacia la solución con menos uso de recursos computaciones y I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos tiempo (esto hace que exijan los tiempos de ejecucion de los algoritmos), lo que la hace adecuada para la exploración de espacios de búsqueda inmensos como los que se presentan en las instancias de mayor tamaño relacionadas a una mayor cercanía a la complejidad problemas reales; en relación a la calidad de la solución se alcanzaron mejores resultados con la técnica evolutiva. Teniendo en cuenta lo anterior, se plantean dos recomendaciones para mejorar el desempeño y la calidad de trabajos futuros, la hibridación de técnicas bio-inspiradas aprovechando los mecanismos de búsqueda más destacadas de cada tipo ( probabilísticas y/o evolutivas), y la adaptación de un modelo de programación en paralelo, aprovechando las funciones e iteraciones que realizan instrucciones con datos diferentes, ejecutándolos sobre la diversidad de arquitecturas de cómputo SMP/SIMD existentes. 6. REFERENCIAS BIBLIOGRÁFICAS [1] M. R. Garey and D. S. Johnson, Computers and Intractability: A Guide to the Theory of NP-Completeness (Series of Books in the Mathematical Sciences). W. H. Freeman, 1979, p. 340. [2] C. A. C. Coello, D. R. Cortés, and N. C. Cortés, “Job Shop Scheduling using the Clonal Selection Principle,” Mexico DF, 2004. [3] A. Manne, “On the Job-Shop Scheduling Problem,” Oper. Res., vol. vol. 8, no. no. 2, pp. 219–223, 1960. [4] M. R. Garey, D. S. Johnson, and R. Sethi, “The Complexity of Flowshop and Jobshop Scheduling,” Math. Oper. Res., vol. 1, no. 2, pp. 117–129, 1976. [5] F. Ghedjati, “Heuristics and a hybrid meta-heuristic for a generalized job-shop scheduling problem,” IEEE Congr. Evol. Comput., pp. 1–8, Jul. 2010. [6] C. Blum and A. Roli, “Metaheuristics in Combinatorial Optimization : Overview and Conceptual Comparison,” vol. 35, no. 3, pp. 268–308, 2003. [7] S. Thomsen, “Metaheuristics combined with branch & bound.,” Copenhagen, Denmark, 1997. [8] M. G. C. Resende and C. C. Ribeiro, “Greedy randomized adaptive search procedures: Advances, hybridizations, and applications,” in Handbook of Metaheuristics, Springer, 2010, pp. 283–319. I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos [9] D. De Inform, T. Universidad, and S. Mar, “Estado del Arte del Job Shop Scheduling Problem Introducci ´ on Definici ´ on del Problema,” pp. 1–8, 2006. [10] M.Tupia, “Un algoritmo GRASP para resolver el problema de la programación de tareas dependientes en máquinas diferentes (task scheduling),” San Marcos, 2005. [11] S. Binato, W. J. Hery, and D. M. Loewenstern, “A grasp for job shop scheduling,” no. March, pp. 1–17, 2000. [12] M. Ventresca and B. M. Ombuki, “Ant Colony Optimization for Job Shop Scheduling Problem,” no. February, 2004. [13] Z. Problemler, Y. Ba, and N. D. E. Yen, “A NEW APPROACH TO SOLVE FLOWSHOP SCHEDULING PROBLEMS BY ARTIFICIAL IMMUNE SYSTEMS,” vol. 8, no. 1, pp. 12–27, 2007. [14] T. Witkowski, P. Antczak, and A. Antczak, “Solving the Flexible Open-Job Shop Scheduling Problem with GRASP and Simulated Annealing,” Artif. Intell. Comput. Intell., vol. vol. 2, p. 437,442,2010 [15] S. R. Lawrence, “Resource-Constrained Project Scheduling: An Experimental Investigation of Heuristic Scheduling Techniques,” Carnegie-Mellon University, 1984. [16] D. Applegate y W. Cook, “A study of the Job shop scheduling problem.pdf,” ORSA J. Comput., vol. 3, pp. 149–156, 1991. [17] A. E. Eiben and J. E. Smith, Introduction to Evolutionary Computing. Springer Berlin Heidelberg, 2003. [18] M. Dorigo and G. Di Caro, “Ant colony optimization: a new meta-heuristic,” in Evolutionary Computation, 1999. CEC 99. Proceedings of the 1999 Congress on, 1999, vol. 2, p. -1477 Vol. 2. [19] J. Kennedy and R. Eberhart, “Particle swarm optimization,” in Neural Networks, 1995. Proceedings., IEEE International Conference on, 1995, vol. 4, pp. 1942–1948 vol.4. [20] E. Flórez, W. Gómez, and L. Bautista, “AN ANT COLONY OPTIMIZATION ALGORITHM FOR JOB SHOP SCHEDULING PROBLEM.,” Int. J. Artif. Intell. Appl., vol. 4, no. 4, 2013. [21] L. N. De Castro, C. Brazil, and F. J. Von Zuben, “The Clonal Selection Algorithm with Engineering Applications 1,” no. July, pp. 36–37, 2000. I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx Edson Flórez, Nelson Díaz, Leydy Luna, Wilfredo Gómez, Lola Bautista Evaluación de algoritmos bioinspirados para la solución del problema de planificación de trabajos [22] W. A. Gómez Bueno, M. I. Cuadrado Morad, and H. Arguello Fuentes, “Algoritmo Basado en Una Red Inmune Artificial para La Alineación de Patrones de Puntos,” Rev. La Esc. Colomb. Ing., vol. v.86, pp. 25 – 33, 2012. [23] U. Garain, M. P. Chakraborty, and D. Dasgupta, “Recognition of Handwritten Indic Script using Clonal Selection Algorithm,” in Artificial Immune Systems, 2006, pp. 256–266. [24] N. C. Cortes and C. A. C. Coello, “Multiobjective Optimization using Ideas from the Clonal Selection Principle,” in Genetic and Evolutionary Computation—GECCO 2003, 2003, pp. 158–170. [25] F. O. de França, F. J. Von Zuben, and L. N. de Castro, “An artificial immune network for multimodal function optimization on dynamic environments,” Proc. 2005 Conf. Genet. Evol. Comput. - GECCO ’05, p. 289, 2005. [26] L. N. de Castro and F. J. Von Zuben, “Learning and optimization using the clonal selection principle,” IEEE Trans. Evol. Comput., vol. 6, no. 3, pp. 239–251, Jun. 2002. [27] J. Brownlee, “OAT HowTo : High-Level Domain , Problem , and Algorithm Implementation,” no. December, pp. 1–6, 2007. [28] N. E. D. DIAZ and L. J. L. Martínez, “Implementación de un Algoritmo Inmune Artificial Aplicado en el Área de Planificación de Recursos,” Universidad Industrial de Santander, 2012. [29] N. Diaz, J. Luna, W. Gomez, and L. Bautista, “Algoritmo Inmune de Selección Clonal para el problema de Job Shop Scheduling,” in IV Congreso Internacional de Computación e Informática, 2013. [30] D. Cortés Rivera, “Un Sistema Inmune Artificial para resolver el problema del Job Shop Scheduling,” CINVESTAV, 2004. I+D Revista de Investigaciones ISSN 2256-1676 Volumen 11 Número 1 Año 06. Enero a junio de 2018, pp.xx-xx
9cs.NE
An Approximation Algorithm for the Art Gallery Problem∗ Édouard Bonnet†1 and Tillmann Miltzow‡1 1 Institute for Computer Science and Control Hungarian Academy of Sciences (MTA SZTAKI) arXiv:1607.05527v1 [cs.CG] 19 Jul 2016 Abstract Given a simple polygon P on n vertices, two points x, y in P are said to be visible to each other if the line segment between x and y is contained in P. The Point Guard Art Gallery problem asks for a minimum set S such that every point in P is visible from a point in S. The set S is referred to as guards. Assuming integer coordinates and a specific general position assumption, we present the first O(log OPT)-approximation algorithm for the point guard problem.1 This algorithm combines ideas of a paper of Efrat and Har-Peled [16] and Deshpande et al. [13, 14]. We also point out a mistake in the latter. 1 Introduction Given a simple polygon P on n vertices, two points x, y in P are said to be visible to each other if the line segment between x and y is contained in P. The point-guard art gallery problem asks for a minimum set S such that every point in P is visible from a point in S. The set S is referred to as guards. A huge amount of research is committed to the studies of combinatorial and algorithmic aspects of the art gallery problem, such as reflected by the following surveys [19, 30, 32, 33]. Most of this research, however, is not focused directly on the art gallery problem but on variants, based on different definitions of visibility, restricted classes of polygons, different shapes and positions of guards, and so on. The most natural definition of visibility is arguably the one we gave above. Other possible definitions are: x sees y if the axis-parallel rectangle spanned by x and y is contained in P; x sees y if the line segment seg(x, y) intersects P at most c times, for some value of c; x sees y if there exists a straight-line path from x to y within P with at most c bends. Common shapes of polygons include: simple polygons, polygons with holes, simple orthogonal polygons, x-monotone polygons and star-shaped polygons. Common placements of guards include: vertex guards and point guards as defined above, but also edgeguard (guards are edges of the polygon), segment guards (guards are interior segments of the polygon) and perimeter guards (guards must be placed on the boundary of P). The art gallery problem variants, also distinguish the way that the polygon is covered. For example, it might be required that every point is seen by two different guards; sometimes it might be required that every point is covered by one guard of each color; and recently the community gets also interested in conflict-free guard colorings. That is, every point has a color such that it sees ∗ supported by the ERC grant PARAMTIGHT: ”Parameterized complexity and the search for tight complexity results”, no. 280152. † [email protected][email protected] 1 For the benefit of the reviewers, we uploaded on youtube a video that describes informally the main ideas of the paper: https://youtu.be/k5CDeimSuBM. The video is meant as supplementary material and is not required for anything that is coming. 1 exactly one guard of that color. In 1978, Steve Fisk proved elegantly that bn/3c guards are always sufficient and sometimes necessary for a polygon with n vertices [18]. Five years earlier, Victor Klee has posed this question to Václav Chvátal, who soon gave a more complicated solution. This constitutes the first combinatorial result related to the art gallery problem. On the algorithmic side, very few variants are known to be solvable in polynomial time [15, 29] and most results are on approximating the minimum number of guards [13, 14, 16, 20, 25, 26]. Many of the approximation algorithms are based on the fact that the range space defined by the visibility regions has bounded VC-dimension for simple polygons [21, 22, 34]. This makes it easy to use the algorithmic ideas of Clarkson [8, 12]. On the lower bound side, Eidenbenz et al. [17] showed NP-hardness and inapproximability for most relevant variants. In particular, they show for the main variants that there is no capproximation algorithm for simple polygons, for some constant c. For polygons with holes, they can even show that there is no o(log n)-approximation algorithm. Also, their reduction from Set-Cover implies that the art gallery problem is W[2]-hard on polygons with holes and that there is no no(k) algorithm, to determine if k guards are sufficient, under the Exponential Time Hypothesis [17, Sec.4]. Recently, a similar result was shown for simple polygons (without holes) [6, 7]. Despite, the large amount of research on the art gallery problem, there is only one exact algorithmic result on the point guard variant. The result is not so well-known and attributed to Micha Sharir [16]: One can find in nO(k) time a set of k guards for the point guard variant, if it exists. This result is quite easy to achieve with standard tools from real algebraic geometry [3] and apparently quite hopeless to prove without this powerful machinery (see [4] for the very restricted case k = 2). Despite the fact that the algorithm uses remarkably sophisticated tools, it uses almost no problem-specific insights and no better exact algorithms are known. Some recent ETH-based lower bounds [6, 7] suggest that there might be no better exact algorithm even for simple polygons. Regarding approximation algorithms for the point guard variant, the results are similarly sparse. For general polygons, Deshpande et al. gave a randomized pseudo-polynomial time O(log n)-approximation algorithm [13, 14]. However, we show that their algorithm is not correct. Efrat and Har-Peled gave a randomized polynomial time O(log |OP Tgrid |)-approximation algorithm by restricting guards to a very fine grid [16]. However, they could not prove that their Sgrid grid solution is indeed an approximation of an optimal guard placement. Developing the ideas of Deshpande et al. in combination of the algorithm of Efrat and Har-Peled, we attain the first randomized polynomial-time approximation algorithm for simple polygons. Here, OP T denotes an optimal set of guards and OP Tgrid an optimal set of guards that is restricted to some grid. At last, we want to mention that there exist approximation algorithms for monotone and rectilinear polygons [27], when the very restrictive structure of the polygon is exploited. To understand the lack of progress, note that the art gallery problem can be seen as a geometric hitting set problem. In a hitting set problem, we are given a universe U and a set of subsets S ⊆ 2U and we are asked to find a smallest set X ⊆ U such that ∀r ∈ S ∃x ∈ X : x ∈ r. Usually the set system is given explicitly or can be at least easily restricted to a set of polynomial size. In our case, the universe is the entire polygon (not just the boundary) and the set system is the set of visibility regions (given a point x ∈ P, the visibility region Vis(x) is defined as the set of points visible from x). The crucial point is that the set system is infinite and no one has found a way to restrict the universe to a finite set (see [1, 11] for some attempts). We also wish to quote a recent remark by Bhattiprolu and Har-Peled [5]: ”One of the more interesting versions of the geometric hitting set problem, is the art gallery problem, where one is given a simple polygon in the plane, and one has to select a set of points (inside or on the boundary of the polygon) that “see” the whole polygon. While much research has gone into variants of this problem [30], nothing is known as far as an approximation algorithm (for the general problem). The difficulty arises from the underlying set system being 2 infinite, see [16] for some efforts in better understanding this problem.” Here, we present the first approximation algorithm for simple polygons under some mild assumptions. Assumption 1 (integer vertex representation). Vertices are given by integers, represented in binary. An extension of a polygon P is a line that goes through two vertices of P. Assumption 2 (general position assumption). No three extensions meet in a point of P which is not a vertex and no three vertices are collinear. Note that we allow that three (or more) extensions meet in a vertex or outside the polygon. Theorem 1. Under Assumptions 1 and 2, there is a randomized O(log |OP T |)-approximation algorithm for Point Guard Art Gallery for simple polygons that runs in polynomial time in the size of the input. The main technical idea is to show the following lemma: Lemma 2 (Global Visibility Containment). Let P be some (not necessarily simple) polygon. Under Assumptions 1 and 2, it holds that there exists a grid Γ and a guard set Sgrid ⊆ Γ, which sees the entire polygon and |Sgrid | = O(|S|), where S is an optimal guard set. To be a bit more precise, let M be the largest appearing integer. Then the number of points in Γ is polynomial in M . This is potentially exponential in the size of the input. Thus algorithms that rely on storing all points of Γ explicitly do not have polynomial worst case running time. The algorithm of Efrat and Har-Peled [16] does not store every point of Γ explicitly and, with the lemma above, the algorithm gives an O(log |OP T |)-approximation on the grid Γ. While Lemma 2 tells us that we can restrict our attention to a finite grid, when considering constant factor approximation, the same is not known for exact computation. In particular, it is not known whether the Point Guard problem lies in NP. Recently, some researchers popularized an interesting class, called ∃R, being somewhere between NP and PSPACE [9, 10, 28, 31]. Many geometric problems, for which membership in NP is uncertain, have been shown to be complete for this class. This suggests that there might be indeed no polynomial sized witness for these problems as this would imply N P = ∃R. The history of the art gallery problem suggests the possibility that the Point Guard problem is ∃R-complete. If N P 6= ∃R, then this would imply that there is indeed no hope to find a witness of polynomial size for the Point Guard problem. In computational geometry and discrete geometry many papers assume that no three points lie on a line. Often this assumption is a pure technicality, in other cases the result might indeed be wrong without this assumption. In our case, we do believe that Lemma 2 could be proven without Assumption 2, but it seems that some new ideas would be needed for a rigorous proof. See [2] for an example where the main result is that some general position assumption can be weakened. The idea of general position assumptions is that a small random perturbation of the point set yields the assumption with probability almost 1. In case that the points are given by integers small random perturbations, destroy the integer property. But random perturbations could be performed in a different way, by first multiplying all coordinates by some large constant 2C ∈ N and then add a random integer x with −C 6 x 6 C. The integer representation assumption (Assumption 1) seems to be very strong as it gives us useful distance bounds not just between any two different vertices of the polygon, but also between any two objects that do not share a point (see Lemma 5). On the other hand, real computers work with binary numbers and cannot compute real numbers with arbitrary precision. 3 The real-RAM model was introduced as a convenient theoretical framework to simplify the analysis of algorithms with numerical and/or geometrical flavors, see for instance [24, page 1] and [23, Remark 23.1]. Also note that Assumption 1 can be replaced by assuming that all coordinates are represented by rational numbers with specified nominator and denominator. (There could be other potentially more compact ways to specify rational numbers.) Multiplying all numbers with the smallest common multiple of the denominators takes polynomial time, makes all numbers integers and does not change the geometry of the problem. Given a polygon P, we will always assume that all its vertices are given by positive integers in binary. (This can be achieved in polynomial time.) We denote by M the largest appearing integer and we denote by diam(P) the largest distance between any two points in P. Note that diam(P) < 2M . We denote L = 20M > 10. Note that log L is linear in the input size. We define the grid Γ = (L−11 · Z2 ) ∩ P. Note that all vertices of P have integer coordinates and thus are included in Γ. Theorem 3 (Efrat, Har-Peled [16]). Given a simple polygon P with n vertices, one can spread a grid Γ inside P, and compute an O(log OP Tgrid )-approximation for the smallest subset of Γ that sees P. The expected running time of the algorithm is 2 log OP Tgrid log(n OP Tgrid ) log2 ∆), O(n OP Tgrid where ∆ is the ratio between the diameter of the polygon and the grid size. The term OP Tgrid refers to the optimum, when restricted to the grid Γ. For the solution S that is output by the algorithm of Efrat and Har-Peled holds |S| = O(|OP Tgrid | log |OP Tgrid |). However, Efrat and Har-Peled make no claim on the relation between |S| and the actual optimum |OP T |. Note that the grid size equals w = L−11 , thus ∆ 6 L11+1 = L12 and consequently log ∆ 6 12 log L, which is polynomial in the size of the input. Efrat and Har-Peled implicitly use the real-RAM as model of computation: elementary computations are expected to take O(1) time and coordinates of points are given by real numbers. As we assume that coordinates are given by integers, the word-RAM or integer-RAM is a more appropriate model of computation. All we need to know about this model is that we can upper bound the time for elementary computations by a polynomial in the bit length of the involved numbers. Thus, going from the real-RAM to the word-RAM only adds a polynomial factor in the running time of the algorithm of Efrat and Har-Peled. Therefore, from the discussion above we see that it is sufficient to prove Lemma 2. Organization. In Section 2, we will describe the counterexample to the algorithm of Deshpande et. al. This will be also very useful as a starting point of Section 3, where we will give an elaborate overview of the forthcoming proofs. Detailed and formal proofs are presented at Section 4, where they can be read in logical order without references to Section 3. Finally in Section 5, we briefly indicate the remaining open questions. 2 Counterexample In this section, we will point out a mistake in the algorithm of Deshpande et al. [13, 14]. This mistake though constitutes an interesting starting point for our purpose. The algorithm by Deshpande et al. can be described from a high level perspective as follows: maintain and refine a triangulation T of the polygon until for every triangle ∆ ∈ T holds the so called local visibility containment property. The local visibility containment property of ∆ certifies that every point p ∈ ∆ can only see points that are also seen by the vertices of ∆. 4 However, we will argue that it is impossible to attain the local visibility containment property with any finite triangulation; hence, the algorithm never stops. Again, we want to mention that the paper of Deshpande et al. has ideas that helped to achieve the result of the present paper. In particular, we will show that the local visibility containment property does indeed hold most of the time. a1 a2 a3 t Figure 1: Illustration of the counterexample to the algorithm of Deshpande et al. [13, 14] Example 4 (Refutation of Deshpande et al. [13, 14]). See Figure 1, for the following description. We have two opposite reflex vertices with supporting line `. The points (ai )i∈N are chosen closer and closer to ` on the right side of the polygon. None of the ai ’s can see t, as this would require to be actually on `. Further, it is easy to see that the visible interval next to t gets smaller and smaller as well. In fact, we can choose the points (ai )i∈N in a way that their intervals will be all disjoint. Consider now any finite collection of points C in the vicinity of the (ai )i∈N . We will show that there is some ai , which sees some interval close to t, that is not seen by any point in C. Recall that no point sees the entire interval around t, but the visibility of the ai ’s come arbitrarily close to t. Thus, there is some ai that sees something that is not visible by any of the points of C. 3 Proof Overview In this section, we will describe all the proof ideas without going into too much technical details. Definitions are given by figures and some technical conditions are not stated at all. The reader who feels uncomfortable with this is deferred to Section 4, where all definitions are rigorously made and all lemmas are presented with formal, detailed proofs. Some readers might also be concerned with the wrong proportions of the figures. Some distances which are supposedly very small are displayed fairly large and vice versa. The reader has to keep in mind that all figures only indicate principal behavior. Our high level proof idea is that the local visibility property holds for every point x that is far enough away from all extension lines. (Recall that the extension of two vertices is the line that contains these vertices.) In a second step, we will show that it is impossible to be close to more than 2 extensions at the same time. We will add one vertex for each extension that x is close two. Recall that vertices are also in Γ. It turns out that the first step is considerably more tedious than the second one. The reason for that is that many of the elementary steps are not true in the naive way, one might think of at first. Thus we have to carefully define the sense in which they are true and handle the other case in a different manner. The tricky bit is usually to identify these cases and to carefully define them. All proofs are elementary otherwise. 5 3.1 Benefit of integer coordinates The integer coordinate assumption implies not just that the distance between any two vertices is at least 1 but it also gives useful lower bounds on distances between any two objects of interest that do not share a point. For example the distance between an extension ` and a vertex v not on ` is at least L−1 . Also the angle between any two non-parallel extensions is at least L−2 . (Recall that L is an upper bound on the diameter and the largest appearing integer.) As these bounds are important for the intuition of the forthcoming ideas, we will proof one of them. Claim. Let ` = `(w1 , w2 ) be the extension of the two vertices w1 , w2 of P and v ∈ / ` some other vertex of P. Then, it holds d = dist(v, `) > L−1 . Here dist(v, `) denotes the euclidean distance between v and `. w1 ` u := w2 w2 − w1 kw2 − w1 k2 d = u⊥ · (v − w2 ) v Figure 2: Computing the distance between a line and a vertex. Proof. The distance d can be computed as d= |(v − w1 ) · (w2 − w1 )⊥ | 1 1 > > . kw2 − w1 k diam(P) L See Figure 2 for a way to derive this elementary formula. Here · denotes the scalar product and x⊥ is the vector x rotated by 90◦ and kxk2 is the euclidean norm of x. The key inside is that the nominator of this formula is at least 1 as it is a non-zero integer by assumption. The denominator is upper bounded by the diameter of P, which is in turn upper bounded by L. All other lower bounds are derived in the same spirit, however with worth bounds. As we choose our grid width smaller than any of these bounds, we will be in the very fortunate situation that everything looks very simple from a local perspective. 3.2 Surrounding Grid Points ≤ L−1 Figure 3: The red point indicates a point of the original optimal solution. The blue points indicate the surrounding grid points that we choose. The polygon is indicated by bold lines. From left to right, we have the three cases: interior case, boundary case and corner case. To the very right, we indicate that in every case vertices of P with distance less than L−1 are also included in α-grid∗ (x). 6 Given a point x ∈ OP T we define α-grid(x) as some grid points around x, as displayed in Figure 3. The parameter α  1 determines how far away these points are. As the grid-width w is much smaller than α, we have a choice on how exactly to place these points. See Section 4.3 for a precise definition. If there is any vertex v of P with dist(x, v) 6 L−1 , then this point will be included into α-grid∗ (x). 3.3 Local Visibility Containment For any extension ` we define an s-bad region, see the gray area in Figure 4a for an illustration. Note that the bad region consists of two connected components, each being a triangle. The parameter s = tan(β) as indicated in the figure. Further, for each point x, the visibility region can be decomposed into triangles as indicated in Figure 4b. ∆ r2 ≤ sL r1 x β slope = s (a) A polygon with two opposite reflex vertices and their (b) The star triangle decomposition of the s-bad region. visibility region of x. Figure 4 Let ∆ be some triangle of the visibility region of x (in blue in Figure 4b). Then the main lemma asserts that α-grid∗ (x) sees ∆ except, if x is in an s-bad region of the vertices defining ∆, see Lemma 11. (With the right choice of α and s.) Important is the one-to-one correspondence between the triangles that cannot be seen and the extension line that we can make responsible for it. The first technical lemma concerns the possibility that there is a reflex vertex q that blocks the visibility of the points of α-grid(x) onto ∆, see Figure 5. We can show that this can happen only in a negligible amount. For this recall that α-grid(x) is very close to x, but q must have distance at least L−1 , as otherwise it would be included into α-grid∗ (x). We call this phenomenon limited blocking. −2 ray1 ≤L ≤ L−2 ray2 Figure 5: The visibility of the grid points g ∈ α-grid(x) can be blocked, but we can bound the amount by which it is blocked. The key idea to show that R2 can be seen by α-grid(x) is to show that the region indicated in solid black is empty. Further the triangle ∆ is split into a small triangle (R1 ) and a trapezoid(R2 ), as indicated 7 in Figure 6a. We show separately, for R1 and R2 that α-grid∗ (x) sees these two regions. r1 x R1 R2 r2 x (a) To show that each triangle of the visibility region is visible by α-grid∗ (x), we treat the small triangle R1 and the trapezoid R2 individually. In particular, as we do not make use of the finiteness of R2 , we just assume it is an infinite cone. (b) The point x is not in an s-bad region implies that α-grid(x) is not in an s/2 bad region. Figure 6 To prove that α-grid∗ (x) sees R1 is not so difficult. We have already argued that reflex vertices v (with dist(x, v) > L−1 ) can only block a small part of the visibility of α-grid(x). (Recall that any vertex v with dist(x, v) < L−1 is included in α-grid∗ (x).) With some simple case distinctions, we can argue that this visibility is sufficient to see R1 . In particular, the argument does not rely on x being outside a bad region. To prove that R2 can be seen by α-grid∗ (x) is more demanding. As it seems not useful to use the boundedness of R2 , we just assume it to be an infinite cone and we try to show that α-grid∗ (x) sees this cone. Obviously, the part of ∂P “behind” seg(r1 , r2 ) is not considered blocking. The crucial step to show that R2 can be seen by α-grid∗ (x) is to show that the black region as indicated in Figure 5 does not exist. The idea is that this is implied if ray1 and ray2 diverge. In other words if ray1 and ray2 never meet and the black region is empty. For this purpose, we make use of the fact that dist(g1 , g2 ) ≈ α, for any g1 , g2 ∈ α-grid(x) by definition, while dist(r1 , r2 ) > 1, because of integer coordinates. Thus intuitively, the distance of ray1 and ray2 is closer at its apex than at the segment seg(r1 , r2 ). For the proof to gp through we further need α-grid∗ (x) not to be in an s/2-bad region, which follows from x not being in an s-bad region, see Figure 6b. The proof becomes technically even more tedious as we have to take into consideration that the visibility of α-grid∗ (x) might be partially blocked. This also forces us to introduce embiggened bad regions, which differ only marginally from bad regions as defined above. 3.4 Global Visibility Containment ⇒ γ β Figure 7: Three bad regions meeting in an interior point implies that the extensions must meet in a single point. No two bad regions intersect in the vicinity of a vertex, as they are defined by some angle β  L−2 . But the angle γ between any two extensions is at least L−2 . Given a minimum solution OP T , we describe a set G ⊆ Γ of size O(|OP T |). We will also 8 show that G sees the entire polygon. For each x ∈ OP T , G contains α-grid∗ (x). Further if x is contained in an s-bad region, G contains at least one of the vertices defining it. It is clear by the previous discussion that G sees the entire polygon, as the only part that is not seen by α-grid∗ (x) are some small regions, which are entirely seen by the vertices bounding it. It remains to show that there is no point in three bad regions. For this, we heavily rely on the integer coordinates and the general position assumption. Note that the integer coordinate assumption implies not just that the distance between any two vertices is at least 1 but also that the distance between any extension ` and a vertex v not on ` is at least L−1 . Also the angle between any two extensions is at least L−2 . (Recall that L is an upper bound on the diameter and the largest appearing integer.) These bounds and other bounds of this kind imply that if any three bad regions meet in the interior, then their extension lines must meet in a single point, see Figure 7. We exclude this by our general position assumption. Close to a vertex, we use a different argument: No two bad regions intersect in the vicinity of a vertex, as bad regions are defined by some angle β with tan(β)  L−2 . But the angle γ between any two extensions is at least L−2 . This implies that each x is in at most 2 bad regions and |G| = (7 + 2)|OP T | = O(|OP T |). Figure 8: The red dots indicate the optimal solution. The blue dots indicate the The red dot on the top is in the interior case and four grid points are added around it. The red dot on the left is too close to two supporting lines and we add one of the reflex vertices of each of the supporting lines. The red dot to the right has distance less than L−1 to a reflex vertex, so we add that vertex as well to G. 4 4.1 Proofs Preliminaries Polygons and visibility. For any two distinct points v and w in the plane, we denote by seg(v, w) the segment whose two endpoints are v and w, by ray(v, w) the ray starting at v and passing through w, by `(v, w) the supporting line passing through v and w. We think of `(v, w) as directed from v to w. Given a directed line `, we denote by `+ the half-plane to the right of ` bounded by `. We denote by `− the half-plane to the left of ` bounded by `. We also denote by disk(v, r) the disk centered in point v and whose radius is r, and by dist(a, b) the distance between point a and point b. We denote by diam(P) the diameter of P and by M the largest appearing integer of any vertex of P. We further assume that all coordinates are represented by positive integers. (As already stated earlier, this can be achieved in polynomial time.) We define L = 20M . This implies diam(P) 6 2M and 10 diam(P) 6 L. A polygon is simple if it is not self-crossing and has no holes. For any point x in a polygon P, Vis(x), denotes the visibility region of x within P, that is the set of all the points y ∈ P such that segment seg(x, y) is entirely contained in P. 9 symbol P Vis(x) diam(P) M L Γ seg(v, w) v(p, q) ∈ S 1 ray(p, q) ray(p, v) `(v, w) `+ , `− disk(v, r) dist(a, b) disthorizontal (a, b) distvertical (a, b) α-grid (x) α-grid ∗ (x) cone(x, r1 , r2 ) cone(x) apex(x, y) definition denotes underlying polygon (we assume all coordinates to be positive) visibility region of x the largest distance between any two points in P largest appearing integer of P = 20M (it holds diam(P) 6 10L.) the grid (L−11 · Z2 ) ∩ P. segment with endpoints v and w direction from p to q p, q points in the plane: ray with apex p in direction v(p, q) p points in the plane, v ∈ S 1 direction: ray with apex p in direction v line through v and w directed from v to w the half-plane to the right respectively to the left of line ` disk centered in point v with radius r euclidean distance between a and b. |ax − bx | |ay − by | some grid points around x, see Figure 11 α-grid(x) and including a possible vertex v with dist(r, x) 6 L−1 a cone with apex x bounded by ray(x, r1 ) and ray(x, r2 ) we use this notation, when r1 and r2 are clear from context. see Figure 18b and Definition 15 Figure 9: This is a glossary of all used notation. Not all of which is introduced in the Preliminaries. 4.2 Benefit of Integer Coordinates The way we use the integer coordinate assumption is to infer distance lower bounds between various objects of interest. The proofs are technical and not very enlightening. Fortunately they are short. Lemma 5 (Distances). Let P be a polygon with integer coordinates and L as defined above. Let v and w be vertices of P, ` and `0 supporting lines of two vertices, and p and q intersections of supporting lines. 1. dist(v, w) > 0 ⇒ dist(v, w) > 1. 2. dist(v, `) > 0 ⇒ dist(v, `) > L−1. 3. dist(p, `) > 0 ⇒ dist(p, `) > L−5 . 4. dist(p, q) > 0 ⇒ dist(p, q) > L−4 . 5. Let ` 6= `0 be parallel. Then dist(`, `0 ) > L−1 . 6. Let ` 6= `0 be any two non-parallel supporting lines and α the smaller angle between them. Then holds tan(α) > 8L−2 . 7. Let a ∈ P be a point and `1 and `2 be some non-parallel lines with dist(`i , a) < d, for i = 1, 2. Then `1 and `2 intersect in a point p with dist(a, p) 6 dL2 . Proof. Case 1 seems trivial, but follows the same general principal as the other bounds. All these distances, are realized by geometric objects, and these geometric objects are represented with the help of the input integers. In order to compute theses distances some elementary calculations 10 are performed and solutions can be expressed as fractions of the input integers. Using the lower bound one and the upper bound L or L/2 on these integers or derived expressions give the desired results. Consider Case 2. Let ` be the supporting line of w1 and w2 . The distance d between v and   ⊥ x2 x1 ⊥ 1 )·(w2 −w1 ) | represents the orthogonal vector = ` can be expressed as |(v−wkw , where −x x −w k 1 2 2 1 to x and · indicates the dot product. As v is not on ` the nominator is lower bounded by one. The denominator is upper bounded by the diameter diam(P). Consider Case 3. Let p be the intersection of `1 = `(v1 , v2 ) and `2 = `(u1 , u2 ). Then p is the unique solution to the linear equations (u2 − u1 ) · (p − u1 ) = 0 and (v2 − v1 ) · (p − v1 ) = 0. So let i) us write this as an abstract linear equation A · x = b. By Cramer’s rule holds xi = det(A det(A) , for i = 1, 2. Here det(.) is the determinant and Ai is the matrix with the i-th column replaced by b. It is easy to see that det(A) is bounded by L2 . Let ` = `(w1 , w2 ) be a different line. Observe that the points w1 , w2 and p lie on a grid Γ∗ of width 1/ det(A). After scaling everything with det(A) the diameter diam(P) of this grid becomes det(A)L 6 L3 . Thus by Case 2 the distance between the line ` and the grid point p is lower bounded by (1/L∗ ) > 1/L3 . Scaling everything back by 1/det(A) > L−2 yields the claimed bound. Consider case 4. Let p be the intersection of `1 = `(v1 , v2 ) and `2 = `(u1 , u2 ). And likewise let q be the intersection of `3 = `(w1 , w2 ) and `2 = `(t1 , t2 ). Then p is the unique solution to the linear equations (u2 − u1 ) · (p − u1 ) = 0 and (v2 − v1 ) · (p − v1 ) = 0. So let us write this as an i) abstract linear equation A · x = b. By Cramer’s rule holds xi = det(A det(A) , for i = 1, 2. Thus the a coefficients of p − q can be represented by det(A)·det(A 0 ) for some value a 6= 0 and some matrices 0 0 A and A . Note that det(A) and det(A ) are bounded by L2 from above. Case 5 follows from Case 2. Let `0 = `(w1 , w2 ). Then dist(`, `0 ) = dist(`, w1 ) > 1/L. Consider case 6. We assume ` = `(v1 , v2 ) and `0 = `(w1 , w2 ). The expressions tan(α) can be computed by k(v2 − v1 ) × (w2 − w1 )k 1 8 > > 2. 2 k(v2 − v1 )k · k(w2 − w1 )k diam(P) L d ` p α β ≤ 2d a d 0 ` x Figure 10 For case 7, see Figure 10 and the notation therein. Without loss of generality we assume α > β. It follows from elementary calculus that z 6 tan(z) 6 2z, for any sufficiently small z. This implies 8L−2 6 tan(α + β) 6 2(α + β) 6 4α 6 4 tan α. We follow from x tan α 6 2d, it holds x 6 2d/ tan α 6 dL2 . 4.3 Defining surrounding grid points The point of this section is to define for a point x some grid-points α-grid(x) surrounding x. Morally, α-grid(x) should see whatever x sees. However, this cannot be achieved in general. Definition 6 (Rounding). Given a point x ∈ P, we define the point round(x) = g ∈ Γ ⊂ P as the closest grid-point to x. In case that there are several grid-points with the same minimum 11 ≤ L−1 Figure 11: The red point indicates a point of the original optimal solution. The blue points indicate the surrounding grid points that we choose. The polygon is indicated by bold lines. From left to right, we have the three cases: interior case, boundary case and corner case. To the very right, we indicate that in every case vertices of P with distance less than L−1 are also included in α-grid∗ (x). distance to x, we choose the one with lexicographic smallest coordinates. The important point here is that round(x) is uniquely defined. Definition 7 (Surrounding Grid points). Given a point x ∈ P and a number α ∈ [0, L−2 ], we define α-grid(x) as a set of grid points around x. The definition depends on the position of x and the value α. Let c be a circle with radius alpha and center x. Then there exists a unique triangle ∆(x) inscribed c such that the lower side of ∆(x) is horizontal. We distinguish three cases. In the interior case, ∆(x) and ∂P are disjoint. In the boundary case, ∆(x) and ∂P have a non-empty intersection, but no vertex of P is contained in ∆(x). In the corner case, on vertex of P is contained in ∆. It is easy to see that this covers all the cases. We also say a point x in the interior case, and so on. In the interior case α-grid(x) is defined as follows. Let v1 , v2 , v3 be the vertices of ∆. Then the grid points round(vi ), for all i = 1, 2, 3 form the surrounding grid points. In the boundary case α-grid(x) is defined as follows. Let S be the set of vertices of ∆ and all intersection points of ∂P with ∂∆(x). Then the grid points round(v), for all v ∈ S ∩ P form the surrounding grid points. In the corner case α-grid(x) is defined as follows. Let S be the set of vertices of ∆. all intersection points of ∂P with ∂∆ and the vertex of P contained in ∆. Then the grid points round(v), for all v ∈ S ∩ P form the surrounding grid points. In any case, if there is a reflex vertex r with dist(x, r) 6 L−1 then we include r in the set α-grid∗ (x) = r ∪ α-grid(x) as well. We will usually denote the points in α-grid(x) with g1 , g2 or just g. As we will choose α  w, the difference between x and round(x) is negligible and thus we will assume that x = round(x). 4.4 Local Visibility Containment Definition 8 (Local Visibility Containment property). We say a point x has the α-local visibility containment property if [ Vis(x) ⊆ Vis(g). g∈α-grid∗ (x) Definition 9 (Opposite reflex vertices and bad regions). Given a polygon P and two reflex vertices r1 and r2 , consider the supporting line ` = `(r1 , r2 ) restricted to P. We say r1 is opposite to r2 if both incident edges of r1 lie on the opposite side of ` as the edges of r2 , see Figure 12a, for an illustration. Given two opposite reflex vertices r1 and r2 , we define their s-bad region as the union of the two triangles as in Figure 12a, where we set the slope to s. Alternatively, let β be the angle at ri , then we define tan(β) = s. 12 We denote by pi the point on seg(r1 , r2 ) with dist(pi , ri ) = L−2 , for i = 1, 2. We define the embiggened s-bad region of r1 and r2 as the union of the two triangles ∆1 and ∆2 , one of which is displayed in Figure 12b. Formally triangle ∆i has one corner pi . The two edges incident to pi form a slope of s. One of these edges is part of `(r1 , r2 ) the other is in the interior of P. The last remaining edge is part of ∂P. r2 ≤ sL L−2 r1 r1 β p1 slope s slope = s (a) A polygon with two opposite reflex vertices and their s-bad regions. (b) The embiggened s-bad region. Figure 12: Illustration of bad regions and embiggened bad regions. Definition 10 (Triangle decomposition of visibility regions and cones). Given a polygon P and some point x, we define the star triangle decomposition of Vis(x) as follows. Let v1 , . . . , vt be the vertices visible from x in clockwise order. Then any two consecutive vertices u, v together with x define a triangle ∆ of Vis(x). Note that u, v are not necessarily the vertices of ∆, see Figure 13a. Also note that the definition does not require the polygon to be simple. (The polygon could have holes.) We denote by cone(x, u, v) = cone(x) the cone with apex x that is bounded by ray(x, u) and ray(x, v), see Figure 13b. We will assume that u and v are implicitly known and omit to mention them if there is no ambiguity. Note that cone(x) is unbounded and not contained in P. Let u, v be vertices, not necessarily visible from some other point g. Let s ⊆ seg(u, v), the part of the segment that is visible from g. Then we define [ cone(g) = ray(g, t). t∈s See the blue cone in Figure 13b. We say α-grid(x) sees cone(x) if [ [ cone(x) ⊆ Vis(g) ∪ cone(g). g∈α-grid(x) g∈α-grid(x) Note that cone(g) is not contained into Vis(g) as the cone is unbounded, whereas the visibility region is contained in P. We define α-grid∗ (x) sees cone(x) in the same fashion. The purpose of this Section is to prove Lemma 11. Lemma 11 (Special Local Visibility Containment Property). Let r1 and r2 be two consecutive vertices in the clockwise order of the vertices visible from x ∈ P and let x be outside the s-bad region of the vertices r1 and r2 . We make the following assumptions: 1. s 6 L−3 2. α 6 L−7 . 3. 16Lα 6 s Then α-grid∗ (x) sees cone(x). 13 x ∆ g x (b) The cone of x and g are displayed. Both (a) The star triangle decomposition of the vis- cones are unbounded. The cone of g is not ibility region of x. bounded by the vertices that define it. Figure 13: Illustration of the star triangle decomposition and cones. Note that, we do not exclude that x is outside any s-bad region but only outside the bad region of r1 and r2 . This subtlety makes the proof more complicated, as it might be that x is in an s-bad region with respect to some other pair of reflex vertices. For instance q, r1 , could be such a pair. It is not difficult to construct an example such that q blocks part of the visibility of α-grid(x). The proof idea is to show that this blocking is very limited (see Lemma 13) and then use only this partially obstructed visibility. Seeing cone(x) implies obviously also that the triangle ∆ ⊆ cone(x) is seen by α-grid(x). An immediate consequence is the following nice lemma. Lemma 12 (Local Visibility Containment Property). Every point x ∈ P outside any s-bad region has the α-local visibility containment property. We make the following assumptions: 1. s 6 L−3 2. α 6 L−7 . 3. 16 L α 6 s Proof. By Lemma 11, every triangle ∆ defined by the star triangle decomposition of Vis(x) is seen by α-grid∗ (x). For Lemma 13, see Figure 14a for an illustration of the setup. The next Lemma deals with the very special situation that there exists a reflex vertex q blocking the visibility of some g ∈ α-grid(x), although q ∈ / cone(x). The critical assumption is dist(q, x) > L−1 . Lemma 13 (Limited Blocking). Let x ∈ P, let r1 , r2 be two vertices and g ∈ α-grid(x) such that g ∈ / cone(x) and α 6 L−7 . Further, let q ∈ cone(g) be a reflex vertex with dist(x, q) > L−1 . We denote by p the intersection point between `(g, q) and seg(r1 , r2 ). Let g and r2 be on the same side of cone(x). Then holds: d = dist(p, r2 ) 6 L−2 . Proof. We show first dist(g, `(r1 , r2 )) > L−1 . Let ` be the line parallel to `(r1 , r2 ) containing the point q. Clearly, these two lines have distance at least L−1 , by Lemma 5 Item 2. And thus also g has at least this distance to `(r1 , r2 ), see Figure 14a. For the other part of the proof let us assume that `(r1 , r2 ) is vertical. We denote by c the vertical distance between g and `(q, r2 ) and by s the point realizing this distance, see Figure 14a. Note that dist(g, q) > dist(x, q) − dist(x, g) > L−1 − α > 1/(2L). By Thales Theorem we know: c c d = 6 = 2cL. dist(p, q) dist(g, q) 1/(2L) 14 r1 x p s d ≤ L−2 r2 q g (a) The reflex vertex q blocks the visibility of g. Fortunately, we can show that only a very small part of the visibility is actually blocked. r2 r1 p d γ q s γ c g e≤α (b) This Figure illustrates the proof of Lemma 13. Figure 14 This implies d 6 2cL dist(p, q) 6 2cL2 It is sufficient to show c 6 αL2 , as α 6 L−7 . For this purpose, we rotate `(r1 , r2 ) again so that it becomes horizontal, see Figure 14b. Now c is the vertical distance between g and `(q, r2 ). We define e = dist(g, `(r2 , q)) and we denote by γ the angle at r2 formed by `(r2 , q) and `(r1 , r2 ). We consider here only the case that γ < 90◦ , the other case is symmetric. We note that γ appears again at s. This implies e = sin(γ). c It is also easy to see that sin(γ) = L−1 dist(`(r1 , r2 ), q) > = L−2 . dist(r2 , q) L Further note that `(r2 , q) must intersect seg(g, x) as q blocks the visibility of g but not of x. Thus e = dist(g, `(r2 , q)) 6 α. This implies c= e 6 αL2 . sin(γ) And thus it holds d 6 2cL2 6 2(αL2 )L2 = αL5 6 L−7 L5 = L−2 . Lemma 14 (Small Triangle). Let x ∈ P and let r1 and r2 be two vertices such that ∆ = ∆(x, r1 , r2 ) ⊆ P. Then it holds that ∆(x, r1 , r2 ) is seen by α-grid∗ (x), with α 6 L−7 . Proof. We consider first the case that dist(x, `(r1 , r2 )) 6 L−1 /2. Note that there is at least one g ∈ α-grid(x) on the same side of `(r1 , r2 ) as x. It follows by Lemma 5 that there can be no vertex of P blocking the visibility of g to ∆(x, r1 , r2 ). Thus from now on, we can assume that dist(x, `(r1 , r2 )) 6 L−1 /2 and this implies in particular that x and α-grid(x) are on the same side of `(r1 , r2 ). 15 Q2 g1 r1 p1 x x p α q m T f p2 r2 g2 g2 Figure 15: Illustration to the proof of Lemma 14. At first consider the case that there is a grid point g ∈ α-grid(x) inside ∆. This implies the claim immediately, as ∆ is convex and it must be empty of obstructions, as ∆ can be seen by x. So, let us assume that there exist two other grid points g1 , g2 ∈ α-grid(x) as in Figure 15. Let us first consider the case that there is no other vertex q with dist(x, q) 6 L−1 . This implies, we can use Lemma 13 and infer that the visibility regions of g1 , g2 are only slightly blocked, as indicated in Figure 15. In particular this implies that there exists a point m ∈ seg(r1 , r2 ) that is visible from g1 and g2 , as dist(r1 , r2 ) > 1 > 2L−2 . We define the quadrangle Q1 = Q(g1 , m, r2 , x) and Q2 = Q(g2 , m, r1 , x). Here Q(t1 , t2 , t3 , t4 ) indicates the quadrangle with vertices t1 , . . . , t4 . Clearly it holds ∆ ⊆ Q1 ∪ Q2 . Thus it is sufficient to show that gi sees Qi , for i = 1, 2. We define the point p = seg(g2 , r1 ) ∩ seg(x, r2 ) and the triangle T = ∆(x, g2 , p). Inside T is the only region where part of P could block the visibility of g2 to see Q2 fully. As g2 can be assumed to see x this blocking part would correspond to a hole of P. But note that a whole has at least 3 vertices and area at least 1/2. The area of T is bounded by αL, as one of its edges has length α and the height is trivailly bounded by L. It remains to consider the case that there exists one vertex q with dist(x, q) < L−1 . This immediately implies q ∈ α-grid∗ (x). If q does not block the vision of either g1 or g2 , we are done. Otherwise, note that q can block the vision of at most one of them, say g1 and there is at most one vertex q with dist(x, q) < L−1 . Thus after removal of q the previous argument above can be applied. Now as q blocks g1 it must be either the case that q ∈ cone(g1 ) or q ∈ T . In the first case q sees the part of cone(g1 ) that is inside P. In the second case, we denote by f the point seg(g1 , x) ∩ `(r1 , q). As dist(x, f ) 6 dist(x, g2 ), we can conclude that f and g1 see ∆ by the same argument as above applied to g1 and f instead of g1 and g2 , under the assumption that q would not block f . Now however holds that q ∈ cone(f ) and thus sees what f would have seen and we are done. v(g2 , r1 ) r1 v(g1 , p1 ) p1 g1 a v(g2 , p2 ) v(g1 , r2 ) g2 p2 r2 Figure 16: Illustration to Definition 15. Definition 15 (Cone-Property). Given points g1 , g2 , two reflex vertices r1 and r2 and two points p1 , p2 ∈ seg(r1 , r2 ) with dist(p1 , r1 ) 6 L−2 and dist(p2 , r2 ) 6 L−2 , see Figure 16. We denote by C1 the cone with apex g1 bounded by the rays ray(g1 , r2 ) and ray(g1 , p1 ) and we 16 denote by C2 the cone with apex g2 bounded by the rays ray(g2 , r1 ) and ray(g2 , p2 ). We say two points g1 , g2 have the cone-property with respect to two reflex vertices r1 , r2 if there exists some ray contained in C1 ∩ C2 . We define a = apex(g1 , g2 ) = seg(g1 , r2 ) ∩ seg(g2 , r1 ). The definition of C1 and C2 might seem a little odd, but in spirit of Lemma 13, we see that Ci ⊆ cone(gi ), for i = 1, 2, if the conditions of Lemma 13 are met. Lemma 16 (New Cone). Let g1 , g2 have the cone-property and assume the notation of Definition 15. Then the cone C with apex a bounded by the rays ray(a, r1 ) and ray(a, r2 ) is contained in C1 ∪ C2 . Proof. The directions v with ray(gi , v) ⊆ Ci , denoted by Ii , form an interval in S 1 for i = 1, 2. We define I as the set of directions v such that ray(a, v) ⊆ C. It is easy to see that I = I1 ∪ I2 , because the cone-property implies that I1 ∩I2 6= ∅. Note that for all b ∈ Ci holds ray(b, v) ⊆ Ci , for all i = 1, 2 and v ∈ Ii . The fact a ∈ C1 ∩ C2 implies C ⊆ C1 ∪ C2 . Lemma 17 (Cone-Property). Given two points g1 , g2 with dist(g1 , g2 ) 6 d 6 4s 6 14 such that g1 and g2 are outside of the embiggened s-bad region of the reflex vertices r1 and r2 . Then g1 and g2 have the cone-property. r2 r1 α r1 α ` r2 C g1 g1 d g2 h h g2 (a) Definition of α and h. r1 α C (b) Definition of ` and C. ` g1 s-bad region f d α g2 (c) Illustrations for the case α < 45 r1 α v r2 g1 ◦ (d) Illustrations for the case α < 45◦ Figure 17: Illustrations to the proof of Lemma 17 Proof. It is sufficient to show that the rays ray(g1 , p1 ) and ray(g2 , p2 ) will not intersect, this is they are either parallel or diverge from one another. Note that dist(p1 , p2 ) > dist(r1 , r2 ) − dist(r1 , p1 ) − dist(r2 , p2 ) > 1 − L−2 − L−2 > 1/2. Here, we used the fact that all vertices have integer coordinates. If we move r1 towards p1 and r2 towards p2 then this does not change whether ray(g1 , p1 ) and ray(g2 , p2 ) will intersect or not. Now, the assumption that g1 and g2 are not contained in the embiggened s-bad region, becomes just that g1 and g2 are not contained in the (ordinary) s-bad region. 17 Thus from now on, we assume r1 = p1 and r2 = p2 . We cannot make the assumption anymore that r1 and r2 have integer coordinates, but we can assume that dist(r1 , r2 ) > 1/2, which is sufficient for the rest of the proof. Without loss of generality, we assume that the supporting line of the two reflex vertices is horizontal. We can assume that the distance dist(g1 , g2 ) = d, as this is the worst case. Further, we assume that g1 is closer to r1 than to r2 . For this purpose, we distinguish two different cases. Either the angle α between `(r1 , r2 ) and the ray ray(g1 , r1 ) is > 45◦ or < 45◦ degree, see Figure 17a. In the first case, we compare the horizontal distance between the lines at two different locations. To be precise, we will show disthorizontal (`(g1 , r1 ), g2 ) < disthorizontal (`(g1 , r1 ), r2 ). This shows that the rays are in fact diverging. The horizontal distance between r2 and `(g1 , r1 ) equals dist(r1 , r2 ) > 1/2 as was remarked √ above. The horizontal distance h between the `(g1 , r1 ) and g2 can be upper bounded by 2d < 2d as follows. See Figure 17b for an illustration. At first let ` be a line parallel to `(g1 , r1 ) containing g2 . Then any point p on ` has the same horizontal distance to `(g1 , r1 ). Further g2 has distance d to g1 and thus lies on the circle C = ∂disk(g1 , d) indicated in Figure 17b. The line ` parallel to `(g1 , r1 ) and furthest away from it that is still intersecting C is indicated in Figure 17b. We can assume that g2 lies on the intersection of C and `, as h would be smaller in any other case. We draw the horizontal segment t realizing the horizontal distance between g2 and `(g1 , r2 ). Note that the angle between `(g1 , r2 ) and t equals α. It is easy to see that seg(g1 , g2 ) and ` are orthogonal. This implies that seg(g1 , g2 ) and `(g1 , r1 ) are orthogonal as well. It follows sin α = Here we used the fact that sin α > √ d 6 2d < 2d. sin α d h ⇒ √1 , 2 for α > 45◦ . In summary we have h= disthorizontal (`(g1 , r1 ), g2 ) 6 2d 6 s/2 6 1/2 6 disthorizontal (`(g1 , r1 ), r2 ). In the second case, we compare the vertical distance v between `(g1 , r1 ) and r2 and `(g2 , r2 ) and g1 . We will show distvertical (`(g1 , r1 ), g2 ) 6 distvertical (`(g1 , r1 ), r2 ). By the same argument as in case one, we can conclude that √ f = distvertical (`(g1 , r1 ), g2 ) 6 2d 6 2d. We repeat the argument to avoid potential confusion, see Figure 17c. Let ` be a line parallel to `(g1 , r1 ). Then every point p on ` has the same vertical distance to `(g1 , r1 ). Further g2 has distance d to g1 and thus lies on the circle C = ∂disk(g1 , d) indicated in Figure 17c. The line ` parallel to `(g1 , r1 ) and furthest away from it that is still intersecting C is indicated in Figure 17c. We can assume that g2 lies on the intersection of C and `, as f would be smaller in any other case. We draw the vertical segment t realizing the vertical distance between g2 and `(g1 , r2 ). Note that the angle between ` and t equals α. It is easy to see that seg(g1 , g2 ) and ` are orthogonal. This implies that seg(g1 , g2 ) and `(g1 , r1 ) are orthogonal as well. It follows cos α = Here we used the fact that cos α > d f √1 , 2 ⇒ f= √ d 6 2d < 2d. cos α for α < 45◦ . 18 Now, we give some bounds on the vertical distance v between `(g1 , r1 ) and r2 . See Figure 17d. Note that tan α > s by the assumption that g1 is not contained in an s-bad region. This implies s 6 tan α = v v 6 6 2v. dist(r1 , r2 ) 1/2 In summary we have (1) distvertical (`(g1 , r1 ), g2 ) 6 2d 6 s/2 6 v = distvertical (`(g1 , r1 ), r2 ). For (1) we used the assumption of the lemma. Definition 18 (Cone Containment and Cutting Cones). We say cone(x) is contained in cone(y) behind r1 and r2 if cone(x) ∩ `+ ⊆ cone(y) ∩ `+ , where `+ is the half-plane bounded by `(r1 , r2 ) and does not contain the points x and y. When r1 and r2 are clear from context, we just say cone(x) is contained in cone(y). In the same fashion, we define cone(z) = cone(x) ∪ cone(y) behind r1 and r2 . We say some cone C is cut by a line segment s if the line segment s0 = C ∩ s is non-empty and contains neither end point of s. It is easy to see that for any cone(x) either holds that there exists a point g ∈ α-grid(x) with g ∈ cone(x) or there exists two points g1 , g2 ∈ α-grid(x) such that cone(x) cuts seg(g1 , g2 ), see Figure 11. g1 apex(g1 , g2 ) r1 s x r1 x s0 g2 g r2 r2 `+ (b) The line segment s cuts cone(x), as s0 is non-empty and contains neither endpoint of s. Thus cone(x) contains apex(x, y). (a) The point g is contained in cone(x) and thus cone(g) contains cone(x) behind `+ . Figure 18: Illustrations to cone containment and cone cutting. Lemma 19 (Cone-Containment). Consider the cones of x and g with respect to r1 and r2 . Let g ∈ cone(x) then cone(x) is contained cone(g) behind r1 and r2 . Lemma 20 (Cut-Segments). Consider the cones of g1 , g2 and x with respect to r1 and r2 . Let g1 , g2 have the cone-property and assume that cone(x) is cut by seg(g1 , g2 ). Then cone(x) is contained in cone(a), where a = apex(g1 , g2 ) behind r1 and r2 . Further cone(a) = cone(g1 ) ∪ cone(g2 ) behind r1 and r2 . Proof. We will show that a ∈ cone(x). See Figure 18b for an illustration of the proof. Let h1 be the half-plane bounded by `(x, r1 ) containing r2 and let h2 be the half-plane bounded by `(x, r2 ) containing r1 . Recall that a = apex(g1 , g2 ) = seg(g2 , r1 ) ∩ seg(g1 , r2 ). Then it is clear that a ∈ seg(g2 , r1 ) ⊆ h1 and a ∈ seg(g1 , r2 ) ⊆ h2 . Thus a ∈ h1 ∩ h2 = cone(x). 19 e2 e1 p1 L−1 /4 d2 R h r1 f d1 slope s/2 B x 2α slope s Figure 19: Illustrations to Lemma 21. ` = `(r1 , r2 ) is horizontal; B is an axis parallel box around x with side length 2α; R is an embiggened (s/2)-bad region; e1 is the horizontal distance between x and r1 ; e2 = e1 +α+L−2 ; d1 is the vertical distance between ` and x; d2 is the vertical distance between ` and B; f = d2 − (s/2)e2 . Lemma 21 (Grid Outside Bad Region). Let x be a point not in the s-bad region of r1 , r2 , seeing r1 and r2 , and dist(x, ri ) > L−1 , for i = 1, 2. Further we assume s 6 8Lα and L−3 6 s. Then it holds that α-grid(x) is not in the embiggened 2s -bad region of r1 and r2 . Proof. Refer to Figure 19 for an illustration of this proof and the notation therein. We assume that `(r1 , r2 ) is horizontal and x is closer to r1 then to r2 . As every point of α-grid(x) has distance at most α from x, it is sufficient to show that the box B with sidelength 2α centered at x does not intersect the embiggened 2s -bad region R. For the proof it is sufficient to assume that x is outside the box C of sidelength L−1 /2 centered at r1 . We denote by h the largest width of R. It is easy to see that h 6 (s/2)L 6 L−2 . In case that e1 < L−1 /2 holds d2 = d1 − α > L−1 /4  h. Thus, we assume from now on e1 > L−1 /2. In this case, it holds e2 = e1 + L−2 + α < 3e1 2 . It suffices to show f > 0. f = d2 − e2 s (1) 3e1 s (2) 3e1 s (3) 3e1 s > d2 − = d1 − α − > e1 s − α − = 2 4 4 4 e1 s 4 (4) −α > (5) L−1 s − α > 0. 8 Inequality (1) was just shown above. Equality (2) can be easily seen in Figure 19. Inequality (3) applies the fact that the s-bad region does not contain x and has slope s. Inequality (4) follows the assumed lower bound e1 > L−1 /4. Inequality (5) is the main assumption of the lemma. We are now ready to proof Lemma 11. Lemma 11 (Special Local Visibility Containment Property). Let r1 and r2 be two consecutive vertices in the clockwise order of the vertices visible from x ∈ P and let x be outside the s-bad region of the vertices r1 and r2 . We make the following assumptions: 1. s 6 L−3 2. α 6 L−7 . 3. 16Lα 6 s Then α-grid∗ (x) sees cone(x). 20 g1 x w r q g2 Figure 20: In this scenario there exists a vertex q, which blocks the visibility g1 . Luckily, we can define another point w, which is not blocked by q. And q can see the cone of w. Proof of Lemma 11. Note first that the triangle ∆(x, r1 , r2 ) is seen by α-grid∗ (x) by Lemma (Small Triangle) 14. So, we are only interested in cone(x) behind r1 and r2 . The easiest case to be ruled out is that there exists g ∈ α-grid∗ (x) such that g ∈ cone(x), as by Lemma (Cone-Containment) 19 this implies the claim. So from now on, we assume for all g ∈ α-grid∗ (x) holds g ∈ / cone(x). We know that there exists two grid points g1 and g2 such that cone(x) cuts the segment seg(g1 , g2 ). By Lemma (Cut-Segments) 20 it remains to show that g1 and g2 have the ConeProperty. For this purpose, we want to invoke Lemma (Cone-Property) 17. To this end, we have to invoke a series of other lemmas. Note that r1 , r2 ∈ cone(x) and dist(x, ri ) < L−1 , for i = 1 or i = 2 implies ri is included in α-grid∗ (x). Thus by the argument above, we assume from now on dist(x, ri ) > L−1 for all i = 1, 2. There might still be a different vertex q 6= r1 , r2 with dist(x, q) < L−1 . We deal first with the case that there are no vertices q with dist(x, q) < L−1 . By Lemma (Grid Outside Bad Region) 21 holds that α-grid(x) is not contained in the embiggened s0 -bad region with s0 = s/2 with respect to r1 and r2 . We can apply Lemma (Limited Blocking) 13 as α < L−7 and what is said above. From Lemma (Limited Blocking) 13 follows that cone(gi ) contains Ci , for i = 1, 2 as defined in Definition (Cone-Property) 15, see also Definition (Cone-Property) 10 to recall the definition of cone(gi ). It remains to show that g1 and g2 satisfy the Cone-Property. To this end, we need to show that the assumptions of Lemma (Cone-Property) 17 is met. Here, we consider the embiggened s0 -bad region with s0 = s/2. Note that dist(g1 , g2 ) 6 2α 6 s/(8L) < s0 /4 = s/8 < 1/4. This shows the claim together with Lemma (New Cone) 16. It remains to consider the case that there exists one vertex q with dist(x, q) < L−1 , see Figure 20. This immediately implies q ∈ α-grid∗ (x). If q does not block the vision of either g1 or g2 , we are done. Otherwise, note that q can block the vision of at most one of them, say g1 and there is at most one vertex q with dist(x, q) < L−1 . We define w = `(q, r) ∩ seg(g1 , g2 ). As the edges incident to q block g1 at least partially, we know that w exists. As dist(w, g2 ) 6 dist(g1 , g2 ) and cone(x) cuts the segment seg(w, g2 ), we can use the same arguments as above. By definition of w holds q ∈ cone(w). And behind r1 , r2 the cone(q) contains cone(w). 4.5 Global Visibility Containment This simple lemma quantifies (as a function of s and L) the maximum width of s-bad regions. Lemma 22 (distance bad region to supporting line). Let p be a point of P inside an s-bad region associated to opposite reflex vertices r1 and r2 . Then dist(p, `(r1 , r2 )) 6 sL. 21 Proof. See Figure 12a. Although it is not possible to achieve a local visibility containment property for all points in P, the exceptions only involve bad regions. Under Assumption 2 (and Assumption 1), we can give a fairly short proof of Lemma 2. As preparation, we need the following technical lemma which heavily relies on Lemma 5. ⇒ γ β Figure 21: Three bad regions meeting in an interior point implies that the extensions must meet in a single point. No two bad regions intersect in the vicinity of a vertex, as they are defined by some angle β  L−2 . But the angle γ between any two extensions is at least L−2 . Lemma 23 (no three bad regions intersect). Under Assumption 1 and 2, for any s 6 L−9 , no point in the interior of P belongs to three different s-bad regions. Proof. We consider now the case that there exists a point x with dist(x, v) 6 L−2 , for some vertex v. We show that x is contained in at most one bad regions, see to the right of Figure 21. note first that any extension ` with v ∈ / ` has distance at least L−1 from v, by Lemma 5. And thus x cannot be in any bad region belonging to ` by Lemma 22. By Lemma 5 the angle between any two extensions must be at least L−2 . As we have at most two vertices contained on any line, the bad regions belonging to the extensions through v must start at v, see Definition 9. For the angle β defining the bad regions holds tan(β) = s  L−2 and thus all bad regions in the vicinity of v are disjoint. (Note that v itself is not considered as part of the bad region.) Let `1 , `2 , `3 be supporting lines of three distinct pairs of opposite reflex vertices. As we assumed that no three points lie on a line, those three lines are also distinct. We first consider the case where two of those supporting lines, say `1 and `2 are parallel. By Lemma 5 Item 5, dist(`1 , `2 ) > L−1 . Also, by Lemma 22, any point of an s-bad region is at distance at most sL of the corresponding supporting line. Therefore, any point in the intersection of the s-bad region associated to `1 and the one associated to `2 is at distance at most L−8 from those two lines; a contradiction to dist(`1 , `2 ) > L−1 . We now show that any intersection of two supporting lines (among `1 , `2 , `3 ) should be in the interior of P. Such an intersection cannot be on the boundary of P deprived of the vertices of P, since it would immediately yield three supporting lines meeting in a point. If two supporting lines, say `1 and `2 , meet in a vertex of P, then this vertex is one of the opposite reflex vertices for both `1 and `2 (otherwise there would be three vertices on a line). Assume now that the intersection p of say, `1 and `2 is outside P. By Lemma 5 Item 4, the distance of p to any point in P is at least L−5 . Let p0 be a point of P in the intersection of two s-bad regions associated to `1 and to `2 . By Lemma 22, the distance of p0 to both `1 and `2 is at most L−8 . That implies, by setting d to L−8 in Lemma 5 Item 7, that dist(p0 , p) 6 L−8 L2 = L−6 ; a contradiction to dist(p, P) > L−5 Thus, we can suppose that `1 , `2 , `3 pairwise intersect in three distinct points p = `1 ∩ `2 , q = `1 ∩ `3 , r = `2 ∩ `3 in the interior of P; this is because we assumed that no three extensions meet in a point. Let p0 be in the s-bad regions associated to `1 and `2 . As explained in the end of the previous paragraph, dist(p0 , p) 6 L−6 . By Lemma 5 Item 3, dist(p, `3 ) > L−5 . By Lemma 22 any point in the s-bad region associated to `3 is at distance at most L−8 . As L−6 + L−8 < L−5 , 22 p0 can not be in the s-bad region associated to `3 . Which means that the intersection of the three s-bad regions associated to `1 , `2 , and `3 is empty. Figure 22: The red dots indicate the optimal solution. The blue dots indicate the The red dot on the top is in the interior case and four grid points are added around it. The red dot on the left is too close to two supporting lines and we add one of the reflex vertices of each of the supporting lines. The red dot to the right has distance less than L−1 to a reflex vertex, so we add that vertex as well to G. Proof Lemma 2 using Assumptions 1 and 2. We denote by OP T an optimal solution of size k. We assume that no point of OP T is actually contained in Γ as we can just take that point into our grid solution. In particular this implies OP T contains non of the vertices of P. Let α = L−11 and s < L−9 . Let x ∈ P be some point and R(x) some set of size at most 2 that contains a reflex vertex for each s-bad region, that x is contained in. As no point is contained in three bad regions R(x) having size 2 is enough, see Lemma 23. We define [ G= α-grid∗ (x) ∪ R(x). x∈OP T It is easy to see that G ⊆ Γ has size |G| 6 (7 + 2)k. We want to argue that G sees the entire polygon. For each x ∈ OP T the local containment property holds, except for the bad regions it is in, see Lemma 11. These parts are seen by the reflex vertices we added. 5 Conclusion We presented an O(log |OP T |)-approximation algorithm for the Point Guard Art Gallery problem under two relatively mild assumptions. The most natural open question is whether Assumption 2 can be removed. We believe that this is possible but it will require some additional efforts and ideas. Another improvement of the result would be to achieve an approximation ratio of O(log n) for polygons with holes. This would match the currently best known algorithm for the Vertex Guard variant and known lower bounds. In that respect, it might be very useful that Lemma 2 does not require the polygon to be simple. One might also ask about the inapproximability of Point Guard Art Gallery for simple polygons. For the moment, the problem is only known to be inapproximable for a certain constant ratio (quite close to 1), unless P=NP. It would be interesting to get superconstant inapproximability under standard complexity theoretic assumptions or improved approximation algorithms. 23 References [1] E. S. Ayaz and A. Üngör. Minimal witness sets for art gallery problems. EuroCG, 2016. [2] J. Barát, V. Dujmovic, G. Joret, M. S. Payne, L. Scharf, D. Schymura, P. Valtr, and D. R. Wood. Empty pentagons in point sets with collinearities. SIAM J. Discrete Math., 29(1):198–209, 2015. [3] S. Basu, R. Pollack, and M.-F. Roy. Algorithms in real algebraic geometry. AMC, 10:12, 2011. [4] P. Belleville. Computing two-covers of simple polygons. Master’s thesis, McGill University, 1991. [5] V. V. S. P. Bhattiprolu and S. Har-Peled. Separating a voronoi diagram via local search. In SOCG 2016, pages 18:1–18:16. [6] É. Bonnet and T. Miltzow. The parameterized hardness of the art gallery problem. In ESA 2016, page to appear, 2016. [7] É. Bonnet and T. Miltzow. The parameterized hardness of the art gallery problem. CoRR, abs/1603.08116, 2016. [8] H. Brönnimann and M. T. Goodrich. Almost optimal set covers in finite vc-dimension. Discrete & Computational Geometry, 14(4):463–479, 1995. [9] J. Canny. Some algebraic and geometric computations in pspace. In STOC, pages 460–467. ACM, 1988. [10] J. Cardinal. Computational geometry column 62. SIGACT News, 46(4):69–78, Dec. 2015. [11] K. Chwa, B. Jo, C. Knauer, E. Moet, R. van Oostrum, and C. Shin. Guarding art galleries by guarding witnesses. Int. J. Comput. Geometry Appl., 16(2-3):205–226, 2006. [12] K. L. Clarkson. Algorithms for polytope covering and approximation. In WADS 1993, pages 246–252, 1993. [13] A. Deshpande. A pseudo-polynomial time O(log2 n)-approximation algorithm for art gallery problems. Master’s thesis, Department of Mechanical Engineering, Department of Electrical Engineering and Computer Science, MIT, 2006. [14] A. Deshpande, T. Kim, E. D. Demaine, and S. E. Sarma. A pseudopolynomial time O(log n)-approximation algorithm for art gallery problems. In WADS 2007, pages 163– 174, 2007. [15] S. Durocher and S. Mehrabi. Guarding orthogonal art galleries using sliding cameras: algorithmic and hardness results. In MFCS 2013, pages 314–324. Springer, 2013. [16] A. Efrat and S. Har-Peled. Guarding galleries and terrains. Inf. Process. Lett., 100(6):238– 245, 2006. [17] S. Eidenbenz, C. Stamm, and P. Widmayer. Inapproximability results for guarding polygons and terrains. Algorithmica, 31(1):79–113, 2001. [18] S. Fisk. A short proof of chvátal’s watchman theorem. J. Comb. Theory, Ser. B, 24(3):374, 1978. [19] S. K. Ghosh. Visibility algorithms in the plane. Cambridge University Press, 2007. 24 [20] S. K. Ghosh. Approximation algorithms for art gallery problems in polygons. Discrete Applied Mathematics, 158(6):718–722, 2010. [21] A. Gilbers and R. Klein. A new upper bound for the vc-dimension of visibility regions. Computational Geometry, 47(1):61–74, 2014. [22] G. Kalai and J. Matoušek. Guarding galleries where every point sees a large area. Israel Journal of Mathematics, 101(1):125–139, 1997. [23] H. Kim and G. Rote. abs/1603.07269, 2016. Congruence testing of point sets in 4 dimensions. CoRR, [24] H. Kim and G. Rote. Congruence testing of point sets in 4-space. In Symposium on Computational Geometry, volume 51 of LIPIcs, pages 48:1–48:16. Schloss Dagstuhl - LeibnizZentrum fuer Informatik, 2016. [25] J. King. Fast vertex guarding for polygons with and without holes. Comput. Geom., 46(3):219–231, 2013. [26] D. G. Kirkpatrick. An O(log log OP T )-approximation algorithm for multi-guarding galleries. Discrete & Computational Geometry, 53(2):327–343, 2015. [27] E. A. Krohn and B. J. Nilsson. Approximate guarding of monotone and rectilinear polygons. Algorithmica, 66(3):564–594, 2013. [28] J. Matousek. Intersection graphs of segments and ∃R. CoRR, abs/1406.2636, 2014. [29] R. Motwani, A. Raghunathan, and H. Saran. Covering orthogonal polygons with star polygons: The perfect graph approach. J. Comput. Syst. Sci., 40(1):19–48, 1990. [30] J. O’rourke. Art gallery theorems and algorithms, volume 57. Oxford University Press Oxford, 1987. [31] M. Schaefer. Complexity of Some Geometric and Topological Problems, pages 334–344. Springer Berlin Heidelberg, Berlin, Heidelberg, 2010. [32] T. C. Shermer. Recent results in art galleries. Proceedings of the IEEE, 80(9):1384–1399, 1992. [33] J. Urrutia et al. Art gallery and illumination problems. Handbook of computational geometry, 1(1):973–1027, 2000. [34] P. Valtr. Guarding galleries where no point sees a small area. Israel Journal of Mathematics, 104(1):1–16, 1998. 25
8cs.DS
arXiv:1803.09921v1 [math.AC] 27 Mar 2018 ON 2-ABSORBING PRIMARY HYPERIDEALS OF MULTIPLICATIVE HYPERRINGS NESLIHAN SUZEN1,2 AND GURSEL YESILOT1 Abstract. Primary hyperideals have been introduced and studied in multiplicative hyperrings. In this paper, we intend to study extensively primary hyperideals of multiplicative hyperrings with absorbing zero and prove some results regarding them. Also, we describe Cu - ideals of multiplicative hyperrings which are particular classes of hyperideals. In the last section, we introduce 2-absorbing primary hyperideals and investigate the properties of this notion in commutative multiplicative hyperrings. Keywords:multiplicative hyperring, primary hyperideal, prime hyperideal, Cu ideal, 2- absorbing hyperideal, 2-absorbing primary hyperideal 1. Introduction The hypertructure theory was first initiated by Marty in 1934 when he defined the hypergroups [7]. Since then, algebraic hyperstructures have been investigated by many researchers with numerous applications in both pure and applied sciences. In algebraic hyperstructures, the product of two elements is not an element but a set, while in classical algebraic structures, the binary operation of two elements of a set is again an element of the set. More exactly, a map ◦ : H × H → P ∗ (H) is called a hyperoperation, where P ∗ (H) is the set of all nonempty subsets of H [4]. If A, B ∈ P ∗ (H) and x ∈ H, then we define [ A◦B = a ◦ b, A ◦ x = A ◦ {x} a∈A,b∈B A semihypergroup (H, ◦) is a nonempty set with the associative hyperoperation; i.e a ◦ (b ◦ c) = (a ◦ b) ◦ c for all a, b, c ∈ H. A semihypergroup H is called a hypergroup if for every a ∈ H, a ◦ H = H = H ◦ a, which is quasihypergroup. Similar to hypergroups, hyperrings are algebraic structures more general than rings, subsitutiting both or only one of the binary operations of addition and multiplication by hyperoperations. The hyperrings were introduced by Krasner [6]. Krasner hyperrings are a generalization of classical rings in which the multiplication is a binary operation while the addition is a hyperoperation. Since then, this concept has been studied by many researchers. The another type of hyperrings called Multiplicative hyperring was introduced and studied by Rota in 1982 [9], which was subsequently investigated by many authors [4,5,8,10]. A multiplicative hyperring is a hyperstructure (R, +, ·), where (R, +) is an additive commutative group 1 Department of Mathematics,Yildiz Technical University, 34220 Istanbul, TURKEY Department of Mathematics,University of Leicester, LE1 7RH , UK E-mail addresses: [email protected](N.Suzen), [email protected] (G.Yesilot). 2 1 ON 2-ABSORBING PRIMARY HYPERIDEALS OF MULTIPLICATIVE HYPERRINGS 2 and (R, ·) is a semihypergroup which satiesfies the axioms i) x · (y + z) ⊆ x · y + x · z and (y + z) · x ⊆ y · x + z · x and ii) x · (−y) = (−x) · y = −(x · y) for all x, y, z ∈ R. If in (i) we have equalities instead of inclusion, then we say that the multiplicative hyperring is strongly distributive. A hyperring R is called proper hyperring if it is not a ring. Also, R is said to be commutative if R is commutative with respect to operation + and hyperoperation · . Recall from [1] that a nonempty subset I of a commutative hyperring R is said to be a hyperideal of R if x − y ∈ I and r · x ⊆ I for any x, y ∈ I and r ∈ R. If A and B are hyperideals of R, then A + B = {a + b : a ∈ A, b ∈ B} and S P n AB = { i=1 ai · bi : ai ∈ A, bi ∈ B and n ∈ N}, which are hyperideals of R [4,5]. This was defined in [5] that the principal hyperideal of R generated by an Pl Pm Pn element a is given by < a >= {pa : p ∈ Z} + { i=1 xi + j=1 yj + k=1 zk : ∀i, j, k, ∃ri , sj , uk ∈ R such that xi ∈ ri ◦ a, yj ∈ a ◦ sj , zk ∈ tk ◦ a ◦ uk }. We n define a set A = {r ∈ √ R : r ⊆ I f or some n ∈ N}, is called as the radical of I and denoted by I or Rad(I). A proper hyperideal P of R is called a prime hyperideal if for any x, y ∈ R, x · y ⊆ P then x ∈ P or y ∈ P [8]. Recall that a proper ideal√Q of R is said to be a primary hyperideal of R if x · y ⊆ Q, then x ∈ Q or y ∈ Q for any x, y ∈ R [5]. Every prime hyperideal of a commutative multiplicative hyperring is clearly a primary hyperideal. However, the converse is not true in general[Example 3.5, 5]. The concept of C-ideal of a multiplicative hyperring was defined by Dasgupta in 2012 [5], which is a particular class of hyperideals. An hyperideal I of a multiplicative hyperring R is said to be a C-ideal if whenever C is the class of all finite products of elements of R, i.e; C = {r1 · r2 · ... · rn : ri ∈ R, n ∈ N} ⊆ P ∗ (R) and A∩I 6= ∅, then A ⊆ I for any A ∈ C. Various generalizations of prime hyperideals, primary hyperideals and also C-ideals of a multiplicative hyperring were studied in his paper. Note that if Q is a primary C-ideal of a hyperring R, then Rad(I) is a prime hyperideal [Proposition 3.6, 5]. Let (R1 , +, ◦1 ) and (R2 , +, ◦2 ) be hyperrings and f : R1 −→ R2 be a map. Then f is called a homomorphism( or good homomorphism) if for all x, y ∈ R1 , f (x + y) = f (x) +2 f (y) and f (x ◦ y) ⊆ f (x) ◦2 f (y) (or f (x ◦ y) = f (x) ◦2 f (y)). Also, let f is a good homomorphism. The kernel of f is the inverse image of < 0 >, the hyperideal generated by the zero in R2 and it is denoted by Kerf [4]. Clearly, we have f (< 0 >) ⊆< 0 >, which follows < 0 >⊆ Kerf . Note that a − b ∈ Kerf does not imply f (a) = f (b) in hyperstructures since the zero hyperideal can contain more than 0, where the zero P hyperideal P is the P hyperideal generated by the additive identity 0; i.e < 0 >= { i xi + j yj + k zk : each sum is f inite and f or each i, j, k there exist ri , sj , tk , uk ∈ R such that xi ∈ ri · 0, yi ∈ 0 · sj , zk ∈ tk · 0 · uk } [4]. Recall that we can define quotient multiplicative hyperrings similar to quotient rings in classical algebra [4]. Let R be a multiplicative hyperring and I be a hyperideal of R. We consider the usual addition of cosets and multiplication (a + I)∗(b+I) = {c+I : c ∈ a.b} on the set R/I = {a+I : a ∈ R} of all cosets of I. Then (R/I, +, ∗) is a multiplicative hyperring. Note that if I and K are hyperideals of a multiplicative hyperring R such that K ⊆ I, then R/K is a multiplicative hyperring and I/K is also a hyperideal of R/K. Some results regarding quotient hyperrings can be seen in [4] . ON 2-ABSORBING PRIMARY HYPERIDEALS OF MULTIPLICATIVE HYPERRINGS3 In this paper, we obtain some results and examples about prime and primary hyperideals of multiplicative hyperrings. Also, we introduce and study minimal prime hyperideal and C-union ideal in commutative multiplicative hyperrings, which is a particular class of hyperideals. It is shown that C-ideal and C-union ideal are different concepts. We prove that every C-union ideal is a C-ideal of hyperring R, but the converse is not true. We study homomorphisms of hyperring regarding C-union ideals. It is shown that the surjective homomorphic image of a prime Cunion ideal (primary C-union ideal) hyperideal is also a prime(primary) hyperideal on the condition that it contains the kernel of homomorphism. In the other section, we define 2-absorbing hyperideals and 2- absorbing primary hyperideals of a multiplicative hyperring, which were studied by Badawi, Tekir and Yetkin in ordinary algebra [2,3]. It is shown that every 2-absorbing hyperideal is a 2- absorbing primary hyperideal, but the converse is not true. Also, we prove that every primary hyperideal is 2- absorbing primary hyperideal. It is shown that a 2- absorbing primary hyperideal need not to be a primary hyperideal. We investigate results and examples that show some differences from same notions in ordinary algebra. Throughout this paper, we assume that all hyperrings are proper commutative multiplictive hyperrings with absorbing zero; i.e there exists 0 ∈ R such that x=0+x and 0 ∈ x · 0 = 0 · x for all x ∈ R. 2. Properties of Hyperideals Lemma 2.1. Let I be a prime hyperideal of hyperring R and J be a subset of R. For any a ∈ R , aJ ⊆ I and a ∈ / I imply that J ⊆ I. Proof. Let aJ ⊆ I and a ∈ / I for any a ∈ R. Hence, we have aJ = ∪aji ⊆ I for all ji ∈ J. Then, aji ⊆ I for all ji ∈ J. Since I prime hyperideal and a ∈ / I, we conclude that ji ∈ I for all ji ∈ J. Thus J ⊆ I. Lemma 2.2. Let I be a primary hyperideal √ of R and J be a subset of R. For any a ∈√ R, aJ ⊆ I and a ∈ / I implies that J ⊆ I.(or aJ ⊆ I and J * I imply that a ∈ I). Proof. Let aJ ⊆ I and a ∈ / I for any a ∈ R. Then we have aJ = ∪aji ⊆ I for all ji ∈ J. Hence aj√ hyperideal and a ∈ / I, i ⊆ I for all ji ∈ J. Since I primary √ we conclude that ji ∈ I for all ji ∈ J. Thus J ⊆ I. The proof of the other argument is similar. Proposition 2.3. Let I be a prime hyperideal of R and A, B be subsets of R. If AB ⊆ I, then A ⊆ I or B ⊆ I. S Proof. Suppose that AB ⊆ I, A * I and B * I. Since AB = ai bi ⊆ I , we have ai bi ⊆ I for all ai ∈ A, bi ∈ B.Since A * I and B * I, then there exist x, y ∈ / I for some x ∈ A, y ∈ B. This implies xy ⊆ AB ⊆ I .Since x, y ∈ / I and I is a prime hyperideal, then xy * I, a contradiction.Thus A ⊆ I or B ⊆ I. Definition 2.4. Let I be a hyperideal of hyperring R and P be a prime hyperideal ′ ′ such that I ⊆ P . If there is no prime hyperideal P such that I ⊆ P ⊆ P , then P is called minimal prime hyperideal of I. The set of all minimal prime hyperideals ON 2-ABSORBING PRIMARY HYPERIDEALS OF MULTIPLICATIVE HYPERRINGS 4 of I is denoted by M inh (I). Proposition 2.5. If P is a prime hyperideal of R then M inh (P ) = {P }. Proof. Since P is a prime hyperideal, the proof is clear . Example 2.6. Let (Z, +, ·) be the ring of integers. For all x, y ∈ Z; we define the hyperoperation x ◦ y = {2xy, 3xy}. Then (Z, +, ◦) is a multiplicative hyperring. The set 12Z = {12n : n ∈ Z} is a hyperideal that is not prime hyperideal of R. Moreover, 2Z and 3Z are minimal prime hyperideals of 12Z. Proposition 2.7. Let I1 , I2 , ..., In be some hyperideals of a hyperring R. Then the following statements hold. Tn Tn (1) Rad(I1 I2 ...In ) = Rad( i=1 Ii ) = i=1 Rad(Ii ) (2) Rad(I) ⊆ Rad(Rad(I)) Proof. Tn Tn (1) SinceTI1 I2 ...In ⊆ i=1 Ii , Rad(I1 I2 ...In ) ⊆ Rad( i=1 Ii ).TNow let x ∈ n n Rad( i=1 Ii ). Then there exists m ∈ N such that xm ⊆ i=1 Ii . Thus, xm ⊆ i, x ∈ Rad(Ii ) and then T Ii for all i = 1, ..., n. Hence T for all T x ∈ ni=1 Rad(Ii ).TIt follows Rad( ni=1 Ii ) ⊆ ni=1 Rad(Ii ). Conversely, suppose that x ∈ ni=1 Rad(Ii ). Then for all i, x ∈ Rad(Ii ). Thus there exists mi ∈ N suchPthat xmi ⊆ Ii . Since xm1 .xm2 ...xmn ⊆ I1 I2 ...In , n i=1 ⊆ I I ...I we Rad(I1 I2 ...In ). Hence 1 2 n and so x ∈ T Tn conclude that x n Rad(I ) ⊆ Rad(I I ...I ). Now let x ∈ Rad( i 1 2 T n i=1 i=1 Ii ), then there exn ists m ∈ N such that xm ⊆ i=1 Ii . Thus xm ⊆ Ii xmn ⊆ I1 I2 ...In for all i and so x ∈ Rad(I1 I2 ...In ). (2) Since I ⊆ Rad(I) for all hyperideal I, the proof is clear .  If I is a C-ideal, in (2) we have equality instead of inclusion [5]. Proposition 2.8. Let f : R −→ S be p good homomorphism of hyper√ an onto rings. If I is a hyperideal of R, then f ( I) ⊆ f (I) . √ √ Proof. Let x ∈ f ( I) for any x ∈ R. Since f is onto, then there exists y ∈ I such that x = f (y). It implies that y n ⊆ I for some n ≥ 1. Since f is pa good homomorphism, we conclude that xn = f (y)n = f (y n ) ⊆ f (I). Thus x ∈ f (I). Proposition 2.9. Let f : R −→ of hyperrings and p S be good homomorphism √ let J be a hyperideal of S. Then f −1 (J) = f −1 ( J). √ √ Proof. Let r ∈ f −1 ( J). Then f (r) ∈ J. Since f is a good homomorphism, for some n ≥ 1, we have (f (r))n = f (rn ) ⊆ J. Hence rn ⊆ f −1 (J) and so p −1 r ∈ f (J). The converse can be shown similarly . Definition 2.10. Let C be the class of all finite hyperproducts of elements of multiplicative hyperring R ,i.e, C = {r1 · r2 · ... · rn : ri ∈ R, i = 1, ..., n}. If for any Aj ∈ C, (∪Aj ) ∩ I 6= ∅ implies that ∪Aj ⊆ I, then I is said to be a C-union ideal of R and it denotes by Cu -ideal. ON 2-ABSORBING PRIMARY HYPERIDEALS OF MULTIPLICATIVE HYPERRINGS5 Example 2.11. Let (Z, +, ·) be the ring of integers. We define the hyperoperation x ◦ y = {2xy, 4xy} for all x, y ∈ Z, then (Z, +, ◦) is a multiplicative hyperring. In (Z, +, ◦), since x ◦ y = {2xy, 4xy} for any x, y ∈ R, then all finite products of elements are subsets of the hyperideal 2Z = {2n : n ∈ Z}. Since for all finite products Aj , (∪Aj ) ∩ I 6= ∅ and ∪Aj ⊆ 2Z, then the hyperideal 2Z is a Cu -ideal. Note that every Cu -ideal of R is a C-ideal. In fact, let I be a Cu -ideal and for some Aj ∈ C , Aj ∩ I 6= ∅. Hence, for any union ∪Aj of elements of C such that Aj ∩ I 6= ∅, we have (∪Aj ) ∩ I 6= ∅. Since I is a Cu -ideal, then ∪Aj ⊆ I and so Aj ⊆ I. It is easy to see that C-ideal and Cu -ideal are different concepts. The following is an example of a hyperideal where it is a C-ideal, but it is not a Cu -ideal. Example 2.12 Consider the hyperring (Z, +, ◦) in Example 2.6. The hyperideal 5Z = {5n : n ∈ Z} of Z is a C-ideal, but it is not a Cu -ideal. Clearly (1 ◦ 1 ∪ 5 ◦ 1) ∩ 5Z = {10, 15} = 6 ∅ ,but 1 ◦ 1 ∪ 5 ◦ 1 = {2, 3, 10, 15} * 5Z. Recall that if Q is a hyperideal of hyperring S and f : R −→ S is a good homomorphism, then f −1 (Q) is always a hyperideal of hyperring R. However, if I is a hyperideal of the hyperring R and f : R −→ S is a good homomorphism, then f (I) need not to be a hyperideal of S. Theorem 2.13. Let f : R −→ S be a homomorphism of hyperrings. Then the following statements hold. (1) Let I is a Cu - ideal of hyperring R and f : R −→ S is an onto good homorphism such that Kerf ⊆ I. If I is a prime hyperideal of R, then f (I) is a prime hyperideal of hyperring S. (2) If f : R −→ S is a good homomorphism and J is a prime hyperideal of hyperring S, then f −1 (J) is a prime hyperideal of hyperring R. Proof. 1. It is easy to see that f (I) is a hyperideal of S. Now, let s1 .s2 ⊆ f (I) for any s1 , s2 ∈ S. Since f is onto homomorphism, then there exists r1 , r2 ∈ R such that s1 = f (r1 ) and s2 = f (r2 ). Thus, f (r1 .r2 ) = f (r1 ).f (r2 ) = s1 .s2 ⊆ f (I) and so 0 ∈ f (I) − f (r1 .r2 ) = f (I − r1 .r2 ) = {f (u) : u ∈ I − r1 .r2 }. Then, there exists v ∈ I − r1 .r2 such that f (v) = 0 ∈< 0 > and hence v ∈ Kerf . Since (I − r1 .r2 ) ∩ I 6= ∅ and I is a Cu - ideal, we conclude I − r1 .r2 ⊆ I. Thus, r1 .r2 ⊆ I. Since I is a prime hyperideal, it implies that r1 ∈ I or r2 ∈ I. and so s1 ∈ f (I) or s2 ∈ f (I). Therefore, f (I) is a prime hyperideal of S. 2. Let r1 , r2 ∈ R such that r1 r2 ⊆ f −1 (J). Since f (r1 r2 ) = f (r1 )f (r2 ) ⊆ J and J is a prime hyperideal of S, we have f (r1 ) ⊆ J or f (r2 ) ⊆ J. Hence we conclude that r1 ∈ f −1 (J) or r2 ∈ f −1 (J). Thus f −1 (J) is a prime hyperideal of R. Theorem 2.14. Let f : R −→ S be a homomorphism of hyperrings. Then the following statements hold. ON 2-ABSORBING PRIMARY HYPERIDEALS OF MULTIPLICATIVE HYPERRINGS 6 (1) Let f is an onto good homomorphism and I be a Cu - ideal of R such that Kerf ⊆ I. If I is a primary hyperideal, then f (I) is a primary hyperideal of S. (2) If f : R −→ S is a good homomorphism of hyperrings and J is a primary hyperideal of S, then f −1 (J) is a primary hyperideal of R. Proof. 1. Let s1 s2 ⊆ f (I) for any s1 , s2 ∈ S. Since f is onto homomorphism, then there exists r1 , r2 ∈ R such that s1 = f (r1 ) and s2 = f (r2 ). Hence, f (r1 r2 ) = f (r1 )f (r2 ) = s1 s2 ⊆ f (I) implies f (r1 r2 ) ⊆ f (I) and so 0 ∈ f (I) − f (r1 r2 ) = f (I − r1 r2 ) = {f (u) : u ∈ I − r1 r2 }. Thus f (v) = 0 ∈< 0 > for some v ∈ I − r1 r2 . It follows that v ∈ Kerf ⊆ I. Since I ∩ (I − r1 r2 ) 6= ∅ and I is a Cu -ideal, we have I − r√ is a primary hyperideal of√R, wepconclude 1 r2 ⊆ I. Since p √ r1 r2 ⊆ I and I √ that r1 ⊆ I or r2 ⊆ I. Then s1 ⊆ f ( I) ⊆ f (I) or s2 ⊆ f ( I) ⊆ f (I) by Proposition 2.8. 2. Let xy ⊆ f −1 (J) for any x, y ∈ R. Since f (xy) = √ f (x)f (y) ⊆ J and J is a primary√hyperideal of S, we get f (x) ⊆ J √ or f (y) ⊆ pJ. Hence, f (x)√⊆ J or f (y) ⊆ J and so x ⊆ f −1 (J) or y ⊆ f −1 ( J). Since f −1 (J) = f −1 ( J), we conclude that f −1 (J) is a primary hyperideal of R by Proposition 2.9. 3. 2-Absorbing Primary Hyperideals of Hyperrings Definition 3.1. Let I be a proper hyperideal of a hyperring R. The hyperideal I is called 2-absorbing hyperideal of R if a · b · c ⊆ I, then a · b ⊆ I or b · c ⊆ I or a · c ⊆ I for any a, b, c ∈ R. Definition 3.2. Let I be a proper hyperideal of a hyperring R. The hyperideal I √ is called 2-absorbing primary hyperideal of R if a · b · c ⊆ I, then a · b ⊆ I or √ b · c ⊆ I or a · c ⊆ I for any a, b, c ∈ R. It is clear that every 2-absorbing hyperideal is a 2-absorbing primary hyperideal. The converse is not true, as is shown in the following example. Example 3.3. (1) Let (Z, +, ·) be the ring of integers. For all x, y ∈ Z; we define the hyperoperation x ◦ y = {2xy, 3xy}. Then (Z, +, ◦) is a multiplicative hyperring. The subset 12Z = {12n : n ∈ Z} is a 2-absorbing primary hyperideal that is not 2-absorbing hyperideal of Z. (2) Consider the ring of integers Z. For all x, y ∈ Z; we define the hyperoperation x ◦ y = {2xy, 4xy}. Then (Z, +, ◦) is a multiplicative hyperring. The hyperideal 120Z = {120n : n ∈ Z} is a 2-absorbing primary hyperideal, but it is not a 2absorbing hyperideal. Also, the hyperideal 15Z = {15n : n ∈ Z} is a 2-absorbing hyperideal. (3) Consider the ring (Z6 , ⊕, ⊙) that ā ⊕ b̄ and ā ⊙ b̄ are remainder of a+b 6 and a·b 6 which + and · are ordinary addition and multiplication for all ā, b̄ ∈ Z6 . For all ā, b̄ ∈ Z6 , we define the hyperoperation ā ⋆ b̄ = {ab, 2ab, 3ab, 4ab, 5ab}. ON 2-ABSORBING PRIMARY HYPERIDEALS OF MULTIPLICATIVE HYPERRINGS7 Then (Z6 , ⊕, ⋆) is a commutative multiplicative hyperring. The hyperideal {0̄} of (Z6 , ⊕, ⋆) is 2-absorbing hyperideal. Note that every primary hyperideal is 2-aborbing primary hyperideal. In fact; let I be a primary hyperideal of R. Suppose that abc √⊆ I and ab * I for any a, b, c ∈ R. Since I is a primary hyperideal, then c ⊆ I by lemma 2.2. Hence n n n there exists n > 0 such √ that c ⊆ I.√Since I is a hyperideal, we have a c ⊆ I and n n b c ⊆ I. Thus ac ⊆ I and bc ⊆ I and so I is 2-absorbing primary hyperideal. The following example shows that a 2-aborbing primary hyperideal need not to be a primary hyperideal. Example 3.4. (1) Consider the hyperring (Z, +, ◦) in Example 3.3(1). The hyperideal 12Z = {12n : n ∈ Z} is a 2-absorbing primary hyperideal of Z , but 12Z is not a primary hyperideal of Z. Clearly, 4 ◦ 3 ⊆ 12Z and 4 ∈ / 12Z, but for all n > 0 we have 3n * 12Z ; and 4 ◦ 3 ⊆ 12Z and 3 ∈ / 12Z, but for all n > 0 we have 4n * 12Z. Thus 12Z is not primary hyperideal. (2)Consider the hyperring (Z, +, ◦) in Example 3.3(3). Since the hyperideal {0̄} is 2-absorbing hyperideal, then it is 2- absorbing primary hyperideal. However, the hyperideal {0̄} is not a primary hyperideal. In fact, 3̄ ⋆ 2̄ = {0̄}, but 3̄ 6= 0̄ and 2̄ 6= 0̄. Also, we have 2̄n = {0̄, 2̄, 4̄} * {0̄} and 3̄n = {0̄, 3̄} * {0̄} for all n > 0. Thus, {0̄} is not a primary hyperideal. Theorem 3.5. Let I be a hyperideal of the hyperring R. If ideal, then I is a 2-absorbing primary hyperideal of R. √ I is a prime hyper- Proof. Suppose √ that√abc ⊆ I and ab * I for any a, b, c ∈ R.√ Since (ac)(bc) √ = abc2 ⊆ I ⊆ I and I is a prime hyperideal, we have ac ⊆ I or bc ⊆ I by Proposition 2.3. Hence, I is a 2-absorbing primary hyperideal of R.  The converse of Theorem 3.5 is not true in general . Example 3.6. The hyperideal I = 120Z = {120n : n ∈ Z} of the √ hyperring (Z, +, ◦) in Example 3.3(2) is 2-absorbing primary hyperideal, but I = 15Z is not prime hyperideal of Z. Clearly 3 ◦ 5 = {30, 60} ⊆ 15Z but 3, 5 ∈ / 15Z . Thus 15Z is not a prime hyperideal of Z. Theorem 3.8. Let P be a hyperideal of R and I1 , I2 , ..., In be primary √ T2-absorbing n I is 2-absorbing I = P for all i=1,...,n. Then hyperideals of R such that i=1 i pTn i I = P . primary hyperideal and i i=1 pTn √ Tn √ Tn Proof. Clearly, I = i=1 Ii = i=1 Ii = P . Let I = i=1 Ii . Suppose that abc ⊆ I and ab * I for any a, b, c ∈ I. Hence ab * Ii for some √ i. Since Ii = P or Ii is a√2-absorbing primary hyperideal and abc ⊆ I ⊆ I , then ac ⊆ i √ √ bc ⊆ Ii = P . Thus we conclude ac ⊆ I or bc ⊆ I. Thus I is a 2-absorbing primary hyperideal of R . ON 2-ABSORBING PRIMARY HYPERIDEALS OF MULTIPLICATIVE HYPERRINGS 8 √ √ Note that if I and J are 2-absorbing primary hyperideals of R and I 6= J, then I ∩ J may not be a 2-absorbing primary hyperideal of R. We have the following example. Example 3.9. Consider the hyperring (Z, +, ◦) in Example 3.3(1). I = 12Z = {12n : n ∈ Z} are 2-absorbing primary hyperideal √ and J = 20Z = {20n : n ∈ Z} √ of Z. Since I = 6Z = {6n : n ∈ Z} and J = 10Z = {10n : n ∈ Z}, then I ∩ J = 30Z = {30n : n ∈ Z} and 30Z is not a 2-absorbing primary hyperideal. Lemma 3.10. If P1 and P2 are prime hyperideals of R, then P1 ∩ P2 is 2-absorbing hyperideal of R. Proof. Let a, b, c ∈ R such that abc ⊆ P1 ∩ P2 , ab * P1 ∩ P2 and bc * P1 ∩ P2 . Then a, b, c ∈ / P1 ∩ P2 . Asume that a ∈ P1 ∩ P2 , then a ∈ P1 and a ∈ P2 . Since P1 and P2 are hyperideals, we have ab ⊆ P1 and ab ⊆ P2 . Then ab ⊆ P1 ∩ P2 , which is a contradiction. Thus a * P1 ∩ P2 . Similarly, b, c ∈ / P1 ∩ P2 . We consider three cases. Case one: Suppose that a ∈ / P1 and a ∈ / P2 . Since c ∈ / P1 ∩ P2 , we have three cases again. Assume that c ∈ / P1 and c ∈ / P2 . Since P1 is a prime hyperideal and ac * P1 , abc ⊆ P1 , then b ∈ P1 by Lemma 2.1. Hence ab ⊆ P1 . Similarly, since P2 is a prime hyperideal and ac * P2 , abc ⊆ P2 , we have b ∈ P2 by Lemma 2.1. Hence ab ⊆ P2 . Thus ab ⊆ P1 ∩ P2 which is a contradiction. Thus c ∈ P1 or c ∈ P2 . Now, assume that c ∈ / P1 and c ∈ P2 . Since P1 is a prime hyperideal and ac * P1 , abc ⊆ P1 , we have b ∈ P1 . Thus bc ⊆ P1 . Since c ∈ P2 , then bc ⊆ P2 and so bc ⊆ P1 ∩ P2 , a contradiction. Finally, assume that c ∈ / P2 and c ∈ P1 . Since P2 is a prime ideal and ac * P2 , abc ⊆ P2 , then b ∈ P2 and so bc ⊆ P2 . Since c ∈ P1 , we conclude bc ⊆ P1 . So we have bc ⊆ P1 ∩ P2 which is a contradiction. Thus, if a ∈ P1 ∩ P2 , implies that a ∈ P1 or a ∈ P2 . Case Two: Suppose that a ∈ P1 and a ∈ / P2 . We show that c ∈ P2 . Assume that c ∈ / P2 . Since P2 is a prime hyperideal, we have ac * P2 . Since whenever abc ⊆ P2 , ac * P2 and also P2 is a prime hyperideal, then b ∈ P2 by Lemma 2.1. Hence ab ⊆ P1 ∩ P2 which is a contradiction. Thus c ∈ P2 . Since c ∈ / P1 ∩ P2 , we get c ∈ / P1 . Therefore, ac ⊆ P1 ∩ P2 . Case Three: Suppose that a ∈ P2 and a ∈ / P1 . We show that c ∈ P1 . Assume that c∈ / P1 . Since P2 is a prime hyperideal, then ac * P1 . Since whenever abc ⊆ P1 , ac * P1 and P1 is a prime hyperideal, by Lemma 2.1 b ∈ P1 . Hence ab ⊆ P1 ∩ P2 which is a contradiction. Since c ∈ P1 and c ∈ / P1 ∩ P2 , we have c ∈ / P2 and hence ac ⊆ P1 ∩ P2 . Consequently, P1 ∩ P2 is 2-absorbing hyperideal.  The following example shows that the converse of this lemma is not true in general. Example 3.11. In Example 3.3(3), {0̄} ∩ {0̄, 2̄, 4̄} = {0̄}. Clearly {0̄} is a 2absorbing hyperideal of (Z6 , ⊕, ⋆), but it is not a prime hyperideal. Theorem 3.12. Let I be P1 -primary C-ideal and J be P2 -primary C-ideal of R. Then the following statements hold. (1) I1 ∩ I2 is 2-absorbing primary hyperideal. ON 2-ABSORBING PRIMARY HYPERIDEALS OF MULTIPLICATIVE HYPERRINGS9 (2) I1 I2 is 2-absorbing primary hyperideal. Proof. √ 2-absorbing 1. Let I1 ∩ I2 = K. Then K = P1 ∩ P2 . Now, we show √ that K is a √ primary hyperideal of R. Suppose that abc ⊆ K, ac * K and bc * √ √ √ √K for any / K, b ∈ / K and c ∈ / K. Since a, b, c ∈ R. Since K is a hyperideal, we have a ∈ I1 and I2 are C-ideals, we have P1 and P2 are prime hyperideals.√By Lemma 3.10, we conclude that P1 ∩ P2 is a 2-absorbing hyperideal of R. Since K = P1 ∩ P2 is a √ 2-absorbing hyperideal, then ab ⊆ K ⊆ P1 . Since P1 is a prime hyperideal, a ∈ P1 √ or b ∈ P1 . We may assume that a ∈ P1 . Hence a ∈ / P2 since a ∈ / K = P1 ∩ P2 . Similarly, one can easily show that b ∈ / P1 . We claim that a ∈ I1 and b ∈ I2 . Suppose that a ∈ / I1 . Since√I1 is P1 -primary hyperideal and a ∈ / I1 , we get bc ∈ P1 and so bc ⊆ P1 . Thus bc ⊆ K and this is a contradiciton. Hence a ∈ I1 . Similarly, let b∈ / I2 . Since I2 is a P2 -primary / I2 , we conclude that ac ⊆ P2 √ hyperideal and b ∈ by Lemma 2.2. Hence ac ⊆ K since ac ⊆ P2 and a ∈ P1 , a contradiction. Thus b ∈ I2 . Therefore, ab ∈ I1 ∩ I2 = K . √ 2. For √ any a, b, c ∈ R, let abc ⊆ I1 I2 and ab, bc * I1 I2 = P1 ∩ P2 . Then √ a, b, c ∈ / I1 I2 = P1 ∩ P2 . Moreover, we have ac ⊆ I1 I2 = P√ 1 ∩ P2 since P1 ∩ P2 is 2-absorbing hyperideal. We show that ac ⊆ I1 I2 . Since ac ⊆ I1 I2 = P1 ∩ P2 ⊆ P1 and P1 is a prime hyperideal, We get a ∈ P1 or c ∈ P1 . We may assume that a ∈ P1 . Since a ∈ / P1 ∩ P2 , √ we have a ∈ / P2 . Also c ∈ P2 and c ∈ / P1 since P2 is a prime hyperideal and ac ⊆ I1 I2 = P1 ∩ P2 ⊆ P2 . Now, we claim that a ∈ I1 and c ∈ I2 . Suppose that√a ∈ / I1 . Since I1 is primary hyperideal, whenever √ abc ⊆ I1 and a ∈ / I1 ,then bc ⊆ I1 = P1 . Since c ∈ P2 , we have bc ⊆ P1 ∩ P2 = I1 I2 which is a contradiction. Thus a ∈ I1 . Similarly, we conclude that c ∈ I2 . Consequently, we get ac ⊆ I1 I2 . The above theorem is not true for a finite number of hyperideals in general. Example 3.13. The hyperideals 3Z = {3n : n ∈ Z}, 5Z = {5n : n ∈ Z} and 7Z = {7n √ : n ∈ Z} in √ Example 3.3(2)√are prime C-ideals and so primary C-ideals such that 3Z = 3Z, 5Z = 5Z and 7Z = 7Z, but 3Z ∩ 5Z ∩ 7Z = 105Z is not a 2-absorbing primary hyperideal. Theorem 3.14. If f : R → S is a good homomorphism of hyperrings and J is a 2-absorbing primary hyperideal of S, then f −1 (J) is a 2-absorbing primary hyperideal of R. Proof. Let xyz ⊆ f −1 (J) for any x, y, z ∈ R. Since f (xyz) = f (x)f (y)f (x) ⊆√J and J is a 2-absorbing primary hyperideal, we have√ f (x)f (y) ⊆ J or√f (x)f (z) ⊆ J √ f (xy) ⊆ J or f (xz) ⊆ J or f (yz) or f (y)f (z) ⊆ J. Hence p ⊆ J. Thus xy √ √ √ ⊆ f −1 (J) or xz ⊆ f −1 ( J ) or yz ⊆ f −1 ( J). By the equality f −1 (J) = f −1 ( J), f −1 (J) is a 2-absorbing primary hyperideal. Theorem 3.15. Let f : R → S be an onto good homomorphism of hyperrings and I be a Cu -ideal of the hyperring R. If I is a 2-absorbing primary hyperideal of R such that Kerf ⊆ I, then f (I) is a 2-absorbing primary hyperideal of S. ON 2-ABSORBING PRIMARY HYPERIDEALS OF MULTIPLICATIVE HYPERRINGS 10 Proof. Let s1 s2 s3 ⊆ f (I) for any s1 , s2 , s3 ∈ S. Since f is onto, there exist r1 , r2 , r3 ∈ R such that s1 = f (r1 ) and s2 = f (r2 ) and s3 = f (r3 ). Then f (r1 r2 r3 ) = f (r1 )f (r2 )f (r3 ) = s1 s2 s3 ⊆ f (I) and hence 0 ∈ f (I) − f (r1 r2 r3 ) = f (I − r1 r2 r3 ) = {f (u) : u ∈ I − r1 r2 r3 }. Thus f (v) = 0 ∈< 0 > for some v ∈ I − r1 r2 r3 . Hence v ∈ Kerf ⊆ I and so I ∩ (I − r1 r2 r3 ) 6= ∅. Since I is a Cu -ideal, we have I − r1 r2 r3 ⊆ I. Thus r1 r2√r3 ⊆ I. Since√I is a 2-absorbing I or r√ I. By Proposition primary hyperideal, we get r√ 2 r3 ⊆ p 1 r2 ⊆ Ipor r1 r3 ⊆ 2.8, s1 s2 ⊆ f (I) or s1 s3 ⊆ f ( I) ⊆ f (I) or s2 s3 ⊆ f ( I) ⊆ f (I).  Corollary 3.16. Let I be a Cu -ideal of the hyperring R and J be a hyperideal of R such that J ⊆ I. If I is a 2-absorbing primary hyperideal of R, then IJ is a 2-absorbing primary hyperideal of RJ. Proof. A mapping f : R −→ R/J with f (x) = x + J for all x ∈ R is an onto good homomorphism. Since the zero in R/J is J and < J >= {J} [see 4] and also Kerf = f −1 (< J >) = f −1 (J) = {r ∈ R : f (r) = J} = {r ∈ R : r + J = J}, then Kerf = J. Hence, the proof is completed by Theorem 3.15.  Lemma 3.17. Let I be a 2-absorbing primary hyperideal of a strongly distributive multiplicative hyperring √ R and J be√ a hyperideal of R. If abJ ⊆ I and ab * I for any a, b ∈ R, then aJ ⊆ I or bJ ⊆ I. √ √ Proof. √Suppose that aJ *√ I ve bJ * I for some a, b ∈ R. Since aJ √= ∪aji * I √and bJ = ∪bji * I for all ji ∈ J, √ there exists a√ji such that aji * I and bji * I. We may assume that aj1 * I and bj2 * √I for some j1 , j2 ∈√J. Also for all ji , abji ⊆ I. Since abj1 ⊆ I, ab *√I and aj1 * I, we √ have bj1 ⊆ I. Similarly, since abj2 ⊆ I, ab * I and bj2 * I, we get aj2 ⊆ I. Now, since I is a 2-aborbing √ primary hyperideal, √ whenever ab(j1 + j2 ) ⊆ I and ab * I, we have √ a(j1 + j2 ) ⊆ √ I or b(j1 + j2 ) ⊆ I. √ Suppose that a(j1 + j2 ) = aj1 + aj2 ⊆ I. Since aj2 ⊆ I, we conclude aj1 ⊆ I √which is a contradiction. Similarly, let √ √ b(j1 + j2 ) = bj1 + bj2 ⊆ √ I. Since bj1 √ ⊆ I, we have bj2 ⊆ I which is a contradiction again. Thus aJ ⊆ I or bJ ⊆ I. Theorem 3.18. Let I be a hyperideal of a strongly distributive multiplicative hyperring R. Then I is a 2-aborbing primary √ √ hyperideal of R if and only if I1 I2 I3 ⊆ I, then I1 I2 ⊆ I or I2 I3 ⊆ I or I1 I3 ⊆ I for any hyperideals I1 , I2 , I3 . Proof. Let I be a 2-aborbing primary ⊆ I and I1 I2 *√I. √ √ hyperideal and I1 I2 I3 √ We claim that√I2 I3 ⊆ I or I√ I ⊆ I. Suppose that I I * I and I1 I3 * I. 1 3 2 3 Hence i1 I3 * I and i2 I3 * I for some i1 ∈ I1 and i2 ∈ I2 . By Lemma 3.17, we get i1 i2 ⊆ I. Since I1 I2 * I, ab * I for some√a ∈ I1 and√b ∈ I2 . Since abI3 ⊆ I1 I2 I3 ⊆ I and ab * I, by Lemma 3.17 aI3 ⊆ I or bI3 ⊆ I. √ √ Case one: Suppose that √ √ aI3 ⊆ I and bI3 * I. Since i1 bI3 ⊆ I1 I2 I3 ⊆ I, bI3 * I and i1 I3 *√ I, we have i1 b ⊆ I by√Lemma 3.17. Since (a + i1 )bI3 ⊆ I1 I2 I3 ⊆ I and bI3 * I, we have (a + i1 )I3 ⊆ I or (a + i1 )b ⊆ I by Lemma 3.17. ON 2-ABSORBING PRIMARY HYPERIDEALS OF MULTIPLICATIVE HYPERRINGS 11 √ Suppose that (a + i1 )I3 ⊆ I. Then for every i3 ∈ I3 , since R is strongly distribu√ tive, we √ conclude that (a + i1 )I3 =√∪(a + i1 )i3 = ai3√+ i1 i3 = aI3 + i1 I3 ⊆ I. Since I is a hyperideal and aI3 ⊆ I, we get i1 I3 ⊆ I which is a contradiction. Now, suppose that (a + i1 )b = ab + i1 b ⊆ I. Since I is a hyperideal and i1 b ⊆ I, we have ab ⊆ I which is a contradiciton √again. √ Case Two: Suppose that aI3 * I and bI3 ⊆ √I. Then ai2 ⊆ I by Lemma 3.17. Since √ a(b + i2 )I3 ⊆ I1 I2 I3 ⊆ I but aI3 * I, we √have a(b + i2 ) ⊆ I or (b + i2 )I3 ⊆ I by Lemma 3.17. Suppose that (b + i2 )I3 ⊆ I. Since R √ is strongly distributive, we√get (b + i2 )I3 = ∪(b + i2 )i3 =√bi3 + i2 i3 = bI3 + i2 I3 ⊆√ I for every i3 ∈ I3 . Since I is a hyperideal and bI3 ⊆ I, we conclude i2 I3 ⊆ I which is a contradiction. Now, suppose that a(b + i2 )b = ab + i2 b ⊆ I. Similarly, since I is a hyperideal and ai2 ⊆ I, we have ab ⊆ I√which is a contradiction. √ √ Case Three: Suppose that aI√3 ⊆ I and bI3 ⊆ I. Since bI3 ⊆ I and √ i2 I3 * I, we have (b + i2 )I3 * I. By Lemma 3.17, we conclude that i1 (b + i2 )√= i1 b + i1 i2 ⊆√I. Since i1 i2 ⊆ I and i1 b + i1 i2 ⊆ √ I, we get bi1 ⊆ I. Since aI3 ⊆ I and i1 I3 * I, we conclude that (a + i1 )I3 * I. Hence (a + i1 )i2 = ai2 + i1 i2 ⊆ I by Lemma Teorem 3.17. Since i1 i2 ⊆ I and ai2 + i1 i2 ⊆ I, we have ai2 ⊆ I. Thus (a + i1 )(b + i2 ) = ab + ai2 + bi1 + i1 i2 ⊆ I by Lemma 3. 17. Since ai2 , bi1 , i1 i2 ⊆ I, we have ai2 + bi1 + i1 i2 ⊆ I. Hence ab ⊆ I since ab + ai2 + bi1 + i1 i2 ⊆ √ I and ai2 + bi√ I or 1 + i1 i2 ⊆ I,a contradiction. Consequently, we conclude that I1 I3 ⊆ I2 I3 ⊆ I . √ Conversely, √ suppose that whenever I1 I2 I3 ⊆ I, then I1 I2 ⊆ I or I2 I3 ⊆ I or I1 I3 ⊆ I for any hyperideals I1 , I2 , I3 . Cleary, I is 2-absorbing primary hyperideal of R by the definition of principal hyperideal of R.  References [1] R.Ameri, M.Norouzi, On commutative hyperrings, Int. Journal of Algebraic Hyperstructures and Its Applications, 1(2014), no.1, 45-58. [2] A.Badawi, On 2-absorbing ideals of commutative rings, Bull. Austral. Math. Soc. 75(2007), no.3, 417-429. [3] A.Badawi, U.Tekir, E.Yetkin, On 2-absorbing primary ideals in commutative rings, Bull. Korean Math. Soc. 51 (2014) no.4, 1163-1173. [4] B.Davvaz, V.Leoreanu, Hyperring Theory and Applications, International Academic Press, (2007). [5] U.Dasgupta, On prime and primary hyperideals of a multiplicative hyperring, Analele Stiintifice aleUniversitatii Al I Cuza din IasiMatematica, 58(2012), no.1, 1937 [6] M. Krasner, A class of hyperrings and hyperfields, Internat. J. Math. Math Sci.,6(1983),307312. [7] F.Marty, Sur une generalization de la notion de groupe, 8iem congres des Mathematiciens Scandivanes, Stockholm (1934), 45-49. [8] R. Procesi, R. Rota, On some classes of hypertructures, Discrete Math., 208/209 (1999), 485-497 [9] R. Rota, Sugli iperanelli moltiplicativi, Rend. Di Mat., Series VII,2(4) (1982) 711-724 [10] R. Rota, Strongly distributive multiplicative hyperrings, J.Geom.,39(1990), 130-138
0math.AC
arXiv:1611.03671v1 [math.CO] 11 Nov 2016 Well-Quasi-Ordering versus Clique-Width: New Results on Bigenic Classes⋆ Konrad K. Dabrowski1 , Vadim V. Lozin2 and Daniël Paulusma1 1 School of Engineering and Computing Sciences, Durham University, Science Laboratories, South Road, Durham DH1 3LE, United Kingdom {konrad.dabrowski,daniel.paulusma}@durham.ac.uk 2 Mathematics Institute, University of Warwick, Coventry CV4 7AL, United Kingdom [email protected] Abstract. Daligault, Rao and Thomassé asked whether a hereditary class of graphs well-quasi-ordered by the induced subgraph relation has bounded clique-width. Lozin, Razgon and Zamaraev recently showed that this is not true for classes defined by infinitely many forbidden induced subgraphs. However, in the case of finitely many forbidden induced subgraphs the question remains open and we conjecture that in this case the answer is positive. The conjecture is known to hold for classes of graphs defined by a single forbidden induced subgraph H, as such graphs are well-quasi-ordered and are of bounded clique-width if and only if H is an induced subgraph of P4 . For bigenic classes of graphs, i.e. ones defined by two forbidden induced subgraphs, there are several open cases in both classifications. In the present paper we obtain a number of new results on well-quasi-orderability of bigenic classes, each of which supports the conjecture. 1 Introduction Well-quasi-ordering is a highly desirable property and frequently discovered concept in mathematics and theoretical computer science [17,21]. One of the most remarkable results in this area is Robertson and Seymour’s proof of Wagner’s conjecture, which states that the set of all finite graphs is well-quasi-ordered by the minor relation [26]. One of the first steps towards this result was the proof of the fact that graph classes of bounded treewidth are well-quasi-ordered by the minor relation [25] (a graph parameter π is said to be bounded for some graph class G if there exists a constant c such that π(G) ≤ c for all G ∈ G). The notion of clique-width generalizes that of treewidth in the sense that graph classes of bounded treewidth have bounded clique-width, but not necessarily vice versa. The importance of both notions is due to the fact that many algorithmic problems that are NP-hard on general graphs become polynomial-time solvable when restricted to graph classes of bounded treewidth or clique-width. ⋆ Research supported by EPSRC (EP/K025090/1 and EP/L020408/1). An extended abstract of this paper appeared in the proceedings of IWOCA 2016 [12]. For treewidth this follows from the meta-theorem of Courcelle [6], combined with a result of Bodlaender [2]. For clique-width this follows from combining results from several papers [8,16,19,24] with a result of Oum and Seymour [23]. In the study of graph classes of bounded treewidth, we can restrict ourselves to minor-closed graph classes, because from the definition of treewidth it immediately follows that the treewidth of a graph is never smaller than the treewidth of its minor. This restriction, however, is not justified when we study graph classes of bounded clique-width, as the clique-width of a graph can be much smaller than the clique-width of its minor. In particular, Courcelle [7] showed that if G is the class of graphs of clique-width 3 and G ′ is the class of graphs obtainable from graphs in G by applying one or more edge contraction operations, then G ′ has unbounded clique-width. On the other hand, the clique-width of a graph is never smaller than the clique-width of any of its induced subgraphs (see, for example, [9]). This allows us to restrict ourselves to classes of graphs closed under taking induced subgraphs. Such graph classes are also known as hereditary classes. It is well-known (and not difficult to see) that a class of graphs is hereditary if and only if it can be characterized by a set of minimal forbidden induced subgraphs. Due to the minimality, the set F of forbidden induced subgraphs is always an antichain, that is, no graph in F is an induced subgraph of another graph in F . For some hereditary classes this set is finite, in which case we say that the class is finitely defined, whereas for other hereditary classes (such as, for instance, bipartite graphs) the set of minimal forbidden induced subgraphs forms an infinite antichain. The presence of these infinite antichains immediately shows that the induced subgraph relation is not a well-quasi-order. In fact there even exist graph classes of bounded clique-width that are not well-quasi-ordered by the induced subgraph relation: take, for example, the class of cycles, which all have clique-width at most 4. What about the inverse implication: does wellquasi-ordering imply bounded clique-width? This was stated as an open problem by Daligault, Rao and Thomassé [14] and a negative answer to this question was recently given by Lozin, Razgon and Zamaraev [22]. However, the latter authors disproved the conjecture by giving a hereditary class of graphs whose set of minimal forbidden induced subgraphs is infinite. Hence, for finitely defined classes the question remains open and we conjecture that in this case the answer is positive. Conjecture 1. If a finitely defined class of graphs G is well-quasi-ordered by the induced subgraph relation, then G has bounded clique-width. We emphasize that our motivation for verifying Conjecture 1 is not only mathematical but also algorithmic. Should Conjecture 1 be true, then for finitely defined classes of graphs the aforementioned algorithmic consequences of having bounded clique-width also hold for the property of being well-quasi-ordered by the induced subgraph relation. A class of graphs is monogenic or H-free if it is characterized by a single forbidden induced subgraph H. For monogenic classes, the conjecture is true. 2 In this case, the two notions even coincide: a class of graphs defined by a single forbidden induced subgraph H is well-quasi-ordered if and only if it has bounded clique-width if and only if H is an induced subgraph of P4 (see, for instance, [13,15,20]). A class of graphs is bigenic or (H1 , H2 )-free if it is characterized by two incomparable forbidden induced subgraphs H1 and H2 . The family of bigenic classes is more diverse than the family of monogenic classes. The questions of well-quasi-orderability and having bounded clique-width still need to be resolved. Recently, considerable progress has been made towards answering the latter question for bigenic classes; see [10] for the most recent survey, which shows that there are currently eight (non-equivalent) open cases. With respect to wellquasi-orderability of bigenic classes, Korpelainen and Lozin [20] left all but 14 cases open. Since then, Atminas and Lozin [1] proved that the class of (K3 , P6 )free graphs is well-quasi-ordered by the induced subgraph relation and that the class of (2P1 + P2 , P6 )-free graphs is not, reducing the number of remaining open cases to 12. All available results for bigenic classes verify Conjecture 1. Moreover, eight of the 12 open cases have bounded clique-width (and thus immediately verify Conjecture 1), leaving four remaining open cases of bigenic classes for which we still need to verify Conjecture 1. Our Results Our first goal is to obtain more (bigenic) classes that are well-quasi-ordered by the induced subgraph relation and to support Conjecture 1 with further evidence. Our second and more general goal is to increase our general knowledge on wellquasi-ordered graph classes and the relation to the possible boundedness of their clique-width. Towards our first goal we prove in Section 4 that the class of (2P1 + P2 , P2 + P3 )-free graphs (which has bounded clique-width [11]) is well-quasi-ordered by the induced subgraph relation. In Section 5 we also determine, by giving infinite antichains, two bigenic classes that are not, namely the class of (2P1 + P2 , P2 + P4 )-free graphs, which has unbounded clique-width [11], and the class of (P1 + P4 , P1 + 2P2 )-free graphs, for which boundedness of the cliquewidth is unknown (see Fig. 1 for drawings of the five forbidden induced subgraphs). Consequently, there are nine classes of (H1 , H2 )-free graphs for which we do not know whether they are well-quasi-ordered by the induced subgraph relation, and there are two open cases left for the verification of Conjecture 1 for bigenic classes. We refer to Open Problems 1 and 3, respectively, in Section 6 where we also give an exact description of the state-of-the-art for results on well-quasi-orderability and boundedness of clique-width for bigenic classes of graphs. Towards our second goal, we aim to develop general techniques as opposed to tackling specific cases in an ad hoc fashion. Our starting point is a very fruitful technique used for determining (un)boundedness of the clique-width of a graph class G. We transform a given graph from G via a number of elementary graph 3 operations that do not modify the clique-width by “too much” into a graph from a class for which we do know whether or not its clique-width is bounded. It is a natural question to research how the above modification technique can be used for well-quasi-orders. We do this in Section 3. The permitted elementary graph operations that preserve (un)boundedness of the clique-width are vertex deletion, subgraph complementation and bipartite complementation. As we will explain in Section 3, these three graph operations do not preserve well-quasiorderability. We circumvent this by investigating whether these three operations preserve boundedness of a graph parameter called uniformicity. This parameter was introduced by Korpelainen and Lozin [20], who proved that every graph class G of bounded uniformicity is well-quasi-ordered by the so-called labelled induced subgraph relation, which in turn implies that G is well-quasi-ordered by the induced subgraph relation. Korpelainen and Lozin [20] proved that boundedness of uniformicity is preserved by vertex deletion. We prove that this also holds for the other two graph operations. The above enables us to focus on boundedness of uniformicity. However, we cannot always do this: there exist graph classes of unbounded uniformicity that are well-quasi-ordered by the labelled induced subgraph relation. As such, we sometimes need to rely only on the labelled induced subgraph relation directly. Hence, in Section 3 we also show that the three permitted graph operations, vertex deletion, subgraph complementation and bipartite complementation, preserve well-quasi-orderability by the labelled induced subgraph relation. As explained in Section 6, we believe that this graph modification technique will also be useful for proving well-quasi-orderability of other graph classes. As such, we view the results in Section 3 as the second main contribution of our paper. 2P1 + P2 P1 + P4 P1 + 2P2 P2 + P3 P2 + P4 Fig. 1. The forbidden induced subgraphs considered in this paper. 2 Preliminaries The disjoint union (V (G) ∪ V (H), E(G) ∪ E(H)) of two vertex-disjoint graphs G and H is denoted by G + H and the disjoint union of r copies of a graph G is denoted by rG. The complement of a graph G, denoted by G, has vertex set V (G) = V (G) and an edge between two distinct vertices if and only if these 4 vertices are not adjacent in G. For a subset S ⊆ V (G), we let G[S] denote the subgraph of G induced by S, which has vertex set S and edge set {uv | u, v ∈ S, uv ∈ E(G)}. If S = {s1 , . . . , sr } then, to simplify notation, we may also write G[s1 , . . . , sr ] instead of G[{s1 , . . . , sr }]. We use G \ S to denote the graph obtained from G by deleting every vertex in S, i.e. G \ S = G[V (G) \ S]. We write H ⊆i G to indicate that H is isomorphic to an induced subgraph of G. The graphs Cr , Kr , K1,r−1 and Pr denote the cycle, complete graph, star and path on r vertices, respectively. The graph K1,3 is also called the claw. The graph Sh,i,j , for 1 ≤ h ≤ i ≤ j, denotes the subdivided claw, that is, the tree that has only one vertex x of degree 3 and exactly three leaves, which are of distance h, i and j from x, respectively. Observe that S1,1,1 = K1,3 . We let S denote the class of graphs, each connected component of which is either a subdivided claw or a path. For a set of graphs {H1 , . . . , Hp }, a graph G is (H1 , . . . , Hp )-free if it has no induced subgraph isomorphic to a graph in {H1 , . . . , Hp }; if p = 1, we may write H1 -free instead of (H1 )-free. For a graph G = (V, E) and a vertex u ∈ V , the set NG (u) = {v ∈ V | uv ∈ E} denotes the (open) neighbourhood of u in G and NG [u] = NG (u)∪{u} denotes the closed neighbourhood of u. We may write N (u) and N [u] instead of NG (u) and NG [u] if this is unambiguous. A graph is bipartite if its vertex set can be partitioned into (at most) two independent sets. The biclique Kr,s is the bipartite graph with sets in the partition of size r and s respectively, such that every vertex in one set is adjacent to every vertex in the other set. Let X be a set of vertices of a graph G = (V, E). A vertex y ∈ V \ X is complete to X if it is adjacent to every vertex of X and anti-complete to X if it is non-adjacent to every vertex of X. Similarly, a set of vertices Y ⊆ V \ X is complete (resp. anti-complete) to X if every vertex in Y is complete (resp. anticomplete) to X. A vertex y ∈ V \ X distinguishes X if y has both a neighbour and a non-neighbour in X. The set X is a module of G if no vertex in V \ X distinguishes X. A module X is non-trivial if 1 < |X| < |V |, otherwise it is trivial. A graph is prime if it has only trivial modules. A quasi order ≤ on a set X is a reflexive, transitive binary relation. Two elements x, y ∈ X in this quasi-order are comparable if x ≤ y or y ≤ x, otherwise they are incomparable. A set of elements in a quasi-order is a chain if every pair of elements is comparable and it is an antichain if every pair of elements is incomparable. The quasi-order ≤ is a well-quasi-order if any infinite sequence of elements x1 , x2 , x3 , . . . in X contains a pair (xi , xj ) with xi ≤ xj and i < j. Equivalently, a quasi-order is a well-quasi-order if and only if it has no infinite strictly decreasing sequence x1 x2 x3 · · · and no infinite antichain. For an arbitrary set M , let M ∗ denote the set of finite sequences of elements of M . Any quasi-order ≤ on M defines a quasi-order ≤∗ on M ∗ as follows: (a1 , . . . , am ) ≤∗ (b1 , . . . , bn ) if and only if there is a sequence of integers i1 , . . . , im with 1 ≤ i1 < · · · < im ≤ n such that aj ≤ bij for j ∈ {1, . . . , m}. We call ≤∗ the subsequence relation. Lemma 1 (Higman’s Lemma [18]). If (M, ≤) is a well-quasi-order then (M ∗ , ≤∗ ) is a well-quasi-order. 5 Labelled Induced Subgraphs and Uniformicity To define the notion of labelled induced subgraphs, let us consider an arbitrary quasi-order (W, ≤). We say that G is a labelled graph if each vertex v of G is equipped with an element lG (v) ∈ W (the label of v). Given two labelled graphs G and H, we say that G is a labelled induced subgraph of H if G is isomorphic to an induced subgraph of H and there is an isomorphism that maps each vertex v of G to a vertex w of H with lG (v) ≤ lH (w). Clearly, if (W, ≤) is a well-quasiorder, then a class of graphs X cannot contain an infinite sequence of labelled graphs that is strictly-decreasing with respect to the labelled induced subgraph relation. We therefore say that a class of graphs X is well-quasi-ordered by the labelled induced subgraph relation if it contains no infinite antichains of labelled graphs whenever (W, ≤) is a well-quasi-order. Such a class is readily seen to also be well-quasi-ordered by the induced subgraph relation. We will use the following three results. Lemma 2 ([1]). The class of P6 -free bipartite graphs is well-quasi-ordered by the labelled induced subgraph relation. Lemma 3 ([1]). Let k, ℓ, m be positive integers. Then the class of (Pk , Kℓ , Km,m )-free graphs is well-quasi-ordered by the labelled induced subgraph relation. Lemma 4 ([1]). Let X be a hereditary class of graphs. Then X is well-quasiordered by the labelled induced subgraph relation if and only if the set of prime graphs in X is. In particular, X is well-quasi-ordered by the labelled induced subgraph relation if and only if the set of connected graphs in X is. Let k be a natural number, let K be a symmetric square 0, 1 matrix of order k, and let Fk be a graph on the vertex set {1, 2, . . . , k}. Let H be the disjoint union of infinitely many copies of Fk , and for i = 1, . . . , k, let Vi be the subset of V (H) containing vertex i from each copy of Fk . Now we construct from H an infinite graph H(K) on the same vertex set by applying a subgraph complementation to Vi if and only if K(i, i) = 1 and by applying bipartite complementation to a pair Vi , Vj if and only if K(i, j) = 1. In other words, two vertices u ∈ Vi and v ∈ Vj are adjacent in H(K) if and only if uv ∈ E(H) and K(i, j) = 0 or uv ∈ / E(H) and K(i, j) = 1. Finally, let P(K, Fk ) be the hereditary class consisting of all the finite induced subgraphs of H(K). Let k be a natural number. A graph G is k-uniform if there is a matrix K and a graph Fk such that G ∈ P(K, Fk ). The minimum k such that G is k-uniform is the uniformicity of G. The following result was proved by Korpelainen and Lozin. The class of disjoint unions of cliques is a counterexample for the reverse implication. Theorem 1 ([20]). Any class of graphs of bounded uniformicity is well-quasiordered by the labelled induced subgraph relation. 6 3 Permitted Graph Operations It is not difficult to see that if G is an induced subgraph of H, then G is an induced subgraph of H. Therefore, a graph class X is well-quasi-ordered by the induced subgraph relation if and only if the set of complements of graphs in X is. In this section, we strengthen this observation in several ways. First, we define the operation of subgraph complementation as follows. Definition 1. Subgraph complementation in a graph G is the operation of complementing a subgraph of G induced by a subset of its vertices. Applied to the entire vertex set of G, this operation coincides with the usual complementation of G. However, applied to a pair of vertices, it changes the adjacency of these vertices only. Clearly, repeated applications of this operation can transform G into any other graph on the same vertex set. Therefore, unrestricted applications of subgraph complementation may transform a well-quasi-ordered class X into a class containing infinite antichains. However, if we bound the number of applications of this operation by a constant, we preserve many nice properties of X, including well-quasi-orderability with respect to the labelled induced subgraph relation. Next, we introduce the following operation: Definition 2. Bipartite complementation in a graph G is the operation of complementing the edges between two disjoint subsets X, Y ⊆ V (G). Note that applying a bipartite complementation between X and Y has the same effect as applying a sequence of three subgraph complementations: with respect to X, Y and X ∪ Y . Finally, we define the following operation: Definition 3. Vertex deletion in a graph G is the operation of removing a single vertex v from a graph, together with any edges incident to v. 3.1 Operations on Labelled Graphs Let k ≥ 0 be a constant and let γ be a graph operation. A graph class G ′ is (k, γ)-obtained from a graph class G if the following two conditions hold: (i) every graph in G ′ is obtained from a graph in G by performing γ at most k times, and (ii) for every G ∈ G there exists at least one graph in G ′ obtained from G by performing γ at most k times. We say that γ preserves well-quasi-orderability by the labelled induced subgraph relation if for any finite constant k and any graph class G, any graph class G ′ that is (k, γ)-obtained from G is well-quasi-ordered by this relation if and only if G is. 7 Lemma 5. The following operations preserve well-quasi-orderability by the labelled induced subgraph relation: (i) Subgraph complementation, (ii) Bipartite complementation and (iii) Vertex deletion. Proof. We start by proving the lemma for subgraph complementations. Let X be a class of graphs and let Y be a set of graphs obtained from X by applying a subgraph complementation to each graph in X. More precisely, for each graph G ∈ X we choose a set ZG of vertices in G; we let G′ be the graph obtained from G by applying a complementation with respect to the subgraph induced by ZG and we let Y be the set of graphs G′ obtained in this way. Clearly it is sufficient to show that X is well-quasi-ordered by the labelled induced subgraph relation if and only if Y is. Suppose that X is not well-quasi-ordered under the labelled induced subgraph relation. Then there must be a well-quasi-order (L, ≤) and an infinite sequence G1 , G2 , . . . of graphs in X with vertices labelled with elements of L, such that these graphs form an infinite antichain under the labelled induced subgraph relation. Let (L′ , ≤′ ) be the quasi-order with L′ = {(k, l) : k ∈ {0, 1}, l ∈ L} and (k, l) ≤′ (k ′ , l′ ) if and only if k = k ′ and l ≤ l′ (so L′ is the disjoint union of two copies of L, where elements of one copy are incomparable with elements of the other copy). Note that (L′ , ≤′ ) is a well-quasi-order since (L, ≤) is a well-quasiorder. For each graph Gi in this sequence, with labelling li , we construct the graph G′i (recall that G′i is obtained from Gi by applying a complementation on the vertex set ZGi ). We label the vertices of V (G′i ) with a labelling li′ as follows: – set li′ (v) = (1, li (v)) if v ∈ ZGi and – set li′ (v) = (0, li (v)) otherwise. We claim that when G′1 , G′2 , . . . are labelled in this way they form an infinite antichain with respect to the labelled induced subgraph relation. Indeed, suppose for contradiction that G′i is a labelled induced subgraph of G′j for some i 6= j. This means that there is a injective map f : V (G′i ) → V (G′j ) such that li′ (v) ≤′ lj′ (f (v)) for all v ∈ V (G′i ) and v, w ∈ V (G′i ) are adjacent in G′i if and only if f (v) and f (w) are adjacent in G′j . Now since li′ (v) ≤′ lj′ (f (v)) for all v ∈ V (G′i ), by the definition of ≤′ we conclude the following: – li (v) ≤ lj (f (v)) for all v ∈ V (G′i ) and – v ∈ ZGi if and only if f (v) ∈ ZGj . Suppose v, w ∈ V (Gi ) with w ∈ / ZGi (v may or may not belong to ZGi ) and note that this implies f (w) ∈ / ZGj . Then v and w are adjacent in Gi if and only if v and w are adjacent in G′i if and only if f (v) and f (w) are adjacent in G′j if and only if f (v) and f (w) are adjacent in Gj . Next suppose v, w ∈ ZGi , in which case f (v), f (w) ∈ ZGj . Then v and w are adjacent in Gi if and only if v and w are non-adjacent in G′i if and only if f (v) and f (w) are non-adjacent in G′j if and only if f (v) and f (w) are adjacent in Gj . 8 It follows that f is an injective map f : V (Gi ) → V (Gj ) such that li (v) ≤ lj (f (v)) for all v ∈ V (Gi ) and v, w ∈ V (Gi ) are adjacent in Gi if and only if f (v) and f (w) are adjacent in Gj . In other words Gi is a labelled induced subgraph of Gj . This contradiction means that if G1 , G2 , . . . is an infinite antichain then G′1 , G′2 , . . . must also be an infinite antichain. Therefore, if the class X is not well-quasi-ordered by the labelled induced subgraph relation then neither is Y . Repeating the argument with the roles of G1 , G2 , . . . and G′1 , G′2 , . . . reversed shows that if Y is not well-quasi-ordered under the labelled induced subgraph relation then neither is X. This completes the proof for subgraph complementations. Since a bipartite complementation is equivalent to doing three subgraph complementations one after another, the result for bipartite complementations follows. Finally, we prove the result for vertex deletions. Let X be a class of graphs and let Y be a set of graphs obtained from X by deleting exactly one vertex zG from each graph G in X. We denote the obtained graph by G − zG . Clearly it is sufficient to show that X is well-quasi-ordered by the labelled induced subgraph relation if and only if Y is. Suppose that Y is well-quasi-ordered by the labelled induced subgraph relation. We will show that X is also well-quasi-ordered by this relation. For each graph G ∈ X, let G′ be the graph obtained from G by applying a bipartite complementation between {zG } and N (zG ), so zG is an isolated vertex in G′ . Let Z be the set of graphs obtained in this way. By Lemma 5.(ii), Z is well-quasiordered by the labelled induced subgraph relation if and only if X is. Suppose G1 , G2 are graphs in Z with vertices labelled from some well-quasi-order (L, ≤). Then for i ∈ {1, 2} the vertex zGi has a label from L and the graph Gi − zGi belongs to Y . Furthermore if G1 − zG1 is a labelled induced subgraph of G2 − zG2 and lG1 (zG1 ) ≤ lG2 (zG2 ) then G1 is a labelled induced subgraph of G2 . Now by Lemma 1 it follows that Z is well-quasi-ordered by the labelled induced subgraph relation. Therefore X is also well-quasi-ordered by this relation. Now suppose that Y is not well-quasi-ordered by the labelled induced subgraph relation. Then Y contains an infinite antichain G1 , G2 , . . . with the vertices of Gi labelled by functions li which takes values in some well-quasi-order (L, ≤). For each Gi , let G′i be a corresponding graph in X, so Gi = G′i − zG′i . Then in G′i we label zG′i with a new label ∗ and label all other vertices v ∈ V (G′i ) with the same label as that used in Gi . We make this new label ∗ incomparable to all the other labels in L and note that the obtained quasi order (L ∪ {∗}, ≤) is also a well-quasi-order. It follows that G′1 , G′2 , . . . is an antichain in X when labelled in this way. Therefore, if Y is not well-quasi-ordered by the labelled induced subgraph relation then neither is X. This completes the proof. ⊓ ⊔ Note that the above lemmas only apply to well-quasi-ordering with respect to the labelled induced subgraph relation. Indeed, if we take a cycle and delete a vertex, complement the subgraph induced by an edge or apply a bipartite 9 complementation to two adjacent vertices, we obtain a path. However, while the set of cycles is an infinite antichain with respect to the induced subgraph relation, the set of paths is not. 3.2 Operations on k-Uniform Graphs We now show that our graph operations do not change uniformicity by “too much” either. The result for vertex deletion was proved by Korpelainen and Lozin. Lemma 6. Let G be a graph of uniformicity k. Let G′ , G′′ and G′′′ be graphs obtained from G by applying one vertex deletion, subgraph complementation or bipartite complementation, respectively. Let ℓ′ , ℓ′′ and ℓ′′′ be the uniformicities of G′ , G′′ and G′′′ , respectively. Then the following three statements hold: (i) ℓ′ < k < 2ℓ′ + 1 [20]; (ii) k2 ≤ ℓ′′ ≤ 2k; (iii) k3 ≤ ℓ′′′ ≤ 3k. Proof. The first inequality of Part (i) is trivial. The second inequality of Part (i) was proved in [20]. We prove Parts (ii) and (iii) below. Let G be a graph of uniformicity k, let X be a set of vertices in G and let G′′ be the graph obtained from G by applying a complementation with respect to the subgraph induced by X. Let ℓ′′ be the uniformicity of G′′ . By symmetry, to prove Part (ii), it is sufficient to prove that ℓ′′ ≤ 2k. Since G is a k-uniform graph, it must belong to P (Fk , K) for some Fk and some K, so it is an induced subgraph of H(K). Consider the graph obtained from Fk by replacing each vertex v of Fk by two non-adjacent vertices v and v ′ . Apply a complementation with respect to {1′ , 2′ , . . . , k ′ } and let Fk′ be the obtained graph. In other words, if v ∈ V (Fk ) then NFk′ (v) = NFk (v) ∪ {w′ | w ∈ NFk (v)} and NFk′ (v ′ ) = NFk (v) ∪ {w′ | w ∈ V (Fk ) \ NFk [v]}. ′ Let K ′ be a 2k × 2k matrix indexed by {1, 2, . . . , k, 1′ , 2′ , . . . , k ′ } with Ki,j = ′ ′ = Ki′ ,j = 1 − Ki′ ,j ′ = Ki,j . This means that H(K ′ ) is formed from H(K) by adding a copy of each vertex that has the same neighbourhood and then applying a complementation with respect to the set of newly-created vertices. Similarly, G′′ can be obtained from G by replacing each vertex in X by a copy with the same neighbourhood and then applying a complementation with respect to the set of newly-created vertices. Therefore G′′ is an induced subgraph of H(K ′ ). Therefore G′′ is a 2k-uniform graph. ′ Ki,j ′ Part (iii) follows from similar arguments to those for Part (ii). (Also note that if we weaken the bounds in Part (iii) to k8 ≤ ℓ′′′ ≤ 8k then the result follows immediately from combining Part (ii) with the fact that a bipartite complementation is equivalent to a sequence of three subgraph complementations.) ⊓ ⊔ 10 4 A New Well-Quasi-Ordered Class In this section we show that (2P1 + P2 , P2 + P3 )-free graphs are well-quasiordered by the labelled induced subgraph relation. We divide the proof into several sections, depending on whether or not the graphs under consideration contain certain induced subgraphs or not. We follow the general scheme that Dabrowski, Huang and Paulusma [11] used to prove that this class has bounded clique-width, but we will also need a number of new arguments. 4.1 Graphs containing a K5 We first consider graphs containing a K5 and prove the following lemma. Lemma 7. The class of (2P1 + P2 , P2 + P3 )-free graphs that contain a K5 is well-quasi-ordered by the labelled induced subgraph relation. Proof. Let G be a (2P1 + P2 , P2 + P3 )-free graph. Let X be a maximal (by set inclusion) clique in G containing at least five vertices. Claim 1. Every vertex not in X has at most one neighbour in X. This follows from the fact that X is maximal and G is 2P1 + P2 -free. Suppose there is a P3 in G \ X, say on vertices x1 , x2 , x3 in that order. Since |X| ≥ 5, we can find y1 , y2 ∈ X none of which are adjacent to any of x1 , x2 , x3 . Then G[y1 , y2 , x1 , x2 , x3 ] is a P2 + P3 . This contradiction shows that G \ X is P3 -free and must therefore be a union of disjoint cliques X1 , . . . , Xk . We say that a clique Xi is large if it contains at least two vertices and that it is small if it contains exactly one vertex. Claim 2. If x ∈ X is adjacent to y ∈ Xi and Xj (with i 6= j) is large, then x can have at most one non-neighbour in Xj . For contradiction, assume that x is non-adjacent to z1 , z2 ∈ Xj . Since |X| ≥ 5 and each vertex that is not in X has at most one neighbour in X, there must be a vertex x′ ∈ X that is non-adjacent to y, z1 and z2 . Then G[z1 , z2 , x′ , x, y] is a P2 + P3 , a contradiction. We consider several cases: Case 1: G \ X contains at most one clique. Then the complement of G is a bipartite graph. Moreover, since the complement of 2P1 + P2 is an induced subgraph of P6 , we conclude that the complements of graphs in our class form a subclass of P6 -free bipartite graphs, which are wellquasi-ordered by the labelled induced subgraph relation by Lemmas 2 and 5.(i). Case 2: G \ X does not contain large cliques. In this case, the structure of graphs can be described as follows: take a collection of stars and create a clique on their central vertices and then add a number (possibly zero) of isolated vertices. In other words, applying subgraph complementation once (to the clique X), we obtain a graph which is a disjoint union 11 of stars and isolated vertices. Clearly, a graph every connected component of which is a star or an isolated vertex is P6 -free bipartite and hence by Lemmas 2 and 5.(i) we conclude that graphs in our class are well-quasi-ordered by the labelled induced subgraph relation. Case 3: G \ X contains exactly one large clique. Without loss of generality, assume that X1 is large and the remaining cliques X2 , . . . , Xk are small. Suppose there are ℓ distinct vertices x1 , . . . , xℓ ∈ X, each of which has a neighbour in X2 ∪ · · · ∪ Xk . By Claim 2, each of these vertices has at most one non-neighbour in X1 . But then ℓ ≤ 2, since otherwise a vertex of X1 has more than one neighbour in X. Therefore, by deleting at most two vertices from G we transform it to a graph from Case 1 plus a number of isolated vertices. Lemma 4 allows us to ignore isolated vertices, while Lemma 5.(iii) allows the deletion of finitely many vertices. Therefore, in Case 3 we deal with a set of graphs which is well-quasiordered by the labelled induced subgraph relation. Case 4: G \ X contains at least two cliques that are large. Suppose there is a vertex x ∈ X that has a neighbour outside of X. By Claim 2, x has at most one non-neighbour in each large clique. Therefore, at most two vertices of X have neighbours outside of X, since otherwise each large clique would have a vertex with more than one neighbour in X. But then by deleting at most two vertices we transform G into a P3 -free graph (i.e. a graph every connected component of which is a clique). It is well-known (and also follows from Lemma 4) that the set of P3 -free graphs is well-quasi-ordered by the labelled induced subgraph relation. Therefore, by Lemma 5.(iii), the same is true for graphs in Case 4. ⊓ ⊔ 4.2 Graphs containing a C5 By Lemma 7, we may restrict ourselves to looking at K5 -free graphs in our class. We now consider the case where these graphs have an induced C5 . Lemma 8. The class of (2P1 + P2 , P2 + P3 , K5 )-free graphs that contain an induced C5 has bounded uniformicity. Proof. To prove this, we modify the proof from [11], which shows that this class of graphs has bounded clique-width. Let G be a (2P1 + P2 , P2 + P3 , K5 )-free graph containing a C5 , say on vertices v1 , v2 , v3 , v4 , v5 in order. Our goal is to show that the graph G has bounded uniformicity and hence, by Lemma 6.(i), in the proof we can neglect any set of vertices that is bounded in size by a constant. Let Y be the set of vertices adjacent to v1 and v2 (and possibly to other vertices on the cycle). If y1 , y2 ∈ Y are non-adjacent, then G[v1 , v2 , y1 , y2 ] would be a 2P1 + P2 . Therefore, Y is a clique. This clique has at most two vertices, since otherwise three vertices of Y together with v1 and v2 would create a K5 . Therefore, the set of all vertices with two consecutive neighbours on the cycle is finite and hence can be neglected (removed from the graph). We may therefore 12 assume that each vertex not on the cycle has at most two neighbours on the cycle and if it has two such neighbours, they must be non-consecutive vertices of the cycle. Now let W be the set of vertices whose unique neighbour on the cycle is v1 . If y1 , y2 ∈ W are non-adjacent, then G[v3 , v4 , y1 , v1 , y2 ] would be a P2 + P3 . If y1 , y2 ∈ W are adjacent, then G[y1 , y2 , v2 , v3 , v4 ] would be a P2 + P3 . Therefore, W contains at most one vertex, and hence the set of all vertices with exactly one neighbour on the cycle can be removed from the graph. Let X be the set of vertices with no neighbours on the cycle. X must be an independent set, since if two vertices in x1 , x2 ∈ X are adjacent, then G[x1 , x2 , v1 , v2 , v3 ] would induce a P2 + P3 in G. For i ∈ {1, 2, 3, 4, 5}, let Vi be the set of vertices not on the cycle that are adjacent to vi−1 and vi+1 , but non-adjacent to all other vertices of the cycle (subscripts on vertices and vertex sets are interpreted modulo 5 throughout this proof). For each i, the set Vi must be independent, since if x, y ∈ Vi are adjacent then G[x, y, vi−1 , vi+1 ] is a 2P1 + P2 . We say that two sets Vi and Vj are consecutive (respectively opposite) if vi and vj are distinct adjacent (respectively non-adjacent) vertices of the cycle. We say that a set X or Vi is large if it contains at least three vertices, otherwise it is small. We say that a bipartite graph with bipartition classes A and B is a matching (co-matching) if every vertex in A has at most one neighbour (nonneighbour) in B, and vice versa. Dabrowski, Huang and Paulusma proved the following claims about the edges between these sets (see Appendix A for a proof). Claim Claim Claim Claim Claim Claim 1. 2. 3. 4. 5. 6. ([11]) ([11]) ([11]) ([11]) ([11]) ([11]) G[Vi ∪ X] is a matching. If Vi and Vj are opposite, then G[Vi ∪ Vj ] is a matching. If Vi and Vj are consecutive, then G[Vi ∪ Vj ] is a co-matching. If Vi is large, then X is anti-complete to Vi−2 ∪ Vi+2 . If Vi is large, then Vi−1 is anti-complete to Vi+1 . If Vi−1 , Vi , Vi+1 are large, then Vi is complete to Vi−1 ∪ Vi+1 . We also prove the following claim: Claim 7. Suppose two consecutive sets Vi and Vi+1 are large and a vertex y ∈ Vi is not adjacent to a vertex z ∈ Vi+1 . Then every vertex x ∈ X ∪ Vi+3 is either complete or anti-complete to {y, z}. To prove this, suppose for contradiction that this is not the case. Without loss of generality, we may assume that that x is adjacent to y but not to z. Since Vi is large it contains at least two other vertices, say a and b. Then z is adjacent to both a and b (since G[Vi ∪Vi+1 ] is a co-matching), while x is adjacent neither to a nor to b (since G[Vi ∪ X] and G[Vi ∪ Vi+3 ] are matchings). But then G[x, y, a, z, b] is a P2 + P3 , a contradiction. We are now ready to prove the lemma. We may delete from G the vertices v1 , . . . , v5 and all vertices in every small set X or Vi . Let G′ be the resulting 13 graph. In order to show that G′ has bounded uniformicity, we split the analysis into the following cases. Case 1: All sets V1 , . . . , V5 are large. From the above claims we conclude that any two consecutive sets are complete to each other and any two opposite sets are anti-complete to each other. Also, X is anti-complete to each of them. Therefore G′ is 6-uniform. Case 2: Four sets Vi are large, say V1 , . . . , V4 . Then V1 and V4 form a matching, while any other pair of these sets are either complete or anti-complete to each other. Also, X is anti-complete to each of them. Therefore G′ is 5-uniform. Case 3: Three consecutive sets Vi are large, say V1 , V2 , V3 . Then V2 is complete to V1 and V3 , while V1 and V3 are anti-complete to eachother. Also, X is anti-complete to V1 and V3 forms a matching with V2 . Therefore G′ is 4-uniform. Case 4: Three non-consecutive sets Vi are large, say V1 , V3 , V4 . Then X is anti-complete to each of them. From the above claims we know that V1 forms a matching with both V3 and V4 , while V3 and V4 form a co-matching. Also, from Claim 7 we conclude that whenever two vertices y ∈ V3 and z ∈ V4 are non-adjacent, then either none of them has a neighbour in V1 or they both are adjacent to the same vertex of V1 . Therefore, if we complement the edges between V3 and V4 , then G′ transforms into a graph in which every connected component is one of the following graphs: K3 , P3 , P2 , P1 . Each of these graphs is an induced subgraph of P1 + P3 (also known as the paw), so the obtained graph is 4-uniform. By Lemma 6.(iii), it follows that G[V1 ∪ V3 ∪ V4 ] is 12-uniform and so G′ is 13-uniform. Case 5: Two consecutive sets Vi are large, say V3 , V4 . This case is similar to the previous one, where the role of V1 is played by X. Thus G′ is 12-uniform. Case 6: Two non-consecutive sets Vi are large. Then X is anti-complete to each of them and hence the graph is obviously 3uniform. Case 7: At most one set Vi is large. Then G′ is obviously 2-uniform. Since the above cases cover all possibilities, this completes the proof. 14 ⊓ ⊔ 4.3 Graphs containing a C4 By Lemmas 7 and 8, we may restrict ourselves to looking at (K5 , C5 )-free graphs in our class. We prove the following structural result. Lemma 9. Let G be a (2P1 + P2 , P2 + P3 , K5 , C5 )-free graph containing an induced C4 . Then by deleting at most 17 vertices and applying at most two bipartite complementations, we can modify G into the disjoint union of a (P2 + P3 )-free bipartite graph and a 3-uniform graph. Proof. In order to prove the lemma, we again modify the proof from [11], which shows that this class of graphs has bounded clique-width. Let G be a (2P1 + P2 , P2 + P3 , K5 , C5 )-free graph containing a C4 induced by the vertices v1 , v2 , v3 , v4 in order. We interpret subscripts on vertices modulo 4 in this proof. Let Y be the set of vertices adjacent to v1 and v2 (and possibly to other vertices on the cycle). If y1 , y2 ∈ Y are non-adjacent, then G[v1 , v2 , y1 , y2 ] would be a 2P1 + P2 . Therefore, Y is a clique. This clique has at most two vertices, since otherwise three vertices of Y together with v1 and v2 would create a K5 . Therefore, after deleting at most 2 × 4 = 8 vertices, we may assume that no vertex of the graph contains two consecutive neighbours on the cycle. Let V1 denote the set of vertices adjacent to v2 and v4 , and let V2 denote the set of vertices adjacent to v1 and v3 . For i ∈ {1, 2, 3, 4}, let Wi denote the set of vertices whose only neighbour on the cycle is vi . If a set Wi contains at most one vertex then we may delete this vertex. Thus, deleting at most four vertices, we may assume that every set Wi is either empty of contains at least two vertices. Finally, let X be the set of vertices with no neighbour on the cycle. Dabrowski, Huang and Paulusma proved the following claims about the edges between these sets (see Appendix B for a proof). Claim 1. ([11]) Vi is independent for i ∈ {1, 2}. Claim 2. ([11]) Wi is independent for i ∈ {1, 2, 3, 4}. Claim 3. ([11]) X is independent. Claim 4. ([11]) Wi is anti-complete to X for i ∈ {1, 2, 3, 4}. Claim 5. ([11]) For i ∈ {1, 2} either Wi or Wi+2 is empty. Therefore, we may assume by symmetry that W3 = ∅ and W4 = ∅. Note that in our arguments so far we have deleted at most 12 vertices. We now argue as follows: Any vertices of X that do not have neighbours in V1 ∪ V2 must be isolated vertices of the graph. Since adding isolated vertices to a P2 + P3 -free bipartite graph maintains the property of it being P2 + P3 -free and bipartite, we may therefore assume that every vertex in X has a neighbour in V1 ∪ V2 . Let X0 denote the subset of X whose vertices have neighbours both in V1 and V2 , let X1 denote the subset of X whose vertices have no neighbours in V1 and let X2 denote the subset of X whose vertices have no neighbours in V2 . Let V0 denote the set of vertices in V1 ∪ V2 adjacent to at least one vertex of X0 and let V10 = V1 ∩ V0 and V20 = V2 ∩ V0 . If V10 or V20 contains at most one 15 vertex then we may delete this vertex. This would cause X0 to become empty. Therefore, by deleting at most one vertex, we may assume that either both V10 and V20 each contain at least two vertices or else V10 , V20 and X0 are all empty. We will show that G[X0 ∪ V0 ] is 3-uniform and can be separated from the rest of the graph using at most two bipartite complementations. To do this, we first prove the following additional claims. Claim 6. Every vertex of X0 has exactly one neighbour in V10 and exactly one neighbour in V20 and these neighbours are adjacent. First, we observe that if a vertex x ∈ X0 is adjacent to y ∈ V1 and to z ∈ V2 , then y is adjacent to z, since otherwise G[x, y, v2 , v1 , z] is an induced C5 . This implies that if x has the third neighbour y ′ ∈ V1 ∪ V2 , then G[x, z, y, y ′ ] is a 2P1 + P2 . This contradiction proves the claim. Claim 7. Every vertex of V0 is adjacent to exactly one vertex of X0 . Let v be a vertex in V0 . Without loss of generality, assume that v belongs to V10 . Suppose that v has at least two neighbours in X0 , say x and x′ , and at least one non-neighbour, say x′′ . Let v ′′ be the neighbour of x′′ in V10 . Then G[v ′′ , x′′ , x, v, x′ ] is a P2 + P3 . This contradiction shows that if v has at least two neighbours in X0 , then it must be adjacent to all the vertices of X0 . Since every vertex of X0 has exactly one neighbour in V10 it follows that v is the only vertex of V10 , a contradiction. We conclude that v (and hence every other vertex of V0 ) has exactly one neighbour in X0 . Claim 8. V10 is complete to V2 and V20 is complete to V1 . Suppose v ∈ V10 is non-adjacent to y ∈ V2 and let x be the unique neighbour of v in X0 . Since y is non-adjacent to v, it cannot be the unique neighbour of x in V2 . Therefore y must be non-adjacent to x. It follows that G[x, v, v1 , y, v3 ] is a P2 + P3 , a contradiction. The second part of the claim follows by symmetry. Claim 9. Every vertex in W1 ∪ W2 ∪ X1 ∪ X2 is either complete or anti-complete to Vi0 for i = 1, 2. Suppose a vertex w ∈ W1 ∪ W2 ∪ X1 ∪ X2 has both a neighbour v and a nonneighbour v ′ in V10 . Let x and x′ be the neighbours of v and v ′ , respectively, in X0 . Recall that x and x′ must be non-adjacent to w. Then G[v ′ , x′ , w, v, x] is a P2 + P3 , a contradiction. By Claims 8 and 9, every vertex outside V10 ∪ V20 ∪ X0 is either complete or anticomplete to V10 and either complete or anti-complete to V20 . Applying at most two bipartite complementations, we may therefore disconnect G[V10 ∪ V20 ∪ X0 ] from the rest of the graph i.e. remove all edges between vertices in V10 ∪ V20 ∪ X0 and vertices outside V10 ∪ V20 ∪ X0 . By Claims 6, 7 and 8 it follows that G[V10 ∪ V20 ∪ X0 ] is a 3-uniform graph. We may now assume that X0 is empty. Let H be the graph obtained from G by deleting the vertices of the original cycle. Note that V (H) = X1 ∪ V1 ∪ W1 ∪ X2 ∪ V2 ∪ W2 . It remains to show that H is a (P2 + P3 )-free bipartite graph. We claim that H is bipartite with independent sets X1 ∪ V1 ∪ W1 and X2 ∪ V2 ∪ W2 . To show this, it suffices to prove that H has no triangles, because all 16 other odd cycles are forbidden in G (and hence in H). We know that X1 ∪ V1 is an independent set and X2 ∪ V2 is an independent set. Also, W1 and W2 are independent and the vertices of X have no neighbours in W1 ∪ W2 . It follows that in H vertices in X1 an can only have neighbours in V2 and vertices of X2 can only have neighbours in V1 , so no triangle in H contains a vertex of X. By symmetry, if H[x, y, z] is a triangle then we may therefore assume that x ∈ W1 , y ∈ V2 and z ∈ V1 ∪ W2 . Now G[x, y, z, v1 ] is a 2P1 + P2 , a contradiction. It follows that H is bipartite. Moreover, it is (P2 + P3 )-free. This completes the proof. ⊓ ⊔ Since P2 + P3 is an induced subgraph of P6 , it follows that every (P2 + P3 )free graph is P6 -free. Combining Lemma 9 with Theorem 1 and Lemmas 2, 5.(ii) and 5.(iii) we therefore obtain the following corollary. Corollary 1. The class of (2P1 + P2 , P2 +P3 , K5 , C5 )-free graphs containing an induced C4 is well-quasi-ordered by the labelled induced subgraph relation. 4.4 (2P1 + P2 , P2 + P3 )-free graphs Theorem 2. The class of (2P1 + P2 , P2 + P3 )-free graphs is well-quasi-ordered by the labelled induced subgraph relation. Proof. Graphs in the class under consideration containing an induced subgraph isomorphic to K5 , C5 or C4 are well-quasi-ordered by the labelled induced subgraph relation by Lemmas 7 and 8 and Corollary 1, respectively. The remaining graphs form a subclass of (P6 , K5 , K2,2 )-free graphs, since C4 = K2,2 and P2 + P3 is an induced subgraph of P6 . By Lemma 3, this class of graphs is wellquasi-ordered by the labelled induced subgraph relation. Therefore, the class of (2P1 + P2 , P2 + P3 )-free graphs is well-quasi-ordered by the labelled induced subgraph relation. ⊓ ⊔ 5 Two New Non-Well-Quasi-Ordered Classes In this section we show that the classes of (2P1 + P2 , P2 + P4 )-free graphs and (P1 + P4 , P1 + 2P2 )-free graphs are not well-quasi-ordered by the induced subgraph relation. The antichain used to prove the first of these cases was previously used by Atminas and Lozin to show that the class of (2P1 + P2 , P6 )-free graphs is not well-quasi-ordered with respect to the induced subgraph relation. Because of this, we can show show a stronger result for the first case. Theorem 3. The class of (2P1 + P2 , P2 + P4 , P6 )-free graphs is not well-quasiordered by the induced subgraph relation. Proof. Let n ≥ 2 be an integer and consider a cycle C4n , say x1 −x2 −· · ·−x4n −x1 . We partition the vertices of this cycle into three sets as follows as follows: X = {xi | i ≡ 0 or 2 mod 4}, Y = {xi | i ≡ 1 mod 4}, Z = {xi | i ≡ 3 mod 4}. 17 Let G4n be the graph obtained from C4n by connecting every vertex of Y to every vertex of Z (see also Fig. 2). Atminas and Lozin showed that the resulting graphs are (2P1 + P2 , P6 )-free and form an infinite antichain with respect to the induced subgraph relation [1]. x3 x4 x2 x5 x1 x6 x12 x7 x11 x8 x10 x9 Fig. 2. The Graph G4n from Theorem 3 when n = 3. It remains to prove that G4n is (P2 + P4 )-free. We argue as in the proof of [11, Theorem 1 (iv)]. For contradiction, suppose that G4n contains an induced subgraph I isomorphic to P2 + P4 . Let I1 and I2 be the connected components of I isomorphic to P2 and P4 , respectively. Since G4n [Y ∪Z] is complete bipartite, I2 must contain at least one vertex of X. Since the two neighbours of any vertex of X are adjacent, any vertex of X in I2 must be an end-vertex of I2 . Then, as Y and Z are independent sets, I2 contains a vertex of both Y and Z. As I1 can contain at most one vertex of X (because X is an independent set), I1 contains a vertex u ∈ Y ∪ Z. However, G4n [Y ∪ Z] is complete bipartite and I2 contains a vertex of both Y and Z. Hence, u has a neighbour in I2 , which is not possible. This completes the proof. ⊓ ⊔ The graphs G4n in the above proof are obtained from cycles in the same way that walls were transformed in [11] to show unboundedness of clique-width for (2P1 + P2 , P2 + P4 )-free graphs (The sets A, B and C in [11] correspond to the sets Y, X and Z, respectively, in the proof above). In fact the construction in [11] is also P6 -free by the same arguments as in [1], so we obtain the following: Remark 1. The class of (2P1 + P2 , P2 +P4 , P6 )-free graphs has unbounded cliquewidth. For our second class, we need a new construction. 18 Theorem 4. The class of (P1 + P4 , P1 + 2P2 )-free graphs is not well-quasiordered by the induced subgraph relation. Proof. Let n ≥ 3 be an integer. Consider a cycle C4n , say x1 − x2 − · · ·− x4n − x1 . We partition the vertices of C4n as follows: X = {xi | i ≡ 0 or 1 mod 4}, Y = {xi | i ≡ 2 or 3 mod 4}. Next we apply a complementation to each of X and Y , so that in the resulting graph X and Y each induce a clique on 2n vertices with a perfect matching removed. Let G4n be the resulting graph (see also Fig. 3). x3 x4 x2 x5 x1 x6 x12 x7 x11 x8 x10 x9 Fig. 3. The Graph G4n from Theorem 4 when n = 3. Suppose, for contradiction that G4n contains an induced P1 + 2P2 . Without loss of generality, the set X must contain three of the vertices v1 , v2 , v3 of the P1 + 2P2 . Since every component of P1 + 2P2 contains at most two vertices, without loss of generality we may assume that v1 is non-adjacent to both v2 and v3 . However, every vertex of G4n [X] has exactly one non-neighbour in X. This contradiction shows that G4n is indeed (P1 + 2P2 )-free. Every vertex in X has exactly one neighbour in Y and vice versa. This means that any K3 in G4n must lie entirely in G4n [X] or G4n [Y ]. Since G4n [X] or G4n [Y ] are both complements of perfect matchings and every vertex of P1 + P4 lies in one of three induced K3 ’s, which are pairwise non-disjoint, it follows that G4n is P1 + P4 -free. It remains to show that the graphs G4n form an infinite antichain with respect to the induced subgraph relation. Since n ≥ 3, every vertex in X (resp. Y ) has 19 at least two neighbours in X (resp. Y ) that are pairwise adjacent. Therefore, given x1 , we can determine which vertices lie in X and which lie in Y . Every vertex in X (resp. Y ) has a unique neighbour in Y (resp. X) and a unique nonneighbour in X (resp. Y ). Therefore, by specifying which vertex in G4n is x1 , we uniquely determine x2 , . . . , x4n . Suppose G4n an induced subgraph of G4m for some m ≥ 3. Then n ≤ m due to the number of vertices. By symmetry, we may assume that the induced copy of G4n in G4m has vertex x1 of G4n in the position of vertex x1 in G4m . Then the induced copy of G4n must have vertices x2 , . . . , x4n in the same position as x2 , . . . , x4n in G4m , respectively. Now x1 and x4n are non-adjacent in G4n . If n < m then x1 and x4n are adjacent in G4m , a contradiction. We conclude that if G4n is an induced subgraph of G4m then n = m. In other words {G4n | n ≥ 3} is an infinite antichain with respect to the induced subgraph relation. ⊓ ⊔ 6 State of the Art and Future Work In this section we summarise what is currently known about well-quasiorderability and boundedness of clique-width, taking in to account the results proved in this paper. We also give a number of directions for future work. Given four graphs H1 , H2 , H3 , H4 , the class of (H1 , H2 )-free graphs and the class of (H3 , H4 )-free graphs are equivalent if the unordered pair H3 , H4 can be obtained from the unordered pair H1 , H2 by some combination of the operations (i) complementing both graphs in the pair and (ii) if one of the graphs in the pair is K3 , replacing it with P1 + P3 or vice versa. If two classes are equivalent, then one of them is well-quasi-ordered with respect to the induced subgraph relation if and only if the other one is [20]. Similarly, if two classes are equivalent, then one of them has bounded clique-width if and only if the other one does [13]. We use this terminology in the remainder of this section. 6.1 Well-Quasi-Ordering Atminas and Lozin [1] proved that the class of (K3 , P6 )-free graphs is well-quasiordered by the induced subgraph relation, while the class of (2P1 + P2 , P6 )-free graphs is not. Updating the classification in [20] with these two results and the three results proved in this paper (Theorems 2–4) leads to the following classification: Theorem 5. Let G be a class of graphs defined by two forbidden induced subgraphs. Then: 1. G is well-quasi-ordered with respect to the labelled induced subgraph relation if it is equivalent to a class of (H1 , H2 )-free graphs such that one of the following holds: (i) H1 or H2 ⊆i P4 ; (ii) H1 = sP1 and H2 = Kt for some s, t; 20 (iii) H1 ⊆i 3P1 and H2 ⊆i 2P1 + P3 or P6 ; (iv) H1 ⊆i 2P1 + P2 and H2 ⊆i P2 + P3 or P5 . 2. G is not well-quasi-ordered with respect to the induced subgraph relation if it is equivalent to a class of (H1 , H2 )-free graphs such that one of the following holds: (i) neither H1 nor H2 is a linear forest (disjoint union of paths); (ii) H1 ⊇i 3P1 and H2 ⊇i 3P1 + P2 , 3P2 or 2P3 ; (iii) H1 ⊇i 2P2 and H2 ⊇i 4P1 or 2P2 ; (iv) H1 ⊇i 2P1 + P2 and H2 ⊇i 4P1 , P2 + P4 or P6 ; (v) H1 ⊇i P1 + P4 and H2 ⊇i P1 + 2P2 . Note that in Theorem 5 every class that is well-quasi-ordered with respect to the induced subgraph relation is also well-quasi-ordered with respect to the labelled induced subgraph relation (see [1,20] and Theorem 2). This agrees with a conjecture of Atminas and Lozin [1] stating that these concepts coincide for hereditary classes X precisely when X is defined by a finite collection of forbidden induced subgraphs. Theorem 5 leaves us with nine open cases. Open Problem 1 Is the class of (H1 , H2 )-free graphs well-quasi-ordered by the induced subgraph relation when: (i) H1 = 3P1 and H2 ∈ {P1 + 2P2 , P1 + P5 , P2 + P4 }; (ii) H1 = 2P1 + P2 and H2 ∈ {P1 + 2P2 , P1 + P4 }; (iii) H1 = P1 + P4 and H2 ∈ {P1 + P4 , 2P2 , P2 + P3 , P5 }. In relation to Open Problem 1, we mention that the infinite antichain for (P1 + P4 , P1 + 2P2 )-free graphs was initially found by a computer search. This computer search also showed that similar antichains do not exist for any of the remaining nine open cases. As such, constructing antichains for these cases is likely to be a challenging problem and this suggests that many of these classes may in fact be well-quasi-ordered. Some of these remaining classes have been shown to have bounded clique-width [3,4,5,10]. We believe that some of the structural characterizations for proving these results may be useful for showing well-quasi-orderability. Indeed, we are currently trying to prove that the classes of (K3 , P1 + P5 )-free graphs and (K3 , P2 + P4 )-free graphs are well-quasi-ordered via a special type of graph partition that avoids rainbow triangles and rainbow anti-triangles. 6.2 Clique-Width The following theorem from [10] describes exactly for which pairs (H1 , H2 ) the (un)boundedness of the clique-width of (H1 , H2 )-free graphs has been determined. Theorem 6. Let G be a class of graphs defined by two forbidden induced subgraphs. Then: 21 1. G has bounded clique-width if it is equivalent to a class of (H1 , H2 )-free graphs such that one of the following holds: (i) H1 or H2 ⊆i P4 ; (ii) H1 = sP1 and H2 = Kt for some s, t; (iii) H1 ⊆i P1 +P3 and H2 ⊆i K1,3 +3P1 , K1,3 +P2 , P1 +P2 +P3 , P1 +P5 , P1 + S1,1,2 , P6 , S1,1,3 or S1,2,2 ; (iv) H1 ⊆i 2P1 + P2 and H2 ⊆i P1 + 2P2 , 2P1 + P3 , 3P1 + P2 or P2 + P3 ; (v) H1 ⊆i P1 + P4 and H2 ⊆i P1 + P4 or P5 ; (vi) H1 ⊆i 4P1 and H2 ⊆i 2P1 + P3 ; (vii) H1 , H2 ⊆i K1,3 . 2. G has unbounded clique-width if it is equivalent to a class of (H1 , H2 )-free graphs such that one of the following holds: (i) H1 6∈ S and H2 6∈ S; / S and H2 6∈ S; (ii) H1 ∈ (iii) H1 ⊇i K1,3 or 2P2 and H2 ⊇i 4P1 or 2P2 ; (iv) H1 ⊇i 2P1 + P2 and H2 ⊇i K1,3 , 5P1 , P2 + P4 or P6 ; (v) H1 ⊇i 3P1 and H2 ⊇i 2P1 + 2P2 , 2P1 + P4 , 4P1 + P2 , 3P2 or 2P3 ; (vi) H1 ⊇i 4P1 and H2 ⊇i P1 + P4 or 3P1 + P2 . This leaves us with the following eight non-equivalent open cases. Open Problem 2 Does the class of (H1 , H2 )-free graphs have bounded or unbounded clique-width when: (i) (ii) (iii) (iv) H1 H1 H1 H1 = 3P1 and H2 ∈ {P1 + S1,1,3 , P2 + P4 , S1,2,3 }; = 2P1 + P2 and H2 ∈ {P1 + P2 + P3 , P1 + P5 }; = P1 + P4 and H2 ∈ {P1 + 2P2 , P2 + P3 } or = H2 = 2P1 + P3 . A potential direction for future research related to determining boundedness of clique-width is investigating linear clique-width for classes defined by two forbidden induced subgraphs. Indeed, it is not hard to show that k-uniform graphs have bounded linear clique-width. Again, we can use complementations and vertex deletions when dealing with this parameter. 6.3 Well-Quasi-Ordering versus Clique-Width We recall that all known results for bigenic classes of graphs verify Conjecture 1. Note that Conjecture 1 is verified directly if a graph class has bounded cliquewidth. Brandstädt, Le and Mosca [4] proved that the class of (P1 + P4 , P1 + P4 )free graphs (and thus the class of (2P1 + P2 , P1 + P4 )-free graphs) has bounded clique-width. Using results from [3], the same authors proved in [5] that the class of (P1 + P4 , P5 )-free graphs (and thus the class of (2P2 , P1 + P4 )-free graphs) has bounded clique-width. Dabrowski, Dross and Paulusma [10] showed that the classes of (K3 , P1 + 2P2 )-free graphs, (K3 , P1 + P5 )-free graphs and (2P1 + P2 , P1 + 2P2 )-free graphs all have bounded clique-width. Hence, there are only two (non-equivalent) bigenic classes of graphs left for which Conjecture 1 needs to be verified. We state these two open cases below. 22 Open Problem 3 Is Conjecture 1 true for the class of (H1 , H2 )-free graphs when: (i) H1 = K3 and H2 = P2 + P4 or when (ii) H1 = P1 + P4 and H2 = P2 + P3 ? As can be seen from Open Problems 1 and 2, for both classes we know neither whether they are well-quasi-ordered by the induced subgraph relation nor whether their clique-width is bounded. References 1. A. Atminas and V. V. Lozin. Labelled induced subgraphs and well-quasi-ordering. Order, 32(3):313–328, 2015. 2. H. L. Bodlaender. A linear-time algorithm for finding tree-decompositions of small treewidth. SIAM Journal on Computing, 25(6):1305–1317, 1996. 3. A. Brandstädt and D. Kratsch. On the structure of (P5 ,gem)-free graphs. Discrete Applied Mathematics, 145(2):155–166, 2005. 4. A. Brandstädt, H.-O. Le, and R. Mosca. Gem- and co-gem-free graphs have bounded clique-width. International Journal of Foundations of Computer Science, 15(1):163–185, 2004. 5. A. Brandstädt, H.-O. Le, and R. Mosca. Chordal co-gem-free and (P5 ,gem)-free graphs have bounded clique-width. Discrete Applied Mathematics, 145(2):232–241, 2005. 6. B. Courcelle. The monadic second-order logic of graphs III: tree-decompositions, minor and complexity issues. Informatique Théorique et Applications, 26(3):257– 286, 1992. 7. B. Courcelle. Clique-width and edge contraction. Information Processing Letters, 114(1–2):42–44, 2014. 8. B. Courcelle, J. A. Makowsky, and U. Rotics. Linear time solvable optimization problems on graphs of bounded clique-width. Theory of Computing Systems, 33(2):125–150, 2000. 9. B. Courcelle and S. Olariu. Upper bounds to the clique width of graphs. Discrete Applied Mathematics, 101(1–3):77–114, 2000. 10. K. K. Dabrowski, F. Dross, and D. Paulusma. Colouring diamond-free graphs. Proc. SWAT 2016, LIPIcs, 53:16:1–16:14, 2016. 11. K. K. Dabrowski, S. Huang, and D. Paulusma. Bounding clique-width via perfect graphs. Journal of Computer and System Sciences, (in press). 12. K. K. Dabrowski, V. V. Lozin, and D. Paulusma. Well-quasi-ordering versus cliquewidth: New results on bigenic classes. Proc. IWOCA 2016, LNCS, 9843:253–265, 2016. 13. K. K. Dabrowski and D. Paulusma. Clique-width of graph classes defined by two forbidden induced subgraphs. The Computer Journal, 59(5):650–666, 2016. 14. J. Daligault, M. Rao, and S. Thomassé. Well-quasi-order of relabel functions. Order, 27(3):301–315, 2010. 15. P. Damaschke. Induced subgraphs and well-quasi-ordering. Journal of Graph Theory, 14(4):427–435, 1990. 16. W. Espelage, F. Gurski, and E. Wanke. How to solve NP-hard graph problems on clique-width bounded graphs in polynomial time. Proc. WG 2001, LNCS, 2204:117– 128, 2001. 23 17. A. Finkel and P. Schnoebelen. Well-structured transition systems everywhere! Theoretical Computer Science, 256(1–2):63–92, 2001. 18. G. Higman. Ordering by divisibility in abstract algebras. Proceedings of the London Mathematical Society, s3–2(1):326–336, 1952. 19. D. Kobler and U. Rotics. Edge dominating set and colorings on graphs with fixed clique-width. Discrete Applied Mathematics, 126(2–3):197–221, 2003. 20. N. Korpelainen and V. V. Lozin. Two forbidden induced subgraphs and well-quasiordering. Discrete Mathematics, 311(16):1813–1822, 2011. 21. J. B. Kruskal. The theory of well-quasi-ordering: A frequently discovered concept. Journal of Combinatorial Theory, Series A, 13(3):297–305, 1972. 22. V. V. Lozin, I. Razgon, and V. Zamaraev. Well-quasi-ordering does not imply bounded clique-width. Proc. WG 2015, LNCS, 9224:351–359, 2016. 23. S.-I. Oum and P. D. Seymour. Approximating clique-width and branch-width. Journal of Combinatorial Theory, Series B, 96(4):514–528, 2006. 24. M. Rao. MSOL partitioning problems on graphs of bounded treewidth and cliquewidth. Theoretical Computer Science, 377(1–3):260–267, 2007. 25. N. Robertson and P. D. Seymour. Graph minors. IV. Tree-width and well-quasiordering. Journal of Combinatorial Theory, Series B, 48(2):227–254, 1990. 26. N. Robertson and P. D. Seymour. Graph minors. XX. Wagner’s conjecture. Journal of Combinatorial Theory, Series B, 92(2):325–357, 2004. 24 A Proofs of the Claims in Lemma 8 from [11, Lemma 10] Claim 1. G[Vi ∪ X] is a matching. Indeed, if some vertex x in Vi (respectively X) is adjacent to two vertices y1 , y2 in X (respectively Vi ), then G[vi+2 , vi+3 , y1 , x, y2 ] is a P2 + P3 . Claim 2. If Vi and Vj are opposite, then G[Vi ∪ Vj ] is a matching. Suppose for contradiction that x ∈ V1 is adjacent to two vertices y, y ′ ∈ V3 . Then G[v2 , x, y, y ′ ] would be a 2P1 + P2 , a contradiction. Claim 3. If Vi and Vj are consecutive, then G[Vi ∪ Vj ] is a co-matching. Suppose for contradiction that x ∈ V1 is non-adjacent to two vertices y, y ′ ∈ V2 . Then G[x, v5 , y, v3 , y ′ ] is a P2 + P3 , a contradiction. Claim 4. If Vi is large, then X is anti-complete to Vi−2 ∪ Vi+2 . Suppose for contradiction that V3 is large and x ∈ X has a neighbour y ∈ V1 . Then since V3 is large and both G[X∪V3 ] and G[V1 ∪V3 ] are matchings, there must be a vertex z ∈ V3 that is non-adjacent to both x and y. Then G[x, y, v3 , v4 , z] is a P2 + P3 , a contradiction. Claim 5. If Vi is large, then Vi−1 is anti-complete to Vi+1 . Suppose for contradiction that V2 is large and x ∈ V1 has a neighbour y ∈ V3 . Since V2 is large and each vertex in V1 ∪ V3 has at most one non-neighbour in V2 , there must be a vertex z ∈ V2 that is adjacent to both x and y. Now G[x, y, v2 , z] is a 2P1 + P2 , a contradiction. Claim 6. If Vi−1 , Vi , Vi+1 are large, then Vi is complete to Vi−1 ∪ Vi+1 . Suppose for contradiction that V1 , V2 , V3 are large and some vertex x ∈ V1 is nonadjacent to a vertex y ∈ V2 . Since V3 is large and G[V2 ∪ V3 ] is a co-matching, there must be two vertices z, z ′ ∈ V3 , adjacent to y. By the previous claim, since V2 is large, z, z ′ must be non-adjacent to x. Therefore G[x, v5 , z, y, z ′] is a P2 + P3 , which is a contradiction. B Proofs of the Claims in Lemma 9 from [11, Lemma 11] Claim 1. Vi is independent for i ∈ {1, 2}. If x, y ∈ Vi were adjacent then G[x, y, vi+1 , vi+3 ] would be a 2P1 + P2 . Claim 2. Wi is independent for i ∈ {1, 2, 3, 4}. If x, y ∈ Wi were adjacent then G[x, y, vi+1 , vi+2 , vi+3 ] would be a P2 + P3 . Claim 3. X is independent. If x, y ∈ X were adjacent then G[x, y, v1 , v2 , v3 ] would be a P2 + P3 . Claim 4. Wi is anti-complete to X for i ∈ {1, 2, 3, 4}. If x ∈ X were adjacent to y ∈ Wi then G[x, y, vi+1 , vi+2 , vi+3 ] would be a P2 +P3 . Claim 5. For i ∈ {1, 2} either Wi or Wi+2 is empty. Therefore, we may assume by symmetry that W3 = ∅ and W4 = ∅. To show this, first suppose that vertices x ∈ W1 and y ∈ W3 are adjacent. Then 25 G[v1 , v2 , v3 , y, x] is a C5 , which is a contradiction. Therefore, W1 is anti-complete to W3 . If both W1 and W3 are non-empty then by our earlier assumption they must each contain at least two vertices. Suppose that x ∈ W1 and y, z ∈ W3 . In this case G[x, v1 , y, v3 , z] is a P2 + P3 , a contradiction. We conclude that at least one of W1 and W3 must be empty. Without loss of generality, we assume that W3 is empty. Similarly, we assume that W4 is empty. 26
8cs.DS
arXiv:1208.2187v2 [math.AC] 11 Mar 2013 THE LEX-PLUS-POWER INEQUALITY FOR LOCAL COHOMOLOGY MODULES GIULIO CAVIGLIA AND ENRICO SBARRA Abstract. We prove an inequality between Hilbert functions of local cohomology modules supported in the homogeneous maximal ideal of standard graded algebras over a field, within the framework of embeddings of posets of Hilbert functions. As a main application, we prove an analogue for local cohomology of Evans’ Lex-Plus-Power Conjecture for Betti numbers. This results implies some cases of the classical Lex-Plus-Power Conjecture, namely an inequality between extremal Betti numbers. In particular, for the classes of ideals for which the Eisenbud-Green-Harris Conjecture is currently known, the projective dimension and the Castelnuovo-Mumford regularity of a graded ideal do not decrease by passing to the corresponding Lex-Plus-Power ideal. Introduction The Eisenbud-Green-Harris (EGH) and Evans’ Lex-Plus-Power (LPP) conjectures are two open problems in Algebraic Geometry and Commutative Algebra which are challenging and of great interest to researchers in these fields, cf. [EiGrHa1], [EiGrHa2], [MePeSt], [MeMu], [FrRi], [Pe], [CaMa], [Ch], [Fr], [Ri], [RiSa]. The survey [PeSt], which includes the two conjectures above, might offer the interested reader an overview of questions which are currently considered to be significant for the classification of Hilbert functions and the study of modules of syzygies. A milestone on this subject is yielded by the work of Macaulay, cf. [Ma] or the dedicated sections in [BrHe], where the sequences of numbers which are possible Hilbert functions of standard graded algebras over a field are characterized, the characterization having made possible by the introduction of a special class of monomial ideals called lexicographic ideals (lex-segment ideals for short). More precisely, all the possible Hilbert functions of standard graded algebras over a field are attained by quotients of polynomial rings by lex-segment ideals. In the 60’s, some forty years after Macaulay’s work, Kruskal-Katona Theorem [Kr], [Ka] provided another fundamental classification result, that of f -vectors of simplicial complexes, and shortly after it was generalized by the ClementsLindström Theorem [ClLi]. Both Kruskal-Katona and Clements-Lindström Theorems extend Macaulay Theorem from graded quotients of A = K[X1 , . . . , Xn ] to graded quotients of R = A/a, where a = (X1d1 , . . . , Xrdr ) with d1 = · · · = dr = 2 and 2 ≤ d1 ≤ · · · ≤ dr resp., by stating that all the possible Hilbert functions are those attained by quotients whose defining ideals are images in R of lex-segments ideals of A. Inspired by these results and driven Date: November 13, 2017. 2010 Mathematics Subject Classification. Primary 13D02,13D45; Secondary 14B15. Key words and phrases. Eisenbud-Green-Harris Conjecture, Lex-Plus-Power Conjecture, embeddings of Hilbert functions, local cohomology. The work of the first author was supported by a grant from the Simons Foundation (209661 to G. C.). 1 2 GIULIO CAVIGLIA AND ENRICO SBARRA by the of generalizing the famous Cayley-Bacharach Theorem, Eisenbud, Green and Harris [EiGrHa1], [EiGrHa2] conjectured among other things what is currently known as EGH: Let f = f1 , . . . , fr be a regular sequence of homogeneous polynomials of degrees d1 ≤ · · · ≤ dr in A. Then, for every homogeneous ideal I ⊂ A containing f , there exists a lex-segment ideal L of A such that I and L + (X1d1 , . . . , Xrdr ) have the same Hilbert function. Since then, the conjecture has been proven only in some special cases, cf. [CaMa], [Ch] and [FrRi]. Furthermore, starting in the early 90’s, lex-segment ideals - and other monomial ideals with strong combinatorial properties - have been studied extensively; properties of lex-segment ideals have been generalized and studied also in other contexts, see for instance [ArHeHi1], [ArHeHi2], generating a very rich literature on the subject. Among other results of this kind, we recall the following ones. The lex-segment ideal in the family of all homogeneous ideals with a given Hilbert function has largest Hilbert functions of local cohomology modules, which was proved in [Sb]. Also, it has largest graded Betti numbers, as it was shown [Bi], [Hu] and [Pa]. In a different direction these are other extensions of Macaulay’s result. Evans’ Lex-Plus-Power Conjecture extends in this sense the Eisenbud-Green-Harris Conjecture to Betti numbers, by asking whether, in case EGH holds true, a Bigatti-Hulett-Pardue type of result holds as well, i.e. LPP: Suppose that a regular sequence f verifies EGH; then the graded Betti numbers over A of every homogeneous ideal I containing f are smaller than or equal to those of L + (X1d1 , . . . , Xrdr ). The conjecture is known in some few cases, the most notable one is when f is a monomial regular sequence, which is solved first in [MePeSt] when d1 = · · · = dr = 2 and then in general in [MeMu]. We now take a step back, and recall that the graded Betti numbers βijA (A/I) are precisely the dimension as a K-vector space of TorA i (A/I, K)j . In other words, once we have fixed A i, we can think the sequence of βij (A/I) as the Hilbert function of TorA i (A/I, K), which is computed by means of a minimal graded free resolution of A/I. If we let Hilb (M) denote the Hilbert series of a graded module M, then we may restate LPP as coefficient-wise inequalities between the Hilbert series of such Tor’s: if f satisfies EGH then for all homogeneous ideals I of A containing f (LPP)     A d1 dr Hilb TorA i (A/I, K) ≤ Hilb Tori (A/(L + (X1 , . . . , Xr )), K) , for all i. In this paper we study analogous inequalities for Hilbert series of local cohomology modules. Let Hmi (•) denote the ith local cohomology module of a graded object with support in the graded maximal ideal. One of our main results is Theorem 4.4, where we show that, if the image of f in a suitable quotient ring of A satisfies EGH (as it does in all the known cases [ClLi], [CaMa], [Ch] and [Ab]) then for all homogeneous ideals I of A containing f (Theorem 4.4)     Hilb Hmi (A/I) ≤ Hilb Hmi (A/(L + (X1d1 , . . . , Xrdr ))) , for all i. Our approach makes use of embeddings of Hilbert functions, which have been recently introduced by the first author and Kummini in [CaKu1] with the intent of finding a new path to the classification of Hilbert functions of quotient rings. Since EGH may be rephrased by means of embeddings, as we explain in Section 2, it is natural to study inequalities of the above type in this generality. In this setting we prove our main result Theorem 3.1, which implies Theorem 4.4. We let R, S be standard graded K-algebras such that R embeds into (S, ǫ), see Definition 2.3. We also assume that, for all homogeneous ideals I of THE LEX-PLUS-POWER INEQUALITY FOR LOCAL COHOMOLOGY MODULES    3  R, Hilb Hmi R (R/I) ≤ Hilb Hmi S (S/ǫ(I)) for all i. Then, Theorem 3.1 states that the polynomial ring R[Z] embeds into (S[Z], ǫ1 ) and, for all homogeneous ideals J of S[Z] and for all i,     Hilb Hmi R[Z] (R[Z]/J) ≤ Hilb Hmi S[Z] (S[Z]/ǫ1 (J)) . Finally, in Theorem 5.4 we prove LPP for extremal Betti numbers: under the same assumption of Theorem 4.4 for all homogeneous ideals I of A containing f and for all corners (i, j) of A/L + (X1d1 , . . . , xdr r ) we have βijA (A/I) ≤ βijA (A/L + (X1d1 , . . . , xdr r )). (Theorem 5.4) This paper is structured as follows. In Section 1 we introduce some general notation and we discuss the basic properties of certain ideals called Z-stable, together with all the related technical results needed, such as distractions. In Section 2 we provide a brief summary of embeddings of Hilbert functions and we recall in Theorem 2.2 a General Restriction Theorem type of result proved in [CaKu1]. This is aimed at setting the general framework for our main theorem and leads to the proof of Proposition 2.6, which is the other main tool we need. Section 3 is devoted to our main theorem, Theorem 3.1. We show there that if a ring R admits an embedding of Hilbert functions and its embedded ideals ǫ(I) maximize all the Hilbert functions of local cohomology modules Hmi (R/•), the same is true for any polynomial ring with coefficients in R. In Section 4 we explain how to derive from Theorem 3.1 our main corollary, Theorem 4.4, a lex-plus-power type inequality for local cohomology which justifies the title. Finally, in the last section we prove the validity of LPP for extremal Betti numbers in Theorem 5.4 and we show in Theorem 5.5 an inclusion between the region of the Betti table outlined by the extremal Betti numbers of an ideal and the one of its corresponding Lex-Plus-Power ideal. 1. Z-stability 1.1. Notation. Let N be the set of non-negative integers, A = K[X1 , . . . , Xn ] be a polynomial ring over a field K and R = ⊕j∈N Rj = A/a be a standard graded algebra. We consider the polynomial ring R[Z] with the standard grading. When I is an ideal of R[Z], we will denote by I its image in R under the substitution map Z 7→ 0. With Hilb (M) we denote the Hilbert series of a module M which is graded with respect to total degree and with Hilb (M)j its j th coefficient, i.e. the j th value of its Hilbert function. Accordingly, Hilb (M)• will denote the Hilbert function of M. We say that an ideal I of R[Z] is Z-graded if it can be written as L h h∈N Ihhi Z , where each Ihhi is a homogeneous ideal of R. In particular a Z-graded ideal of R[Z] is homogeneous. We will denote with mR and mR[Z] the homogeneous maximal ideals of R and R[Z] respectively. 1.2. Z-stability. The following definition was introduced in [CaKu1]. L Definition 1.1. Let I = h∈N Ihhi Z h be a Z-graded ideal of R[Z]. We say that I is Z-stable if, for all k ≥ 0, we have Ihk+1i mR ⊆ Ihki . The simplest example of a Z-stable ideal is the extension to R[Z] of an ideal J of R, in which L case JR[Z] = h∈N JZ h . It is easy to see that Z-stable ideals are fixed under the action 4 GIULIO CAVIGLIA AND ENRICO SBARRA on R[Z] of those coordinates changes of K[X1 , . . . , Xn , Z] which are both homogeneous and R-linear. Remark 1.2. (a) Let I be a Z-stable ideal of R[Z] and let us write the degree d component Id of I as a direct sum of vector spaces Vd ⊕ Vd−1 Z ⊕ · · · ⊕ V0 Z d . It follows directly from Definition 1.1 that, for all j = 0, . . . , d, the j th component of the R-ideal generated by Ld j=0 Vj is the vector space Vj . L (b) It is immediately seen that the ideal I : Z = h∈N Ihh+1i Z h is Z-stable as well. Furthermore, we observe that I : Z = I : mR[Z] ; one inclusion is clear and the other follows from M M M mR[Z] (I : Z) = Ihh+1i (mR + Z)Z h ⊆ Ihhi Z h + Ihh+1i Z h+1 ⊆ I. h∈N In particular, I sat := S i (I : h∈N miR[Z] ) = S i (I h∈N i : Z ) =: I : Z ∞ is a Z-stable ideal. The next result about Z-stable ideals will be used later in the paper. Lemma 1.3.  Let I andJ be Z-stable ideals of R[Z] with Hilb (I)i = Hilb (J)i for all i ≫ 0. Then, Hilb I = Hilb J for all j ≫ 0. j j Proof. Since i ≫ 0, we may assume that there is no generator of I or J in degree i and above. As in Remark 1.2 (a), we denote the vector space of all homogeneous polynomials in I of degree i by Ii , and we write it as direct sum of vector spaces Vi ⊕ Vi−1 Z ⊕ · · · ⊕ V0 Z i . From the definition of Z-stability it follows that Ii (mR[Z] )1 ⊆ Vi (mR )1 ⊕ Ii Z. Hence, we get a decomposition of the vector space Ii+1 as direct sum I i (mR )1 ⊕Ii Z = I i+1 ⊕Ii Z. Similarly, we can write Ji+1 as J i+1 ⊕ Ji Z and now the conclusion follows easily from the hypothesis.  1.3. Distractions. Let I be a Z-graded ideal of R[Z] and let l = l+Z be an element of R[Z] with ¯l ∈ R1 (and possibly zero). Given a positive degree d we define the (d, l)-distraction of I, and we denote it by D(d,l) (I), D(d,l) (I) := M 0≤h<d  Ihhi Z h ⊕ l  M d≤h  Ihhi Z h−1 . It is not hard to see that D(d,l) (I) is an ideal of R[Z] with the same Hilbert function as I, see [CaKu1] Lemma 3.16 and also [BiCoRo] for more information about general distractions of the polynomial ring A. To our purposes, it is important to notice that D(d,l) (I) can be realized in two steps as a polarization of I followed by a specialization. In  Lorder to do so, L h h−1 . we first define J to be the ideal of R[Z, T ] generated by 0≤h<d Ihhi Z ⊕ T d≤h Ihhi Z Notice that the Hilbert function of J is the same as the one of IR[Z, T ]. This implies that T − Z and T − l are R[Z, T ]/J-regular, and thus there exist isomorphisms (1.4) R[Z, T ]/(J + (T − Z)) ≃ R[Z]/I, R[Z, T ]/(J + (T − l)) ≃ R[Z]/D(d,l) (I). We now define a partial order ≺ on all the Z-graded ideals of R[Z] by letting (1.5) J L iff  Hilb  M k≤h   Jhki Z k  ≤ Hilb  M k≤h  Lhki Z k  for all h, THE LEX-PLUS-POWER INEQUALITY FOR LOCAL COHOMOLOGY MODULES 5 L L where k≤h Jhki Z k and k≤h Lhki Z k are considered as graded R-modules with deg Z k = k. We write J ≺ L when J  L and at least one of the above inequalities is strict. Let now I be a Z-graded ideal of R[Z] and consider the partially ordered set I of all Z-graded ideals of R[Z] = A/a[Z] with the same Hilbert function as I. We claim that I has finite dimension as a poset, i.e. the supremum of all lengths of chains in I is finite. To this end, we fix a monomial order τ on A and we compute the initial ideal with respect to τ of the pre-image in A[Z] of every ideal in I. In this way, we have constructed a set J of monomial ideals in A[Z] all with the same Hilbert function, say H. By Macaulay Theorem, this set is finite, for the degrees of the minimal generators of an ideal in J are bounded above by the degrees of the minimal generators of the unique lex-segment ideal with Hilbert function H. Since every chain of I lifts to a chain in J , our claim is now clear. Proposition 1.6. Let I be a Z-graded ideal of R[Z] and let ω = (1, . . . , 1, 0) be a weight vector. If I is not Z-stable, then there exist a positive integer d and a linear form l = l + Z with ¯l ∈ R1 such that I ≺ inω (D(d,l) (I)). L Proof. We write I as h∈N Ihhi Z h and we let d > 0 be the least positive integer such that Ihdi mR 6⊆ Ihd−1i . Thus, there exists an indeterminate Xj of A such that Ihdi Xj 6⊆ Ihd−1i ; therefore we can define l to be the image in R[Z] of Xj +Z and D(d,l) to be the corresponding L L (d, l)-distraction. Since D(d,l) ( j≤i RZ j ) ⊆ j≤i RZ j for all i, we have I  inω (D(d,l) (I)) =: J. Furthermore, Ihd−1i ⊆ Jhd−1i and Ihdi Xj ⊆ Jhd−1i . Since Ihdi Xj 6⊆ Ihd−1i we deduce that Ihd−1i ( Jhd−1i , hence I ≺ J as desired.  From now on, Hmi (•) will denote the ith local cohomology with support in the homogeneous maximal ideal m of a standard graded K-algebra. Proposition 1.7. Let I be a homogeneous ideal of R[Z]. Then, there exists a Z-stable ideal J of R[Z] with the same Hilbert function as I such that     Hilb Hmi R[Z] (R[Z]/I) ≤ Hilb Hmi R[Z] (R[Z]/J) ,    for all i.  Proof. By [Sb] Theorem 2.4, Hilb Hmi R[Z] (R[Z]/I) ≤ Hilb Hmi R[Z] (R[Z]/ inω (I)) where ω = (1, . . . , 1, 0), and thus without loss of generality we may assume that I is Z-graded. Let now I be the set of all Z-graded ideals of R[Z] with same Hibert function as I and J ∈ I be maximal - with respect to the partial order    ≺ defined in (1.5) - among the i ideals of I which satisfy Hilb HmR[Z] (R[Z]/I) ≤ Hilb Hmi R[Z] (R[Z]/J) for all i. We claim that J is Z-stable. If it were not, by Proposition 1.6 there would exist a positive integer d and a linear form l such that J ≺ inω (D (J)). By (1.4) together with [Sb] Section   (d,l)  i i 5, we have Hilb HmR[Z] (R[Z]/J) = Hilb HmR[Z] (R[Z]/D(d,l) (J)) . By [Sb] Theorem 2.4, inω (D(d,l) (J)) ∈ I, contradicting the maximality of J.  2. Embeddings and the General Hyperplane Restriction Theorem Let B = K[X1 , . . . , Xn ] be a standard graded polynomial ring over a field K, b a homogeneous ideal of B and S = B/b. Denote by I S the poset {J : J is a homogeneous S-ideal} ordered by inclusion, and with HS the poset {Hilb (J)• : J ∈ I S } of all Hilbert functions of the ideals in I S with the usual point-wise partial order. Following [CaKu1] we say that S 6 GIULIO CAVIGLIA AND ENRICO SBARRA admits an embedding if there exists an order preserving injection ǫ : HS −→ I S such that the image of any given Hilbert function is an ideal with that Hilbert function. We call any such ǫ an embedding of S. A ring S with a specified embedding ǫ is denoted by (S, ǫ) and, for simplicity’s sake, we also let ǫ(I) := ǫ(Hilb (I)• ), for every I ∈ I S . The notion of embedding captures the key property of rings for which an analogous of Macaulay Theorem holds. Example 2.1 (Three standard examples of embedding). In the following we present some results that can be re-interpreted with the above terminology. (a) Let S = B and define ǫ : HS −→ IS as ǫ(Hilb (I)• ) := L, where L is the unique lexsegment ideal with Hilbert function Hilb (I)• . The fact that this map is well-defined is just a restatement of Macaulay Theorem. (b) Let S = B/b, where b = (X1d1 , . . . , Xrdr ) and d1 ≤ · · · ≤ dr . Let I be a homogeneous ideal of S, by Clements-Lindström Theorem [ClLi] there exists a lex-segment ideal L ⊆ B such that Hilb (I) = Hilb (LS). Since LS is uniquely determined by Hilb (I), we may define ǫ(Hilb (I)• ) := LS. The ideal L+b, which is uniquely determined by the Hilbert function of I, is often referred to as the Lex-Plus-Power ideal associated with I (with respect to d1 , . . . , dr ). L (c) Let m be a positive integer and S = B (m) = d≥0 Bmd the mth -Veronese subring of B. Let I be a homogeneous ideal of ideal L LS. Then, by [GaPeMu], there exists a lex-segment L of B such that Hilb (I) = Hilb d≥0 Lmd and we define ǫ(Hilb (I)• ) := d≥0 Lmd . We observe that in all of the above examples the image set of ǫ consists of the classes in S of lex-segment ideals; rings with this property are called Macaulay-Lex, cf. for instance [MePe]. These examples can be derived by general properties of embeddings proved in [CaKu1]. For instance, if we let (S, ǫ) be a ring with an embedding then: (i) the polynomial ring S[Z] admits an embedding and if ǫ is defined by means of a lexsegment as in (a) and (b) then so is the extended embedding on S[Z]; (ii) when HS[Z]/(Z d ) = {Hilb (JS[Z])• : J is Z-stable}, the ring S[Z]/(Z d) admits an embedding as well. By an iterated use of this fact, starting with S = K, one can recover (b); (iii) any Veronese subring S (m) of S admits an embedding inherited from (S, ǫ); (iv) S/ǫ(I) admits an embedding induced by ǫ; (v) when b is monomial and c ⊆ T is a polarization of b, then T /c admits an embedding.  The following theorem generalizes to rings with embedding [HePo] Theorem 3.7 (see also [Ga] Theorem 2.4) valid for polynomial rings. Theorem 2.2 (General Restriction Theorem). Let (S, ǫ) be a standard graded K-algebra with an embedding and S[Z] a polynomial ring in one variable with coefficients in S. There L exists an embedding ǫ1 : HS[Z] −→ IS[Z] such that ǫ1 (I) = h Jhhi Z h is a Z-stable ideal with ǫ(Jhhi ) = Jhhi . Moreover, if I is Z-stable, then     Hilb I + (Z j ) ≥ Hilb ǫ1 (I) + (Z j ) , for all j. Proof. See that of [CaKu1] Theorem 3.9 (see also [CaKu2] Theorem 2.1).  Definition 2.3. Let (S, ǫ) be a ring with an embedding. We say that a K-algebra R embeds into (S, ǫ) and we write (R, S, ǫ) if HR ⊆ HS . Moreover, we say that an ideal I of S is embedded if it is in the image of ǫ. For simplicity’s sake, we let again ǫ(I) := ǫ(Hilb (I)• ) for all homogeneous ideals I of R. THE LEX-PLUS-POWER INEQUALITY FOR LOCAL COHOMOLOGY MODULES 7 Clearly, (S, ǫ) embeds into itself and if R embeds into (S, ǫ) then Hilb (R) = Hilb (S), for there is an ideal I ∈ IS with same Hilbert function as R, therefore Hilb (I)0 = 1 implies I = S. The above definition is motivated by the conjecture of Eisenbud, Green and Harris, which has been discussed in the introduction. When a regular sequence f of A = K[X1 , . . . , Xn ] satisfies EGH, the Hilbert functions of homogeneous ideals in R = A/(f ) are also Hilbert functions of homogeneous ideal in S = B/(X1d1 , . . . , Xrdr ). Equivalently HR ⊆ HS . The fact that Clements-Lindström Theorem holds for S tells us that R embeds into S. One of the reasons why EGH is important is that HR ⊆ HS together with the fact that ClementsLindström Theorem gives an embedding, allow to transfer certain results, e.g. an uniform upper bound on the number of generators as in Remark 2.5), from the ring S to the ring R. Let now (S, ǫ) be a ring with an embedding, and let I ∈ IS . It is easily seen from [CaKu1] Proposition 2.4 and Definition 2.3 (i) that the ideal ǫ(I)mS is embedded i.e. ǫ(ǫ(I)mS ) = ǫ(I)mS . Lemma 2.4. Let R embed into (S, ǫ) and let I ∈ IR . Then, mS ǫ(I) ⊆ ǫ(mR I). Proof. Since mS ǫ(I) is embedded and embeddings preserve poset structures we only need to show that Hilb (mS ǫ(I))• ≤ Hilb (ǫ(mR I))• or, equivalently, that dimK (S1 ǫ(I))d+1 ≤ dimK R1 Id for all d ≥ 0. Since ǫ(I) contains ǫ((Id )) and they agree in degree d, we have (S1 ǫ(I))d+1 = (S1 ǫ((Id )))d+1 and its dimension is smaller than or equal to that of ǫ((Id ))d+1 . Now it is enough to observe that the latter has the same dimension as R1 Id .  Remark 2.5. There is point-wise inequality between the number and the degrees of minimal R S generators of a homogeneous ideal I ⊆ R and the ones of ǫ(I), namely β1j (I) ≤ β1j (ǫ(I)). This inequality is equivalent to Hilb (I/mR I) ≤ Hilb (ǫ(I)/mS ǫ(I)) , which follows immediately from Lemma 2.4. Proposition 2.6. Let R embed into (S, ǫ) and let ǫ1 as in Theorem 2.2. Then R[Z] embeds into (S[Z], ǫ1 ). Moreover, if I is a Z-stable ideal of R[Z] then     Hilb I + (Z j ) ≥ Hilb ǫ1 (I) + (Z j ) , for all j. Proof. Let I be a homogeneous ideal of R[Z]. By Proposition 1.7 there exists a Z-stable ideal of R[Z] with the same Hilbert function as I so that we may assume that I is Z-stable. L L Now we write I as h∈N Ihhi Z h and we let J be the S-module h∈N ǫ(Ihhi )Z h . It is easy to see that J is an ideal of S, for ǫ(Ih0i ) ⊆ ǫ(Ih1i ) ⊆ · · · , and thus HR[Z] ⊆ HS[Z]. By Lemma 2.4, mS ǫ(Ihh+1i ) ⊆ ǫ(Ihhi ) which implies that J is Z-stable. We now have Hilb (I + (Z j )) = Hilb (J + (Z j )) for all j and we can conclude the proof by applying Theorem 2.2 since ǫ1 (J) = ǫ1 (I).  We conclude this section with a technical result we need later on. Lemma 2.7. Let R embed into (S, ǫ) and let ǫ1 as in Theorem 2.2. If I is a Z-stable ideal of R[Z], then ǫ(I) sat = ǫ1 (I) sat . ǫ (I) = ǫ1 (I)h0i is an embedded ideal of R by Theorem 2.2. Proof. First, we observe that   1 By Proposition 2.6, Hilb I ≥ Hilb ǫ1 (I) , hence ǫ(I) ⊇ ǫ(ǫ1 (I)) = ǫ1 (I). Moreover, • • 8 GIULIO CAVIGLIA AND ENRICO SBARRA  Hilb ǫ(I)  j   = Hilb I j  = Hilb ǫ1 (I)  j for j ≫ 0 by Lemma 1.3, from which we deduce that ǫ(I)j = ǫ1 (I)j for j ≫ 0. This is enough to complete the proof, since saturation of a homogeneous ideal can be computed by any of its sufficiently high truncations.  3. The main theorem In this section we illustrate our main result, which is stated in the next theorem. We say that (R, S, ǫ) is (local) cohomology   extremal if, for  every homogeneous ideal I of R and all i, i i one has Hilb HmR (R/I) ≤ Hilb HmS (S/ǫ(I)) . We recall that both R and S are graded quotients of A = B = K[X1 , . . . , Xn ], and that the projective dimension proj dimA (M) and the Castelnuovo-Mumford regularity regA (M) of a finitely generated graded A-module M can be expressed in terms of local cohomology modules as max{n − i : Hmi A (M) 6= 0} and max{d + i : Hmi A (M)d 6= 0} respectively. Thus when (R, S, ǫ) is cohomology extremal, for every homogeneous ideal I of R one has proj dim(R/I) ≤ proj dim(S/ǫ(I)) and reg(R/I) ≤ reg(S/ǫ(I)), and analogous inequalities hold for the embeddings ǫ1 and ǫm of Theorem 3.1 and Corollary 3.2 below. Theorem 3.1. Let (R, S, ǫ) be cohomology extremal. Then, (R[Z], S[Z], ǫ1 ) is cohomology extremal. By recursion, one immediately obtains the natural generalization to the case of m variables. Corollary 3.2. Let m be a positive integer and (R, S, ǫ) be cohomology extremal. Then, (R[Z1 , . . . , Zm ], S[Z1, . . . , Zm ], ǫm ) is cohomology extremal. Let A = K[X1 , . . . , Xm ] be a polynomial ring over a field K, I ⊆ A a homogeneous ideal and L the unique lex-segment ideal of A with the same Hilbert function as I. It was proven in [Sb] Theorem 5.4 that (3.3)     Hilb Hmi A (A/I) ≤ Hilb Hmi A (A/L) , for all i. This result can be now recovered from the above corollary, since any field K has a trivial embedding ǫ0 , so that (K, K, ǫ0 ) and (A, A, ǫm ) are cohomology extremal. By Example 2.1 part (i), we know that ǫm (I) is the lex-segment ideal L. Similarly, Corollary 3.2 implies the following result, which is the analogous inequality, for local cohomology, of that for Betti numbers proved by Mermin and Murai in [MeMu]. Theorem 3.4. Let A = K[X1 , . . . , Xn ], a = (X1di , . . . , Xrdr ), with d1 ≤ · · · ≤ dr . Let I ⊆ A be a homogeneous ideal containing a, and let L + a be the Lex-Plus-Power ideal associated to I with respect to d1 , . . . , dr . Then, (3.5)     Hilb Hmi A (A/I) ≤ Hilb Hmi A (A/L + a) , for all i. Proof. Let R̄ = K[X1 , . . . , Xr ]/(X1d1 , . . . , Xrdr ); by Example 2.1 (b) R̄ has an embedding ǫ induced by the Clements and Lindström Theorem. Since R̄ is Artinian we see immediately that (R̄, R̄, ǫ) is cohomology extremal being Hm0 R̄ (R̄/J) = R̄/J and Hm0 R̄ (R̄/ǫ(J)) = R̄/ǫ(J) THE LEX-PLUS-POWER INEQUALITY FOR LOCAL COHOMOLOGY MODULES 9 for all homogeneous ideal J of R̄. Now, A/a is isomorphic to R̄[Xr+1 , . . . , Xn ], and by Corollary 3.2 we know that ǫn−r is cohomology extremal. Furthermore, ǫn−r (I(A/a)) = L(A/a) (see [CaKu2] Remark 2.5). By Base Independence of local cohomology, we thus have  Hilb Hmi A (A/I)   = Hilb Hmi A/a (A/I)    ≤ Hilb Hmi A/a ((A/a)/ǫn−r (I(A/a)))   = Hilb Hmi A (A/L + a) , for all i.  For the proof of Theorem 3.1 we need some preparatory facts. First, we observe that for any homogeneous ideal I of R[Z], I sat sat = I sat , (3.6) since I sat and I coincide in high degrees because I sat and I do. It is not difficult to see that, if I is a homogeneous ideal of R, then for all i > 0  Hilb Hmi R[Z] (R[Z]/IR[Z])  h = X  Hilb Hmi−1 (R/I) R k≥h  k+1 , cf. for instance [Sb2] Lemma 2.2 for a proof. As an application, when I is a Z-stable ideal of R[Z] and i > 0 one has  (3.7) Hilb Hmi R[Z] (R[Z]/I)  h  = Hilb Hmi R[Z] (R[Z]/I sat )  h = X  Hilb Hmi−1 (R/I sat ) R k≥h  k+1 , which is clearly equivalent to (3.8)   Hilb Hmi R[Z] (R[Z]/I) = X   tj · Hilb Hmi−1 (R/I sat ) , for i > 0. R j<0 We shall also need the observation, yielded by (3.8) together with (3.6), that for a Z-stable ideal I of R[Z] (3.9)   Hilb Hmi R[Z] (R[Z]/I) = X   tj · Hilb Hmi−1 (R/I sat ) , for i > 1. R j<0 Lemma 3.10. Let I be a Z-stable ideal of S[Z] and d ≫ 0 a fixed integer. Then, for all j = 0, . . . d, j X k=0  Hilb I sat  d−k ≤ j X k=0  Hilb ǫ1 (I) sat  d−k . d Proof. Let Id = Vd ⊕ Vd−1 Zm ⊕ · · · ⊕ V0 Zm be a decomposition of Id as a direct sum of ∞ vector spaces. Since d ≫ 0, we have that I sat = (Id ) sat which by Z-stability is (Id ) : Zm ; sat therefore, I is generated by the elements in V0 ⊕· · ·⊕Vd , which also generate in S the ideal I sat . Moreover, cf. Remark 1.2(a), (I sat )d−j is exactly the vector space Vj , for 0 ≤ j ≤ d. The same argument can be repeated for ǫ1 (I), since it is also Z-stable; therefore, the two terms which appear in the inequality that has to be proven are the values at d of the Hilbert function of I +(Zm )j /(Zm )j and ǫ1 (I)+(Zm )j /(Zm )j respectively, thus the conclusion follows now immediately from Theorem 2.2.  10 GIULIO CAVIGLIA AND ENRICO SBARRA Proof of Theorem 3.1. By Proposition 1.7 we may assume I to be Z-stable in order to prove our thesis     Hilb Hmi R[Z] (R[Z]/I) ≤ Hilb Hmi S[Z] (S[Z]/ǫ1 (I)) , for all i. i = 0 For this case it is enough to recall that Hilb (R[Z]/I) = Hilb (S[Z]/ǫ1 (I)) and Proposition 2.2 yields Hilb (R[Z]/(I + (Z j ))) ≤ Hilb (S[Z]/(ǫ1 (I) + (Z j ))), for all j. Thus, for all j, Hilb(I : Z j /I) ≤ Hilb (ǫ1 (I) : Z j /ǫ1 (I)) which is equivalent to our thesis if j is chosen to be large enough, as we already observed in Remark 1.2 (b). i = 1 If Hm1 R[Z] (R[Z]/I) = 0 there is nothing to prove. Suppose then that this is not the case. Now, an application of (3.7) with d ≫ 0 and for all j ≤ d yields Hilb   Hm1 R[Z] (R[Z]/I) d−j (3.11) = = j X  Hilb Hm0 R (R/I sat ) k=0 j X  Hilb I sat sat k=0  d+1−k {z |  d+1−k −  Hilb I sat k=0 } Σ1 (I) j X |  d+1−k {z . } Σ2 (I) We now look at the terms appearing in the first sum. By Lemma 2.7, ǫ(I) sat and ǫ1 (I) sat are equal, and thus (3.6) implies Σ1 (I) = (3.12) = j X k=0 j X  Hilb I   d+1−k  Hilb ǫ1 (I) sat k=0  sat sat   = j X Hilb I k=0 d+1−k  sat  d+1−k ≤ j X k=0  Hilb ǫ(I) sat  d+1−k = Σ1 (ǫ1 (I)),  for Hilb I sat ≤ Hilb ǫ(I) sat descends easily from the fact that (R, S, ǫ) is cohomology extremal considering cohomological degree 0. Since Σ2 (I) ≥ Σ2 (ǫ1 (I)) by Lemma 3.10, (3.12) now implies  Hilb Hm1 R[Z] (R[Z]/I)  d−j = Σ1 (I) − Σ2 (I)  ≤ Σ1 (ǫ1 (I)) − Σ2 (ǫ1 (I))) = Hilb Hm1 S[Z] (S[Z]/ǫ1 (I))  d−j and this case is completed. P tj a series with positive coefficients, we are left to prove i > 1 By (3.9) and being j<0    sat i sat i the inequality Hilb HmR (R/I ) ≤ Hilb HmS (S/ǫ1 (I) ) for all i > 0, or its equivalent       Hilb Hmi R (R/I) ≤ Hilb Hmi S (S/ǫ1 (I)) for i > 0. By hypothesis, Hilb Hmi R (R/I) ≤   Hilb Hmi S (S/ǫ(I)) for all i > 0, thus we may conclude if we know, and we do by Lemma 2.7, that ǫ(I) and ǫ1 (I) have the same saturation. Now the proof of the theorem is complete.  THE LEX-PLUS-POWER INEQUALITY FOR LOCAL COHOMOLOGY MODULES 11 4. A Lex-Plus-Power-type inequality for local cohomology Let A = B = K[X1 , . . . , Xn ], let a = (f ) = (f1 , . . . , fr ) be the ideal of A generated by a homogeneous regular sequence f1 , . . . , fr of degrees d1 ≤ · · · ≤ dr , and let b ⊆ B be the ideal (X1d1 , . . . , Xrdr ). As before, we let R = A/a and S = B/b and recall that, by ClementsLindström Theorem, S has an embedding whose image set consists of the classes in S of all lex-segment ideals of B. Henceforth, such an embedding will be denoted by ǫCL . Thus, we may restate EGH in the following way. Conjecture 4.1 (Eisenbud-Green-Harris). Let f be as above. Then, R embeds into (S, ǫCL ). At the moment there are few cases for which a proof of this conjecture is known, and are essentially contained in [ClLi], [CaMa], [Ch] and [Ab]. Yet, Evans wondered if the following far-reaching result on graded Betti numbers holds. Conjecture 4.2 (Evans’ LPP). Assume that f satisfies EGH. Then, for all homogeneous ideal I of R and all i  βijA (R/I) := Hilb TorA i (R/I, K)  j  ≤ Hilb TorB i (S/ǫCL (I), K)  j =: βijB (S/ǫCL (I)). Remark 4.3. Consistently with our definition of cohomology extremal embeddings, we will call an embedding (R, S, ǫ) satisfying the inequality predicted by the LPP conjecture above, Betti extremal. With this terminology, Theorem 3.1 of [CaKu2] together with the subsequent discussion imply that, when (R, S, ǫ) is Betti extremal, (R[Z], S[Z], ǫ1) is Betti extremal as well. The only case in which LPP is known so far is when f is monomial, see [MePeSt] for a proof when d1 = · · · = dr = 2 and [MeMu] for a proof without restrictions on the degrees. The purpose of this section is to prove in Theorem 4.4 an analogous of the LPP conjecture when we consider local cohomology modules instead of Tor modules. Theorem 4.4 holds not only when f is monomial but also in all the cases for which EGH is known. More precisely, our assumption is to require that at least an Artinian reduction of A/(f ) satisfies EGH. Let l1 , . . . , ln−r be a sequence of linear forms such that f , l1 , . . . , ln−r form an A-regular sequence, which always exists provided that K is infinite. After applying a coordinates change we may assume these linear forms to be Xn , . . . , Xr+1 . Let f ∈ A = K[X1 , . . . , Xr ] be the image of f modulo Xn , . . . , Xr+1. We also let B = A and b be the image of b in B. Finally, ǫCL will denote the Clements-Lindström embedding of B/b. Theorem 4.4. Assume that f satisfies EGH. Then, for all homogeneous ideal I of R.     Hilb Hmi R (R/I) ≤ Hilb Hmi S (S/ǫCL (I)) . In other words, (R, S, ǫCL (I)) is cohomology extremal. Proof. Let I be a homogeneous ideal of R and let J denote its pre-image in A. Clearly, (f ) ⊆ J and, if we let ω be the weight vector with entries ωi = 1 for all i ≤ r and 0 otherwise, then f ∈ P := inω (J).  A/(f ) embeds into (B/b, ǫCL ), and more By hypothesis over being both rings Artinian A/(f), B/b, ǫCL is trivially cohomology extremal. Theorem 3.1 now yields that (A/(f )A, S, ǫ) is also cohomology extremal and ǫ, which is obtained 12 GIULIO CAVIGLIA AND ENRICO SBARRA by extending ǫCL , is precisely the Clements-Lindström embedding ǫCL of S, cf. Example 2.1 part (ii). By Base Independence of local cohomology and by [Sb] Theorem 2.4,      Hilb Hmi R (R/I) = Hilb Hmi A (A/J) ≤ Hilb Hmi A/(f )A (A/P ) . Finally, since I has the   same Hilbert function as the image of P in A/(f)A and A/(f )A, S, ǫCL is cohomology extremal, we have Hilb  (A/P ) Hmi A/(f)A    ≤ Hilb Hmi S (S/ǫCL (I))) as desired.  Remark 4.5. Clearly, if EGH were true in general then the assumption on f in Theorem 4.4 would be trivially satisfied and (R, S, ǫCL ) would be cohomology extremal. It is proven in [CaMa] that if f satisfies EGH then f does, whereas at this point we do not know about the converse. A simple flat deformation argument together with the results of [MeMu] and [MePeSt] shows that LPP holds true when f is a Gröbner basis with respect to some given term order τ . We would like to point out that, under this assumption, the conclusion of Theorem 4.4 holds as well, and we prove our claim in the following lines. Let g = inτ (f1 ), . . . , inτ (fr ). As 4.4, by [Sb] Theorem 2.4 it is sufficient  in the proof of Theorem  i to bound above Hilb HmA/(g) (A/ inτ ((f ) + I)) . By hypothesis g form a monomial regular sequence in A, therefore it is easy to see that there are linear forms l1 , . . . , ln−r such that A/(g, l1 , . . . , ln−r ) is Artinian and isomorphic to K[X1 , . . . , Xr ]/(X1d1 , . . . , Xrdr ), which has the Clements-Lindström embedding. Therefore, the sequence g in A/(l1 , . . . , ln−r ) satisfies EGH, and thus, verifies the hypothesis of Theorem 4.4, which now yields what we wanted. 5. Extremal Betti numbers and LPP In this section we show how to derive directly from Theorem 4.4 a special case of LPP for Betti numbers. Precisely, we prove that the inequality predicted by LPP holds for those Betti numbers which in the literature, following [BaChPo], are called extremal. Furthermore, we will show an inclusion between the regions of the Betti tables of R/I and S/ǫCL where non-zero values may appear, and which are outlined by the positions of the corresponding extremal Betti numbers. As in the previous section, let f ∈ A = K[X1 , . . . , Xn ] be a homogeneous regular sequence of degrees d1 ≤ · · · ≤ dr . By extending the field we may assume that |K| = ∞ and up to a change of coordinates, that f , Xn , . . . , Xn−r+1 form a regular sequence as well. Let M be a finitely generated graded A-module; the following definition was introduced in [BaChPo] when M = A/I. A non-zero βijA (M) = dimK TorA i (M, K)j such that βrs (M) = 0 whenever r ≥ i, s ≥ j + 1 and s − r ≥ j − i is called extremal Betti number of M. A pair of indexes (i, j −i) such that βij (M) is extremal is called a corner of M. The reason for this terminology is that extremal Betti numbers correspond to certain corners in the output of Macaulay2 [M2] command for computing Betti diagrams. Let I be a homogeneous ideal of A and denote by Gin(I) the generic initial ideal of I with respect to the reverse lexicographic order, cf. [Gr2] and [Ei] for more details on generic initial ideals. The interest in extremal Betti numbers comes from the fact, proved in [BaChPo] and [Tr], that A/I and A/ Gin(I) have the same extremal Betti numbers, and therefore same corners. Since projective dimension and Castelnuovo-Mumford regularity can be computed from corners, this result is a strengthening of the well-known Bayer-Stillman Criterion [BaSt]. In the proof, one can use the fact that THE LEX-PLUS-POWER INEQUALITY FOR LOCAL COHOMOLOGY MODULES 13 the extremal Betti numbers of M can be computed directly from the Hilbert functions of certain local cohomology modules, and in particular from the considerations in [BaChPo] or [Tr] one can deduce that, for any finitely generated graded A-module M (5.1)  βijA (M) = Hilb Hmn−i (M) A  j−n , when (i, j − i) is a corner of M. For the proof of the next theorem, we need to recall the definition of partial CastelnuovoMumford regularities and its characterization: Given a finitely generated A-module M, for any integer 0 ≤ h ≤ dim M, we have regh (M) := sup{j − i : βijA (M) 6= 0, i ≥ n − h} = sup{j + i : (Hmi A (M))j 6= 0, i ≤ h}, see [Tr] Theorem 3.1 (i). If we set reg−1 (M) = −∞, clearly we have reg−1 (M) ≤ reg0 (M) ≤ reg1 (M) ≤ · · · ≤ regn (M) = reg(M). Moreover, the corners of the Betti table of M can be determined by looking at the strict inequalities in the previous sequence: (i, j − i) is a corner of M if and only if (5.2) regn−i−1 (M) < regn−i (M) and j − i = regn−i(M); in particular (5.3) regh (M) = sup{j − i : (i, j − i) is a corner of M and i ≥ n − h}. Theorem 5.4 (LPP for extremal Betti numbers). Let f satisfy EGH. Then, for all homogeneous ideals I of R, βijA (R/I) ≤ βijA (S/ǫCL (I)), when (i, j − i) is a corner of S/ǫCL (I). Proof. If n = 1 there is nothing to prove. Thus, let n ≥ 2 and observe that, if (i, j − i) is also a corner of R/I then the conclusion is straightforward by the use of Theorem 4.4 and (5.1). Otherwise, since Theorem 4.4 yields regh (R/I) ≤ regh (S/ǫCL (I)) for all h, then regn−i (R/I) < regn−i (S/ǫCL (I)) = j − i. Hence βijA (R/I) = 0.  Furthermore, under the same assumption of the above theorem, we have the following result, see also Figure 1. i j−i j’−i’ i’ βij(R/I) βij’’ (S/εCL(I)) Figure 1. The Betti diagrams of R/I and S/ǫCL (I)), and their extremal Betti numbers. 14 GIULIO CAVIGLIA AND ENRICO SBARRA Theorem 5.5 (Inclusion of Betti regions). Let (i, j − i) be a corner of R/I. Then there exists a corner (i′ , j ′ − i′ ) of S/ǫCL (I)) such that i ≤ i′ and j − i ≤ j ′ − i′ . Proof. Theorem 4.4 implies that regh (R/I) ≤ regh (S/ǫCL (I)) for all h. Since (i, j − i) is a corner of R/I, by (5.2) regn−i(R/I) = j − i and, therefore, regn−i (S/ǫCL (I)) ≥ j − i. By (5.3) we know that regn−i (S/ǫCL (I)) = j ′ − i′ for some corner (i′ , j ′ − i′ ) of S/ǫCL (I) satisfying i′ ≥ n − (n − i) = i, as we desired.  References [Ab] A. Abedelfatah. “On the Eisenbud-Green-Harris Conjecture”. arXiv:1212.2653v1 [math.AC]. [ArHeHi1] A. Aramova, J. Herzog, T. Hibi. “Ideals with stable Betti numbers”. Adv. Math. 152 (2000), no. 1, 72-77. [ArHeHi2] A. Aramova, J. Herzog, T. Hibi. “Shifting operations and graded Betti numbers”. J. Algebraic Combin. 12 (2000), no. 3, 207-222. [BaChPo] D. Bayer, H. Charalambous, S. Popescu. “Extremal Betti numbers and applications to monomial ideals”. J. Algebra 221 (1999), no. 2, 497-512. [BaSt] D. Bayer, M. Stillman. “A criterion for detecting m-regularity”. Invent. Math. 87 (1987), no. 1, 1-11. [Bi] A. M. Bigatti. “Upper bounds for the Betti numbers of a given Hilbert function”. Comm. Algebra 21 (1993), no. 7, 2317-2334 [BiCoRo] A. M. Bigatti, A. Conca, R. Robbiano. “Generic initial ideals and distractions”. Comm. Algebra 33 (2005), no. 6, 1709-1732. [BrHe] W. Bruns, J. Herzog. Cohen-Macaulay rings. Revised edition Cambridge University Press, Cambridge, 1998. [BrSh] M. Brodmann, R. Sharp. Local Cohomology. Cambridge University Press, Cambridge, 1998. [CaKu1] G. Caviglia, M. Kummini. “Poset embeddings of Hilbert functions”. Math Z. (2012), doi: 10.1007/s00209-012-1097-6. [CaKu2] G. Caviglia, M. Kummini. “Embeddings of Hilbert functions and Betti numbers”. arXiv:1210.5562v1 [math.AC]. [CaMa] G. Caviglia, D. Maclagan. “Some cases of the Eisenbud-Green-Harris conjecture”. Math. Res. Lett. 15 (2008), no. 3, 427-433. [Ch] R. Chen. “Hilbert Functions and Free Resolutions”. Ph.D. Thesis, Cornell 2011. [ClLi] G. F. Clements, B. Lindström. “A generalization of a combinatorial theorem of Macaulay”. J. Combinatorial Theory 7 (1969), 230-238. [Ei] D. Eisenbud. Commutative algebra with a view towards algebraic geometry. Springer Verlag, New York, 1995. [EiGrHa1] D. Eisenbud, M. Green, and J. Harris. “Higher Castelnuovo theory”, in Journées de Géométrie Algébrique d’Orsay (Orsay, 1992). Astérisque (1993), no. 218, 187-202. [EiGrHa2] D. Eisenbud, M. Green, and J. Harris. “Cayley-Bacharach theorems and conjectures”. Bull. Amer. Math. Soc. 33 (1996), no. 3, 295-324. [Fr] C. A. Francisco. “Almost complete intersections and the lex-plus-powers conjecture”. J. Algebra 276 (2004), no. 2, 737-760. [FrRi] C. A. Francisco, B. P. Richert. “Lex-plus-power ideals”, in Syzygies and Hilbert functions, 113-144, Lect. Notes Pure Appl. Math., 254, Chapman & Hall/CRC, Boca Raton, FL, 2007. [Ga] V. Gasharov. “Hilbert functions and homogeneous generic forms II”. Compositio Math. 116 (1999), no. 2, 167-172. [GaPeMu] V. Gasharov, I. Peeva, S. Murai. “Hilbert schemes and maximal Betti numbers over Veronese rings” Math. Z., 267 (2011), no. 1-2, 155-172. [Gr] M. Green. “Restrictions of linear series to hyperplanes, and some results of Macaulay and Gotzmann”, in Algebraic curves and projective geometry (Trento, 1988). Lecture Notes in Math., 1389, 76-86, Springer, Berlin, 1989. THE LEX-PLUS-POWER INEQUALITY FOR LOCAL COHOMOLOGY MODULES 15 [Gr2] M. Green. “Generic initial ideals”, in Six lectures on Commutative Algebra (J. Elias et. al. eds), 119-186 (2010), Birkhäuser Verlag AG, Basel, 2010. [HePo] J. Herzog, D. Popescu. “Hilbert functions and generic forms”. Compositio Math. 113 (1998), no. 1, 1-22. [HeSb] J. Herzog, E. Sbarra. “Sequentially Cohen-Macaulay modules and local cohomology”, in Algebra, arithmetic and geometry, Part I, II (Mumbai, 2000) Tata Inst. Fund. Res., Bombay (2002), 327-340. [Hu] H. A. Hulett. “Maximum Betti numbers of homogeneous ideals with a given Hilbert function”. Comm. Algebra 21 (1993), no. 7, 2335-2350. [Ka] G. Katona. “A theorem for finite sets”, in Theory of Graphs (P. Erdös and G. Katona, eds), Academic Press, New York (1968), 187-207. [Kr] J. Kruskal. “The number of simplices in a complex”, em in Mathematical Optimization Techniques (R. Bellman, ed), University of California Press, Berkeley (1963), 251-278. [Ma] F. Macaulay. “Some properties of enumeration in the theory of modular systems”. Proc. London Math. Soc. 26 (1927), no. 1, 531-555. [M2] D. R. Gruson, M. Stillman. Macaulay 2, a software system for research in algebraic geometry (2006). Available at http://www.math.uiuc.edu/Macaulay2/. [MeMu] J. Mermin, S. Murai. “The Lex-Plus-Powers Conjecture holds for pure powers”. Adv. Math. 226 (2011), no. 4, 3511-3539. [MePe] J. Mermin, I. Peeva. “Lexifying ideals”. Math. Res. Lett. 13 (2006), no 2-3, 409-422. [MePeSt] J. Mermin, I. Peeva, M. Stillman. “Ideals containing the squares of the variables”. Adv. Math. 217 (2008), no. 5, 2206-2230. [Pa] K. Pardue. “Deformation classes of graded modules and maximal Betti numbers”. Illinois J. Math. 40 (1996), no. 4, 564-585. [Pe] I. Petrakiev. “On zero-dimensional schemes with special Hilbert functions”. Ph.D. Thesis, Harvard, 2006. [PeSt] I. Peeva, M. Stillman. “Open problems on syzygies and Hilbert functions”, available online at: http://www.math.cornell.edu/~ irena/papers/overview.pdf. J. Commut. Algebra, 1 (2009), no. 1, 159195. [Ri] B. P. Richert. “A Study of the Lex Plus Powers Conjecture”. J. Pure Appl. Algebra, 186 (2004), no. 2, 169-183. [RiSa] B. P. Richert, S. Sabourin. “The residuals of lex plus powers ideals and the Eisenbud-Green-Harris conjecture”. Illinois J. Math., 52 (2008), no. 4, 1355-1384. [Sb] E. Sbarra. “Upper bounds for local cohomology for rings with given Hilbert function”. Comm. Algebra, 29 (2001), no. 12, 5383-5409. [Sb2] E. Sbarra. “Ideals with maximal local cohomology”. Rend. Sem. Mat. Univ. Padova, 111 (2004), 265275. [Tr] N. V. Trung. “Gröbner bases, local cohomology and reduction number”. Proc. Amer. Math. Soc., 129 (2001), no. 1, 9-18. Giulio Caviglia - Department of Mathematics - Purdue University - 150 N. University Street, West Lafayette - IN 47907-2067 - USA E-mail address: [email protected] Enrico Sbarra - Dipartimento di Matematica - Università degli Studi di Pisa -Largo Bruno Pontecorvo 5 - 56127 Pisa - Italy E-mail address: [email protected]
0math.AC
A Historical Review of Forty Years of Research on CMAC Frank Z. Xing arXiv:1702.02277v1 [cs.NE] 8 Feb 2017 School of Computer Science and Engineering Nanyang Technological University [email protected] Abstract— The Cerebellar Model Articulation Controller (CMAC) is an influential brain-inspired computing model in many relevant fields. Since its inception in the 1970s, the model has been intensively studied and many variants of the prototype, such as KCMAC, MCMAC, and LCMAC, have been proposed. This review article focus on how the CMAC model is gradually developed and refined to meet the demand of fast, adaptive, and robust control. Two perspective, CMAC as a neural network and CMAC as a table look-up technique are presented. Three aspects of the model: the architecture, learning algorithms and applications are discussed. In the end, some potential future research directions on this model are suggested. I. INTRODUCTION The Cerebellar Model Articulation Controller (CMAC) was proposed by J. S. Albus in 1975 [2]. Parallel at this time in the history, the concept of perceptron [23] had already been popular, whereas effective learning schemes to tune perceptrons [24] were not on the stage yet. In 1969, Minsky and Papert also pointed out the limitations that the exclusive disjunction logic cannot be solved by the perceptron model in their book Perceptrons: An Introduction to Computational Geometry. These facts made it less promising to consider CMAC as a neural network form. Consequently, although the name of CMAC appears bio-inspired enough, and the theory that the cerebellum is analogous to a perceptron has been proposed earlier [1], CMAC was emphasized to be understood as a table referring technique that can adaptive to real-time control system. Nevertheless, the underlying bioscience mechanism was addressed again in 1979 by Albus [3], which always gives the CMAC model two different ways of interpretation. The structure of CMAC was originally described as two inter-layer mappings illustrated in Fig. 1. The control functions are represented in the weighted look-up table, rather than by solution of analytic equations or by analog [2]. If we use S to denote sensory input vectors, and let A and P stand for association cells and response output vectors respectively, both CMAC and multilayer percptrons (MLP) model can be formalized as:  f :S→A g:A→P the final output can be calculated as: y = ∑ A∗i wi where the asterisk denotes a link or activation between certain association cell and the output. The nuance between Fig. 1. The primary CMAC structure MLP and CMAC model is that, for mapping f , MLP model is fully connected but CMAC restricts the association in a certain neighboring range. This property of mapping significantly accelerates the learning process of CMAC, which is considered a main advantage of it comparing to other neural network models. It is notable that CMAC may not represent accurately how the human cerebellum works, even at a most simplified level. For instance, recent biological evidence from eyelid conditioning experiments suggests that the cerebellum is capable of computing exclusive disjunction [34]. However, CMAC is still an important computational model, because the restriction on mapping function effectively decreased the chance of been trapped in a local minimum during learning process. Despite the advantage aforementioned, CMAC has the following disadvantages as well [25]: • many more weight parameters are needed comparing to normal MLP model • local generalization mechanism may cause some training data to be incorrectly interpolated, especially when data is sparse considering the size of CMAC • CMAC is a discrete model, analytical derivatives do not exist As a response to these problems, modified or high order CMAC, storage space compressing, and fast convergent learning algorithms are continuously studied. These discov- eries will be elaborated in the following sections. Recent advances in Big Data and computing power seem to have watered down these problems. But in many physical scenarios, the computing power are still restricted and high speed responses are required. This serves for the reason to further study CMAC-like models, though it has been in and out of fashion for several times. Although there has been few other pioneer review works on CMAC, for instance by Mohajeri et al. in 2009 [20], this article is inventive for its chronological perspective. rather than emphasizing on detailed techniques. The remainder of the article is organized as follows: Section II provides the evolution trajectory of CMAC structure and efficient storage techniques. Section III discusses the learning algorithms. Section IV presents various circumstances that CMAC model has been applied. Section V summarizes the paper, and instigates discussions about potential improvements that can be made on CMAC model. Fig. 3. Albus’ model [1] of cerebellum resembles a forward feed perceptron. It assumes climbing fiber activity would cause parallel fiber synapses to be weakened. S stands for stellate b cells, B stands for basket cells II. ARCHITECTURE A. Basic Architectures Before the CMAC was proposed in the 1970s, the anatomy and physiology of cerebellum has been studied for a long time. It is widely agreed that many different type of nerve cells are involved in cerebellar functioning. Fig. 2 shows the computational model proposed by Mauk and Donegan [18]. A more simple and implementable model proposed by Albus [3] is exhibited in Fig. 3. If we use A to represent the actual memory (Association Cells), M is the conceptual memory to encode S. Then the conceptual mapping f is more sparse and constrained within a certain range, but mapping g could be random.   f :S→M g:M→A  h:A→P When it comes to implementation, the connectivism perspective to recognize CMAC as a neural network and the table referring perspective are equivalent. Fig. 5 illustrates the difference at a conceptual level [25]. To the upper part is a two input one output neural network structure, to the lower part is a two input one output table look-up structure. An intuitive observation from both Fig. 4 and Fig. 5 is that the number of weights will increase exponentially with the number of input variables. This problem brings out two challenges: 1) The storage of weights become space consuming; 2) The training process becomes difficult to converge and waiting time before termination will lengthen. Fig. 2. Mauk’s model assumes complex interaction between different type of cells: open arrow stands for plastic synapses; filled circle arrow stands for inhibitory synapses; hollow square arrow stands for excitatory synapses. Based on the computational model of cerebellum (Fig. 3), the primary CMAC structure as shown in Fig. 1 is conceived. While it is obvious that high dimensional proximity of association rules cannot be captured in this primary form, because the nodes are arranged into one dimensional array. A simple solution to this problem is to introduce some nonlinearity to the first mapping. As a result, another layer called “conceptual memory” was soon added to the CMAC structure, which involves one additional mapping to the primary structure. The function of conceptual memory is illustrated in Fig. 4. Fig. 4. CMAC with conceptual memory B. Modified Architectures Since simply increasing the CMAC size gives diminishing returns, two directions of modification are undertaken to push forward the research on CMAC. The first consideration is to combine multiple low dimensional CMACs. The second consideration is to introduce other properties, for example spline neurons, fuzzy coding or cooperative PID controller. Cascade CMAC architecture was firstly proposed in 1997 for the purpose of printer calibration [10] (Fig. 6). Input variables are sequentially added to keep each of the CMAC component two dimensional. Fig. 6. Fig. 5. A conceptual level comparison of two different perspectives A previously used technique to solve the first challenge is called tile coding, which latter was developed to an adaptive version as well [36]. The advantage of tile coding is that we can strictly control the number of features through tile split. Another commonly employed trick is called hashing. This technique is applied to CMAC in the 1990s, and maps a large virtual space A to a smaller physical address A0 . Many common hashing function fh can be used, for instance from MD5 or DES, which are fundamental methods in cryptography. However, how to reduce the collision for specific problems according to the data property is still considered an art. Cascade CMAC architecture Another method to combine multiple CMACs can be realized by voting technique. If we regard the Cascade CMAC model as a fusion of input information at a feature level, then the voting CMACs can be reckoned as a fusion at decision level. Each small CMAC just accept a subset of the whole input space. In this case an important antecedent is that input data is well partitioned. The reason to this requirement is that voting lift can only be achieved by heterogeneous expert networks. Taken this into account, some prior knowledge of input data or unsupervised clustering techniques can be applied in this stage. If we make more efforts for dimension reduction, multiple levels of voting can be used. Then the architecture can be reckoned as a Hierarchical CMAC (H-CMAC), which is described by Tham [32] in 1996. H-CMAC has several advantages, such as less storage space and fast adaptation for learning non-linear functions. In Fig. 7, a two level HCMAC is illustrated. It is noticeable that each conventional CMAC components in different layers plays different role. The gating network works at a higher level. Literature [25] introduced a hardware implementation which uses selected binary bits of indexes as the hashing code. Whereas other research, e. g. [35], claims that due to the learning rate diminishing and slower convergence, hashing is not effective for enhancing the capability of approximation by CMAC. Therefore, many other attempts have been made, such as neighbor sequential, CMAC with general basis functions, and adaptive coding [7], which is a similar idea to hashing in the sense of weight space compression. Fig. 7. Hierarchical CMAC architecture, adapted from [32] These architectures can be employed at the same time with more fundamental modifications for the second consideration. In 1992, Lane et al. [11] descried high order CMAC as CMAC with binary neuron output replaced by spline functions. This modification brings about more parameters of splines, but makes the output derivable, which sometimes gives a better performance because the learning phase goes deeper. Sharing the idea to allow more meticulous transfer function, a similar modification can be made by introducing linguistic rules and fuzzy logic. Linguistic CMAC (LCMAC) was proposed by He and Lawry based on label semantics, rather than mapping functions in 2009. A cascade of LCMAC series was further developed in 2015 [8]. Borrowing the terminology of “focal element” from evidence theory, the properties used to activate it is represented as membership function (usually trapezoidal) of several attributes. Therefore, for each input tuple, the excited neurons form a hypercube in the matrix of all the weights as memory. The responsive output can be distributionally depicted as: N P(a|x) = ∏ mxd (Fdi ) d=1 where P is the probability of some memory unit a been activated given the input vector x. F denotes focal element. di is the index of linguistic attributes. m is the hidden weights for F called “mass assignment”. Fuzzy CMAC (FCMAC) is yet another form of fuzzy coding. The intuition to use fuzzy representation is similar to using spline function. For most well defined problems, the nature of CMAC approximation is using multiple steps to emulate a smooth surface. Proper selection of fuzzy membership function would obviously relief the pressure of weight storage and training. From my understanding, FCMAC is an inverse structure of many established NeuroFuzzy Inference Systems. Usually, two extra fuzzy/defuzzy layers are added next to the association layer, the consequents can be Mamdani type, TSK type, weights, or a hybrid of them, e. g. Parametric-FCMAC (PFCMAC) [21]. More advanced FCMAC models, maybe inspired by spline methods, use interpolation to solve the discrete inference problem. In 2015, Zhou and Quek proposed FIE-FCMAC [39], which adds fuzzy interpolation and extrapolation to a rigid CMAC structure. Recently, CMAC applications to more specific scenarios are studied. For example, for control of time-varying nonlinear system, a combination of Radial Basis Function network and the local learning feature of CMAC is proposed (RBFCMAC). It is reported that using RBFs can prevent parameter drift and accelerate synchronization speed to the changing system [17]. For this type of combination, beside RBF, Wavelet Neural Network (WNN), fuzzy rule neuron and recurrent mechanism [15] or a mingle of them can also be employed with CMAC model simultaneously. Previous works, such as [38], have provided evidence that these features are effective for modeling complicated dynamic systems. In a broader scenario, CMAC can be applied with other control systems as well (Fig. 8). Traditionally, the role of CMAC at the primary stage is to assist the output of a main controller. As the training proceed, error between CMAC and the actual model decays. CMAC takes charge of the main controller. Back-forward signal acceptor or conjugated CMACs are often used to accelerate this process [13]. More precisely, this arrangement is a change of information flow but not a change of architecture. Fig. 8. A combined control system of CMAC and PID Similarly, CMAC structures that modifies the storage optimizing methods, for example quantization [16] and multiresolution [19], will only result in architectural difference from a hardware implementation sense. According to my personal understanding, they are the same thing regarding the conceptual structure, though these techniques are of sufficient interests to be discussed in Section III. III. LEARNING ALGORITHM The original form of learning proposed Albus is based on backward propagation of errors. The fast convergence of this algorithm is proved mathematically by succeeding researches. Specifically, the convergence rate is only governed by the size of receptive fields for association cells [37]. Some study [25] suggests that it would be useful to distinguish between target training and error training, despite they share the same mathematical form. In the weights updating rule, wi (k + 1) = wi (k) + α Error xi count(A∗ ) k is the epoch times, α ∈ [0, 1] is the learning rate, xi is a state indicator of activation. The learning process is theoretically faster with a larger α, while overshooting may occur. If the difference between output and the desired value ∆y = y − ŷ can well define the error, target training and error training will be equivalent. In certain cases, 1 (y − ŷ)2 2c is a popular cost function as well. Based on the original learning algorithm, many developments are further derived. Most of them can be categorized into two directions of improvement. The first relies on extra supervisory signals or value assignment mechanism based on statistics. The second endeavors to optimize the use of memory. From a more practical sense, the dichotomy can be understood as learning to adjust value of weights, and learning to adjust number or size of weights. Error = A. Adjusting value of weights Facing the trade off between speed of convergence and learning stability, it is intuitive to consider using a relatively large α at the beginning, and slow down the weight adjustment near the optimum point. This improvement is called adaptive learning rate [14]. It can be achieved by using two CMAC components, one as main controller, another as supervisory controller or compensated controller. Another way to achieve this adaption is by imposing a resistant term to the weight updating rule: wi (k + 1) = wi (k) + α0 Error xi cαi count(A∗ ) In the above rule, α0 and c are constants, αi denotes the average activation times of the memory units that have been activated by training sample i. For both fixed learning rate and adaptive learning rate, weights adjustment start from a randomized set of parameters. Experiments suggest that for sparse data, even if the training samples are within the local generalization range, perfect linear interpolation may not be achieved [25]. As a result, the approximation may appears to have many small zigzag patterns. Therefore, the weight smoothing technique is proposed. After each iteration, the weights are globally adjusted according to: ∗ wi (A∗j ) = (1 − δ ) wi (A∗j ) + count(A ) δ ∑ wi (A∗k ) ∗ count(A ) k=1 variables x = {x1 , x2 , ..., xn }, the output can directly be the weight of the winning neuron. The weights updating rule can be formalized according to Hebbian theory: wx (k + 1) = wx (k) + α (y(k) − wx (k)) Note that the index of x can be time dependent. A modified version of the aforementioned rule involves not only inputs, but also errors as feedback: wx ,ee (k + 1) = wx ,ee (k) + α (y(k) − wx ,ee (k)) Using this learning mechanism, the SOFM-like CMAC is named MCMAC. In 2000, Ang and Quek [5] proposed learning with momentum, neighborhood, and averaged fuzzy output for both CMAC and MCMAC. For CMAC and MCMAC with momentum, the weights updating rules can be written as:  ∆w j (k + 1) = α ∆w j (k) + η δ j (k)y j (k) ∆wx ,ee (k + 1) = α ∆wx ,ee (k) + λ (1 − α)[y(k) − wx ,ee (k)] where the first term represents a momentum, the second term is a back propagation term with learning rate η and local gradient δ j . j is the index for activated weights. Therefore, given a sequential learning process, the aggregational weights adjustment can be derived from the above rules: k ∆w j (k + 1) = η i=1 k where δ is the proportional coefficient measuring the share of the weight with index j that needs to be replaced by the average of all activated weights A∗ . While the weight smoothing technique tries to affect as much memory as possible in one iteration, repeated activation of the same units may not be a good thing. In 2003, research [26] pointed out that equally assign the error to each weight is not a meticulous method. During the learning process, if an associative memory is activated many times, which means many relevant samples are already learned, the weight should be more close to the desired value. In other words, the weight value is more “credible”. In this situation, less error should be assigned to it so that other memory units can learn faster. This rule is called learning based on credit assignment: wi (k + 1) = wi (k) + α f (i)−1 g ∑ f (i)−1 g (y − ∑ wi (k)) xi i=1 i=1 where g is a parameter regarding the degree of local generalization, f (i) records the times memory unit i has been activated. Further research has proved that the convergence is guaranteed with learning rate α < 2. The hardware implementation of CMAC memory enables other interpretations of the associative architecture. If we recognize it as a self-organizing feature map (SOFM), competitive learning algorithm can be realized. With input ∑ α k−1 δ j (i)y j (i) = −η ∂ Error ∑ α k−1 ∂ w j (k) i=1 ∂ Error ∂wj When the sign of keeps unchanged, ∆w j is accelerating; while if the sign is reversing, ∆w j will slow down to stabilize the learning process. The neighborhood learning rule proposed by Ang and Quek [5] serves the same purpose as weight smoothing technique. However, they used the Gaussian function to put more attention to those neurons surrounding the winning neuron instead of evenly adjusting each weight regardless of the distance. Weights updating rule for MCMAC with momentum and neighborhood in singular form is: ∆wi (k + 1) = α ∆wi (k) + hi j [λ (1 − α)(y(k) − wi (k))] where  |r − r |2  j i hi j = exp − 2σ 2 is the distance metric between neuron j and the winning neuron i. Beside using additional terms such as momentum and neighborhood, kernel method can also be applied to CMAC learning. In 2007, Kernel CMAC (KCMAC) was proposed [9], [11] to reduce the CMAC dimension which usually hazard the training speed and convergence. KCMAC treats the association memory as the feature space of a kernel machine, thus weights can be determined by solving an optimization problem. The supervised learning using error e as slack variables is to achieve: β n 1 T w w + ∑ e 2i w ,ee 2 2 i=1 β s.t. w T φ (ui ) + e i > 1, i = 1, 2, ..., n 2 where w denotes weights, coefficient β serves as penalty parameter, φ (·) is the mapping function and K(uu, w ) = φ (uu) · w) is the kernel function. φ (w The standard procedure to this problem is to solve the maxima-minima of Lagrangian function. Though other learning method can be employed as well, for instance, using Bayesian Ying-Yang (BYY) learning as proposed in 2013 by Tian et al [33]. The key idea behind BYY learning can be represented by harmonizing the joint probability with different product form of Bayesian components. In this specific KCMAC case, u and output z are observable, while w is a hidden variable. The joint distribution can either be written as ying form or yang form.  w)p(uu|w w)p(zz|uu, w ) pying (uu, z , w ) = p(w w|uu, z ) pyang (uu, z , w ) = p(uu)p(zz|uu)p(w min Our goal is to maximize H(pying , pyang ), H(pying , pyang ) = ZZZ w pying ln pyang duu dzz dw In practice, ∆H is frequently calculated depending on how the conditional probabilities are estimated and maximum of H is achieved by searching heuristically. B. Adjusting number of weights Adjusting number of weights is chiefly realized by introducing multi-resolution and dynamic quantization techniques. As Section I has explained, CMAC was firstly used for real time control system. Consequently, the structural design fits the hardware implementation well. Many CMAC variants, such as LCMAC and FCMAC, inherit the memory units division with a lattice-based manner. Inputs are generally built on grids with equal space. This characteristic adds local constraints to the value of adjacent units. If we consider this problem from a function approximation perspective, it is also rather intuitive that local complex shape needs a larger number of low-order elements to approach. Naturally, multi-resolution lattice techniques [19] were proposed in the 1990s. With our prior knowledge, some metrics can be used to determine the resolution, for example, the variation of output in certain memory unit areas, which can be formalized as following: resolution ∝ v = 1 N N ∑ |y j − ȳ| j=1 where N is the number of output samples, v is the variance. Other attempts use a tree structure to manage the resolution hierarchically. New high resolution lattice is generated only if the threshold of variance is exceeded. The concept of quantization is almost identical to resolution. The nuance may be that the terminology quantization puts more emphasis on the discretion of continuous signal. Furthermore, increasing resolution will also cause the number of weights to grow. Quantization deals with a given memory capacity problem. To the best of my knowledge, the idea of adaptive quantization was initially proposed in 2006 [16]. The algorithm used to interpolate points looks on change of slopes, which is also similar to the variance metric discussed above. The input space is initialized with uniform quantization. For each point xi , the slopes are calculated by neighbor points. ˆ j = f (x j ) − f (xi ) , j = 1, 2, 3... slope x j − xi Here f stands for the mapping function between input vector and association cells. The change of sign for corresponding directions indicates finer local structure, or fluctuation in other words, thus a new critical point is added to split the interval. The termination condition is that, within all intervals, the difference of output values should not exceed an experimental constant C [28]. The adaptive quantization technique is later developed to the Pseudo Self Evolving CMAC (PSECMAC) model [30], which further introduced neighborhood activation mechanism. IV. APPLICATION Though CMAC was firstly proposed for manipulator control, during the past decades it has been proved effective in robotic arm control, fractionator control, piezoelectric actuator control [22], mechanic system, signal processing, intelligent driver warning system, fuel injection, canal control automation, printer color reproduction, ATM cash demand [31], and many other fields [7]. This can be attributed to the fast learning and stable performance of CMAC models. Moreover, engineering-oriented software and toolkit also help to promote the application of CAMC. In the following part, CMAC application to two emerging engineering fields are elaborated. A. Financial Engineering The practice side of financial engineering has employed various instruments to model the price and risk of bond, stock, option, future and other derivatives. In most cases, historic data can be partitioned into chunks of selected time span to enable a supervised learning process. In 2008, Teddy et al [29] proposed an improved CMAC variant (PSECMAC) to model the price of currency exchange American call option. Three variables are taken into consideration: difference between strike price and current price, time of maturity, and pricing volatility. Thus the pricing function is formulated as: C0 = f (S0 − X, T, σ30 ) The article reported PSECMAC as the best-performing model among several CMAC-like systems. It is also reported that most of the CMAC models produce better result than using Black-Scholes model in sense of RMSE. Though for American option, Black-Scholes model is not a good benchmark because it is sensitive to details of calculation. This work further constructed an arbitrage system based on the pricing model. Positions are adjusted according to the Delta hedging ratio. Experiments suggested the model has a marginal positive ROI, omitting transaction costs. B. Adaptive Control The application of CMAC on commercial devices may be more advantageous. The pressure to reduce cost and demand of embedded controller make CMAC-like models a good choice. Recently, studies have been carried on adaptive control of disabled wheelchair and seatless unicycle [12]. This type of problems can be formalized as controlling a set of variables in certain range (e. g. speed and balance angle) with a set of unknown and varying variables (e. g. friction to the ground and weight of the rider). Li et al [12] proposed a TSK type FCMAC to synthesis the equations of adaptive steering control. The back-stepping error is associated with the torque τ, which can simultaneously effect on critical moments.  θ̈ = Ā(θ , θ̇ ) + B̄(θ )(τ − µ φ̇ − c sgn(φ̇ )) φ̈ = C̄(θ , θ̇ ) + D̄(θ )(τ − µ φ̇ − c sgn(φ̇ )) As the output adapting to the moment parameters, the balance angle is controlled near zero. The performance of FCMAC is benchmarked with a linear-quadratic regulator for differential equations to describe the state of the motor. Simulations suggest that LQR is not able to converge speed and angle of balance, while FCMAC provides satisfactory result. V. DISCUSSIONS Referring to Section IV, CMAC was proved to be effective in many classic control problem and has been applied to emerging engineering problems. However, this model seems have encountered a bottleneck because of the lack of fundamental breakthrough during the past decade. Nowadays, issues discussed are mainly focused on trivial modification on memory structure and learning algorithm. The framework of error propagation or minimization of loss function is kept unchanged. According to my understanding, the limitation of current CMAC models can be ascribe to its over simplification of the cerebellum structure. Therefore, the next generation cerebellar model may adopt new discoveries from neuroscience. For example, the associative memory cells may take different roles rather than been treated identically. In fact, anatomical models usually feature several types of elementary cerebellar processing units. Meanwhile, the theory of Spike Timing Dependent Plasticity (STDP) suggests that the learning process of firing neurons may be ordered [6]. This feature can introduce far more complexity to the current learning algorithm. R EFERENCES [1] J. S. Albus, “A Theory of Cerebellar Function,” Mathematical Biosciences, pp. 25-61, 1971. [2] J. S. Albus, “A New Approach to Manipulator Control: the Cerebellar Model Articulation Controller (CMAC),” Trans. ASME, Series G. Journal of Dynamic Systems, Measurement and Control, 97, pp. 220233, 1975. [3] J. S. Albus, “Mechanisms of Planning and Problem Solving in the Brain,” Mathematical Biosciences, 45, pp. 247-293, 1979. [4] P. C. E. An, W.T. Miller, and P.C. Parks, “Design Improvements in Associative Memories for Cerebellar Model Articulation Controllers,” in Proceedings of ICANN, pp. 1207-10, 1991. [5] K. K. Ang and C. Quek, “Improved MCMAC with momentum, neighborhood, and averaged trapezoidal output,” IEEE Transactions on Systems. Man and Cybernetics: PartB, 30(3), pp. 491-590, 2013. [6] N. Caporale and Y. Dan, “Spike TimingDependent Plasticity: A Hebbian Learning Rule,” Annual Review of Neuroscience, 31(1), pp. 25-46, 2008. [7] P. Duan and H. Shao, “CMAC Neural Network based Neural Computation and Neuro-control,” Information and Control (in Chinese), 28(3), 1999. [8] H. He, Z. Zhu, A. Tiwari, and A. Mills, “A Cascade of Linguistic CMAC Neural Networks for Decision Making,” in International Joint Conference on Neural Networks (IJCNN), 2015. [9] G. Horváth and T. Szabó, “Kernel CMAC with improved capability,” IEEE Transactions on Systems. Man and Cybernetics: PartB, 37(1), pp. 124–38, 2007. [10] K.-L. Huang, S.-C. Hsieh, and H.-C. Fu, “Cascade-CMAC neural network applications on the color scanner to printer calibration,” in International Conference on Neural Networks, 1997. [11] S. H. Lane, D. A. Handelman, and J. J. Gelfand, “Theory and development of higher-order CMAC neural networks,” IEEE Control Systems, April, pp. 23–30, 1992. [12] Y.-Y. Li, C.-C. Tsai, F.-C. Tai and H.-S. Yap, “Adaptive steering control using fuzzy CMAC for electric seatless unicycles,” IEEE International Conference on Control & Automation, pp. 556–561, 2014. [13] C. C. Lin and F. C. Chen, “On a new CMAC control scheme, and its comparisons with the PID controllers,” Proceedings of the American Control Conference, pp. 769–774, 2001. [14] C.-M. Lin and Y.-F. Peng, “Adaptive CMAC-based supervisory control for uncertain nonlinear systems,” IEEE Transactions on Systems, Man, and Cybernetics, Part B, 34(2), pp. 1248–60, 2004. [15] C.-M. Lin and H.-Y. Li, “Self-organizing adaptive wavelet CMAC backstepping control system design for nonlinear chaotic systems,” Nonlinear Analysis: Real World Applications, 14(1), pp. 206–223, 2013. [16] H.-C. Lu, M.-F. Yeh, and J.-C. Chang, “CMAC Study with Adaptive Quantization,” IEEE Intl. Conf. on Systems, Man, and Cybernetics, Taipei, pp. 2596–2601, 2006. [17] C. J. B. Macnab, “Using RBFs in a CMAC to prevent parameter drift in adaptive control,” Neurocomputing, pp. 45–52, 2016. [18] M. D. Mauk and N. H. Donegan, “A Model of Pavlovian Eyelid Conditioning Based on The Synaptic Organization of Cerebellum,” Learn. Mem., 3, pp. 130-158, 1997. [19] A. Menozzi and M.-Y. Chow, “On the training of a multi-resolution CMAC neural network,” in Proceedings of the IEEE International Symposium on Industrial Electronics, 1997. [20] K. Mohajeri, G. Pishehvar, and M. Seifi, “CMAC neural networks structures,” in IEEE International Symposium on Computational Intelligence in Robotics and Automation, 2009. [21] K. Mohajeri, M. Zakizadeh, B. Moaveni, and M. Teshnehlab, “Fuzzy CMAC structures,” in IEEE International Conference on Fuzzy Systems, 2009. [22] Y.-F. Peng, R.-J. Wai and C.-M. Lin, “Adaptive CMAC model reference control system for linear piezoelectric ceramic motor,” in IEEE International Symposium on Computational Intelligence in Robotics and Automation, 2003. [23] F. Rosenblatt, “Principles of Neurodynamics: Perceptrons and the Theory of Brain Mechanisms,” Spartan Books, Washington DC, 1961. [24] D. E. Rumelhart, G. E. Hinton, and R. J. Williams, “Learning Internal Representations by Error Propagation,” Nature, 323(9), 1986. [25] R. L. Smith, “Intelligent Motion Control with an Artificial Cerebellum,” PhD Thesis of The University of Auckland, New Zealand, Chapter 3, 1998. [26] S.-F. Su, T. Tao, and T.-H. Hung, “Credit assigned CMAC and its application to online learning robust controllers,” IEEE Transactions on Systems, Man, and Cybernetics, Part B (Cybernetics), 33(2), 2003. [27] R. S. Sutton, “Generalization in Reinforcement Learning: Successful Examples Using Sparse Coarse Coding,” Advances in Neural Information Processing Systems, pp. 1038–1044, MIT Press, 1996. [28] S. D. Teddy, E. M.-K. Lai, and C. Quek, “Hierarchically Clustered Adaptive Quantization CMAC and Its Learning Convergence,” IEEE TRANSACTIONS ON NEURAL NETWORKS, 18(6), 2007. [29] S. D. Teddy, C. Quek, and E. M.-K. Lai, “A cerebellar associative memory approach to option pricing and arbitrage trading,” Neurocomputing, 19(4), 2008. [30] S. D. Teddy, C. Quek, and E. M.-K. Lai, “PSECMAC: A Novel SelfOrganizing Multiresolution Associative Memory Architecture,” IEEE Trans. Neural Networks, 19(4), pp. 689–712, 2008. [31] S. D. Teddy and S. K. Ng, “Forecasting ATM cash demands using a local learning model of cerebellar associative memory network,” International Journal of Forecasting, 27(3), pp. 760–776, 2011. [32] C.-K. Tham, “A hierarchical CMAC architecture for context dependent function approximation,” in IEEE International Conference on Neural Networks, 1996. [33] K. Tian, B. Guo, G. Liu, I. Mitchell, D. Cheng, and W. Zhao, “KCMAC-BYY: Kernel CMAC using Bayesian YingYang learning,” Neurocomputing, 101, pp. 24-31, 2013. [34] H. Voicu, “The Cerebellum: An Incomplete Multilayer Perceptron?,” Neurocomputing, 72, pp. 592-599, 2008. [35] Z.-Q. Wang, J. L. Shiano, and M. Ginsberg, “Hash-coding in CMAC Neural Networks,” in IEEE International Conference on Neural Networks, Washington, pp. 1698-1703, 1996. [36] S. Whiteson, M. E. Taylor, and P. Stone “Adaptive Tile Coding for Value Function Approximation,” AI Technical Report AI-TR-07-339, University of Texas at Austin, 2007. [37] Y.-F. , “CMAC Learning is Governed by a Single Parameter,” in IEEE International Conference on Neural Networks, San Francisco, pp. 1439-43, 1993. [38] F. Z. Xing, E. Cambria and X. Zou, “Predicting Evolving Chaotic Time Series with Fuzzy Neural Networks,” in International Joint Conference on Neural Networks (IJCNN), 2017. [39] W. J. Zhou, D. L. Maskell and C. Quek, “FIE-FCMAC: A novel fuzzy cerebellum model articulation controller (FCMAC) using fuzzy interpolation and extrapolation technique,” in International Joint Conference on Neural Networks (IJCNN), 2015.
9cs.NE
1 Stochastic Channel Modeling for Diffusive Mobile Molecular Communication Systems Arman Ahmadzadeh, Student Member, IEEE, Vahid Jamali, Student Member, IEEE, and Robert Schober, Fellow, IEEE arXiv:1709.06785v1 [cs.IT] 20 Sep 2017 Abstract In this paper, we develop a mathematical framework for modeling time-variant stochastic channels in diffusive mobile molecular communication (MC) systems. In particular, we consider a diffusive mobile MC system consisting of a pair of transmitter and receiver nano-machines suspended in a fluid medium with a uniform bulk flow, where we assume that either the transmitter, or the receiver, or both are mobile and we model the mobility of the nano-machines by Brownian motion. The transmitter and receiver nano-machines exchange information via diffusive signaling molecules. Due to the random movements of the transmitter and receiver nano-machines, the statistics of the channel impulse response (CIR) change over time. In this paper, we introduce a statistical framework for characterization of the impulse response of time-variant MC channels. To this end, we derive closed-form expressions for the mean, the autocorrelation function, the cumulative distribution function (CDF), and the probability density function (PDF) of the time-variant CIR. Given the autocorrelation function, we define the coherence time of the time-variant MC channel as a metric for characterization of the variations of the impulse response. The derived CDF is employed for calculation of the outage probability of the system. We also show that under certain conditions, the PDF of the CIR can be accurately approximated by a Log-normal distribution. Given this approximation, we derive a simple model for outdated channel state information (CSI). Moreover, we derive an analytical expression for evaluation of the expected error probability of a simple detector for the considered MC system. In order to investigate the impact of CIR decorrelation over time, we compare the performances of a detector with perfect CSI knowledge and a detector with outdated CSI knowledge. The accuracy of the proposed analytical expressions is verified via particle-based simulation of the Brownian motion. I. I NTRODUCTION Future synthetic nano-networks are expected to facilitate new revolutionary applications in areas such as biological engineering, healthcare, and environmental engineering [2], [3]. Molecular communication (MC), where molecules are the carriers of information, is one of the most promising candidates for enabling reliable communication between nano-machines in such This work will be presented in part at IEEE GLOBECOM 2017 [1]. 2 future nano-networks due to its bio-compatibility, energy efficiency, and abundant use in natural biological systems. Some of the envisioned application areas for synthetic MC systems may require the deployment of mobile nano-machines. For instance, in targeted drug delivery and intracellular therapy applications, it is envisioned that mobile nano-machines carry drug molecules and release them at the desired site of application, see [2, Chapter 1]. As another example, in molecular imaging, a group of mobile bio-nano-machines such as viruses carry green fluorescent proteins (GFPs) to gather information about the environmental conditions from a large area inside a targeted body, see [2, Chapter 1]. For these applications, communication among the nano-machines is needed for efficient operation. In order to establish a reliable communication link between nano-machines, knowledge of the channel statistics is necessary [4]. However, for mobile nano-machines, these statistics change with time, which makes communication even more challenging. Thus, it is crucial to develop a mathematical framework for characterization of the stochastic behaviour of the channel. Stochastic channel models provide the basis for the design of new modulation, detection, and/or estimation schemes for mobile MC systems. In the MC literature, the problem of mobile MC has been considered in [5]–[13]. However, none of these previous works provided a stochastic framework for the modeling of time-variant channels. In particular, in [5]–[8] it is assumed that only the receiver node is mobile and the channel impulse response (CIR) either changes slowly over time, due to the slow movement of the receiver, as in [6], or it is fixed for a block of symbol intervals and may change slowly from one block to the next; see [7], [8]. In [9] and [10], a three-dimensional random walk model is adopted for modeling the mobility of nano-machines, where it is assumed that information is only exchanged upon the collision of two nano-machines. In particular, Förster resonance energy transfer and a neurospike communication model are considered for information exchange between two colliding nano-machines in [9] and [10], respectively. The authors of [11] proposed a leader-follower model for target detection applications in two-dimensional mobile MC systems. Langevin equations are used to describe the mobility of the nano-machines. There, it is assumed that the information molecules do not diffuse; the leader nano-machine releases signaling molecules that stick to the release site and form a path that the follower nano-machine follows. The mathematical modeling of this non-diffusion communication approach between leader and follower nano-machines is further analyzed in [12]. In the most recent work [13], a one-dimensional random walk model is adopted for modeling the mobility of a point source transmitter and a fully-absorbing point receiver, and the first hitting time distribution of the 3 released particles is evaluated. In our previous work [14], unlike [5]–[13], we have established the mathematical basis required for analyzing mobile MC systems. We have shown that by appropriately modifying the diffusion coefficient of the signaling molecules, the CIR of a mobile MC system can be obtained from the CIR of the same system with fixed transmitter and receiver. In this paper, we consider a three-dimensional diffusion model to characterize the movements of both transmitter and receiver nano-machines, where unlike [9]–[12], we assume that nanomachines exchange information via diffusive signaling molecules. Furthermore, unlike [14], we develop a stochastic framework for characterizing the time-variant CIR of the mobile MC system. To the best of the authors’ knowledge, a stochastic channel model for mobile MC systems has not been reported, yet. In particular, this paper makes the following contributions: 1) Expanding upon our preliminary work in [1], we establish a mathematical framework for the characterization of the time-variant CIR of mobile MC systems as a stochastic process, i.e., we introduce a stochastic channel model. 2) We derive closed-form analytical expressions for the first-order (mean) and second-order (autocorrelation function) moments of the time-variant CIR of mobile MC systems. Here, unlike our preliminary work [1], we also include the impact of flow. Equipped with the autocorrelation function of the CIR, we define the coherence time of the channel as the time during which the CIR does not substantially change. 3) We derive a closed-form expression for the cumulative distribution function (CDF) of the CIR. The derived CDF can be employed for calculation of the outage probability of the considered system. 4) We propose a simple model for modeling outdated CSI in mobile MC systems. To this end, we derive a closed-form expression for the probability density function (PDF) of the impulse response of the channel. Subsequently, we show that in a certain regime, the PDF can be accurately approximated by a Log-normal distribution. We quantify the approximation regime and based on the approximated PDF, we derive the proposed model for outdated CSI in mobile MC systems. 5) To evaluate the impact of the CIR decorrelation occurring in mobile MC systems on performance, we derive the expected bit error probability of a simple detector for perfect and outdated CSI knowledge, respectively. The rest of this paper is organized as follows. In Section II, we introduce the system model. In Section III, we develop the proposed stochastic channel model. In Section IV, we derive closed-form expressions for the mean, the autocorrelation function, the CDF, and the PDF of 4 Fig. 1. (a) Illustration of the considered system model, where the receiver and the transmitter are shown as gray and green spheres, respectively. Sample trajectories of the receiver and the transmitter are shown as blue solid arrows. (b) Example of CIR variation over time t. the time-variant CIR. Then, in Section V, we calculate the expected bit error probability of the considered system for detectors with perfect and outdated CIR knowledge, respectively. Simulation and analytical results are presented in Section VI, and conclusion are drawn in Section VII. II. S YSTEM M ODEL We consider an unbounded three-dimensional fluid environment with constant temperature and viscosity. The receiver is modeled as a passive observer, i.e., as a transparent sphere with radius arx that diffuses with constant diffusion coefficient Drx . Furthermore, we model the transmitter as another transparent sphere with radius atx that diffuses with constant diffusion coefficient Dtx . The transmitter employs type A molecules, which we also refer to as A molecules and also as information or signaling molecules, for conveying information to the receiver. We assume that the A molecules are released in the center of the transmitter and that they can leave the transmitter via free diffusion. In particular, we assume that each signaling molecule diffuses with constant diffusion coefficient D A and the diffusion processes of individual A molecules are independent of each other. Moreover, we assume that interfering A molecules are uniformly distributed in the environment and impair the reception. These noise molecules may originate from natural sources in the environment. Furthermore, we assume that there exists a uniform 5 flow in the environment, denoted by v® = [v x, v y, vz ], where v x , v y , and vz are the components of v® in the x, y, and z directions of a Cartesian coordinate system, respectively. Due to the Brownian motion and flow, the positions of the transmitter and the receiver change over time. In particular, we denote the time-varying positions of the transmitter and the receiver at time t by r®tx (t) and r®rx (t), respectively. Then, we define vector r®(t) = r®rx (t)−® rtx (t) and denote its magnitude at time t as r(t), i.e., |® r (t)| = r(t), see Fig. 1. Furthermore, without loss of generality, we assume that at time t0 = 0, the transmitter is located at the origin of the Cartesian coordinate system, i.e., r®tx (t0 = 0) = [0, 0, 0], and the receiver is at r®rx (t0 = 0) = [x0, 0, 0]. Thus, r®(t0 ) = r®rx (t0 ) and r(t0 = 0) = r0 = x0 . We assume that the information that is sent from the transmitter to the receiver is encoded into a binary sequence of length L, b = [b1, b2, · · · , b L ]. Here, b j is the bit transmitted in the jth bit interval with Pr(b j = 1) = P1 and Pr(b j = 0) = P0 = 1 − P1 , where Pr(·) denotes probability. We assume that transmitter and receiver are synchronized, see e.g. [15]. We adopt ON/OFF keying for modulation and a fixed bit interval duration of T seconds. In particular, the transmitter releases a fixed number of A molecules, N A, for transmitting bit “1” at the beginning of a modulation bit interval and no molecules for transmitting bit “0”. III. S TOCHASTIC C HANNEL M ODEL In this section, we provide some preliminaries regarding the modeling of time-variant channels in diffusive mobile MC systems. In particular, in Section III-A, we introduce the terminology used for describing the time-variant CIR in the absence of flow. Subsequently, we present a mathematical expression for the CIR. Then, we investigate the impact of flow on the derived CIR expression in detail in Section III-B. A. Impulse Response of Time-Variant MC Channel without Flow In this subsection, in order to be able to focus on the impact of the mobility of the transmitter and receiver on the CIR, we assume v® = [0, 0, 0]. We borrow the terminology and the notation for time-variant CIRs from [16, Ch. 5]. There, it is assumed that the impulse response of a classical wireless multipath channel can be characterized by a function h◦ (t, τ), where t represents the time variation due to the mobility of the receiver and τ describes the channel multipath delay for a fixed t. Here, we also adopt this notation and derive h◦ (t, τ) for the problem at hand. In the context of MC, the impulse response of the channel corresponds to the probability of observing a molecule released by the transmitter at the receiver [2]. 6 Let us assume, for the moment, that at the time of release of a given A molecule at the transmitter, r(t) is known and given by r ∗ . Then, the impulse response of the channel, i.e., the probability that a given A molecule, released at the center of the transmitter at time τ = 0, is observed inside the volume of the transparent receiver at time τ > 0 can be written as [17, Eq. (4)] ! ∗ )2 −(r V obs exp , h◦ (τ|r ∗ ) = 4D1 τ (4πD1 τ)3/2 (1) 3 is the volume of the receiver and D = D + D is the effective diffusion where Vobs = 34 πarx 1 A rx coefficient capturing the relative motion of the signaling molecules and the receiver, see [14, Eq. (8)]. However, due to the random movements of both the transmitter and the receiver, r®(t) (and consequently r(t)) change randomly. In particular, for the problem at hand, the PDF of random variable r®(t) is given by fr®◦(t) (®r ) ! 1 −|® r − r®0 | 2 = exp , 4D2 t (4πD2 t)3/2 (2) where D2 = Drx + Dtx is the effective diffusion coefficient capturing the relative motion of transmitter and receiver, see [14, Eq. (10)]. Thus, for a mobile transmitter and a mobile receiver, the CIR, denoted by h◦ (t, τ), can be written as ! 2 V −|® r (t)| obs , h◦ (t, τ) = exp 4D1 τ (4πD1 τ)3/2 (3) where r®(t) is distributed according to the PDF in (2). CIR h◦ (t, τ) completely characterizes the time-variant channel and is a function of both t and τ. Variable t represents the time of release of the molecules at the transmitter, whereas τ represents the relative time of observation of the signaling molecules at the receiver for a fixed value of t, cf. Fig. 1. We note that the movement of the receiver is accounted for in (1) via D1 as far as its effect on the A molecules is concerned, and in (2) via D2 as far as the relative motion of the transmitter and receiver is concerned. Both effects impact h◦ (t, τ) in (3). For any given τ, h◦ (t, τ) is a stochastic process with random variables h◦ (ti, τ), i ∈ {1, 2, . . . , n}. Specifically, h◦ (ti, τ) can be interpreted as a function of random variable r®(t). B. Impact of Flow In this subsection, we consider the impact of uniform bulk flow on the CIR h◦ (t, τ). We distinguish between three cases, based on the mobility of the transmitter and the receiver. Let us denote the x, y, and z coordinates of the position of the transmitter, i.e., the components 7 of vector r®tx (t), at time t by Xtx (t), Ytx (t), and Ztx (t), respectively. Similarly, the x, y, and z coordinates of the position of the receiver, i.e., the components of vector r®rx (t), at time t are denoted by Xrx (t), Yrx (t), and Zrx (t), respectively. 1) Mobile Transmitter and Mobile Receiver: In this case, both the transmitter and the receiver, along with the information molecules, move with the bulk flow in the environment. Using a moving reference frame that also moves with the bulk flow, it can be easily verified that the ◦ r ) and h◦ (t, τ), i.e., (2) and (3), respectively, are still valid. expressions for fr®(t) (® 2) Mobile Transmitter and Fixed Receiver: In this case, since the receiver is fixed, D1 and D2 are given by D1 = D A and D2 = Dtx , respectively. Due to the random walk of the transmitter, and according to the configuration of the transmitter and receiver as shown in Fig. 1, we can write Xtx (t) ∼ N (v x t, 2Dtx t), Ytx (t) ∼ N (v y t, 2Dtx t), Ztx (t) ∼ N (vz t, 2Dtx t), Xrx (t) = x0, Yrx (t) = 0, Zrx (t) = 0, (4) where N (µ, σ 2 ) denotes a Gaussian distribution with mean µ and variance σ 2 . Then, for the components of vector r®(t) = r®rx (t) − r®tx (t), we obtain X(t) = Xrx (t) − Xtx (t) ∼ N (x0 − v x t, 2D2 t), Y (t) = Yrx (t) − Ytx (t) ∼ N (−v y t, 2D2 t), Z(t) = Zrx (t) − Ztx (t) ∼ N (−vz t, 2D2 t). (5) Given (5), the PDF of random variable r®(t) can be written as  2 1 © − r® − r®0 − v®t ª exp ­ (6) = ®. 4Dtx t (4πDtx t)3/2 « ¬ In a similar way, the corresponding impulse response of the time-variant MC channel can be fr®rx(t) (®r ) written as 2 Vobs © − r®(t) − v®τ ª exp h (t, τ) = ­ ®. 4D A τ (4πD A τ)3/2 « ¬ rx rx The superscript “rx” in fr®(t) (® r ) and h (t, τ) emphasizes that the receiver is fixed. rx (7) 3) Fixed Transmitter and Mobile Receiver: In the third case, the transmitter node is fixed while the receiver is mobile, and, as a result, the corresponding effective diffusion coefficients are given by D1 = D A + Drx and D2 = Drx . Now, using a similar approach as in (4) and (5), we can write the PDF of random variable r®(t) as follows fr®tx(t) (®r ) 1 © − r® − r®0 + v®t = exp ­ 4Drx t (4πDrx t)3/2 «  2 ª ®, ¬ (8) 8 where the superscript “tx” indicates that the transmitter node is fixed. Furthermore, we denote the impulse response of the time-variant channel for this scenario by htx (t, τ). For calculation of htx (t, τ), however, since both the information molecules and the receiver are equally affected by the flow, by using a moving reference frame, it can be easily verified that htx (t, τ) = h◦ (t, τ), i.e., ! 2 −|® r (t)| V obs exp . htx (t, τ) = 4D1 τ (4πD1 τ)3/2 (9) By comparing the PDFs of random variable r®(t) in (2), (6), and (8), and similarly, the impulse responses of the time-variant MC channel in (3), (7), and (9), we can observe that the major difference between the respective equations appears in the argument of the exponential functions. Thus, to facilitate our subsequent analysis, we introduce general expressions for the PDF of r®(t) and the time-variant CIR unifying all considered cases. In particular, we model the PDF of random variable r®(t) as ? 1 © − r® − r®0 − v® t exp ­ fr®(t) (®r ) = 4D2 t (4πD2 t)3/2 « and the impulse response of the time-variant MC channel as  2 ª ®, ¬ (10) 2 0 Vobs © − r®(t) − v® τ ª exp (11) h(t, τ) = ­ ®, 4D1 τ (4πD1 τ)3/2 « ¬ where v®?, v®0, D1 , and D2 are defined in Table I for different mobility scenarios. In Table I, “TX” and “RX” stand for transmitter and receiver, respectively. We also note that for the case of fixed TX and RX (with and without flow), fr®(t) (® r ) → δ(® r − r®0 ), where δ(·) is the Dirac delta function. Furthermore, for conciseness of presentation, we introduce the following notations: ϕ= 1 1 1 Vobs , λ(t)= , α= , β(t)= . 3/2 3/2 4D1 τ 4D2 t (4πD1 τ) (4πD2 t) (12) IV. S TATISTICAL A NALYSIS OF T IME -VARIANT MC C HANNEL In this section, we analyze the statistical averages of the considered time-variant channel, i.e., the statistical averages of the random process h(t, τ). In particular, we derive closed-form expressions for the mean and autocorrelation function of h(t, τ). Furthermore, we derive closedform expressions for the CDF and the PDF of the time-variant CIR, and provide a mathematical model for outdated CSI. 9 TABLE I VALUES OF v®? , v® 0 , D1 , AND Mobility Scenario v®? v® 0 D1 D2 No flow with fixed TX and fixed RX 0® 0® DA 0 No flow with mobile TX and fixed RX 0® 0® DA Dtx No flow with fixed TX and mobile RX 0® 0® D A + Drx Drx No flow with mobile TX and mobile RX 0® 0® D A + Drx Drx + Dtx Flow with fixed TX and fixed RX 0® v® DA 0 Flow with mobile TX and fixed RX v® v® DA Dtx Flow with fixed TX and mobile RX −®v 0® D A + Drx Drx 0® 0® D A + Drx Drx + Dtx Flow with mobile TX and mobile RX D2 A. Statistical Averages of Time-Variant MC Channel Let us start with the mean of h(t, τ) for arbitrary time t, denoted by m(t). Then, m(t) can be evaluated as ˆ m(t) = E h(t, τ) =  h(t, τ) r®∈R3 × fr®(t) (® r ) d® r, (13) r®(t)=® r where E(·) denotes expectation. The solution to (13) is provided in the following theorem. Theorem 1 (Mean of Time-variant MC Channel): The mean of the impulse response of a time-variant MC channel including the effects of uniform bulk flow, and diffusive passive transmitter and receiver nano-machines with diffusion coefficients Dtx and Drx , respectively, which communicate via signaling molecules with diffusion coefficient D A, is given by ! ? 0 2 −|® r0 − v® t − v® τ| Vobs . m(t) =  3/2 exp 4 (D1 τ + D2 t) 4π (D1 τ + D2 t) Proof: Substituting (10) and (11) in (13), we can write m(t) as ˆ 0 2 ? 2 m(t) = ϕλ(t) e−α|®r −®v τ| × e−β(t)|®r −(®r0 −®v t)| d® r. r®∈R3 ˆ+∞ˆ+∞ˆ+∞ = ϕλ(t) e−(α+β(t)) x 2 +2 (14) (15) ( β(t)(x0 −v?x t)+αvx0 τ) x−β(t)(x0 −v?x t)2 −α(vx0 τ)2 × e−(α+β(t)) y2 −∞ −∞ −∞  ×e  2 αvy0 τ−β(t)vy?t y−β(t)(vy?t)2 −α(vy0 τ)2 × e−(α+β(t))z 2 +2 (αvz0 τ−β(t)vz?t )z−β(t)(vz?t)2 −α(vz0 τ)2 dx dy dz. 10 The three integrals in (15) can be solved independently. Now, using the following definite integral [18, Eq. (3.323.2.10)] ˆ+∞   2 2 exp −p x ± qx dx = exp −∞ q2 4p2 !√ π , p (16) the integrals in (15) simplify to the expression in (14). This completes the proof. Remark 1: Since m(t) is a function of t, h(t, τ) is a non-stationary stochastic process. In fact, this is due to the assumption of an unbounded environment, as on average the transmitter and the receiver diffuse away from each other and, ultimately, h(t, τ) approaches zero as t → ∞. Next, we derive a closed-form expression for the autocorrelation function (ACF) of h(t, τ) for two arbitrary times t1 and t2 > t1 , denoted as φ(t1, t2 ). To this end, we write φ(t1, t2 ) as follows ¨  φ(t1, t2 ) = E h(t1, τ)h(t2, τ) = h(t1, τ) r®(t)=®r1 1 r®1, r®2 ∈R3  × h(t2, τ) r®(t)=®r2 × fr®(t1 ), r®(t2 ) r®1, r®2 d® r1 d® r2, (17)  where fr®(t1 ), r®(t2 ) r®1, r®2 is the joint distribution function of random variables r®(t1 ) and r®(t2 ), which can be written as   fr®(t1 ), r®(t2 ) r®1, r®2 = fr®(t1 ) r®1 fr®(t2 ) r®2 r®1 ,   (18)   where we used the fact that free diffusion is a memoryless process and, as a result, fr®(t2 ) r®2 r®1, r®0   = fr®(t2 ) r®2 r®1 . Given (18), a closed-form expression of φ(t1, t2 ) is provided in the following theorem. Theorem 2 (ACF of Time-variant MC Channel): The ACF of the impulse response of a time-variant MC channel including the effects of uniform bulk flow, and diffusive passive transmitter and receiver nano-machines with diffusion coefficients Dtx and Drx , respectively, which communicate via signaling molecules with diffusion coefficient D A, is given by  (2π)3 ϕ2 λ(t1 )λ(t2 − t1 ) exp κ x + κ y + κz φ(t1, t2 ) =   3/2 ,   4 α+β (t1 ) α+β (t2 −t1 ) +αβ (t2 −t1 ) (19) G where t1 and t2 > t1 are two arbitrary times and κζ is defined as κζ = Wζ where  2   G ζ = −α 2β(t2 − t1 ) + α β(t1 )(x0 − v?ζt1 )2 + β(t2 − t1 ) α + β(t1 ) v?ζ(t2 − t1 ) 1 In (20)  our analysis, the definition of the ACF in (17) can be easily extended to φ(t1, t2 ) = E h(t1, τ1 )h(t2, τ2 ) . However, since in Section V we consider a detector that takes only one sample at a fixed time after the beginning of each modulation interval, for simplicity of presentation, we focus on the case of τ1 = τ2 = τ. 11  + α + 2β(t2 − t1 ) β(t1 )(vζ0 τ)2 + 2β(t1 )β(t2 − t1 )v?ζ(t2 − t1 )(vζ0 τ − x0 + v?ζt1 )  − 2αβ(t1 )vζ0 τ(x0 − v?ζt1 ) − 4β(t1 )β(t2 − t1 )vζ0 τ(x0 − v?ζt1 ) , W = αβ(t1 ) + 2αβ(t2 − t1 ) + β(t1 )β(t2 − t1 ) + α2, where ζ = {x, y, z} and x0 is set to zero (x0 = 0) when ζ = {y, z}. Proof: Please refer to Appendix A. In the following corollary, we study a special case of φ(t1, t2 ) where t2 → t1 , i.e., φ(t1, t1 ) =  E h(t1, τ)h(t1, τ) , since φ(t1, t1 ) cannot be directly obtained from (19) by substituting t2 = t1 . Corollary 1 (ACF of Time-variant MC Channel for t2 = t1 ): In the limit of t2 → t1 , the ACF of h(t, τ), i.e., φ(t1, t1 ), is given by φ(t1, t1 ) = 2 Vobs (4πD1 τ)3/2 4π (D1 τ + 2D2 t1 )  3/2 ! −|® r0 − v®?t − v®0 τ| 2 exp . 2 (D1 τ + 2D2 t1 ) Proof: In the limit of t2 → t1 , φ(t1, t2 ) in (17) becomes ˆ n o 2 φ(t1, t1 ) = E h (t1, τ) = h2 (t1, τ) r®1 ∈R3 × fr®(t1 ) (® r1 ) d® r1 . (21) (22) r®(t)=® r1 Substituting (10) and (11) in (22), leads to ˆ 0 2 ? 2 2 φ(t1, t1 ) = ϕ λ(t1 ) e−2α|®r1 −®v τ| × e−β(t1 )|®r1 −(®r0 −®v t1 )| d® r1 . (23) r®1 ∈R3 Now, expanding the integrand in (23), similar to (15), and using (16), φ(t1, t1 ) simplifies to (21). Given (21), we define the variance of the time-variant MC channel as σ 2 (t) = φ(t, t) − m2 (t). B. Coherence Time of Time-Variant MC Channel In this subsection, we provide an expression for evaluation of the coherence time of the considered time-variant MC channel. To this end, we first define the normalized autocorrelation function of random process h(t, τ) as follow:  E h(t1, τ)h(t2, τ) φ(t1, t2 ) ρ(t1, t2 )= q  =p .  φ(t , t )φ(t , t ) 2 2 1 1 2 2 E h (t1, τ) E h (t2, τ) (24) Now, for time t1 = 0, we define the coherence time of the time-variant MC channel, T c , as the minimum time t2 after t1 = 0 for which ρ(t1, t2 ) falls below a certain threshold value 0 < η < 1, i.e.,  T c = arg min ρ(0, t2 ) < η . ∀t2 >0 (25) 12 We note that the particular choice of η is application dependent, as the coherence time of the channel refers to the time during which the channel does not change significantly and the definition of a significant change may vary from one application scenario to another. For example, typical values of η reported in the traditional wireless communications literature span the range from 0.5 to 1, [19]–[21], e.g., smaller values of η are often employed for resource allocation problems, while larger values of η are used for channel estimation problems. C. CDF of Impulse Response of Time-Variant MC Channel Now, we are interested in calculating the CDF of the time-variant CIR h(t, τ) in (11), denoted  as Fh(t,τ) (h). Thus, we need to calculate Pr h(t, τ) ≤ h . The result of this calculation is provided in the following theorem. Theorem 3 (CDF of Time-variant MC Channel): The CDF of the impulse response of a time-variant MC channel including the effects of uniform bulk flow, and diffusive passive transmitter and receiver nano-machines with diffusion coefficients Dtx and Drx , respectively, which communicate via signaling molecules with diffusion coefficient D A, is given by r   r   © ln ϕ + r eq (t)√α ª © ln ϕ − r eq (t)√α ª ­ ­ ® 1 ® h h 1 ­ ­ ® ® (26) Fh(t,τ) (h) = erfc ­ ® + erfc ­ ® √ √ ­ ­ ® 2 ® 2 4D2 tα 4D2 tα ­ ­ ® ® « « ¬ ¬ ! !2   2 r r         √ √   © © ª ϕ ϕ   eq (t) α ® eq (t) α ª   ­ ­ ® ln ln − r + r   √ h h   ­ ­ ® ®    D2 t ­ ­ ® ® exp ­− + − exp ­− , ® ® √ ­ ­ ® ® 4D2 tα 4D2 tα r eq (t) π      ­ ­ ® ®    ­ ­ ® ®       « « ¬ ¬   where erfc (·) denotes the complementary error function, and we define the equivalent distance r eq (t) = |® r0 − v®?t − v®0 τ| for compactness. Proof: Please refer to Appendix B. Remark 2: One immediate application of the derived CDF is the calculation of the outage probability of the considered system. In particular, the outage probability, Pout , can be defined as  Pr h(t, τ) < hmin , i.e., the probability that the value of the impulse response of the time-variant channel falls below a minimum threshold. Different criteria can be used for selecting hmin , e.g., hmin can be chosen such that it guarantees a minimum bit error probability at the receiver nanomachine. As another application, the derived CDF can be employed for calculation of the average number of successfully transmitted information bits before an outage occurs, denoted by n̄out . b 13  Let us define tmax = arg max(Pr h(t, τ) < hmin ). Then, n̄out = tmax /T, where T is the duration b ∀t>0 of the modulation bit interval. Remark 3: Assuming independent diffusion for each information molecule A, we can write the observed signal at the receiver as N(t, τ) = N A h(t, τ). Now, given Fh(t,τ) (h), the CDF of N(t, τ) can be evaluated as FN(t,τ) (n) = Fh(t,τ) (n/N A). D. PDF of Impulse Response of Time-Variant MC Channel In this subsection, we calculate the PDF of the impulse response of the time-variant MC channel, and provide a corresponding simple approximation. Corollary 2 (PDF of Time-variant MC Channel): Given (26), the PDF of the impulse response of the considered time-variant MC channel, fh(t,τ) (h), can be expressed as !2 !2   r   r     √ √ © © ª ϕ ϕ eq (t) α ® eq (t) α ª   ­ ­ ® ln − r ln + r   h h ­ ­ ® ®  1 ­ ­ ® ®  fh(t,τ) (h) = ® − exp ­− ® . √ exp ­­− ­ ® ® 4D2 tα 4D2 tα 4αr eq (t)h πD2 t  ­ ­ ® ®  ­ ­ ® ®    « « ¬ ¬  (27) Proof: fh(t,τ) (h) can be straightforwardly calculated by taking the partial derivative of Fh(t,τ) (h) in (26) with respect to h. The derived expression for the PDF of the time-variant CIR can be used for the design of new detection and/or estimation algorithms at the receiver nano-machines [22], [23]. However, (27) might be too complicated for some design and/or analysis problems. In the remainder of this section, we first show how (27) can be approximated by a Log-normal distribution. Then, we specify the necessary condition that has to be met for this approximation to be accurate. To this end, we start with the following Lemma. Lemma 1: It has been shown in [24, Ch. 1] that if random variable U is noncentral chi-squared distributed, i.e., U ∼ χk2 (γ), the asymptotic distribution of U − (k + γ) ∼ N (0, 1) √ 2k + 4γ (28) follows a standard Normal distribution as either k → ∞ for a fixed γ, or γ → ∞ for a fixed k. Given the result of Lemma 1, we provide the asymptotic distribution of h(t, τ) in the following proposition. 14 10 0 10 -5 10 -10 10 -15 200 400 600 800 1000 Fig. 2. NMSE between the PDF of random variable U ∼ χk2 (γ) and its Gaussian approximation as a function of γ. ? Proposition 1: The asymptotic PDF of h(t, τ) in (27), denoted by fh(t,τ) (h), in the regime of (r eq (t))2 2D2 t → ∞ follows a Log-normal distribution, i.e., ? fh(t,τ) (h) ∼ Lognormal µ?, σ? ,  2 !  (29) !  2 (r eq (t))2 2(r eq (t))2 + ln ϕ , σ? = (2D2 tα)2 × 6 + . (30) 2D2 t D2 t   2 Proof: We have shown in Appendix B that h(t, τ) = ϕ exp −2D2 tαr̃ (t) , where r̃ 2 (t) ∼ µ? = −2D2 tα 3 + χk2 (γ(t)) with k = 3 and γ(t) = (r eq (t))2 /(2D2 t). Employing Lemma 1 for the case where k is  fixed, in the limit of γ(t) → ∞, we obtain r̃ 2 (t) ∼ N (k + γ(t)), 2k + 4γ(t) , i.e., ! eq (t))2 eq (t))2 2(r (r ,6+ . (31) r̃ 2 (t) ∼ N 3 + 2D2 t D2 t ? Now, given (31), it is straightforward to show that fh(t,τ) (h) follows a Log-normal distribution. ? The key step in the derivation of the asymptotic PDF, fh(t,τ) (h), is the approximation of the PDF of r̃ 2 (t) ∼ χk2 (γ(t)) with a Normal distribution employing (28). Theoretically, this approximation becomes valid when γ(t) → ∞. In order to evaluate the accuracy of the approximation introduced in (28), in Fig. 2, we show the normalized mean square error (NMSE) between the PDF of U ∼ χk2 (γ), denoted by fU (x|k, γ), and the approximated PDF of a Gaussian random variable with mean µ = (k + γ) and variance σ 2 = (2k + 4γ), denoted by gU (x| µ, σ 2 ). As can be observed, values of γ ≥ 100 lead to an NMSE of approximately less than 10−10 , which provides an accurate approximation for (31). Taking this into account, we establish a necessary condition 15 for approximating the PDF of the impulse response of a time-variant MC channel by a Lognormal distribution as γ(t) ≥ 100, i.e., (r eq (t))2 ≥ 100 2D2 t or D2 t ≤ (r eq (t))2 . 200 (32) Remark 4: In the literature of conventional (non-molecular) communication, a similar approach for approximating the distribution of a noncentral chi-squared random variable with normal distribution can be found. There, usually the case where k → ∞ is considered. For example, in his seminal work [25], Urkowitz showed that values of k ≥ 250 provide an accurate approximation. Later, Urkowitz’ criterion has been widely used in the spectrum sensing literature, see e.g. [26]–[28]. In this work, we have a fixed k = 3 and adopt the approximation based on γ → ∞. E. Outdated CSI Model As one application of the expression derived for the PDF of h(t, τ), in this subsection, we propose a simple analytical model for outdated CSI in time-variant MC channels. In particular, for the problem at hand, knowledge of the CSI is equivalent to knowledge of the CIR. Due to the mobility of the nano-machines, the CIR decorrelates over time, which may limit the performance of detection algorithms that require instantaneous knowledge of the CIR. Similar to conventional wireless communication systems, one possible approach would be to organize the transmitted symbols into blocks, estimate the CIR at the beginning of each block based on pilot symbols, and use the estimated CIR for detection/decoding of the symbols in the block, where the CIR changes within the transmission block due to the mobility of the transmitter and receiver. On the other hand, there is a trade-off between block length and CSI quality, i.e., by increasing the block length, the CSI becomes more outdated but the training overhead is reduced. Thus, a simple yet accurate model for the outdated CSI is desirable. Let us assume that the receiver obtains a perfect estimate of the CIR at time ts , where we denote the estimated CIR by ĥ(ts, τ) and the estimated r®(ts ) by r®ˆs .2 Now, given (31), for t > ts , we can write (r eq (t 0))2 + h(t 0, τ) = ϕ exp −2D2 t 0αr̃ 2 (t 0) = ϕ exp − 2D2 t 0α 3 + 2D2 t 0    s   2(r eq (t 0))2 6+ × , D2 t 0 (33) 2 We note that based on the expression for the CIR in (11), knowing h(ts, τ) is equivalent to knowing r®(ts ), if all other system parameters are known at the receiver. 16 where t0 = t − ts and  ∼ N (0, 1). Now, substituting r eq (t 0) = q |r®ˆs − v®?t 0 − v®0 τ| 2 into (33), it can be easily verified that h(t 0, τ) can be written as h(t 0, τ) = C ĥ(ts, τ)M Θ, (34) where M ∼ Lognormal(0, 1), and C and Θ are defined as   C = exp −6D2 t 0α − 2α v®?t 0 and (r®ˆs − v®0 τ)  s , Θ = −2D2 t 0α 6 + 2|r®ˆs − v®?t 0 − v®0 τ| 2 , (35) D2 t 0 denotes the inner product of two vectors. In (34), C and Θ are two time-dependent variables. In the limit of t → ts (t 0 → 0), C and Θ approach 1 and 0, respectively, and h(t 0, τ) → ĥ(ts, τ). On the other hand, as t 0 increases, C decreases and Θ increases, which reflects the decorrelation of h(t 0, τ) and ĥ(ts, τ). Furthermore, we note that the accuracy of (34) depends on the accuracy of the approximation introduced in (31). V. E RROR R ATE A NALYSIS FOR P ERFECT AND O UTDATED CSI In this section, we first calculate the expected error probability of a single-sample threshold detector. Then, we discuss the choice of the detection threshold of the detector. Finally, in order to investigate the impact of CIR decorrelation, we calculate the expected error probability of the considered detector for perfect and outdated CSI. A. Expected Bit Error Probability We consider a single-sample threshold detector, where the receiver takes one sample at a fixed time τs after the release of the molecules at the transmitter in each modulation bit interval, counts the number of signaling A molecules inside its volume, and compares this number with a detection threshold. In particular, we denote the received signal, i.e., the number of molecules observed inside the volume of the receiver in the jth bit interval, j ∈ {1, 2, . . . , L}, at the time of sampling by N(τj,s ), where τj,s = ( j − 1)T + τs . Furthermore, we assume that the detection threshold of the receiver, ξ j , can be adapted from one bit interval to the next. The choice of ξ j is discussed in the next subsection. Thus, the decision of the single-sample detector in the jth bit interval, b̂ j , is given by b̂ j =    1  if N(τj,s ) ≥ ξ j ,   0  if N(τj,s ) < ξ j . (36) 17 For the decision rule in (36), we showed in [14] that the expected error probability of the jth bit, Pe (b j ), can be calculated as [14, Eq. (12)] ˆ ˆ Õ Pe (b j ) = · · · fR® (r) Pr(b)Pe (b j |b, r) d®r1 · · · d®rL−1, r∈R (37) b∈B where f R® (r) is the (L − 1)-dimensional joint PDF of vector R® = [® r (T), r®(2T), · · · , r®((L − 1)T)] that can be evaluated as fR® (r) = fr®(T) r®1 |®r0 × · · · × fr®((L−1)T ) r®L−1 |®rL−2, · · · , r®0  (a) = j=L−1 Ö  fr®( jT) r®j |®r j−1 .  (38) j=1 Here, r = [® r1, r®2, · · · , r®L−1 ] is one sample realization of R® and equality (a) holds as free diffusion   is a memoryless process, i.e., fr®( jT) r®j |® r j−1, · · · , r®0 = fr®( jT) r®j |® r j−1 . Furthermore, R and B are the sets containing all possible realizations of r and b, respectively, and Pr(b) denotes the likelihood of the occurrence of b and Pe (b j |b, r) is the conditional bit error probability of b j . In [14], we considered a reactive receiver [29] and showed how Pe (b j |b, r) can be calculated for a single-sample detector using a fixed detection threshold ξ. Here, we provide Pe (b j |b, r) for a passive receiver [17] employing a single-sample detector with an adaptive detection threshold ξj. Let us assume that b and r are known. It has been shown in [17] that the number of observed molecules, N(τj,s ), can be accurately approximated by a Poisson random variable. The mean of N(τj,s ), denoted by N(τj,s ), due to the transmission of all bits up to the current bit interval can be written as N(τj,s ) = N A j Õ bi h iT, ( j − i)T + τs + n A,  (39) r®(iT)=® ri i=1 where n A is the mean number of noise molecules inside the volume of the receiver at any given time. Now, given N(τj,s ) and the decision rule in (36), Pe (b j |b, r) can be written as Pe (b j |b, r) =     Pr(N(τj,s ) < ξ j )  if b j = 1, (40)    Pr(N(τj,s ) ≥ ξ j ) if b j = 0,  where Pr(N(τj,s ) < ξ j ) can be calculated from the cumulative distribution function of a Poisson distribution as  Pr(N(τj,s ) < ξ j ) = exp −N(τj,s )  ω j −1 N(τ )  ξÕ j,s ω=0 ω! , (41) 18 and Pr(N(τj,s ) ≥ ξ j ) = 1 − Pr(N(τj,s ) < ξ j ). Given Pe (b j |b, r) in (40), Pe (b j ) can be calculated Í based on (37). Subsequently, we can obtain the expected error probability as Pe = L1 Lj=1 Pe (b j ). B. Choice of Detection Threshold In this subsection, we discuss the choice of the adaptive detection threshold for the considered single-sample detector. Let us assume for the moment that sequence {b1, b2, · · · , b j−1 } and r are opt known, and we are interested in finding the optimal detection threshold, ξ j , that minimizes the instantaneous error probability Pe (b j ). Then, we have shown in [30] that for any threshold opt detector whose received signal can be modeled as a Poisson random variable, ξ j is given by [30, Eq. (25)] & opt ξj = ln  P0 P1  ' + (λ1 − λ0 )  , ln λ1 /λ0 (42) where λ1 = N(τj,s |b j = 1), λ0 = N(τj,s |b j = 0), and d·e denotes the ceiling function. opt Remark 5: We note that the evaluation of ξ j requires knowledge of the previously trans- mitted bits up to the current bit interval, which is not available in practice. Thus, for practical subopt implementation, we propose a suboptimal detector whose detection threshold, ξˆj , is evaluated according to (42) after replacing {b1, b2, . . . b j−1 } in (39) with the estimated previous bits, i.e., { b̂1, b̂2, · · · , b̂ j−1 }. Remark 6: It has been shown in [31] that when the effect of inter-symbol interference (ISI) is negligible compared to n A, the combination of (36) and (42) constitutes the optimal maximum likelihood (ML) detector. We note that, in this regime, knowledge of previously transmitted bits opt is not required for calculation of ξ j . C. Detectors with Perfect and Outdated CSI In this subsection, we distinguish between the cases of perfect CSI and outdated CSI knowledge, and explain how the corresponding expected error probabilities of the single-sample detector can be evaluated. Perfect CSI: For the case of a single-sample detector with perfect CSI, we assume that for any given modulation bit interval, r(t) is known at the receiver for all previous bit intervals up to the current bit interval, i.e., for the jth bit interval, [® r (0), r®(T), . . . , r®( jT)] is known at the receiver. subopt Thus, ξˆj can be directly obtained from (11), (39), and (42). Outdated CSI: For the case of a single-sample detector with outdated CSI, we assume that only the initial distance between transmitter and receiver at time t0 = 0, i.e., r0 , is known at the 19 TABLE II S IMULATION PARAMETERS Parameter Value Parameter Value NA DA Drx r0 arx nA 30000 5 × 10−9 m2 /s 10−13 m2 /s 1 µm 0.15 µm 10 T τ = τs L P1 P0 ∆t 0.5 ms 0.035 ms 50 0.5 0.5 5 µs subopt receiver. As a result, in any modulation bit interval, the receiver evaluates ξˆj via (42) with the mean given by N(τj,s ) = N A j Õ  bi h t0 , ( j − i)T + τs + n A . (43) i=1 Finally, for both cases, Pe (b j |b, r) is obtained from (40). VI. S IMULATION R ESULTS In this section, we present simulation and analytical results to assess the accuracy of the derived analytical expressions for the mean and the ACF of the time-variant CIR and the expected error probability of the considered mobile MC system. For simulation, we adopted a particlebased simulation of Brownian motion, where the precise locations of the signaling molecules, transmitter, and receiver are tracked throughout the simulation environment. In particular, in the simulation algorithm, time is advanced in discrete steps of ∆t seconds. In each step of the simulation, each A molecule, the transmitter, and the receiver undergo random walks, and their new positions in each Cartesian coordinate are obtained by sampling a Gaussian random variable with √ √ √ mean vζ ∆t, ζ = {x, y, z}, and standard deviation 2D A∆t, 2Dtx ∆t, and 2Drx ∆t, respectively. Furthermore, we used Monte-Carlo simulation for evaluation of the multi-dimensional integral in (37). For all simulation results, we chose the set of simulation parameters provided in Table II, unless stated otherwise. For all simulation results in Sections VI-A and VI-B, we assume that n̄ A = 0. Furthermore, we considered an environment with the viscosity of blood plasma (' 4 mPa · s) at 37 ◦ C and we used the Stokes–Einstein equation [2, Eq. (5.7)] for calculation of D A and Dtx . The only parameters that were varied are Dtx = {0.1, 1, 5, 20, 100} × 10−13 m2 s (corresponding to 20 35 1 0.9 30 0.8 25 0.7 4 20 3 0.6 2 1 15 0.5 0 0 10 20 30 40 50 0.4 10 0 10 20 30 40 50 Fig. 3. Expected received signal, N A m(t), as a function of time t for different values of Dtx = {5, 20, 100} × 2 10−13 ms in the absence of flow. 0 10 20 30 40 50 Fig. 4. Normalized ACF, ρ(t1 = 0, t2 ), as a function of t2 , for 2 different values of Dtx = {0.1, 1, 5, 20, 100} × 10−13 ms in the absence of flow. atx = 5.6793 × {10−6, 10−7, 2 × 10−8, 5 × 10−9, 1 × 10−9 } m)3 and flow velocity v®. All simulation results were averaged over 105 independent realizations of the environment. A. First- and Second-order Moments of CIR In Fig. 3 and its inset, we investigate the impact of time t on the mean and the normalized variance of the received signal in the absence of flow, i.e., N A m(t) and σ 2 (t)/m2 (t), respectively, for Dtx = {5, 20, 100} × 10−13 m2 s . Fig. 3 shows that as time t increases, N A m(t) decreases. This is due to the fact that as t increases, on average r(t) increases as transmitter and receiver diffuse away and, consequently, m(t) decreases. The decrease is faster for larger values of Dtx , since for larger Dtx , the transmitter diffuses away faster. The normalized variance of the received signal is shown in the inset of Fig. 3. We observe that for all values of Dtx , the normalized variance of the received signal is an increasing function of time. This is because as time increases, due to the Brownian motion of transmitter and receiver, the variance of their movements increases, which leads to an increase in the normalized variance of the received signal. As expected, this increase is faster for larger values of Dtx , since the displacement variance of the transmitter, 2Dtx t, is larger. In Fig. 4, the normalized ACF, ρ(t1, t2 ), is evaluated as a function of t2 in the absence of flow for a fixed value of t1 = 0 and transmitter diffusion coefficients Dtx = {0.1, 1, 5, 20, 100} × 10−13 m2 s . We observe that for all considered values of Dtx , ρ(t1, t2 ) decreases with increasing t2 . This 3 The very small values of atx (in the order of a few nm) have been used only to consider the full range of Dtx values. 21 50 1 40 0.9 0.8 30 0.7 20 0.6 10 0.5 0 0.4 0 10 20 30 40 50 0 10 20 30 40 50 Fig. 5. Expected received signal, N A m(t), as a function of time Fig. 6. Normalized ACF, ρ(t1 = 0, t2 ), as a function of t2 , for t for a fixed receiver. 2 τ = τs , Dtx = {5, 20} × 10−13 ms , and v={0, 10−5, −10−5 } ms for a fixed receiver. is due to the fact that by increasing t2 , on average r(t) increases, and the CIR becomes more decorrelated from the CIR at time t1 = 0. Furthermore, as expected, for larger values of Dtx , ρ(t1, t2 ) decreases faster, as for larger values of Dtx , the transmitter diffuses away faster. For η = 0.9, the coherence time, T c , for Dtx = 20 × 10−13 m2 s and Dtx = 5 × 10−13 m2 s is 7 ms and 23 ms, respectively. The coherence time is a measure for how frequently CSI acquisition has to be performed. In Figs. 5 and 6, we investigate the impact of flow on N A m(t) and the normalized ACF. In Fig. 5, N A m(t) is depicted as a function of time t for system parameters Dtx = {20, 100} × 10−13 m2 s and v = {0, 10−5, −10−5 } m s, where we assumed v x = v y = vz = v and a fixed receiver. Fig. 5 shows that for positive v, N A m(t) first increases, as a positive flow carries the transmitter towards the receiver, and then decreases, since the transmitter eventually passes the receiver. Moreover, the increase of N A m(t) is larger for smaller values of Dtx . This is because, when Dtx is small, flow is the dominant transport mechanism. However, when Dtx is large, diffusion becomes the dominant transport mechanism and, as discussed before, on average r(t) increases, which reduces N A m(t). For the case when the flow is negative, N A m(t) decreases quickly. This behaviour is expected, as for v < 0, the flow carries the transmitter away from the receiver. In Fig. 6, the normalized ACF, ρ(t1, t2 ), is evaluated as a function of t2 for a fixed value of t1 = 0, a fixed receiver, and system parameters Dtx = {5, 20} × 10−13 m s, m2 s and v = {0, 10−5, −10−5 } where v x = v y = vz = v. We observe that, for both considered values of Dtx , if v = 10−5 (v = −10−5 ) m s, ρ(0, t2 ) is larger (smaller) than the corresponding value when v = 0. This has 22 10 3 4 1 0.8 3 0.6 2 0.4 1 0.2 0 0 1 2 3 0 4 0.5 1 1.5 2 2.5 3 10 -3 10 -3 Fig. 8. PDF of the CIR, fh(t,τ) (h), for v = {0, −10−5 } ms and Fig. 7. CDF of the CIR, Fh(t,τ) (h), at t = 5 ms. t = {25, 100} ms. the following reason. On the one hand, the variance of the movements of the transmitter in each Cartesian coordinate, σtx2 = 2Dtx t2 , is an increasing function of time t2 and independent of v. On the other hand, for v = 10−5 (v = −10−5 ) from) the receiver than for v = 0 m s. m s, on average the transmitter is closer to (farther Thus, at any given time t2 , σtx2 leads to relatively smaller (larger) variations of h(t2, τs ) for the case when v = 10−5 (v = −10−5 ) case when v = 0 m s than for v = 0 m s. m s. m s compared with the This leads to a larger (smaller) value of ρ(0, t2 ) for v = 10−5 (v = −10−5 ) We note the excellent match between simulation and analytical results in Figs. 3-6. B. CDF and PDF of CIR In Fig. 7, the CDF of the impulse response of a time-variant MC channel, Fh(t,τ) (h), is shown for system parameters Dtx = {10−12, 10−13 } m2 s , v x = v y = vz = v = {0, 10−5, −10−5 } m s, a fixed receiver, and time t = 5 ms, i.e., t = 10T. We observe that for all considered values of v, increasing Dtx makes the CDF wider, as for larger values of Dtx the variance of the movements of the transmitter and, as a result, the variance of r®(t) increase, which leads to an increase in the variance of h(t, τ). Furthermore, Fig. 7 shows that for a given Dtx and a fixed receiver, a positive and a negative flow shift the CDF of the CIR to the right and the left, respectively, compared to the case without flow. This is because, e.g. in the presence of a positive flow, the transmitter is pushed towards the receiver and hence, r®(t) decreases. As a result, larger values of h are more likely to occur. Furthermore, the solid black line in Fig. 7 denotes h = hmin = 10−3 , which corresponds to an average error probability of approximately 10−3 . Fig. 7 reveals that 23 10 3 1.4 10 0 1.2 10 -2 1 0.8 10 -4 0.6 0.4 10 -6 0.2 0 0 0.5 1 1.5 2 2.5 3 10 -8 0 50 100 150 10 -3 Fig. 9. PDF of the CIR, fh(t,τ) (h), for v = {0, 10−5 } ms and Fig. 10. NMSE of the PDF of the received signal as a function t = {5, 25} ms. of dimensionless time, t/T. after 5 ms, i.e., after transmission of 10 bits, the outage probability is higher for v = 0 v = −10−5 m s compared to v = 10−5 m s, as for v = {0, −10−5 } m s, m s and transmitter and receiver are on average further apart after 5 ms. We note again the excellent matched between simulation and analytical results. In Fig. 8, the PDF of the time-variant CIR, fh(t,τ) (h), is evaluated for system parameters t = {25, 100} ms, v x = v y = vz = v = {0, −10−5 } m s, Drx = 10−13 m2 s , and a fixed transmitter. For the case of a fixed transmitter, in the presence of a negative flow, e.g., v = −10−5 m s, the receiver first moves towards the transmitter before passing it. Thus, as shown in Fig. 8, first, for t = 25 ms, fh(t,τ) (h) is shifted to the right, and later for t = 100 ms, when the receive is far away from the transmitter, fh(t,τ) (h) is shifted to the left. We note the excellent agreement of the derived expression for fh(t,τ) (h) i.e., (27) with the simulation results. We also observe that the Log-normal distribution provides a good approximation for the PDF of the CIR in Fig. 8, as for all three considered cases, the necessary condition (32) is satisfied. In Fig. 9, fh(t,τ) (h) is depicted for system parameters t = {5, 25} ms, v x = v y = vz = v = {0, −10−5 } m s, Dtx = 10−12 m2 s , and a fixed receiver. In Fig. 9, since the receiver is fixed, in the presence of a positive flow v = 10−5 m s, the transmitter moves towards the receiver, and hence, fh(t,τ) (h) shifts to the right compared to the case without flow, see e.g. for time t = 5 ms. As time increases, the transmitter passes the receiver and r(t) starts to increase, and hence, fh(t,τ) (h) starts to shift to the left. However, in Fig. 9, the effective diffusion coefficient D2 = Dtx = 10−12 m2 s is greater than the effective diffusion coefficient D2 = Drx = 10−13 m2 s in Fig. 8. As a result, the Log-normal distribution approximation starts to deviate from the actual PDF sooner, i.e., at 24 100 10 0 10 -1 10 -1 10 -2 10-2 10 -3 10 -4 10 -3 1 10 20 30 40 10 -5 50 1 10 20 30 40 50 Fig. 11. Expected error probability, Pe (b j ), as a function of Fig. 12. Pe (b j ) as a function of bit interval j for v x = {0, 10−5 } bit interval j. m s 2 and D2 = {1.1, 21} × 10−13 ms . t = 25 ms. This is because for larger values of D2 , condition (32) is violated for smaller t. ? In order to evaluate the accuracy of the proposed approximate PDF, fh(t,τ) (h), in Fig. 10, the ´ ? NMSE of the PDF of the received signal, defined as NMSE = |1/N Afh(t,τ) ( NnA )−1/N Afh(t,τ) ( NnA )| 2 ´  dn |1/N Afh(t,τ) ( NnA )| 2 dn , is evaluated as a function of normalized time, t/T, for system parameters D2 = {10−12, 10−13, 10−14 } m2 s and v = {0, 10−5, −10−5 } m s for a fixed receiver. Fig. 10 shows that, for a given time t, the NMSE grows with the effective diffusion coefficient of transmitter and receiver, D2 . This is because condition (32) is inversely proportional to D2 . In other words, for smaller values of D2 , the maximum time, tmax , that satisfies (32) is larger than for larger values of D2 . For example, in Fig. 10, for D2 = 10−13 ms, while for D2 = 10−12 m2 s and v = 0 m s , tmax m2 s and v = 0 m s , tmax ' 67T = 33.5 ' 7T = 3.5 ms. Furthermore, we can observe that for the considered values of D2 , when v < 0, NMSE is smaller compared to the case when v ≥ 0. This is because for v < 0, r eq (t) in (32) increases more quickly over time, which yields smaller values of NMSE. C. Error Rate Analysis In Fig. 11, the expected error probability, Pe (b j ), is shown as a function of bit interval j in the absence of flow for system parameters Dtx = {0.1, 5, 20, 100} × 10−13 m2 s as well as for the conventional case of fixed transmitter and fixed receiver, i.e., Dtx = Drx = 0. As expected, when transmitter and receiver are fixed, the performances of the detectors with perfect and outdated CSI are identical, as the channel does not change over time. On the other hand, when Dtx > 0, the performances of both detectors deteriorate over time. This is due to the fact that as time increases, 25 i) σ 2 (t) increases and ii) m(t) decreases. Furthermore, the gap between the BERs of the detector with perfect CSI and the detector with outdated CSI increases over time since the impulse response of the channel decorrelates (see Fig. 4), and, as a result, the CSI becomes outdated. Moreover, the CSI becomes outdated faster for larger values of Dtx . Hence, for a given time (bit interval), the absolute value of the performance gap between both cases, highlighted by solid black lines in Fig. 11, increases. For instance, for j = 37, the absolute values of the performance gap between the detectors with perfect and outdated CSI for Dtx = {0.1, 5, 20, 100} × 10−13 m2 s are {0.0013, 0.0212, 0.0624, 0.08}, respectively. In Fig. 12, Pe (b j ) is evaluated as a function of bit interval j for two sets of system parameters. For the first set, we consider a mobile transmitter and receiver in the absence of flow, and adopt Dtx = {0.1, 20} × 10−13 m2 s , Drx = 10−13 m2 s , and v y = vz = v x = 0 m s. For the second set, we consider a mobile transmitter and a fixed receiver in the presence of flow, and assume Drx = 0 m2 s , v y = vz = 0 m s, and v x = 10−5 m s. Furthermore, in order to have a fair comparison between both sets with respect to D2 , for the second set, we adopt Dtx = {1.1, 21} × 10−13 m2 s such that the same values of D2 results for both sets. First of all, Fig. 12 shows that for both considered values of D2 , by increasing v x the performance of both detectors improves. This is because in the presence of positive flow v x = 10−5 m s, r(t) increases on average later in time compared to the case without flow, since the transmitter is moved towards the receiver, and, as a result, the performance of both detectors improves. Furthermore, we can see that the performance gap between the two detectors becomes larger as Dtx decreases. This is because for the detector with outdated CSI, the channel does not only decorrelate over time, but the mean of the channel also changes drastically for smaller values of D2 in the presence of positive flow compared with the case without flow, and as a result, the performance gap between the two detectors is larger for smaller values of D2 . In Fig. 13, the impact of flow on Pe (b j ) is investigated for system parameters Dtx = 5.1×10−13 m2 s , v y = vz = 0 m s, and v x = {0.4, 1, 2.5} × 10−5 diffusion is dominant over the flow (v x = 0.4 × m s . Interestingly, Fig. 13 10−5 ms ), the performance reveals that when of both detection schemes deteriorates over time, as on average r(t) increases. In the intermediate regime (v x = 1 × 10−5 m s ), diffusion and flow essentially cancel out each others’ impact and r(t) remains on average approximately constant. Thus, the BERs of both detectors also remain approximately constant over time. However, in a flow dominated regime (v x = 2.5×10−5 m s ), since r(t) decrease on average over time for the duration of the considered bit intervals, the BER for perfect CSI decreases over time but the BER for outdated CSI still increases because of the inaccurate 26 10 -2 10 -4 10 -6 1 10 20 30 40 50 Fig. 13. Expected error probability, Pe (b j ), as a function of bit interval j. decision threshold. VII. C ONCLUSIONS In this paper, we established a mathematical framework for the statistical characterization of the time-variant CIR of mobile MC channels. In particular, we derived closed-form expressions for the mean, the ACF, the CDF, and the PDF of the time-variant CIR. Furthermore, we approximated the PDF of the CIR by a Log-normal distribution, quantified the regime where this approximation is valid, and proposed a simple model for outdated CSI. Our analytical and simulation results reveal that (1) the coherence time of the channel decreases when transmitter and/or receiver diffuse faster; (2) outages are more likely to occur when flow causes the transmitter and receiver to drift apart and/or transmitter and receiver diffuse faster; (3) the accuracy of the Log-normal approximation of the PDF of the CIR decreases slower over time for smaller effective diffusion coefficients of transmitter and receiver; (4) both CIR decorrelation over time and flow influence the performance gap between detectors employing perfect and outdated CSI, respectively; (5) new modulation, detection, and estimation techniques have to be developed to enable reliable communication of time-variant mobile MC channels. A PPENDIX A P ROOF OF T HEOREM 2 Given (18), substituting h(t1, τ) r®(t)=®r1 and h(t2, τ) r®(t)=®r2 from (11) in (17), we can write φ(t1, t2 ) as ¨ φ(t1, t2 ) = ϕ λ(t2 − t1 )λ(t1 ) 2 r®1, r®2 ∈R3 2 2 ?t ) 2 1 e−α |r®1 −®v τ | e−α |r®2 −®v τ | e−β(t1 ) |r®1 −(®r0 −®v 0 0 | 27 ? (t −t )) 2 2 1 × e−β(t2 −t1 ) |r®2 −(®r1 −®v | d® r2 d® r1 . (44) Expanding the integrands in (44) leads to ˆ +∞ ˆ +∞ 2 2 2 ? 0 0 2 φ(t1, t2 ) = ϕ λ(t2 − t1 )λ(t1 ) ··· e−α( x1 −vx τ) −α( x2 −vx τ) −β(t2 −t1 )( x2 −x1 +vx (t2 −t1 )) −∞ ×e −β(t1 )( x1 −x0 +v? x t1 ) 2 × e−α(z1 −vz τ) 0 −∞ 2  2  2  2 −α y1 −vy0 τ −α y2 −vy0 τ −β(t2 −t1 ) y2 −y1 +vy?(t2 −t1 ) −β(t1 ) y1 +vy?t1  2 ×e 2 2 2 −α( z2 −vz0 τ ) −β(t2 −t1 )( z2 −z1 +vz?(t2 −t1 )) −β(t1 )( z1 +vz?t1 ) dx1 dx2 dy1 dy2 dz1 dz2 . (45) To solve the multiple integrals in (45), we use the PDF integration formula for multivariate Gaussian distributions. In particular, let us assume that vector X = [x1, y1, z1, x2, y2, z2 ]| has a multivariate Gaussian distribution with mean vector µ = E{X} ∈ R6 and covariance matrix Σ = E{(X − µ)(X − µ)| }. Then, the well-known PDF of X is given by   exp − 21 (X − µ)| Σ−1 (X − µ) fX (x1, y1, z1, x2, y2, z2 ) = , p (2π)3 det (Σ) (46) where det(·) denotes the determinant. It can be easily verified that for mean vector µ = [µ x1, µ y1, µz1, µ x2, µ y2, µz2 ] and inverse covariance matrix Σ−1 ϑ 0  =  ψ0 0 0  0 ϑ 0 0 ψ 0 0 0 ϑ 0 0 ψ ψ 0 0 ε 0 0 0 ψ 0 0 ε 0 0 0  ψ 0, 0 ε  (47) where µ x2   ϑ = 2 α + β(t2 − t1 ) + β(t1 ) , ε = 2 α + β(t2 − t1 ) , ψ = −2β(t2 − t1 ) h i  0 τ) + ε+ψ β(t − t )v?(t − t ) + β(t )(x − v?t ) (αv 2 ε−ψ 2 1 x 2 1 1 0 x x 1 ε ε µ x1 = , ϑ − ψ 2 /ε     ε−ψ ε+ψ 0 ? ? 2 ε (αv y τ) + ε β(t2 − t1 )v y (t2 − t1 ) − β(t1 )v y t1 µ y1 = , ϑ − ψ 2 /ε     ε−ψ ε+ψ 0 ? ? 2 ε (αvz τ) + ε β(t2 − t1 )vz (t2 − t1 ) − β(t1 )vz t1 µz1 = , ϑ − ψ 2 /ε 2αv 0y τ − 2β(t2 − t1 )v?y (t2 − t1 ) − ψ µ y1 2αv 0x τ − 2β(t2 − t1 )v?x (t2 − t1 ) − ψ µ x1 = , µ y2 = , ε ε 2αvz0 τ − 2β(t2 − t1 )v?z (t2 − t1 ) − ψ µz1 , (48) µz2 = ε 28  − µ)| Σ−1 (X  − µ) × exp(κ x + κ y + κz ) (with κ x, κ y, κz as given in (20)) is equal to the ´ +∞ ´ +∞ integrands in (45). Now, given that −∞ · · · −∞ fX (x1, y1, z1, x2, y2, z2 ) dx1 . . . dz2 = 1, φ(t1, t2 ) exp − 12 (X can be written as p φ(t1, t2 ) = ϕ2 λ(t2 − t1 )λ(t1 ) exp(κ x + κ y + κz )(2π)3 det(Σ). (49) Given Σ−1 in (47), after some calculations, it can be shown that det (Σ) = 1 ϑ × ε − ψ2 3 . (50) Finally, substituting (50) into (49) leads to (19). A PPENDIX B P ROOF OF T HEOREM 3 For calculation of Fh(t,τ) (h), we first find the distribution of |® r (t) − v®0 τ| 2 . Given the PDF of random variable r®(t) in (10), we obtain for the elements of the vector r®(t)−®v 0 τ = [X(t), Y (t), Z(t)]      ? 0 ? 0 ? 0 X(t) ∼ N x0 − v x t − v x τ, 2D2 t , Y (t) ∼ N −v y t − v y τ, 2D2 t , Z(t) ∼ N −vz t − vz τ, 2D2 t . (51) We can rewrite |® r (t) − v®0 τ| 2 as follows   |® r (t) − v® τ| = X (t) + Y (t) + Z (t) = 2D2 t × X̃ (t) + Ỹ (t) + Z̃ (t) = 2D2 t × r̃ 2 (t), (52)     p p ? ? 0 0 where X̃(t) ∼ N (x0 − v x t − v x τ)/ (2D2 t), 1 , Ỹ (t) ∼ N (−v y t − v y τ)/ (2D2 t), 1 , and Z̃(t)   p ∼ N (−v?z t − vz0 τ)/ (2D2 t), 1 . Given (52), we can rewrite the CIR in (11) as h(t, τ) = ϕ exp(−2 0 2 2 2 2 2 2 2 ×D2 tαr̃ 2 (t)), where r̃ 2 (t) follows a noncentral chi-square distribution with k = 3 degrees of freedom and noncentrality parameter γ(t) = |® r0 −®v?t−®v 0 τ| 2 /2D2 t, i.e., r̃ 2 (t) ∼ χ32 (γ(t)). Therefore, we can calculate the CDF of the CIR of the mobile MC channel as follows      2 Fh(t,τ) (h) = Pr h(t, τ) < h = Pr ϕ exp −2D2 tαr̃ (t) ≤ h ! ! ln ϕ/h ln ϕ/h = Pr r̃ 2 (t) ≥ = 1 − Pr r̃ 2 (t) < , 2D2 tα 2D2 tα (53) where ln(·) denotes the natural logarithm. The last term on the right-hand side of (53) is the CDF of random variable r̃ 2 (t). The CDF of a random variable U ∼ χk2 (γ), i.e., Pr(U ≤ u), is √ √ given by 1 − Q k/2 ( γ, u), where Q m (a, b) denotes the generalized Marcum Q-function of order m [32, Eq. (4.33)] Q m (a, b) = 1 am−1 ˆ ∞ b ! 2 + a2 x x m exp − Im−1 (ax) dx, 2 (54) 29 where Im (·) is the mth-order modified Bessel function of the first kind. Given (53) and (54), we obtain s  © r eq (t) ª ln ϕ/h ®. (55) , Fh(t,τ) (h) = Q3/2 ­­ √ 2D2 tα ® 2D2 t « ¬ In order to further simplify the expression derived in (55), we use the closed-form representation of Q m (a, b) proposed in [33]. There, it has been shown that for the case of m = 0.5n, where n is an odd positive integer, Q m (a, b) is given by [33, Eq. (11)] ! ! m−1.5 k 1 a+b b−a 1 1 Õ b2k Õ (−1)q (2q)! Q m (a, b) = erfc √ + erfc √ + √ 2 2 a 2π k=0 2 k q=0 (k − q)!q! 2 2 ×  2q  Õ    i=0  1 (ab)2q−i i! ! !   2 2     (b − a) (b + a) (−1)i exp −  , a > 0, b ≥ 0. − exp −   2 2     (56) p √ After substituting m = 3/2 = 0.5 × 3, a = r eq (t)/ 2D2 t, and b = ln(ϕ/h)/2D2 tα from (55) into (56), Fh(t,τ) (h) simplifies to (26). R EFERENCES [1] A. Ahmadzadeh, V. Jamali, and R. Schober, “Statistical analysis of time-variant channels in diffusive mobile molecular communications,” Accepted for presentation at IEEE GLOBECOM, 2017. [2] T. Nakano, A. W. Eckford, and T. Haraguchi, Molecular Communication. Cambridge University Press, 2013. [3] I. F. Akyildiz, J. M. Jornet, and M. Pierobon, “Nanonetworks: A new frontier in communications,” Commun. ACM, vol. 54, no. 11, pp. 84–89, Nov. 2011. [4] M. Pierobon and I. F. Akyildiz, “A physical end-to-end model for molecular communication in nanonetworks,” IEEE J. Sel. Areas Commun., vol. 28, no. 4, pp. 602–611, May 2010. [5] Z. Luo, L. Lin, and M. Ma, “Offset estimation for clock synchronization in mobile molecular communication system,” in Proc. IEEE WCNC, Apr. 2016, pp. 1–6. [6] S. Qiu, T. Asyhari, and W. Guo, “Mobile molecular communications: Positional-distance codes,” in Proc. IEEE SPAWC, Jul. 2016, pp. 1–5. [7] W.-K. Hsu, M. R. Bell, and X. Lin, “Carrier allocation in mobile bacteria networks,” in Proc. 49th Asilomar Conference on Signals, Systems and Computers, Nov. 2015, pp. 59–63. [8] V. Jamali, A. Ahmadzadeh, C. Jardin, H. Sticht, and R. Schober, “Channel estimation for diffusive molecular communications,” IEEE Trans. Commun., vol. 64, no. 10, pp. 4238–4252, Oct. 2016. [9] A. Guney, B. Atakan, and O. B. Akan, “Mobile ad hoc nanonetworks with collision-based molecular communication,” IEEE Trans. Mobile Comput., vol. 11, no. 3, pp. 353–366, Mar. 2012. [10] M. Kuscu and O. B. Akan, “A communication theoretical analysis of FRET-based mobile ad hoc molecular nanonetworks,” IEEE Trans. Nanobiosci., vol. 13, no. 3, pp. 255–266, Sep. 2014. [11] T. Nakano, Y. Okaie, S. Kobayashi, T. Koujin, C.-H. Chan, Y.-H. Hsu, T. Obuchi, T. Hara, Y. Hiraoka, and T. Haraguchi, “Performance evaluation of leader-follower-based mobile molecular communication networks for target detection applications,” IEEE Trans. Commun., vol. 65, no. 2, pp. 663–676, Feb. 2017. 30 [12] S. Iwasaki, J. Yang, and T. Nakano, “A mathematical model of non-diffusion-based mobile molecular communication networks,” IEEE Commun. Lett., vol. 21, no. 9, pp. 1969–1972, Sep. 2017. [13] W. Haselmayr, S. M. H. Aejaz, A. T. Asyhari, A. Springer, and W. Guo, “Transposition errors in diffusion-based mobile molecular communication,” IEEE Commun. Lett., vol. 21, no. 9, pp. 1973–1976, Sep. 2017. [14] A. Ahmadzadeh, V. Jamali, A. Noel, and R. Schober, “Diffusive mobile molecular communications over time-variant channels,” IEEE Commun. Lett., vol. 21, no. 6, pp. 1265–1268, jun. 2017. [15] V. Jamali, A. Ahmadzadeh, and R. Schober, “Symbol synchronization for diffusive molecular communication systems.” in Proc. IEEE ICC, 2017, pp. 1–7. [16] T. S. Rappaport, Wireless Communications: Principles and Practice, 2nd ed. Prentice Hall, 2002. [17] A. Noel, K. C. Cheung, and R. Schober, “Improving receiver performance of diffusive molecular communication with enzymes,” IEEE Trans. Nanobiosci., vol. 13, no. 1, pp. 31–43, Mar. 2014. [18] I. Gradshteyn and I. Ryzhik, Table of Integrals, Series, and Products, 7th ed. Academic Press, 2007. [19] S. Zhou and G. B. Giannakis, “Adaptive modulation for multiantenna transmissions with channel mean feedback,” IEEE Trans. Wireless Commun., vol. 3, no. 5, pp. 1626–1636, Sep. 2004. [20] J. L. Vicario, A. Bel, J. A. Lopez-Salcedo, and G. Seco, “Opportunistic relay selection with outdated CSI: outage probability and diversity analysis,” IEEE Trans. Wireless Commun., vol. 8, no. 6, pp. 2872–2876, Jun. 2009. [21] Y. Ma, D. Zhang, A. Leith, and Z. Wang, “Error performance of transmit beamforming with delayed and limited feedback,” IEEE Trans. Wireless Commun., vol. 8, no. 3, pp. 1164–1170, Mar. 2009. [22] V. Jamali, A. Ahmadzadeh, N. Farsad, and R. Schober, “SCW codes for maximum likelihood detection in diffusive molecular communications without channel state information,” Submitted to IEEE Trans. Commun., 2017. [Online]. Available: arXiv:1706.02171 [23] V. Jamali, A. Ahmadzadeh, and R. Schober, “On the design of matched filters for molecule counting receivers,” IEEE Commun. Lett., vol. 21, no. 8, pp. 1711–1714, Aug. 2017. [24] R. J. Muirhead, Aspects of Multivariate Statistical Theory. Wiley-Interscience, 2005. [25] H. Urkowitz, “Energy detection of unknown deterministic signals,” Proc. IEEE, vol. 55, no. 4, pp. 523–531, Apr. 1967. [26] A. Mariani, A. Giorgetti, and M. Chiani, “Effects of noise power estimation on energy detection for cognitive radio applications,” IEEE Trans. Commun., vol. 59, no. 12, pp. 3410–3420, Dec. 2011. [27] R. Tandra and A. Sahai, “SNR walls for signal detection,” IEEE J. Sel. Areas Commun., vol. 2, no. 1, pp. 4–17, Feb. 2008. [28] D. Horgan and C. C. Murphy, “Fast and accurate approximations for the analysis of energy detection in Nakagami-m channels,” IEEE Commun. Lett., vol. 17, no. 1, pp. 83–86, Jan. 2013. [29] A. Ahmadzadeh, H. Arjmandi, A. Burkovski, and R. Schober, “Comprehensive reactive receiver modeling for diffusive molecular communication systems: Reversible binding, molecule degradation, and finite number of receptors,” IEEE Trans. Nanobiosci., vol. 15, no. 7, pp. 713 – 727, Oct. 2016. [30] A. Ahmadzadeh, A. Noel, and R. Schober, “Analysis and design of multi-hop diffusion-based molecular communication networks,” IEEE Trans. Mol. Biol. Multi-Scale Commun., vol. 1, no. 2, pp. 144–157, Jun. 2015. [31] V. Jamali, N. Farsad, R. Schober, and A. Goldsmith, “Non-coherent multiple-symbol detection for diffusive molecular communications,” in Proc. ACM NANOCOM, Sep. 2016, pp. 7:1–7:7. [32] M. K. Simon and M.-S. Alouini, Digital Communication over Fading Channels: A Unified Approach to Performance Analysis, 1st ed. Wiley-Interscience, 2000. [33] R. Li and P. Y. Kam, “Computing and bounding the generalized marcum q-function via a geometric approach,” in Proc. IEEE ISIT, Jul. 2006, pp. 1090–1094.
7cs.IT
Further scramblings of Marsaglia’s xorshift generators arXiv:1404.0390v3 [cs.DS] 23 May 2016 Sebastiano Vigna, Università degli Studi di Milano, Italy xorshift* generators are a variant of Marsaglia’s xorshift generators that eliminate linear artifacts typical of generators based on Z/2Z-linear operations using multiplication by a suitable constant. Shortly after high-dimensional xorshift* generators were introduced, Saito and Matsumoto suggested a different way to eliminate linear artifacts based on addition in Z/232 Z, leading to the XSadd generator. Starting from the observation that the lower bits of XSadd are very weak, as its reverse fails several statistical tests, we explore variants of XSadd using 64-bit operations, and describe in detail xorshift128+, an extremely fast generator that passes strong statistical tests using only three shifts, four xors and an addition. Categories and Subject Descriptors: G.3 [PROBABILITY AND STATISTICS]: Random number generation; G.3 [PROBABILITY AND STATISTICS]: Experimental design General Terms: Algorithms, Experimentation, Measurement Additional Key Words and Phrases: Pseudorandom number generators 1. INTRODUCTION xorshift generators are a simple class of pseudorandom number generators introduced by Marsaglia [2003]. While it is known that such generators have some deficiencies [Panneton and L’Ecuyer 2005], the author has shown recently that high-dimensional xorshift* generators, which scramble the output of a xorshift using multiplication by a constant, pass the strongest statistical tests of the TestU01 suite [L’Ecuyer and Simard 2007]. Shortly after the introduction of high-dimensional xorshift* generators, Saito and Matsumoto [2014] proposed a different way to eliminate linear artifacts: instead of multiplying the output of the underlying xorshift generator (based on 32-bit shifts) by a constant, they add it (in Z/232 Z) with the previous output. Since the sum in Z/232 Z is not linear over Z/2Z, the result should be free of linear artifacts. Their generator XSadd has 128 bits of state and full period 2128 −1. However, while XSadd passes BigCrush, its reverse fails the LinearComp, MatrixRank, MaxOft and Permutation test of BigCrush, which highlights a significant weakness in its lower bits. In this paper, leveraging the theoretical and experimental data about xorshift generators contained in [Vigna 2014], we study xorshift+, a family of generators based on the idea of XSadd, but using 64-bit operations. In particular, we propose a tightly coded xorshift128+ generator that does not fail any test from the BigCrush suite of TestU01 (even reversed) and generates 64 pseudorandom bits in 1.06 ns on an Intel R CoreTM i74770 CPU @3.40GHz (Haswell). It is the fastest full-period generator we are aware of with such empirical statistical properties. 2. xorshift GENERATORS The basic idea of xorshift generators is that the state is modified by applying repeatedly a shift and an exclusive-or (xor) operation. In this paper we consider 64-bit shifts and states made of 2n bits, with n ≥ 7. We usually append n to the name of a family of generators when we need to restrict the discussion to a specific state size. In linear-algebra terms, if L is the 64 × 64 matrix on Z/2Z that effects a left shift of one position on a binary row vector (i.e., L is all zeroes except for ones on the principal subdiagonal) and if R is the right-shift matrix (the transpose of L), each left/right shift/xor Author’s addresses: Sebastiano Vigna, Dipartimento di Informatica, Università degli Studi di Milano, via Comelico 39, 20135 Milano MI, Italy. 2 S. Vigna   can be described as a linear multiplication by I + Ls or I + Rs , respectively, where s is the amount of shifting.1 As suggested by Marsaglia [2003], we use always three low-dimensional 64-bit shifts, but locating them in the context of a larger block matrix of the form2  0 0 0  I 0 0   0 I 0 M =  0 0 I · · · · · · · · · 0 0 0  · · · 0 (I + La )(I + Rb )  ··· 0 0   ··· 0 0 . ··· 0 0   ··· ··· ··· c ··· I (I + R ) It is useful to associate with a linear transformation M its characteristic polynomial P (x) = det(M − xI). The associated generator has maximum-length period if and only if P (x) is primitive over Z/2Z. This happens if P (x) is irreducible and if x has maximum period in the ring of polynomial over Z/2Z modulo P (x). The weight of P (x) is the number of terms in P (x), that is, the number of nonzero coefficients. It is considered a good property for generators of this kind that the weight is close to n/2, that is, that the polynomial is neither too sparse nor too dense [Compagner 1991]. 3. xorshift+ GENERATORS It is known that xorshift generators exhibit a number of linear artifacts, which results in failures in TestU01 tests like MatrixRank, LinearComp and HammingIndep. Nonetheless, very little is necessary to eliminate such artifacts: Marsaglia [2003] suggested multiplication by a constant, which is the approach used by xorshift* [Vigna 2014], or combination with an additive Weyl generator, which is the approach used by Brent [2007] in his xorgens generator. The approach of XSadd can be thought of as a further simplification of the Weyl generator idea: instead of keeping track of a separate generator, XSadd adds (in Z/232 Z) consecutive outputs of an underlying xorshift generator. In this way, we introduce a nonlinear operation without enlarging the state. In practice, this amounts to returning the sum of the currently updated word and of the lastly updated word of the state. Saito and Matsumoto [2014] claim that XSadd does not fail any BigCrush test. This is true of the generator, but not of its reverse (i.e., the generator obtained by reversing the bits of the output). Testing the reverse is important because of the bias towards high bits of TestU01: indeed, the reverse of XSadd fails a number of tests, including some that are not due to linear artifacts, suggesting that it its lower bits are very weak. We are thus going to study the xorshift+ family of generators, which is built on the same idea of XSadd (returning the sum of consecutive outputs of an underlying xorshift generator) but uses 64-bit shifts and the high-dimensional transition matrix proposed by Marsaglia. In this way we can leverage the knowledge gathered about high-dimensional xorshift generators developed in [Vigna 2014]. 1A more detailed study of the linear algebra behind xorshift generators can be found in [Marsaglia 2003; Panneton and L’Ecuyer 2005]. 2 We remark that XSadd uses a slightly different matrix, in which the bottom right element is 1 + Lc . Further scramblings of Marsaglia’s xorshift generators 3 3.1. Equidistribution and full period It is known that a xorshift generator with a state of n bits is n/64-dimensionally equidistributed,3 and that the associated xorshift* generator inherits this property [Vigna 2014]. It is easy to show that a slightly weaker property is true of the associated xorshift+ generator: Proposition 3.1. If a xorshift generator is k-dimensionally equidistributed, the associated xorshift+ generator if (k − 1)-dimensionally equidistributed. Proof. Consider a (k − 1)-tuple ht1 , t2 , . . . , tk−1 i. For each possible value x0 , there is exactly one k-tuple hx0 , x1 , . . . , xk−1 i such that xi−1 + xi = ti (the sum is in Z/264 Z), for 0 < i < k. Thus, there are exactly 264 appearances of the (k − 1)-tuple ht1 , t2 , . . . , tk−1 i in the sequence emitted by a xorshift+ generator associated with a k-dimensionally equidistributed xorshift generator, with the exception of the zero (k − 1)-tuple, for which the appearance associated with the zero k-tuple is missing. Note that in general it is impossible to claim k-dimensional equidistribution. Consider the full-period 6-bit generator that uses 3-bit shifts with a = 1, b = 2 and c = 1. As a xorshift generator with a 3-bit output (the lowest bits), it is 2-dimensionally equidistributed. However, it is easy to verify that the sequence of outputs of the associated xorshift+ generator contains twice the pair of consecutive 3-bit values h000, 000i, so the generator is 1-, but not 2-dimensionally equidistributed. An immediate consequence is that every individual bit of the generator (and thus a fortiori the entire output) has full period: Proposition 3.2. Every bit of a xorshift+ generator with n bits of state has period 2n − 1. Proof. Since n ≥ 7, by Proposition 3.1 a xorshift+ generator is at least 1dimensionally equidistributed, and we just have to apply Proposition 7.1 from [Vigna 2014]. We remark that, similarly to a xorshift or xorshift*4 generator, the lowest bit of a xorshift+ generator satisfies a linear recurrence, as on the lowest bit the effect of an addition is the same as that of a xor. 3.2. Choosing the shifts Vigna [2014] provides choices of shifts for full-period generators with 1024 or 4096 bits of state. In this paper, however, we want to explore the idea of xorshift+ generators with 128 bits of state to provide an alternative to XSadd that is free of its statistical flaws, and faster on modern 64-bit CPUs. Finding generators with a small state space, strong statistical properties and speed comparable with that of a linear congruential generator is an interesting practical goal. We thus computed shifts yielding full-period generators; in particular, we computed all full-period shift triples such that a is coprime with b and a + b ≤ 64 (there are 272 such triples). We then ran experiments following the protocol used in [Vigna 2014], which we briefly recall. We sample generators by executing a battery of tests from TestU01, a framework for testing pseudorandom number generators developed by L’Ecuyer and Simard [2007]. We start at 100 different seeds that are equispaced in the state space. For instance, 3 In this context, a generator with n bits of state and t output bits is k-dimensionally equidistributed if over the whole output every k-tuple of consecutive output values appears 2n−t−k times, except for the zero k-tuple, which appears 2n−t−k − 1 times. 4 It should be remarked that at least the two lowest bits of a xorshift* generator satisfy a linear recurrence; they become three if the multiplier is congruent to 1 modulo 4, as it happens in [Vigna 2014]. 4 S. Vigna Table I. Results of BigCrush on the ten best xorshift128+ generators following Crush. a, b, c 23, 26, 23, 41, 23, 21, 21, 20, 25, 17, 26 19, 5 18, 5 11, 34 31, 18 23, 28 16, 37 21, 11 8, 55 29, 13, 7 S 34 31 38 31 48 53 57 66 48 532 Failures R + 30 64 37 68 32 70 39 70 34 82 31 84 29 86 32 98 190 238 593 1125 Weight Systematic failures 61 53 65 61 57 47 39 51 51 — — — — — — — — BirthdaySpacings 57 RandomWalk1C, RandomWalk1H, RandomWalk1J, RandomWalk1M, RandomWalk1R for a 64-bit state we use the seeds 1 + ib264 /100c, 0 ≤ i < 100. The tests produce a number of statistics, and we use the number of failed tests as a measure of low quality. We consider a test failed if its p-value is outside of the interval [0.001 . . 0.999]. This is the interval outside which TestU01 reports a failure by default. We call systematic a failure that happens for all seeds. A more detailed discussion of this choice can be found in [Vigna 2014]. Note that we run our tests both on a generator and on its reverse, that is, on the generator obtained by reversing the order of the 64 bits returned. The final score is the sum of the number of tests failed by a generator and its reverse. We applied a three-stage strategy using SmallCrush, Crush and BigCrush, which are increasingly stronger test suites from TestU01. We ran SmallCrush on all 272 full-period generators just found, isolating 141 which had less than 10 overall failures. We then ran Crush on the latter ones, and finally BigCrush on the top 10 results. To get an intuition about the relative strength of the two techniques used to reduce linear artifacts (multiplication by a constant in xorshift* generators versus adding outputs in xorshift+ generators), we also performed the same tests on xorshift128* generators, and ran BigCrush on the 20 full-period triples for xorshift1024+ generators reported in [Vigna 2014]. 4. RESULTS In Table I we report the results of BigCrush on the ten best xorshift128+ generators: we show the number of failures of a generator, of its reverse, their sum, the weight of the associated polynomial and, finally, systematic failures, if any; it should be compared with Table III, which report results for the ten best xorshift128* generators. In Table II we report the same data for the 20 full-period generators identified in [Vigna 2014], which should be compared with Table VI therein. All xorshift128* generators fail the MatrixRank test: with this state size, multiplication is not able to hide such linear artifacts from BigCrush. On the other hand, among the best xorshift128+ generators selected by Crush some non-linear systematic failure appears. Table IV compares the BigCrush scores of the generators we discussed. For xorshift128+ we used the triple 23, 18, 5 (Figure 1). For xorshift128* we used the triple 49, 5, 26 and for xorshift1024+/xorshift1024* the triple 31, 11, 30 (the xorshift1024* generator is the one proposed in [Vigna 2014]). Further scramblings of Marsaglia’s xorshift generators 5 Table II. Results of BigCrush on the xorshift1024+ generators. The last five generators fail systematically a large number of tests. a, b, c 16, 23, 30 31, 11, 30 10, 11, 61 40, 11, 31 9, 14, 41 10, 9, 63 31, 33, 37 41, 7, 29 15, 16, 19 27, 13, 46 9, 5, 60 22, 7, 48 7, 16, 55 25, 8, 15 31, 10, 27 3, 26, 35 2, 11, 61 1, 13, 7 47, 1, 41 51, 1, 46 S 31 27 34 30 44 36 35 40 30 45 39 34 39 49 44 698 1108 1521 894 890 Failures R 32 38 33 39 25 34 39 34 45 32 38 44 41 32 39 38 34 46 819 1080 + 63 65 67 69 69 70 74 74 75 77 77 78 80 81 83 736 1142 1567 1713 1970 Weight 59 363 155 77 167 69 79 265 255 275 227 223 65 281 233 89 81 113 99 111 Table III. Results of BigCrush on the ten best xorshift128* generators following Crush. All generators fail a MatrixRank test. a, b, c 26, 17, 13, 49, 49, 40, 28, 16, 44, 16, 9, 27 47, 29 25, 19 5, 26 2, 25 7, 27 5, 33 21, 1 7, 18 19, 22 S 128 131 129 134 128 141 140 143 133 144 Failures R 124 126 130 128 135 129 131 132 153 143 + 252 257 259 262 263 270 271 275 286 287 Weight 29 27 51 63 43 47 39 65 53 45 Our choice of triples is based not only on the BigCrush scores and on polynomial weight, but also on an additional datum: the result of POP (“p-value of p-values”) tests. BigCrush generates 254 p-values, each corresponding to a specific statistics (the same test might generate several statistics). If the source is perfectly random, and the statistics distribution is known exactly, the p-values generated at different points of the state space should appear to be uniformly distributed. We can thus test whether this is true for each one of the 254 6 S. Vigna generated values,5 using a goodness-of-fit test to get a p-value (which is a p-value of p-values): NIST [Rukhin et al. 2001] suggests the threshold 10−4 on a χ2 test on the counts of the p-values falling in the intervals [k/10 . . (k + 1)/10), 0 ≤ k < 10; we used the more stringent value 10−3 on a Kolmogorov-Smirnov test for the uniform (continuous) distribution. The triples we suggest for xorshift+ do not fail any POP test, and the same happens for the xorshift1024* generator suggested in [Vigna 2014]. #include <stdint.h> uint64_t s[2]; uint64_t next(void) { uint64_t s1 = s[0]; const uint64_t s0 = s[1]; const uint64_t result = s0 + s1; s[0] = s0; s1 ^= s1 << 23; // a s[1] = s1 ^ s0 ^ (s1 >> 18) ^ (s0 >> 5); // b, c return result; } Fig. 1. The xorshift128+ generator used in the tests. #include <stdint.h> uint64_t s[16]; int p; uint64_t next(void) { const uint64_t s0 = s[p]; uint64_t s1 = s[p = (p + 1) & 15]; const uint64_t result = s0 + s1; s1 ^= s1 << 31; // a s[p] = s1 ^ s0 ^ (s1 >> 11) ^ (s0 >> 30); // b, c return result; } Fig. 2. The xorshift1024+ generator used in the tests. 5. JUMPING AHEAD The simple form of a xorshift generator makes it trivial to jump ahead quickly by any number of next-state steps. If v is the current state, we want to compute vM j for some j. But M j is always expressible as a polynomial in M of degree lesser than that of the characteristic polynomial. To find such a polynomial it suffices to compute xj mod P (x), where P (x) is the characteristic polynomial of M . Such a computation can be easily carried 5 Actually, four p-values (two from the LongestHeadRun test and two from the Fourier3 test) have been dropped as they are based on rather approximate statistics, as documented by the authors of TestU01, and thus tend to generate spurious errors. Further scramblings of Marsaglia’s xorshift generators 7 k out using standard techniques (quadratures to find x2 mod P (x), etc.), leaving us with a polynomial Q(x) such that Q(M ) = M j . Now, if Q(x) = n X αi xi , i=0 we have vM j = vQ(M ) = n X αi vM i , i=0 i and now vM is just the i-th state after the current one. If we known in advance the αi ’s, computing vM j requires just computing the next state for n times, accumulating by xor the i-th state iff αi 6= 0.6 In general, one needs to compute the αi ’s for each desired j, but the practical usage of this technique is that of providing subsequences that are guaranteed to be non-overlapping. We can fix a reasonable jump, for example 264 for a xorshift128+ generator, and store the αi ’s for such a jump as a bit mask. Operating the jump is now entirely trivial, as it requires at most 128 state changes. In Figure 3 we show the jump function for the generator of Figure 1. By iterating the jump function, one can access 264 non-overlapping sequences of length 264 (except for the last one, which will be of length 264 − 1). #include <stdint.h> void jump(void) { static const uint64_t JUMP[] = { 0x8a5cd789635d2dff, 0x121fd2155c472f96 }; uint64_t s0 = 0; uint64_t s1 = 0; for(int i = 0; i < sizeof JUMP / sizeof *JUMP; i++) for(int b = 0; b < 64; b++) { if (JUMP[i] & 1ULL << b) { s0 ^= s[0]; s1 ^= s[1]; } next(); } s[0] = s0; s[1] = s1; } Fig. 3. The jump function for the generator of Figure 1 in C99 code. It is equivalent to 264 calls to next(). 5.1. Speed Table IV reports the speed of the generators discussed in the paper and of their xorshift* counterparts on an an Intel R CoreTM i7-4770 CPU @3.40GHz (Haswell). We measured the time that is required to emit 64 bits, so in the XSadd case we measure the time required to 6 Brent’s ranut generator [Brent 1992] contains one of the first applications of this technique. 8 S. Vigna Table IV. A comparison of generators. Algorithm xorshift128+ xorshift128* xorshift1024+ xorshift1024* XSadd Speed (ns/64 b) 1.06 1.18 1.32 1.34 S 38 134 27 33 2.06 38 Failures R + 32 70 128 262 38 65 32 65 850 888 W/n Systematic failures 0.50 0.49 0.35 0.35 — MatrixRank — — 0.10 LinearComp, MatrixRank, MaxOft, Permutation Table V. Mean and standard deviation for the data shown in Figure 4. Algorithm xorshift128* xorshift128+ XSadd xorshift1024* xorshift1024+ Mean 0.4996 0.4974 0.4957 0.4935 0.4575 Standard deviation 0.0048 0.0239 0.0302 0.0296 0.1045 emit two 32-bit values. We used suitable options to keep the compiler from unrolling loops or extracting loop invariants. The xorshift128+ case is particularly interesting because we can update the generator paying essentially no cost for the fact that the state is made of more than 64 bits: as it is shown in Figure 1, we just need, while performing an update, to swap the role of the two 64-bit words of state when we move them into temporary variables. The resulting code is incredibly tight, and, as it can be seen in Table IV, gives rise to the fastest generator (also because we no longer need to manipulate the counter that would be necessary to update a xorshift1024+ generator). 5.2. Escaping zeroland We show in Figure 4 the speed at which the generators hitherto examined “escape from zeroland” [Panneton et al. 2006]: purely linearly recurrent generators with a very large state space need a very long time to get from an initial state with a small number of ones to a state in which the ones are approximately half. The figure shows a measure of escape time given by the ratio of ones in a window of 4 consecutive 64-bit values sliding over the first 1000 generated values, averaged over all possible seeds with exactly one bit set (see [Panneton et al. 2006] for a detailed description). Table V condenses Figure 4 into the mean and standard deviation of the displayed values. There are three clearly defined blocks: xorshift128*; then, XSadd, xorshift128+ and xorshift1024*; finally, xorshift1024+. These blocks are reflected also in Table V. The clear conclusion is that the xorshift* approach yields generators with faster escape. 6. CONCLUSIONS We discussed the family of xorshift+ generators—a variant of XSadd based on 64-bit shifts. In particular, we described a xorshift128+ generator that is currently the fastest full-period generator we are aware of that does not fail systematically any BigCrush test (not even reversed), making it an excellent drop-in substitute for the low-dimensional generators found in many programming languages. For example, the current default pseudorandom Further scramblings of Marsaglia’s xorshift generators Average number of ones xorshift128* xorshift1024* xorshift128+ 9 xorshift1024+ XSadd 0.55 0.5 0.45 0.4 0.35 0.3 0.25 0.2 0.15 0.1 0.05 0 1 10 100 1000 Samples Fig. 4. Convergence to “half of the bits are ones in average” plot. number generator of the Erlang language is a custom xorshift116+ generator designed by the author using 58-bit integers and shifts (Erlang uses the upper 6 bits for object metadata, so using 64-bit integers would make the algorithm significantly slower); and the JavaScript engines of Chrome, Firefox and Safari are based on xorshift128+. xorshift128+ can also be easily implemented in hardware, as it requires just three shift, four xors and an addition. Higher-dimensional xorshift+ generators “escape from zeroland” too slowly, making them less interesting than their xorshift* counterpart. REFERENCES Richard P. Brent. 1992. Uniform Random Number Generators for Supercomputers. In Supercomputing, the competitive advantage: proceedings of the Fifth Australian Supercomputing Conference. 5ASC Organising Committee, Melbourne, 95–104. Richard P. Brent. 2007. Some long-period random number generators using shifts and xors. ANZIAM J. 48 (2007), C188–C202. Aaldert Compagner. 1991. The hierarchy of correlations in random binary sequences. Journal of Statistical Physics 63, 5-6 (1991), 883–896. Pierre L’Ecuyer and Richard Simard. 2007. TestU01: A C library for empirical testing of random number generators. ACM Trans. Math. Softw. 33, Article 22 (August 2007). Issue 4. George Marsaglia. 2003. Xorshift RNGs. Journal of Statistical Software 8, 14 (2003), 1–6. François Panneton and Pierre L’Ecuyer. 2005. On the xorshift random number generators. ACM Trans. Model. Comput. Simul 15, 4 (2005), 346–361. François Panneton, Pierre L’Ecuyer, and Makoto Matsumoto. 2006. Improved long-period generators based on linear recurrences modulo 2. ACM Trans. Math. Softw. 32, 1 (2006), 1–16. Andrew Rukhin, Juan Soto, James Nechvatal, Miles Smid, Elaine Barker, Stefan Leigh, Mark Levenson, Mark Vangel, David Banks, Alan Heckert, James Dray, and San Vo. 2001. A Statistical Test Suite For Random and Pseudorandom Number Generators for Cryptographic Applications. National Institute for Standards and Technology, pub-NIST:adr. NIST Special Publication 800-22, with revisions dated May 15, 2001. Mutsuo Saito and Makoto Matsumoto. 2014. XSadd (Version 1.1). (25 March 2014). http://www.math.sci. hiroshima-u.ac.jp/∼m-mat/MT/XSADD/ Sebastiano Vigna. 2014. An experimental exploration of Marsaglia’s xorshift generators, scrambled. CoRR abs/1402.6246 (2014). To appear in ACM Trans. Math. Software.
8cs.DS
arXiv:1606.04471v3 [math.CO] 13 Feb 2017 ON SOFIC APPROXIMATIONS OF PROPERTY (T) GROUPS GÁBOR KUN Abstract. We prove Bowen’s conjecture that every sequence of finite graphs that locally converges to the Cayley graph of a countably infinite group with Kazhdan Property (T) is essentially a vertex-disjoint union of expander graphs. We characterize graph sequences that are essentially a vertex-disjoint union of expander graphs in terms of the Markov operator. We show that a sequence of 2-dimensional complexes that locally converges to the Cayley complex of a finitely presented Property (T) group is not 1hyperfinite: This gives an alternative to the construction of Freedman and Hastings. 1. Introduction A sequence of finite graphs is locally convergent if for every r the isomorphism class of a rooted r-ball centered at a vertex chosen uniformly at random converges in distribution. In particular, a sequence of finite (labeled) graphs converges to a Cayley graph of a finitely generated group if for every r the portion of vertices such that the r-ball centered at this vertex is isomorphic to the r-ball in the Cayley graph goes to one. Our main result is the proof of a conjecture of Lewis Bowen [5]. We prove the following. Theorem 1. Let Γ be a countably infinite Property (T) group and {Gn }∞ n=1 a sequence of finite, bounded degree graphs that locally converges to a Cayley graph of Γ. Then there exists a γ > 0 and a sequence of finite d-regular graphs {G′n }∞ n=1 such that (1) V (Gn ) = V (G′n ) ′ )| n (2) limn→∞ |E(G|Vn )∆E(G =0 (Gn )| (3) For every n the graph G′n is a vertex-disjoint union of γ-expander graphs. This research was supported by Marie Curie IIF Fellowship Grant 627476, by ERC Consolidator Research Grant No. 648017 and by National Research, Development and Innovation Office (NKFIH) Grant ERC HU 15 118286. 1 2 GÁBOR KUN A finitely generated group is called sofic if for any of its labeled Cayley graphs there is a sequence of finite labeled graphs that locally converges to the Cayley graph. (Note that if this holds for one Cayley graph of a group then it will hold for any.) Sofic groups were introduced by Gromov [11], see also Weiss [17]. Many classical conjectures are known to hold for the class of sofic groups: Gottschalk’s conjecture (Gromov [11]), Kaplansky’s direct finiteness conjecture (Elek, Szabó [6]) and Connes’ embedding conjecture (Elek, Szabó [7]). It is a major open problem if every group is sofic, though it is widely believed that non-sofic groups exist. Theorem 1 is expected to be a useful tool in the solution of this fundamental problem. See Pestov [14] for a survey on sofic groups. Our theorem reveals a highly unexpected graph theoretical phenomenon: The local statistics of a sparse graph may (robustly) witness expansion properties. So far in every known case when the local statistics determines the global behavior of a sparse graph the graph is hyperfinite. (A sequence of finite graphs is hyperfinite if for every ε > 0 there is a k > 0 such that by removing ε|V (G)| edges all, but finitely many graphs in the sequence can be broken into components of size at most k.) For example, every minor-closed class is known to be hyperfinite (Benjamini, Schramm, Shapira [4]), and a major result of Schramm states that every sequence of graphs that locally converges to a Cayley graph of an amenable group is hyperfinite [16]. Theorem 1, our main result is a natural counterpart of Schramm’s theorem. Our theorem is the first one for sparse graphs that implies quasirandom global structure under local conditions. The notion of quasirandomness is at the heart of Szemerédi’s regularity lemma and the limit theory of dense graphs: Note that for dense graphs quasirandomness can be implied by local conditions. See the book of Lovász on graph limits for the details [12]. Graph sequences that are essentially a vertex-disjoint union of expander graphs (with uniform expansion) can not be characterized by local conditions: Graphs with large girth may be expander graphs but may also be very far from a disjoint union of expander graphs. (Here we consider the so-called edit distance: The edit distance of two graphs on the same set of vertices is the size of the symmetric difference of the edge sets.) However, we can give a characterization in terms of the Markov operator. M denotes the Markov operator, and k ∗ k denotes the L2 norm with respect to the uniform probability distribution. Theorem 2 is the main tool in the proof of Theorem 1. ON SOFIC APPROXIMATIONS OF PROPERTY (T) GROUPS 3 Theorem 2. Let {Gn }∞ n=1 be a sequence of d-regular graphs. Then the following are equivalent: (1) There exists an ε > 0 such that for every δ > 0 for all, but finitely many n and for every function f : V (Gn ) → [0; 1] the inequality kM 2 f − Mf k ≤ (1 − ε)kMf − f k + δ holds. (2) There exists a γ > 0 and a sequence of d-regular graphs {G′n }∞ n=1 |E(Gn )∆E(G′n )| ′ such that V (Gn ) = V (Gn ), limn→∞ = 0 and every |V (Gn )| ′ Gn is a vertex-disjoint union of γ-expanders. Note that if we had no δ in (1) then Gn would be a vertex-disjoint union of expander graphs with second eigenvalue less than (1 − ε). Here we have to make clear the connection of our decomposition to similar decompositions used to attack Khot’s Unique Games Conjecture: In order to improve the best known algorithm [1] for the Unique Games Conjecture one needs only a positive portion of the edges to be the edge set of a disjoint union of expander graphs, while the expanders in our decomposition consist of essentially every edge, but such decompositions exist for a very special class of graphs only. Theorem 1 gives an ergodic decomposition theorem for certain non-separable probability measure spaces with an invariant group action: Given a sequence of finite labeled graphs that locally approximates the labeled Cayley graph of Γ, the ultraproduct of these graphs will admit an almost free, measure-preserving Γ-action. The support of almost every ergodic measure in the decomposition of the ultraproduct space will be almost an ultraproduct of expanders. Hence these supports can be disjoint in the decomposition. See [5, 8] on ultraproducts of graphs. We apply Theorem 1 to study embeddings of graph sequences converging to the Cayley graph and sequences of 2-dimensional CW complexes converging to the Cayley complex of a Property (T) group. An r-ball in a CW complex centered at a 0-cell x will be the subcomplex spanned by the 0-cells at distance at most r from x, where the distance is the graph distance in the 1-skeleton. A sequence of CW complexes is locally convergent if for every r the isomorphism class of a rooted r-ball centered at a 0-cell chosen uniformly at random converges in distribution. Theorem 3. Consider a sequence of finite CW complexes {Xn }∞ n=1 that converges to a Cayley complex C of a countably infinite Property (T) group. And consider a sequence of finite 1-dimensional CW complexes ∞ {Yn }∞ n=1 and continuous mappings {fn : Xn → Yn }n=1 . Then for every 4 GÁBOR KUN K if n is large enough then there exists a 1-cell in Xn whose image intersects the image of at least K other 1-cells. This is an alternative construction of 2-dimensional non-hyperfinite simplicial complexes in the sense of Freedman and Hastings [9]. Informally speaking, a 2-dimensional simplicial complex is 1-hyperfinite if for every ε > 0 it admits after the removal of an ε-portion of the 0-cells and the higher dimensional cells containing these a continuous mapping to a 1-dimensional complex such that the pre-image of every point has bounded diameter (depending on ε). Corollary 4. Consider a sequence of finite CW complexes that converges to a Cayley complex of a finitely presented infinite Property (T) group, and a sequence {Xn }∞ n=1 of simplicial complexes obtained by the subdivision of the 2-faces of the CW complexes into a bounded number of simplices. Then {Xn }∞ n=1 is not 1-hyperfinite. Theorem 3 has a surprising graph theoretical corollary, too. This answers a question of L. M. Lovász [13]. Corollary 5. 1 Consider a sequence of finite graphs {Gn }∞ n=1 that converges to a Cayley graph corresponding to a finite presentation of a Property (T) group Γ. The sequence {Gn }∞ n=1 admits no L-Lipshitz embedding for any L into a sequence of graphs with bounded degree and girth greater than rL, where r is the length of the shortest relation in the presentation of Γ. Proof. Consider a sequence of large girth graphs, an integer L and a sequence of L-Lipschitz mappings. Let {Xn }∞ n=1 denote the following sequence of 2-dimensional CW-complexes: The 1-skeleton of Xn is Gn and for every cycle of length at most r there is a 2-cell on this cycle. Let {Yn }∞ n=1 denote the sequence of 1-dimensional CW-complexes. And let {fn : Xn → Yn }∞ n=1 a sequence of continuous mappings extending the sequence of the L-Lipschitz mappings: Every 1-cell of Xn will be mapped to the shortest path connecting the image of its two 0-subcells. The image of every short cycle will be null-homotopic by the girth condition, hence the mapping can be extended to 2-cells. Theorem 3 can be applied: The theorem follows, since the degrees are bounded.  1An ineffective version of the corollary can be obtained using that Property (T) groups admit no treeable almost free action [2] and that every subrelation (refinement) of a treeable relation is treeable [10]. This holds also in the case when Γ is not finitely presented. ON SOFIC APPROXIMATIONS OF PROPERTY (T) GROUPS 5 In particular, a sequence of graphs that locally converges to a Property (T) group admits no coarse embedding into any large girth sequence: This gives a new proof of Theorem 9.1. of Mendel and Naor [15]. 2. Definitions We deal with sequences {Gn }∞ n=1 of finite, undirected, d-regular graphs. Finite graphs will be equipped with the uniform measure, where the measure of every vertex is 1/|V (G)|. Given a subset S ⊆ V (G) we denote by |S| the measure of S. Let k ∗ k and k ∗ k1 denote the L2 and L1 norms, respectively. MG will denote the Markov operator of the graph G. We will usually drop the subscript. We say that a d-regular, finite graph G is a γ-expander if for every S ⊆ V (G), where |S| ≤ |V (G)|/2 we have |E(S, V (G) \ S)| ≥ γd|S|. We say that the sequence {Gn }∞ n=1 is essentially a disjoint union of expanders if every Gn can be turned into a vertex-disjoint union of d-regular δ-expander graphs on the same set of vertices after removing and adding o(|V (Gn )|) edges. Given an integer r and a graph G we will consider the following probability distribution on isomorphism classes of rooted graphs: Pick a vertex uniformly at random and consider the isomorphism class of the rooted r-ball centered and rooted at x. We call this sequence of probability distributions the local statistics of G. A sequence of graphs is locally convergent if this probability measure converges in distribution for every r. A graphing is a graph equipped with an extra measurable structure, a generalization of finite graphs (with the uniform measure). The vertex set of a graphing is a probability measure space, the edge set is measurable in the product measure, and the edge set of a graphing is a countable union of measure-preserving, partially defined mappings. The notion of local statistics and local convergence extends to graphings. Every sequence of bounded degree graphs admits a locally convergent subsequence. The most convenient limit objects are the weak limit and the ultraproduct. These are graphings. See Lovász [12] on limits of graphs. The edges of the graph may have an asymmetric labeling by the generating set of a (finitely generated) group. Every unlabeled graph will be undirected in this paper. The notion of local statistics and local convergence extends to labeled graphs and graphings. We define the local statistics for finite CW complexes. Given a CW complex X, a 0-cell x and an integer r the ball B(x, r) will be the following CW complex: the set of 0-cells will be the set of 0-cells in X at distance at most r from x, where we consider the graph distance in 6 GÁBOR KUN the 1-skeleton. And B(x, r) will be the subcomplex spanned by these 0-cells: A cell of X will be in B(x, r) if all of its 0-subcells are in B(x, r). Given an integer r and a CW complex X we will consider the following probability distribution on isomorphism classes of rooted graphs: Pick a 0-cell uniformly at random and consider the isomorphism class of the rooted r-ball centered and rooted at x. A sequence of CW complexes is locally convergent if this probability measure converges in distribution for every r. Given a finitely generated group with its presentation the Cayley complex is a 2-dimensional CW complex: The 1-skeleton of the Cayley complex is the Cayley graph, and there are 2-cells for every cycle that belongs to a relation in the presentation. In other words, the Cayley complex is the universal cover of the presentation complex. We say that the finitely generated group Γ has Kazhdan Property (T) if there is a finite set of generators S and an ε > 0 such that for every Hilbert space H and π : Γ → U(H) unitary representation of Γ P either π has a non-zero, invariant vector, or for A = s∈S π(S)/|S| the inequality kAhk ≤ (1 − ε)khk holds for every h ∈ H \ {0}. See the book of Bekka, de La Harpe and Valette on Property (T) [3]. We will use the following consequence of the Kazhdan Property. Lemma 6. Let Γ be a finitely generated group with Kazhdan Property (T ) with respect to ε > 0 and a finite set of generators S ⊆ Γ. Let H be a P Hilbert space, π : Γ → U(H) a unitary representation of Γ. Set A = s∈S π(S)/|S|. Then for every h ∈ H the inequality kA2 h−Ahk ≤ (1 − ε)kAh − hk holds. Proof. Consider the set of fixed points F = {h ∈ H : π(γ)h = h ∀γ ∈ Γ}. F is a closed subspace of H. The orthogonal complement of F , F ⊥ is a closed subspace invariant under π(γ) for every γ, since π is a unitary representation. Hence F ⊥ is invariant under A. These yield that (Ah − h) ∈ F ⊥ for every h ∈ H. The restriction of the representation π to F ⊥ induces a representation that does not have any fixed point but 0, hence kAgk ≤ (1 − ε)kgk holds for every g ∈ F ⊥ . We conclude that kA2 h−Ahk = kA(Ah−h)k ≤ (1 − ε)kAh − hk.  3. The proof of Theorem 2 Lemma 7. Let G be a finite d-regular graph and M its Markov operator. Consider the set S ⊆ V (G) and the function f : V (G) → [0; 1]. 1 Assume that kf k1 = |S| and kf − χS k < |S| 2 6 . Then there exists a ON SOFIC APPROXIMATIONS OF PROPERTY (T) GROUPS set of vertices U ⊆ supp(f ) such that |U| < 2|S|, |U ∩ S| > 1 1 3 1 kχU − MχU k1 ≤ 4d 2 72 4 |S| 4 kf − Mf k 2 ). 7 3|S| 4 and Proof. Pick a number t ∈ I = ( 21 ; 32 ) uniformly at random and set Ut = {v ∈ V (G) : f (v) > t}. The size of Ut is < 2|S| for every t ∈ I, since f (u) > 21 for every u ∈ Ut and kf k1 = |S|. We show that the size of Ut ∩ S is at least |S| : For every t ∈ I and 2 1 2 every u ∈ / Ut the inequality f (u) < 3 holds. Hence |S \ Ut | 2 (1 − 23 ) < 1 2 kf − χS k < |S|6 . These imply |S \ Ut | < |S| and |Ut ∩ S| > 3|S| . 4 4 We will use for every t ∈P I that k(f − Mf )|{x:f (x)>t} k1 ≥ d1 x,y:f (x)>t≥f (y),(x,y)∈E(G) t − f (y). Integrate this over I in order to get |I|k(f − Mf )|{x:f (x)> 1 } k1 ≥ 2 P 1 2 |[f (x); f (y)] ∩ I| /2. 1 x,y:f (x)> 2 ,(x,y)∈E(G) d Finally, the expected value of kχUt − MχUt k1 is at most X |[f (x); f (y)] ∩ I| X 2 |[f (x); f (y)] ∩ I| ≤ ≤ d|I| d|I| 1 (x,y)∈E(G) f (x)> 2 ,(x,y)∈E(G) 1  X 1 2 2 2 2 |[f (x); f (y)] ∩ I| ≤ (2|S|d) d|I| 1 f (x)> 2 ,(x,y)∈E(G) 1 1 2 (2|S|d) 2 (2d|I|k(f − Mf )|{x:f (x)> 1 } k1 ) 2 = 2 d|I| 1 1 1 4|S| 2 d 2 k(f − Mf )|{x:f (x)> 1 } k12 ≤ 1 2 2 |I| 1 1 3 1 1 1 1 1 4|S| 2 d 2 4|S| 4 2 4 d 2 k(f − Mf )|{x:f (x)> 1 } k 2 (2|S|) 4 ≤ kf − Mf k 2 = 1 1 2 |I| 2 |I| 2 1 1 3 1 4d 2 72 4 |S| 4 kf − Mf k 2 ). There exists a t ∈ I that the required inequality holds for U = Ut .  Lemma 8. Let G be a finite d-regular graph, k > 0 an integer, 0 < c < c′ < 1 and α, δ > 0. Assume that for every S ⊆ V (G) the inequality kM k+1 χS − M k χS k < ckMχS − χS k + δ holds. Then there exists a set 2 of vertices B ⊆ V (G) of size ≤ α2 (cδ′ −c)2 (d2k+2 + 1) such that for every S ⊆ V (G) \ B either kMχS − χS k < αkχS k or kM k+1 χS − M k χS k < c′ kMχS − χS k holds. Proof. Let B ′ be a maximal subset of V (G) under containment such that kM k+1 χB′ − M k χB′ k ≥ c′ kMχB′ − χB′ k and kMχB′ − χB′ k ≥ αkχB′ k. Set B = N2k+2 (B ′ ). 8 GÁBOR KUN First, let S ⊆ V (G) \ B and consider the set S ∪ B ′ . Note that kM k+1 χS∪B′ −M k χS∪B′ k2 = kM k+1 χS −M k χS k2 +kM k+1 χB′ −M k χB′ k2 , and kMχS∪B′ −χS∪B′ k2 = kMχS −χS k2 +kMχB′ −χB′ k2 , since S and B ′ are far from each other. The choice of B ′ implies either kMχS − χS k < αkSk or kM k+1 χS − M k χS k < c′ kMχS − χS k. Now we prove the required upper bound on |B|. Note that kχB k ≤ (d2k+2 + 1)kχB′ k. We know that kM k+1 χB′ − M k χB′ k < ckMχB′ − χB′ k + δ. On the other hand, kM k+1 χB′ − M k χB′ k ≥ c′ kMχB′ − χB′ k and kMχB′ −χB′ k ≥ αkχB′ k. We can conclude that α(c′ −c)kχB′ k ≤ δ, the lemma follows.  Proof. (of Theorem 2) The implication (2) → (1) is straightforward: We know the inequality kM 2 f − Mf k ≤ (1 − ε)kMf − f k if ε > 0 is smaller than the eigenvalue gap, while δ will bound the error term coming from edges added and removed. Now we prove (2) → (1). The following straightforward consequence of (1) will be handy: Claim 1: For every δ > 0 and integer k > 0 for all, but finitely many n and every S ⊆ V (Gn ) the inequality kM k+1 χS − M k χS k ≤ (1 − ε)k kMχS − χS k + δ holds. Claim 2: For every α, β > 0, integer k > 0 and c′ > (1 − ε)k for all, but finitely many n there exists Bnk ⊆ V (Gn ) such that |Bnk | < β and for every S ⊆ V (Gn ) \ Bnk either kχS − MχS k < αkχS k or the inequality kM k+1 χS − M k χS k ≤ c′ kMχS − χS k holds. Proof. The claim follows by Lemma 8.  Claim 3: There exists a γ > 0 such that for every δ > 0 for all, but an finitely Pan many n there exists a partition of V (Gn ) = ∪i=1 Pn,i such that i=0 kMχPn,i − χPn,i k1 < δ, |Pn,0 | < δ and for every 1 ≤ i ≤ an and S ⊆ Pn,i , where |S| ≤ |Pn,i |/2 the inequality kMχS − χS k1 ≥ γkχS k1 holds. 2 ε Proof. Set γ = 36d . Choose α, β > 0 and a positive integer k later. The following process will give the required partition of V (Gn ). Set Pn,0 = Bnk , and for i ≥ 0 proceed as follows: If there is a set S ⊆ V (Gn )\∪ij=0 Pn,j such that kMχS −χS k1 < γ|S| then consider such a set of minimum size. If kMχS −χS k1 < α|S| then set Pn,i+1 = S, else apply Lemma 7 to S and f = M k χS . Both conditions of the lemma hold: Pk k clearly kf k1 = kχS k1 . And kχS − M χS k ≤ i=1 kM i−1 χS − M i χS k < ON SOFIC APPROXIMATIONS OF PROPERTY (T) GROUPS 1 2 1 2 9 1 2 kχS − MχS k/ε ≤ (kχS −MεχS k1 d) < (γ|S|d) = |S|6 . (The previous last ε inequality follows from the fact that on its support |χS − MχS | is between 1/d and 1.) This yields the desired bound. We obtain a set U: set Pn,i+1 = U \ ∪ij=0 Pn,j . The expansion condition holds for the subsets of Pn,i+1 , since |Pn,i+1| < 2|S|, and S is a subset of V (Gn ) \ ∪ij=0 Pn,j of minimum size with small expansion. In what follows we denote S by Sn,i+1 and U by Un,i+1 . The total expansion Pan of the sets in the partition is i=0 kMχPn,i − χPn,i k1 ≤ Pn 3 1 1 1 max{α|Pn,i |, 4|Sn,i | 4 72 4 d 2 kM k+1 χSn,i − M k χSn,i k 2 } ≤ 2β + 2 ai=1 Pn 1 1 1 3 max{α|Pn,i |, 4|Sn,i | 4 72 4 d 2 (c′ kχSn,i − MχSn,i k) 2 } ≤ 2β + 2 ai=1 √ Pn 1 3 1 max{α|Pn,i |, 16|Pn,i| 4 d 2 3c′ |Pn,i | 4 } ≤ 2β + 2 ai=1 √ Pn 1√ 1 |Pn,i | ≤ 2β + max{2α, 16d 2 3c′ }. 2β + 2max{α, 16d 2 3c′ } ai=1 The first inequality uses the bound on Pn,0, Lemma 7 and the fact that even though Pn,i may have large boundary than Un,i , the extra edges belong to the boundary of Pn,j for a j < i, hence we can count this distribution to the boundary of Pn,j by a loss of a multiplicative factor 2. The second inequality uses Claim 2. The third inequality holds since |Sn,i | < 2|Pn,i |, |χSn,i − MχSn,i | is at most 1 and its L1 norm is at most 4|Pn,i |. The right hand side is less than δ if α, β and c′ (> (1 − ε)k ) in Claim 2 are small enough.  Claim 4: There is a γ ′ > 0 such that for every α > 0 for all, but finitely many n the graph Gn can be turned into a vertex-disjoint union of γ ′ -expanders by adding and removing an α-portion of the edges. Proof. If d is odd then we may assume that every class P has even size. We can get such a partition slightly changing the classes (by a single vertex at most) and adding and removing a small number of edges. After these changes the conditions of Claim 3 will still hold. The constants may get worse: Denote the new γ by γ0 . First we remove every edge between different classes. We will make a surgery on (almost) every class separately, while the edge set of a few classes will be simply replaced by an expander. For example, Pn,0 will be replaced. Consider a class P . Let B denote the set of vertices in P adjacent to a vertex not in P . Set r = 6/γ0 . Find a matching M in P such that the distance of any two edges in M is greater than 2r, no vertex of B is adjacent to the an endpoint of an edge in M, and the size of M equals to the half of the number of the edges leaving P . If there is no such M than |E(P, P c)| is too large: This can hold for very few P (o(|V (Gn )|) 10 GÁBOR KUN in total size) only: the edge set of every such P will be replaced by an expander. Now assume that such a matching M exists and let M denote the set of vertices covered by M. Consider a matching N between the vertices of B with multiplicity d minus their degree, i.e., the number of its neighbors not in P and M. Let Q denote the following graph: V (Q) = P, E(Q) = N ∪ {(x, y) ∈ E(G) : x, y, ∈ P } \ M. Q is d-regular. We may assume that Q has diameter at least 2r: Otherwise we have an expansion constant (possibly small). We prove γ0 1 that Q is a γ ′ = 6d = dr -expander. Consider a subset of vertices S ⊆ P |P | of size at most 2 . If |S ∩ (B ∪ M)| < 2γ0 |S|/3 then |EQ (S, P \ S)| ≥ |EGn (S, V (Gn ) \ S)| − |S ∩ (B ∪ M)| ≥ γ0 d/3|S|. If |S ∩ (B ∪ M)| ≥ 2γ0 |S|/3 and |S ∩ M| ≤ γ0 |S|/3 then |EQ (S, P \ S)| ≥ |EQ (S, P \ S) ∩ N | ≥ |S ∩ B| − |S ∩ M| ≥ γ0 |S|/3: Finally, assume that |S ∩ M| > γ0 |S|/3. Consider the ball B(x, r) for every x ∈ S ∩ M: At least half of these balls contains less than r vertices of S, and hence at least one edge in |EQ (S, P \ S)|. We can conclude that |EQ (S, P \ S)| ≥ γ0 |S|/6.   4. The proof of Bowen’s conjecture Consider a sequence of functions {fn : V (Gn ) → [0; 1]}∞ n=1 . We suffice to show by Theorem 2 that there is an ε > 0 that for every δ > 0 and for every sequence of functions {fn : V (Gn ) → [0; 1]}∞ n=1 the 2 inequality kM fn − Mfn k ≤ (1 − ε)kMfn − fn k + δ holds for all, but finitely many n. We choose ε > 0 such that Lemma 6 holds. We will prove by contradiction. Suppose that the inequality fails for infinitely many n. We may suppose that it fails for every n. Consider the graph sequence {Gn }∞ n=1 equipped with the function {fn }∞ , and a weak limit of these. We may suppose that the limit exn=1 ists. This is a graphing on a probability measure space with a function. The connected component of almost every point is isomorphic to the Cayley graph of Γ: Let X denote the probability measure space consisting of these points. We do not have a natural Γ-action on X, hence we will consider the following product space. Let Y denote the set of automorphisms of the rooted Cayley graph: this is a probability measure space, too. The elements of Y are in one-to-one correspondence with a (consistent) labeling of the Cayley graph. The product space Z = X × Y is a probability measure space. Consider the following graph on Z: the vertices (x, y) and (x′ , y ′) are adjacent if x is adjacent to x′ and the labeling y can be obtained from the labeling y ′ by moving the root x′ to x. Every connected component of this graphing ON SOFIC APPROXIMATIONS OF PROPERTY (T) GROUPS 11 is isomorphic to the Cayley graph, and the labeling induces a natural, measure-preserving Γ-action on Z, and hence on L2 (Z). Let f denote the weak limit of the functions fn on X, this naturally induces a function f ∗ on Z. We know by Lemma 6 that for our set of generators and the corresponding ε > 0 for every such probability measure space Z, every measure-preserving, free action of Γ on Z and g ∈ L2 (Z) the inequality kM 2 g − Mgk ≤ (1 − ε)kMg − gk holds, where M denotes the “average of the actions of the generators”. Clearly (Mf )∗ = Mf ∗ , and Mf is the weak limit of the sequence {Mfn }∞ n=1 . The theorem follows by choosing g = f ∗ . 5. The proof of Theorem 3 Lemma 9. Consider a sequence of finite d-regular graphs {Gn }∞ n=1 . ∞ Assume that {Gn }n=1 locally converges to the Cayley graph of a finitely generated infinite group Γ with Property (T). Consider a positive integer L, a prime p and a mapping ϕn : E(Gn ) → {−L, . . . , L} ⊆ Zp . Assume the followings. (1) ϕ((x, y)) = −ϕ((y, x)) for every edge (x, y). (2) Given an integer l consider the sum of ϕn over every cycle of length l. Assume that for every l the portion of cycles with nonzero sum goes to zero as n goes to infinity. (3) Given an integer t > 0 let sn0 , . . . , snt be a random walk on Gn chosen uniformly at P random. Assume that the limit distribution limt→∞ limn→∞ ti=1 ϕn ((sni−1 , sni )) exists, where we consider the statistical distance, and it is equal to the uniform distribution on Zp . Then p ≤ 1 + 4L , γ where γ > 0 is given in Theorem 1. Proof. We may assume that the sequence {Gn }∞ n=1 is expander. The mapping ϕn induces a p-fold covering of Gn , denote the covering graph by Cn . The vertices of the graph Cn are pairs (x, y), where x ∈ Gn and y ∈ Zp , and a pair of vertices (x, y) and (x′ , y ′) is an edge if x and x′ are adjacent and y − y ′ = ϕn ((x, x′ )). Now Zp embeds into the automorphism group of Cn acting on the second coordinate. The sequence {Cn }∞ n=1 converges still to the same Cayley graph, this is the point where we use (2). Hence by Theorem 1 it is essentially a disjoint union of expanders. It is easy to see that it is either essentially an expander or essentially a disjoint union of p expanders isomorphic to Gn , where the Zp -action is essentially permuting these subgraphs. First suppose that (an infinite subsequence of) {Cn }∞ n=1 is essentially an expander sequence: there is a γ > 0 given by Theorem 1 such 12 GÁBOR KUN that for every subset S ⊆ Cn , where |S| < 21 we have |E(S, S c )| ≥ γd|S| + o(1). For every z ∈ Zp the equality |f −1 ({z})| = 1/p holds. Consider the set S = f −1 ({1, . . . , p−1 }). Clearly |S| = p−1 . Since 2 2p 2dL 4L c |E(S, S )| ≤ p , we can conclude that p ≤ 1 + γ . Now suppose that (an infinite subsequence of) {Cn }∞ n=1 is essentially a disjoint union of p expanders isomorphic to Gn . Consider one of these subgraphs essentially isomorphic to Gn . Let f∗ denote the restriction of f to this subgraph, and consider the probability measure on it. We show that |f∗−1 ({z})| = 1/p + o(1) for every z ∈ Zp . The probability that for a random walk of length t we have f (s0 ) ≡ f (st ) converges to 1/p. On the other hand, for a uniform random walk of P length 2t in our component this is equal to z∈Zp kM t χf∗−1 ({z}) k2 ≥ P −1 2 z∈Zp |f∗ ({z})| ≥ 1/p. The second inequality should be (asymptotically) an equality for every component, hence |f∗−1({z})| = 1/p + o(1). Consider the set S = f −1 ({1, . . . , p−1 }). Since |E(S, S c )| ≥ γd|S| + 2 + o(1) we conclude again that p ≤ 1 + 4L .  o(1) and |E(S, S c )| ≤ 2dL p γ Proof. (of Theorem 3) We prove by contradiction. Consider a sequence of finite CW complexes {Xn }∞ n=1 that converges to a Cayley complex C of a finitely generated infinite Property (T) group, a sequence of finite 1dimensional CW complexes {Yn }∞ n=1 , continuous mappings {fn : Xn → ∞ Yn }n=1 and an integer K. Suppose for a contradiction that the image of every 1-cell in Xn intersects the image of at most K other 1-cells. We think of Yn as a graph and use the graph theoretical terminology. We may assume that the image of every 0-cell is a vertex and the image of every 1-cell is a path, since we can change f by a deformation to achieve these. We choose a prime p later. We assign an element of {−1, +1} ⊂ Zp independently at random (with probability 21 each) to a subset of edges of Yn : We will call such edges weighted. To every nonempty set of 1cells in Xn whose image intersects in an edge at least we will assign such a weighted edge in Yn , and to every such set of 1-cells we will assign a different edge. The image of every 1-cell contains less than 2K weighted edges. Let Gn denote the 1-skeleton of Xn , Gn is a graph. We show that the image of a long uniform random walk in Gn under fn contains many weighted edges with high probability or there is a point whose pre-image intersects many 1-cells (if the image of every 1-cell in Xn intersects the image of at most K other 1-cells). Claim: For every k there is a t such that either the image of a uniform random walk of length at least t in Gn (with a uniformly random ON SOFIC APPROXIMATIONS OF PROPERTY (T) GROUPS 13 starting vertex) contains at least k weighted edges with probability at least (1 − 1/k) if n is large enough (depending on k, K). Proof. Choose a starting vertex s0 . Consider the image of the walk under fn . And consider the path between fn (s0 ) and fn (st ) obtained by the removal of the cycles of this walk in Yn . If this path has at most k weighted edges then it can be covered by the image of at most k 1-cells. If there is no point whose pre-image intersects at least K 1cells then there are less than K k+1 possible images of 0-cells reachable via such a short sequence from fn (s0 ), and the probability that the endpoint is the pre-image of any of these 0-cells can be arbitrary small if t and n is large enough.  Consider the mapping ϕn : E(Gn ) → Zp that assigns to every edge of Gn (1-cell of Xn ) the sum of these weights over the edges in its image (with orientation and multiplicity). The values assigned to the weighted edges are chosen uniformly at random from {−1, +1} ⊂ Zp independently. The sum over every path will be distributed identically to the endpoint of a random walk on the cycle of length p, where the number of steps equals to the number of weighted edges on the path. This will converge to the uniform distribution as the length goes to infinity. And the value for paths with disjoint images will be independent, hence we have a concentration. Note that so far we have only used that Xn is large enough and connected. K Choose a prime p > 4 2γ . For every length l the portion of cycles with nonzero sum can be arbitrary small if n is large enough, since C is simply connected and the sum over null-homotopic cycles is zero. Hence condition (2) of Lemma 9 is satisfied. The distribution of the sum over uniform random walks in condition (3) can be arbitrarily close to uniform on Zp if n is large enough, since Xn is large enough and connected. Lemma 9 gives a contradiction, the theorem follows.  References [1] Arora, Sanjeev, Boaz Barak, and David Steurer. ”Subexponential algorithms for unique games and related problems.” Foundations of Computer Science (FOCS), 2010 51st Annual IEEE Symposium on. IEEE, 2010. [2] Adams, S. R., and R. J. Spatzier. ”Kazhdan groups, cocycles and trees.” American Journal of Mathematics (1990): 271-287. [3] Bekka, Bachir, Pierre de La Harpe, and Alain Valette. Kazhdan’s property (T). Vol. 11. Cambridge university press, 2008. [4] Benjamini, Itai, Oded Schramm, and Asaf Shapira. ”Every minor-closed property of sparse graphs is testable.” Proceedings of the fortieth annual ACM symposium on Theory of computing. ACM, 2008. 14 GÁBOR KUN [5] Lewis Bowen, ”Ergodic decompositions of sofic approximations”, manuscript, 2011. [6] G. Elek and E. Szabó, Sofic groups and direct finiteness, Journal of Algebra 280 (2004) 426-434. [7] G. Elek and E. Szabó, Hyperlinearity, essentially free actions and L2-invariants. The sofic property, Math. Ann. 332 (2005) 421-441. [8] G. Elek and B. Szegedy, A measure-theory approach to the theory of dense hypergraphs, Advances in Mathematics 231 (2012) 1731–1772, [9] Freedman, Michael H., and Matthew B. Hastings. ”Quantum systems on nonk-hyperfinite complexes: A generalization of classical statistical mechanics on expander graphs.” Quantum Information & Computation 14.1-2 (2014): 144180. [10] D. Gaboriau, Cout des relations d’equivalence et des groupes, (in French) [Cost of equivalence relations and of groups], Inventiones Mathematicae, 139 (2000), no. 1, 41–98. [11] M. Gromov, Endomorphisms of symbolic algebraic varieties, J. Eur. Math. Soc. 1 (1999) no. 2, 109-197. [12] Lovász, László. Large networks and graph limits. Vol. 60. American Mathematical Soc., 2012. [13] Lovász, László Miklós, Question at Open Problem Session, Graph Theory Meeting, 10-16 January, 2016, MFO, Oberwolfach. [14] Pestov, Vladimir G. ”Hyperlinear and sofic groups: a brief guide.” Bulletin of Symbolic Logic 14.04 (2008): 449-480. [15] Mendel, Manor, and Assaf Naor. ”Nonlinear spectral calculus and superexpanders.” Publications mathmatiques de l’IHS 119.1 (2014): 1-95. [16] O. Schramm. Hyperfinite graph limits. Electron. Res. Announc. Math. Sci., 15 (2008), pp. 1723. [17] B. Weiss, Sofic groups and dynamical systems (Ergodic theory and harmonic analysis, Mumbai, 1999) Sankhya Ser. A. 62 (2000) no. 3, 350-359. E-mail address: [email protected]
4math.GR
Making FPGAs accessible to Scientists and Engineers as Domain Expert Software Programmers with LabVIEW Hugo A. Andrade Simon Hogg Stephan Ahrends National Instruments Berkeley, CA, USA [email protected] National Instruments Austin, TX, USA [email protected] National Instruments Munich, Germany [email protected] The framework presents a platform-based design methodology, which supports multiple models of computation to capture the application at the right domain level, and then helps map that application into several pre-qualified platform targets. These heterogenous targets range from personal computers running desktop operating systems, to embedded real-time processors, to micro-controllers and FPGAs. Abstract— In this paper we present a graphical programming framework, LabVIEW, and associated language and libraries, as well as programming techniques and patterns that we have found useful in making FPGAs accessible to scientists and engineers as domain expert software programmers. Keywords— FPGA; RIO; LabVIEW; software programmers; graphical programming; domain experts I. INTRODUCTION Many scientists and engineers do software programming as a (significant) part of their daily job. Either setting up experiments, taking measurements, developing prototypes, testing their designs, embedding software as part of larger systems, or modeling and analyzing the world around them. The type of software that they develop varies significantly with their domain or task that they are performing, and many times is categorized as scientific programming, embedded programming, test software development, and more recently cyber-physical systems programming, etc. Many of these scientist and engineers are domain experts in other fields like medicine, biology, chemistry, mechanical engineering, etc. and are not formally trained as computer scientists or electrical engineers, but have learned software programming well enough to be proficient in their own domain, and use software programming to their advantage. So having to go even further to understand how to program an FPGA is a foreign concept. For such scientists and engineers having a programming framework that makes their programming job easier is a welcome help. In this paper we present one such framework, (Laboratory Virtual Instrument Engineering LabVIEW Workbench), specifically targeted to scientist and engineers, who need to program as part of their jobs. In addition to highlighting the merits of a visual framework and graphical programming language, we will also show the importance of intuitive and precise access to I/O, and a rich set of library components so that reuse can be exploited. We will also show how such framework has evolved from a programming environment to a system-level development framework for heterogeneous targets. Software programmers will find familiar elements in this flow, and will be eased into more hardware centric elements as needed/beneficial for specific requirements, in particular interfacing to real-world I/O at several levels. This paper is subdivided into the following sections: in Section II we describe the general LabVIEW framework in technical detail, including key language and environment features and the set of libraries supported. In section III we show how this environment can make development for software programmers trying to use FPGAs much easier. What  Is  LabVIEW? Section IV shows a supporting use case. Section V summarizes Publish  Date:  Aug  16,  2013 our conclusions and future direction. Table  of  Contents 1.   What  Makes  Up  LabVIEW? II. THE LABVIEW SOFTWARE DEVELOPMENT FRAMEWORK 2.   Benefits  of  LabVIEW 3.   LabVIEW  –  More  Than  Just  Software LabVIEW is a graphical application programming environment originally developed in the mid 1980’s by National Instruments Corporation for the Data Acquisition LabVIEW  is  a  highly  productive  development  environment  for  creating  custom  applications  that  interact  with  real-­world  data  or (DAQ), Test and Measurement (T&M) and the Industrial signals  in  fields  such  as  science  and  engineering. Automation (IA) markets. It is composed of several well The  net  result  of  using  a  tool  such  as  LabVIEW  is  that  higher  quality  projects  can  be  completed  in  less  time  with  fewer  people  involved. So  productivity  is  the  key  benefit,  but  that  is  a  broad  and  general  statement.  To  understand  what  this  really  means,  consider  the  reasons integrated sub-tools targeted at making the development and that  have  attracted  engineers  and  scientists  to  the  product  since  1986.  At  the  end  of  the  day,  engineers  and  scientists  have  a  job  to  do  – they  have  to  get  something  done,  they  have  to  show  the  results  of  what  they  did,  and  they  need  tools  that  help  them  do  that.  Across prototyping of science and engineering applications that different  industries,  the  tools  and  components  they  need  to  succeed  vary  widely,  and  it  can  be  a  daunting  challenge  to  find  and  use  all these  disparate  items  together.  LabVIEW  is  unique  because  it  makes  this  wide  variety  of  tools  available  in  a  single  environment, require interaction with real-world data and signals very simple ensuring  that  compatibility  is  as  simple  as  drawing  wires  between  functions. and efficient. These sub-tools can be categorized as shown in 1.  What  Makes  Up  LabVIEW? LabVIEW  itself  is  a  software  development  environment  that  contains  numerous  components,  several  of  which  are  required  for  any  type  of Figure 1 [4], and are described in the following sub-sections. test,  measurement,  or  control  application. 4.   Productivity  and  Empowerment  with  LabVIEW NI  LabVIEW  software  is  used  for  a  wide  variety  of  applications  and  industries,  which  can  make  it  challenging  to  answer  the  question: “What  is  LabVIEW?”  I  have  heard  many  conflicting  opinions  and  debates  over  the  years,  so  I  thought  it  would  be  appropriate  to  take  this opportunity  to  discuss  what  LabVIEW  is.   Figure  1.  LabVIEW  contains  several  valuable  components. Fig. 1. LabVIEW Subtools by Category To  quote  one  of  our  software  developers,  “We  write  low-­level  code  so  you  don’t  have  to.”  Our  global  team  of  developers  continually works  on  the  six  areas  called  out  in  Figure  1  to  free  you,  the  LabVIEW  user,  up  to  focus  on  the  bigger  problems  and  tasks  you  are  trying to  solve.     G  Programming  Language Intuitive,  flowchart-­like  dataflow  programming  model Shorter  learning  curve  than  traditional  text-­based  programming Copyright is held by the author/owner(s). 1st International Workshop on FPGAs for Software Programmers (FSP 2014), September 1, 2014, Munich, Germany. Naturally  represents  data-­driven  applications  with  timing  and  parallelism The  G  programming  language  is  central  to  LabVIEW;;  so  much  so  that  it  is  often  called  “LabVIEW  programming.”  Using  it,  you  can  quickly tie  together  data  acquisition,  analysis,  and  logical  operations  and  understand  how  data  is  being  modified.  From  a  technical  standpoint,  G is  a  graphical  dataflow  language  in  which  nodes  (operations  or  functions)  operate  on  data  as  soon  as  it  becomes  available,  rather  than in  the  sequential  line-­by-­line  manner  that  most  programming  languages  employ.  You  lay  out  the  “flow”  of  data  through  the  application graphically  with  wires  connecting  the  output  of  one  node  to  the  input  of  another. 9 A. G Programming Language One of the key subtools is a compiler for the graphical programming language called G. G is a dataflow language that due to its intuitive graphical representation and programmatic syntax has been well accepted in the instrumentation industry, especially by scientists and engineers that are familiar with programming concepts but are not professional software developers and rather domain experts. Using it, they can quickly tie together data acquisition, analysis, and logical operations and understand how data is being modified. Though it is easy to use and flexible, it is built on an elegant and practical model of computation. process of manually taking individual measurements and then trying to correlate, process, and tabulate data by hand. LabVIEW makes the process of integrating hardware much easier by using a consistent programming approach no matter what hardware is being used. The same initialize-configureread/write-close pattern is repeated for a wide variety of hardware devices, data is always returned in a format compatible with the analysis and reporting functions, and the user is not forced to search through instrument programming manuals to find low-level message and register-based communication protocols unless specifically needed. LabVIEW has freely available drivers for thousands of NI and third-party hardware devices (e.g. scientific instruments, data acquisition devices, sensors, cameras, motors and actuators, etc.) In the rare case that a LabVIEW driver does not already exist, the user has tools to create his own, reuse a DLL or other driver not related to LabVIEW, or use low-level communication mechanisms to operate hardware without a driver. The idea behind G was to provide an intuitive flowchartlike block diagram view to the domain expert software programmer, since most scientists and engineers understood that concept; and it became the primary syntactical element in LabVIEW. The semantics follow homogeneous structured dynamic dataflow, which combines constructs from imperative and functional languages [1], where actor nodes (operations or functions called virtual instruments or “VI’s”) operate on data as soon as it becomes available, rather than in the sequential line-by-line manner that most programming languages employ. The VI’s are connected via unidirectional edges (called “wires”) as shown on Figure 2. VI’s are either primitives built into G or sub-VI’s written in the G language. Dataflow allows the user to not worry about memory allocation, garbage collection, and concurrency. The focus is on data, who produces and who consumes it, and what operation is performed on the data, rather than on how to pass data from one place to the other, or when the data arrive. The cross-platform nature of LabVIEW also allows the user to deploy his code to many different computing platforms. In addition to the desktop OSs (Windows, OS X, and Linux), LabVIEW can target embedded real-time controllers, ARM microprocessors, and field-programmable gate arrays (FPGAs), so he can quickly prototype and deploy to the most appropriate hardware platform without having to learn new tool chains. C. Analysis and Technical Code Libraries LabVIEW tailors the G programming language to engineering and scientific use by incorporating hundreds of specialized functions and algorithms that are not typically included with general-purpose programming languages. The user interface is presented through a “front panel” that provides “controls” and “indicators” through which the user sends and receives information. The programmatic hierarchical interface is specified through the connector pane. In addition to the standard programming language constructs, LabVIEW contains functions for: Figure  2.  This  block  diagram  shows  shows  self-­documenting  G  code. Fig. 2. LabVIEW Block Diagram LabVIEW  contains  a  powerful  optimizing  compiler  that  examines  your  block  diagram  and  directly  generates  efficient  machine  code, avoiding  the  performance  penalty  associated  with  interpreted  or  cross-­compiled  languages.  The  compiler  can  also  identify  segments  of code  with  no  data  dependencies  (that  is,  no  wires  connecting  them)  and  automatically  split  your  application  into  multiple  threads  that  can run  in  parallel  on  multicore  processors,  yielding  significantly  faster  analysis  and  more  responsive  control  compared  to  a  single-­threaded, sequential  application. • String, array, and waveform manipulation • Signal processing, including filters, spectral analysis, and transforms • Mathematical analysis, including curve fitting, statistics, differential equations, linear algebra, and interpolation • Communication, including high-level protocols, HTTP, SMTP, FTP, TCP, UDP, Serial, and Bluetooth • Report generation, file I/O, and database connectivity • Add-on packages for specialized disciplines, such as: o Control design and simulation o Sound and vibration analysis windowing, o Machine vision and image processing B. Hardware Support o RF and communication Typically, integrating different hardware devices can be a With  the  debugging  tools  in  LabVIEW,  you  can  slow  down  execution  and  see  the  data  flow  through  your  diagram,  or  you  can  use common  tools  such  as  breakpoints  and  data  probes  to  step  through  your  program  node-­by-­node.  The  combination  of  working  with major pain point when automating any test, measurement, or higher-­level  building  blocks  and  improved  visibility  into  your  application’s  execution  results  in  far  less  time  spent  tracking  down  bugs  in All of the included functions in LabVIEW work seamlessly your  code. control system. Worse yet, not integrating the different with the data acquired from the supported hardware, and no Hardware  Support hardware pieces leads to the hugely inefficient and error-prone Support  for  thousands  of  hardware  devices,  including: special conversion or data movement setup is needed. Scientific  instruments Data  acquisition  devices Sensors Cameras Motors  and  actuators Familiar  programming  model  for  all  hardware  devices Portable  code  that  supports  several  deployment  targets 10 Typically,  integrating  different  hardware  devices  can  be  a  major  pain  point  when  automating  any  test,  measurement,  or  control  system. Worse  yet,  not  integrating  the  different  hardware  pieces  leads  to  the  hugely  inefficient  and  error-­prone  process  of  manually  taking individual  measurements  and  then  trying  to  correlate,  process,  and  tabulate  data  by  hand. These flexible models of computation allow the domain expert to pick the right tool for the particular problem being solved. In any given application the developer is likely to use more than one approach, and LabVIEW is a good tool to quickly tie everything together. D. UI Components and Reporting Tools Every LabVIEW block diagram also has an associated front panel, which is the user interface of the application. On the front panel generic controls and indicators such as strings, numbers, and buttons or technical controls and indicators such as graphs, charts, tables, thermometers, dials, and scales can be placed. These are designed for engineering use, meaning the user can enter SI units such as 4M instead of 4,000,000, change the scale, export data to tools such as NI DIAdem and Microsoft Excel, and they can be completely customized. G. Levels of Abstraction LabVIEW can express functionality at several levels that enable the user to trade off productivity or ease of use with performance of the resulting systems. It provides several ways to accomplish similar tasks, so the user can make balance simplicity and customization on a task-by-task basis. In addition to displaying data as an application is running, LabVIEW also contains several options for generating reports from test or acquired data. The user can send simple reports directly to a printer or HTML file, programmatically generate Microsoft Office documents, or integrate with NI DIAdem for more advanced reporting. Remote front panels and Web service support cab be used to publish data over the Internet with the built-in Web server. Express VIs offer quick and easy configuration of VIs, but are somewhat limited in flexibility. Many of these types of VIs generate lower level G code that can be made accessible to the user as a starting point to develop more flexible code. Third party developers can themselves offer Express VIs to endusers. Non-express VIs, where the Application Programming Interface (API) is exposed directly, are categorized as productive (high-level) or low-level. The most common way to program in LabVIEW is using high-level functions that strike a balance between abstracting the unnecessary administrative tasks such as memory management and format conversion, but keep the flexibility of being able to customize almost every aspect of whatever task you need to accomplish. In contrast, when one needs to be able to completely define every detail of a task, LabVIEW offers the same low-level access as available in traditional programming languages. E. Technology Abstraction LabVIEW quickly adopts technology advances in personal and embedded computing in such a way that the domain expert user gets the new capabilities without having to learn significant new paradigms. Examples of this approach include how LabVIEW is able to automatically generate multithreaded code for execution on multicore processors or program FPGAs to gain the speed and reliability of custom hardware chips without the user needing to learn the underlying details of multithreading, or hardware description languages for FPGAs. The same applies to new OSs, networking protocols, etc. VIs at all levels of abstraction are provided as part of the main libraries, examples, additional libraries, third party libraries, and, in a growing number, by an open community. To deal with the large number of options a comprehensive VI search facility and hyper-linked documentation are provided in the framework. F. Models of Computation When LabVIEW was first released, G was the only way to define the user functionality. Much has changed since then. The user can now pick the most efficient approach to solve the problem at hand. Examine the following considerations: • Graphical data flow is the default model of computation for LabVIEW • Statecharts provide a higher level of abstraction for state-based (control) applications. • Simulation diagrams are a familiar way of modeling and analyzing dynamic systems. • Formula Nodes put simple mathematical formulas in line with the G code. MathScript is math-oriented, textual programming for LabVIEW that can be used to call .m files without the need for extra software. • DLL calls, ActiveX/.NET communication, and the inline C node let the user reuse existing ANSI C/C++ code and code from other programming languages. • CLIP and IP integration nodes import FPGA intellectual property based on VHDL or other HDLs. • Single-cycle Timed Loops (SCTL) provide a synchronous-reactive model of computation for register-transfer level (RTL) hardware design. III. ENABLING FPGAS FOR DOMAIN EXPERT SOFTWARE PROGRAMMERS In this section we present some framework extensions (LabVIEW FPGA [6]) as well as techniques and patterns that focus on making FPGAs more accessible to LabVIEW software programmers, in particular those that are domain experts, focusing on protocol-aware testing, software-defined instruments, and embedded and cyber-physical systems. A. Integrated Synthesis Tools The Xilinx synthesis tools are integrated with LabVIEW FPGA. They are invoked automatically on hidden generated code to create a bitfile to download and run on the FPGA. B. Reference Target Platform In order to make targeting FPGAs more consistent, we defined a canonical FPGA platform that is not limited to just a fabric, but included an instruction processor and attached I/O. It centered on the common use case of real-world I/O access, and was specialized for an FPGA-based computing platform. We call it Reconfigurable I/O (RIO) [5], as shown in Figure 3. 11 There are three main computing engines: an externally attached or internal instruction processor, typically running a real-time operating system, an (optional) remote host computer, typically running a desktop operating system, and the FPGA fabric. All of these computing engines are programmable by LabVIEW. Depending on the application and the knowledge or experience of the programmer, parts of the code may run on the host computer, the real-time computer or the FPGA. The framework attempts to show a consistent programming environment, yet has not hidden the boundaries between these components. investment of code that has been made on the host already, which uses the standard API; matching the original validated FPGA design as well. So a set of side-band interfaces were defined that allow most of the matched FPGA-Host code to continue to operate as originally intended, but allowing for extensibility. The side-band interface includes feature or signature export from the FPGA and import on the host, as well as communication through host-FPGA boundary. E. Effective Use of Hardware-Software Communication In order to be able to start with a design that has most of the code on the instruction processor, and migrates only those part needed to the fabric, we need to minimize the development and run-time cost of doing so. This means that the inter-process communication has to be independent of target and has to be efficient. The LabVIEW RIO framework supports both queue and memory register abstractions to communicate between tasks on the same processor or FPGA, as well as across these entities. If the entities are across a bus, it automatically instantiates DMA channels and engines to support the operation. I/O attached to the FPGA is viewed as part of a RIO target, and has first class representation within the LabVIEW FPGA environment. The nodes present an interface to the program in terms closest to the domain expert, e.g. analog input in engineering units, as opposed to digital protocols to specific analog to digital converters. Similarly control of the timing of the critical I/O operations is done in high-level terms. F. Models of Computation Different jobs require different tools. Similarly, depending on the tasks, the user may want to code application components using different models of computation. Just like in the general framework, multiple models of computation are available for the FPGA. In particular, the general G structured homogeneous dataflow is the default model of computation. The Single Cycle Timed Loop sub-framework discussed below follows a synchronous reactive model of computation consistent with execution on clock ticks. For control applications we also offer a modal model that follows StateCharts syntax and semantics, including hierarchical and concurrent states. Some models of computation like continuous time (mainly for physical subsystem modeling) are not available for implementation on FPGA yet, but are available for co-simulation. Fig. 3. LabVIEW RIO Architecture C. Pre-configured FPGA bit personalities with I/O As we have mentioned, access to real-world I/O is one of most important requirements for the type of domain experts that we are targeting. Yet, many of them do not want to program an FPGA just to have synchronous deterministic access to I/O. The NI Scan Engine [3] enables efficient access to coherent sets of I/O channels attached to the FPGA, using a scan that stores data in a global memory map and updates all values at a single rate, known as the scan period. To do this a specialized IP is placed on the FPGA that interfaces to I/O modules connected to the FPGA. Yet, at the same time, it allows the rest of the fabric to be available for further FPGA computing or connecting to other types of specialized I/O that may not only interface to the Scan Engine. G. Consistent IP and Programming Model As part of making software components portable between targets it is important to not only have a consistent programming language, but also consistent set of libraries that port across most targets. Each of these libraries is optimized and the resource utilization is made clear, either in documentation or as part of the framework information system. H. Optimization D. FPGA Extensions Whenever possible we try to make I/O functionality directly available to the instruction processor, either by using the Scan Engine or other “relaying” techniques. This gives the programmer the most flexibility. In doing so, we make choices on levels of API supported. For example, in the case of RIOenabled RF instruments, we have pre-built bit personalities onto the FPGA that allow the board to appear as a more traditional instrument, by supporting standard APIs for that class of instrument. Yet, domain experts want to make changes and specialize such a software-defined instrument. Such a change in the FPGAs makes it difficult to preserve the 1) Algorithmic IP and High-level Synthesis Optimizing an algorithm for an FPGA can be a complex task since the concurrency and connectivity options are fairly large. As an add-on to the LabVIEW FPGA Module, LabVIEW FPGA IP Builder generates high-performance FPGA IP by leveraging high-level synthesis (HLS) technology. HLS generates efficient hardware designs from three components: 1. an algorithm implemented in a high-level language such as LabVIEW, 2. visual synthesis directives specifying the performance and resource objectives, and 3. an FPGA target with known characteristics. It can be used to 12 automatically optimize FPGA VIs and easily port desktop code to the FPGA. The user is able to quickly explore designs with rapid performance and resource estimates. He can reuse IP, unmodified, to adapt to different application requirements. the application, and only then would they need to target the actual FPGA, so that the compilation time is minimized. L. High-level Language Features Software engineering principles like object-oriented design are very useful to domain experts as well, especially as their code base grows incrementally or when they are starting on large projects to begin with. These techniques are also available in graphical form with LabVIEW and they extend to LabVIEW FPGA as well. 2) Low-level IP and Graphical RTL Abstraction Sometimes in order to optimize an algorithm or to connect to detailed I/O protocols it is necessary to describe the operations at the cycle or register transfer level (RTL). LabVIEW provides the Single Cycle Timed Loop model of computation in which the user, when needed, can describe the operations a cycle at a time. Within this environment the compiler takes advantage of the fact that data needs to only propagate data between adjacent flip-flops and removes part of the logic that would normally ensure that the regular dataflow semantics are followed between VIs. IV. USE CASE To demonstrate some of the framework features and recommended techniques listed in sections II and III, we describe in this section how we developed a device that connects to a regular pair of analog speakers and enables them to play music from iOS devices over the air. To this effect we used the LabVIEW framework and a RIO board to develop an AirPlay-based [7] Wireless Music System (WMS). I. External IP Even if we provide much IP at the high-level, sometimes the end-user either has legacy IP or has available to them IP written in a different programming or hardware description languages. In such a case, it is important to be able to import that IP, and make it appear in a consistent and native form to the LabVIEW framework. CLIP (Component Level IP) and IPIN (IP Integration Nodes) are two ways to import external IP into LabVIEW FPGA. A CLIP Node executes independently and in parallel to the IP developed in LabVIEW FPGA. In addition, CLIP can interface directly with the FPGA clocks and I/O pins. In contrast, the IP Integration Node is inserted into the LabVIEW FPGA block diagram and executes as defined by the dataflow of the LabVIEW VI. As part of the LabVIEW dataflow execution, the IP integration Node provides the ability to verify the overall application behavior and timing using the cycle-accurate simulation tools. Since we wanted for this design to be available as reference for students, we selected as a base interface board the NI myRIO [2], which is an embedded hardware device that introduces students to industry proven RIO technology and allows them to quickly design real, complex engineering systems. In our case, it provides the following platform elements needed for our implementation: 1. Wi-Fi access for over the air music delivery; 2. a Digital to Analog Converter (DAC), connected to audio quality analog output (for analog speakers); and 3. a Xilinx Zynq 7010 all-programmable SoC, implementing the basic RIO architecture elements: a dual-core ARM processor to run the basic protocols, and high-level soft real-time processing; a reconfigurable fabric to interface to the DAC, provide low-level timing, and hard real-time processing. There are a couple of free implementations of the AirPlay protocol [7] for ARM processors running Linux, which we were able to leverage. The main application is developed using LabVIEW RT (Figure 4). It spawns a process running ShairPort, which implements basic protocols and decoding for the music transmitted from iOS devices. ShairPort was compiled from C code available online [7]. To advertise AirPlay service ShairPort searches for an installed Avahi mDNS service (binary opkg) and connects to it directly. J. Soft Computing Targets FPGAs are very flexible, including the development of instruction processors on the fabric. These processors are complete but are not the most powerful, yet the fact that the user can dedicate a processor to a specific I/O component is very useful. Using some of the IP integration mechanisms described above, we have been able to integrate popular soft processors such as MicroBlaze, by using the Xilinx tools to define the processor and its I/O. The I/O then appears as connection to the rest of the LabVIEW FPGA code for setup in accelerated computing or directly attached to I/O. The processor can be programmed today in C, and resulting compiled code can be overlaid onto an existing bit file without recompiling the rest of the fabric portion. The ShairPort process provides the data in lossless format to the main LabVIEW RT processing loop via UNIX pipes. The main loop implements a simple equalizer using a 3channel filter bank (Figure 5), using the built-in libraries. It then passes the data to a Host-FPGA DMA FIFO queue, so that we can implement on the FPGA the only part that really requires very precise timing, namely the 44KHz interface to the analog out port (Figure 6). Notice that as domain experts we do not need to worry about the details of the interface to DAC, but just provide high-level data to the I/O interface. Similarly we described the timing as a simple loop timer that gets the specific timing requirements from the RT processor via a run-time parameter. K. Consistent Debugging Techniques and Simulation In addition to consistent models of computation, libraries and patterns, it is important to have a consistent debugging and simulation flow in between targets as well. In the LabVIEW framework a developer can start development on the host, and can complete all the logic or algorithm development there, then they can move all to the real-time processor in case they need to directly access I/O, and eventually to the LabVIEW FPGA. Once on the FPGA they can see a cycle accurate simulation of The prototype is shown in Figure 7, with the myRIO device attached to the speakers, streaming music from an iPhone. 13 V. CONCLUSIONS AND FUTURE DIRECTIONS REFERENCES In this paper we have presented a graphical programming framework, LabVIEW, and associated language and libraries, as well as programming techniques and patterns that we have found useful in making FPGAs accessible to scientists and engineers as domain expert software programmers. [1] [2] [3] We focused on a single RIO module as target, i.e. one instruction processor, attached fabric and I/O, and we only touched briefly on some of the challenges of networking RIO subsystems. In the future, we would like to focus on networks of RIO modules, and some of the challenges of programming such a system. In particular, we would like view the entire system of processors and FPGA as one large target, i.e. systemlevel synthesis. [4] [5] [6] [7] H. Andrade, and S. Kovner, “Software Synthesis from Dataflow Models for G and LabVIEW™,” in Thirty-second Annual Asilomar Conference on Signals, Systems, and Computers, Pacific Grove, California, U.S.A., November 1998 “NI myRIO, “ originally published online at http://www.ni.com/myrio/ “NI Scan Engine Adavanced I/O Access,” originally publihsed online at http://www.ni.com/white-paper/8071/en/ Hogg, Simon, “What is LabVIEW?”, originally published online at http://www.ni.com/newsletter/51141/en “LabVIEW RIO Architecture”, originally published online at http://www.ni.com/white-paper/10894/en/ “LabVIEW FPGA”, originally published online at http://www.ni.com/fpga/ “AirPlay (Wikipedia)”, originally published online at http://en.wikipedia.org/wiki/AirPlay Fig. 4. LabVIEW Project Explorer View (top left) and LabVIEW Linux RT Top-level App Front Panel (top right) and Block Diagram (bottom) Fig. 5. LabVIEW Linux RT Decoding and Processing BDs Fig. 6. LabVIEW FPGA DAC Timing FP and BD 14 Fig. 7. myRIO WMS Protoytpe
6cs.PL
VGGFace2: A dataset for recognising faces across pose and age Qiong Cao, Li Shen, Weidi Xie, Omkar M. Parkhi and Andrew Zisserman arXiv:1710.08092v1 [cs.CV] 23 Oct 2017 Visual Geometry Group, Department of Engineering Science, University of Oxford {qiong,lishen,weidi,omkar,az}@robots.ox.ac.uk Abstract— In this paper, we introduce a new large-scale face dataset named VGGFace2. The dataset contains 3.31 million images of 9131 subjects, with an average of 362.6 images for each subject. Images are downloaded from Google Image Search and have large variations in pose, age, illumination, ethnicity and profession (e.g. actors, athletes, politicians). The dataset was collected with three goals in mind: (i) to have both a large number of identities and also a large number of images for each identity; (ii) to cover a large range of pose, age and ethnicity; and (iii) to minimize the label noise. We describe how the dataset was collected, in particular the automated and manual filtering stages to ensure a high accuracy for the images of each identity. To assess face recognition performance using the new dataset, we train ResNet-50 (with and without Squeeze-and-Excitation blocks) Convolutional Neural Networks on VGGFace2, on MSCeleb-1M, and on their union, and show that training on VGGFace2 leads to improved recognition performance over pose and age. Finally, using the models trained on these datasets, we demonstrate state-of-the-art performance on the IJB-A and IJB-B face recognition benchmarks, exceeding the previous state-of-the-art by a large margin. Datasets and models are publicly available1 . I. INTRODUCTION Concurrent with the rapid development of deep Convolutional Neural Networks, there has been much recent effort in collecting large scale datasets to feed these datahungry models. In general, recent datasets (see Table I) have explored the importance of intra- and inter-class variation. The former focuses on depth (many images of one subject) and the latter on breadth (many subjects with limited images per subject). However, none of these datasets was specifically designed to explore pose and age variation. We address that here by designing a dataset generation pipeline to explicitly collect images with a wide range of pose, age, illumination and ethnicity variations of human faces. We make the following four contributions: first, we have collected a new large scale dataset, VGGFace2, for public release. It includes over nine thousand identities with between 80 and 800 images for each identity, and more than 3M images in total; second, a dataset generation pipeline is proposed that encourages pose and age diversity for each subject, and also involves multiple stages of automatic and manual filtering in order to minimise label noise; third, we provide template annotation for the test set to explicitly explore pose and age recognition performance; and, finally, we show that training deep Convolutional Neural Networks on the new dataset substantially exceeds the state-of-theart performance on the IJB benchmark datasets [13], [22]. 1 http://www.robots.ox.ac.uk/ ˜vgg/data/vgg_face2/ In particular, we experiment with the recent Squeeze-andExcitation network [9], and also investigate the benefits of first pre-training on a dataset with breadth (MS-Celeb1M [7]) and then fine tuning on VGGFace2. The rest of the paper is organised as follows: We review previous dataset in Section II, and give a summary of existing public dataset in Table I. Section III gives an overview of the new dataset, and describes the template annotation for recognition over pose and age. Section IV describes the dataset collection process. Section V reports the results on the VGGFace2 test set, and state-of-the-art performance of several different architectures on the IJB-A [13] and IJBB [22] benchmarks. II. DATASET REVIEW In this section we briefly review the principal “in the wild” datasets that have appeared recently, inspired by the original Labelled Faces in the Wild (LFW) dataset [10] of 2007. This dataset had 5, 749 identities with 13, 000 images. The CelebFaces+ dataset [20] was released In 2014, with 202, 599 images of 10, 177 celebrities. The CASIA-WebFace dataset [25] released the same year has 494, 414 images of 10, 575 people. The VGGFace dataset [16] released in 2015 has 2.6 million images covering 2, 622 people, making it amongst the largest publicly available datasets. The curated version, where label noise is removed by human annotators, has 800, 000 images with approximately 305 images per identity. Both the CASIA-WebFace and VGGFace datasets were released for training purposes only. MegaFace dataset [12] was released in 2016 to evaluate face recognition methods with up to a million distractors in the gallery image set. It contains 4.7 million images of 672, 057 identities as the training set. However, an average of only 7 images per identity makes it restricted in its per identity face variation. In order to study the effect of pose and age variations in recognising faces, the MegaFace challenge [12] uses the subsets of FaceScrub [14] containing 4, 000 images from 80 identities and FG-NET [15] containing 975 images from 82 identities for evaluation. Microsoft released the large Ms-Celeb-1M dataset [7] in 2016 with 10 million images from 100k celebrities for training and testing. This is a very useful dataset, and we employ it for pre-training in this paper. However, it has two limitations: (i) while it has the largest number of training images, the intra-identity variation is somewhat restricted because of an average of 81 images per person; (ii) images in the training set were directly retrieved from a search engine without manual filtering, and consequently there is label Datasets LFW [10] YTF [23] CelebFaces+ [20] CASIA-WebFace [25] IJB-A [13] IJB-B [22] VGGFace [16] MegaFace [12] MS-Celeb-1M [7] UMDFaces [5] UMDFaces-Videos [4] VGGFace2 (this paper) # of Subjects 5, 749 1, 595 10, 177 10, 575 500 1, 845 2, 622 690, 572 100, 000 8, 501 3, 107 9, 131 # of images 13, 233 3, 425 videos 202, 599 494, 414 5, 712 images, 2, 085 videos 11, 754 images, 7, 011 videos 2.6 M 4.7 M 10 M 367, 920 22, 075 videos 3.31 M # of images per subject 1/2.3/530 19.9 2/46.8/804 11.4 36.2 1, 000/1, 000/1, 000 3/7/2469 100 43.3 87/362.6/843 manual identity labelling Yes Yes pose Yes Yes age Yes Yes Yes TABLE I: Statistics for recent public face datasets. The three entries in the field refer to minimum/average/maximum per subject. noise. The recent UMDFaces [5] dataset contains 367, 920 images of 8, 501 identities (43.3 images per identity). The IARPA Janus Benchmark-A (IJB-A) [13] and BenchmarkB (IJB-B) [22] datasets were released as evaluation benchmarks (only test) for face detection, recognition and clustering in images and videos. Unlike the above datasets which are geared towards imagebased face recognition, the Youtube Face (YTF) [23] and UMDFaces-Videos [4] datasets aim to recognise faces in unconstrained videos. YTF contains 1, 595 identities and 3, 425 videos, whilst UMDFaces-Videos is larger with 3, 107 identities and 22, 075 videos. Apart form these public datasets, Facebook and Google have large in-house datasets. For instance, Facebook [21] trained a face identification model using 500 million images of over 10 million subjects. The face recognition model by Google [18] was trained using 200 million images of 8 million identities. Compared with the public datasets, VGGFace2 is advantageous in two ways: first, the images have large pose, age, ethnicity variations by design; second, with 9131 identities and an average of 362 images per subject, the dataset guarantees both inter- and intra-class variations, while annotation noise is minimized through manual filtering. III. AN OVERVIEW OF THE VGGFACE 2 DATASET A. Dataset Statistics The VGGFace2 dataset contains 3.31 million images from 9131 celebrities spanning a wide range of ethnicities and professions (e.g. politicians and athletes). The Images were downloaded from Google Image Search and show large variations in pose, age, lighting and background. The dataset is approximately gender-balanced, with 59.7% males, varying between 87 and 843 images for each identity, with 362.6 images on average. It includes human verified bounding boxes around faces, and 5 fiducial keypoints predicted by the model of [26]. In addition, pose (yaw, pitch and roll) and apparent age information are estimated by our pre-trained pose and age classifiers. (Pose, age statistics and example images are shown in Figure 1) B. Dataset Split The dataset is divided into two splits: one for training having 8631 classes, and one for evaluation with 500 classes. C. Pose and Age Annotations The VGGFace2 provides annotation to enable evaluation on two scenarios: face matching across different poses, and face matching across different ages. Pose templates. A template here consists of five faces from the same subject with a consistent pose. This pose can be frontal, three-quarter or profile view. For a subset of 300 subjects of the evaluation set, two templates (5 images per template) are provided for each pose view. Consequently there are 1.8K templates with 9K images in total. An examples is shown in Figure 2 (left). Age templates. A template here consists of five faces from the same subject with either an apparent age below 34 (deemed young), or 34 or above (deemed mature). These are provided for a subset of 100 subjects from the evaluation set with two templates for each age period, therefore, there are 400 templates with a total of 2K images. Examples are show in Figure 2 (right). IV. DATASET COLLECTION In this section, we describe the dataset collection process, including: how a list of candidate identities was obtained; how candidate images were collected; and, how the dataset was cleaned up both automatically and manually. The process is summarised in Table II. A. Stage 1: Obtaining and selecting a name list We use a similar strategy to that proposed by [16]. The first stage is to find as many subjects as possible that have a sufficiently distinct set of images available, for example, celebrities and public figures (such as actors, politicians and athletes). An initial list of 500k public figures is obtained from the Freebase knowledge graph [2]. These public figures have considerable ethnic diversity and diversity in profession. An annotator team is then used to remove identities from the candidate list that do not have sufficient distinct images. To this end, for each of the 500K names, 100 images are downloaded using Google Image Search and then shown to human annotators to decide which subjects have sufficient images. To be specific, annotators are instructed to retain subjects for which approximately 90% or more of the 100 images belong to a single identity. This removes candidates (a) pose statistics (b) age statistics (c) John Wesley Shipp (d) Leymah Gbowee (e) Princess Haya Bint Al Hussein (f) Julio César Chávez Jr. (g) Roy Jones Jr. (h) Ruby Lin (i) Additi Gupta (j) Lee Joon-gi Fig. 1: (a-b) VGGFace2 poses and ages statistics. (c-j) example images for eight subjects with different ethnicities. Stage 1 2 3 4 5 6 Aim Name list selection Image downloading Face detection Automatic filtering by classification Near duplicate removal Final automatic and manual filtering Type M A A A A A/M # of subject 500K 9244 9244 9244 9244 9131 total # of images 50.00 million 12.94 million 7.31 million 6.99 million 5.45 million 3.31 million Annotation effort 3 months 12 days 10 days 21days TABLE II: Dataset statistics after each stage of processing in the collection pipeline. who do not have insufficient images or for which Google Image Search returns a mix of people for a single name. In this manner, we reduce the candidates to only 9244 names. Attribute information such as ethnicity and kinship is obtained from DBPedia [1]. This enables the selection of a more diverse spread of ethnicity. B. Stage 2: Obtaining images for each identity We query in Google Image Search and download 1000 images for each subject. To obtain images with large pose and age variations, we then append the keyword ‘sideview’ and ‘very young’ to each name and download 200 images for each. This results in 1400 images for each identity. C. Stage 3: Face detection Faces in the downloaded images are detected using the model provided by [26]. We use the hyper-parameters recommended in that work to favor a good trade-off between precision and recall. This bounding box is then extended by a factor of 0.3 to include the whole head. D. Stage 4: Automatic filtering by classification The aim of this stage is to remove outlier faces for each identity automatically. This is achieved by learning a classifier to identify the faces, and removing possible erroneous faces below a classification score. To this end, 1-vs-rest classifiers are trained to discriminate between the 9244 subjects. Specifically, faces from the top 100 retrieved Fig. 2: VGGFace2 template examples. Left: pose templates from three different viewpoints (arranged by row) – frontal, three-quarter, profile. Right: age templates for two subjects for young and mature ages (arranged by row). images of each identity are used as positives, and the top 100 of all other identities are used as negative for training. The face descriptor features are obtained from the VGGFace [16] model. Then, the scores (between 0 and 1) from the trained model is used to sort images for each subject from most likely to least likely. By manually checking through images from a random 500 subjects, we choose a threshold of 0.5 and remove any faces below this. E. Stage 5: Near duplicate removal The downloaded images also contain exact or near duplicates due to the same images being found at different internet locations, or images differing only slightly in colour balance or JPEG artifacts for example. To alleviate this, duplicate images are removed by clustering VLAD descriptors for all images remaining at stage 4 and only retaining one image per cluster [3], [11]. F. Stage 6: Final automatic and manual filtering At this point, two types of error may still remain: first, some classes still have outliers (i.e. images that do not belong to the person); and second, some classes contain a mixture of faces of more than one person, or they overlap with another class in the dataset. This stage addresses these two types of errors with a mix of manual and automated algorithms. Detecting overlapped subjects. Subjects may overlap with other subjects. For instance, ‘Will I Am’ and ‘William James Adams’ in the candidate list refer to the same person. To detect confusions for each class, we randomly split the data for each class in half: half for training and the other for testing. Then, we train a ResNet-50 [8] and generate a confusion matrix by calculating top-1 error on the test samples. In this manner, we find 20 subjects confused with others. We found that among the confused subjects, there was a subject ‘Tyler Winklevoss’ confused with subject ‘Cameron Winklevoss’. They are twin brothers and were hard to discriminate due to the deficiency of the model. In this stage, we removed 19 noisy classes. In addition, we remove 94 subjects with samples less than 80 images, which results in a final list of 9131 identities. Removing outlier images for a subject. The aim of this filtering, which is partly manual, is to achieve a purity greater than 96%. We found that for some subjects, images with very high classifier scores at stage 4 can also be noisy. This happens when the downloaded images contain couples or band members who always appear together in public. For example, by querying ‘Grutle Kjellson’ in Google Image Search, most of the retrieved images contain the other members of Enslaved. In this case, the classifiers trained with these mixed examples at stage 4 tend to fail. We retrain the model based on the current dataset, and for each identity the classifier score is used to divide the images into 3 sets: H (i.e. high score range [1, 0.95]), I (i.e. intermediate score range (0.95, 0.8]) and L (i.e. low score range (0.8, 0.5]). Human annotators clean up the images for each subject based on their scores, and the actions they carry out depends on whether the set H is noisy or not. If the set (H) contains several different people (noise) in a single identity folder, then set I and L (which have lower confidence scores), will undoubtedly be noisy as well, so all three sets are cleaned manually. In contrast, if set H is clean, then only set L (the lowest scores which is supposed to be the most noisy set) is cleaned up. After this, a new model is trained on the cleaned set H and L, and set I (intermediate scores, noise level is also intermediate) is then cleaned by model prediction. This procedure achieves very low label noise without requiring manual checking of every image. G. Pose and age annotations For the purpose of template annotation, we train two networks to obtain the pose and age information for the dataset. To obtain head pose (roll, pitch, yaw), a 5-way classification ResNet-50 [8] model is trained on CASIA-Web dataset [25]. In particular, the 5 classes are faces having yaw angles in the range [−100, −40), [−40, −10), [−10, 10), [10, 40) and [40, 100) which correspond to left profile, left threequarter, frontal, right three-quarter and right profile views respectively. Then, this trained model is used to predict pose for all the images in the dataset. Similarly, to estimate the apparent age, a 8-way classification ResNet-50 model [8] is trained on IMDB-WIKI 500k+ dataset [17]. Ages of faces are then predicted by this model. V. EXPERIMENTS In this section, we evaluate the quality of the VGGFace2 dataset by conducting a number of baseline experiments. We report the results on the VGGFace2 test set, and evaluate on the public benchmarks IJB-A [13] and IJB-B datasets [22]. The subjects in our training dataset are disjoint with the ones in IJB-A and IJB-B dataset. We also remove the overlap between MS-Celeb-1M and the two benchmarks when training the networks. A. Experimental setup Architecture. ResNet-50 [8] and SE-ResNet-50 [9] (SENet for short) are used as the backbone architectures for the comparison amongst training datasets. The Squeeze-andExcitation (SE) blocks [9] adaptively recalibrate channelwise feature responses by explicitly modelling channel relationships. They can be integrated with modern architectures, such as ResNet, and improves its representational power. This has been demonstrated for object and scene classification, with a Squeeze-and-Excitation network winning the ILSVRC 2017 classification competition. The experiments are developed under four settings: (a) networks are learned from scratch on VGGFace [16] (VF for short); (b) networks are learned from scratch on MS-Celeb-1M (MS1M for short) [7]; (c) networks are learned from scratch on VGGFace2 (VF2 for short); and, (d) networks are first pre-trained on MS1M, and then fine-tuned on VGGFace2 (VF2 ft for short). Training implementation details. During training, a region of 224 × 224 pixels is randomly cropped from each sample, and the shorter side is resized to 256. The mean value of each channel is subtracted for each pixel. Transformation to monochrome augmentation is used with a probability of 20% in order to reduce over-fitting on colour images. Stochastic gradient descent is used with mini-batches of size 256, with a balancing-sampling strategy for each mini-batch due to the unbalanced training distribution. The initial learning rate is 0.1 for the models learned from scratch, and this is decreased twice with a factor of 10 when errors plateau. The weights of the models are initialised as described in [8]. The learning rate for model fine-tuning starts from 0.005 and decrease to 0.001. Similarity computation. In all the experiments (i.e. for both verification and identification) we need to compute the similarity between subjects, where a subject is represented by a template of data, and a template could be a set of faces from images of that subject or a set of faces from a video of that subject. A template is represented by a single vector computed by averaging the face descriptors of each face in the set, and the similarity between two subjects is then computed as the cosine between the vectors representing each template. The only exception to this procedure is in section V-B where SVM classifiers are used for identification. A face descriptor is obtained from the learned networks as follows: the centre 224 × 224 crop of the face image is used. The shorter side is resized to 256, and the CNNs descriptor is computed for this region by extracting the deep features from the layer adjacent to the classifier layer. This leads to a 2048 dimensional descriptor, which is then L2 normalised. B. Experiments on the new dataset In this section, we evaluate ResNet-50 trained from scratch on the three datasets as described in the Sec. V-A on the test set of VGGFace2. We test identification performance and also similarity over pose and age, and validate the capability of VGGFace2 to tackle pose and age variations. Face identification. This scenario aims to predict, for a given test image, whose face it is. Specifically, for each of the 500 subjects in the evaluation set, 50 images are randomly chosen as the testing split and the remaining images are used as the training split. This training split is used to learn 1-vs-rest SVM classifiers for each subject. A top-1 classification error is then used to evaluate the performance of these classifiers on the test images. As shown in Table III, there is a significant improvement for the model trained on VGGFace2 rather than on VGGFace. This demonstrates the benefit of increasing data variation (e.g, subject number, pose and age variations) in the VGGFace2 training dataset. More importantly, models trained on VGGFace2 also achieve better result than that on MS1M even though it has tenfold more subjects and threefold more images, demonstrating the good quality of VGGFace2. In particular, the very low top-1 error of VGGFace2 provides evidence that there is very little label noise in the dataset – which is one of our design goals. Training dataset Top-1 error (%) VGGFace 10.6 MS1M 5.6 VGGFace2 3.9 TABLE III: Identification performance (top-1 classification error) on the VGGFace2 test set for ResNet models trained on different datasets. A lower value is better. Probing across pose. This test aims to assess how well templates match across three pose views: front, three-quarter and profile views. As described in section III-C, 300 subjects in the evaluation set are annotated with pose templates, where each template contains 5 images, and there are six templates for each subject: two each for front, three-quarter view and profile views. These six templates are divided into two sets, A and B, such that each set contains templates for the three poses, and a 3 × 3 similarity matrix is constructed between the two Training dataset front three-quarter profile front 0.5781 0.5706 0.4859 VGGFace three-quarter 0.5679 0.5957 0.5379 profile 0.4821 0.5345 0.5682 front 0.5661 0.5628 0.4776 MS1M three-quarter 0.5582 0.5766 0.5064 profile 0.4715 0.5036 0.5094 front 0.6876 0.6859 0.6264 VGGFace2 three-quarter 0.6821 0.6980 0.6515 profile 0.6222 0.6481 0.6488 TABLE IV: Face probing across poses. Similarity scores are evaluated across pose templates. A higher value is better. Fig. 3: Histograms of similarity scores for front-to-profile matching for the models trained on different datasets. Fig. 4: Two example templates of front-to-profile matching. Left: the similarity scores produced by VGGFace, MS1M, VGGFace2 are 0.41, 0.35 and 0.59, respectively; Right: the scores are 0.41, 0.31 and 0.57, respectively. sets, e.g. the first row corresponds to the front template from A versus the three pose templates from B. Each element of the matrix is the cosine similarity between two templates. Figure 4 visualises two example of these cosine similarity scores for front-to-profile templates. Table IV compares the similarity matrix averaged over the 300 subjects. We can observe that (i) all the three models perform better when matching similar poses, i.e., front-to-front, three-quarter-to-three-quarter and profile-to-profile; and (ii) the performance drops when probing for different poses, i.e., front-to-three-quarter and front-to-profile, showing that recognition across poses is a much harder problem. Figure 3 shows histograms of similarity scores. It is evident that the mass of the VGGFace2 trained model is to the right of the MS1M and VGGFace trained models. This clearly demonstrates the benefit of training on a dataset with larger pose variation. Probing across age. This test aims to assess how well templates match across age, for two ages ranges: young and mature faces. As described in section III-C, 100 subjects in the evaluation set are annotated with age templates, where each template contains 5 images, and there are four templates for each subject: two each for young and mature ages. For each subject a 2 × 2 similarity matrix is computed, where an element is the cosine similarity between two templates. For example, the (1, 1) element corresponds to the first young template against the other young template, and the (1, 2) element is the first young template matched against the mature template. Figure 6 shows two examples of the young-to-mature templates, and their similarity scores. Table V compares the similarity matrix averaged over the 100 subjects as the model changes. For all the three models, there is always a big drop in performance when matching across young and mature faces, which reveals that young-to-mature matching is substantially more challenging than young-to-young and mature-to-mature. Moreover, young-to-young template matching is more difficult than mature-to-mature matching. Figure 5 illustrates the histograms of the young-to-mature template similarity scores. Discussion. In the evaluation of pose and age protocols, models trained on VGGFace2 always present the highest similarity scores, and lowest on MS1M dataset, this can be explained by the fact that the MS1M dataset is designed to focus more on inter-class diversities. This design harms the matching performance across different poses, ages, illustrating the value of the VGGFace2 dataset in having more intra-class diversities that cover large variations in pose and age. Figure 7 shows the top 3 and bottom 3 front-to-profile template matches sorted using the similarity scores produced by the ResNet model trained on VGGFace2. We can observe Training dataset young mature VGGFace young mature 0.5231 0.4338 0.4394 0.5518 MS1M young mature 0.4983 0.4005 0.4099 0.5276 VGGFace2 young mature 0.6256 0.5524 0.5607 0.6637 TABLE V: Face probing across ages. Similarity scores are evaluated across age templates. A higher value is better. Fig. 5: Histograms of similarity scores for young-to-mature matching for the models trained on different datasets. Fig. 6: Two example templates of young-to-mature matching. Left: the similarity scores produced by VGGFace, MS1M, VGGFace2 are 0.42, 0.30 and 0.58, respectively; Right: the scores are 0.43, 0.41 and 0.73, respectively. that the model gives high scores to front-to-profile templates where there is little variation beyond pose; while it gives lower scores to templates where many other variations exist, such as expression and resolution. Figure 8 shows the top 3 and bottom 3 young-to-mature template matches sorted using the similarity scores produced by the ResNet model trained on VGGFace2. It can be seen that the model gives low scores to young-to-mature templates where variations such as pose and occlusion exist. C. Experiments on IJB-A In this section, we compare the performance of the models trained on the different datasets on the public IARPA Janus Benchmark A (IJB-A dataset) [13]. The IJB-A dataset contains 5712 images and 2085 videos from 500 subjects, with an average of 11.4 images and 4.2 videos per subject. All images and videos are captured from unconstrained environment and show large variations in expression and image qualities. As a pre-processing, we detect the faces using MTCNN [26] to keep the cropping consistent between training and evaluation. IJB-A provides ten-split evaluations with two standard protocols, namely, 1:1 face verification and 1:N face identification, where we directly extract the features from the models for the test sets and use cosine similarity score. For verification, the performance is reported using the true accept rates (TAR) vs. false positive rates (FAR) (i.e. receiver operating characteristics (ROC) curve). For identification, the performance is reported using the true positive identification rate (TPIR) vs. false positive identification rate (FPIR) (equivalent with decision error trade-off (DET) curve) and the Rank-N (i.e. the cumulative match characteristic (CMC) curve). Table VI and Figure 9 presents the comparison results. The effect of training set. We first investigate the effect of different training sets based on the same architecture ResNet-50 (Table VI). Based on the same network configuration(learned from scratch), we can observe that the model trained on VGGFace2 outperforms the one of VGGFace by a large margin which has the similar scale (2.6M images) but with fewer subjects and variations. Moreover, the model of VGGFace2 is significantly superior to the one of MS1M which has 10 times subjects over our dataset. Specially, it achieve ∼ 4.4% improvement over MS1M on FAR=0.001 for verification, ∼ 3.7% on FPIR=0.01 and ∼ 1.5% on Rank-1 for identification. When comparing with the results of existing works, the model trained on VGGFace2 surpasses previously reported results on all metrics (best to our knowledge, reported on IJB-A 1:1 verification and 1:N identification protocols), which further demonstrate the advantage of the VGGFace2 dataset. In addition, the generalisation power can be further improved by first training with MS1M and then fine-tuning with VGGFace2 (i.e. “VGGFace2 ft”), however, the differ- Fig. 7: Top 3 and bottom 3 front-to-profile template matches sorted using the similarity score produced by a ResNet model trained on VGGFace2. The front template is on the left, and the profile template on the right in each row. Fig. 8: Top 3 and bottom 3 young-to-mature template matches sorted using the similarity score produced by a ResNet model trained on VGGFace2. The young template is on the left, and the mature template on the right in each row. Training dataset VGGFace [16] MS1M [7] VGGFace2 VGGFace2 ft VGGFace2 VGGFace2 ft Crosswhite et al. [6] Sohn et al. [19] Bansalit et al. [4] Yang et al. [24] Arch. ResNet-50 ResNet-50 ResNet-50 ResNet-50 SENet SENet - FAR=0.001 0.620 ± 0.043 0.851 ± 0.030 0.895 ± 0.019 0.908 ± 0.017 0.904 ± 0.020 0.921 ± 0.014 0.836 ± 0.027 0.649 ± 0.022 0.730† 0.881 ± 0.011 1:1 Verification TAR FAR=0.01 0.834 ± 0.021 0.939 ± 0.013 0.950 ± 0.005 0.957 ± 0.007 0.958 ± 0.004 0.968 ± 0.006 0.939 ± 0.013 0.864 ± 0.007 0.874 0.941 ± 0.008 FAR=0.1 0.954 ± 0.005 0.980 ± 0.003 0.980 ± 0.003 0.986 ± 0.002 0.985 ± 0.002 0.990 ± 0.002 0.979 ± 0.004 0.970 ± 0.001 0.960† 0.978 ± 0.003 FPIR=0.01 0.454 ± 0.058 0.807 ± 0.041 0.844 ± 0.035 0.861 ± 0.027 0.847 ± 0.051 0.883 ± 0.038 0.774 ± 0.049 0.817 ± 0.041 FPIR=0.1 0.748 ± 0.024 0.920 ± 0.012 0.924 ± 0.006 0.936 ± 0.007 0.930 ± 0.007 0.946 ± 0.004 0.882 ± 0.016 0.917 ± 0.009 1:N Identification TPIR Rank-1 Rank-5 0.925 ± 0.008 0.972 ± 0.005 0.961 ± 0.006 0.982 ± 0.004 0.976 ± 0.004 0.992 ± 0.002 0.978 ± 0.005 0.992 ± 0.003 0.981 ± 0.003 0.994 ± 0.002 0.982 ± 0.004 0.993 ± 0.002 0.928 ± 0.010 0.977 ± 0.004 0.895 ± 0.003 0.957 ± 0.002 0.958 ± 0.005 0.980 ± 0.005 Rank-10 0.983 ± 0.003 0.990 ± 0.002 0.995 ± 0.001 0.995 ± 0.001 0.996 ± 0.001 0.994 ± 0.001 0.986 ± 0.003 0.968 ± 0.002 0.986 ± 0.003 TABLE VI: Performance evaluation on the IJB-A dataset. A higher value is better. The values with † are read from [4]. ence is only 0.908 Vs. 0.895. Many existing datasets are constructed by following the assumption of the superiority of wider dataset (more identities) [25], [7], [12], where the huge number of subjects would increase the difficulty on model training. In contrast, VGGFace2 takes both aspects of depth (sample number per subject) and breath (subject number) into account, guaranteeing rich intra-variation and inter-diversity. The effect of architectures. We then investigate the effect of architectures trained on VGGFace2 (Table VI). The compari- Fig. 9: Results on the IJB-A dataset (average over 10 splits). Left: ROC (higher is better); Middle: DET (lower is better); Right: CMC (higher is better). son between ResNet-50 and SENet both learned from scratch reveals that SENet has a consistently superior performance on both verification and identification. More importantly, SENet trained from scratch achieves comparable results to the fine-turned ResNet-50 (i.e. first pre-trained on the MS1M dataset), demonstrating that the diversity of our dataset can be further exploited by an advanced network. In addition, the performance of SENet can be further improved by training on the two datasets VGGFace2 and MS1M, exploiting the different advantages that each offer. D. Experiments on IJB-B The IJB-B dataset is an extension of IJB-A, having 1, 845 subjects with 21.8K still images (including 11, 754 face and 10, 044 non-face) and 55K frames from 7, 011 videos. We evaluate the models on the standard 1:1 verification protocol (matching between the Mixed Media probes and two galleries) and 1:N identification protocol (1:N Mixed Media probes across two galleries). We observe the similar behaviour as in the IJB-A evaluation. For the comparison between different training sets (Table VII and Figure 10), the models trained on VGGFace2 significantly surpass the ones trained on MS1M, and the performance can be further improved by integrating the advantages of two datasets. In addition, SENet’s superiority over ResNet-50 is evident in both verification and identification with the two training settings (i.e. trained from scratch and fine-tuned). Moreover, we also compare the results reported by the benchmark [22] (as shown in Table VII), and there is a considerable improvement over their performance for all of the measures. VI. CONCLUSIONS In this work, we have presented a new large-scale dataset VGGFace2. Compared to most existing face datasets, it has both depth and breadth, and consequently rich intra- and inter-identity diversities. We have also proposed a pipeline for collecting a high-quality dataset with a wide range of pose and age. Furthermore, we presented deep models (ResNet-50 and SENet) trained on VGGFace2, which achieve state-of-the-art performance on the IJB-A and IJB-B benchmarks. Acknowledgments. We would like to thank Momenta2 for data clean up. This research is based upon work supported by the Office of the Director of National Intelligence (ODNI), Intelligence Advanced Research Projects Activity (IARPA), via contract number 2014-14071600010. The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of ODNI, IARPA, or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purpose notwithstanding any copyright annotation thereon. R EFERENCES [1] Dbpedia. http://wiki.dbpedia.org/. [2] Freebase. http://www.freebase.com/. [3] R. Arandjelović and A. Zisserman. All about VLAD. In Proc. CVPR, 2013. [4] A. Bansal, C. Castillo, R. Ranjan, and R. Chellappa. The do’s and don’ts for cnn-based face verification. arXiv preprint arXiv:1705.07426, 2017. [5] A. Bansal, A. Nanduri, C. Castillo, R. Ranjan, and R. Chellappa. Umdfaces: An annotated face dataset for training deep networks. arXiv preprint arXiv:1611.01484, 2016. [6] N. Crosswhite, J. Byrne, C. Stauffer, O. Parkhi, Q. Cao, and A. Zisserman. Template adaptation for face verification and identification. In Automatic Face & Gesture Recognition (FG), pages 1–8. IEEE, 2017. [7] Y. Guo, L. Zhang, Y. Hu, X. He, and J. Gao. Ms-celeb-1m: A dataset and benchmark for large-scale face recognition. In Proc. ECCV, 2016. [8] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In CVPR, pages 770–778, 2016. [9] J. Hu, L. Shen, and G. Sun. Squeeze-and-Excitation networks. arXiv preprint arXiv:1709.01507, 2017. [10] G. B. Huang, M. Ramesh, T. Berg, and E. Learned-Miller. Labeled faces in the wild: A database for studying face recognition in unconstrained environments. Technical report, 2007. [11] H. Jegou, F. Perronnin, M. Douze, J. Sánchez, P. Perez, and C. Schmid. Aggregating local image descriptors into compact codes. TPAMI, 34(9):1704–1716, 2012. [12] I. Kemelmacher-Shlizerman, S. M. Seitz, D. Miller, and E. Brossard. The megaface benchmark: 1 million faces for recognition at scale. In CVPR, pages 4873–4882, 2016. [13] B. F. Klare, B. Klein, E. Taborsky, A. Blanton, J. Cheney, K. Allen, P. Grother, A. Mah, and A. K. Jain. Pushing the frontiers of unconstrained face detection and recognition: Iarpa janus benchmark a. In CVPR, pages 1931–1939, 2015. [14] H.-W. Ng and S. Winkler. A data-driven approach to cleaning large face datasets. In ICIP, pages 343–347. IEEE, 2014. [15] G. Panis and A. Lanitis. An overview of research activities in facial age estimation using the fg-net aging database. In ECCV, pages 737– 750. Springer, 2014. 2 https://momenta.ai/ Training dataset Arch. VGGFace [16] MS1M [7] VGGFace2 VGGFace2 ft VGGFace2 VGGFace2 ft Whitelam et al. [22] ResNet-50 ResNet-50 ResNet-50 ResNet-50 SENet SENet - FAR=1E − 5 0.342 0.548 0.647 0.671 0.671 0.705 0.350 1:1 Verification TAR FAR=1E − 4 FAR=1E − 3 0.535 0.711 0.743 0.857 0.784 0.878 0.804 0.891 0.800 0.888 0.831 0.908 0.540 0.700 FAR=1E − 2 0.850 0.935 0.938 0.947 0.949 0.956 0.840 FPIR=0.01 0.429 ± 0.024 0.662 ± 0.036 0.701 ± 0.038 0.702 ± 0.041 0.706 ± 0.047 0.743 ± 0.037 0.420 FPIR=0.1 0.635 ± 0.015 0.810 ± 0.028 0.824 ± 0.034 0.843 ± 0.032 0.839 ± 0.035 0.863 ± 0.032 0.640 1:N Identification TPIR Rank-1 Rank-5 0.752 ± 0.038 0.843 ± 0.032 0.865 ± 0.053 0.917 ± 0.032 0.886 ± 0.032 0.936 ± 0.019 0.894 ± 0.039 0.940 ± 0.022 0.901 ± 0.030 0.945 ± 0.016 0.902 ± 0.036 0.946 ± 0.022 0.790 0.850 Rank-10 0.874 ± 0.026 0.936 ± 0.024 0.953 ± 0.013 0.954 ± 0.016 0.958 ± 0.010 0.959 ± 0.015 0.900 TABLE VII: Performance evaluation on the IJB-B dataset. A higher value is better. The results of [22] are read from the curves reported in the paper. Note, [22] has a different evaluation for the verification protocol where pairs generated from different galleries are evaluated separately and averaged to get the final results. Fig. 10: Results on the IJB-B dataset across gallery sets S1 and S2. Left: ROC (higher is better); Middle: DET (lower is better); Right: CMC (higher is better). [16] O. M. Parkhi, A. Vedaldi, and A. Zisserman. Deep face recognition. In Proc. BMVC., 2015. [17] R. Rothe, R. Timofte, and L. Van Gool. Dex: Deep expectation of apparent age from a single image. In CVPR Workshops, pages 10–15, 2015. [18] F. Schroff, D. Kalenichenko, and J. Philbin. Facenet: A unified embedding for face recognition and clustering. In CVPR, pages 815– 823, 2015. [19] K. Sohn, S. Liu, G. Zhong, X. Yu, M.-H. Yang, and M. Chandraker. Unsupervised domain adaptation for face recognition in unlabeled videos. In Proc. ICCV, 2017. [20] Y. Sun, X. Wang, and X. Tang. Deep learning face representation from predicting 10,000 classes. In CVPR, pages 1891–1898, 2014. [21] Y. Taigman, M. Yang, M. Ranzato, and L. Wolf. Web-scale training for face identification. In CVPR, pages 2746–2754, 2015. [22] C. Whitelam, E. Taborsky, A. Blanton, B. Maze, J. Adams, T. Miller, N. Kalka, A. K. Jain, J. A. Duncan, K. Allen, et al. Iarpa janus benchmark-b face dataset. In CVPR Workshop on Biometrics, 2017. [23] L. Wolf, T. Hassner, and I. Maoz. Face recognition in unconstrained videos with matched background similarity. In CVPR, pages 529–534. IEEE, 2011. [24] J. Yang, P. Ren, D. Zhang, D. Chen, F. Wen, H. Li, and G. Hua. Neural aggregation network for video face recognition. In CVPR, pages 4362–4371, 2017. [25] D. Yi, Z. Lei, S. Liao, and S. Z. Li. Learning face representation from scratch. arXiv preprint arXiv:1411.7923, 2014. [26] K. Zhang, Z. Zhang, Z. Li, and Y. Qiao. Joint face detection and alignment using multitask cascaded convolutional networks. IEEE Signal Processing Letters, 23(10):1499–1503, 2016.
1cs.CV
Logical Methods in Computer Science Vol. 8 (1:11) 2012, pp. 1–32 www.lmcs-online.org Submitted Published Jun. 10, 2011 Feb. 27, 2012 A SYSTEM F ACCOUNTING FOR SCALARS PABLO ARRIGHI a AND ALEJANDRO DÍAZ-CARO b a ENS-Lyon, Laboratoire LIP and Université de Grenoble, Laboratoire LIG, France e-mail address: [email protected] b Université de Grenoble, Laboratoire LIG and Université Paris-Nord, Laboratoire LIPN, France e-mail address: [email protected] Abstract. The algebraic lambda-calculus and the linear-algebraic lambda-calculus extend the lambda-calculus with the possibility of making arbitrary linear combinations of terms. In this paper we provide a fine-grained, System F -like type system for the linear-algebraic lambda-calculus. We show that this “Scalar ” type system enjoys both the subject-reduction property and the strong-normalisation property, our main technical results. The latter yields a significant simplification of the linear-algebraic lambda-calculus itself, by removing the need for some restrictions in its reduction rules. But the more important, original feature of the Scalar type system is that it keeps track of ‘the amount of a type’ that is present in each term. As an example of its use, we show that it can serve as a guarantee that the normal form of a term is barycentric, i.e that its scalars are summing to one. 1. Introduction (Linear-)algebraic λ-calculi. A number of recent works seek to endow the λ-calculus with a vector space structure. This agenda has emerged simultaneously in two different contexts. • The field of Linear Logic considers a logic of resources where the propositions themselves stand for those resources – and hence cannot be discarded nor copied. When seeking to find models of this logic, one obtains a particular family of vector spaces and differentiable functions over these. It is by trying to capture back these mathematical structures into a programming language that Ehrhard and Regnier have defined the differential λ-calculus [ER03], which has an intriguing differential operator as a built-in primitive and and an algebraic module of the λ-calculusterms over natural numbers. Lately Vaux [Vau07, Vau09] has focused his attention on a ‘differential λ-calculus without differential operator’, extending the algebraic module to positive real numbers. He obtained a confluence result 1998 ACM Subject Classification: F.4.1. Key words and phrases: linear-algebraic λ-calculus; type theory; barycentric calculus. An extended abstract of an earlier version of this paper has appeared in [ADC11]. b This work was partially supported by grants from DIGITEO and Région Île-de-France. l LOGICAL METHODS IN COMPUTER SCIENCE c DOI:10.2168/LMCS-8 (1:11) 2012 CC P. Arrighi and A. Díaz-Caro Creative Commons 2 P. ARRIGHI AND A. DÍAZ-CARO in this case, which stands even in the untyped setting. More recent works on this algebraic λ-calculus tend to consider arbitrary scalars [Ehr10, Tas09]. • The field of Quantum Computation postulates that, as computers are physical systems, they may behave accordingto the quantum theory. It proves that, if this is the case, novel, more efficient algorithms are possible [Sho97, Gro96] – which have no classical counterpart. Whilst partly unexplained, it is nevertheless clear that the algorithmic speed-up arises by tapping into the parallelism granted to us ‘for free’ by the superposition principle; which states that if t and u are possible states of a system, then so is the formal linear combination of them α.t + β.u (with α and β some arbitrary complex numbers, up to a normalizing factor). The idea of a module of λ-terms over an arbitrary scalar field arises quite naturally in this context. This was the motivation behind the linear-algebraic λ-calculus by Dowek and one of the authors [AD08], who obtained a confluence result which holds for arbitrary scalars and again covers the untyped setting. These two languages are rather similar: they both merge higher-order computation, be it terminating or not, in its simplest and most general form (namely the untyped λ-calculus) together with linear algebra in its simplest and most general form also (the axioms of vector spaces). In fact they can simulate each other [DCPTV10]. Our starting point is the second one, also referred to as Lineal in this work: because its confluence proof allows arbitrary scalars and because one has to make a choice. Whether the models developed for the first language, and the type systems developed for the second language, carry through to one another via their reciprocal simulations, is a current topic of investigation. Other motivations to study (linear-)algebraic λ-calculi. The two languages are also reminiscent of other works in the literature: • Algebraic and symbolic computation. The functional style of programming is based on the λ-calculus together with a number of extensions, so as to make everyday programming more accessible. Hence since the birth of functional programmingthere have been several theoretical studies on extensions of the λ-calculus in order to account for basic algebra (see for instance Dougherty’s algebraic extension [Dou92] for normalising terms of the λ-calculus) and other basic programming constructs such as pattern-matching [CKL01, AMR09], together with sometimes non-trivial associated type theories [Pet09]. Whilst this was not the original motivation behind (linear-)algebraic λ-calculi, they could still be viewed as just an extension of the λ-calculus in order to handle operations over vector spaces and make programmingmore accessible upon them. The main difference in approach is that the λ-calculus is not seen here as a control structure which sits on top of the vector space data structure, controlling which operations to apply and when. Rather, the λ-calculus terms themselves can be summed and weighted, hence they actually are vectors, upon which they can also act. • Parallel and probabilistic computation. The above intertwinings of concepts are essential if seeking to represent parallel or probabilistic computation as it is the computation itself which must be endowed with a vector space structure. The ability to superpose λ-calculus terms in that sense takes us back to Boudol’s parallel λ-calculus [Bou94]. It may also be viewed as being part of a series of works on probabilistic extensions of calculi, e.g. [BH03, HP00] and [dP95, DHW05, DZ11] for λ-calculus more specifically. A SYSTEM F ACCOUNTING FOR SCALARS 3 Hence (linear-)algebraic λ-calculi can be seen as a platform for various applications, ranging from algebraic computation, probabilistic computation, quantum computation and resourceaware computation. Imposing the existence of a norm in (linear-)algebraic λ-calculi. We do not explore any of the above-mentioned fields of applications specifically in this paper. The theory of vector spaces has many fields of applications, but also many theoretical refinements that must be studied in their own right. We take the view that, in the same way, the theory of vector spaces plus λ-calculus has got theoretical refinements that we must study. Moreover, some of these theoretical refinements are often pre-requisite in order to address other applications, as is notoriously the case with the notion P of norm. For instance if we want to be able to interpret a linear combination of terms αi .ti as a probability distribution, we need to make sure that it has norm one. The same is true if we want to interpret P αi .ti as quantum superposition, but with a different norm1. Yet the very definition of a norm is difficult in our context: deciding whether a term terminates is undecidable; but these terms can produce infinities (e.g. a non terminating term which reduces to itself plus 1), hence convergence of the norm is undecidable. Related to this precise topic, Vaux has studied simply typed algebraic λ-calculus, ensuring convergence of the norm [Vau07, Vau09]. Tasson has studied model-theoretic properties of the barycentric fragment of this simplytyped algebraic λ-calculus. Ehrhard has proven [Ehr10] the convergence of a Taylor series expansion of algebraic λ-calculus terms, via a System F type system [Gir71, Rey74] . Therefore, it can be said that standard type systems provide part of the solution: they ensure the convergence of (the existence of the norm of) a term. And indeed it is not so hard to define a simple extension of System F that fits Lineal – just by providing the needed rules to type additions, scalar products and the null vector in some trivial manner (see Definition 5.1). In this paper we do provide a full-blown proof of strong normalisation for this type system. A byproduct of this result is that we are able to lift several conditions that were limiting the reduction rules of Lineal and still prove its confluence. This is because the purpose of these conditions was really to prevent indefinite forms from reducing (e.g. t − t, with t a divergent term). Hence the result together with its byproduct make Lineal into a simpler language. Imposing a given norm in (linear-)algebraic λ-calculi. Standard type systems only provide a part of the to impose that well-typed terms P solution; they are unable for instance P have normal form αi .ti with the constraint that αi = 1, a property which is referred to as barycentricity in the previous literature [Tas09]. Our main contribution in this paper is to have managed a type system of a novel kind, Scalar, which has the ability to keep track of ‘the amount of a type’ by summing the amplitudes of its contributing terms and reflecting this amount through scalars within the types. As an example application of the Scalar type system, we have demonstrated that the type system can be used to enforce the barycentric property (see section 6), thereby specializing Lineal into a barycentric, higherorder λ-calculus. 1Whereas it is clear already that Lineal is a quantum λ-calculus, in the sense that any quantum algorithm can be expressed in this language [AD08], the converse, alas, is not true, in the sense that some programs in Lineal express evolutions which are not quantum algorithms. This is precisely because Lineal does not P valid restrict its vectors to be normalized |αi |2 = 1 and its applications to be isometries relative to this norm. 4 P. ARRIGHI AND A. DÍAZ-CARO Endowing Lineal with a non-trivial, more informative, fine-grained type system was quite a challenge, as the reader will judge. We believe that fine-grained type theories for these non-deterministic, parallel, probabilistic or quantum extensions of calculi, which capture how many processes are in what class of states (with what weight), constitute truly promising routes towards relevant, less ad-hoc quantitative logics. Plan. Section 2 presents an overview of the linear-algebraic λ-calculus (Lineal) [AD08]. Section 3 presents the Scalar type system with its grammar, equivalences and inference rules. Section 4 shows the subject reduction property giving consistency to the system. Section 5 shows the strong normalisation property for this system, allowing us to lift the above discussed restrictions in the reduction rules. In section 6 we formalize the type system B for barycentric calculi. Section 7 concludes. 2. Linear-algebraic λ-calculus Intuitions. As a language of terms, Lineal is just the λ-calculus together with the possibility to make arbitrary linear combinations of terms: if t and r are two terms, α.t + β.r is also a term. Regarding the operational semantics, Lineal merges higher-order computation, be it terminating or not, in its simplest and most general form (the β-reduction of the untyped λ-calculus) together with linear algebra in its simplest and most general form also (the oriented axioms of vector spaces). Care must be taken, however, when merging these two families of reduction rules. For instance the term (λx xx)(α.t + β.u) maybe thought of as reducing to (α.t + β.u)(α.t + β.u) in a call-by-name-oriented view or to α.(tt) + β.(uu) in a call-by-valueoriented view, also compatible with the view that application should be bilinear, just as in linear algebra (cf. Application rules, below). Leaving both options open would break confluence, the second option was chosen, which entails restricting the β-reduction to terms not containing sums or scalars in head position (cf. Beta reduction rule, below). Instead of introducing vector spaces via an oriented version of their axioms (e.g. α.u + β.u → (α + β).u), one could have decided to perform the β-reduction ‘modulo equality in the theory of vector spaces’ (e.g. α.u + β.u = (α + β).u). But there is a good reason not to do that. Define a fixed point operator Y = λy (λx (y + xx))(λx (y + xx)) and consider a term b such that Yb is β-equivalent to b + Yb and so on. Modulo equality over vector spaces, the theory would be inconsistent, as the term Yb − Yb would then be equal to 0, but would also reduce to b + Yb − Yb and hence also be equal to b. Instead, this problem can be fixed by restricting rules such as α.u + β.u → (α + β).u to terms that cannot reduce forever (cf. Factorisation rules, below), matching the old intuition that indefinite forms ‘∞ − ∞’ must be left alone. Moreover, oriented axioms of vector spaces define vector spaces and no more than vector spaces, just as well as the original axioms do, as was shown in [AD08]. Plus the orientation serves a purpose: it presents the vector in its canonical form. A SYSTEM F ACCOUNTING FOR SCALARS 5 Definitions. The untyped Lineal calculus, as defined in [AD08], is presented in Figure 1. Terms contain a subclass of base terms, that are the only ones that can be substituted for a variable in a β-reduction step. We use the convention that terms equal up to associativity and commutativity axioms on + (that is an AC-rewrite system). In particular, we have t + u = u + t and t + (u + r) = (t + u) + r. That rewriting modulo equational theory has been extensively studied [JK86, PS81] to a high-level of rigour, and largely discussed in the context of this calculus in [AD08]. Scalars (denoted by α, β, γ, . . . ) are members of a commutative ring (S, +, ×, 0). Scalars can be defined as forming a rewrite system by itself [AD08], however for the sake of simplicity, it is enough to consider them as members of a ring. For example, the term 6.t and the term (2 × 3).t are considered to be the same term. Also, α-equivalence is considered implicitly, that is we rename variables when needed to avoid variable capturing. To be fully formal we would need to introduce these three equivalences, however they are standard so we do not mention them explicitly as long as it does not lead to confusion. The parentheses associations are the standard. We add the following conventions: α.β.t stands for α.(β.t) and t1 . . . tn + r1 . . . rn stands for (t1 . . . tn ) + (r1 . . . rn ). The confluence of this calculus has been formally proven in [AD08]. The set of free variables of a term (notation: FV(t)) is defined as expected. The operation of substitution on terms (notation: t[b/x]) is defined as usual (i.e. taking care of renaming bound variables when needed in order to prevent variable capture), with (α.t + β.u)[b/x] = α.(t[b/x]) + β.(u[b/x]). Finally, nf(t) denotes the unique normal form of the term t and it is used only when it is clear that t has a unique normal form. As usual, →∗ is the application of zero or more reduction rules. Example 2.1. One may be tempted to think λx 2.x ∼ 2.λx x. Consider the following reduction. (λx 2.x + λx x)(3.b1 + 2.b2 ) →∗ →∗ →∗ →∗ 3.((λx 2.x)b 1 ) + 3.((λx x)b1 ) + 2.((λx 2.x)b2 ) + 2.((λx x)b2 ) 3.2.b1 + 3.b1 + 2.2.b2 + 2.b2 6.b1 + 3.b1 + 4.b2 + 2.b2 9.b1 + 6.b2 However while these terms behave the same in this case, they are different: the first one is the function (a base term) duplicating its argument, while the second one is twice the identity function. The display below is clarifying: (λx y)(λx 2.x) → y, (λx y)(2.λx x) → 2.(λx y)(λx x) → 2.y. 3. The Scalar Type System The grammar of types, cf. Figure 2, defines the set of types (denoted by T, R, S) and its syntactic subclass (denoted by U, V, W ) of what we call unit types. Note that the grammar for unit types does not allow for scalars except to the right of an arrow. More generally, note the novelty of having scalars at the level of types. We will see that these scalars keep track of the sum of the coefficients of the terms contributing to the type. Type variables are denoted by X, Y , etc. and can only ever be substituted by a unit type. Contexts are denoted by Γ, ∆, etc. and are defined as sets {x : U, . . .}, where x is a term 6 P. ARRIGHI AND A. DÍAZ-CARO Terms: Base terms: Elementary rules: t + 0 → t, 0.t → 0, 1.t → t, α.0 → 0, α.(β.t) → (α × β).t, α.(t + r) → α.t + α.r. r, t, u ::= b ::= b | tr | 0 | α.t | t + r x | λx t Factorisation rules: α.t + β.t → (α + β).t (*), α.t + t → (α + 1).t (*), t + t → (1 + 1).t (*). Beta reduction: (λx t)b → t[b/x] (***). Application rules: (t + r)u → tu + ru (**), u(t + r) → ut + ur (**), (α.t)r → α.tr (*), r(α.t) → α.rt (*), 0t → 0, t0 → 0. Contextual rules: If t → r, then for any term u and variable x, tu → ru, ut → ur, t + u → r + u, u + t → u + r, α.t → α.r and λx t → λx r. where + is an associative-commutative (AC) symbol and (*) these rules apply only if t is a closed normal term. (**) these rules apply only if t + r is a closed normal term. (***) the rule applies only when b is a base term. Restriction (***) is the one that limits the β-reduction, whereas restrictions (*) and (**) are those that avoid confluence problems related to infinities and indefinite forms, as discussed above. Figure 1: Syntax and reduction rules of Lineal. variable appearing only once in the set and U is a unit type. We usually omit the brackets of the set. The substitution of V for X in U is defined as usual and is written U [V /X]. We ~ /X] ~ for U [V1 /X1 ] · · · [Vn /Xn ] if X ~ = X1 , . . . , Xn sometimes use the vectorial notation U [V ~ = V1 , . . . , Vn . In order to avoid capture, we consider that Xi cannot appear free in and V Vj , with j < i. Also we assume that free and bound variables of a type are distinct. We ~ ∈ ~ are in the also may abuse notation and say X / S meaning that none of the Xi from X set S. We write Γ[U/X] to the substitution of U for X in each type of Γ. Also we write (α.T )[U/X] for α.T [U/X]. FV(T ) designates the set of free variables of the type T , defined in the usual manner, and FV(Γ) is the union of the sets of free variables of each type in Γ. Scalars are denoted by α, β, γ . . . and are members of the same commutative ring (S, +, ×) as those of terms. We also define an equivalence relation upon types as follows: Definition 3.1. For any α, β and T . We define the type equivalence ≡ to be the least congruence such that • α.0 ≡ 0 • 0.T ≡ 0 • 1.T ≡ T • α.(β.T ) ≡ (α × β).T • ∀X.α.T ≡ α.∀X.T The complete set of typing rules is shown in Figure 2. Splitting the grammar into general types and unit types is a necessary consequence of the fact that we want scalars in the types to reflect scalars in the terms (e.g. α.λx t should have a type α.U ). Indeed if we did not have the restriction on the left hand side of an arrow being a unit type, i.e. U → T , then we would have types like (α.X) → X, which a priori do not make sense, because A SYSTEM F ACCOUNTING FOR SCALARS Types: Unit types: Γ, x : U ⊢ x : U Γ, x : U ⊢ t : T Γ ⊢ λx t : U → T Γ ⊢ 0: 0 ax0 Γ ⊢ t: T ax R, S, T ::= U, V, W ::= U | ∀X.T | α.T | 0 X | U → T | ∀X.U T ≡S Γ ⊢ t : α.(U → T ) Γ ⊢ t: S Γ ⊢ t : ∀X.T →I Γ ⊢ t : T [U/X] Γ ⊢ t : α.T 7 ≡ Γ ⊢ r : β.U Γ ⊢ tr : (α × β).T Γ ⊢ t: T ∀E X∈ / FV(Γ) Γ ⊢ t : ∀X.T Γ ⊢ r : β.T Γ ⊢ t + r : (α + β).T Γ ⊢ t: T +I Γ ⊢ α.t : α.T →E ∀I sI Figure 2: Types and typing rules of Scalar abstractions receive only base terms as arguments. This could be fixed by adding the equivalence (α.A) → B ≡ α.(A → B), making sure that α is non-zero. But still we would need to keep the →E rule restricted to having a unit type on the left of the arrow, otherwise we would break the required correspondence between scalars-in-types and scalars-in-terms, e.g.: ⊢ α.λx x : (α.T ) → T ⊢ t : α.T but (α.λx x)t →∗ α.t which should be of type α2 .T ⊢ (α.λx x)t : T We want the scalars in the types to represent those in the terms, hence the rule sI . The rule +I takes care of sums of terms and the term 0 gets the special type 0 by an axiom. Finally, let us go back to the application. The standard rule →E from System F needs to be consistent with the extra rules for application that we have on top of β-reduction in Lineal; namely the Application rules: (1) (t + r)u → tu + ru (2) u(t + r) → ut + ur (3) (α.t)r → α.tr (4) r(α.t) → α.rt (5) 0t → 0 (6) t0 → 0 Note that the terms t and r in rules (1) and (2) must now have the same type (up to a scalar) according to the rule +I , so the type of t + r is analogous to the type of α.t in rules (3) and (4). Also, the type for 0 in rules (5) and (6) is the same as that of 0.t if we take α = 0 in rules (3) and (4). Thus we can focus our discussion on rules (3) and (4). By the rule (3), we must have: Γ ⊢ t : α.(U → T ) Γ ⊢ r: U Γ ⊢ tr : α.T By the rule (4), we must have: Γ ⊢ t: U → T Γ ⊢ r : β.U Γ ⊢ tr : β.T By combining these two we obtain the rule →E presented in Figure 2. 8 P. ARRIGHI AND A. DÍAZ-CARO Remark 3.2. A good insight into the type system is that, due to the equivalence relation, scalars in types occur only at the top-level and in the target subtypes of arrow types. This fits very well with the idea that in Lineal all term constructs are linear, except for abstraction. With this in mind, the syntax of arrow types could have been restricted to U → α.V , or even written as U →α V instead. In other words, we could get rid of the type equivalences (cf. Definition 3.1) and represent each type equivalence class by just its canonical member. Such a design choice would spare us some lemmas (cf. Section 4), but comes at a price: • Equivalences between 0.T and 0.R or 1.T and T would still need to be enforced through an equivalence relation or some unelegant case distinctions, at least if we want to maintain them. • More generally our aim is to reflect some of the vectorial structure of the terms of Lineal up at the level of types. In that sense the explicit type equivalences we have given provide a good indication that types have the desired structure. 4. Subject reduction The following theorem ensures that typing is preserved by reduction. Having such a property is part of the basic requirements for a type system. Theorem 4.1 (Subject Reduction). For any terms t, t′ , any context Γ and any type T , if t → t′ and Γ ⊢ t : T , then Γ ⊢ t′ : T . The proof of this theorem is quite long and non-trivial. This is one of the main technical contributions of the paper. 4.1. Preliminary lemmas. In order to prove this theorem, we need several auxiliary lemmas giving general properties of our system. We have tried to provide an intuition of every lemma so as to make it easier to follow. Also, we divided them in four groups, reflecting the nature of their statements. Standard and straightforward lemmas are left without proof to improve readability. 4.1.1. Lemmas about types. The lemmas in this section are statements about the properties of the types themselves, i.e. the type equivalence relation. It is not so hard to see that every type is equivalent to unit type multiplied by a scalar. A unit type itself can of course always be multiplied by 1. Lemma 4.2 (α unit). For each type T there exists a unit type U and a scalar α such that T ≡ α.U . A SYSTEM F ACCOUNTING FOR SCALARS 9 This first lemma should not be misinterpreted however: this does not mean to say that any scalar appearing within a type can be factored out of the type. For example even a simple unit type X → α.X is not equivalent to α.(X → X). The following just says that when two types are equivalent, then the outer left scalars are the same: Lemma 4.3 (Unit does not add scalars). For any unit types U , U ′ and scalars α, β, if α.U ≡ β.U ′ then, α = β and if α 6= 0, then U ≡ U ′ . Informal proof. Following the grammar of unit types, neither U nor U ′ could contain scalars in this head form but only in the right hand side of an arrow. However, no equivalence rule lets it come out from the right of the arrow and get to the head-form, so if α.U ≡ β.U ′ that means α = β = 0 or U ≡ U ′ and α = β. 4.1.2. Relation between types. We define a family of relations between types inspired by [Bar92, def. 4.2.1]: Definition 4.4. For any types T, R any context Γ and any term t such that Γ ⊢ t: T ====== Γ ⊢ t: R t (1) if X ∈ / FV(Γ), write T ≻X,Γ R if • either R ≡ ∀X.T • or T ≡ ∀X.S and R ≡ S[U/X] for some U and S. (2) if V is a set of type variables such that V ∩ FV(Γ) = ∅, we define tV,Γ inductively by • If X ∈ V and T ≻tX,Γ R, then T t{X},Γ R. • If V1 , V2 ⊆ V, T tV1 ,Γ R and R tV2 ,Γ S, then T tV1∪V2 ,Γ S. • If T ≡ R, then T tV,Γ R. Example 4.5. Let the following be a valid derivation. Γ ⊢ t: T X∈ / FV(Γ) ∀I Γ ⊢ t : ∀X.T ∀E Γ ⊢ t : T [U/X] Y ∈ / FV(Γ) ∀I Γ ⊢ t : ∀Y.T [U/X] ∀Y.T [U/X] ≡ R Γ ⊢ t: R ≡ Then T t{X,Y },Γ R. Note that this relation is stable under reduction in the following way: Lemma 4.6 (-stability). For any types T, R, set of type variables V, terms t and r and context Γ, if T tV,Γ R, t → r and Γ ⊢ r : T , then T rV,Γ R. Proof. It suffices to show this for ≻tX,Γ , with X ∈ V. Observe that since T ≻tX,Γ R, then X ∈ / FV(Γ). We only have to prove that Γ ⊢ r : R is derivable from Γ ⊢ r : T . We proceed now by cases: • R ≡ ∀X.T , then using rules ∀I and ≡, we can deduce Γ ⊢ r : R. • T ≡ ∀X.S and R ≡ S[U/X], then using rules ∀E and ≡, we can deduce Γ ⊢ r : R. 10 P. ARRIGHI AND A. DÍAZ-CARO The following lemma states that scalars do not interfere with the relation. Lemma 4.7 (Scalars keep order). For any types T , R, any scalar α, context Γ, set of variable types V and term t, if T tV,Γ R then α.T α.t V,Γ α.R. The following lemma states that if two arrow types are ordered, then they are equivalent up to some substitutions. Lemma 4.8 (Arrows comparison). For any types U, V , T, R, context Γ, set of type variables ~ and variables X ~ ∈V V and term t, if V → R tV,Γ U → T , then there exist unit types W such that ~ /X] ~ U → T ≡ (V → R)[W Proof. cf. Appendix A.1. 4.1.3. Classic lemmas. The lemmas in this section are the classic ones, which appear in most subject reduction proofs. Proving subject reduction means proving that each reduction rule preserves the type. The way to do this is to go in the opposite direction to the reduction rule, i.e. to study the reduct so as to understand where it may come from, thereby decomposing the redex in its basic constituents. Generation lemmas accomplish that purpose. We need five generation lemmas: the classical ones, one for applications (Lemma 4.9) and one for abstractions (Lemma 4.11); and three new ones for the algebraic rules, one for products by scalars different than 0 (Lemma 4.12) other for product by 0 (Lemma 4.13) and one for sums (Lemma 4.14). All of them follow by induction on the typing derivation. Lemma 4.9 (Generation lemma (app)). For any terms t, r, any type T , any scalar γ and any context Γ, if Γ ⊢ tr : γ.T , then there exist α, β, U, V with γ.R tr V,Γ γ.T such that Γ ⊢ r : α.U and Γ ⊢ t : β.(U → R) with α × β = γ. Remark 4.10. Consider the following example: Let Γ ⊢ t : U → R and Γ ⊢ r : U . Then Γ ⊢ tr : R and if R tr V,Γ T , then Γ ⊢ tr : T . Note that in general, t does not have type U → T . As a counterexample note that x : X → X ⊢ x : X → X but x : X → X 6⊢ x : X → ∀X.X. Lemma 4.11 (Generation lemma (abs)). For any term t, any type T and any context Γ, t if Γ ⊢ λx t : T then there exist U , R and V such that Γ, x : U ⊢ t : R and U → R λx V,Γ T . Proof. cf. Appendix A.2. Lemma 4.12 (Generation lemma (sc)). For any scalar α 6= 0, any context Γ, any term t and any type T , if Γ ⊢ α.t : α.T , then Γ ⊢ t : T . Lemma 4.13 (Generation lemma (sc-0)). For any context Γ, any term t and any type T , if Γ ⊢ 0.t : T , then there exists R such that Γ ⊢ t : R. Lemma 4.14 (Generation lemma (sum)). For any terms t, r, any scalar α, any unit type U and any context Γ, if Γ ⊢ t + r : α.U , then there exist δ, γ ∈ S such that Γ ⊢ t : δ.U and Γ ⊢ r : γ.U with δ + γ = α. A SYSTEM F ACCOUNTING FOR SCALARS 11 Remark 4.15. Note that the assumption of the previous lemma could be weakened as Γ ⊢ t + r : T , since by Lemma 4.2, any type T can be written as α.U for some scalar α and unit type U . The following lemma is quite standard in proofs of subject reduction for System F -like systems and can be found for example in [Bar92, prop. 4.1.19] and [Kri90, prop. 8.2 and 8.5]. It ensures that when substituting types for type variables or terms for term variables, in an adequate manner, then the type derived remains valid. ~ and Lemma 4.16 (Substitution lemma). For any term t, any base term b, any types T , U any context Γ, ~ /X] ~ ⊢ t : T [U ~ /X]. ~ (1) If Γ ⊢ t : T then Γ[U (2) If Γ, x : U ⊢ t : T and Γ ⊢ b : U then Γ ⊢ t[b/x] : T . 4.1.4. Lemmas about the scalars. This section contains the lemmas which make statements about the relative behaviour of the scalars within terms and within types. For example, scalars appearing in the terms are reflected within the types also. This is formalized in the following lemma, which is proved by induction on the typing derivation. Lemma 4.17 (Scaling unit). For any term t, scalar α, type T and context Γ, if Γ ⊢ α.t : T then there exists U and γ ∈ S such that T ≡ α.γ.U . Base terms are typed by unit types or its equivalent (proof by induction on the typing derivation). Lemma 4.18 (Base terms in unit). For any base term b, context Γ and type T , if Γ ⊢ b : T then there exists U such that T ≡ U . By ax0 , it is easy to see that 0 has type 0, but also by using equivalences between types we have that ∀X.0 is equivalent to 0. Moreover, for any T , Γ and V with V ∩FV(Γ) = ∅,such that 0 0V,Γ T , we have T ≡ 0. Then we can state the following lemma (proof by induction on the typing derivation). Lemma 4.19 (Type for 0). For any context Γ and type T , if Γ ⊢ 0 : T then T ≡ 0. The following theorem is an important one. It says that our Scalar type system is polymorphic only in the unit types but not in the general types in the sense that even if it is possible to derive two types for the same term, the outermost-leftmost scalar (i.e. the scalar in the head position) must remain the same. Its proof is not trivial, as it uses several of the previously formulated lemmas. Theorem 4.20 (Uniqueness of scalars). For any term t, any context Γ, any scalars α, β and any unit types U , V , if Γ ⊢ t : α.U and Γ ⊢ t : β.V , then α = β. Proof. Structural induction over t. (1) t = 0. Then by Lemmas 4.19 and 4.3, α = β = 0. (2) t = x or t = λx t′ . Then by Lemmas 4.18 and 4.3, α = β = 1. (3) t = γ.t′ . Then by Lemma 4.17, there exist σ, δ, U ′ , V ′ , such that α.U ≡ γ.σ.U ′ and β.V ≡ γ.δ.V ′ . If γ = 0, then γ × σ = γ × δ = 0 and then by Lemma 4.3, α = β = 0. If γ 6= 0, then by Lemma 4.12, Γ ⊢ t′ : σ.U ′ and Γ ⊢ t′ : δ.V ′ , so by the induction hypothesis σ = δ. Note that, by Lemma 4.3, α = γ × σ and β = γ × δ, so α = γ × σ = γ × δ = β. 12 P. ARRIGHI AND A. DÍAZ-CARO (4) t = t1 + t2 . Then by Lemma 4.14, there exist γ1 , γ2 such that Γ ⊢ t1 : γ1 .U and Γ ⊢ t2 : γ2 .U with γ1 + γ2 = α; and also by the same lemma, there exist δ1 , δ2 such that Γ ⊢ t1 : δ1 .V and Γ ⊢ t2 : δ2 .V with δ1 + δ2 = β. Then by the induction hypothesis γ1 = δ1 and γ2 = δ2 , so α = γ1 + γ2 = δ1 + δ2 = β. t1 t2 (5) t = t1 t2 . Then by Lemma 4.9, there exist γ1 , γ2 , W, V and α.T V,Γ α.U such that Γ ⊢ t1 : γ1 .(W → T ) and Γ ⊢ t2 : γ2 .W with γ1 × γ2 = α; and also by the same lemma, there exist δ1 , δ2 , W ′ , V ′ and β.R Vt1′t,Γ2 β.V such that Γ ⊢ t1 : δ1 .(W ′ → R) and Γ ⊢ t2 : δ2 .W ′ with δ1 × δ2 = β. Then by the induction hypothesis γ1 = δ1 and γ2 = δ2 , so α = γ1 × γ2 = δ1 × δ2 = β. From this theorem, the uniqueness of 0 follows, in the sense that no term can have type 0 and some other type T which is not equivalent to 0. Corollary 4.21 (Uniqueness of 0). For any term t and any context Γ, if Γ ⊢ t : 0 then for each T 6≡ 0, Γ 6⊢ t : T . Proof. Assume Γ ⊢ t : T , then by Lemma 4.2, T ≡ α.U . Since Γ ⊢ t : 0 ≡ 0.U we obtain by Theorem 4.20 that α = 0. Since 0 has type 0 which is equivalent to 0.U for any U , 0 can still act as argument for an abstraction or even be applied to another term. In either case the result is a term of type 0: Lemma 4.22 (Linearity of 0). For any term t, any context Γ and any type T , (1) If Γ ⊢ 0t : T then T ≡ 0. (2) If Γ ⊢ t0 : T then T ≡ 0. Proof. (1) Let Γ ⊢ 0t : T . By Lemma 4.2, T ≡ γ.U . Moreover, by Lemma 4.9, there exist α, β, U ′ , V ′ ′ and γ.R 0t V,Γ γ.U such that Γ ⊢ 0 : β.(U → R) and Γ ⊢ t : α.U with γ = α × β. Hence, by Corollary 4.21, β.(U ′ → R) ≡ 0 ≡ 0.U , so by Lemma 4.3, β = 0, then γ = α × 0 = 0, so T ≡ γ.U ≡ 0. (2) Analogous to (1). 4.1.5. Subject reduction cases. The following three lemmas are in fact cases of subject reduction, however, they are also necessary as lemmas in subsequent proofs. Lemma 4.23 (Product). For any term t, any scalars α and β and any context Γ, if Γ ⊢ α.(β.t) : T then Γ ⊢ (α × β).t : T . Proof. By Lemma 4.17, there exist U and γ ∈ S such that T ≡ α.γ.U . We proceed now by cases: α 6= 0 and β 6= 0: By Lemma 4.12, Γ ⊢ β.t : γ.U . Moreover, by Lemma 4.17 again, there exist U ′ and γ ′ such that γ.U ≡ β.γ ′ .U ′ . So, by Lemma 4.12, Γ ⊢ t : γ ′ .U ′ , from which, using the rule sI one can derive Γ ⊢ (α × β).t : (α × β).γ ′ .U ′ . Note that (α × β).γ ′ .U ′ ≡ α.β.γ ′ .U ′ ≡ α.γ.U ≡ T . α 6= 0 and β = 0: By Lemma 4.12, Γ ⊢ 0.t : γ.U . Moreover, by Lemma 4.13, there exists R such that Γ ⊢ t : R, from which, using the rule sI , one can derive Γ ⊢ (α × 0).t : (α × 0).R = 0.R. Note that by Lemma 4.2, there exists δ and V such that R ≡ δ.V , so 0.R ≡ 0.V ≡ 0. Since (α × 0).t = 0.t, by Corollary 4.21, γ = 0, and note that 0.U ≡ 0, so 0.R ≡ 0 ≡ 0.U = (α × 0).U ≡ α.0.U ≡ T . A SYSTEM F ACCOUNTING FOR SCALARS 13 α = 0: By Lemma 4.13, there exists R such that Γ ⊢ β.t : R. Then by Lemma 4.12 or 4.13, depending if β = 0 or not, there exists S such that Γ ⊢ t : S, from which, using the rule sI , one can derive Γ ⊢ 0.t : 0.S. Note that 0.S ≡ 0 ≡ 0.γ.U ≡ T . Also note that 0.t = (0 × β).t. Lemma 4.24 (Distributivity). For any terms t and r, any scalar α, any context Γ and any type T , if Γ ⊢ α.(t + r) : T then Γ ⊢ α.t + α.r : T . Proof. Let Γ ⊢ α.(t + r) : T . By Lemma 4.17, there exist α, R such that T ≡ α.R. We proceed now by cases: α 6= 0: By Lemma 4.12, Γ ⊢ t + r : R. By Lemma 4.2, there exist σ, U such that R ≡ σ.U . So by Lemma 4.14 there exist δ and γ such that Γ ⊢ t : δ.U and Γ ⊢ r : γ.U with δ + γ = σ. Then by rules sI and ≡, Γ ⊢ α.t : (α × δ).U and Γ ⊢ α.r : (α × γ).U , from which using the rule +I one can derive Γ ⊢ α.t + α.r : (α × δ + α × γ).U . Note that (α × δ + α × γ).U ≡ α.σ.U ≡ α.R ≡ T . α = 0: By Lemma 4.13, there exists S such that T ≡ 0.S ≡ 0 with Γ ⊢ t + r : S. In addition, by Lemma 4.2, there exist δ, V such that S ≡ δ.V . Then by Lemma 4.14, there exist σ, ς such that Γ ⊢ t : σ.V and Γ ⊢ r : ς.V . By rules sI and ≡, Γ ⊢ 0.t : 0.V and Γ ⊢ 0.r : 0.V , from which using the rule +I one can derive Γ ⊢ 0.t+0.r : 0.V . Note that 0.V ≡ 0 ≡ T . Lemma 4.25 (Factorisation). For any term t, scalars α and β, type T and context Γ, if Γ ⊢ α.t + β.t : T then Γ ⊢ (α + β).t : T . Proof. Let Γ ⊢ α.t + β.t : T . By Lemma 4.2, there exist σ, V such that T ≡ σ.V . So, by Lemma 4.14, there exist δ, γ ∈ S such that Γ ⊢ α.t : δ.V and Γ ⊢ β.t : γ.V with δ + γ = σ. Then by Lemma 4.17, there exist φ, ϕ, U and U ′ such that δ.V ≡ α.φ.U and γ.V ≡ β.ϕ.U ′ . So, by Lemma 4.3, δ = α × φ and γ = β × ϕ. We proceed now by cases: α = 0: Then δ = 0 and so γ = σ. Thus Γ ⊢ β.t : T . Note that β = α + β. α 6= 0, β = 0: Analogous to the previous case. α, β 6= 0, δ = 0: Then γ = σ, so Γ ⊢ β.t : T ≡ β.ϕ.U ′ , then by Lemma 4.12, Γ ⊢ t : ϕ.U ′ . In addition, Γ ⊢ α.t : 0.V ≡ 0 ≡ α.0, so by Lemma 4.12, Γ ⊢ t : 0. Then by Corollary 4.21, ϕ.U ′ ≡ 0, so by definition of ≡ and Lemma 4.3, ϕ = 0 and then γ = 0, so σ = 0 and T ≡ 0. Using the rule sI one can derive Γ ⊢ (α + β).t : (α + β).0 ≡ 0 ≡ T . α, β 6= 0, γ = 0: Analogous to the previous case. α, β, γ, δ 6= 0: Then φ, ϕ 6= 0, so by Lemma 4.3, V ≡ U ≡ U ′ . Then Γ ⊢ α.t : α.φ.V and Γ ⊢ β.t : β.ϕ.V . Hence by Lemma 4.12, Γ ⊢ t : φ.V and Γ ⊢ t : ϕ.V . Then by Theorem 4.20, φ = ϕ and then by the rule sI , one can derive Γ ⊢ (α + β).t : (α + β).φ.V . Note that (α + β).φ.V ≡ ((α + β) × φ).V = (α × φ + β × ϕ).V = (δ + γ).V = σ.V ≡ T . 4.2. Subject reduction proof. Now we are able to prove the subject reduction property (Theorem 4.1). Proof. We proceed by checking that every reduction rule preserves the type. We give two cases as example, the full proof can be found in Appendix A.3. rule (t + r)u → tu + ru: Let Γ ⊢ (t + r)u : T ≡ 1.T . Then, by Lemma 4.9, there exist (t+r)u α, β, U, V and T ′ V,Γ T such that Γ ⊢ u : α.U and Γ ⊢ t + r : β.(U → T ′ ) ≡ 1.β.(U → T ′ ) with α×β = 1. Then by Lemma 4.14, there exist δ and γ such that Γ ⊢ t : δ.(U → T ′ ) and Γ ⊢ r : γ.(U → T ′ ) with δ + γ = β. Then by the rule →E , Γ ⊢ tu : (δ × α).T ′ and 14 P. ARRIGHI AND A. DÍAZ-CARO Γ ⊢ ru : (γ × α).T ′ . Using the rule +I , one can derive Γ ⊢ tu + ru : (δ × α + γ × α).T ′ = T. 1.T ′ ≡ T ′ and by Lemma 4.6, T ′ ≻tu+ru V,Γ rule (λx t)b → t[b/x]: Let Γ ⊢ (λx t)b : T . By the rule ≡, Γ ⊢ (λx t)b : 1.T , so by (λx t)b T such that Γ ⊢ λx t : β.(U → T ′ ) and Lemma 4.9, there exist α, β, U, V, T ′ V,Γ Γ ⊢ b : α.U with α × β = 1. Since b is a base term, by Lemmas 4.18 and 4.3, α = 1 and ′ t so β = 1. Then by Lemma 4.11, there exist V , R and V ′ with V → R λx V ′ ,Γ U → T . ~ and X ~ ∈ V ′ such that U ≡ V [W ~ /X], ~ T ′ ≡ R[W ~ /X] ~ Then by Lemma 4.8, there exist W ′ ~ ~ ~ and since X ∈ / FV(Γ), Γ = Γ[W /X]. So, by Lemma 4.16(1), Γ, x : U ⊢ t : T . Thus, by Lemma 4.16(2), Γ ⊢ t[b/x] : T ′ , from which, by Lemma 4.6, one obtain Γ ⊢ t[b/x] : T . 5. Strong Normalisation, simplified reduction rules and Confluence The Scalar type system is now proved to have the strong normalisation property, i.e. every typable term is strongly normalising, it cannot reduce forever. In order to show this we first set up another type system, which simply ‘forgets’ the scalars. Hence this simpler type system is just a straightforward extension of System F , called here λ2la (Definition 5.1). In the literature surrounding not Lineal but its cousin, the algebraic λ-calculus, one finds such a System F in [Ehr10], which extends the simply typed algebraic λ-calculus of [Vau07, Vau09] – our λ2la is very similar. Secondly we prove strong normalisation for it (Theorem 5.9). Thirdly we show that every term which has a type in Scalar has a type in λ2la (Lemma 5.11), which entails strong normalisation in Scalar (Theorem 5.12). This strong normalisation proof constitutes the second main technical contribution of the paper. The confluence of a simplified version of Lineal is derived from it. In this section we use the following notation: T(λ2la ) is the set of types of λ2la (denoted by A, B, C). Λ is the set of terms of Lineal. Γ t : A says that it is possible to derive the type A ∈ T(λ2la ) for the term t ∈ Λ in the context Γ under the typing rules of λ2la . We just use ⊢ for Scalar. In addition, we use Name⊳ to distinguish the names of the typing rules in λ2la from those of Scalar. Definition 5.1. The type grammar of λ2la is the following: A, B, C = X | A → B | ∀X.A The typing rules of λ2la are those of System F plus the following rules: Γ t: A Γ r: A ⊳ Γ t: A ⊳ ax⊳0 +I sI Γ 0: A Γ t + r: A Γ α.t : A Example 5.2. In Scalar it is possible to derive ⊢ 3.λx (x + x) : 3.(X → 2.X), while in λ2la we have ⊢ 3.λx (x + x) : X → X. In order to prove strong normalisation we extend the proof for λ2. The standard method was invented by Tait [Tai67] for simply typed λ-calculus and generalized to System F by Girard [Gir72]. Our presentation follows [Bar92, sec. 4.3] (who uses an analogous to Krivine’s saturated sets [Kri90, thm. 8.9]). The following definitions are taken from this reference – with slight modifications to handle the extra λ2la rules. The strong normalisation property entails that every term is strongly normalising, so first we define the set of strongly normalising terms. A SYSTEM F ACCOUNTING FOR SCALARS 15 Definition 5.3. SN = {t ∈ Λ | t is strongly normalising}. The notion of closure is often captured by the notion of saturated set. We use the notation ~t = t1 , . . . , tn with n ≥ 0. Also r~t = rt1 . . . tn where if n = 0 it is just r. Definition 5.4. (1) A subset X ⊆ SN is called saturated if (a) 0 ∈ X; (b) for each x and ~t ∈ SN, x~t ∈ X; (c) if b ∈ SN and t[b/x]~r ∈ X then (λx P t)b~r ∈ X; (d) if (for each i ∈ I, ti~r ∈ X) then ( i∈I P ti )~r ∈ X; (e) if (for each i ∈ I, uti~r ∈ X) then u( i∈I ti )~r ∈ X; (f) for each α ∈ S, t ∈ X if and only if α.t ∈ X; (g) α.t1 t2 . . . tn ∈ X if and only if t1 t2 . . . (α.tk ) . . . tn ∈ X (1 ≤ k ≤ n); (h) for each ~t ∈ SN, 0~t ∈ X; (i) for each t, ~u ∈ SN, t0~ u ∈ X. where I is a finite set of indices. (2) SAT = {X ⊆ Λ | X is saturated} The basic idea is to prove that types correspond to saturated sets. In order to achieve this, we define a valuation from types to SAT (in fact, from type variables to SAT and then, we define a set in SAT by using such a valuation). Definition 5.5. (1) A valuation in SAT is a map ξ : V → SAT, where V is the set of type variables. (2) For any A, B ⊆ Λ, we define A ⇒ B = {t ∈ Λ | for each r ∈ A, tr ∈ B}. (3) Given a valuation ξ in SAT, we define for every T ∈ T(λ2la ) a set [[T ]]ξ ⊆ Λ as follows: [[X]]ξ = ξ(X), where X ∈ V [[A → B]]ξ = [[A]]ξ ⇒ [[B]]ξ \ [[∀X.A]]ξ = [[A]]ξ(X:=Y ) Y ∈SAT Lemma 5.6. (1) SN ∈ SAT, (2) If A, B ∈ SAT then A ⇒ B ∈ SAT, T (3) Let {Ai }i∈I be a collection of members of SAT, i∈I Ai ∈ SAT, (4) Given a valuation ξ in SAT and A in T(λ2la ), then [[A]]ξ ∈ SAT. Proof. cf. Appendix A.4. Just like in Definition 5.5, we define another valuation, this time from term variables to base terms. We use it to check what happens when we change every free variable of a term for any other base term. The basic idea is the following: we define ρ, ξ  t : A to be the property of changing every free term variable in t for another term with the help of the valuation ρ (a base term, since term variables only run over base terms) and still having the resulting term in the set [[A]]ξ . So, we define Γ  t : A to be the same property, when the property holds for every pair in Γ and for every valuations ρ and ξ. This is formalised in the following definition (Definition 5.7) and with this definition, we prove that if a term has a type in a valid context, then the property above holds 16 P. ARRIGHI AND A. DÍAZ-CARO (Theorem 5.8), which yields the strong normalisation theorem (Theorem 5.9) via the concept of saturated set (because saturated sets are subsets of SN). Definition 5.7. • A valuation in Λb is a map ρ : V → Λb , where V is the set of term variables and Λb = {b ∈ Λ | b is a base term}. • Let ρ be a valuation in Λb . Then [[t]]ρ = t[x1 := ρ(x1 ), . . . , xn := ρ(xn )], where ~x = x1 , . . . , xn is the set of free variables in t. • Let ρ be a valuation in Λb and ξ a valuation in SAT. Then − ρ, ξ satisfies t : A, notation ρ, ξ  t : A, if and only if [[t]]ρ ∈ [[A]]ξ . − ρ, ξ  Γ if and only if ρ, ξ  x : A for all x : A in Γ − Γ  t : A if and only if for every ρ, ξ, ρ, ξ  Γ implies ρ, ξ  t : A. Theorem 5.8 (Soundness). If Γ t : A then Γ  t : A. Proof. We proceed by induction on the derivation of Γ t : T . We show one case as an example. The full proof is in Appendix A.5. By the induction hypothesis, Γ  t : A → B and Γ  r : A. Assume ρ, ξ  Γ in order to show ρ, ξ  tr : B. Then Γ t: A → B Γ r: A ⊳ ρ, ξ  t : A → B, i.e. [[t]]ρ ∈ [[A → B]]ξ = [[A]]ξ ⇒ [[B]]ξ →E Γ tr : B and [[r]]ρ ∈ [[A]]ξ . Then [[tr]]ρ = [[t]]ρ [[r]]ρ ∈ [[B]]ξ , so ρ, ξ  tr : B. Theorem 5.9 (Strong normalisation for λ2la ). If Γ t : A, then t is strongly normalising. Proof. Let Γ t : A. Then by Theorem 5.8, Γ  t : A. Define ρ0 (x) = x for all x and let ξ be a valuation in SAT. Then ρ0 , ξ  Γ (i.e. for all (x : B) ∈ Γ, ρ0 , ξ  x : B since x ∈ [[B]]ξ holds because [[B]]ξ is saturated). Therefore ρ0 , ξ  t : A, hence t = [[t]]ρ0 ∈ [[A]]ξ ⊆ SN. It is possible to map every type from Scalar to a type in λ2la as follows. Definition 5.10. Let (·)♮ be the following mapping from types in Scalar to T(λ2la ): • X♮ = X • (∀X.T )♮ = ∀X.T ♮ • (U → T )♮ = U ♮ → T ♮ • (α.T )♮ = T ♮ ♮ •0 =A where A is an arbitrary fixed type in T(λ2la ). We also extend this definition to contexts: Γ♮ = {(x : T ♮ ) | (x : T ) ∈ Γ}. The following lemma ensures that if it is possible to give a type to a term in Scalar then it is possible to give to the term the mapped type in λ2la . Example 5.2 may help to see this. Lemma 5.11 (Correspondence with λ2la ). If Γ ⊢ t : T then Γ♮ t : T ♮. Proof. We proceed by induction on the derivation of Γ ⊢ t : T . We show one case as example. The full proof is in Appendix A.6. Γ ⊢ t : α.T Γ ⊢ r : β.T By the induction hypothesis Γ♮ t : T ♮ and Γ♮ r : T ♮ , so +I by the rule +⊳ , Γ♮ t + r : T ♮ = ((α + β).T )♮ . I Γ ⊢ t + r : (α + β).T Strong normalisation arises as a consequence of strong normalisation for λ2la and the above lemma. Theorem 5.12 (Strong normalisation). If Γ ⊢ t : T then t is strongly normalising. Proof. By Lemma 5.11, Γ♮ t : T ♮ , then by Theorem 5.9, t is strongly normalising. A SYSTEM F ACCOUNTING FOR SCALARS 17 Taking up again the example of Section 2, terms like Y are simply not allowed in this typed setting, since Theorem 5.12 ensures that all the typable terms have a normal form. So we do not have infinities and hence the intuitive reasons for having restrictions (∗) on the Factorisation rules of the linear-algebraic calculus (cf. the reduction rules in Section 2) have now vanished. If we drop them, the example becomes as follows. Example 5.13. Consider some arbitrary typable and hence normalising term t. Then α.t − α.t can be reduced by a factorisation rule into (α − α).t. This reduces in one step to 0, without the need to reduce t. It turns out that, in general, for typable terms we can indeed drop the restrictions (*) and (**) without breaking the confluence of Lineal. These restrictions were there only due to the impossibility of checking for the normalisation property in the untyped setting. Having this property, the confluence of the system follows naturally. Theorem 5.14 (Confluence). Let t be a term of Lineal, as it appears in Figure 1, but without restrictions (*) and (**). If t is typable in Scalar, t →∗ u and t →∗ r, then there exists a term t′ such that u →∗ t′ and r →∗ t′ . Proof. First let us introduce some notation. Let →β be a β-reduction and →a any reduction from Figure 1 but the β-reduction, without restrictions (*) and (**). Moreover, →∗β and →∗a are the application of zero or more of such rules, as usual. The proof follows in several steps. (1) First we prove local confluence for the algebraic fragment, i.e. if t →a u and t →a r, then there exists a term t′ such that u →∗a t′ and r →∗a t′ . (2) Then we prove local confluence for the β-reduction, i.e. if t →β u and t →β r, then there exists a term t′ such that u →∗β t′ and r →∗β t′ . (3) Finally, we prove that algebraic rules and β-reduction commutes, i.e. if t →a u and t →β r, then there exists a term t′ such that u →∗ t′ and r →∗ t′ , where →∗ is a reduction sequence of zero or more steps involving any rules. This prove the local confluence of the system. The well known Newman’s lemma states that local confluence plus strong normalisation implies confluence (cf. for example [TeR03, thm. 1.2.1]). This is how the proofs of the steps look like. (1) Valiron did a semi-automatized proof in the interactive theorem prover Coq [Coq09]. The interested reader can find the proof in [Val11]. An easier-to-read explanation of it appears in [ADCV11]. (2) The local confluence of the β-reduction follows from [Dou92] and a trivial extension of the confluence of lambda-calculus. (3) This proof goes by structural induction. cf. Appendix A.7. Note that the proofs of subject reduction (Theorem 4.1) and strong normalisation (Theorem 5.12) have been done in the general case, without restrictions (*) and (**), so they are still valid for the simplified calculus. Having dropped restrictions (*) and (**) is an important simplification of the linearalgebraic λ-calculus, which becomes really just an oriented version of the axioms of vector spaces [AD04] together with the call-by-value strategy (i.e. restriction (***) remains, of course, to make all functions remain linear in their arguments, in the sense of linear-algebra). 18 P. ARRIGHI AND A. DÍAZ-CARO 6. Barycentric λ-calculus By slightly modifying our system, the Scalar type system may be used in order to specialize Lineal into a higher-order barycentric calculus. In order to illustrate this point, let us consider the following type judgement, which can be obtained from Scalar : 1 3 1 f ::= λx ((x( .(true + false)))( .true + .false)) : B → B; 2 4 4 where B stands for ∀X.X → X → X. Note that the type B has true, false and linear combinations of them with scalars summing to one, as members. In this example the type system provides a guarantee that the function is barycentric and that if it receives a barycentric argument, it preserves this property. For example, if we apply such a function to 12 .(true + false) we obtain: 1 3 5 f ( .(true + false)) −→∗ .true + .false. 2 8 8 Although this seems feasible, we do not develop a full-blown barycentric higher-order λcalculus and associated properties in this paper. We just show that the Scalar type system accomplishes part of the job by checking for the barycentric property, i.e. checking that the normal form of a term has amplitudes summing to one. A barycentric λ-calculus fragment of the algebraic λ-calculus has already been studied for its own sake [Tas09], however in this work the calculus was endowed with a simple type system, not one that would recognize barycentric terms amongst other terms. To this end let us define a type system with the rules and grammar of Scalar, but where the valid types are the classic ones (i.e. types exempt of any scalar, which we have referred to as T(λ2la ) in Definition 5.1), whilst all the other types are just intermediate types: Definition 6.1. We define the type system B for the barycentric calculus to be the Scalar type system with the following restrictions: • S = R, • Contexts are sets of tuples (x : A), with A ∈ T(λ2la ), • Type variables run over T(λ2la ) instead of unit types, i.e. the rule ∀E accepts only A ∈ T(λ2la ), • The final sequent has type in T(λ2la ). Note that the type derivation may have, as intermediate sequents, sequents that do not have their type in T(λ2la ) but in Scalar. Example 6.2. The sequent y : X ⊢ 2.(λx 12 .x)y : X is valid in B, even if intermediate sequents do not have their types restricted to T(λ2la ): y : X, x : X ⊢ x : X ax y : X, x : X ⊢ 12 .x : 21 .X sI y : X ⊢ λx 21 .x : X → 12 .X →I y:X ⊢ y:X y : X ⊢ (λx 12 .x)y : 21 .X y : X ⊢ 2.(λx 12 .x)y : 2. 21 .X ax →E sI y : X ⊢ 2.(λx 21 .x)y : X 2. 12 .X ≡ X ≡ In order to show that this type system does the job, let us define the weight function: A SYSTEM F ACCOUNTING FOR SCALARS 19 Definition 6.3. Let ω : Λ → R be a function defined inductively by: ω(0) = 0 ω(b) = 1 ω(t1 t2 ) = ω(t1 ) × ω(t2 ) ω(t1 + t2 ) = ω(t1 ) + ω(t2 ) ω(α.t) = α × ω(t) where b is a base term. Example 6.4. Continuing Example 6.2, note that 2.(λx 12 .x)y →∗ y. The weight function cannot check the barycentric property on the first term (indeed ω(2.(λx 21 .x)y) = 2), even when this term reduces to a barycentric term. For this matters, we use the type system B to check this property, as stated by the following theorem. Theorem 6.5 (Normal-form of terms in B have weight 1). Let Γ ⊢ t : A with A ∈ T(λ2la ), then ω(nf(t)) = 1. We need the following three lemmas in order to prove this theorem. The first lemma says that an application in normal form can only happen when a variable is in head position. Lemma 6.6. If t1 t2 is in normal form, then t1 = x~r. Proof. Structural induction on t1 . cf. Appendix A.8. The following lemma says that if there is an application in normal form (which by the previous lemma has to have the form x~r), then it cannot be typed in the type system B with a type having a scalar at the right of an arrow, the only possible scalar have to be in the head position of the type. Lemma 6.7. Γ ⊢ x~r : T and x~r is in normal form, then there exist A ∈ T(λ2la ) and α ∈ S such that T ≡ α.A. Proof. Induction on the derivation of Γ ⊢ x~r : T . cf. Appendix A.9. The last lemma shows that scalars cannot be removed by subsumption. Lemma 6.8. Let A ∈ T(λ2la ). For any T, V, Γ, t, if α.T tV,Γ α.A, then T ≡ B with B ∈ T(λ2la ). Proof. Case analysis. cf. Appendix A.10 Using these lemmas, the proof of Theorem 6.5 goes as follows. Proof. Instead, we prove the more general case: If Γ ⊢ t : α.A then ω(nf(t)) = α, by structural induction on nf(t). We take Γ ⊢ nf(t) : α.A, which is true by Theorem 4.1. We show two cases as an example. The full proof is in Appendix A.11. • Case nf(t) = γ.t′ . Then ω(nf(t)) = γ × ω(t′ ). By Lemma 4.17, there exist U and δ such that α.A ≡ γ.δ.U . Note that T(λ2la ) is included in the set of unit types, so by Lemma 4.3, α = γ × δ. We consider two cases: α = 0: Then either γ = 0, and so ω(γ.t′ ) = 0 × ω(t′ ) = 0, or γ 6= 0 but δ = 0, and so by Lemma 4.12, Γ ⊢ t′ : 0.U ≡ 0.A, so by the induction hypothesis ω(t′ ) = 0, and then ω(γ.t′ ) = γ × 0 = 0. α 6= 0: Then A ≡ U , so by Lemma 4.12, Γ ⊢ t′ : δ.A. Then by the induction hypothesis ω(t′ ) = δ. Note that ω(nf(t)) = γ × ω(t′ ) = γ × δ = α. 20 P. ARRIGHI AND A. DÍAZ-CARO • Case nf(t) = t1 t2 . Then ω(nf(t)) = ω(t1 ) × ω(t2 ). By Lemma 4.9, there exist U, T, β, δ t1 t2 and V such that Γ ⊢ t1 : β.(U → T ) and Γ ⊢ t2 : δ.U with α.T V,Γ α.A and β × δ = α. la Since A ∈ T(λ2 ) by assumption, using Lemma 6.8 we have T ≡ B with B ∈ T(λ2la ) and since t1 t2 is in normal form, by Lemma 6.6, t1 is a variable applied to something else, so by Lemma 6.7, U → B ∈ T(λ2la ), which implies that U ∈ T(λ2la ). Then by the induction hypothesis, ω(t1 ) = β and ω(t2 ) = δ, so ω(nf(t)) = ω(t1 ) × ω(t2 ) = β × δ = α. Remarks 6.9. • As first proved in [AD08, prop. 2], closed normal terms have form m n X X λx uj αi .λx ti + i=1 Pn j=1 Thus the Theorem 6.5 entails that i=1 αi + m = 1. Hence the type system B, an easy variation of the Scalar type system, checks for the barycentric property, i.e. it checks that a given term reduces to a barycentric distribution of terms. • A bit more elaborated example than the one given in Example 6.4. It is easy to prove that 1 1 z : A, w : A ⊢ (2.λx λy ( .x + .y))zw : A. 4 4 But note that ω((2.λx λy ( 41 .x + 41 .y))zw) = 2, even when (2.λx λy ( 41 .x + 41 .y))zw →∗ 1 1 2 .z + 2 .w, whose weight is equal to one. So, a priori this ω function cannot tell us that this term yields a barycentric term. However the fact that has type A in T(λ2la ), according to the Theorem 6.5, anticipates this result. • One might think that unit types are just as good as barycentric types B for the sake of obtaining Theorem 6.5, via a combination of Subject-reduction and the uniqueness of scalars property (cf. Theorem 4.20). This is not quite the case, here is a counter-example: 1 1 1 x : U → 2.U, y : U ⊢ x .y : U but ω(x .y) = 2 2 2 But the more significant difference between unit types and B is one of composability: the application of a term of unit type to another is not necessarily of unit type; whereas barycentric types on the other hand are preserved under application. Thus terms in B are not only barycentric; they can also be viewed as barycentric-preserving functions. 7. Summary of contributions In summary, we have defined a System F -like type system for an extension of Lineal, a λ-calculus which allows making arbitrary linear combinations of λ-calculus terms α.t + β.u. The Scalar type system is fine-grained in that it keeps track of the ‘amount of a type’, i.e. the scalar of the type of a term is the sum of the scalars of the types of the contributing subterms. Our main technical contributions were: • A proof of the subject reduction property of the Scalar type system (Theorem 4.1). This came out after having proven a set of lemmas related to the equivalence relation intrinsic to the types and another set of lemmas explaining how the scalars within the types are related to the scalars within the terms. Once all of the important properties were known, A SYSTEM F ACCOUNTING FOR SCALARS 21 we were able to use them to decompose and recompose any term before and after applying a reduction rule, so as to show that every reduction rule preserves the types. • A proof of the strong normalisation property of the Scalar type system (Theorem 5.12). The technique used to prove the strong normalisation property was by proving that such property would hold for a simpler system and then to show the correspondence between the two systems. • A proof that under strong normalisation, most of the conditions upon the Lineal reduction rules can be lifted (e.g. allowing the factorisation not only of closed normal terms but of any term) without jeopardizing confluence, thereby simplifying the Lineal language. • A proof that the Scalar type system can be used to check that a term has the barycentric property, i.e. that the amplitudes of its normal form are summing to one. Arguably a denotational semantics approach might have led to less syntactic proofs of the properties of the type system, sustained by the guiding intuition about an underlying mathematical space. On the other hand, the complexity of the proofs in this paper is largely due to the large number of rules (16 rules plus associativity and commutativity of +). Moreover the issue of models of (linear-)algebraic λ-calculus is a challenging, active topic of the current research. We know of the categorical model of simply typed Lineal [Val10] and the finiteness space model of simply typed algebraic λ-calculus [Ehr05, Tas09]. Moreover, even if both calculi simulate each other [DCPTV10], it is not clear whether the translation applies at the level of models. Hence known models are intricate and tend not to cover the set of terms under consideration in this paper. Note also that since the models of untyped λ-calculus are uncountable, the models of (linear-)algebraic λ-calculus are likely to be vector spaces of uncountable dimensions. These are fascinating, open questions. Acknowledgement We would like to thank to Gilles Dowek, Jonathan Grattage, Philippe Jorrand, Simon Perdrix, Barbara Petit, Frédéric Prost and Benoı̂t Valiron for enlightening discussions. We thank also the anonymous referee for his careful reading, which enabled us to improve the level of rigour of our proofs. References [AD04] [AD08] [ADC11] [ADCV11] [AMR09] Pablo Arrighi and Gilles Dowek. A computational definition of the notion of vectorial space. In Narciso Martı́-Oliet, editor, Proceedings of WRLA-2004, volume 117 of Electronic Notes in Theoretical Computer Science, pages 249–261. Elsevier, 2004. Pablo Arrighi and Gilles Dowek. Linear-algebraic lambda-calculus: higher-order, encodings, and confluence. In Andrei Voronkov, editor, Proceedings of RTA-2008, volume 5117 of Lecture Notes in Computer Science, pages 17–31. Springer, 2008. Pablo Arrighi and Alejandro Dı́az-Caro. Scalar System F for linear-algebraic λ-calculus: Towards a quantum physical logic. In Bob Coecke, Prakash Panangaden, and Peter Selinger, editors, Proceedings of QPL-2009, volume 270/2 of Electronic Notes in Theoretical Computer Science, pages 219–229. Elsevier, 2011. Pablo Arrighi, Alejandro Dı́az-Caro, and Benoı̂t Valiron. A type system for the vectorial aspects of the linear-algebraic lambda-calculus. In Proceedings of the 7th International Workshop on Developments of Computational Methods (DCM 2011), Zurich, Switzerland, 2011. To appear in EPTCS. Draft at http://www.diaz-caro.info/vectorial.pdf. Ariel Arbiser, Alexandre Miquel, and Alejandro Rı́os. The λ-calculus with constructors: Syntax, confluence and separation. Journal of Functional Programming, 19(5):581–631, 2009. 22 [Bar92] P. ARRIGHI AND A. DÍAZ-CARO Henk P. Barendregt. Lambda calculi with types. Handbook of Logic in Computer Science: Volume 2. Oxford University Press, 1992. [BH03] Olivier Bournez and Mathieu Hoyrup. Rewriting logic and probabilities. In Robert Nieuwenhuis, editor, Proceedings of RTA-2003, volume 2706 of Lecture Notes in Computer Science, pages 61– 75. Springer, 2003. [Bou94] Gérard Boudol. Lambda-calculi for (strict) parallel functions. Information and Computation, 108(1):51–127, 1994. [CKL01] Horatiu Cirstea, Claude Kirchner, and Luigi Liquori. The Rho Cube. In Furio Honsell and Marino Miculan, editors, Proceedings of FOSSACS-2001, volume 2030 of Lecture Notes in Computer Science, pages 168–183. Springer, 2001. [Coq09] Coq Dev. Team. The Coq proof assistant reference manual. INRIA, 8.2 edition, February 2009. [DCPTV10] Alejandro Dı́az-Caro, Simon Perdrix, Christine Tasson, and Benoı̂t Valiron. Equivalence of algebraic λ-calculi. In Informal Proceedings of the 5th International Workshop on Higher-Order Rewriting, HOR-2010, pages 6–11, Edinburgh, UK, July 14, 2010. [DHW05] Alessandra Di Pierro, Chris Hankin, and Herbert Wiklicky. Probabilistic λ-calculus and quantitative program analysis. Journal of Logic and Computation, 15(2):159–179, 2005. [Dou92] Daniel J. Dougherty. Adding algebraic rewriting to the untyped lambda calculus. Information and Computation, 101(2):251–267, 1992. [dP95] Ugo de’Liguoro and Adolfo Piperno. Non deterministic extensions of untyped λ-calculus. Information and Computation, 122(2):149–177, 1995. [DZ11] Ugo Dal Lago and Margherita Zorzi. Probabilistic operational semantics for the lambda calculus. Preprint at arXiv:1104.0195, April 2011. [Ehr05] Thomas Ehrhard. Finiteness spaces. Mathematical Structures in Computer Science, 15(4):615– 646, 2005. [Ehr10] Thomas Ehrhard. A finiteness structure on resource terms. In Proceedings of LICS-2010, pages 402–410. IEEE Computer Society, 2010. [ER03] Thomas Ehrhard and Laurent Regnier. The differential lambda-calculus. Theoretical Computer Science, 309(1):1–41, 2003. [Gir71] Jean-Yves Girard. Une extension de l’interpretation de Gödel à l’analyse, et son application à l’élimination des coupures dans l’analyse et la théorie des types. In Jens Erik Fenstad, editor, Proceedings of the 2nd Scandinavian Logic Symposium, volume 63 of Studies in Logic and the Foundations of Mathematics, pages 63–92. North-Holland, 1971. [Gir72] Jean-Yves Girard. Interprétation fonctionnelle et élimination des coupures dans l’arithmétique d’ordre supérieure. PhD thesis, Université Paris Diderot, Paris, France, 1972. [Gro96] Lov K. Grover. A fast quantum mechanical algorithm for database search. In Proceedings of the 28th Annual ACM Symposium on Theory of computing, STOC-96, pages 212–219. ACM, 1996. [HP00] Oltea Mihaela Herescu and Catuscia Palamidessi. Probabilistic asynchronous π-calculus. In Jerzy Tiuryn, editor, Proceedings of FOSSACS-2000, volume 1784 of Lecture Notes in Computer Science, pages 146–160. Springer, 2000. [JK86] Jean-Pierre Jouannaud and Hélène Kirchner. Completion of a set of rules modulo a set of equations. SIAM Journal on Computing, 15(4):1155–1194, 1986. [Kri90] Jean-Louis Krivine. Lambda-calcul: types et modèles. Études et recherches en informatique. Masson, 1990. [LBR03] Didier Le Botlan and Didier Rémy. MLF : raising ML to the power of System F. In Proceedings of the eighth ACM SIGPLAN international conference on Functional programming, ICFP’03, pages 27–38, New York, NY, USA, 2003. ACM. [Pet09] Barbara Petit. A polymorphic type system for the lambda-calculus with constructors. In PierreLouis Curien, editor, Proceedings of TLCA-2009, volume 5608 of Lecture Notes in Computer Science, pages 234–248. Springer, 2009. [PS81] Gerald E. Peterson and Mark E. Stickel. Complete set of reductions for some equational theories. Journal of the ACM, 28(2):233–264, 1981. [Rey74] John C. Reynolds. Towards a theory of type structure. In Bernard Robinet, editor, Programming Symposium: Proceedings of the Colloque sur la Programmation, volume 19 of Lecture Notes in Computer Science, pages 408–425. Springer, 1974. A SYSTEM F ACCOUNTING FOR SCALARS [Sho97] [Tai67] [Tas09] [TeR03] [Val10] [Val11] [Vau07] [Vau09] 23 Peter W. Shor. Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. SIAM Journal on Computing, 26(5):1484–1509, 1997. William W. Tait. Intensional interpretations of functionals of finite type I. The Journal of Symbolic Logic, 32(2):198–212, 1967. Christine Tasson. Algebraic totality, towards completeness. In Pierre-Louis Curien, editor, Proceedings of TLCA-2009, volume 5608 of Lecture Notes in Computer Science, pages 325–340. Springer, 2009. TeReSe. Term Rewriting Systems, volume 55 of Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, 2003. Benoı̂t Valiron. Semantics of a typed algebraic lambda-calculus. In S. Barry Cooper, Prakash Panangaden, and Elham Kashefi, editors, Proceedings DCM-2010, volume 26 of Electronic Proceedings in Theoretical Computer Science, pages 147–158. Open Publishing Association, 2010. Benoı̂t Valiron. Coq proof. www.monoidal.net/vectorial-lvec-coqproof.tar.bz2, 2011. Lionel Vaux. On linear combinations of lambda-terms. In Franz Baader, editor, Proceedings of RTA-2007, volume 4533 of Lecture Notes in Computer Science, pages 374–388. Springer, 2007. Lionel Vaux. The algebraic lambda calculus. Mathematical Structures in Computer Science, 19(5):1029–1059, 2009. Appendix A. Omitted proofs A.1. Proof of Lemma 4.8. A map (·)◦ from types of Scalar to T(λ2la )is defined by X◦ = X (U → T )◦ = U → T (∀X.T )◦ = T ◦ (α.T )◦ = α.T ◦ (0)◦ = 0 We need three intermediate results. (1) If T ≡ R, then T ◦ ≡ R◦ . (2) For any types T and U , exists V such that (T [U/X])◦ ≡ T ◦ [V /X] (3) For any types T , R, set of type variables V, context Γ and term t, if T tV,Γ R then ~ and X ~ ∈ V such that R◦ ≡ T ◦ [U ~ /X] ~ there exists U Proofs. (1) By induction on the equivalence rules. We only show the basic cases since the inductive step, given by the context where the equivalence is applied, is trivial. ◦ ◦ α.0 ≡ 0: (α.0)◦ = α.0 = α.0 ≡ 0 = 0 . ◦ ◦ ◦ 0.T ≡ 0: (0.T ) = 0.T ≡ 0 = 0 . 1.T ≡ T : (1.T )◦ = 1.T ◦ ≡ T ◦ . α.(β.T ) ≡ (α × β).T : (α.(β.T ))◦ = α.(β.T ◦ ) ≡ (α × β).T ◦ = ((α × β).T )◦ . ∀X.α.T ≡ α.∀X.T : (∀X.α.T )◦ = (α.T )◦ = α.T ◦ = α.(∀X.T )◦ = (α.∀X.T )◦ . (2) Structural induction on T T = X: then (X[U/X])◦ = U ◦ = X[U ◦ /X] = X ◦ [U ◦ /X]. T = Y : then (Y [U/X])◦ = Y = Y ◦ [U/X]. T = V → R: then ((V → R)[U/X])◦ = (V [U/X] → R[U/X])◦ = V [U/X] → R[U/X] = (V → R)[U/X] = (V → R)◦ [U/X]. T = ∀Y.R: then ((∀Y.R)[U/X])◦ = (∀Y.R[U/X])◦ = (R[U/X])◦ , which, by the induction hypothesis, is ≡ to R◦ [V /X] = (∀Y.R)◦ [V /X]. T = 0: analogous to T ≡ Y . T = α.R: then (α.R[U/X])◦ = α.(R[U/X])◦ , which, by the induction hypothesis, is ≡ to α.(R◦ )[V /X] = (α.R)◦ [V /X]. (3) It suffices to show this for T ≻tX,Γ R. 24 P. ARRIGHI AND A. DÍAZ-CARO Case 1: R ≡ ∀X.T . Then R◦ ≡ T ◦ . Case 2: T ≡ ∀X.S and R ≡ S[U/X] then by the intermediate results 1 and 2, one has R◦ ≡ (S[U/X])◦ ≡ S ◦ [V /X] ≡ T ◦ [V /X] for some V . Proof of the lemma. U → T ≡ (U → T )◦ , by the intermediate result 3, this is ≡ to ~ /X] ~ = (V → R)[U ~ /X]. ~ (V → R)◦ [U A.2. Proof of Lemma 4.11. Induction on the depth of the derivation. Γ, x : U ⊢ t : T This is the trivial case. Note that for each V 6⊆ FV(Γ), one (1) →I has U → T ≻λx t U → T . V,Γ Γ ⊢ λx t : U → T (2) (3) (4) Γ ⊢ λx t : ∀X.T Γ ⊢ λx t : T [V /X] Γ ⊢ λx t : T ∀E By the induction hypothesis there exist U , R and V such t λx t that Γ, x : U ⊢ t : R and U → R λx V,Γ ∀X.T ≻X,Γ T [V /X]. (Observe that since X is bounded in ∀X.T , any variable in F V (Γ) is distinct from it). X∈ / FV(Γ) Γ ⊢ λx t : ∀X.T Γ ⊢ λx t : T T ≡R Γ ⊢ λx t : R ≡ ∀I By the induction hypothesis there exist U , R and V t λx t such that Γ, x : U ⊢ t : R and U → R λx V,Γ T ≻X,Γ ∀X.T . By the induction hypothesis there exist U , S and V such t that Γ, x : U ⊢ t : S and U → S λx V,Γ T ≡ R. A.3. Proof of Theorem 4.1. We proceed by checking that every reduction rule preserves the type. Let t → r and Γ ⊢ t : T . To show that Γ ⊢ r : T , we proceed by induction on the derivation of the typing judgement. Elementary rules: rule t + 0 → t: Let Γ ⊢ t+0: T . By Lemma 4.2, there exist U and α such that T ≡ α.U , then by Lemma 4.14, there exist δ, γ ∈ S such that Γ ⊢ t : δ.U and Γ ⊢ 0 : γ.U with δ + γ = α. By Lemma 4.19, γ.U ≡ 0, so γ = 0 and then δ = α. rule 0.t → 0: Let Γ ⊢ 0.t : T . By Lemma 4.17, there exists R such that T ≡ 0.R ≡ 0 and by the rule ax0 , Γ ⊢ 0 : 0. rule 1.t → t: Let Γ ⊢ 1.t : T ≡ 1.T . By Lemma 4.12, Γ ⊢ t : T . rule α.0 → 0: Let Γ ⊢ α.0 : T . By Lemma 4.17, there exists R such that T ≡ α.R. We proceed now by cases: α 6= 0: By Lemma 4.12, Γ ⊢ 0 : R. Thus, by Lemma 4.19, R ≡ 0 and so T ≡ α.R ≡ 0. α = 0: By Lemma 4.13 there exists S such that Γ ⊢ 0 : S and by Lemma 4.19 S ≡ 0. rule α.(β.t) → (α × β).t: True by Lemma 4.23 rule α.(t + r) → α.t + α.r: True by Lemma 4.24. Factorisation rules: rule α.t + β.t → (α + β).t: True by Lemma 4.25. rule α.t + t → (α + 1).t: Let Γ ⊢ α.t + t : T . Using the rule sI one can derive Γ ⊢ 1.(α.t + t) : 1.T . Then by Lemma 4.24, Γ ⊢ 1.α.t + 1.t : 1.T . Moreover, by Lemma 4.2, there exist β, U such that T ≡ β.U and then by Lemma 4.14, Γ ⊢ 1.α.t : γ.U and Γ ⊢ 1.t : δ.U with γ + δ = β. So, by Lemma 4.23, Γ ⊢ α.t : γ.U . Then using the rule +I one can derive Γ ⊢ α.t + 1.t : α.U . We conclude, by Lemma 4.25, with Γ ⊢ (α + 1).t : α.U ≡ T . A SYSTEM F ACCOUNTING FOR SCALARS 25 rule t + t → (1 + 1).t: Let Γ ⊢ t + t : T . Then by the rule sI , Γ ⊢ 1.(t + t) : 1.T . By Lemma 4.24, Γ ⊢ 1.t + 1.t : 1.T and by Lemma 4.25, Γ ⊢ (1 + 1).t : 1.T ≡ T . Application rules: rule (t + r)u → tu + ru: Given in the main text of the paper. rule u(t + r) → ut + ur: Analogous to the previous case. rule (α.t)r → α.tr: Let Γ ⊢ (α.t)r : T ≡ 1.T . Then by Lemma 4.9, there exist γ, β, U, V (α.t)r and T ′ V,Γ T such that Γ ⊢ r : γ.U and Γ ⊢ α.t : β.(U → T ′ ) with γ × β = 1. Moreover, by Lemma 4.17, β.(U → T ′ ) ≡ α.δ.U ′ then by Lemma 4.3, U → T ′ ≡ U ′ and β = α × δ (note that β 6= 0 because γ × β = 1). So by Lemma 4.12, Γ ⊢ t : δ.(U → T ′ ). By using the rule →E one can derive Γ ⊢ tr : δ.γ.T ′ from which, using the rule sI one can deduce Γ ⊢ α.tr : α.δ.γ.T ′ . Note that α.δ.γ.T ′ ≡ (α × δ × γ).T ′ = (β × γ).T ′ = 1.T ′ ≡ T ′ and by Lemma 4.6, T ′ α.tr V,Γ T . rule r(α.t) → α.rt: Analogous to the previous case. rule 0t → 0: True by Lemma 4.22 and the rule ax0 . rule t0 → 0: True by Lemma 4.22 and the rule ax0 . Beta reduction: Given in the main text of the paper. AC equivalences: Commutativity: Let Γ ⊢ t + r : T . By Lemma 4.2, there exist α, U such that T ≡ α.U . Then, by Lemma 4.14, there exist δ and γ such that Γ ⊢ t : δ.U and Γ ⊢ r : γ.U with δ + γ = α. Then using rules +I and ≡, one can derive Γ ⊢ r + t : T . Associativity: Let Γ ⊢ (t + r) + u : T . By Lemma 4.2, there exist α, U such that T ≡ α.U . Then, by Lemma 4.14, there exist δ and γ such that Γ ⊢ t + r : δ.U and Γ ⊢ u : γ.U with δ + γ = α. Then, by Lemma 4.14 again, there exist δ′ and γ ′ such that Γ ⊢ t : δ′ .U and Γ ⊢ r : γ ′ .U with δ′ + γ ′ = δ. Then with the rule +I one can deduce Γ ⊢ r + u : (γ ′ + γ).U and with the same rule, Γ ⊢ t + (r + u) : (δ′ + γ ′ + γ).U ≡ T . The inverse is analogous: if Γ ⊢ t + (r + u) : T then Γ ⊢ (t + r) + u : T . Contextual rules: Let t → r and assume as the induction hypothesis that for any context Γ and type T , if Γ ⊢ t : T then Γ ⊢ r : T . tu → ru: Let Γ ⊢ tu : T . By the rule ≡, Γ ⊢ tu : 1.T . Then by Lemma 4.9, there exist α, β, U , R and V such that Γ ⊢ t : α.(U → R) and Γ ⊢ u : β.U with R tu V,Γ T and α × β = 1. By the induction hypothesis Γ ⊢ r : α.(U → R), from which, using the rule →E , one can deduce Γ ⊢ ru : α × β.R. Note that α × β.R = 1.R ≡ R and by Lemma 4.6, R ru V,Γ T . ut → ur: Analogous to the previous case. t+u → r+u: Let Γ ⊢ t+u : T . By Lemma 4.2, T ≡ α.U , so by the rule ≡, Γ ⊢ t+u : α.U . Then by Lemma 4.14, Γ ⊢ t : δ.U and Γ ⊢ u : γ.U with δ + γ = α. By the induction hypothesis Γ ⊢ r : δ.U , so using the rule +I one can deduce Γ ⊢ r + u : (δ + γ).U . Note that (δ + γ).U = α.U ≡ T . u + t → u + r: Analogous to the previous case. α.t → α.r: Let Γ ⊢ α.t : T . By Lemma 4.17, there exist γ and U such that T ≡ α.γ.U . We proceed now by cases: α 6= 0: By Lemma 4.12, Γ ⊢ t : γ.U . Moreover, by the induction hypothesis Γ ⊢ r : γ.U and using the rule sI one can derive Γ ⊢ α.r : α.γ.U ≡ T . α = 0: By Lemma 4.13, there exists R such that Γ ⊢ t : R. Moreover, by the induction hypothesis Γ ⊢ r : R and using the rule sI one can derive Γ ⊢ α.r : α.R ≡ 0 ≡ T . 26 P. ARRIGHI AND A. DÍAZ-CARO λx t → λx r: Let Γ ⊢ λx t : T . By Lemma 4.11, there exist U , R and V such that Γ, x : U ⊢ λx t T . Then by the induction hypothesis Γ, x : U ⊢ r : R, and using t : R with U → R V,Γ r the rule →I one can derive Γ ⊢ λx r : U → R. By Lemma 4.6, U → R λx V,Γ T . A.4. Proof of Lemma 5.6. (1) Obviously SN ⊆ SN. We need to prove it satisfies each point of the definition of saturation. (a) 0 ∈ SN. (b) for each x and ~t, x~t ∈ SN. (c) Assume t[b/x]~r ∈ SN, then the term (λx t)b~r (A.1) must terminate because t, b and ~r terminate since they are SN by assumption (t[b/x] is a sub-term of a term in SN, hence itself is SN; but then t is also SN), After finitely many steps reducing terms in A.1 we obtain (λx t′ )b′ r~′ with t →∗ t′ , b → b′ and for each i, ri → r′i . Then the contraction of (λx t′ )b′ r~′ gives t′ [b′ /x]r~′ (A.2) This is a reduct of t[b/x]~r and since this is SN, also A.2 and (λx t)b~r are SN. (d) First note that if t, u ∈ SN, then t + u ∈ SN. Now, assume that for P each i ∈ I,∗ ~ ~ tP r ∈ SN, which implies that t and r are SN. Also, note that ( r → i i i∈I ti )~ ~ t r which is the sum of SN terms, so is SN. We need to prove that any other i∈I i P reduction starting from i∈I ti~r is also SN. We proceed by induction on I. To simplify the notation, we take I = {1, . . . , n} with n ≥ 1. • If I = {1}, then we are done, since for each i P ∈ I, ti~r ∈ SN. • Assume it is true for I = {1, . . . , n}, that is ( ni=1 tP r ∈ SN. i )~ • Let I = {1, . . . , n + 1}, then we must prove that ( ni=1 ti + tn+1 )~r ∈ SN. We proceed by a case analysis of every possible reductions of this term. Note that any reduction in ~t or ~r is finite since these terms are in SN, so the amount of addends is the same. Elementary rules: − One tk = 0 and the rule t + 0 → t applies. Then the induction hypothesis closes the case. − One tk = α.(tk1 + tk2 ) and reduces to α.tk1 + α.tk2 , it still can be considered as one addend since tk is in SN. − In other case, it is just a reduction in one ti or one of ~r. Factorisation rules: This case follows by the induction hypothesis. Application rules: − Again, reductions on any tk are not considered since these cases are trivial by the P strong normalisation Pof tk . − ( ni=1 ti +Ptn+1 )~r → ( ni=1 ti )~r + (tn+1 )~r, then since by the induction hypothesis ( ni=1 ti )~r ∈ SN and by assumption also (tn+1 )~r ∈ SN, its sum is in SN. P P P − ( ni=1 ti + tn+1 )~r → ( ki=1 ti )~r + ( n+1 r the induction hypothesis api=k+1 ti )~ plies to both addends. A SYSTEM F ACCOUNTING FOR SCALARS 27 − Any other case does not involve a sum, so they are either included in the case of reduction of one tk or one from ~r, or in the basic case of the induction. Recall that the terms are considered modulo AC axioms for + so it is not relevant to consider the permutations or different parentheses locations in the big sums. Beta reduction: This is either the basic case or a reduction in one tk or one of ~r. P P (e) for each i ∈ I, uti~r ∈ SN. Note that u( i∈I ti )~r →∗ i∈I uti~r which is the sum of SN terms. This case is analogous to 1d. (f) if t ∈ SN, then for each α ∈ S, α.t ∈ SN and vice-versa. (g) α.t1 t2 . . . tn ∈ SN then for each k, the term t1 . . . (α.tk ) . . . tn must terminate because ~t terminate since these terms are SN by assumption, so after finitely many reduction steps reducing t1 . . . (α.tk ) . . . tn we obtain α.u, with t1 . . . tn →∗ u. So α.u is a reduct of α.t1 . . . tn and since this term is SN, for each k, t1 . . . (α.tk ) . . . tn are SN. (h) 0~t →∗ 0t~′ and since ~t is SN, assume t~′ is in normal form, so 0t~′ can only reduce to 0, then 0~t ∈ SN. (i) Consider the term t0~u. The term reduces to 0~u, which then reduces to 0. But we could also choose to first reduce t or ~u. In any case, the terms t and u do not interact with any other term than with 0, and when they do they reach 0. This will necessarily happen since t and u are in SN by assumption. Hence the entire term is in SN. (2) Let A, B ∈ SAT, then x ∈ A by definition of saturated sets. For each t ∈ A ⇒ B, tx ∈ B. Since B ∈ SAT, then B ⊆ SN, so tx ∈ SN and so t is strongly normalising. Therefore A ⇒ B ⊆ SN. Now we need to show A ⇒ B is saturated by showing each point in the definition of saturated sets. (a) By saturation of B, for each u ∈ A, 0u ∈ B, then 0 ∈ A ⇒ B. (b) Let ~t ∈ SN, we need to show that x~t ∈ A ⇒ B, i.e. for each u ∈ A, x~tu ∈ B, which is true since A ∈ SAT implies that u ∈ SN, so B ∈ SAT implies that x~tu ∈ B. (c) Let t[b/x]~r ∈ A ⇒ B, then for each u ∈ A, t[b/x]~ru ∈ B and since B is saturated, (λx t)b~ru ∈ B, so (λx t)b~r ∈ A ⇒ B. (d) Let for each i ∈ I, ti~r ∈ A ⇒ B, A and for each i ∈ I, ti~ru ∈ B, P then for each u ∈P then by the saturation of B, ( i∈I ti )~ru ∈ B, so ( i∈I ti )~r ∈ A ⇒ B. ′ ′ (e) Let for each i ∈ I,Puti~r ∈ A ⇒ B, then P for each t ∈ A, uti~rt ∈ B, then by ′ saturation of B, u( i∈I ti )~rt ∈ B, so u( i∈I ti )~r ∈ A ⇒ B. (f) Let t ∈ A ⇒ B then for each u ∈ A, tu ∈ B, then by the saturation of B, for each α ∈ S, α.tu ∈ B, then also by the saturation of B, (α.t)u ∈ B, so α.t ∈ A ⇒ B. Let α.t ∈ A ⇒ B, then for each u ∈ A, α.tu ∈ B, so by the saturation of B, α.tu ∈ B, and again, by the saturation of B, tu ∈ B, so t ∈ A ⇒ B. (g) Let α.t1 . . . tn ∈ A ⇒ B, then for each u ∈ A, (α.t1 . . . tn )u ∈ B, then by the saturation of B, α.t1 . . . tn u ∈ B, and so, by the saturation of B again, for each k, t1 . . . (α.tk ) . . . tn u ∈ B, then for each k, t1 . . . (α.tk ) . . . tn ∈ A ⇒ B. The inverse follows analogously: let t1 . . . (α.tk ) . . . tn ∈ A ⇒ B, then for each u ∈ A, t1 . . . (α.tk ) . . . tn u ∈ B, so by the saturation of B, one has α.t1 . . . tn u ∈ B and then, also by the saturation of B, one has (α.t1 . . . tn )u ∈ B, then α.t1 . . . tn ∈ A ⇒ B. 28 P. ARRIGHI AND A. DÍAZ-CARO (h) For each u ∈ A, u ∈ SN and then, by the saturation of B, for each ~t ∈ SN, 0~tu ∈ B. Then 0~t ∈ A ⇒ B. (i) For each r ∈ A, r ∈ SN and then, by the saturation of B, for each t, ~u ∈ SN, ur ∈ B. Then t0~u ∈ A ⇒ B. t0~ (3) T Let {Ai }i∈I be a collection of members T of SAT, then for each i ∈ I, Ai ⊆ SN, so A ⊆ SN. We have to show that i∈I i i∈I Ai is saturated. • Conditions (a), (b), (h) and (i) follow trivially: all these conditions have T the form “t ∈ X”. Since by the saturation of Ai , for each i ∈ I, t ∈ Ai , then t ∈ i∈I Ai . • Conditions (c), (d), (e), (f) and (g) are also straightforward: all these conditions have T the form “If t in X, then r in X”. Let t ∈ i∈I Ai , then for each iT∈ I, t ∈ Ai and so, by the saturation of Ai , r ∈ Ai , from where one can deduce r ∈ i∈I Ai . (4) By structural induction on A. A := X: Then [[A]]ξ = ξ(X) ∈ SAT. A := B → C: Then [[A]]ξ = [[B]]ξ ⇒ [[C]]ξ . By the induction hypothesis [[B]]ξ and [[C]]ξ ∈ SAT, then by Lemma T 5.6(2), ′[[B]]ξ ⇒ [[C]]ξ ∈ SAT. ′ A := ∀X.A : Then [[A]]ξ = Y ∈SAT [[A ]]ξ(X:=Y ) . By T the induction hypothesis ∀Y ∈ SAT, [[A′ ]]ξ(X:=Y ) ∈ SAT, then by Lemma 5.6(3), Y ∈SAT [[A′ ]]ξ(X:=Y ) ∈ SAT. A.5. Proof of Theorem 5.8. We proceed by induction on the derivation of Γ t : T . ax⊳ Note that if ρ, ξ  Γ, x : A, then by definition ρ, ξ  x : A. (1) Γ, x : A x : A ax⊳0 Then for each ξ and ρ, by the saturation of [[A]]ξ one has 0 ∈ [[A]]ξ . (2) Since [[0]]ρ = 0, then ρ, ξ  0 : A, and so for every Γ, Γ  0 : A. Γ 0: A (3) (4) (5) (6) (7) t: A → B Γ Γ Γ, x : A Γ Γ Γ Γ t: B t : ∀X.A t : A[B/X] t: A t: A Γ r: A tr : B λx t : A → B Γ Γ Γ →⊳I ∀⊳E Assume ρ, ξ  Γ in order to show ρ, ξ  t : A[B/X]. By the induction hypothesis [[t]]ρ ∈ [[∀X.A]]ξ and this set is equal to T Y ∈SAT [[A]]ξ(X:=Y ) , hence [[t]]ρ ∈ [[A]]ξ(X:=[[B]]ξ ) = [[A[B/X]]]ξ . t : ∀X.A t + r: A r: A Given in the main text of the paper. Assume ρ, ξ  Γ in order to show ρ, ξ  λx t : A → B. That is, we must show [[λx t]]ρ u ∈ [[B]]ξ for all u ∈ [[A]]ξ . Assume u ∈ [[A]]ξ , then ρ(x := u)  Γ, x : A and hence by the induction hypothesis [[t]]ρ(x:=u) ∈ B. Since [[λx t]]ρ u = (λx t)[~y := ρ(~y )]u →β t[~y := ρ(~y ), x := u] = [[t]]ρ(x:=u) , it follows from the saturation of [[B]]ξ that [[λx t]]ρ u ∈ [[B]]ξ . X∈ / FV(Γ) Γ →⊳E +⊳I ∀⊳I Assume ρ, ξ  Γ in order to show ρ, ξ  t : ∀X.A. Since X ∈ / FV(Γ), one also has ∀Y ∈ SAT that ρ, ξ(X := Y )  Γ, therefore ∀Y ∈ SAT, [[t]]ρ ∈ [[A]]ξ(X:=Y ) , then by definition of [[∀X.A]]ξ , [[t]]ρ ∈ [[∀X.A]]ξ , i.e. ρ, ξ  t : ∀X.A. Assume ρ, ξ  Γ in order to show ρ, ξ  t + r: A. By the induction hypothesis one has Γ  t : A and Γ  r : A, so [[t]]ρ ∈ [[A]]ξ and [[r]]ρ ∈ [[A]]ξ . Since [[t+r]]ρ = (t+r)[~x := ρ(~x)] = t[~x := ρ(~x)] + r[~x := ρ(~x)] = [[t]]ρ + [[r]]ρ , it follows from the saturation of [[A]]ξ that [[t + r]]ρ ∈ [[A]]ξ . A SYSTEM F ACCOUNTING FOR SCALARS (8) Γ Γ t: A α.t : A 29 Suppose ρ, ξ  Γ in order to show ρ, ξ  α.t : A. By the induction hypothesis one has Γ  t : A, then [[t]]ρ ∈ [[A]]ξ . Since [[α.t]]ρ = (α.t)[~x := ρ(~x)] = α.t[~x := ρ(~x)] = α.[[t]]ρ , it follows from the saturation of [[A]]ξ that [[α.t]]ρ ∈ [[A]]ξ . s⊳I A.6. Proof of Lemma 5.11. We proceed by induction on the derivation of Γ ⊢ t : T . ax (Γ, x : U )♮ = Γ♮ , x : U ♮ , so by ax⊳ , (Γ, x : U )♮ x : U ♮ . (1) Γ, x : U ⊢ x : U (2) (3) (4) Γ ⊢ 0: 0 ax0 By ax0 ⊳ , Γ♮ Γ ⊢ t : α.(U → T ) Γ ⊢ r : β.U Γ ⊢ tr : (α × β).T Γ, x : U ⊢ t : T ♮ 0 : A for any A ∈ T(λ2la ), so take A = 0 . →I →E By the induction hypothesis Γ♮ t : U ♮ → T ♮ and Γ♮ r : U ♮ , so by the rule →⊳E , Γ♮ tr : T ♮ = ((α × β).T )♮ . By the induction hypothesis Γ♮ , x : U ♮ →⊳I , Γ♮ λx t : U ♮ → T ♮ = (U → T )♮ . t : T ♮ , so by the rule Γ ⊢ λx t : U → T Γ ⊢ t : ∀X.T By the induction hypothesis Γ♮ t : (∀X.T )♮ = ∀X.T ♮ , so by ∀E (5) the rule ∀⊳E , Γ♮ t : T ♮ [U ♮ /X]. Γ ⊢ t : T [U/X] Γ ⊢ t: T By the induction hypothesis Γ♮ t : T ♮ , so by the rule ∀⊳I , Γ♮ (6) ∀I t : ∀X.T ♮ = (∀X.T )♮ . (Note that F V (Γ) = F V (Γ♮ )). Γ ⊢ t : ∀X.T (7) (8) Γ ⊢ t : α.T Γ ⊢ r : β.T Γ ⊢ t + r : (α + β).T Γ ⊢ t: T Γ ⊢ α.t : α.T sI +I Given in the main text of the paper. By the induction hypothesis Γ♮ α.t : T ♮ = (α.T )♮ . t : T ♮ , so by the rule s⊳I , Γ♮ A.7. Proof of Theorem 5.14(3). Before proving this theorem, we need to prove the following properties: Lemma A.1. (1) Let t and r be any terms. If t →a r, then for any base term b, t[b/x] →a r[b/x]. (2) Let b1 and b2 be base terms. If b1 →a b2 , then for any term t, t[b1 /x] →∗a t[b2 /x]. Proof. (1) We proceed by structural induction on t. (a) t cannot be a variable or 0, since it reduces. (b) t = λx t′ and r = λx r′ , with t′ →a r′ . Then λx t′ [b/x] = λx (t′ [b/x]), which by the induction hypothesis →a -reduces to λx (r[b/x]) = λx r[b/x]. (c) t = α.t′ . We proceed now by cases: (i) α = 0 and r = 0, then (0.t′ )[b/x] = 0.t′ [b/x] →a 0 = 0[b/x]. (ii) α = 1 and r = t′ , then (1.t′ )[b/x] = 1.t′ [b/x] →a t′ [b/x]. (iii) t = 0 and r = 0, then (α.0)[b/x] = α.0[b/x] = α.0 →a 0 = 0[b/x]. (iv) t′ = β.t′′ and r = (α × β).t′′ , then (α.β.t′′ )[b/x] = α.β.t′′ [b/x] →a (α × β).t′′ [b/x] = ((α × β).t′′ )[b/x]. 30 P. ARRIGHI AND A. DÍAZ-CARO (v) t′ = t1 + t2 and r = α.t1 + α.t2 , then (α.(t1 + t2 ))[b/x] = α.(t1 [b/x] + t2 [b/x]) →a α.t1 [b/x] + α.t2 [b/x] = (α.t1 + α.t2 )[b/x]. (vi) t′ →a r′ , and r = α.r′ , then (α.t′ )[b/x] = α.t′ [b/x], which by the induction hypothesis →a -reduces to α.r′ [b/x] = (α.r′ )[b/x]. (d) t = t1 + r2 . We proceed now by cases: (i) t2 = 0 and r = t1 , then (t1 + 0)[b/x] = t1 [b/x] + 0 →a t1 [b/x]. (ii) t1 = α.t′ , t2 = β.t′ and r = (α + β).t′ , then (α.t′ + β.t′ )[b/x] = α.t′ [b/x] + β.t′ [b/x] →a (α + β).t′ [b/x] = ((α + β).t′ )[b/x]. (iii) t1 = α.t′ , t2 = t′ and r = (α + 1).t′ . Analogous to the previous case. (iv) t1 = t2 = t′ , and r = (1 + 1).t′ . Analogous to the previous case. (v) t1 →a t′ and r = t′ + t2 , then (t1 + t2 )[b/x] = t1 [b/x] + t2 [b/x], which by the induction hypothesis →a -reduces to t′ [b/x] + t2 [b/x] = (t′ + t2 )[b/x]. (vi) t2 →a t′ and r + t1 + t′ . Analogous to the previous case. (e) t = t1 t2 . We proceed now by cases: (i) t1 = t11 + t12 and r = t11 t2 + t12 t2 , then ((t11 + t12 )t2 )[b/x] = (t11 [b/x] + t12 [b/x])t2 [b/x] →a t11 [b/x]t2 [b/x] + t12 [b/x]t2 [b/x] = (t11 t2 )[b/x] + (t12 t2 )[b/x] = (t11 t2 + t12 t2 )[b/x]. (ii) t2 = t21 + t22 and t = t1 t21 + t1 t22 . Analogous to the previous case. (iii) t1 = α.t′ and r = α.t′ t2 , then ((α.t′ )t2 )[b/x] = α.t′ [b/x]t2 [b/x] →a α.t′ [b/x]t2 [b/x] = (α.t′ t2 )[b/x]. (iv) t2 = α.t′ and r = α.t1 t′ . Analogous to the previous case. (v) t1 = r = 0, then (0t2 )[b/x] = 0t2 [b/x] →a 0 = 0[b/x]. (vi) t2 = r = 0. Analogous to the previous case. (vii) t1 →a t′ and r = t′ t2 , then (t1 t2 )[b/x] = t1 [b/x]t2 [b/x], which by the induction hypothesis →a -reduces to t′ [b/x]t2 [b/x] = (t′ t2 )[b/x]. (viii) t2 →a t′ and r = t1 t′ . Analogous to the previous case. (2) We proceed by structural induction over t. (i) t = x, then x[b1 /x] = b1 →a b2 = x[b2 /x]. (ii) t = y, then y[b1 /x] = y = y[b2 /x]. (iii) t = 0, analogous to the previous case. (iv) t = λy t′ , then (λy t′ )[b1 /x] = λy t′ [b1 /x]. By the induction hypothesis t′ [b1 /x] →∗a t′ [b2 /x], so λy t′ [b1 /x] →∗a λy t′ [b2 /x]. (v) t = t1 t2 . Then (t1 t2 )[b1 /x] = t1 [b1 /x]t2 [b1 /x]. By the induction hypothesis t1 [b1 /x] →∗a t1 [b2 /x] and t2 [b1 /x] →∗a t2 [b2 /x], so t1 [b1 /x]t2 [b1 /x] →∗a t1 [b2 /x]t2 [b2 /x] = (t1 t2 )[b2 /x]. (vi) t = t1 +t2 . Then (t1 +t2 )[b1 /x] = t1 [b1 /x]+t2 [b1 /x]. By the induction hypothesis t1 [b1 /x] →∗a t1 [b2 /x] and t2 [b1 /x] →∗a t2 [b2 /x], so one has t1 [b1 /x]+t2 [b1 /x] →∗a t1 [b2 /x] + t2 [b2 /x] = (t1 + t2 )[b2 /x]. (vii) t = α.t′ . Then (α.t′ )[b1 /x] = α.t′ [b1 /x]. By the induction hypothesis one has t′ [b1 /x] →∗a t′ [b2 /x], so α.t′ [b1 /x] →∗a α.t′ [b2 /x] = (α.t′ )[b2 /x]. Now, we can prove Theorem 5.14(3), using this property. Proof. Let t →a u and t →β r. We proceed by structural induction on t. (1) t cannot be a variable or 0, since it reduces. (2) t = λx t1 . Then u = λx u1 and r = λx r1 with t1 →a u1 and t1 →β r1 . Then by the induction hypothesis there exists t′1 such that u1 →β t′1 and r1 →a t′1 . Take t′ = λx t′1 . (3) t = t1 t2 . We proceed now by cases: A SYSTEM F ACCOUNTING FOR SCALARS 31 (a) r = r1 t2 where t1 →β r1 . We proceed now by cases: (i) u = u1 t2 where t1 →a u1 . Then by the induction hypothesis, there exists t′1 such that r1 →a t′1 and u1 →β t′1 . Take t′ = t′1 t2 . (ii) u = t1 u2 where t2 →a u2 . Take t′ = r1 u2 . (b) r = t1 r2 where t2 →β r2 . Analogous to the previous case. (c) r = r1 [t2 /x] where t1 = λx r1 and t2 is a base term. We proceed now by cases: (i) u = (λx u1 )t2 where r1 →a u1 . By Lemma A.1(1), r = r1 [t2 /x] →a u1 [t2 /x], and note that u →β u1 [t2 /x]. (ii) u = (λx r1 )u2 where t2 →a u2 . By Lemma A.1(2), r = r1 [t2 /x] →∗a r1 [u2 /x], and note that u →β r1 [u2 /x]. (4) t = t1 + t2 . We proceed now by cases: (a) u = (α + β).u′ with t1 = α.u′ and t2 = β.u′ . We proceed now by cases: (i) r = α.r′ + β.u′ with u′ →β r′ . Then note that u = (α + β).u′ →β (α + β).r′ and α.r′ + β.u′ →β α.r′ + β.r′ →a (α + β).r′ . (ii) r = α.u′ + β.r′ with u′ →β r′ . Analogous to the previous case. (b) u = (α + 1).u′ with t1 = α.u′ and t2 = u′ . Analogous to the previous case. (c) u = (1 + 1).u′ with t1 = t2 . Analogous to the previous case. (d) u = t1 with t2 = 0. Then the only possibility for r is to be r′ + 0 where t1 →β r′ . Then r′ + 0 →a r′ , which closes the case. (5) t = α.t1 . The only possibility for r is to be α.r′ where t1 →β r′ . We proceed now by cases: (a) u = (α × β).u1 with t1 = β.u1 , then r′ = β.r′′ with u1 →β r′′ . Then (α × β).u1 →β (α × β).r′′ and α.(β.r′′ ) →a (α × β).r′′ . (b) u = α.u1 + α.u2 with t1 = u1 + u2 . We proceed now by cases: (i) r′ = r1 +u2 with u1 →β r1 , then α.(r1 +u2 ) →a α.r1 +α.u2 and α.u1 +α.u2 →β α.r1 + α.u2 . (ii) r′ = u1 + r2 with u2 →β r2 , analogous to the previous case. (c) u = t1 with α = 1. Note that 1.r′ →a r′ . (d) u = 0 with α = 0. Note that α.r′ →a 0. (e) u = 0 with t1 = 0. Absurd since t1 →β r′ . A.8. Proof of Lemma 6.6. Structural induction on t1 . (1) t1 = x. Done. (2) t1 = λx r, then t1 t2 → r[t2 /x], which is a contradiction. (3) t1 = 0, then t1 t2 → 0, which is a contradiction. (4) t1 = α.r, then t1 t2 → α.rt2 , which is a contradiction. (5) t1 = r + u, then t1 t2 → rt2 + ut2 , which is a contradiction. (6) t1 = u1 u2 , then by the induction hypothesis u1 = x~r, so u1 u2 = x~r′ , where ~r′ = ~r, u2 . A.9. Proof of Lemma 6.7. Fist we need some remarks. Remark A.2. (1) Variables can only have type T ∈ T(λ2la ), since contexts have only classic types in the type system B, and forall eliminations do not introduce types with scalars. 32 P. ARRIGHI AND A. DÍAZ-CARO (2) If A ∈ T(λ2la ) and U is a unit type, with α.U ≡ β.A, then it is easy to check that U ∈ T(λ2la ), α = β and U ≡ A, since there is no way using the equivalences to remove a scalar at the right of an arrow. Now, we prove Lemma 6.7 Proof. I induction on the derivation of Γ ⊢ x~r : T . We only consider the cases ending with an application. Γ ⊢ x: U → T Γ ⊢ t : β.U →E (1) Since U → T ∈ T(λ2la ), then T ∈ T(λ2la ). Γ ⊢ xt : β.T Γ ⊢ x~r : α.(U → T ) Γ ⊢ t : β.U Then by the induction hypothesis, U → (2) →E T ∈ T(λ2la ), so T ∈ T(λ2la ). Γ ⊢ (x~r)t : (α × β).T (3) (4) Γ ⊢ x~r : ∀X.T Γ ⊢ x~r : T [A/X] Γ ⊢ x~r : T Γ ⊢ x~r : ∀X.T ∀I ∀E Then by the induction hypothesis there exist B ∈ T(λ2la ) and α ∈ S such that ∀X.T ≡ α.B, so there exists C ∈ T(λ2la ) such that T ≡ α.C, then T [A/X] ≡ (α.C)[A/X] ≡ α.C[A/X]. Note that C[A/X] ∈ T(λ2la ). Then by the induction hypothesis there exist A ∈ T(λ2la ) and α ∈ S such that T ≡ α.A, so ∀X.T ≡ ∀X.α.A ≡ α.∀X.A. A.10. Proof of Lemma 6.8. First note that if A ∈ T(λ2la ) and α.T ≡ α.A, then T = A or T = 1.A: The only equivalence rule involving a type that could be in T(λ2la ) is 1.T ≡ T , so if α.T ≡ α.A, T must be either 1.A or A. Now we prove the Lemma for ≻tX,Γ , and in the light of Lemma 4.7, we can remove the scalar α. We proceed now by cases: • A ≡ ∀X.T , then either ∀X.T = A, so T ∈ T(λ2la ), or ∀X.T = 1.A, in which case T = 1.B with B ∈ T(λ2la ). • T ≡ ∀X.R and A ≡ R[U/X]. Since R[U/X] ∈ T(λ2la ), then R ∈ T(λ2la ) and so ∀X.R ∈ T(λ2la ), then either T ∈ T(λ2la ) or T ≡ 1.B with B ∈ T(λ2la ). A.11. Proof of Theorem 6.5. Instead, we prove the most general case: If Γ ⊢ t : α.A then ω(nf(t)) = α, by structural induction on nf(t). We take Γ ⊢ nf(t) : α.A, which is true by Theorem 4.1. (1) nf(t) = 0. Then ω(nf(t)) = 0. In addition, by Lemma 4.19, α.A ≡ 0, so by Theorem 4.20, α = 0. (2) nf(t) = x or nf(t) = λx t′ . Then ω(nf(t)) = 1. In addition, by Lemma 4.18, α = 1. (3) nf(t) = γ.t′ . Given in the main text of the paper. (4) nf(t) = t1 + t2 . Then ω(nf(t)) = ω(t1 ) + ω(t2 ). By Lemma 4.14, there exist σ, φ ∈ S such that Γ ⊢ t1 : σ.A and Γ ⊢ t2 : φ.A with σ +φ = α. Then by the induction hypothesis ω(t1 ) = σ and ω(t2 ) = φ, so ω(t1 ) + ω(t2 ) = σ + φ = α. (5) nf(t) = t1 t2 . Given in the main text of the paper. This work is licensed under the Creative Commons Attribution-NoDerivs License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/2.0/ or send a letter to Creative Commons, 171 Second St, Suite 300, San Francisco, CA 94105, USA, or Eisenacher Strasse 2, 10777 Berlin, Germany
6cs.PL
1 SpecWatch: A Framework for Adversarial Spectrum Monitoring with Unknown Statistics Ming Li, Member, IEEE, Dejun Yang, Member, IEEE, Jian Lin, Member, IEEE, Ming Li, Member, IEEE, and Jian Tang, Senior Member, IEEE arXiv:1710.05981v1 [cs.IT] 16 Oct 2017 Abstract In cognitive radio networks (CRNs), dynamic spectrum access has been proposed to improve the spectrum utilization, but it also generates spectrum misuse problems. One common solution to these problems is to deploy monitors to detect misbehaviors on certain channel. However, in multi-channel CRNs, it is very costly to deploy monitors on every channel. With a limited number of monitors, we have to decide which channels to monitor. In addition, we need to determine how long to monitor each channel and in which order to monitor, because switching channels incurs costs. Moreover, the information about the misuse behavior is not available a priori. To answer those questions, we model the spectrum monitoring problem as an adversarial multi-armed bandit problem with switching costs (MABSC), propose an effective framework, and design two online algorithms, SpecWatch-II and SpecWatch-III, based on the same framework. To evaluate the algorithms, we use weak regret, i.e., the performance difference between the solution of our algorithm and optimal (fixed) solution in hindsight, as the metric. We prove that the expected weak regret of SpecWatch-II is O(T 2/3 ), where T is the time horizon. Whereas, the actual weak regret of SpecWatch-III is O(T 2/3 ) with probability 1 − δ, for any δ ∈ (0, 1). Both algorithms guarantee the upper bounds matching the lower bound of the general adversarial MABSC problem. Therefore, they are all asymptotically optimal. Index Terms Cognitive Radio Networks, Spectrum Monitoring, Multi-armed Bandit Problem. This is an extended and enhanced version of the paper [50] that appeared in INFOCOM 2016. This research was supported in part by NSF grants 1443966, 1444059, and 1619728. The information reported here does not reflect the position or the policy of the federal government. M. Li, D. Yang and J. Lin are with Colorado School of Mines, Golden, CO 80401. E-mail: {mili, djyang, jilin}@mines.edu. M. Li is with the University of Arizona, Tucson, AZ 85721. E-mail: [email protected]. J. Tang is with Syracuse University, Syracuse, NY 13210. E-mail: [email protected]. 2 I. I NTRODUCTION With the proliferation of wireless devices and applications, demand for access to spectrum has been growing dramatically and is likely to continue to grow in the foreseeable future [1]. However, there is a paradoxical phenomenon that usable radio frequencies are exhausted while much of the licensed spectrum lies idle at any given time and location [2]. To improve the radio spectrum utilization efficiency, dynamic spectrum access (DSA) in cognitive radio networks (CRNs) has been proposed as a promising approach. Among various DSA strategies, opportunistic spectrum access (OSA) based on the hierarchical access model has received much attention recently [3–10]. This underlay approach achieves spectrum sharing by allowing secondary (unlicensed) users (SUs) to dynamically search and access the spectrum vacancy while limiting the interference perceived by primary (licensed) users (PUs) [11]. OSA helps to improve the spectrum utilization but also results in spectrum misuse or abuse problems due to the flexibility of spectrum opportunity. For example, an SU may intentionally disobey the interference constraints set by the PU; or some greedy SUs may transmit more aggressively in time and frequency to dominate the spectrum sharing, or even emulate the PU to prevent other SUs from sharing. Through such spectrum access misbehavior, the malicious users (MUs), i.e., the misbehaving SUs, not only harm the spectrum access operations of normal users, but also impede the CRNs to function correctly since there is no incentive to pay for spectrum access [12]. Thus, spectrum monitoring is necessary and imperative. To address the spectrum misuse problem, different trusted infrastructures have been proposed to detect spectrum misuse and punish MUs [12–15]. In addition, various detection techniques have been designed, including enforcing silence slots [16], publicizing back-off sequences [17, 18], exploiting spatial pattern of signal strength [19], measuring detector value [20]. There is also a crowdsourcing-based framework named SpecGuard [21] which explores dynamic power control at SUs to contain the spectrum permit in physical layer signals. Another crowdsourced enforcement framework [22] improves the probability of detection while reducing the likelihood of false positives for spectrum misuses and it can detect misuses caused by mobile users. Moreover, applying big data analysis and machine learning to cloud-based radio access networks also provide an appropriate approach to enable long-term spectrum monitoring [23]. However, all these works assume that all channels can be monitored at the same time. In this paper, we consider spectrum monitoring in multi-channel CRNs with limited monitoring 3 resource. In particular, we deploy one monitor with multiple radios where each radio is in charge of one channel. The main problem is the selection of channels since monitoring all channels simultaneously is very energy-consuming and impractical. It is challenging because the information of MUs is unknown a priori. In addition, switching costs caused by changing channels must be considered. To solve this problem, we formulate it as an adversarial (nonstochastic) multi-armed bandit (MAB) problem [24] with switching costs. We then propose an effective spectrum monitoring framework and design two online algorithms based on it. In summary, we contribute in the following aspects: 1) We study the adversarial spectrum monitoring problem with unknown statistics in multichannel CRNs, while considering the switching cost. We model this problem as an adversarial MAB-SC problem. 2) We propose an online spectrum monitoring framework, SpecWatch. Based on this framework, we design two spectrum monitoring algorithms, SpecWatch-II and SpecWatch-III, which differ in the way of calculating strategy probabilities and updating strategy weights. Our algorithms guarantee the proved performance under any type of adversary settings. In addition, they can work with any spectrum misuse detection techniques in the current literature. 3) We prove that the expected weak regret of SpecWatch-II is O(T 2/3 ), which matches the lower bound in [25]. Therefore, SpecWatch-II is asymptotically optimal. Note that the expected value of normalized weak regret is guaranteed to be O(1/T 1/3 ), which converges to 0 as time horizon T approaches to ∞. 4) SpecWatch-III select channels more strategically and explore all channels more efficiently. We prove that this algorithm guarantees the actual weak regret to be O(T 2/3 ), which is asymptotically optimal as well, with probability 1 − δ, for any δ ∈ (0, 1). II. R ELATED W ORK A. Spectrum Monitoring Problem Spectrum monitoring problem has been formulated as optimization problems with different objectives. In [26], Shin and Bagchi modeled the channel assignment for monitoring wireless mesh networks as a maximum-coverage problem with group budget constraints. They then extended it to the model where monitors may make errors due to poor reception [27]. Along the same line, Nguyen et al. [28] focus on the weighted version of the problem, where users to 4 be covered have weights. To maximize the captured data of interest, Chen et al. [29] utilized support vector regression to guide monitors to intelligently select channels. Considering similar objectives, Shin et al. [30] designed a cost-effective distributed algorithm. With a different approach, Yan et al. [31] solved the problem by predicting secondary users’ access patterns. However, we consider a different objective in this paper, which is to capture spectrum misuses. In addition, we assume no information about the malicious users. The closest works to ours were presented in [32–36]. In [32], Arora and Szepesvari first modeled the spectrum monitoring problem as a multi-armed bandit problem (MAB) to monitor the maximum number of active users. They designed two algorithms to learn sequentially the user activities while making channel assignment decisions. Observing the above algorithms suffer from high computation cost, Zheng et al. [33] traded off between the rate of learning and the computation cost. They proposed a centralized online approximation algorithm and show that it incurs sub-linear regret bounds over time and a distributed algorithm with moderate message complexity. In [34], Le et al. considered switching costs for the first time and utilized Upper Confident Bound-based (UCB) policy [37] which enjoys a logarithmic regret bound in time that depends sublinearly on the number of arms, while its total switching cost grows in the order of O(log(log T)). Considering a different objective, Yi et al. [35] used UCB to capture as much as interested user data. However, these works used the stochastic MAB model, where the rewards for playing each arm are generated independently from unknown but fixed distributions. Our model, in contrast, does not make such assumptions. The only work considered the similar problem model to ours is [36], where Xu et al. tried to capture packets of target SUs for CRN forensics. However, they did not provide any algorithm whose actual weak regret can be bounded with a confidence value. B. Multi-arm Bandit Problem The MAB problem first introduced by Robbins [38] has been extensively studied in the literature. The classical MAB problem models the trade-offs faced by a gambler who aims to maximize his rewards over many turns by exploring different arms of slot machines and to exploit arms which have provided him more rewards than others. The gambler has no knowledge about the reward of each arm a priori and only gains knowledge of the arms he has pulled. An 5 MAB algorithm should specify a strategy by which the gambler chooses an arm at each turn. The performance of an algorithm is measured in regret, as will be elaborated in Section III. There are mainly two algorithm families based on different formulations of MAB. The upper confidence bounds (UCB) family of algorithms [39] works for stochastic MAB, whose regret can be as small as O(ln T) where T is the number of turns. However, these algorithms are established with the assumption that there exist fixed (though unknown) probability distributions of different arms to generate rewards, which may not be satisfied in our spectrum monitoring problem and thus not considered by us. The other algorithm family is the EXP3 family [24] for adversarial MAB. Auer [24] has studied MAB with no assumption on the rewards distribution and proposed algorithms with regret of O(T 1/2 ). There are also some algorithms considering both stochastic and adversarial adversary [40, 41]. However, switching costs are not considered in all above works. In our model, each time the monitor changes its monitoring channels, there are drastic costs in terms of delay, packet loss, and protocol overhead [42]. These costs must be taken into consideration when designing monitoring algorithms. Although there exists some work on stochastic multi-armed bandit problem with switching cost (MAB-SC) [42], little research has been done on adversarial MAB-SC. Dekel et al. [25] proved the lower bound of the regret for adversarial MAB-SC to be Ω̃ (T 2/3 ). In this paper, the upper bound of regret guaranteed by our algorithms matches this lower bound. Moreover, different from existing works, the strategy for each turn (or timeslot as in our model) is no longer a single arm because we consider a more general case where multiple channels can be monitored at the same time. Therefore, none of above algorithms can be directly applied to our problem. III. S YSTEM M ODEL AND P ROBLEM S TATEMENT We consider a cognitive radio network which adopts a hierarchical access structure with primary users (PUs) and secondary users (SUs). We assume the spectrum is divided into a set K = {1, 2, . . . , k, . . . , K } of K channels. The total time period is discretized into a set T = {1, 2, . . . , t, . . . , T } of T timeslots. Ideally, SUs seek spectrum opportunities among K channels in a non-intrusive manner. However, the malicious users (MUs) may perform unauthorized access or selfish access. We consider the scenario where there exists one monitor with l radios and a set M = {1, 2, . . . , m, . . . , M } of M MUs. Note that for the case of multiple monitors, if there is a central controller, it is equivalent to one monitor with the same number of radios; otherwise, 6 each monitor can execute our algorithms independently. In the latter case, however, the regret may not be bounded. Since the monitor is equipped with l radios, it can monitor up to l channels at the same time. Assume that one radio is tuned to monitor channel k, and there are Mk MUs on that channel, then the detection probability of that radio to successfully detect MUs’ presence is pd (Mk ), which is dependent on the monitor’s hardware and the detection technique. Any technique in [16–20] can be adopted to detect spectrum misuses. In practice, the detection probability will also be dependent on the presence of PU and other SUs. However, since our algorithms do not require the knowledge of the detection probability, we simplify the notion to pd (Mk ) where it seems that only Mk matters. Let {0, 1, . . . , l} K denote the strategy space of the monitor. A strategy s is represented as (as1, as2, . . . , asK ), where the value of the ask is 1 if a radio is assigned to monitor channel k, Í 0 otherwise. Therefore, k∈K ask = l. For example, considering 4 channels and a monitor with 2 radios, strategy (0, 1, 0, 1) indicates that one radio is tuned to monitor channel 2 and the other radio is tuned to monitor channel 4. For notational simplicity, we will write k ∈ s instead of ask = 1 to denote that channel k is chosen in strategy s. Since each radio is assigned one out  of K channels to monitor, and we have l radios in total, the number of strategies is S = kl . The whole strategy set is represented as S = {1, 2, . . . , s, . . . , S}. Note that K and l are usually small. For example, the regulated 2.4 GHz band is divided into only 14 channels. The maximum number of radios on each monitor defined by the active IEEE 802.11af standard is set to be 4 [43]. In this paper, we assume both the monitor and MUs are static, i.e., staying at the same location. Note that when mobility is considered as in the pursuit-evasion problems [44], we only need to enlarge the strategy space by including the location dimension. At the beginning of timeslot t ∈ T , the monitor selects only one strategy from the strategy set S, and we denote the chosen strategy as Xt . We assume the switching cost c(Xt−1, Xt ) ∈ [0, 1],   but our algorithm can be generalized to any range c, c̄ , c < c̄ by scaling, where c and c̄ are the minimum value and the maximum value of the switching cost, respectively. For simplicity, set the switching cost of the first timeslot to be c(X0, X1 ) = c0 regardless of what X1 is. Clearly, c(Xt−1, Xt ) = 0 if Xt−1 = Xt . Threat Model: At each timeslot t ∈ T , each MU m ∈ M chooses one channel to attack (conduct n o m m m m denotes misuses) according to its attack probability distribution Pt = Pt,1, . . . , Pt,K where Pt,k 7 the probability of MU m attacking channel k in timeslot t. Since MUs may not attack in some Í m ≤ 1 for any m ∈ M and t ∈ T . We consider two types of adversary: timeslot, k∈K Pt,k 1) Oblivious Adversary (Stochastic): The MUs keep their attack patterns regardless of how the monitor work. For any MU m, the attack distribution Ptm remains the same throughout the time horizon. In this paper, we consider three different adversary settings (elaborated in Section VII): fixed adversary, uniform adversary, and normal adversary. 2) Adaptive Adversary (Adversarial): The MUs know every action of the monitor from the beginning to the current timeslot and adjust their strategies accordingly based on any learning algorithms, i.e., the attack distribution might change with time. Our framework and algorithms work for both types and the theoretical bounds hold no matter what the adversary type is. Now we define the reward for the monitor. The strategy reward of choosing strategy s in timeslot t is  Í    k∈s fk,t  def gs,t =   0  is defined as if s = Xt, (1) otherwise, where the channel reward fk,t    r if channel k ∈ Xt and misuse is detected,  def fk,t = (2)    0 otherwise,  where the unit reward r is assumed to be scaled and satisfies rl ≤ 1 for the purpose of mathematical analysis. Note that the probability of at least one MU being detected on monitored channel k is determined by the number of radios on that channel Mk , the detection probability m } M . We denote the detection probability on channel k by pd (Mk ) and the action of MUs {Pt,k m=1   m M adopting strategy Xt at timeslot t as Pd a Xt k , pd (Mk ), {Pt,k }m=1 which is assumed to be a nonm . Thus, the channel reward f decreasing function in a Xt k , pd (Mk ), and Pt,k k,t is r with probability   m }M Pd a Xt k , pd (Mk ), {Pt,k m=1 . Note that the knowledge of this probability is not required. Assume the monitor follows the strategy sequence X1, X2, . . . , XT generated by any monitoring Algorithm A. At the end of timeslot T, the cumulative strategy reward is T Õ def GA = g Xt ,t . (3) t=1 Meanwhile, the monitor incurs cumulative switching cost T Õ def LA = c(Xt−1, Xt ). t=1 (4) 8 Thus, the utility of the monitor by choosing Algorithm A is UA = GA − LA . (5) To measure the performance of Algorithm A, we use a special case of the worst-case regret, weak regret [24], as the metric. The weak regret of Algorithm A is the difference between the utility by using best fixed algorithm and the actual utility by using Algorithm A. A fixed algorithm chooses only one strategy for all timeslots and never switches. The best fixed algorithm is the one resulting in the highest utility among all fixed algorithms. The strategy chosen in best fixed algorithm is called Í  def the best strategy, denoted by sbest . Formally, sbest = argmaxs∈S Tt=1 gs,t − c0 , and the utility by using the best fixed algorithm is Ubest = G best − Lbest, def where G best = maxs∈S ÍT t=1 gs,t (6) and Lbest = c0 since the switch only happens at the first timeslot. Note that the best strategy can only be found in hindsight. Now we can define the weak regret of Algorithm A as RA = Ubest − UA . def (7) Problem Statement: Given K channels, time horizon T, and a monitor with l radios, our objective is to design online spectrum monitoring algorithms such that the weak regret is minimized, in the presence of different adversaries. We make no assumption on the knowledge   m }M of the probability functions pd (Mk ) and Pd a Xt k , pd (Mk ), {Pt,k m=1 . In addition, the attack distribution Ptm and the reward of choosing a strategy are unknown a priori. Therefore, any desired algorithm needs to balance not only the trade-off between exploration and exploitation, but also that between strategy rewards and switching costs. This is a very challenging problem. IV. S PECTRUM M ONITORING F RAMEWORK In this section, we design SpecWatch, a spectrum monitoring framework, based on the batching version of exponential-weight algorithm for exploration and exploitation, where the idea of batching is inspired by [45]. To control the trade-off between the reward and the switching cost, we group all the timeslots into consecutive and disjoint batches. Within each batch, we stick to the same strategy to avoid 9 the switching cost. Between batches, we reselect a strategy to gain higher rewards. A smaller batch size may result in larger reward but larger switching cost, while a bigger batch size may result in smaller switching cost but smaller reward. SpecWatch: 1 Parameter: τ ∈ [1, T] 2 Initialization: ws,1 ← 1 for all s ∈ S, J ← dT/τe. 3 for j ← 1, . . . , J do 4 Calculate the strategy probability ps, j for all s ∈ S 5 Choose strategy Z j ∈ S randomly accordingly to the probability distribution p1, j , . . . , pS, j and incur switching cost c(Z j−1, Z j ). 6 Monitor using Z j for τ timeslots, i.e., X[ j]+i ← Z j for 1 ≤ i ≤ τ, and record the reward of each monitored channel, fk,[ j]+i for all k ∈ Z j , 1 ≤ i ≤ τ. 7 8 Update strategy weight ws, j+1 for all s ∈ S. end The design details of SpecWatch are illustrated above. We first set the initial weight of each strategy to be 1. Given the batch size τ, the timeslots 1, 2, . . . , T are divided into J = dT/τe consecutive and disjoint batches. Let [ j] = ( j −1)τ for 1 ≤ j ≤ J. Then the j-th batch starts from timeslot [ j] + 1 and ends at timeslot [ j] + τ as shown in Fig. 1. At the beginning of each batch, we calculate the strategy probabilities according to strategy weights. Then we randomly select a strategy based on the probability distribution. During the whole batch, the chosen strategy remains the same. At the end of each batch, strategy weights are updated according to the strategy rewards. Fig. 1: Example of batching timeslots with batch size τ = 4 In the following sections, we design two effective online spectrum monitoring algorithms, SpecWatch-II and SpecWatch-III. These two algorithms are designed based on SpecWatch and 10 TABLE I: M AIN N OTATIONS Notation Meaning K set of all channels T set of all timeslots M set of malicious users S set of all strategies C covering strategy set Ck number of strategies in C that contains channel k l number of radios in the monitor r unit channel reward which satisfies rl ≤ 1 c(Xt−1, Xt ) switching cost from strategy Xt−1 to Xt GA cumulative strategy rewards of Algorithm A LA cumulative switching costs of Algorithm A UA utility of Algorithm A RA weak regret of Algorithm A τ parameter to determine the batch size J number of batches γ parameter to calculate strategy probabilities η parameter to update weights β parameter to calculate channel scores fk,t channel reward of channel k in timeslot t gs,t strategy reward of strategy s in timeslot t f̄k, j average channel reward of channel k in batch j ḡs, j average strategy reward of strategy s in batch j 0 f̄k, j 0 ḡs, j average channel score of channel k in batch j hk, j channel weight of channel k in batch j ws, j strategy weight of strategy s in batch j Wj total weight of all strategies in batch j qk, j channel probability of channel k in batch j ps, j strategy probability of strategy s in batch j average strategy score of strategy s in batch j SpecWatch+ in our paper [46]. We rename SpecWatch and SpecWatch+ to SpecWatch-I and SpecWatch-III, respectively. We introduce SpecWatch-II in this paper and discard SpecWatch-I because SpecWatch-II has better theoretical performance than SpecWatch-I. 11 The main notations are summarized in Table I. Different algorithms use different equations to calculate the strategy probabilities (Line 3) and update the strategy weights (Line 6). With carefully chosen parameters, their theoretical performances are shown in Table II. In summary, SpecWatch-I and SpecWatch-II bound the expected weak regrets to O(T 2/3 ); while SpecWatch-III bounds the actual weak regret to O(T 2/3 ) with user-defined probability. TABLE II: A LGORITHM C OMPARISON Algorithm Core Functions Theoretical Bound of Weak Regret γ w ps, j = (1 − γ) Ws, j + S j 1 2 IE [RI ] ≤ 3 ((e − 1)S ln S) 3 T 3 SpecWatch-I   1 Íτ f j]+i γ Í ws, j+1 = ws, j exp S k ∈s τÍ i=1 k,[ s:k ∈s p s, j w ps, j = Ws, j j 1 2  3 IE [RII ] ≤ 3 12 S ln S T 3 SpecWatch-II   Í 1 k ∈Z j (1/l− τ1 τi=1 fk,[ j]+i ) Í Í ws, j+1 = ws, j exp −η k ∈s p s:k ∈s w s, j γ ps, j = (1 − γ) Ws, j + C 1s ∈ C j SpecWatch-III # 2 q 3 √ 2 K IPr RIII ≤ 2 4 lC ln S + 2 lK ln δ T3 ≤ 1−δ "  τ 1 © Í ª τ Í i=1 fk,[ j]+i +β ws, j+1 = ws, j exp ­η k ∈s ® ∈s w s, j γC k (1−γ) s:kW + C j « ¬ Í V. S PECTRUM M ONITORING A LGORITHM WITH B OUNDED E XPECTED W EAK R EGRET In this section, we design one spectrum monitoring algorithm, SpecWatch-II, whose expected weak regret is theoretically bounded. A. SpecWatch-II 1) Algorithm Design: Compared to SpecWatch-I, the input parameters of SpecWatch-II are τ and η, where τ determines the batch size and η is used to calculate strategy weights; the strategy probabilities in SpecWatch-II are proportion to the strategy weights only, and the strategy weights are updated smaller for the next timeslot. 12 Calculating Strategy Probability ps, j . The probability of choosing strategy s ∈ S is calculated using ws, j , (8) Wj Í is the strategy weight of strategy s in batch j, and W j = s∈S ws, j . Recall that in ps, j = where ws, j SpecWatch-I, we use the weighted average of two terms, ps, j = (1 − γ) Ws,jj + γS , where the first is w to exploit strategies with good reward history, and the second guarantees the exploration over all strategies. γ controls the balance between them. Now we only have one term, but the balance still exists. This is because a strategy not chosen before is guaranteed to have a higher weight, due to the way we update the strategy weight as discussed below. Choosing Strategy Z j and Monitoring Spectrum. We select a strategy Z j ∈ S randomly according to the probabilities calculated above. The monitor keeps using Z j for all τ timeslots in batch j, i.e., X[ j]+i = Z j for 1 ≤ i ≤ τ. Therefore, the monitor only incurs switching cost c(Z j−1, Z j ) once for the whole batch j. Depending on the misuse behavior of MUs (discussed in Section III), the monitor receives rewards on monitored channels accordingly. The monitor keeps records of fk,[ j]+i for all k ∈ Z j and 1 ≤ i ≤ τ. The strategy reward gained by the monitor is the summation of rewards over all monitored channels. Updating Strategy Weight ws, j+1 . At the end of each batch, we update strategy weights in the following steps. First, we calculate the average channel reward of each channel k ∈ K in batch j, τ 1Õ fk,[ j]+i . f̄ k, j = τ i=1 (9) By (2), f̄ k, j ∈ [0, r]. We also calculate the probability of choosing channel k ∈ Z j by summing up the probabilities of strategies containing that channel, Õ q k, j = ps, j . (10) s:k∈s where s : k ∈ s denotes any strategy s containing channel k. Based on (9) and (10), we calculate the average channel score, 1/l − f̄ k, j 1 k∈Z j , (11) q k, j is an indicator function which has the value 1 if k ∈ Z j ; 0 otherwise. This score is f̄0k, j = where 1 k∈Z j always nonnegative since f̄ k, j ≤ r ≤ 1/l. Then we update each channel weight by   0 h k, j+1 = h k, j exp −ηf̄ k, j , (12) 13 where h k,1 = 1 for all k ∈ K. Note that the channel weight is non-increasing from batch to batch. Finally, we give the formal definition of strategy weight, which is defined as Ö def ws, j = h k, j . (13) k∈s Combining (12) and (13), we can directly update the strategy weight for each s ∈ S by ws, j+1 = ws, j exp(−ηḡ0s, j ), (14) where ḡ0s, j is the average strategy score for each s ∈ S, i.e., Õ ḡ0s, j = f̄0k, j . (15) k∈s Note that by combining (9), (10) and (11), we can directly calculate ḡ0s, j directly by Í Õ Õ 1 k∈Z j (1/l − f̄ k, j ) Õ 1 k∈Z j (1/l − 1 τ fk,[ j]+i ) τ i=1 0 0 Í = . ḡs, j = f̄ k, j = q p k, j s, j s:k∈s k∈s k∈s k∈s (16) Remark. We do not update strategy weights based on strategy rewards, but instead calculate channel weights (12) first. This is because the rewards of monitored channels provide useful information on those unchosen strategies containing these channels. 2) Performance Analysis: To analyze the performance of SpecWatch-II, we first bound the difference between the reward gained by SpecWatch-II and that by the best fixed algorithm (Lemma 1), and then prove the upper bound of the expected weak regret (Theorem 1). For a better understanding of Theorem 1, we present a specific bound obtained by a particular choice of parameters η and τ (Corollary 1). Recalling (5), (6) and (7), the weak regret of SpecWatch-II is RII = (G best − Lbest ) − (GII − LII ). (17) Since the best fixed algorithm never switches the strategies, and SpecWatch-II only switches between batches for at most J times, their cumulative switching costs are J Õ Lbest = c0 ∈ [0, 1] and LII = c(Z j−1, Z j ) ≤ J. j=1 Thus, we have LII − Lbest ≤ J. (18) Now it suffices to only consider the difference between rewards. An important observation is that we group the timeslots into batches, calculate the strategy probabilities only at the beginning 14 of each batch, and use the average value of entire batch to update weight. Therefore, each batch can be considered as a round in conventional MAB. With this consideration, we introduce the notations below for our proofs, ḡs, j = Õ f̄k, j , ḠII = def J Õ ḡ Z j , j Ḡbest = max def and s∈S j=1 k∈s J Õ ḡs, j . (19) j=1 Note that ḡs, j = Õ τ f̄ k, j k∈s 1Õ 1 ÕÕ = f k, j = fk,[ j]+r τ k∈s τ k∈s i=1 τ τ 1 ÕÕ 1Õ = fk,[ j]+r = gs,[ j]+r . τ i=1 k∈s τ i=1 Thus we have GII = T Õ g Xt ,t = τ t=1 J Õ ḡs, j = τ ḠII . (20) j=1 Similarly, G best = τ Ḡbest . (21) We now provide the bound of the expected difference between ḠII and Ḡbest . Lemma 1. For any type of adversaries, any T > 0, and any η > 0, we have   ηJS ln S IE Ḡbest − ḠII ≤ + , 2 η (22) where ln is the natural logarithm function. Proof. The proof of this lemma is based on [40, Theorem 3.1] with necessary modifications and extensions. 15 First we analyze W j+1 Wj . For any sequences Z1, . . . , Z j generated by SpecWatch-II, we have Õ ws, j+1 W j+1 = Wj Wj s∈S   Õ ws, j = exp −ηḡ0s, j Wj s∈S   Õ = ps, j exp −ηḡ0s, j (23) s∈S Õ ≤  ηḡ0s, j ps, j 1 − s∈S ≤ 1−η Õ ps, j ḡ0s, j  1  0 2 ηḡs, j + 2 (24)  2 η2 Õ ps, j ḡ0s, j , + 2 (25)  s∈S s∈S where (23) uses the definition of ps, j , and (24) holds by the fact that for x ≥ 0, e−x ≤ 1− x + 12 x 2 .  2 Í Í Next, we bound (25) by bounding s∈S ps, j ḡ0s, j and s∈S ps, j ḡ0s, j . ! Õ Õ Õ ps, j ḡ0s, j = ps, j f̄0k, j s∈S s∈S k∈s Õ Õ ! = f̄0k, j k∈K = ps, j s:k∈s Õ f̄0k, j q k, j  k∈K = Õ 1/l − f̄ k, j  k∈K = Õ  Õ  1/l − f̄ k, j + k∈Z j 1/l − f̄ k, j k∈K\Z j ≥ 1 − ḡ Z j , j , Õ s∈S  ps, j ḡ0s, j 2  (26) !2 Õ© Õ ª = f̄0k, j ® ­ps, j k∈s s∈S « ¬ !  2 Õ Õ 0 ≤ ps, j · l · f̄ k, j k∈s s∈S =l· Õ  f̄0k, j 2 Õ f̄0k, j 2 k∈K =l· Õ  k∈K ! ps, j s:k∈s  q k, j (27) 16   1/l − f̄ k, j Õ© ª ­f̄0 · ® · q k, j ­ k, j ® q k, j k∈K « ¬  Õ 1 f̄0k, j · ≤l· f k∈K Õ = f̄0k, j =l· k∈K = Õ Õ f̄0k, j + k∈Z j f̄0k, j k∈K\Z j = ḡ0Z j , j , where (27) holds as a special case of the Cauchy-Schwarz inequality, Thus, we have Õ ps, j ḡ0s, j ≥ ḡ Z j , j and s∈S Õ  2 ps, j ḡ0s, j ≤ ḡ0Z j , j . (28) s∈S Combining (25) and (28), we have W j+1 η2 ≤ 1 − η(1 − ḡ Z j , j ) + ḡ0Z j , j . Wj 2 (29) Taking the log of both sides and using 1 + x ≤ e x gives ln W j+1 η2 ≤ −η(1 − ḡ Z j , j ) + ḡ0Z j , j . Wj 2 (30) Summing over j, we then get J η2 Õ 0 W J+1 ≤ −η(J − ḠII ) + ln ḡ . W1 2 j=1 Z j , j (31) . For any strategy s, Now we consider the lower bound of ln WWJ+1 1 ln ws, j+1 W J+1 ≥ ln W1 W1  = ln ws,1 exp −η = −η ÍJ 0 j=1 ḡs, j  Iws,1 J Õ ḡ0s, j − ln S. j=1 Since the above inequality holds for any strategy s, we get J Õ W J+1 ≥ −η min ḡ0s, j − ln S. ln W1 s∈S j=1 (32) 17 Combining (31) and (32), we have J J Õ η2 Õ 0 ḡ Z j , j ≥ −η min ḡ0s, j − ln S. −η(J − ḠII ) + 2 j=1 s∈S j=1 Dividing both sides by −η and moving terms, we have (J − ḠII ) − min s∈S J Õ J ḡ0s, j j=1 ηÕ 0 ln S ≤ ḡ Z j , j + . 2 j=1 η (33) We take expectations of both sides in (33) with respect to the distribution of Z1, Z2, . . . , Z j . For the conditional expected value of each ḡ0s, j , we have h i IE ḡ0s, j |Z1, Z2, . . . , Z j−1 h i 1 − ḡs, j + (1 − ps, j ) · IE ḡ0s, j |s , Z j ps, j 1 − ḡs, j = ps, j ps, j = ps, j · = 1 − ḡs, j , where the first equation is due to the fact that Z j = s with probability ps, j , and the second Í equation is due to that ḡ0s, j = k∈s f̄0k, j = 0 when s , Z j . Similarly, h i IE ḡ0Z j , j |Z1, Z2, . . . , Z j−1 = 1 − ḡ Z j , j . Therefore, we have J  IE Ḡbest − ḠII  ηÕ ln S ≤ ḡ Z j , j + 2 j=1 η ≤ ln S η JS + . 2 η Now taking into consideration the bound of switching costs, (18), we have the following theorem: 2 Theorem 1. For any type of adversaries, the expected weak regret of SpecWatch-II is O(T 3 ) with 1 1 parameters η = AηT − 3 > 0 and τ = Aτ T 3 ∈ [1, T] , where Aγ and Aτ are constants. Specifically,   Aη S Aτ ln S 2 1 IE [RII ] ≤ + + T3. (34) 2 Aη Aτ 18 Proof. IE [RII ] = IE [G best − Lbest − GII + LII ] ≤ IE [G best − GII ] + J   = IE τ Ḡbest − τ ḠII + J ηJSτ τ ln S + +J 2 η ηST τ ln S = + + T/τ 2 η   Aη S Aτ ln S 2 1 = + + T3. 2 Aη Aτ = For better understanding of Theorem 1, we now give a specific bound by choosing particular parameters. Corollary 1. For any type of adversaries, when T ≥ 12 S ln S, with parameters η = q τ = 3 S2T ln S , the expected weak regret of SpecWatch-II is  1 IE [RII ] ≤ 3 S ln S 2  13 q 3 4 ln S S 2T 2 T3. and (35) Proof. Substituting the parameters in (34), we have the immediate result. Remark. The expected weak regret of SpecWatch-II is bounded by O(T 2/3 ). This upper bound matches the lower bound of the MAB-SC problem proved in [25] which is used to model the spectrum monitoring problem in this paper. Thus, SpecWatch-II is asymptotically optimal. If we calculate the normalized weak regret RII T , i.e., amortizing the regret to every timeslot, then it is clear that the expected value of normalized weak regret converges to 0 as T approaches to ∞. VI. S PECTRUM M ONITORING A LGORITHM WITH B OUNDED W EAK R EGRET We have already proved that SpecWatch-II is an effective online spectrum monitoring algorithms with expected normalized regret converging to 0. Though the expectation provides a quite legitimate estimate on the performance of SpecWatch-I and SpecWatch-II, the actual value of weak regret may sometimes deviate a lot from the expected bound as expectation just represents the mean. In this section, we propose the improved algorithm, SpecWatch-III, whose actual weak regrets are bounded by O(T 2/3 ) with any user-defined confidence level. 19 A. SpecWatch-III 1) Algorithm Design: SpecWatch-III is designed similar to SpecWatch-II. However, it takes four parameters τ, γ, β and η as input, where γ is used to calculate strategy probabilities, β is used to calculate average channel scores, and η is used to update strategy weights. Calculating Strategy Probability ps, j . For calculating strategy probabilities, we introduce a new concept called covering strategy set. A covering strategy set C ⊂ S is a set of strategy that covers all channels K, where a channel k ∈ K is covered by C if there is a strategy s ∈ C such that k ∈ s. In SpecWatch-III, we randomly construct a minimal covering strategy set whose size C = |C| is less than or equal to K. The probability of each strategy s is calculated by def ps, j = (1 − γ) ws, j γ + 1s∈C, Wj C (36) where 1s∈C is an indicator function which has the value 1 if s ∈ C; 0 otherwise. In this way, the strategies in the covering set are more likely to be chosen than others. As a result, SpecWatch-III can explore all channels more quickly, and thus reveal the best channels sooner, which expedites the exploration for the best strategy. Choosing Strategy Z j and Monitoring Spectrum. This part is the same as SpecWatch-II. Updating Strategy Weight ws, j+1 . For calculating average channel scores, we introduce a f̄ +β new parameter β and have f̄0k, j = k,qjk, j , where q k, j is the channel probability of k ∈ K in batch Í Í ∈s ws, j k j. By (36), we have is q k, j = s:k∈s ps, j = (1 − γ) s:kW + γC C , where Ck is the number of j strategies in the covering strategy set and containing channel k, i.e., Ck = |{s|s ∈ C ∧ k ∈ s}|. The average channel score use q k, j as the denominator in order to compensate the rewards of channels with low probabilities. Among the channels receiving rewards, those with lower probabilities can obtain higher average channel scores, and therefore higher channel weights. Note that we could also gain rewards on an unmonitored channel if we had monitored it, which indicates that the average channel score of that channel should be positive. With this concern, we use parameter β to reduce the bias between monitored and unmonitored channels. Then the channel weight of k is h k, j+1 = h k, j exp  ηf̄0k, j−1  , (37) where h k,1 = 1 for all k ∈ K. Thus, the strategy weight of s is updated by ws, j+1 = ws, j exp(ηḡ0s, j ), (38) 20 where ḡ0s, j is the average strategy score of s in batch j and can be calculated directly by Õ 1 Íτ fk,[ j]+i + β τ i=1 0 Í . (39) ḡs, j = γCk s:k ∈s ws, j (1 − γ) + k∈s C Wj 2) Performance Analysis: Since SpecWatch-III only update the monitoring strategy across def Í batches, each batch can be regarded as a round in conventional MAB. We define ḠIII = Jj=1 ḡ Z j , j , where Z j is SpecWatch-III’s chosen strategy for each batch. Then we have the following lemma. We first introduce the following two notations, F̄ k,n = def n Õ f̄ k, j and F̄0k,n = def j=1 n Õ f̄0k, j for k ∈ K, (40) j=1 where n is an arbitrary batch, f̄ k, j = 1 τ Íτ i=1 fk,[ j]+i and f̄0k, j = f̄k, j +β qk, j . We then prove the following lemma. Lemma 2. For any type of adversaries, for any δ ∈ (0, 1), β ∈ (0, 1) and k ∈ K in SpecWatch-III, we have  IPr F̄ k,n ≥ F̄0k,n Proof. We prove (41) based on [47, Lemma 2].  δ 1 K ≤ . + ln β δ K (41) Note that f̄0k, j for different batches are generated independently and F̄ k,n is the sum of these independent random variables. By the Chernoff bound, we have i h     , IPr F̄ k,n ≥ F̄0k,n + u ≤ exp(−uv)IE exp v F̄ k,n − F̄0k,n for any k ∈ K, any u > 0, and any v > 0. Let u = 1β ln Kδ and v = β, then we have i h   0 exp(−uv)IE exp v F̄ k,n − F̄ k,n   i K h = exp(− ln )IE exp β F̄ k,n − F̄0k,n δ   i δ h = IE exp β F̄ k,n − F̄0k,n . K Thus, to prove (41), it suffices to prove that for all n, h   i 0 IE exp β F̄ k,n − F̄ k,n ≤ 1. Define    def Dn = exp β F̄ k,n − F̄0k,n . 21 We first show that IEn [Dn ] ≤ Dn−1 for n ≥ 2, where IEn denotes the conditional expectation IE [·|Z1, Z2, . . . Zn−1 ]. Note that    Dn = Dn−1 exp β f̄ k,n − f̄0k,n . Taking conditional expectations, we obtain IEn [Dn ] h   i = Dn−1 IEn exp β f̄ k,n − f̄0k,n " !!# 1 k∈Zn f̄ k,n + β = Dn−1 IEn exp β f̄ k,n − q k,n " !!#   1 k∈Zn f̄ k,n β2 = Dn−1 exp − IEn exp β f̄k,n − q k,n q k,n " !   1 k∈Zn f̄ k,n β2 ≤ Dn−1 exp − IEn 1 + β f̄ k,n − q k,n q k,n ! 2  1 f̄ k∈Z k,n n  +β2 f̄ k,n −  q k,n   ! 2     1 f̄ β2 k∈Zn k,n  = Dn−1 exp − IEn 1 + β2 f̄ k,n −  q k,n q k,n     ! 2     1 k∈Zn f̄k,n  β2 ≤ Dn−1 exp − IEn 1 + β2  q k,n q k,n        2 2 β β ≤ Dn−1 exp − 1+ q k,n q k,n (42) (43) ≤ Dn−1, (44) 1 f̄ n k,n where 1 k∈Zn = 1 if k ∈ Zn and 0 otherwise; (42) holds because β < 1, f̄ k,n − k ∈Z ≤ 1 and qk,n i h 1 f̄ n k,n e x ≤ 1 + x + x 2 for x ≤ 1; (43) follows from IEt k ∈Z = f̄ k,n ; (44) holds by the inequality qk,n 1 + x ≤ e x . Taking expectations on both sides proves IE [Dn ] ≤ IE [Dn−1 ] . h   i 0 A similar approach shows that IE [D1 ] ≤ 1, which implies IE [Dn ] = IE exp β F̄ k,n − F̄ k,n ≤1 as desired. 22 Lemma 3. For any type of adversaries, any T > 0, γ ∈ (0, 1/2), τ ∈ [1, T], β ∈ (0, 1), and η > 0 satisfying 2ηlC ≤ γ, we have Ḡbest − ḠIII ≤ γJ + 2ηlC J + l K ln S ln + + βK J. β δ η with probability at least 1 − δ for any δ ∈ (0, 1). Proof. First, we show 0 ≤ ηḡs, j ≤ 1. It is easy to notice that ηḡ0s, j ≥ 0. In addition, we have ηḡ0s, j = η Õ f̄0k, j ≤ η k∈s ≤η Õ1+β k∈s γ C where the second inequality is due to q k, j ≥ γ C Õ f̄ k, j + β q̄s, j k∈s ≤ (1 + β)ηlC ≤ 1, γ for all k ∈ K, and the last inequality is due to 2ηlC ≤ γ. Then we analyze W j+1 Wj . For any sequence Z1, . . . , Z j generated by SpecWatch-III, we have W j+1 Wj Õ ws, j+1 = Wj s∈S   Õ ws, j 0 = exp ηḡs, j Wj s∈S   Õ ps, j − γ 1s∈C C = exp ηḡ0s, j 1−γ s∈S  2 Õ ps, j − γ 1s∈C  C 0 2 ≤ 1 + ηḡs, j + η ḡ0s, j 1−γ s∈S   2 1 − γ Õ ps, j 0 2 + ηḡs, j + η ḡ0s, j ≤ 1−γ 1−γ (45) (46) s∈S  2 η Õ η2 Õ 0 ≤ 1+ ps, j ḡs, j + ps, j ḡ0s, j , 1−γ 1−γ s∈S (47) s∈S where (45) uses the definition of ps, j in (36), and (46) holds by the fact that e x ≤ 1 + x + x 2 for 0 ≤ x ≤ 1. 23 Next we bound (47). For the second term, we have ! Õ Õ Õ f̄0k, j ps, j ḡ0s, j = ps, j s∈S s∈S k∈s Õ Õ ! = f̄0k, j = ps, j s:k∈s k∈K Õ f̄0k, j q k, j  k∈K = Õ f̄ k, j + β  k∈K = Õ   Õ  f̄ k, j + β + f̄ k, j + β k∈Z j k∈K\Z j = ḡ Z j , j + K β, (48) where (48) uses the definition of average strategy reward and the fact that f̄ k, j is 0 when k < Z j . For the second sum, Õ s∈S  ps, j ḡ0s, j 2 !2 Õ© Õ ª = f̄0k, j ® ­ps, j k∈s s∈S « ¬ !  2 Õ Õ 0 ≤ ps, j · l · f̄k, j =l· Õ  f̄0k, j 2 Õ f̄0k, j 2 ! ps, j s:k∈s k∈K =l· (49) k∈s s∈S Õ   q k, j k∈K =l· Õ f̄0k, j · 1 k∈Z j f̄ k, j + β k∈K ≤ l · (1 + β) · Õ ≤ l · (1 + β) · Õ q k, j ! · q k, j f̄0k, j k∈K ḡ0s, j , (50) s∈C where (49) holds as a special case of the Cauchy-Schwarz Inequality Ín i=1 ai ·1 2 ≤ and (50) holds because covering strategy set C covers each channel at least once. Therefore, combining (47), (48), and (50), we have  η2 l(1 + β) Õ W j+1 η  ≤ 1+ ḡ Z j , j + K β + ḡ0s, j . Wj 1−γ 1 − γ s∈C Ín 2 i=1 ai  Ín 2 i=1 1  , 24 Taking the log of both sides and using 1 + x ≤ e x gives  η2 l(1 + β) Õ W j+1 η  ln ≤ ḡ Z j , j + K β + ḡ0 . Wj 1−γ 1 − γ s∈C s, j Summing over j we then get J Õ  η2 l(1 + β) Õ η  W J+1 ≤ ḠIII + JK β + ḡ0 . ln W1 1−γ 1 − γ j=1 s∈C s, j Note that J Õ Õ ḡ0s, j ≤ C max s∈S j=1 s∈C J Õ ḡ0s, j ≤ C max Ḡ0s,J . s∈S j=1 We have ln  η2 l(1 + β)C W J+1 η  max Ḡ0s,J . ≤ ḠIII + JK β + W1 1−γ 1−γ s∈S (51) Now we consider the lower bound of ln WWJ+1 . For any strategy s, 1 ln ws, j+1 W J+1 ≥ ln W1 W1 = ln =η  Í  J 0 ws,1 exp η j=1 ḡs, j Sws,1 J Õ ḡ0s, j − ln S j=1 = ηḠ0s,J − ln S. Since the above inequality holds for any strategy s, we get ln W J+1 ≥ η max Ḡ0s,J − ln S. W1 s∈S (52) Combining (51) and (52), we have ḠIII ≥ (1 − γ − ηl(1 + β)C) max Ḡ0s,J − s∈S Note that Ḡ0s,J = and that Ḡs,J = J Õ ḡ0s, j = J Õ Õ j=1 j=1 k∈s J Õ J Õ Õ j=1 ḡs, j = j=1 k∈s f̄0k, j = 1−γ ln S − JK β. η Õ F̄0k,n, k∈s f̄ k, j = Õ k∈s F̄ k,n . (53) 25 By using Lemma 41 and applying Boole’s inequality, we obtain that, with probability at least 1 − δ,  ḠIII ≥ (1 − γ − ηl(1 + β)C) max Ḡs,J s∈S −  1−γ ln S − JK β η  ≥ (1 − γ − ηl(1 + β)C) Ḡbest − K l − ln β δ l K − ln β δ  1−γ ln S − JK β, η where 1 − γ − ηl(1 + β)C > 0 because ηl(1 + β)C ≤ 2ηlC ≤ γ < 1/2. Therefore, Ḡbest − ḠIII ≤ (γ + ηl(1 + β)C)Ḡbest l K 1−γ ln + ln S + JK β β δ η K ln S l + βK J, ≤ γJ + 2ηlC J + ln + β δ η + (1 − γ − ηl(1 + β)C) where the last inequity is due to the fact that Ḡbest ≤ J. Next, we bound the difference between the cumulative strategy reward of the best fixed algorithm and that of SpecWatch-III. Theorem 2. For any type of adversaries, with probability at least 1 − δ, the weak regret of 1 2 1 SpecWatch-III is bounded by O(T 3 ). In particular, choosing τ = Bτ T 3 ∈ [1, T] , γ = Bγ T − 3 ∈ 1 (0, 21 ), β = BβT − 3 ∈ (0, 1), and η = Bγ − 1 3 2lC T , where Bτ , Bγ , and Bβ are constants, we have ! ! l ln Kδ ln S 2 1 RIII ≤ 2Bγ + Bβ K + Bτ + + T3. (54) Bβ Bη Bτ Proof. Similar to the proof of Theorem 1, we have RII = G best − Lbest − GII + LII ≤ G best − GII + J T = τ Ḡbest − τ ḠII + τ   l K ln S T ≤ τ γJ + 2ηlC J + ln + + βK J + , β δ η τ 26   l K ln S T ≤ (γ + 2ηlC + βK) T + τ ln + + , β δ η τ (55) with probability at least 1 − δ. The last inequality follows from Lemma 3. Plugging in the value of parameters finishes the proof. We now provide an example choice of parameters to reach a specific bound. Corollary 2. For any type of adversaries, under the condition of   3/2   l K     3/2 ln  2 8 (lC ln S)    K δ T ≥ max B , , ,   B B       q q √ K l ln S − 32 13 − 13 − 13 − 13 − 31 using parameters τ = B T , γ = lC ln S · B T , β = K ln δ · B T , and η = 4lC · q √ 1 1 B− 3 T − 3 , where B = 4 lC ln S + 2 lK ln Kδ , we have √ r RIII ≤ 2 4 lC ln S + 2 lK ln K δ ! 23 2 T 3, (56) with probability at least 1 − δ. Proof. Substituting the parameters in (54), we have the immediate result. Remark. Note that it is not guaranteed that SpecWatch-III always outperforms SpecWatch-II. The improvement over SpecWatch-II is the fact that SpecWatch-III guarantees the actual weak regret to be bounded with any predefined confidence level. VII. P ERFORMANCE E VALUATION We conduct extensive simulations to demonstrate the performance of our proposed online spectrum monitoring algorithms, SpecWatch-I, SpecWatch-II, and SpecWatch-III. We first show the convergence of normalized weak regrets of all four algorithms and then study and compare their performances under different adversary settings. We also demonstrate the impact of the detection probability, the number of radios, the number of MUs, and adversary settings, on the algorithm performance. In the simulation setting, we consider K = 10 channels, and we deploy a monitor with l = 2 radios. We set the unit reward of successfully detecting on a single channel to be r = 0.3 and the unit switching cost of tuning one radio to be c = 0.03. If not specified, the detection probability of each radio is set to be pd = 0.9 as it is the recommended detection accuracy in consistent SpecWatch-I SpecWatch-II SpecWatch-III 0.03 0.025 0.02 3 4 5 6 7 8 9 10 0.034 9000 0.032 8800 0.03 SpecWatch-I SpecWatch-II SpecWatch-III 0.028 0.026 0.024 0 1 2 104 Time Horizon (T) Cumulative Utility 0.035 Normalized Weak Regret Normalized Weak Regret 27 3 4 8400 8200 8000 2 Fig. 3: Algorithm Comparison 4 6 8 10 Exponent -1 ( ) 104 Timeslots (t) Fig. 2: Convergence of weak regrets 8600 7800 0 5 SpecWatch-I SpecWatch-II SpecWatch-III Fig. 4: Impact of batch size on cumulative utility Cumulative Utility 6000 4000 Fixed Uniform Normal Adaptive 2000 0 0 0.5 1 1.5 2 104 Fig. 5: Cumulative utility under different ad- Fig. 6: Impact of detection probability on versary settings cumulative reward and switching cost 1 1 0.8 0.8 0.8 l=1 l=2 l=3 l=5 0.6 0.4 0.2 0 0 m=1 m=2 m=3 m=5 0.6 0.4 0.2 20 40 60 80 100 0 0 CDF 1 CDF CDF Timeslots (t) 0.6 0.4 Fixed Uniform Normal Adaptive 0.2 20 Timeslots (t) 40 60 80 100 Timeslots (t) 0 0 20 40 60 80 100 Timeslots (t) Fig. 7: Number of timeslots to detect the first Fig. 8: Number of timeslots to detect the first Fig. 9: Number of timeslots to detect the first misuse with different number of radios misuse with different number of MUs misuse under different adversary settings with [48]. The parameters of all algorithms are chosen as in the corollaries. If the monitor uses SpecWatch-III, we set δ = 0.5 so that the weak regret is relatively small with an acceptable confidence level. We assume there are m = 2 MUs attacking channels either obliviously or adaptively. Specifically, we consider four adversary settings, • Fixed adversary (Fixed): Each MU selects a fixed channel and never switches throughout the time horizon T. • Uniform adversary (Uniform): In every timeslot, each MU selects a channel uniformly at random. • Normal adversary (Normal): In every timeslot, each MU selects a channel following the same normal distribution. • Adaptive adversary (Adaptive): Each MU adopts modified SpecWatch-I, where the actual 28 channel reward is r if the MU is not captured on that channel, and 0 otherwise. The simulation results are shown below, and each of them is averaged over 100 trials. Weak Regret. Fig. 2 shows the normalized weak regrets of all algorithms decrease with time horizon T, which supports our theoretical analysis that the normalized weak regret converges to 0 as T → ∞. In all following simulations, we fix the time horizon to be T = 50000. Here we only show the result with adaptive adversary since in other adversary settings, the results are similar. Note that SpecWatch-II outperforms other algorithms as shown in the figure, but it only means that SpecWatch-II’s way to trade-off between exploration and exploitation is more appropriate under our current simulation setting. Fig. 3 plots how the normalized weak regret decreases with timeslots under adaptive adversary. At the beginning, there is apparent fluctuation of the normalized weak regret. As time goes by, the monitor and the adaptive adversary enter a relatively stable stage, but we can still see the decreasing trend of the normalized weak regret, which indicates our algorithms are learning from monitoring history to make smart decisions. Impact of Algorithm Parameters. Among all parameters of the four algorithms, the most important one is the batch size τ, which controls the trade-off between cumulative reward and cumulative switching cost. As shown in Fig. 4, we conducted simulations where the batch size τ was set to be exactly T 1/∆ and plotted how the cumulative utility changes with ∆, under the adaptive adversary. It is shown that all algorithms achieve highest cumulative utility ratio when τ is around T 1/3 , which is in consistency with our theoretical analysis. The performances of all algorithms are almost the same because they are designed based on the same framework and using same way to trade-off between rewards and switching costs. Cumulative Utility. Fig. 5 plots the actual utilities gained by SpecWatch-III. The figures for the other three algorithms are very similar and thus omitted. We observe that the cumulative utilities under fixed adversary greatly exceed the other three settings, and the other three settings have similar results. Impact of System Parameters and Adversary Settings. In simulations, we fix the time horizon to be T = 50000. Since the impacts on all algorithms are similar, we only present results of SpecWatch-III. Fig. 6 shows the impact of detection probability pd on the cumulative rewards and the cumulative switching cost. As expected, the cumulative reward grows with decreasing slope as the detection probability 29 increases. The cumulative switching cost, however, has a decreasing trend. This is because the larger the detection probability, the more accurate for the monitor to evaluate each strategy; thus the best strategy is revealed more quickly, avoiding unnecessary switches and reducing cumulative switching cost. We also study the impact the number of radios l, the number of MUs m, and the types of adversary on the performance of our algorithms. Fig. 7, Fig. 8, and Fig. 9 illustrate the cumulative distribution function (CDF) of expected number of timeslots to detect the first misuse. In general, more radios or more MUs make it sooner for the monitor to detect successfully. In Fig. 9, the monitor takes the longest time to detect the first misuse under fixed adversary setting, which is because the monitor sticks to the same strategy for the whole batch to prevent switching costs. If the monitor does not choose the channels attacked by MUs at the first timeslot in a batch, it will not detect misuse for the following τ − 1 timeslots. As a result, it takes longer time for the monitor to detect the first misuse under fixed adversary setting. VIII. C ONCLUSION In this paper, we studied the adversarial spectrum monitoring problem with unknown statistics by formulating it as an adversarial multi-armed bandit problem with switching costs (MAB-SC). To solve this problem, we proposed an online spectrum monitoring framework named SpecWatch and designed two effective online algorithms, SpecWatch-II and SpecWatch-III. We rigorously proved that their weak regrets are bounded by O(T 2/3 ), which matches the lower bound of the general MAB-SC problem. Thus, they are asymptotically optimal. Moreover, our algorithms can guarantee the proved performance under any adversary setting and are independent of the underlying misuse detection technique. R EFERENCES [1] F. S. P. T. Force, “Report of the spectrum efficiency working group,” Tech. Rep., 2002. [2] Q. Zhao and B. M. Sadler, “A survey of dynamic spectrum access,” IEEE Signal Process. Mag., vol. 24, no. 3, pp. 79–89, 2007. [3] C. Santivanez, R. Ramanathan, C. Partridge, R. Krishnan, M. Condell, and S. Polit, “Opportunistic spectrum access: Challenges, architecture, protocols,” in Proc. of WICON, 2006, p. 13. [4] A. Anandkumar, N. Michael, and A. Tang, “Opportunistic spectrum access with multiple users: learning under competition,” in Proc. of INFOCOM, 2010, pp. 1–9. [5] C. Tekin and M. Liu, “Online learning in opportunistic spectrum access: A restless bandit approach,” in Proc. of INFOCOM, 2011, pp. 2462–2470. 30 [6] Y. Xu, J. Wang, Q. Wu, A. Anpalagan, and Y.-D. Yao, “Opportunistic spectrum access in unknown dynamic environment: A game-theoretic stochastic learning solution,” IEEE Trans. Wireless Commun., vol. 11, no. 4, pp. 1380–1391, 2012. [7] O. Altrad, S. Muhaidat, A. Al-Dweik, A. Shami, and P. D. Yoo, “Opportunistic spectrum access in cognitive radio networks under imperfect spectrum sensing,” IEEE Trans. Veh. Technol., vol. 63, no. 2, pp. 920–925, 2014. [8] R. N. Yadav, R. Misra, U. Gupta, and S. Bhagat, “Opportunistic spectrum access in cr network in licensed and unlicensed channels,” in Proc. of ICDCN, 2015, p. 39. [9] Q. Wang, K. Ren, P. Ning, and S. Hu, “Jamming-resistant multiradio multichannel opportunistic spectrum access in cognitive radio networks,” IEEE Trans. Veh. Technol., vol. 65, no. 10, pp. 8331–8344, 2016. [10] G. I. Tsiropoulos, O. A. Dobre, M. H. Ahmed, and K. E. Baddour, “Radio resource allocation techniques for efficient spectrum access in cognitive radio networks,” IEEE Commun. Surveys & Tutorials, vol. 18, no. 1, pp. 824–847, 2016. [11] Q. Wang, K. Ren, and P. Ning, “Anti-jamming communication in cognitive radio networks with unknown channel statistics,” in Proc. of ICNP, 2011, pp. 393–402. [12] L. Yang, Z. Zhang, B. Y. Zhao, C. Kruegel, and H. Zheng, “Enforcing dynamic spectrum access with spectrum permits,” in Proc. of MobiHoc, 2012, pp. 195–204. [13] M. B. Weiss, M. Altamimi, and M. McHenry, “Enforcement and spectrum sharing: A case study of the 1695–1710 mhz band,” in Proc. of CROWNCOM, 2013, pp. 7–12. [14] C. Sorrells, P. Potier, L. Qian, and X. Li, “Anomalous spectrum usage attack detection in cognitive radio wireless networks,” in Proc. of HST, 2011, pp. 384–389. [15] G. P. Kumar and D. K. Reddy, “Frequency domain techniques for void spectrum detection in cognitive radio network for emulation attack prevention,” in Proc. of CCPCT, 2016, pp. 1–6. [16] G. Atia, A. Sahai, and V. Saligrama, “Spectrum enforcement and liability assignment in cognitive radio systems,” in Proc. of DySPAN, 2008, pp. 1–12. [17] P. Kyasanur and N. H. Vaidya, “Detection and handling of mac layer misbehavior in wireless networks,” in Proc. of DSN, 2003, pp. 173–182. [18] Y. Zhang and L. Lazos, “Countering selfish misbehavior in multi-channel mac protocols,” in Proc. of INFOCOM, 2013, pp. 2787–2795. [19] S. Liu, L. J. Greenstein, W. Trappe, and Y. Chen, “Detecting anomalous spectrum usage in dynamic spectrum access networks,” Ad Hoc Netw., vol. 10, no. 5, pp. 831–844, 2012. [20] J. Tang and Y. Cheng, “Selfish misbehavior detection in 802.11 based wireless networks: An adaptive approach based on markov decision process,” in Proc. of INFOCOM, 2013, pp. 1357–1365. [21] X. Jin, J. Sun, R. Zhang, Y. Zhang, and C. Zhang, “SpecGuard: Spectrum misuse detection in dynamic spectrum access systems.” in Proc. of INFOCOM, 2015, pp. 172–180. [22] A. Dutta and M. Chiang, “‘see something, say something’ crowdsourced enforcement of spectrum policies,” IEEE Trans. Wireless Commun., vol. 15, no. 1, pp. 67–80, 2016. [23] P. Baltiiski, I. Iliev, B. Kehaiov, V. Poulkov, and T. Cooklev, “Long-term spectrum monitoring with big data analysis and machine learning for cloud-based radio access networks,” Wireless Personal Commun., vol. 87, no. 3, pp. 815–835, 2016. [24] P. Auer, N. Cesa-Bianchi, Y. Freund, and R. E. Schapire, “The nonstochastic multiarmed bandit problem,” SIAM J. on Computing, vol. 32, no. 1, pp. 48–77, 2002. [25] O. Dekel, J. Ding, T. Koren, and Y. Peres, “Bandits with switching costs: T 2/3 regret,” in Proc. of STOC, 2014, pp. 459–467. [26] D.-H. Shin and S. Bagchi, “Optimal monitoring in multi-channel multi-radio wireless mesh networks,” in Proc. of MobiHoc, 2009, pp. 229–238. 31 [27] D.-H. Shin, S. Bagchi, and C.-C. Wang, “Toward optimal sniffer-channel assignment for reliable monitoring in multichannel wireless networks,” in Proc. of SECON, 2013, pp. 203–211. [28] H. Nguyen, G. Scalosub, and R. Zheng, “On quality of monitoring for multichannel wireless infrastructure networks,” IEEE Trans. Mobile Comput., vol. 13, no. 3, pp. 664–677, 2014. [29] S. Chen, K. Zeng, and P. Mohapatra, “Efficient data capturing for network forensics in cognitive radio networks,” IEEE/ACM Trans. Netw., vol. 22, no. 6, pp. 1988–2000, 2014. [30] D.-H. Shin, S. Bagchi, and C.-C. Wang, “Distributed online channel assignment toward optimal monitoring in multi-channel wireless networks,” in Proc. of INFOCOM, 2012, pp. 2626–2630. [31] Q. Yan, M. Li, F. Chen, T. Jiang, W. Lou, Y. T. Hou, and C.-T. Lu, “SpecMonitor: Towards efficient passive traffic monitoring for cognitive radio networks,” IEEE Trans. Wireless Commun., vol. 13, no. 10, pp. 5893–5905, 2014. [32] P. Arora, C. Szepesvári, and R. Zheng, “Sequential learning for optimal monitoring of multi-channel wireless networks,” in Proc. of INFOCOM, 2011, pp. 1152–1160. [33] R. Zheng, T. Le, and Z. Han, “Approximate online learning algorithms for optimal monitoring in multi-channel wireless networks,” IEEE Trans. Wireless Commun., vol. 13, no. 2, pp. 1023–1033, 2014. [34] T. Le, C. Szepesvari, and R. Zheng, “Sequential learning for multi-channel wireless network monitoring with channel switching costs,” IEEE Trans. Signal Process., vol. 62, no. 22, pp. 5919–5929, 2014. [35] S. Yi, K. Zeng, and J. Xu, “Secondary user monitoring in unslotted cognitive radio networks with unknown models,” in Proc. of WASA, 2012, pp. 648–659. [36] J. Xu, Q. Wang, R. Jin, K. Zeng, and M. Liu, “Secondary user data capturing for cognitive radio network forensics under capturing uncertainty,” in Proc. of MILCOM, 2014, pp. 935–941. [37] P. Auer, N. Cesa-Bianchi, and P. Fischer, “Finite-time analysis of the multiarmed bandit problem,” Mach. Learn., vol. 47, no. 2-3, pp. 235–256, 2002. [38] H. Robbins, “Some aspects of the sequential design of experiments,” Bull. Amer. Math. Soc., vol. 58, no. 5, pp. 527–535, 1952. [39] T. L. Lai and H. Robbins, “Asymptotically efficient adaptive allocation rules,” Adv. Appl. Math., vol. 6, no. 1, pp. 4–22, 1985. [40] S. Bubeck, N. Cesa-Bianchi et al., “Regret analysis of stochastic and nonstochastic multi-armed bandit problems,” Foundations and Trends R in Mach. Learn., vol. 5, no. 1, pp. 1–122, 2012. [41] P. Auer and C.-K. Chiang, “An algorithm with nearly optimal pseudo-regret for both stochastic and adversarial bandits,” in Proc. of COLT, 2016, pp. 116–120. [42] L. Chen, S. Iellamo, and M. Coupechoux, “Opportunistic spectrum access with channel switching cost for cognitive radio networks,” in Proc. of ICC, 2011, pp. 1–5. [43] “IEEE standard for information technology–telecommunications and information exchange between systems local and metropolitan area networks–specific requirements - part 11: Wireless LAN medium access control (MAC) and physical layer (PHY) specifications,” IEEE Std 802.11-2016, pp. 1–3534, 2016. [44] Q. Wang and M. Liu, “Learning in hide-and-seek,” IEEE/ACM Trans. Netw., vol. 24, no. 2, pp. 1279–1292, 2016. [45] R. Arora, O. Dekel, and A. Tewari, “Online bandit learning against an adaptive adversary: from regret to policy regret,” in Proc. of ICML, 2012, pp. 1503–1510. [46] M. Li, D. Yang, M. Li, J. Lin, and J. Tang, “SpecWatch: Adversarial spectrum usage monitoring in CRNs with unknown statistics,” in Proc. of INFOCOM, 2016, pp. 1–9. [47] A. Gyorgy, T. Linder, G. Lugosi, and G. Ottucsak, “The on-line shortest path problem under partial monitoring,” J. Mach. Learn. Res., vol. 8, pp. 2369–2403, 2007. 32 [48] J.-K. Choi and S.-J. Yoo, “Time-constrained detection probability and sensing parameter optimization in cognitive radio networks,” EURASIP J. Wireless Commun. Netw., vol. 2013, no. 1, pp. 1–12, 2013.
7cs.IT
1 Quickest Detection for Changes in Maximal kNN Coherence of Random Matrices arXiv:1508.04720v2 [math.ST] 29 Oct 2017 Taposh Banerjee, Hamed Firouzi, and Alfred O. Hero III, Fellow, IEEE Abstract—The problem of quickest detection of a change in the distribution of a n × p random matrix based on a sequence of observations having a single unknown change point is considered. The forms of the pre- and post-change distributions of the matrices are assumed to belong to the family of elliptically contoured densities with sparse dispersion matrices but are otherwise unknown. A non-parametric stopping rule is proposed that is based on a novel scalar summary statistic related to the maximal k-nearest neighbor correlation between columns of each observed random matrix, and is related to a test of existence of a vertex in a sample correlation graph having degree at least k. Performance bounds on the delay and false alarm performance of the proposed stopping rule are obtained. When the prechange dispersion matrix is diagonal it is shown that, among all functions of the proposed summary statistic, the proposed stopping rule is asymptotically optimal under a minimax quickest change detection (QCD) model, in the purely high-dimensional regime of p → ∞ and n fixed. The significance is that the purely high dimensional asymptotic regime considered here is asymptotic in p but finite n making it especially well suited to big data regimes. The theory developed also applies to sequential hypothesis testing and fixed sample size tests. Index Terms—Big data, correlation change detection, correlation screening, correlation mining, generalized likelihood ratio test, k-NN, maximum magnitude sample correlation, misspecification of distribution, quickest change detection, summary statistic. I. I NTRODUCTION One of the greatest challenges in data analysis is to develop robust algorithms for statistical inference on large scale data. Many big data applications fall in the so-called sample starved regime [1], where conclusions have to be drawn or decisions have to be made based on a small set of samples of a highdimensional vector. Most classical statistical tests have been designed for the large sample regime, where the number of samples are much larger than the dimension of the vector, and This work was partially supported by the Consortium for Verification Technology under Department of Energy National Nuclear Security Administration award number de-na0002534 and the Air Force Office of Scientific Research under grant FA9550-13-1-0043. A preliminary version of this paper has been presented at 2015 IEEE International Symposium on Information Theory. Taposh Banerjee is with the School of Engineering and Applied Sciences, Harvard University, Cambridge, MA, Hamid Firouzi is with Goldman Sachs, New York, NY, and Alfred Hero is with the Department of Electrical Engineering and Computer Science, University of Michigan, Ann Arbor, MI. This work was completed when the authors were with the Department of Electrical Engineering and Computer Science, University of Michigan, Ann Arbor, MI 48109, USA (e-mail: [email protected]; [email protected]; [email protected]) hence are not applicable to high-dimensional data analysis. Thus, new approaches are needed to address these challenges. In this paper we consider the problem of detecting a change in maximal coherence between variables in high dimension with a limited number of samples. Specifically, assume that a sequence of high-dimensional vectors is available. Initially the vector sequence is i.i.d. with a nominal correlation matrix, i.e., a “normal” or “expected” baseline of multivariate correlations. At some time point in the sequence the correlation matrix may change, e.g., due to a certain unknown event, activity or disorder. The objective is to detect this change in correlation as quickly as possible. In other words, we want to quickly determine whether or not the sequence of high-dimensional vectors is inhomogeneous, i.e., if there is a “change point” in the sequence beyond which the correlation structure changes. In many applications the change has to be detected in real time, i.e., with minimum possible delay while avoiding false alarms. Rapid and timely detection of disorder can potentially save the cost of acquiring the rest of the samples. This problem has applications to slippage problems in multivariate time-series analysis and financial stock analysis, anomaly detection in social networks, cyber-physical systems and communication networks, and intrusion detection in sensor networks. In multivariate time-series analysis, it is of interest to know if the coefficients of the time series have abruptly changed over time. In stochastic finance, it is of interest to detect a sudden change in the correlation between a set of stocks being monitored. In social networks, it is of interest to detect an abrupt change in the interaction level between a pair of agents. In communication networks it is of interest to detect emergent hubs of highly correlated traffic flows over the network. Such a hub may be a potential point of attack by a cyber attacker. In sensor network intrusion detection, the presence of an intruder might affect the correlation between the observations at various sensors located near the intruder. The major challenges in this problem are: 1) The dimension of the vectors is much larger than the total number of available samples before and after the change point. 2) The statistical properties of the vectors may not be precisely known, i.e., the problem is nonparametric in nature1 . We formulate this detection problem in the framework of quickest change detection (QCD) (see, e.g., [2], [3], and [4]). In the QCD problem a decision maker observes a stochastic process over time. At some point in time, called the change point, the distribution of the process changes. The decision 1 By nonparametric we mean that the parameter space is infinite dimensional. 2 maker has to detect this change in distribution with minimum possible delay, subject to a constraint on false alarms. The QCD problem has been formulated in various ways in the literature. One prevalent formulation of the QCD problem is as a stochastic optimization problem, where the goal is to find a stopping time on the observed stochastic process so as to minimize a suitable metric on the delay, subject to a suitable metric on the false alarm rate. A typical solution is a stopping rule that reduces to a single threshold test, where a sequence of statistics is computed over time, and a change is declared the first time the statistic exceeds a stopping threshold. The stopping threshold is chosen to control the rate of false alarms. The theoretical foundation for such sequential decision making was laid by Wald; see [5] [6]. The Bayesian version of the problem, where a prior on the change point is assumed, is developed in [7], [8], and [9]. The QCD problem in non-Bayesian minimax settings has been formulated in [10], [11], [12], [13], [14]. In general, an optimal or asymptotically optimal solution to a QCD problem can be obtained only when the pre- and post-change distributions are known to the decision maker, or when the post-change distribution is in a parametric family. In the nonparametric setting, an optimal solution is hard to obtain. As a result, in the nonparametric setting the goal is often less ambitious than to find an optimal solution. Rather, a reasonable procedure is proposed and its properties are established, e.g., consistency, convergence rate, scalability, and so on. In this paper we propose a consistent and scalable nonparametric procedure for correlation change detection in high-dimensional random vectors in a sample starved setting. This success is achieved through the notions of subsampling – collecting blocks of observations at a time – and summary statistics defined on each block. See Section II and III for details. Specifically, we consider the following random matrix observation model. A sequence of random matrices {X(m)} is observed over time, indexed by m, where each X(m) is a n × p short and fat random matrix. By short and fat matrix we mean p  n. The rows of these random matrices may correspond to approximately independent realizations of p different variables, e.g., sampled over blocks of time or sampled in a sequence of repeated experiments. For example, in the case of detecting a change in the coefficients of a Gaussian univariate time series, p successive time samples may be acquired over n well separated blocks of time. A change in the coefficients of the time series is reflected in a change in the correlation matrix associated with each block. In stochastic finance, we may have access to multiple instances of stock values over a day or week, and a change in correlation may occur only at the end of the day or week. For example, we may have a total of 500 samples of a 10000 dimensional vector. These 500 samples are acquired periodically over time (say one each weekday). An anomaly may occur either any time (day) or at times that are multiples of 5 (once a week). These 500 samples may be grouped 5 samples at a time to form a sequence of hundred 5×10, 000 random matrices (p = 10, 000 and n = 5). Note that even if a change in correlation occurs at any time point, we still group the data in batches2 . This is the price we pay for operating in nonparametric and highdimensional setting. The objective is to obtain a sequential procedure for detecting a change in correlations in such a setting. If the distribution of the random matrices belong to a parametric family, and the parameter before the change is known, then efficient procedures from the quickest change detection literature can be used for detection [11], [14], [15]. However, as discussed above, in the absence of a parametric model for the data, or even a lack of knowledge of the prechange parameter in a parametric model, a situation common in big data settings and the high-dimensional nature of our problem (p  n), no optimal procedures are known for detection of change. Here, by optimal we mean optimal in the sense of minimizing detection delay as studied in classical QCD literature [8], [11], [16]. In this paper we propose a nonparametric procedure that can provably detect a class of changes in population correlation in the observed highdimensional vectors. The procedure is also optimal in a well defined sense. Specifically, in Section II we consider the problem of quickest detection of a change in population dispersion (or correlation) matrix under the assumption that the X(m) are independent and identically distributed, with joint distribution from the nonparametric family of elliptically contoured distributions. The precise mathematical problem is stated in Section II. We propose a novel scalar summary statistic V (X) for the data matrix X that is used as the test statistic in the change detection procedure. The summary statistic is the minimal size of the k-nearest neighborhood among all the columns of the observed matrix, where size is measured by the sample correlation associated with the column and its knearest (most correlated) neighbors. We obtain an approximate distribution for the summary statistic in the sample starved purely high dimensional regime of p → ∞ with n fixed and small. We show in Section III that the distribution of the summary statistic belongs to a one-parameter exponential family, with the unknown parameter a function of the underlying distribution of the data matrix. In this manner we map the sequence of n × p observed data matrices {X(m)} to a sequence of real valued summary statistics {V (X(m))} whose distribution is in a known parametric family for sufficiently large p and finite n. A change in distribution in the sequence {X(m)} may cause a change in the parameter of the distribution of {V (X(m))}. While the parametric family for {V (X(m))} is known, the actual pre- and post-change parameters may not be known. However, in our problem, under some block sparsity condition on the population correlation matrix, the pre-change parameter can be shown to be within an interval around 1 (See Theorem 3.1 below). We thus detect the change in parameter by applying the generalized likelihood ratio (GLR) based test of Lorden [11] (also see [17]) by setting the pre-change parameter to 1. We then provide a detailed performance analysis of the Lorden’s test under misspecification of the pre- and post2 As we will see later, the block size could be any n ≥ 5. 3 change distributions. We emphasize that while the analysis of SPRT and CUSUM tests under misspecification of pre-change parameter is standard (though nontrivial; see [4]), equivalent analysis for Lorden’s GLR test need an extra set of conditions (see Section IV-B). The summary statistic we choose is equivalent to the maximum magnitude correlation in the sample correlation matrix. As a result our proposed procedure is asymptotically optimal over all tests that use maximum magnitude correlation as test statistics. This is because our proposed test uses the asymptotic distribution of the summary statistic in the Lorden’s test. We also remark that while we focus on sequential detection of changes, it is clear that the proposed summary statistic can also be used for sequential hypothesis testing and even for fixed sample size testing [4]. In Section V we validate the effectiveness of the proposed procedure by verifying the theoretical results through numerical simulations. To summarize the contributions of this paper: we propose a nonparametric quickest detection procedure for detecting a change in correlation in a sequence of n × p high-dimensional matrices (p  n) {X(m)}. The details are summarized below. 1) We propose a novel summary statistic V (X) of the data matrix X, which is the maximal sample correlation between the columns of the matrix X. 2) We obtain an asymptotic distribution for V (X) in the purely high dimensional regime of fixed n and p → ∞ under the assumption that the matrices X are elliptically distributed. The asymptotic distribution of V (X) belongs to a one-parameter exponential family. 3) The change is detected by applying Lorden’s GLR test to the summary statistic sequence {V (X(m))}. 4) We analyze the performance of Lorden’s GLR test when the pre- and post-change distribution are misspecified. As we will show in Section IV-B the analysis needs extra set of conditions as compared to those needed for similar analysis of classical tests like SPRT or CUSUM. 5) We obtain conditions on the pre- and post-change dispersion matrices in the elliptical model of X(m) for which the change can be accurately detected. II. P ROBLEM D ESCRIPTION A decision-maker sequentially acquires samples from a family of distributions of n×p random matrices over time, indexed by m, leading to the random matrix sequence {X(m)}m≥1 , called data matrices. For each m the data matrix X(m) has the following properties. Each of its n rows is a sample of a pvariate random vector X(m) = [X1 (m), · · · , Xp (m)]T with p × 1 translation parameter µm and p × p positive definite dispersion matrix Σm . The random matrix X(m) is assumed to have an elliptically contoured density, also called an elliptical density [18], [19] T fX(m) (x) = hm (trace{(x − µm 1T )T Σ−1 m (x − µm 1 )}), for some unknown nonnegative strictly decreasing shaping function hm on R+ . If µm = 0 and Σm = Ip , where Ip is the p × p identity matrix, then the matrix X(m) is said to have a spherical density. The data matrices {X(m)} are assumed to be statistically independent. For some time parameter γ the samples have common dispersion matrix Σm = Σ0 and shaping function hm = h0 for m < γ and common dispersion parameter Σm = Σ1 6= Σ0 and shaping function hm = h1 for m ≥ γ. The scalar γ is called the change point and the pre-change 0 and post-change distributions of X(m) are denoted by fX and 1 fX , respectively. No assumptions are made about the mean parameter µm , which can take different values for different m. At each time point m the decision-maker decides to either stop sampling, declaring that the change has occurred, i.e., m ≥ γ, or to continue sampling. The decision to stop at time m is only a function of (X(1), · · · , X(m)). Thus, the time at which the decision-maker decides to stop sampling is a stopping time for the matrix sequence {X(m)}. The decisionmaker’s objective is to detect this change in distribution of the data matrices as quickly as possible, subject to a constraint on the false alarm rate. The above detection problem is an example of the quickest change detection (QCD) problem. See [3], [2], and [4] for an overview of the QCD literature. The objective in our QCD problem is to find a stopping time τ on the sequence of data matrices {X(m)}, so as to minimize a suitable metric on the delay (τ −γ), subject to a constraint on a suitable metric on the event of false alarm {τ < γ}. This paper follows the minimax QCD formulation of Pollak [16]: min τ subj. to sup Eγ [τ − γ|τ ≥ γ] γ≥1 (1) E∞ [τ ] ≥ β, where Eγ is the expectation with respect to the probability measure under which the change occurs at γ, E∞ is the corresponding expectation when the change never occurs, and β ≥ 1 is a user-specified constraint on the mean time to false alarm. 0 1 If the pre- and post-change densities fX and fX are known to the decision maker, and µm is constant before and after change, then algorithms like the Cumulative Sum (CuSum) algorithm [10], [11], [12], or the Shiryaev-Roberts family of algorithms [20], [16], [21], can be used for efficient change detection. Both the CuSum algorithm and the Shiryaev-Roberts family of algorithms have strong optimality properties with respect to both the popular formulations of Lorden [11] and that of Pollak [16], used in this paper. If only the pre-change and post-change shape functions h0 and h1 are known then (1) is a parametric QCD problem. In this case, under the assumption that µm = µ0 , m < γ, and Σ0 are known, efficient QCD algorithms can be designed, having strong asymptotic optimality properties, based on, e.g., the generalized likelihood ratio (GLR) technique [4], the mixture based technique [4], or the non-anticipating estimation based technique [15]. In many situations, however, the pre- and post-change shape functions h0 and h1 may be unknown. This is the nonparametric QCD setting considered in this paper. In addition we are interested in the scenario where p  n. There is 4 no known non-parametric and efficient3 solution to the QCD problem in this high dimensional regime. For example, for a test based on empirical estimates of the covariance/correlation matrix of X, one typically needs the dimension p to be smaller than the number of samples n. In the rest of the paper we propose a technique for efficient quickest detection of changes for the above nonparametric and high-dimensional QCD problem. We first propose a novel scalar summary statistic V (X) on the data matrix X. The theory from [23] helps us establish that the proposed summary statistic has a well defined exponential limiting distribution as p → ∞ for fixed n, the so-called ”purely high dimensional regime” [1]. This summary statistic is related to the empirical distribution of the vertex degree of the correlation graph associated with the thresholded sample correlation matrix. Below we show that the distribution of the statistic V (X) converges to a parametric distribution in the exponential family in this purely high dimensional regime. Thus, the nonparametric QCD problem in terms of {X(m)} is mapped to a parametric QCD problem in terms of the summary statistic sequence {V (X(m))}. We then apply a GLR based test suggested by Lorden in [11] to the sequence of summary statistics {V (X(m))} to detect the change efficiently. If the pre-change dispersion matrix Σ0 is diagonal, then we show below that this amounts to a known pre-change parameter in the QCD problem of detecting a change in the distribution of the statistic V (X(m)). In this case the GLR stopping rule used is asymptotically optimal under the Lorden minimax QCD model [11], and hence also in terms of solving (1), among all rules that are stopping rules for the sequence {V (X(m))}. If the pre-change matrix Σ0 is unknown and not diagonal, then we have an unknown pre-change parameter in the QCD problem based on {V (X(m))}. Below we establish conditions on the matrix Σ0 which guarantee that the GLR stopping rule remains approximately optimal. This is achieved by analyzing the performance of the GLR test under mis-specification of the pre-change distribution. III. S UMMARY S TATISTIC FOR THE DATA M ATRIX X In this section we define the proposed summary statistic V (X) and obtain its asymptotic density in the purely high dimensional regime of p → ∞, n fixed. The notation below follows the conventions of [23]. For an elliptically distributed random data matrix X we write X = [X1 , · · · , Xp ] = [XT(1) , · · · , XT(n) ]T , where Xi = [X1i , · · · , Xni ]T is the ith column and X(i) = [Xi1 , · · · , Xip ] is the ith row. Define the p × p sample covariance matrix as n S= 1 X (X(i) − X̄)T (X(i) − X̄), n − 1 i=1 3 We call a test efficient if there is a linear relationship between the average delay and the logarithm of the mean time to false alarm. This is a standard notion of a good test in the literature; see [22] and also see Theorem 4.1. where X̄ is the sample mean of the n rows of X. Also define the sample correlation matrix as R = DS −1/2 SDS −1/2 , where DA denotes the matrix obtained by zeroing out all but the diagonal elements of the matrix A. Note that, under our assumption that the ensemble dispersion matrix Σ of the rows of X is positive definite, DS is invertible with probability one. Thus Rij , the ijth element of the matrix R, is the sample correlation coefficient between the ith and j th columns of X. (k) Define dNN (i) to be the sample correlation between the i-th column of X and its k-th nearest neighbor in the columns of X (in terms of Euclidean distance): (k) dNN (i) := k th largest order statistic of {|Rij |; j 6= i}. Then for fixed k, define the summary statistic (k) Vk (X) := max dNN (i). 1≤i≤p (2) Thus, if magnitude correlation between variables is used as a distance measure, then the summary statistic Vk is the maximum size of the k-Nearest Neighborhood (k-NN) across variables. However, the summary statistic Vk is a global statistic, and is insensitive to variations in the minimal kNN correlations as long as the maximum of these k-NN correlations remains the same. Below we show that the distribution of the statistic Vk can be related to the distribution of an integer valued random variable Nδ,ρ that counts the number of highly correlated neighborhoods. For a threshold parameter ρ ∈ [0, 1] define the correlation graph Gρ (R) associated with the correlation matrix R as an undirected graph with p vertices, each representing a column of the data matrix X. An edge is present between vertices i and j if the magnitude of the sample correlation coefficient between the ith and j th components of the random vector X is greater than ρ, i.e., if |Rij | ≥ ρ, i 6= j. We define δi to be the degree of vertex i in the graph Gρ (R). For a positive integer δ ≤ p − 1 we say that a vertex i in the graph Gρ (R) is a hub of degree δ if δi ≥ δ. We denote by Nδ,ρ the total number of hubs in the correlation graph Gρ (R), i.e., Nδ,ρ = card{i : δi ≥ δ}. The events {Vδ (X) ≥ ρ} and {Nδ,ρ > 0} are equivalent. Hence P(Vδ (X) ≥ ρ) = P(Nδ,ρ > 0). (3) Because of the above relation, for a fixed level ρ, Vδ (X) indicates the presence of star subgraphs of degree at least k in the correlation network of threshold value ρ. Thus Vδ (X) is an extreme value statistic that is only sensitive to the topology of the correlation network through the distribution of star subgraphs. As in [24] and [23] we say that a matrix is row sparse of degree k if there are no more than k nonzero entries in any row. We say that a matrix is block sparse of degree k if the matrix can be reduced to block diagonal form having a single k × k block, via row-column permutations. 5 Theorem 3.1: Let Σ, the population dispersion matrix of the rows of X, be row sparse of degree k = o(p). Also let p → ∞ and ρ = ρp → 1 such that p1/δ (p−1)(1−ρ2 )(n−2)/2 → en,δ ∈ (0, ∞). Then: The density fV is a member of a one-parameter exponential family with JX as the unknown parameter. This follows from the following relations. First δ   Z 1 p−1 2 n−4 2 du Λ(ρ) = p an (1 − u ) δ ρ 1) P(Vδ (X) ≥ ρ) → 1 − exp(−ΛJX /φ(δ)), (6) δ = C T (ρ) , where JX is the function (defined as function J in [23, Equation (33)]) of the distribution of X (and hence of X) and Λ= lim p→∞,ρ→1 where C = Cp,n,δ = p δ Λ(ρ) = ((en,δ an )/(n − 2)) /δ!,   p−1 δ an δ (7) does not depend on ρ, and with   p−1 Λ(ρ) = p P0 (ρ)δ , δ Z 1 (1 − u2 ) n−4 2 du. (8) ρ n−4 1 2 (1 − u ) P0 (ρ) = an Z T (ρ) = n−4 2 Using (6) and noting that T (ρ)0 = −(1 − ρ2 ) 2 , fV (ρ) = fV (ρ; JX ) is a member of the exponential family with parameter JX > 0: du, ρ an = 2B((n−2)/2, 1/2) with B(l, m) the beta function, φ(δ) = 2 if δ = 1, φ(δ) = 1 otherwise. 2) If Σ is block sparse of degree k, then fV (ρ; JX )   (9) Cδ CT (ρ)δ δ−1 2 n−4 2 T (ρ) (1 − ρ ) JX . = JX exp − φ(δ) φ(δ) JX = 1 + O((k/p)δ+1 ), and if Σ is diagonal then JX = 1. Proof: The result follows from (3) and from Proposition 2 in [23]: The vertex degree parameter δ in (9) is a fixed design parameter that can be selected to maximize change detection performance according to (1). In the sequel, we fix δ = 1. For this value of δ, the statistic Vδ reduces to the maximal magnitude correlation P(Nδ,ρ > 0) → 1 − exp(−ΛJX /φ(δ)), V (X) = max |Rij |, i6=j under the same asymptotic limit of p and ρ specified in the theorem statement. In Section III-A below we provide some insights into the nature of the parameter JX appearing in Theorem 3.1 above. We first comment on the consequences of this theorem. Using (3) and Theorem 3.1, the large p distribution of Vk defined in (2) can be approximated, for k = δ, by P(Vδ (X) ≤ ρ) = exp(−Λ(ρ)JX /φ(δ)), ρ ∈ [0, 1], (4) where Λ(ρ) is as defined in Theorem 3.1. Although the limits in Theorem 3.1 are guaranteed to hold for large values of ρ, numerical experiments [23] have shown that the approximation (4) remains accurate for smaller values of ρ as long as n is small and p  n. The distribution (4) is differentiable everywhere except at ρ = 0 since P (Vδ (X) = 0) > 0 when using the finite p and ρ < 1 approximation Λρ for Λ specified in Theorem 3.1. For ρ > 0 and large p, Vδ has density   Λ(ρ) Λ0 (ρ) JX exp − JX , ρ ∈ (0, 1]. (5) fV (ρ) = − φ(δ) φ(δ) Note that fV in (5) is the density of the Lebesgue continuous component of the distribution (4) and that it integrates to 1 − 2 O(e−p ) over ρ ∈ (0, 1]. (10) and the density in (9) reduces to   n−4 C C (1 − ρ2 ) 2 J exp − J T (ρ) , ρ ∈ (0, 1], 2 2 (11) where we have suppressed subscript X in the exponential family parameter J on the distribution of X. In Fig. 1 is plotted the density fV for various values of J for n = 10, and p = 100. We note that for the chosen values of n and p, the density is concentrated close to ρ = 1. fV (ρ; J) = Fig. 1. Plot of density fV in (9) for various values of the parameter J for n = 10, p = 100. This is the density of the summary statistic used to detect a change in covariance of the random matrix sequence X. 6 A. Interpretation of the parameter J = JX The asymptotic approximation to the probability P(Nδ,ρ > 0), used in Theorem 3.1, is obtained in [23] by relating Nδ,ρ to a Poisson random variable in the purely high dimensional limit as p → ∞ and n fixed. The first step in the process is a Z-score representation of sample correlation R: R = ZT Z, Z = [Z1 , . . . , Zp ] Xi − µ̂i 1 , i = 1, . . . , p Zi = √ √ σ̂ ii n − 1 These Z-scores lie in a n − 2 dimensional subspace 1T Zi = 0 and kZi k = 1. Due to the fact that ZTi Zj = Rij , and kZi − Zj k = q 2(1 − Rij ), the correlation between the columns of the data matrix is directly related to the Eucledian distance between their corresponding Z-scores. The parameter J = JX is a limiting value of an average of the joint density of the Z-scores. It is a Z-score uniformity measure: J = 1 implies the scores are uniformly distributed on the n − 2 dimensional sphere, J > 1 if the scores are homophilic in nature, and J < 1 if they are homophobic. For more details we refer the readers to [23]. in parameter of an exponential family, with known pre-change parameter value. The change in this case can be efficiently detected using Lorden’s GLR test [11] (also see Section IV-A below), and the test can be designed using the performance analysis provided in [11]. In the case of non-diagonal dispersion matrix Σ0 , the QCD problem in (12) has an unknown pre-change parameter J0 . There are no known efficient solutions to the QCD problem in this case 4 . However, we recall that if the dispersion matrix Σ0 is only block-sparse with degree k  p, then by assertion 2 of Theorem 3.1, J0 is close to 1, i.e., |J0 − 1| is small. Motivated by this fact we use Lorden’s test in this case as well, with J0 set equal to 1, and characterize the range of pre-change parameters close to 1 for which the change can be detected efficiently. Specifically, in Section IV-B below, we provide delay and false alarm analysis of Lorden’s test when there is a mis-specification in the pre- and post-change distribution. As discussed in the introduction, such an analysis for SPRT and CUSUM is standard (though nontrivial) in the literature [4], but the one involving GLR based CUSUM, i.e., Lorden’s test requires an extra set of conditions. These extra set of conditions are specified in Assumptions 1–3 below. We note again that the performance analysis in Section IV-B is provided for an arbitrary one-parameter exponential family, and not just for the family in (11). IV. QCD FOR LARGE SCALE RANDOM MATRICES In this section we apply the asymptotic results of Theorem 3.1 derived in Section III to quickest change detection of the maximal kNN coherence in the data matrix sequence {X(m)}. We assume that both the pre- and post-change dispersion matrices, Σ0 and Σ1 , are row sparse with degree k = o(p), and map the data matrix sequence {X(m)} to the sequence of summary statistics {Vδ (X(m))}m≥1 , with δ = 1. For simplicity we refer to this sequence by {V (m)}. In the asymptotic regime considered in Theorem 3.1, the random variables {V (m)} each have an approximate asymptotic density fV (·; J) of form (11). A change in the distribution of the data matrix sequence {X(m)} at time γ changes the parameter J in the density fV (·; J) of variable V . Let J0 and J1 be the value of parameter J before and after change point γ, respectively. We are implicitly assuming here that a change in correlation changes the parameter J of the summary statistic. If not, then our proposed procedure will be insensitive to the correlation change. The QCD problem on the density fX , depicted in (??), is reduced to the following QCD problem on the density fV : V (m) ∼ fV (·; J0 ), m < γ ∼ fV (·; J1 ), m ≥ γ. (12) Below we consider two cases of row-sparse pre-change dispersion matrices: 1) Σ0 is diagonal, and 2) Σ0 is not diagonal but is block-sparse. Note that Σ1 is only assumed to be row-sparse. If Σ0 is diagonal then, from Theorem 3.1, J0 = 1, and the QCD problem in (12) reduces to a QCD problem of change A. QCD with Diagonal Pre-Change Dispersion Matrix Σ0 If the pre-change dispersion matrix is diagonal, then from Theorem 3.1 J0 = 1, and the QCD problem (12) reduces to the parametric QCD problem with unknown post-change parameter J: V (m) ∼ fV (·; 1), ∼ fV (·; J), m<γ J 6= 1, m ≥ γ. (13) Consider the following QCD test, defined by the stopping time τG 5 ) ( m X fV (V (i); J) >A , τG = inf max sup log m≥1 1≤`≤m J:|J−1|≥ fV (V (i); 1) i=` (14) where A and  > 0 are user-defined parameters. The parameter A is a threshold used to control the false alarm rate. The parameter  represents the minimum magnitude of change, away from J = 1, that the user wishes to detect. The stopping rule τG was shown to be asymptotically optimal in [11] for a related QCD problem when 1) the marginal density fV (v; ·) of the observation sequence {V (m)} is of known form that is a member of a one-parameter exponential family, and 2) when the parameter J0 of the pre-change density is known. Both of these properties are satisfied for 4 The difficulty in this setting is that due to our minimax formulation, the worst case of delay will occur when we do not have enough time to learn the pre-change parameter. 5 The subscript G in τ is used to denote a GLR test. This is not to be G confused with the use of density function g in the misspecification analysis to follow. 7 the summary statistic V = V (X) for the QCD model in (13), since J0 = 1. Due to the results in [14], the stopping rule τG is asymptotically optimal for the problem (1) as well. The following theorem establishes strong asymptotic optimality of this test with {V (m)} as the observation sequence. It also provides delay and false alarm estimates by which the test can be designed. Theorem 4.1 ( [11], [14]): Fix any  > 0. 1) For the stopping rule τG , the supremum in (1) is achieved at γ = 1, i.e., Below we provide performance bounds for the mean time to false alarm and the average detection delay when the samples have density g. Specifically, we provide bounds on Eg [τG ], where Eg denotes expectation with respect to the probability measure under which all the samples {Ym } have density g. When the density g is close to fθ0 , the expression Eg [τG ] can be interpreted as an estimate of the mean time to false alarm. When the density g is close to fθ , for some θ with |θ−θ0 | ≥ , then the expression Eg [τG ] can be interpreted as an estimate of the average time to change detection. 1) Mean Time to False Alarm: We first provide a lower bound on Eg [τG ] when g is not necessarily equal to fθ0 , but is close to fθ0 in a particular sense. The closeness is characterized through the following three assumptions. sup Eγ [τG − γ|τG ≥ γ] = E1 [τG − 1]. γ≥1 2) Setting A = log β ensures that as β → ∞, E∞ [τG ] ≥ β(1 + o(1)), and for each possible true post-change parameter J, with |J − 1| ≥ , log β (1 + o(1)) I(J) = inf sup Eγ [τ − γ|τ ≥ γ](1 + o(1)), E1 [τG ] = τ :E∞ [τ ]≥β γ≥1 Assumption 1: There exists a positive constant κθ,g such that for every θ ∈ Θ with |θ − θ0 | ≥  κθ,g Z  fθ (y) g(y) dµ(y) = 1. (18) fθ0 (y) Furthermore, there exists κg such that (15) where I(J) is the Kullback-Leibler divergence between the densities fV (·; J) and fV (·; 1). Theorem 4.1 implies that the stopping rule τG is uniformly asymptotically optimal for each post-change parameter J, as long as |J − 1| ≥ . For convenience of implementation one can also use the window limited variation of τG as suggested in [14]. B. QCD with Block-Sparse Pre-Change Dispersion Matrix Σ0 As discussed above, if the pre-change dispersion matrix Σ0 is not diagonal, then the pre-change parameter J0 6= 1. If Σ0 is block-sparse with degree k  p, then by Theorem 3.1, |J0 − 1| is small. This motivates the use of Lorden’s test as in (14) for QCD, but then Theorem 4.1 no longer applies since fV (·; J0 ) with J0 = 1 is a mis-specification of the true pre-change distribution. In this section we analyze the performance of Lorden’s GLR test for {fV (·; J)} vs fV (·; 1) when the samples are drawn from a density g. The theorem proven below is in fact applicable to a broader class of scalar parameter exponential families, not just to the {fV (·; J)} family (11) considered in this paper. For scalar parameter θ let {fθ } be a parametric exponential family of distributions with respect to a σ-finite measure µ fθ (y) = eθT (y)−b(θ) h(y), θ ∈ Θ, (16) where Θ is a specified interval on the real line and b(θ) is differentiable everywhere on Θ. The QCD test τG applied to this family for detecting a change from fθ0 to fθ , with |θ − θ0 | ≥ , in an observation sequence {Ym }, is given by (see (14)) ( ) m X fθ (Yi ) >A . τG = inf m ≥ 1 : max sup log 1≤k≤m θ:|θ−θ0 |≥ fθ0 (Yi ) i=k (17) 0 < κg ≤ inf θ∈Θ:|θ−θ0 |≥ (κθ,g ). (19) The condition in (18) is the classical condition needed to analyze one-sided tests under mis-specification [25]. The condition in (19) is an additional condition that will be needed for analysis of the GLR test defining the stopping time (17). Let G be a family of densities on the real line, for example, G ⊂ {fθ }. Assumption 2: There exists a positive constant κ∗ such that 0 < κ∗ ≤ κg , ∀g ∈ G. (20) Assumption 3: The KL-divergence I(θ) between fθ and fθ0 increases with |θ − θ0 |. Theorem 4.2: 1) If Assumption 1 and Assumption 3 are satisfied then eκg A Eg [τG ] ≥ 2  A min{I(θ0 +),I(θ0 −)} +1 . 2) Furthermore, if Assumption 2 is also satisfied then for every g ∈ G ∗ eκ Eg [τG ] ≥ 2  A A min{I(θ0 +),I(θ0 −)} +1 . Proof: The proof is provided in the appendix. We note that the lower bound in the second part of the above theorem is not a function of the density g. Also, if g = fθ0 then κ∗ = κg = κθ,g = 1, ∀θ, and the lower bounds agree with that obtained in [11]. 8 plot the integral in (18) for various values of J, |J − 1| ≥ , in Fig. 2. Specifically, we use J = 0.4, 1.9, 5, 10, 15, and plot R of the integral (fV (v; J)/fV (v; 1))κ fV (v; J0 ) dv = 1 as a function of κ. In the figure we can see the points at which the integral equals 1 (identified for example by the labels κ1.9 and κ5 ), and the smallest such point correspond to the curve for parameter J = 1 +  = 1 + 0.9 = 1.9. By varying J0 and  one can show that there is an interval around 1 for which the corresponding κg,θ is positive, and the smallest value is Theorem 4.3: If Assumption 4 is satisfied then achieved by either of the post-change parameters 1+ or 1−. A (1+o(1)) as A → ∞. Thus, the results are analogous to the Gaussian case analyzed Eg [τG ] ≤ R log[fθg (y)/fθ0 (y)]g(y)dµ(y) in Lemma 1. Proof: The proof is provided in the appendix. 2) Average Detection Delay: We next obtain an upper bound on Eg [τG ] when g is close to one of the members of the post-change set of densities. The closeness here is characterized by the following assumption. Assumption 4: ∃θg , s.t. |θg − θ0 | ≥  Z log[fθg (y)/fθ0 (y)] g(y) dµ(y) > 0. We note that if g = fθ , for |θ − θ0 | ≥ , then the upper bound in Theorem 4.3 is the performance of the GLR test as obtained in [11]. 3) Example from a Gaussian family: We now give an example where the conditions of Theorem 4.2 are satisfied. We state the result as a lemma. Lemma 1: Consider a Gaussian family (y−θ)2 1 fθ (x) = √ e− 2 , θ ∈ (−∞, ∞), 2π where we are trying to detect a change in mean from a level θ0 to a level θ, with |θ −θ0 | ≥ , and the actual samples {Ym } have density g = fθ̃0 . Then the following hold. 1) There exists a κθ,g > 0 given by κθ,g = 1 + 2(θ0 − θ̃0 ) θ − θ0 (21) R Fig. 2. Plot of the integral (fV (v; J)/fV (v; 1))κ fV (v; J0 ) dv = 1 as a function of κ, for various values of J: J = 0.4, 1.9, 5, 10, 15. The dashed lines are used to show the point of intersection of the curve corresponding to a particular value of J with the straight line at height 1. Note that the value of κ at which the curves take value 1, κg , increases with the parameter value J for J > 1, and κg ≤ 1 for J ≥ 1 and κg ≥ 1 for J < 1. Thus the smallest κ is achieved by the parameter J = 1 + , which in this case, is 1 +  = 1.9. satisfying (18) provided |θ̃0 − θ0 | < /2. 2) There exists a κg > 0 given by 2(|θ̃0 − θ0 |) κg = min{κg,θ0 + , κg,θ0 − } = 1 − (22)  that satisfies (19). 3) Let G = {fθ : |θ − θ0 | ≤ /3}. Then κ∗ = min{κfθ0 +/3 ,θ0 + , κfθ0 −/3 ,θ0 − } satisfies Assumption 2. That is, κ∗ is the minimum of kg with g = fθ0 + 3 and kg with g = fθ0 − 3 . Proof: The proof is provided in the appendix. 4) Application to the family {fJ }: The conditions of Theorem 4.2 are also satisfied by the family {fV (·; J)} defined in (11) for large p. We consider a change in parameter J of the family   n−4 C C fV (ρ; J) = (1 − ρ2 ) 2 J exp − J T (ρ) , ρ ∈ (0, 1], 2 2 (23) from 1 to J with |J − 1| ≥ . If the samples are drawn from J0 , i.e., g = fJ0 , we show via numerical computation that similar to the Gaussian case, the worst case κg is achieved at the boundary. To show this we fix  = 0.9, J0 = 1.1 and V. N UMERICAL R ESULTS Here we apply the stopping rule τG in (14) to the problem of detecting a change in the distribution when the {X(m)} are Gaussian distributed random matrices. In this case the dispersion Σ is the covariance matrix of the rows of X. The pre-change covariance is the p × p diagonal matrix Σ0 = diag(σi2 ), where σi2 > 0 are arbitrary componentwise variances. The post-change covariance matrix Σ1 is a row-sparse matrix of degree k, obtained as follows. A p × p sample from the Wishart distribution is generated and some of the entries are forced to be zero in such a way that no row has more than k non-zero elements. Specifically, we retain the top left k × k block of the matrix, and for each row i, k + 1 ≤ i ≤ (p + k)/2, all but the diagonal and the (p + k + 1 − i)th element is forced to zero. Each time an entry (i, j) is set to zero, the entry (j, i) is also set to zero, to maintain symmetry. Finally, a scaled diagonal matrix is also added to Σ1 to restore its positive definiteness. We set n = 10, p = 100, and k = 5. To implement τG we have chosen  = 1.5, and we use the the maximum likelihood estimator which, as a function of m samples (V (1), · · · , V (m)) from fV (·, J), is given by ˆ (1), · · · , V (m)) = J(V C 1 2 m 1 Pm i=1 T (V (i)) . (24) 9 Specifically, arg max log J:J≥2.5 m X fV (V (i); J) i=` fV (V (i); 1) (25) ˆ (`), · · · , V (m))}. = max{2.5, J(V In Fig. 3 we plot the delay (E1 [τG ]) vs the log of mean time to false alarm (log E∞ [τG ]) for various values of the postchange parameter J. The values in the figure are obtained by choosing different values of the threshold A and estimating the delay by choosing the change point γ = 1 and simulating the test for 500 sample paths. The mean time to false alarm values are estimated by simulating the test for 1500 sample paths. The parameter J for the post-change distribution is estimated using the maximum likelihood estimator (24). As predicted Fig. 3. The empirical mean time to detect vs mean time to false alarm (in log scale). The mean time to detect decreases as the parameter J increases, and the relation between E1 [τG ] and log(E∞ [τG ]) is linear, as predicted by Theorem 4.1. The K-L divergence values for J = 1.99, 3.5, 5.97 and 21.45 are 0.1906, 0.5385, 0.9543, and 2.1123, respectively. The slopes of the lines are approximately inverse of the K-L divergence values. by the theory, the delay vs log of false alarm trade-off curve is approximately linear. For larger values of J, the KullbackLeibler (K-L) divergence between fV (·, J) and fV (·, 1) is also larger, resulting in smaller delays. For the chosen values of the post-change parameters J = 1.99, 3.5, 5.97 and 21.45, the corresponding K-L divergence values I(J) are 0.1906, 0.5385, 0.9543, and 2.1123, respectively. In Fig. 4 we compare the delay vs false alarm trade-off curve for the post-change parameter J = 3.5 plotted in E∞ [τG ] Fig. 3, with the values predicted by the theory: logI(J) . We see from Fig. 4 that the predictions are quite accurate. We have obtained similar results when the test was simulated for different sparsity degrees k. Thus, the change can be efficiently detected using our proposed methodology. Finally, in Fig. 5 is plotted the delay vs false alarm tradeoff curves for a misspecification scenario. We consider the situation when we wish to detect a change in correlation in the sequence of random matrices {X(m)}. Suppose we believe that the pre-change dispersion matrix Σ0 to be diagonal and the post-change dispersion matrix Σ1 to be row sparse. As a result we choose to apply the Lorden’s GLR rule τG (14), with  = 1.5, for change detection. The first curve from the Fig. 4. Comparison of the delay vs false alarm trade-off curve for J = 3.5 log E∞ [τG ] log E∞ [τG ] from Fig.3 with the values predicted by the theory: = 0.5385 . I(J) The difference diminishes as the mean time to false alarm increases. This is due to the asymptotic nature of the results in Theorem 4.1 bottom in Fig. 5 is the performance, obtained via simulations, of the rule τG when Σ0 is indeed diagonal and the post-change parameter is J = 3.149. This curve will serve as a benchmark. Suppose now that in fact the matrix Σ0 is not diagonal, and hence some correlation is present between the variables before the change occurs. Specifically, we assume that Σ0 is block sparse with block size 5. For the Σ0 we have chosen the parameter J0 is 1.31, and the performance of the stopping rule τG for this case is shown by the second curve from below in Fig. 5. As expected there is a loss in performance because of the misspecification in the pre-change parameter J0 . For this plot the threshold A for τG was chosen using the knowledge of the pre-change parameter J0 . The remaining, the top two, plots in Fig. 5 show the loss in performance as predicted by Theorem 4.2. As suggested by the theorem the delay-false alarm trade-off is given by E1 [τG ] = log β (1 + o(1)), as β → ∞, κg I(J) when the pre-change parameter is known, and by E1 [τG ] = log β (1 + o(1)), as β → ∞, κ∗ I(J) when the pre-change parameter is known only within an uncertainty class. The top most plot in Fig. 5 is the trade-off curve for the case when we only Rknow that |J0 − 1| ≤ 0.4. Thus, κ∗ is obtained by solving (fJ (v)/f1 (v))κ fJ0 (v) dv = 1 for J = 2.5 and J0 = 1.4. The value obtained is 0.33. The second curve from the top is the trade-off curve when the value of κ is obtained by using the knowledge of the prechange parameter. The value of κ = κg so obtained is 0.47. As expected, these estimate show a significant loss in performance because the thresholds have to be chosen to satisfy the false alarm constraint, without the knowledge of the pre- and postchange parameters. VI. C ONCLUSIONS AND F UTURE W ORK We have introduced a novel summary statistic based on correlation mining and hub discovery for performing nonparametric quickest change detection (QCD) on a sequence of large scale random matrices. The proposed QCD algorithm 10 probability for a one-sided test to stop in finite time under null hypothesis, obtained by applying Theorem 1.1 in [25] (also see Theorem 3.1 in [25]). We will now use (30) to obtain an upper bound on Pg (N < ∞). Towards that end, we revisit Section 3 of [11] and modify the proof there appropriately to suit out needs. Note that log fθ (y) = (θ − θ0 )T (y) − b(θ) + b(θ0 ). fθ0 (y) Thus, with Fig. 5. Delay-false alarm trade-off curves for a misspecification scenario: GLR designed for J = 1 to J = 2.5, the same values that were used in Fig. 3. The actual pre-change parameter J0 = 1.31 because Σ0 is block sparse with block size 5. The post-change parameter is 3.149. The uncertainty family for the parameter J0 is G = {g = fJ0 : |J0 − 1| ≤ 0.4}. From the top, the first curve is the trade-off when the pre-change parameter is not know, so that the threshold A has to be selected using Theorem 4.2-(2). The second curve is the trade-off curve obtained using the knowledge of the pre-change parameter. The post-change parameter is always unknown. The third curve is the actual performance of the rule τG when J0 = 1.31. The fourth curve, and the first from the bottom, is the performance of τG when J0 = 1. is strongly optimal in the sense of Lorden [11] and Pollak [16] among all detection algorithms that use the proposed summary statistic. Future work will include extensions to local summary statistics and experiments with QCD in real applications that yield sequences of large scale random matrix measurements. A PPENDIX Proof of Theorem 4.2: As shown in [11], the key to analysis of τG is the following one-sided GLR test ( ) m X fθ (Yi ) log N = inf m ≥ 1 : sup > A . (26) fθ0 (Yi ) θ:|θ−θ0 |≥ i=1 Specifically, for any density g, 1 , (27) α where Pg is the probability measure under which all the observations {Ym } have density g, and Eg is the corresponding expectation. We thus focus on obtaining a bound on Pg (N < ∞). In reference to this we define the one-sided test between θ vs θ0 as ( ) m X fθ (Yi ) > A . (28) ν(fθ , fθ0 ) = inf m ≥ 1 : log fθ0 (Yi ) i=1 Pg (N < ∞) ≤ α =⇒ Eg [τG ] ≥ From Theorem 3.4 in [25] we know that if there exists a positive constant κθ,g > 0 such that (see (18)) κθ,g Z  fθ (y) g(y)dµ(y) = 1, (29) fθ0 (y) then Pg (ν(fθ , fθ0 ) < ∞) ≤ e−κθ,g A . (30) The basic idea behind (30) is  that if (29) κθ,gis true, then we can fθ (y) define a density gκθ,g (y) = fθ (y) g(y), and the test 0 ν(fθ , fθ0 ) is equivalent to ν(gκθ,g , g) with threshold κθ,g A. The estimate (30) is then just the classical estimate of the Sm := m X T (Yi ), i=1 we have m X sup log θ:|θ−θ0 |≥ i=1 = fθ (Yi ) fθ0 (Yi ) sup (θ − θ0 )Sm − m(b(θ) − b(θ0 )). θ:|θ−θ0 |≥ Now, ( ) (θ − θ0 )Sm − m(b(θ) − b(θ0 )) > A sup θ:|θ−θ0 |≥   A + m(b(θ) − b(θ0 )) = Sm > inf θ:θ≥θ0 + θ − θ0   A + m(b(θ) − b(θ0 )) ∪ Sm < sup . θ − θ0 θ:θ≤θ0 − (31) This is because if the left hand side is true, then there is θ1 such that {(θ1 −θ0 )Sm −m(b(θ1 )−b(θ0 )) > A}, and θ1 could be either greater or less than θ0 , making θ1 − θ0 positive or negative. Thus, left hand side is a subset of the right hand side. An identical argument given in reverse justifies that the right hand side is a subset of the left. By Assumption 1 there exists a positive constant κθ,g satisfying (18) for every θ ∈ Θ with |θ −θ0 | ≥ . Furthermore, there exists κg such that 0 < κg ≤ inf θ∈Θ:|θ−θ0 |≥ (κθ,g ). (32) With this assumption we have an upper bound on the estimate in (30): ∀θ ∈ Θ, |θ − θ0 | ≥ , Pg (ν(fθ , fθ0 ) < ∞) ≤ e−κθ,g A ≤ e−κg A . (33) Now consider the infimum on the right hand side of (31). Let the infimum be approached along the sequence {θ` }. Then,   A + m(b(θ) − b(θ0 )) Pg Sm > inf θ:θ≥θ0 + θ − θ0   A + m(b(θ` ) − b(θ0 )) = lim Pg Sm > `→∞ θ` − θ0 (34) ≤ lim sup Pg (ν(fθ` , fθ0 ) ≤ m) `→∞ ≤ lim sup Pg (ν(fθ` , fθ0 ) < ∞) `→∞ ≤ e−κg A , 11 where the last inequality follows from (33). An almost identical argument yields the same bound on the probability of the other event involving a supremum in (31). Thus, Pg (N = m) ( ) ≤ Pg sup (θ − θ0 )Sm − m(b(θ) − b(θ0 )) > A We have the estimate   A Pg <N <∞ min{I(θ0 + ), I(θ0 − )} = Pg (∪m∈M {N = m}) ( ( )) [ ≤Pg sup (θ − θ0 )Sm − m(b(θ) − b(θ0 )) > A θ:|θ−θ0 |≥ ≤ 2e −κg A . ≤Pg (35) (m∈M  [ A < min{I(θ0 + ), I(θ0 − )}, m (36) then the infimum and supremum on the right hand side of (31) are achieved at the boundaries θ0 + , and θ0 − , respectively. To see this, we differentiate to show that the term inside the infimum is equal to Sm m∈M A + m(b(θ) − b(θ0 )) > inf θ:θ≥θ0 + θ − θ0 ) ) A + m(b(θ) − b(θ0 )) + Pg Sm < sup θ − θ0 θ:θ≤θ0 − m∈M (  ) [ A + m(b(θ0 + ) − b(θ0 )) =Pg Sm > θ0 +  − θ0 m∈M ( )  [ A + m(b(θ0 − ) − b(θ0 )) + Pg Sm < θ0 −  − θ0 m∈M ( ) [ ≤Pg {ν(fθ0 + , fθ0 ) ≤ m} ( By Assumption 3, I(θ), the Kullback-Leibler divergence between fθ and fθ0 , increases with |θ − θ0 |. Because of this assumption, if θ:|θ−θ0 |≥ [  m∈M ( ) [ + Pg {ν(fθ0 − , fθ0 ) ≤ m} m∈M d A + m(b(θ) − b(θ0 )) dθ θ − θ0 m[(θ − θ0 )b0 (θ) − (b(θ) − b(θ0 ))] − A = (θ − θ0 )2 mI(θ) − A . = (θ − θ0 )2 ≤Pg (ν(fθ0 + , fθ0 ) < ∞) + Pg (ν(fθ0 − , fθ0 ) < ∞) ≤2e−κg A . (39) (37) Thus, similar to the estimate in [11], we have the estimate Pg (N < ∞) b min{I(θ Thus, setting the derivative to zero shows that the local interior minima θ∗ must satisfy A c 0 +),I(θ0 −)} X = Pg (N = m) m=1  (40) A <N <∞ min{I(θ0 + ), I(θ0 − )}   A −κg A ≤ 2e +1 . min{I(θ0 + ), I(θ0 − )}  I(θ∗ ) = A/m. (38) Since, Θ is assumed to be an interval and the term inside the infimum is continuous, it must achieve its minimum on [θ0 + , θM ], where θM is the rightmost point of Θ. The condition (36) guarantees that the minimum cannot be achieved on (θ0 + , θM ). Furthermore, it cannot be achieved at θM since otherwise we would have the contradiction A A < I(θ0 + ) ≤ I(θM ) ≤ , m m where the last inequality follows from the standard necessary condition on optimization over convex sets; see Proposition 2.1.2 in [26]. Almost identical arguments allows us to prove that the supremum on the right hand side of (31) is achieved at θ0 −  if (36) is true. Define  M= m:m> A min{I(θ0 + ), I(θ0 − )}  . + Pg From (27) Eg [τG ] ≥ 1 2e−κg A  A min{I(θ0 +),I(θ0 −)} +1 . (41) This proves the first part of the theorem. The second part is now obvious. Proof of Theorem 4.3: Let θg be as in Assumption 4. Then note that ( ) m X fθ (Yi ) τG = inf m ≥ 1 : max sup log >A 1≤k≤m θ:|θ−θ0 |≥ fθ0 (Yi ) i=k ( ) m X fθg (Yi ) ≤ inf m ≥ 1 : log >A . fθ0 (Yi ) i=1 (42) Assumption 4 implies that the drift of the random walk with fθ (Yi ) increments log fθg (Yi ) is positive when samples are drawn 0 12 from g. The theorem now follows from Proposition 8.21 in [27]: as A → ∞ A   (1 + o(1)). Eg [τG ] ≤ (43) fθ (Y1 ) Eg log fθg (Y1 ) 0 Proof of Lemma 1: For the Gaussian case the integral κθ,g Z  fθ (y) fθ̃0 (y) dy = 1. fθ0 (y) can be explicitly solved for κθ,g giving two solutions: κθ,g = 0 and that given by (21). The latter is positive only if |θ̃0 −θ0 | < /2. This proves the first part of the theorem. The second part is true because κθ,g is monotonic in θ, and its value is smallest when θ is either equal to θ0 +  or θ0 − . This value has the explicit expression given by the right most expression in (22). The third part of the theorem is true because the expression for κg given in (22) is monotonic in |θ̃0 − θ0 |. R EFERENCES [1] A. Hero and B. Rajaratnam, “Foundational principles for large scale inference: Illustrations through correlation mining,” IEEE Proceedings, 2015. In press. http://arxiv.org/abs/1505.02475. [2] V. V. Veeravalli and T. Banerjee, Quickest Change Detection. Academic Press Library in Signal Processing: Volume 3 – Array and Statistical Signal Processing, 2014. http://arxiv.org/abs/1210.5552. [3] H. V. Poor and O. Hadjiliadis, Quickest detection. Cambridge University Press, 2009. [4] A. G. Tartakovsky, I. V. Nikiforov, and M. Basseville, Sequential Analysis: Hypothesis Testing and Change-Point Detection. Statistics, CRC Press, 2014. [5] A. Wald, Sequential analysis. Dover Publication, 2013. [6] A. Wald and J. Wolfowitz, “Optimum character of the sequential probability ratio test,” Ann. Math. Statist., vol. 19, no. 3, pp. pp. 326– 339, 1948. [7] M. A. Girshick and H. Rubin, “A Bayes approach to a quality control model,” Ann. Math. Statist., pp. 114–125, 1952. [8] A. N. Shiryaev, “On optimum methods in quickest detection problems,” Theory of Prob and App., vol. 8, pp. 22–46, 1963. [9] A. G. Tartakovsky and V. V. Veeravalli, “General asymptotic Bayesian theory of quickest change detection,” SIAM Theory of Prob. and App., vol. 49, pp. 458–497, Sept. 2005. [10] E. S. Page, “Continuous inspection schemes,” Biometrika, vol. 41, pp. 100–115, June 1954. [11] G. Lorden, “Procedures for reacting to a change in distribution,” Ann. Math. Statist., vol. 42, pp. 1897–1908, Dec. 1971. [12] G. V. Moustakides, “Optimal stopping times for detecting changes in distributions,” Ann. Statist., vol. 14, pp. 1379–1387, Dec. 1986. [13] Y. Ritov, “Decision theoretic optimality of the CUSUM procedure,” Ann. Statist., vol. 18, pp. 1464–1469, Nov. 1990. [14] T. L. Lai, “Information bounds and quick detection of parameter changes in stochastic systems,” IEEE Trans. Inf. Theory, vol. 44, pp. 2917 –2929, Nov. 1998. [15] G. Lorden and M. Pollak, “Nonanticipating estimation applied to sequential analysis and changepoint detection,” Ann. Statist., pp. 1422–1454, 2005. [16] M. Pollak, “Optimal detection of a change in distribution,” Ann. Statist., vol. 13, pp. 206–227, Mar. 1985. [17] T. L. Lai, “Sequential changepoint detection in quality control and dynamical systems,” J. Roy. Statist. Soc. Suppl., vol. 57, no. 4, pp. pp. 613–658, 1995. [18] T. W. Anderson, An Introduction to Multivariate Statistical Analysis. New York, NY: Wiley, 2003. [19] T. W. Anderson, “Non-normal multivariate distributions: inference based on elliptically contoured distributions,” tech. rep., July 1992. [20] S. W. Roberts, “A comparison of some control chart procedures,” Technometrics, vol. 8, pp. 411–430, Aug. 1966. [21] A. G. Tartakovsky, M. Pollak, and A. S. Polunchenko, “Third-order asymptotic optimality of the generalized Shiryaev-Roberts changepoint detection procedures,” Theory of Prob and App., vol. 56, no. 3, pp. 457– 484, 2012. [22] D. Siegmund and E. S. Venkatraman, “Using the generalized likelihood ratio statistic for sequential detection of a change-point,” Ann. Statist., vol. 23, pp. 255–271, Feb. 1995. [23] A. Hero and B. Rajaratnam, “Hub discovery in partial correlation graphs,” IEEE Trans. Inf. Theory, vol. 58, no. 9, pp. 6064–6078, 2012. [24] A. Hero and B. Rajaratnam, “Large-scale correlation screening,” J. Amer. Statist. Assoc., vol. 106, no. 496, pp. 1540–1552, 2011. [25] M. Woodroofe, Nonlinear Renewal Theory in Sequential Analysis. CBMS-NSF regional conference series in applied mathematics, SIAM, 1982. [26] D. P. Bertsekas, Nonlinear programming. Belmont, MA: Athena Scientific, 2004. [27] D. Siegmund, Sequential Analysis: Tests and Confidence Intervals. Springer series in statistics, Springer-Verlag, 1985.
10math.ST
arXiv:1602.07028v2 [math.RT] 5 Aug 2016 QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS CLINTON BOYS AND ANDREW MATHAS Abstract. The main result of this paper shows that, over large enough fields of characteristic different from 2, the alternating Hecke algebras are Z-graded algebras that are isomorphic to fixed-point subalgebras of the quiver Hecke algebra of the symmetric group Sn . As a special case, this shows that the group algebra of the alternating group, over large enough fields of characteristic different from 2, is a Z-graded algebra. We give a homogeneous presentation for these algebras, compute their graded dimension and show that the blocks of the quiver Hecke algebras of the alternating group are graded symmetric algebras. Introduction In a landmark paper, Brundan and Kleshchev [2] constructed an explicit Zgrading on the cyclotomic Hecke algebras of type A. These algebras include, as special cases, the group algebras of the symmetric group and the Iwahori-Hecke algebras of type A. This paper extends these results to the group algebras of the alternating groups and, more generally, to Mitsuhashi’s alternating Hecke algebras [20]. Let Hξ (Sn ) be the Iwahori-Hecke algebra of the symmetric group with parameter ξ ∈ F × , where F is a field. Then Hξ (Sn ) is a deformation of the group algebra of Sn . The algebra Hξ (Sn ) has an automorphism # that can be considered as a ξ-deformation of the sign automorphism of F Sn . The alternating Hecke algebra Hξ (An ) = Hξ (Sn )# is the fixed-point subalgebra of Hξ (Sn ) under #. Brundan and Kleshchev showed that Hξ (Sn ) is a Z-graded algebra by construct≃ ing an explicit family of isomorphisms θ : Re (Sn ) −→ Hξ (Sn ), where Re (Sn ) is a quiver Hecke algebra of Sn [2, 5, 14, 22]. Here, e is quantum characteristic of ξ, so e > 0 is minimal such that 1 + ξ + · · · + ξ e−1 = 0. As observed in [15, (3.14)], the algebra Re (Sn ) has a homogeneous automorphism sgn that is a graded analogue of the sign automorphism of the symmetric group. Let Re (An ) = Re (Sn )sgn be the fixed-point subalgebra of Re (Sn ) under sgn. Then Re (An ) is a homogeneous subalgebra of Re (Sn ). It is natural to ≃ hope that θ restricts to an isomorphism Re (An ) −→ Hξ (An ). Unfortunately, the isomorphisms constructed by Brundan and Kleshchev do not restrict to isomorphisms between the alternating subalgebras; see Example 2.20. Let F be a field and ξ ∈ F an element of quantum characteristic pdefinition, √ e. By the field F is large enough for ξ if F contains square roots ξ and 1 + ξ + ξ 2 whenever e > 3. 2000 Mathematics Subject Classification. 20C08, 20D06, 20C30. Key words and phrases. Alternating groups, alternating Hecke algebras, Khovanov-LaudaRouquier algebras, representation theory. 1 2 CLINTON BOYS AND ANDREW MATHAS Theorem A. Suppose that ξ ∈ F is an element of quantum characteristic e 6= 2, where F is a large enough field for ξ of characteristic different from 2. Then Hξ (An ) ∼ = Re (An ). ≃ To prove this result we construct a new isomorphism Re (Sn ) −→ Hξ (Sn ) that intertwines the involutions, sgn and #, on the two algebras. We do this using the framework developed by Hu and the second-named author [9], which shows that the KLR grading can be described explicitly in terms of seminormal forms. As the algebra Re (An ) is a graded subalgebra of Re (Sn ) we immediately obtain the following. Corollary A1. Suppose that ξ ∈ F is an element of quantum characteristic e 6= 2, where F is a large enough field for ξ of characteristic different from 2. Then Hξ (An ) is a Z-graded algebra. In particular, over large enough fields of characteristic different from 2 the group algebra F An of the alternating group is Z-graded, for n ≥ 1. The alternating group corresponds to the case when ξ = 1, so if F is a field of characteristic p 6= 2 then F An ∼ = Rp (An ) if 3 has a square root in F whenever p > 3. Applying Theorem A twice shows that, up to isomorphism, Hξ (An ) depends only on e, the quantum characteristic of ξ, rather than on ξ itself. Hence, the following holds: Corollary A2. Let F be a field of characteristic different from 2. Suppose that ξ, ξ ′ ∈ F are elements of quantum characteristic e 6= 2, where F is a large enough field for ξ and for ξ ′ . Then Hξ (An ) ∼ = Hξ′ (An ). In particular, over a large enough field, the decomposition matrix of Hξ (An ) depends only on e, and the field F , and not on the choice of ξ. The quiver Hecke algebra Re (Sn ) has a homogeneous presentation by generators and relations that is described in terms of the quiver Γe with vertex set I = Z/eZ to Γe a set of simple and edges i → i + 1, for i ∈ I. In Section 1.3 we associate L + Nα let roots {αi | i ∈ I} and a positive root lattice Q+ = i . If α ∈ Q i∈I α n I = {i ∈ I | α = αi1 + · · · + αin }. Let ∼ be the equivalence relation on I n generated by i ∼ j if j = −i. This relation induces an equivalence relation on Q+ ε where α S ∼ β if there exists i ∈ I α such that −i ∈ I β . Let Qεn = Q+ n /∼. If γ ∈ Qn α γ let I = α∈γ I . Using the KLR presentation of Re (Sn ), and the realisation of Re (An ) as a fixed-point subalgebra of Re (Sn ), gives the following homogeneous presentation for Re (An ) with respect to the Z-grading. For i, j ∈ I n set δi∼j = 1 if i ∼ j and set δi∼j = 0 otherwise. Theorem B. Suppose that e 6= 2 and that 2 is invertible in Z. Then M Re (An ) = Re (An )γ γ∈Qεn where Re (An )γ is the unital associative Z-algebra generated by elements {Ψr (i), Ys (i), ε(i) | 1 ≤ r ≤ n, 1 ≤ s < n and i ∈ I γ } QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS subject to the relations Y1 (i)(Λ0 ,αi1 ) = 0, Yr (−i) = −Yr (i) P ε(i)ε(j) = δi∼j ε(i), Ψr (−i) = −Ψr (i) 3 1 i∈I γ 2 ε(i) = 1, ε(−i) = ε(i) ε(i)Yr (j)ε(k) = δij δjk Yr (j), ε(i)Ψr (j)ε(k) = δsr ·i,j δjk Ψr (j), Yr (i)Ys (j) = δij Ys (i)Yr (j),  Ψr (i)Yr+1 (i) = Yr (sr · i)Ψr (i) + δir ir+1 ε(i) ,  Yr+1 (sr · i)Ψr (i) = Ψr (i)Yr (i) + δir ir+1 ε(i) , Ψr (i)Ys (i) = Ys (sr · i)Ψr (i), if s 6= r, r + 1, Ψr (st · i)Ψt (i) = Ψt (sr · i)Ψr (i), if |r − s| > 1,  Yr (i) − Yr+1 (i), if ir → ir+1 ,     Yr+1 (i) − Yr (i), if ir ← ir+1 , Ψr (sr · i)Ψr (i) =  0, if ir = ir+1 ,    ε(i), otherwise and Ψr (sr+1 sr · i)Ψr+1 (sr · i)Ψr (i) − Ψr+1 (sr sr+1 · i)Ψr (sr+1 · i)Ψr+1 (i) is equal to   if ir = ir+2 ← ir+1 , ε(i), −ε(i), if ir = ir+2 → ir+1 ,   0, otherwise, for all i, j, k ∈ I γ and all admissible r, s and t. P The fraction 12 appears in the relation i∈I γ 12 ε(i) = 1 because ε(i) = ε(−i). (It follows from the relations in Theorem B that ε(i) = 0 if i = −i, for i ∈ I n .) The relations in Theorem B are homogeneous with respect to the degree function deg ε(i) = 0, deg Yr (i) = 2 and deg Ψr (i) = −(αir , αir+1 ), where ( , ) is the Cartan pairing. Hence, Re (An ) is a Z-graded algebra. Quite surprisingly, this presentation is almost identical to the KLR-presentation of Re (Sn ). The main difference being the three “sign relations” relating the generators indexed by i and −i, for i ∈ I γ . The key idea behind the proof Theorem B is to introduce a (Z2 × Z)-grading on the KLR algebra Re (Sn ). With respect to the (Z2 × Z)grading, the algebra Re (An ) is the even part of Re (Sn ). Using this observation we can deduce the relations for Re (An ) directly from those for Re (Sn ). Finally, using the graded cellular bases of Hu and Mathas [7] we construct a homogeneous basis for the Z-graded algebra Re (An ). As a corollary we obtain the graded dimension of Re (An ). See Chapter 3 below for the unexplained notation. Theorem C. Suppose that e 6= 2 and that 2 is invertible in F . Then the alternating quiver Hecke algebra Re (An ) has graded dimension X q deg s+deg t . (s,t)∈Std2 (Pn ) n res(s)∈I+ In fact, using the work of Li [16] it follows that over any ring in which 2 is invertible the algebra Re (An ) is free with the same graded rank. As a second application of our basis theorem we show that the blocks of Re (An ) are graded symmetric algebras. 4 CLINTON BOYS AND ANDREW MATHAS The results in this paper exclude the cases when F is a field of characteristic 2 and when e = 2 or, equivalently, ξ = −1. This is because most our arguments fail, and most of our results are false, when we drop these assumptions. The paper is organised as follows. Chapter 1 starts by defining the quiver Hecke algebra Re (An ) of the alternating group as the fixed-point subalgebra of Re (Sn ) under the homogeneous sign involution sgn. We then prove Theorem B by first introducing a (Z2 × Z)-grading on Re (Sn ) and showing that Re (An ) is the even part of Re (Sn ), with respect to the Z2 -grading. Chapter 2 starts by setting up the framework of seminormal coefficient systems and showing how seminormal bases behave under the ungraded sign involution #. Building on ideas from [9], we give a new presentation of HtO , over a specially chosen ring O, that we use to construct ≃ a new isomorphism Θ : Re (Sn ) −→ Hξ (Sn ) over the residue field of O. Unlike the known isomorphisms in the literature, Θ intertwines the two sign involutions, sgn and #, implying Theorem A. In Chapter 3 we give a homogeneous basis of Re (An ) and hence prove Theorem C. As an application we show that the blocks of Re (An ) are graded symmetric algebras. Finally, using Clifford theory, the classification of the blocks and irreducible graded modules of Re (An ) is given. Acknowledgments. We thank the referee for their careful reading of our manuscript. The first-named author was supported by an Australian Postgraduate Award and the second-named author by the Australian Research Council. Some of the work in the first-named author’s PhD thesis [1] was based on an earlier version of this paper. 1. Iwahori-Hecke algebras and quiver Hecke algebras This chapter defines both the alternating Hecke algebras and the alternating quiver Hecke algebras of type A. Both algebras are defined as fixed point subalgebras of the corresponding Hecke algebras. In the final section we prove that Theorem B gives a homogeneous presentation for the alternating quiver Hecke algebra. 1.1. Iwahori-Hecke algebras and alternating Hecke algebras. We start by defining the Iwahori-Hecke algebras of the symmetric groups. These algebras are well-studied deformations of the group algebras of the symmetric groups that arise naturally in the representation theory of the general linear groups. Fix a (unital) integral domain Z and an invertible element ξ ∈ Z × . 1.1. Definition. The Iwahori-Hecke algebra Hξ (Sn ) = HξZ (Sn ) is the (unital) associative Z-algebra with generators T1 , . . . , Tn−1 subject to relations (Tr − ξ)(Tr + 1) = 0, Tr Ts = Ts Tr , Tr Tr+1 Tr = Tr+1 Tr Tr+1 , for r = 1, . . . , n − 1, if |r − s| > 1, for r = 1, . . . , n − 2. For 1 ≤ r < n let sr = (r, r + 1) ∈ Sn . Then {s1 , . . . , sn−1 } is the standard set of Coxeter generators for Sn . If w ∈ Sn then the length of w is the integer ℓ(w) = min{l ≥ 0 | w = sr1 . . . srl with 1 ≤ rj < n}. A reduced expression for w is any word w = sr1 . . . srℓ with ℓ = ℓ(w) and 1 ≤ rj < n, for 1 ≤ j ≤ ℓ. If w ∈ Sn define Tw = Tr1 . . . Trℓ , where w = sr1 . . . srℓ is any reduced expression. As is well-known, because the braid relations hold in Hξ (Sn ) the element Tw QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS 5 depends only on w and not on the choice of reduced expression. Moreover, the algebra Hξ (Sn ) is free as a Z-module with basis {Tw | w ∈ Sn }. See, for example, [17, Chapter 1]. In particular, if ξ = 1 then Hξ (Sn ) ∼ = ZSn via the map Tw 7→ w, for w ∈ Sn . Following Goldman [10, Theorem 5.4], let # : Hξ (Sn ) −→ Hξ (Sn ) be the unique Z-linear automorphism of Hξ (Sn ) such that (1.2) Tr# = −ξTr−1 = −Tr + (ξ − 1), for 1 ≤ r < n. It follows directly from the definitions that when ξ = 1 the automorphism # of H1Z (Sn ) ∼ = ZSn is the usual “sign involution” which sends each simple transposition sr to −sr , for 1 ≤ r < n [11, p5]. Since the group algebra of the alternating group is the fixed-point subalgebra of the sign automorphism, the following definition gives a ξ-analogue of the group ring ZAn of the alternating group An . 1.3. Definition (Mitsuhashi [20]). Suppose that ξ 6= −1. Then the alternating Hecke algebra is the fixed-point subalgebra Hξ (An ) = HξZ (An ) = {h ∈ Hξ (Sn ) | h# = h} of Hξ (Sn ) under the hash involution. 1.4. Remark. Mitsuhashi’s [20, Definition 4.1] original definition of the alternating Hecke algebra was by generators and relations, giving a deformation of a well-known presentation of the alternating group. Definition 1.3 is equivalent to Mitsuhashi’s definition by [19, Proposition 1.5]. 1.2. Graded modules and algebras. The main result of this paper shows that the alternating Hecke algebra is a graded algebra, so we quickly review this terminology. For the most part we will work with Z-graded modules and algebras, however, to prove Theorem B we consider more general gradings. Recall that Z is a unital integral domain. In this paper all modules will be assumed to be free and of finite rank as Z-modules. Let (G, +) be an abelian group. A G-graded L Z-module is a Z-module M that admits a vector space decomposition M = g∈G Mg . If g ∈ G and 0 6= m ∈ Mg then m is homogeneousL of degree g. Similarly, a G-graded Z-algebra is a G-graded Z-module A = g∈G Ag that is a Z-algebra such that Af Ag ⊆ Af +g , for all f, g ∈ G. A G-graded A-module is a G-graded Z-module M such that Mf Ag ⊂ Mf +g , for f, g ∈ G. Unless otherwise specified, G = Z and a graded module will mean a Z-graded module. Similarly, a graded algebra is a Z-graded algebra. 1.3. Cyclotomic quiver Hecke algebras of type A. We now define the second class of algebras that we are interested in: the cyclotomic quiver Hecke algebras of Sn . These algebras are certain quotients of the Z-graded quiver Hecke algebras introduced, independently, by Khovanov and Lauda [14] and Rouquier [22]. Fix e ∈ {3, 4, 5, . . .}∪{∞} and define Γe to be the quiver with vertex set I = Z/eZ and edges i → i + 1, for i ∈ I. (By convention, I = Z if e = ∞.) Thus, Γe is the (1) infinite quiver of type A∞ if e = ∞ and the finite quiver of Dynkin type Ae−1 if e ≥ 3. We exclude e = 2 only because this corresponds to the case ξ = −1 in Definition 1.3, which we do not consider in this paper. 6 CLINTON BOYS AND ANDREW MATHAS Following Kac [13], to the quiver Γe we attach the usual Lie theoretic data of the positive roots {αL ∈ I}, the positive i | i ∈ I}, the fundamental weights {Λi | iL weight lattice P + = i∈I NΛi , the positive root lattice Q+ = i∈I Nαi , the nondegenerate pairing ( , ) : P + × Q+ −→ Z given by (Λi , αj ) = δij , for i, j ∈ I, and the Cartan matrix C = (cij )i,j∈I where   if i = j, 2, cij = −1, if i ← j or i → j,   0, otherwise. P + The height of α ∈ Q is the non-negative integer ht α = i (Λi , α). Fix n ≥ 0 and + + let Q+ n = {α ∈ Q | ht α = n}. For α ∈ Qn , let I α = {i = (i1 , . . . , in ) ∈ I n | α = αi1 + · · · + αin }. 1.5. Definition (Khovanov and Lauda [14] and Rouquier [22]). Suppose that α ∈ Q+ and e ∈ {3, 4, 5, . . .}∪{∞}. The cyclotomic quiver Hecke algebra Re (Sn )α is the unital associative Z-algebra with generators {ψ1 , . . . , ψn−1 } ∪ {y1 , . . . , yn } ∪ {e(i) | i ∈ I α } and relations (Λ ,α ) y1 0 i1 e(i) = 0, yr e(i) = e(i)yr , e(i)e(j) = δij e(i), ψr e(i) = e(sr · i)ψr , P i∈I α e(i) = 1, yr ys = ys yr , yr+1 ψr e(i) = (ψr yr + δir ir+1 )e(i), ψr yr+1 e(i) = (yr ψr + δir ir+1 )e(i), if s 6= r, r + 1, ψr ys = ys ψr , ψr ψs = ψs ψr , if |r − s| > 1,  0, if ir = ir+1 ,    (y − y )e(i), if i → i , r r+1 r r+1 ψr2 e(i) =  (y − y )e(i), if i ← i r+1 r r r+1 ,    e(i), otherwise,   (ψr+1 ψr ψr+1 − 1)e(i), if ir = ir+2 → ir+1 , ψr ψr+1 ψr e(i) = (ψr+1 ψr ψr+1 + 1)e(i), if ir = ir+2 ← ir+1 ,   ψr+1 ψr ψr+1 e(i), otherwise, α for i, j ∈ I and all admissible r and s. If n ≥ 0 then the quiver Hecke algebra of Sn is the algebra M Re (Sn ) = Re (Sn )α . α∈Q+ n Note that the algebra Re (Sn )α depends on e, Γe , Λ0 and α ∈ Q+ . We write Re (Sn ) = ReZ (Sn ) when we want to emphasise that Re (Sn ) is a Z-algebra. The main advantage of the relations in Definition 1.5 is that they are homogeneous with respect to the following Z-valued degree function: deg e(i) = 0, (1.6) deg yr = 2, deg ψr e(i) = −cir ,ir+1 , Therefore, Re (Sn ) is a Z-graded algebra. for all i ∈ I n , for 1 ≤ r ≤ n, for 1 ≤ r < n and i ∈ I n . QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS 7 1.7. Remark. There are fewer relations appearing in Definition 1.5 than in [2, Theorem 1.1]. This is because we are assuming that e 6= 2 (and Λ = Λ0 ). We have also made a sign change compared with [2], which is consistent with [9]. In examples, we write e(i) = e(i1 i2 . . . in ) if i = (i1 , i2 , . . . , in ). 1.8. Example. Let n = 3, e = 3 and Λ = Λ0 . First, y1 = 0 because of the relations P (Λ0 ,αi1 ) e(i) = 0 and i e(i) = 0. It is not difficult to see that ψ1 = 0 = y2 and that y1 e(i) = 0 unless i = (012) or (021); see, for example [18, Proposition 2.4.6]. Hence, Re (S3 ) is generated by ψ2 , y3 , e(012) and e(021). Using the quadratic relation, ( −y3 e(i), if i = (012), 2 ψ2 e(i) = y3 e(i), if i = (021). In turn, this implies that y32 e(i) = ±y3 ψ2 e(i) = ±ψ2 y2 e(i) = 0, so y32 = 0. Therefore, Re (S3 ) is spanned by {e(012), e(021), ψ2e(012), ψ2 e(021), y3 e(012), y3 e(021)}. By Theorem 1.9 below, these elements are a basis of Re (Sn ). ♦ To connect the algebras Re (Sn ) and Hξ (Sn ) define the quantum characteristic of ξ to be the smallest non-negative integer e such that 1 + ξ + · · · + ξ e−1 = 0, and set e = ∞ if no such integer exists. By definition, e ∈ {2, 3, 4, 5, 6, . . .} ∪ {∞} and e = 2 if and only if ξ = −1. Brundan and Kleshchev proved the following remarkable theorem, which connects the two algebras Re (Sn ) and Hξ (Sn ). 1.9. Theorem (Brundan and Kleshchev [2], Rouquier [22, Corollary 3.20]). Suppose that F is a field and that ξ 6= −1 has quantum characteristic e > 2. Then ReF (Sn ) ∼ = HξF (Sn ). Hence, if F is a field then we can consider HξF (Sn ) as a Z-graded algebra via the isomorphism HξF (Sn ) ∼ = ReF (Sn ). We have stated a special case of Brundan and Kleshchev’s result because this is all that we need. Over a field, Brundan and Kleshchev prove more generally that the cyclotomic Hecke algebras of type A are isomorphic to cyclotomic quiver Hecke algebras — and they also allow e = 2. To prove Theorem 1.9 Brundan and Kleshchev construct an explicit isomorphism (in fact, they construct different isomorphisms for the cases when ξ = 1 and ξ 6= 1). Our proof of Theorem B builds from a variation on their ideas, following [9]. 1.4. Alternating quiver Hecke algebras of type A. In this section we introduce a homogeneous analogue of the #-involution of Hξ (Sn ) and use it to define the alternating quiver Hecke algebras of type A. If i = (i1 , . . . , in ) ∈ I n let −i = (−i1 , . . . , −in ) ∈ I n . Following [15, (3.14)], define sgn to be the unique automorphism of Re (Sn ) such that ψrsgn = −ψr , yssgn = −ys , and e(i)sgn = e(−i), for 1 ≤ r < n, 1 ≤ s ≤ n and i ∈ I n . ′ + ′ If α ∈ Q+ n let α be the unique element of Qn such that (Λi , α) = (Λ−i , α ), for all i ∈ I. Recall from the introduction that ∼ is the equivalence relation on I n generated by i ∼ j if j = −i and that if α, β ∈ Q+ then α ∼ β if there exists i ∈ I α such that −i ∈ I β . Hence, α ∼ β if and only if β ∈ {α, α′ }. Checking the relations in Definition 1.5 reveals the following. 8 CLINTON BOYS AND ANDREW MATHAS 1.10. Proposition ([15, (3.14)]). The map sgn restricts to a homogeneous isomor≃ phism of Z-graded algebras Re (Sn )α −→ Re (Sn )α′ , for α ∈ Q+ n . Hence, sgn is a homogeneous automorphism of Re (Sn ) of order 2. Mirroring Definition 1.3, we define the second algebra appearing in Theorem A. 1.11. Definition. The alternating quiver Hecke algebra of An is the fixedpoint subalgebra Re (An ) = ReZ (An ) = {a ∈ Re (Sn ) | asgn = a} of Re (Sn ) under the involution sgn. Since sgn is a homogeneous involution of Re (Sn ), an immediate and important consequence of Definition 1.11 is the following. 1.12. Corollary. The alternating quiver Hecke algebra Re (An ) is a Z-graded subalgebra of Re (Sn ). We finish this section with an example of how our main result, Theorem A, works when n = 3 = e. 1.13. Example. Suppose that e = 3 and n = 3. Then A3 ∼ = Z/3Z is the cyclic group of order 3. By Example 1.8, R3 (A3 ) is spanned by the three elements 1 = e(012) + e(021), Ψ = ψ2 (e(012) − e(021)), Y = y3 (e(012) − e(021)). These three elements are homogeneous, with deg Ψ = 1 and deg Y = 2, and Theorem 1.9 implies that they are non-zero. Therefore, {1, Ψ, Y } is a basis of R3 (A3 ). Using the relations in Definition 1.5, Ψ2 = −Y and Ψ3 = −Y Ψ = 0. Therefore, the map Ψ 7→ x determines an isomorphism of graded algebras Re (A3 ) = hΨ | Ψ3 = 0i ∼ = Z[x]/(x3 ), where we put deg x = 1. It is now easy to see that R3 (A3 ) ⊗ F3 ∼ = F3 A3 , where F3 = Z/3Z. For example, an isomorphism is determined by Ψ 7→ 1 − s1 s2 . The isomorphism above is not unique. In the special case when n = 3 and ξ = 1 ∈ F3 , the proof of Theorem A in Section 2.5 constructs a different isomorphism ≃ ♦ F3 A 3 ∼ = Hξ (A3 ) −→ Re (A3 ) that is determined by Ψ 7→ s2 s1 − s1 s2 . The algebra Re (Sn ) is defined in terms of the subalgebras Re (Sn )α . To give a presentation for Re (An ) we need to work with the blocks of these algebras. As in the introduction, set Qεn = Q+ n /∼. Using the notation introduced before + Proposition 1.10, if α ∈ Q then {α, α′ } is its ∼-equivalence class. If γ ∈ Qεn n L set Re (Sn )γ = α∈γ Re (Sn )α . By Proposition 1.10, sgn induces a homogeneous automorphism of Re (Sn )γ . Define (1.14) Re (An )γ = (Re (Sn )γ )sgn = {a ∈ Re (Sn )γ | a = asgn } to be the fixed-point subalgebra of Re (Sn )γ under the sgn automorphism. Since L Re (Sn ) = α Re (Sn )α we have the following decomposition of Re (An ) as a direct sum of two-sided Z-graded ideals. M 1.15. Corollary. As a graded algebra, Re (An ) = Re (An )γ . γ∈Qεn QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS 9 1.5. A presentation for alternating quiver Hecke algebras of An . In this section we prove Theorem B. To do this we first give a “super” presentation for the quiver Hecke algebra Re (Sn ). For convenience, we identify the group Z2 = Z/2Z with {0, 1} in the obvious way. We start by defining a new algebra Rnε that, it turns out, is isomorphic to Re (Sn ). The advantage of Rnε is that it is (Z2 × Z)-graded where the Z2 -grading encodes the effects of sgn. Abusing notation, we use similar notation for the generators of Re (Sn ) and Rnε . This is justified by Proposition 1.19 below. The sequence i = (0, . . . , 0) ∈ I n , which is the unique sequence such that i = −i, is potentially problematic for us. The next result resolves this. 1.16. Lemma. Suppose that i ∈ I n and e(i) 6= 0. Then i1 = 0 and i2 = ±1. In particular, e(0, . . . , 0) = 0. Proof. By [7, Lemma 4.1c], e(i) 6= 0 if and only i is the residue sequence of some standard tableau (see Section 2.1), which readily implies the result. As we need this argument later, we give a direct proof following [18, Proposition 2.4.6]. First, (Λ0 ,αi1 ) e(i) = 0. If y1 = 0 and e(i) 6= 0 only if i1 = 0 by the cyclotomic relation y1 i1 = i2 = 0 then e(i) = (y2 ψ1 − ψ1 y1 )e(i) = y2 ψ1 e(i) = y2 e(i)ψ1 , so that e(i) = y22 e(i)ψ12 = 0. Hence, e(0, 0, i3 , . . . , in ) = 0. Finally, suppose that i2 6= ±1, 0. Then e(i) = ψ12 e(i) = ψ1 e(i2 , i1 , i3 . . . , in )ψ1 = 0 since e(j) = 0 whenever j1 6= 0.  n n Set I+ = {i ∈ I n | i1 = 0 and i2 = +1} and I− = {i ∈ I n | i1 = 0 and i2 = −1}. n n Then Lemma 1.16 shows that e(i) 6= S0 onlyα if i ∈ I+ ∪ I− . ε γ I . Recall that if γ ∈ Qn then I = α∈γ 1.17. Definition. Suppose that e 6= 2, 2 is invertible in Z and that γ ∈ Qεn . The algebra Rγε = Rγε (Γe , Λ0 ) is the unital associative Z-algebra with generators {ψr , ys , εa (i) | 1 ≤ r < n, 1 ≤ s ≤ n, i ∈ I γ and a ∈ Z2 } subject to the relations (Λ0 ,αi1 ) y1 ε0 (i) = 0, εa (i)εb (i) = εa+b (i), P 1 i∈I γ 2 ε0 (i) = 1, ε0 (i)ε0 (j) = δi∼j ε0 (i), a εa (i) = (−1) εa (−i), yr εa (i) = εa (i)yr , ψr yr+1 ε1 (i) = (yr ψr + δir ir+1 )ε1 (i), ψr ys ε1 (i) = ys ψr ε1 (i), ψr εa (i) = εa (sr · i)ψr , yr ys ε1 (i) = ys yr ε1 (i), yr+1 ψr ε1 (i) = (ψr yr + δir ir+1 )ε1 (i), if s 6= r, r + 1, ψr ψs ε1 (i) = ψs ψr ε1 (i), if |r − s| > 1,  if ir = ir+1 ,  0,  (y − y )ε (i), if i → i , r r+1 0 r r+1 ψr2 ε1 (i) = (yr+1 − yr )ε0 (i), if ir ← ir+1 ,    ε1 (i), otherwise,   ψr+1 ψr ψr+1 ε0 (i) − ε1 (i), if ir = ir+2 → ir+1 , ψr ψr+1 ψr ε0 (i) = ψr+1 ψr ψr+1 ε0 (i) + ε1 (i), if ir = ir+2 ← ir+1 ,   ψr+1 ψr ψr+1 ε0 (i), otherwise, L γ for i, j ∈ I , a, b ∈ Z2 and all admissible r and s. Let Rnε = γ∈Qε Rγε . n 10 CLINTON BOYS AND ANDREW MATHAS It is routine to check that the relations in Definition 1.17 are homogeneous with respect to the degree function Deg : Rnε −→ Z2 × Z that is determined by Deg ψr ε0 (i) = (1, −cir ,ir+1 ), Deg ys = (1, 2) and Deg εa (i) = (a, 0), for 1 ≤ r < n, 1 ≤ s ≤ n and i ∈ I n . Hence, Rnε is a (Z2 × Z)-graded algebra. By Definition 1.17, if i ∈ I γ then εa (i) = ±εa (−i) so Rnε is generated by the γ γ elements {ψ1 , . . . , ψn−1 } ∪ {y1 , . . . , yn } ∪ {εa (i) | a ∈ Z2 and i ∈ I+ }, where I+ = γ n n I γ ∩ I+ . Similarly, set I− = I γ ∩ I− . We use I γ in Definition 1.17 because it compactly encodes a sign change in the relation ψr εa (i) = εa (sr · i)ψ when r = 2. We need a partial analogue of Lemma 1.16 for Rγε . 1.18. Lemma. Suppose that i ∈ I γ and that i = −i. Then εa (i) = 0, for a ∈ Z2 . Proof. If i = −i then ε1 (i) = −ε1 (i) = 0. Hence, ε0 (i) = ε1 (i)ε1 (i) = 0.  By forgetting the Z2 -grading on Rγε we obtain a Z-graded algebra. Given the similarity of the relations in Definition 1.5 and Definition 1.17 the next result should not surprise the reader. 1.19. Proposition. Suppose that γ ∈ Qεn , n ≥ 0, e 6= 2 and that 2 is invertible in Z. Then, as Z-graded algebras, Rγε ∼ = Re (Sn )γ . Proof. Define a map θ from the generators of Rγε to Re (Sn )γ by  θ(ψr ) = ψr , θ(ys ) = ys , and θ εa (i) = e(i) + (−1)a e(−i), for 1 ≤ r < n, 1 ≤ s ≤ n, a ∈ Z2 and i ∈ I γ . The relations in Definition 1.17 are very similar to those of Definition 1.5, so it is straightforward to check that θ extends to an algebra homomorphism Rγε → Re (Sn )γ . By definition, if i ∈ I γ then  e(i) = 21 θ ε0 (i) + ε1 (i) . Therefore, the image of θ contains all of the generators of Re (Sn )γ . Hence, θ is surjective. Rather than proving directly that θ is an isomorphism we define an inverse map. Define ϑ to be the map from the set of non-zero generators of Re (Sn )γ into Rγε given by   ϑ(ψr ) = ψr , ϑ(ys ) = ys , and ϑ e(i) = 12 ε0 (i) + ε1 (i) , for 1 ≤ r < n, 1 ≤ s ≤ n and i ∈ I γ . If i ∈ I γ and a ∈ Z2 then  1  ϑ e(i) + (−1)a e(−i) = ε0 (i) + ε1 (i) + (−1)a ε0 (−i) + (−1)a ε1 (−i) = εa (i). 2 Hence, by Lemma 1.18, the image of ϑ contains all of the generators of Rγε so, if it is a homomorphism, it is surjective. Now, since εa (i)εb (i) = εa+b (i), for all i ∈ I γ and a, b ∈ Z2 , by multiplying the relations in Definition 1.17 on the right by ε1 (i) the following additional relations hold in Rγε : yr ys ε0 (i) = ys yr ε0 (i), ψr yr+1 ε0 (i) = (yr ψr + δir ir+1 )ε0 (i), ψr ys ε0 (i) = ys ψr ε0 (i), ψr ψs ε0 (i) = ψs ψr ε0 (i), yr+1 ψr ε0 (i) = (ψr yr + δir ir+1 )ε0 (i), if s 6= r, r + 1, if |r − s| > 1, QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS 11  0, if ir = ir+1 ,    (y − y )ε (i), if i → i , r r+1 1 r r+1 ψr2 ε0 (i) =  (y − y )ε (i), if i ← i r+1 r 1 r r+1 ,    ε0 (i), otherwise,   ψr+1 ψr ψr+1 ε1 (i) − ε0 (i), if ir = ir+2 → ir+1 , ψr ψr+1 ψr ε1 (i) = ψr+1 ψr ψr+1 ε1 (i) + ε0 (i), if ir = ir+2 ← ir+1 ,   ψr+1 ψr ψr+1 ε1 (i), otherwise, for all admissible r and s and i ∈ I γ . As it was for θ, it is now straightforward to verify that ϑ respects all of the relations of Re (Sn )γ . Consequently, ϑ extends to an algebra homomorphism Re (Sn )γ → Rγε . In view of Lemma 1.16 and Lemma 1.18, the automorphisms θ ◦ ϑ and ϑ ◦ θ act as the identity on the non-zero generators of Re (Sn )γ and Rγε , respectively. ≃ Therefore, θ and ϑ are mutually inverse isomorphisms and Rγε −→ Re (Sn )γ as (ungraded) algebras. It remains to observe that θ and ϑ respect the Z-gradings on both algebras, but this is immediate from the definitions of θ and ϑ. Hence, Re (Sn )γ ∼ = Rγε as Z-graded algebras, completing the proof.  Define h ∈ Rnε to be even if Deg h = (0, d) and h is odd if Deg h = (1, d), for some d ∈ Z. Let Rγε+ and Rγε− be the sets of even and odd elements in Rγε , respectively. Then Rγε+ is a subalgebra of Rγε and Rγε = Rγε+ ⊕ Rγε− (1.20) as Z-modules. Moreover, as we next show, Rγε+ is isomorphic to Re (An ) under the isomorphism of Proposition 1.19. 1.21. Corollary. Suppose that n ≥ 0 and that 2 is invertible in Z. Let γ ∈ Qεn . Then Rγε+ ∼ = Re (An )γ as Z-graded algebras. Proof. Under the isomorphism Rγε ∼ = Re (Sn )γ of Proposition 1.19, the images of the even generators of Rγε are sgn-invariant and sgn multiplies the images of the ≃ odd generators by −1. Hence, θ restricts to an isomorphism Rγε+ −→ Re (An )γ .  We can now prove Theorem B from the introduction. Proof of Theorem B. Let Aγ be the abstract algebra with the presentation given in Theorem B. By Corollary 1.21, to prove Theorem B it is enough to show that Aγ ∼ = Rγε+ . Define a map Θ : Aγ −→ Rγε+ by Ψr (i) 7→ ψr ε1 (i), Ys (i) 7→ ys ε1 (i) and ε(i) 7→ ε0 (i), for all i ∈ I γ , 1 ≤ r ≤ n and 1 ≤ s < n. Using Definition 1.17, and the relations in the proof of Proposition 1.19, it is straightforward to check that all of the relations in Aγ are satisfied in Rγε+ , so Θ extends to an algebra homomorphism from Aγ to Rγε+ . By Definition 1.17, the algebra Rγε+ is generated by arbitrary products of the generators of Rnε such that the resulting element is even. However, the only even generators of Rnε are the idempotents ε0 (i), for i ∈ I n , so Rγε+ is generated by these idempotents together with all words of even length in the odd generators of Rnε . 12 CLINTON BOYS AND ANDREW MATHAS As ψr ε1 (i) = ε1 (sr · j)ψr and ys ε1 (i) = ε1 (i)ys , for admissible r, s and i ∈ I n , it follows that Rγε+ is generated by the images of Aγ under Θ. Hence, Θ is surjective. The algebra Rγε+ is defined by generators and relations, so Rγε+ is the subalgebra of Rnε generated by the words of even length in the generators of Rnε modulo the even part of the relational ideal that defines Rnε . The only even relations for Rnε are the idempotent relations and the commutation relations (these are the relations appearing in the first three lines of the relations in Definition 1.17). Hence, up to multiplication by an idempotent ε0 (i), all of the even relations are essentially trivial. Therefore, the even component of the relational ideal for Rnε is generated by words of even length in the odd relations for Rnε . In turn, all of the even products of the odd relations are products of the even relations given in the proof of Proposition 1.19, together with the even idempotent and commutation relations. All of these relations are the images under Θ of the relations of Aγ . Hence, Θ is an isomorphism and the result follows.  2. The seminormal form To prove Theorem A we will work mainly in the setting of the semisimple representation theory of Hξ (Sn ). The idea is to show that the fixed-point subalgebras of Hξ (An ) = Hξ (Sn )# and Re (Sn ) = Re (Sn )sgn coincide under the BrundanKleshchev isomorphism of Theorem 1.9. Unfortunately, as shown by Example 2.20, this is not true. To get around this we use the machinery developed in [9] to con≃ struct a new isomorphism Re (Sn ) −→ Hξ (Sn ) that does restrict to an isomor≃ phism Re (An ) −→ Hξ (An ). 2.1. Tableau combinatorics. This section recalls the partition and tableau combinatorics that are needed in this paper. A partition λ = (λ1 , λ2 , . . . ) is a weakly decreasing sequence of non-negative integers. The integers λr are the parts of λ, for r ≥ 1, and λ is a partition of n if |λ| = n, where |λ| = λ1 + λ2 + · · · . Let Pn be the set of partitions of n. The Young diagram of a partition λ is the set {(r, c) | 1 ≤ c ≤ λr for r ≥ 1}, which we represent as a collection of left-justified boxes in the plane, with λr boxes in row r and with rows ordered from top to bottom by increasing row index. We identify a partition with its diagram. The partition λ′ with λ′r = #{c ≥ 1 | λr ≥ c} is the partition conjugate to λ. Suppose that λ ∈ Pn . A λ-tableau is a bijective filling of the boxes of λ with the numbers 1, 2, . . . , n. If t is a λ-tableau then it has shape λ and we write Shape(t) = λ. For m ≥ 1 let t↓m be the subtableau of t that contains the numbers 1, 2, . . . .m. A tableau is standard if its entries increase from left to right along each row and from top to bottom down each column. Hence, t is standard if and only if t↓m is standard for 1 ≤ m ≤ n. Let Std(λ) be the set of standard λ-tableaux and let [ [ Std(λ) × Std(λ). Std(λ) and Std2 (Pn ) = Std(Pn ) = λ∈Pn λ∈Pn If t is a standard λ-tableau then the conjugate tableau t′ is the standard λ′ tableau obtained by swapping the rows and columns of t. The initial λ-tableau tλ is the λ-tableau obtained by inserting the numbers 1, 2, . . . , n in order along the rows of λ, from left to right and then top to bottom. QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS 13 ′ The co-initial tableau tλ is the conjugate of tλ . Then tλ is the unique λ-tableau that has the numbers 1, 2, . . . , n entered in order down the columns of λ, from left to right. Recall that I = Z/eZ. Let t be a standard tableau and suppose that m appears in row r and column c of t, where 1 ≤ m ≤ n. The content and e-residue of m in t are given by cm (t) = c − r ∈ Z and resm (t) = c − r + eZ ∈ I. respectively. The e-residue sequence of the tableau t is the n-tuple  res(t) = res1 (t), . . . , resn (t) ∈ I n . Given a sequence i ∈ I n let Std(i) = {t ∈ Std(Pn ) | res(t) = i} be the set of standard tableaux with residue sequence i. 2.2. Seminormal forms. To prove Theorem 2.45 we make extensive use of the semisimple representation theory of Hξ (Sn ) using seminormal forms. This section introduces Jucys-Murphy elements and seminormal forms and proves some basic facts relating seminormal forms and the #-involution. Throughout this section we fix a field K and a non-zero scalar t ∈ K. Let HtK (Sn ) be the Iwahori-Hecke algebra of Sn over K with parameter t. If k ∈ Z define the quantum integer to be the scalar ( (1 + t + · · · + tk−1 ), if k ≥ 0, [k]t = −1 −2 k −(t + t + · · · + t ), if k < 0. When t is understood we write [k] = [k]t . We need a well-known result, which is easily proved by induction on n. To state this, define the Poincaré polynomial of HtK (Sn ) to be PH (t) = [1][2] . . . [n] ∈ K. 2.1. Lemma (See [17, Lemma 3.34]). Suppose that PH (t) 6= 0 and that s, t ∈ Std(Pn ). Then s = t if and only if [cr (s)] = [cr (t)], for 1 ≤ r ≤ n. We assume for the rest of this section that PH (t) 6= 0. In fact, the results that follow imply that HtK (Sn ) is semisimple if and only if PH (t) 6= 0 and, in turn, this is equivalent to the condition in Lemma 2.1. If t is a tableau and 1 ≤ r ≤ n then the axial distance from r + 1 to r in t is (2.2) ρr (t) = cr (t) − cr+1 (t) ∈ Z. By definition, −n < ρr (t) < n so [ρr (t)] 6= 0 if PH (t) 6= 0. The next definition will provide us with the framework to prove Theorem 2.45. 2.3. Definition (Hu-Mathas [9, Definition 3.5]). Suppose that PH (t) 6= 0. A ∗-seminormal coefficient system is a set of scalars α = {αr (t) ∈ K | 1 ≤ r < n and t ∈ Std(Pn )} such that if t ∈ Std(Pn ) and 1 ≤ r < n then: a) αr (t) = 0 whenever sr t is not standard. b) αr (t)αk (sr t) = αk (t)αr (sk t) whenever 1 ≤ k < n and |r − k| > 1. c) αr (sr+1 sr t)αr+1 (sr t)αr (t) = αr+1 (sr sr+1 t)αr (sr+1 t)αr+1 (t) if r 6= n − 1, d) if v = sr t ∈ Std(Pn ) then αr (t)αr (v) = [1 + ρr (t)][1 + ρr (v)] . [ρr (t)][ρr (v)] 14 CLINTON BOYS AND ANDREW MATHAS Many examples of seminormal coefficient systems are given in [9, §3]. For exr (t)] ample, {αr (t)} is seminormal coefficient system, where αr (t) = [1+ρ [ρr (t)] whenever t, sr t ∈ Std(Pn ). In Section 2.4 we fix a particular choice of seminormal coefficient system but until then we will work with an arbitrary coefficient system. For k = 1, 2, . . . , n the Jucys-Murphy element Lk ∈ HtO is defined by Lk = k−1 X tj−k T(k−j,k) . j=1 2 A basis {fst | (s, t) ∈ Std (Pn )} of HtK (Sn ) is a seminormal basis if Lk fst = [ck (s)]fst and fst Lk = [ck (t)]fst , 2 for all (s, t) ∈ Std (Pn ) and 1 ≤ k ≤ n. The basis {fst } is a ∗-seminormal basis if, in addition, fst∗ = fts , for all (s, t) ∈ Std2 (Pn ), where ∗ is the unique anti-isomorphism of HtK (Sn ) that fixes T1 , . . . , Tn−1 . Recall that PH (t) = [1][2] . . . [n]. 2.4. Theorem (The seminormal form [9, Theorem 3.9]). Suppose that PH (t) 6= 0 and that α is a seminormal coefficient system for HtK (Sn ). Then: a) The algebra HtK (Sn ) has a unique ∗-seminormal basis {fst | (s, t) ∈ Std2 (Pn )} such that 1 fst , fst∗ = fts , Lk fst = [ck (s)]fst and Tr fst = αr (s)fut − [ρr (s)] where u = (r, r + 1)s. (Set fut = 0 if u is not standard.) b) For t ∈ Std(Pn ) there exist non-zero scalars γt ∈ K such that fst fuv = δtu γt fsv and { γ1t ftt | t ∈ Std(Pn )} is a complete set of pairwise orthogonal primitive idempotents. c) The ∗-seminormal basis {fst | (s, t) ∈ Std2 (Pn )} is uniquely determined by the ∗-seminormal coefficient system α and the scalars {γtλ | λ ∈ Pn }. By Theorem 2.4(b), if t ∈ Std(Pn ) then Ft = γ1t ftt is a primitive idempotent in HtK (Sn ). As is well-known (see, for example, [9, (3.2)]), Ft = n Y Y k=1 s∈Std(Pn ) ck (s)6=ck (t) Lk − [ck (s)] . [ck (t)] − [ck (s)] In particular, the idempotent Ft is independent of the choice of seminormal basis. Let L be the commutative subalgebra generated by the Jucys-Murphy elements. Theorem 2.4(a) implies that, as an (L , L )-bimodule, HtK (Sn ) decomposes as M (2.5) HtK (Sn ) = Hst , (s,t)∈Std2 (Pn ) where Hst = Kfst . Equivalently, Hst = {h ∈ HtK (Sn ) | Lk h = [ck (s)]h and hLk = [ck (t)]h for 1 ≤ k ≤ n}, for (s, t) ∈ Std2 (Pn ). Let # be the hash involution from (1.2) on HtK (Sn ). Then Tr# = −Tr + t − 1, for 1 ≤ r < n. QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS 15 2.6. Lemma. Suppose that 1 ≤ k ≤ n and s ∈ Std(Pn ). Then ′ L# k fss = [ck (s )]fss . Proof. For 1 ≤ k ≤ n set L̂k = t1−k Tk−1 Tk−2 · · · T2 T12 T2 · · · Tk−2 Tk−1 . It is wellknown and easy to prove that L̂k = (t−1)Lk +1; see, for example, [17, Exercise 3.6]. By Theorem 2.4(a), Lk fss = [ck (s)]fss , so L̂k fss = tck (s) fss . Now (L̂k )# = L̂−1 k since Tr# = −tTr−1 by (1.2), for 1 ≤ r < k ≤ n. Therefore, −1 −ck (s) L̂# fss = tck (s ) fss , k fss = L̂k fss = t ′ where the last equality follows because ck (s′ ) = −ck (s) for 1 ≤ k ≤ n. Hence, ′ L#  k fss = [ck (s )]fss as claimed. 2.7. Lemma. Suppose that s ∈ Std(Pn ). Then Fs# = Fs′ . Proof. Since Fs = 1 γs fss , applying Lemma 2.6 gives # ′ # ′ # Lk Fs# = (L# k Fs ) = ([ck (s )]Fs ) = [ck (s )]Fs . Similarly Fs# Lk = [ck (s′ )]Fs# . Therefore, Fs# ∈ Hs′ s′ in the decomposition of (2.5). As Fs is an idempotent, and # is an algebra automorphism, it follows that Fs# = Fs′  since this is the unique idempotent in Hs′ s′ = KFs′ = Kfs′ s′ . 2.8. Corollary. Suppose that s ∈ Std(Pn ). Then fss# = Proof. Using Theorem 2.4(b) and Lemma 2.7, fss# = γs fs′ s′ . γs ′ 1 # γs Fs = 1 ′ γs Fs = γs′ γs fs′ s′ .  2.9. Lemma. Let s, u ∈ Std(Pn ) be standard tableaux such that u = (r, r + 1)s, for some integer r with 1 ≤ r < n. Then αr (s′ )γs f u′ s ′ . αr (s)γs′   Proof. By Theorem 2.4(a), fus = αr1(s) Tr + [ρr1(s)] fss . Recall that Tr# = −tTr−1 = −Tr + t − 1. Therefore, using (1.2) and Corollary 2.8 for the second equality, 1  1 # # # fus = Tr + fss αr (s) [ρr (s)] γs  1  = fs′ s′ − Tr + t − 1 + αr (s)γs′ [ρr (s)] γs  tρr (s)  =− fs′ s′ Tr − αr (s)γs′ [ρr (s)] γs  1  =− fs′ s′ , Tr + αr (s)γs′ [ρr (s′ )] # fus =− since [ρr (s)] = −tρr (s) [−ρr (s)] = −tρr (s) [ρr (s′ )]. Hence, the result follows by another  application of Theorem 2.4(a). By Theorem 2.4(c) any ∗-seminormal basis is uniquely determined by a seminormal coefficient system and a choice of scalars {γtλ | λ ∈ Pn }. For completeness we determine these scalars for the seminormal basis {fst# | (s, t) ∈ Std2 (Pn )}. Recall ′ from Section 2.1 that tλ = (tλ )′ is the co-initial λ-tableau. 16 CLINTON BOYS AND ANDREW MATHAS 2.10. Proposition. The seminormal basis {fst# | (s, t) ∈ Std(Pn )} of HtK (Sn ) is the seminormal basis determined by the seminormal coefficient system {−αr (s′ ) | s ∈ Std(Pn ) and 1 ≤ r < n} together with the γ-coefficients {γtλ | λ ∈ Pn }. That is, if (s, t) ∈ Std2 (Pn ) then 1 # f #, Lk fst# = [cr (s′ )]fst# , fst# Lk = [cr (t′ )]fst# and Tr fst# = −αr (s)fut − [ρr (s′ )] st # # where u = (r, r + 1)s, 1 ≤ k ≤ n and 1 ≤ r < n. Moreover, fst# fuv = δtu γt fsv , for 2 (s, t), (u, v) ∈ Std (Pn ). Proof. If 1 ≤ k ≤ n then Lk fst# = [cr (s′ )]fst# and fst# Lk = [cr (t′ )]fst# by Lemma 2.6. Using Theorem 2.4(a), # #   = (−Tr + t − 1)fst Tr fst# = Tr#fst #  1 )fst = − αr (s)fut + (t − 1 + [ρr (s)]  # 1 = − αr (s)fut − f st [ρr (s′ )] 1 # = −αr (s)fut − f #. [ρr (s′ )] st # # Similarly, fst# fuv = (fst fuv )# = δtu γt fsv . By Lemma 2.9, fst# ∈ Hs′ t′ , so the α# coefficient corresponding to fst is naturally indexed by s′ (and not by s). Similarly, the labelling for the γ-coefficients involves conjugation because Ft = γ1′ ft# ′ t′ by t Corollary 2.8. Hence, the result follows by Theorem 2.4.  2.3. Idempotent subrings and KLR generators. We are almost ready to introduce the generators of HtO that we need to prove Theorem 2.45. This section defines roughly half of these generators. The definition of these elements involves lifting idempotents from the non-semisimple case to the semisimple case and to do this we need to place additional constraints upon the rings that we work over. If O is a ring let J = J (O) be the Jacobson radical of O. 2.11. Definition ([9, Definition 4.1]). Suppose that O is a subring of a field K and that t ∈ O× . The pair (O, t) is an e-idempotent subring of K if: a) The Poincaré polynomial PH (t) is a non-zero element of O, b) If k ∈ / eZ then [k]t is invertible in O, c) If k ∈ eZ then [k]t ∈ J (O). Condition (a) ensures that Lemma 2.1 and Theorem 2.4 apply and, in particular, that HtK (Sn ) has a seminormal basis {fst }. As discussed in [7, Example 4.2], when considering the Hecke algebra Hξ (Sn ) defined over the field F with parameter ξ ∈ F × , one natural choice of idempotent subring is to let x be an indeterminate over F and set K = F (x), t = x + ξ and O = F [x, x−1 ](x) . Note that m = xO is the unique maximal ideal of O and that (K, O, F ) is a modular system with Hξ (Sn ) ∼ = HtO ⊗O F , where F is considered as an O-module by letting x act as multiplication by 0. The hash involution # from (1.2) is well-defined on HtO . Let HtO (An ) the O-subalgebra of #-fixed points in HtO . Then Hξ (An ) ∼ = HtO (An ) ⊗O F . QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS 17 Recall that if i ∈ I n then Std(i) = {t ∈ Std(Pn ) | res(t) = i}. Using an idea that goes back to Murphy [21], the i-residue idempotent is defined to be the element fiO = X t∈Std(i) X 1 Ft . ftt = γt t∈Std(i) By Theorem 2.4(b), if s ∈ Std(j) and t ∈ Std(k) are tableaux of the same shape then fiO fst = δij fst and fst fiO = δik fst , for i, j, k ∈ I n . By definition, fiO ∈ HtK (Sn ) but, in fact, fiO ∈ HtO . O 2.12. Lemma. Suppose that i ∈ I n . Then fiO ∈ HtO and (fiO )# = f−i . Proof. Since (O, t) is an idempotent subring, fiO ∈ HtO by [9, Lemma 4.5]. To O prove that (fiO )# = f−i first observe that s ∈ Std(i) if and only if s′ ∈ Std(−i). Therefore, by Lemma 2.7, X X O Fs′ = f−i Fs# = (fiO )# = s∈Std(i) s∈Std(i) as claimed.  Following [2, 9], define Mr = 1 − Lr + tLr+1 , for 1 ≤ r ≤ n. If (s, t) ∈ Std2 (Pn ) then it follows easily using Theorem 2.4(a) that (2.13) Mr fst = tcr (s) [1 − ρr (s)]fst . The next result says that these elements are invertible when projected onto certain residue idempotents fiO , for i ∈ I n . 2.14. Corollary ([9, Corollary 4.8]). Suppose that i ∈ I n and ir 6= ir+1 + 1, for 1 ≤ r < n and . Then X t−cr (t) Fs ∈ HtO . [1 − ρr (s)] s∈Std(i) In view of Corollary 2.14, if ir 6= ir+1 + 1 define the formal symbol 1 O f = Mr i X s∈Std(i) t−cr (t) Fs . [1 − ρr (s)] This abuse of notation is justified because M1r fiO Mr = fiO by (2.13). We will use these elements to define the KLR-generators of HtO that we use to prove Theorem A. The results of [9] depend upon choosing an arbitrary section of the natural quotient map Z ։ Z/eZ. In this paper we are far less flexible and need to use a particular section of this map. If i ∈ I let ı̂ ≥ 0 be the smallest non-negative integer such that i = ı̂ + eZ. (If e = ∞ set î = i.) This defines an embedding I ֒→ Z; i 7→ ı̂. For i ∈ I n set ρr (i) = ı̂r − ı̂r+1 , for 1 ≤ r < n. P By Theorem 2.4, the identity element of HtO can be written as 1 = i∈I n fiO . P So if h ∈ HtO then h = i∈I n hfiO is uniquely determined by its projection onto the idempotents fiO . 18 CLINTON BOYS AND ANDREW MATHAS 2.15. Definition P ([9, Definition 4.14]). Fix an integer 1 ≤ r < n and define the element ψr+ = i∈I n ψr+ fiO by  tı̂r O  if ir = ir+1 , (1 + Tr ) Mr fi , ψr+ fiO = (Tr Lr − Lr Tr )t−ı̂r fiO , if ir → ir+1 ,   (Tr Lr − Lr Tr ) M1r fiO , otherwise. P For 1 ≤ s ≤ n define ys+ = i∈I n t−ı̂s (Ls − [ı̂s ])fiO . + Recall from Section 1.5 that Qεn = Q+ n /∼. For α ∈ Q define X HαO = HtO fαO , where fαO = fiO . i∈I α For γ ∈ Qεn set fγO = P α∈γ fαO and set HγO = L α∈γ HαO = HtO fγO . 2.16. Proposition. Suppose that (O, t) is an idempotent subring. Then fγO is a M central idempotent in HtO and HtO = HγO . γ∈Qεn Proof. By Lemma 2.12, fγO ∈ HtO and it follows from Theorem 2.4 that fγO is P O O a central idempotent and that 1 = = fγO HtO fγO is a γ∈Qεn fγ . Hence, Hγ L  subalgebra of HtO and HtO = γ∈Qε HγO . n Q+ n the algebras HαO ⊗O F are indecomposable two-sided ideals By [12], for α ∈ of Hξ (Sn ). Later we need the counterpart of Corollary 1.15 for Hξ (An ). If γ ∈ Qεn then (fγO )# = fγO by Lemma 2.12. Therefore, # restricts to an automorphism of HγO . Define # (2.17) HtO (An )γ = HγO = {h ∈ HγO | h# = h} = HtO (An )fγO . P As 1 = γ fγO , Proposition 2.16 immediately implies the following. 2.18. Corollary. Suppose that (O, t) is an idempotent subring. Then M HtO (An ) = HtO (An )γ . γ∈Qεn The subalgebra HtO (An )γ is a block of HtO (An ) in the sense that it is a twosided ideal and a direct summand of HtO (An ). Let F be a field that is an Oalgebra and set HξF (An )γ = HtO (An )γ ⊗O F . Then HξF (An )γ is almost always indecomposable. See Theorem 3.22 for the precise statement. 2.19. Theorem (Hu-Mathas [9, Theorem A]). Suppose that K is a field, γ ∈ Q+ n and that (O, t) an e-idempotent subring of K, where e 6= 2. As an O-algebra, the Iwahori-Hecke algebra HγO is generated by the elements {fiO | i ∈ I γ } ∪ {ψr+ | 1 ≤ r < n} ∪ {ys+ | 1 ≤ s ≤ n} subject to the relations (y1+ )(Λ0 ,αi1 ) fiO = 0, X fiO fjO = δij fiO , yr+ fiO = fiO yr+ , ψr+ fiO + ψr+ yr+1 fiO = (yr+ ψr+ + δir ir+1 )fiO , = fsOr ·i ψr+ , + yr+1 ψr+ fiO = fiO = 1 i∈I γ yr+ ys+ = ys+ yr+ (ψr+ yr+ + δir ir+1 )fiO QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS ψr+ ys+ = ys+ ψr+ , ψr+ ψs+ (ψr+ )2 fiO + ψr+ fiO ψr+ ψr+1 hdi ψs+ ψr+ , 19 if s 6= r, r + 1, = if |r − s| > 1,  h1+ρr (i)i + (yr − yr+1 )fiO , if ir → ir+1 ,     h1−ρr (i)i (yr+1 − yr+ )fiO , if ir ← ir+1 , = 0, if ir = ir+1 ,    O fi , otherwise,  + + + 1+ρ (i) r  )fiO , if ir = ir+2 → ir+1 , (ψr+1 ψr ψr+1 − t + + = (ψr+1 ψr+ ψr+1 + 1)fiO , if ir = ir+2 ← ir+1 ,   + + + O ψr+1 ψr ψr+1 fi , otherwise, where yr fiO = (td yr+ − [d])fiO for d ∈ Z, and ρr (i) = ı̂r − ı̂r+1 , for i, j ∈ I γ and all admissible r, s. A], this result holds for the algebras HαO , for α ∈ Q+ Proof. By [9, n. L Theorem O O As Hγ = α∈γ Hα this gives the result for HγO . The proof of [9, Theorem A] assumes that e < ∞ (or e = 0 in the notation of [9]), however, this assumption is only needed for [9, (3.2)] which is automatic in level 1 when Λ = Λ0 . Alternatively,  as in [9, Corollary 2.15], it is enough to consider the case when n < e < ∞. As above, let m be a maximal ideal of O and set F = O/m and ξ = t + m ∈ F and let Hξ (Sn ) be the Iwahori-Hecke algebra over F with parameter ξ. Then HξF (Sn ) ∼ = HtO ⊗O F. The definition of an e-idempotent subring ensures that ξ has quantum characteristic e. Comparing the relations in Definition 1.5 with those in Theorem 2.19, modulo m, there is an algebra isomorphism θ : ReF (Sn ) −→ HξF (Sn ) determined by ψr 7→ ψr+ ⊗ 1F , yr 7→ yr+ ⊗ 1F and e(i) 7→ fiO ⊗ 1F , for all admissible r and i ∈ I n . Unfortunately, as the next example shows, we 6 # ◦ θ. cannot use θ to prove Theorem A because θ ◦ sgn = 2.20. Example. Suppose that n = 3, Λ = Λ0 and work over F3 , the field with three elements. By Example 1.8,  e(012), e(021), y3e(012), y3 e(021), ψ2 e(012), ψ2 e(021) is a basis of Re (S3 ) ∼ = F3 S3 and, by Example 1.13,  e(012) + e(021), ψ2 (e(012) − e(021)), y3 (e(012) − e(021)) is a basis of Re (A3 ). Let θ : Re (S3 ) −→ F3 S3 be the Brundan-Kleshchev isomorphism induced by Theorem 2.19. With some work it is possible to show that:  θ e(012) + e(021) = 1  θ y3 (e(012) − e(021)) = 1 + s1 s2 + s2 s1  θ ψ2 (e(012) − e(021)) = s2 + 2s1 s2 s1 . In particular, θ does not restrict to an isomorphism between Re (A3 ) and F3 A3 . ♦ To obtain an isomorphism Re (Sn ) → Hξ (Sn ), which restricts to an isomorphism Re (An ) → Hξ (An ), we modify the generators of HtO given in Theorem 2.19. 2.21. Definition. Let ψr− = (ψr+ )# and ys− = (ys+ )# , for 1 ≤ r < n and 1 ≤ s ≤ n. 20 CLINTON BOYS AND ANDREW MATHAS O Notice that (fiO )# = f−i by Lemma 2.12. Therefore, since # is an automor− − phism, the elements {ψr , ys , fiO } generate HtO , subject to essentially the same relations as those given in Theorem 2.19 except that i should be replaced with −i. As we need this result below we state it in full for easy reference. 2.22. Corollary. Suppose that e > 2, γ ∈ Q+ n and n ≥ 0. Let (O, t) be an eidempotent subring of K. Then HγO is generated as an O-algebra by the elements {ψr− | 1 ≤ r < n} ∪ {ys− | 1 ≤ s ≤ n} ∪ {fiO | i ∈ I γ } subject to the relations (y1− )(Λ0 ,αi1 ) fiO = 0, yr− fiO = fiO yr− , ψr− fiO − ψr− yr+1 fiO = (yr− ψr− + δir ir+1 )fiO , ψr− ys− = ys− ψr− , ψr− ψs− = ψs− ψr− , (ψr− )2 fiO − ψr− ψr+1 ψr− fiO hdi X fiO fjO = δij fiO , = fsOr ·i ψr− , − yr+1 ψr− fiO = fiO = 1 i∈I γ yr− ys− = ys− yr− (ψr− yr− + δir ir+1 )fiO if s 6= r, r + 1, if |r − s| > 1,  h1−ρr (i)i − O (yr − yr+1 )fi , if ir ← ir+1 ,     h1+ρr (i)i (yr+1 − yr− )fiO , if ir → ir+1 , =  0, if ir = ir+1 ,    O fi , otherwise,  − − − 1−ρr (i) O  )fi , if ir = ir+2 ← ir+1 , (ψr+1 ψr ψr+1 − t − − − = (ψr+1 ψr ψr+1 + 1)fiO , if ir = ir+2 → ir+1 ,   − − − O ψr+1 ψr ψr+1 fi , otherwise, where yr fiO = (td yr− − [d])fiO , for all d ∈ Z, for i, j ∈ I γ and all admissible r and s. hdi The elements yr appearing in Theorem 2.19 and Corollary 2.22 are different. In the next section we introduce a third variation of this notation. The meaning hdi of yr will always be clear from context. 2.4. Signed KLR generators. This section sets up the machinery that will be used to construct the isomorphism Re (An ) → Hξ (An ). The idea is to use the results of the last two sections to give a new presentation of HtO , which induces an isomorphism Re (Sn ) → Hξ (Sn ) that restricts to an isomorphism Re (An ) → Hξ (An ). To do this we use the generators of HtO given in Theorem 2.19 and Corollary 2.22 together with a particular seminormal coefficient system and idempotent subring. The seminormal coefficient system that we use to prove Theorem A forces us to work over a ring that contains “enough” square roots. We start by defining this ring, following [19, Definition 3.1]. Suppose that the Iwahori-Hecke algebra H is defined over the field F with parameter ξ ∈ F of quantum characteristic e. Recall that in this paper we are assuming that characteristic of F is not 2 and that e > 2. 2.23. Definition. Let x be an indeterminate over √ F√and setpt = x + ξ. In the algebraic closure F (x) of F (x) fix square roots −1, t and [h], for 1 < h ≤ n. Let  √ p O = F t, [h] 1 < h ≤ n (x) QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS 21 √ p be the localization of F [ t, [h] | 1 < h ≤ n] at the maximal ideal generated by x. Let K be the field of fractions of O. Note that t is invertible in O so that we can consider the Iwahori-Hecke algebra HtO with parameter t. By [19, Corollary 5.12], the field of fractions K of O is a splitting field for the semisimple algebra HtK (An ). Let m = xO be the maximal ideal of O and set F = O/m. Then F is (isomorphic to) a subfield of F. Moreover, ξ is identified with the image of t under the natural map O ։ F. Hence, Hξ (Sn ) ⊗F F ∼ = HtO ⊗O F. (Note that working over F does not change the representation theory of Hξ (Sn ) because any field is a splitting field for Hξ (Sn ) since it is apcellular algebra [6, 17].) By construction, F contains √ √ square roots −1, ξ and [h]ξ , for −n ≤ h ≤ n. In general, F is a non-trivial extension of F . For 0 < h ≤ n fix a choice of “negative” square roots in O by setting p p √ √ (2.24) [−h] = −1( t)−h [h]. p Then [−h] ∈ O for −n ≤ h ≤ n. If h > 0 then [−h] = −t−h [h] so the effect of (2.24) is to fix the sign of the square root of [−h]. In order to apply the results of Theorem 2.19 and Corollary 2.22 we need to check that (O, t) is an idempotent subring in the sense of Definition 2.11. Part (a) of Definition 2.11 is automatic whereas parts (b) and (c) follow from the observation that if k ∈ Z then the polynomial [k] = [k]t ∈ O has zero constant term, as a polynomial in x, if and only if k ∈ eZ. Hence, we have the following. 2.25. Lemma. The pair (O, t) is an idempotent subring. Now that we have fixed an idempotent subring we turn to the proof of Theorem A. The idea is to use the generators of HγO from Theorem 2.19 for “half” of HγO and to use the generators from Corollary 2.22 the rest of the time. To make this more precise, recall from after Lemma 1.16 that n I+ = {i ∈ In | i1 = 0 and i2 = 1} and n I− = {i ∈ In | i1 = 0 and i2 = −1}. γ γ n n These sets are disjoint because e 6= 2. Set I+ = I γ ∩ I+ and I− = I γ ∩ I− , for ≃ γ γ ε γ ∈ Qn . Then the map i 7→ −i is a bijection of sets I+ −→ I− . γ γ 2.26. Lemma. Suppose that i ∈ I γ and fiO 6= 0. Then i ∈ I+ or i ∈ I− . Proof. By definition, fiO 6= 0 only if Std(i) 6= ∅ or, equivalently, i = res(t) for some standard tableau t ∈ Std(Pn ). If t ∈ Std(i) then i1 = res1 (t) = 0 and γ γ i2 = res2 (t) = ±1, so i ∈ I+ ∪ I− .  P O ). In what follows we In particular, if h ∈ HγO then h = i∈I γ (hfiO + hf−i + apply Lemma 2.26, and this observation, without further mention. Motivated in part by Proposition 2.10 we make the following definition. 2.27. Definition. An alternating coefficient system is a ∗-seminormal coefficient system α = {αr (t)} such that αr (t) = −αr (t′ ), for 1 ≤ r < n and t ∈ Std(Pn ). Consider the case when n = 3 and α is an alternating coefficient system. Let 3 t = 1 2 and s = 1 3 , so that res(t) ∈ I+ . By Definition 2.27 and Definition 2.3, 3 2 α2 (t)2 = −α2 (s)α2 (t) = − t[3] . [2]2 22 CLINTON BOYS AND ANDREW MATHAS √ √p So α2 (t) = ± −1 t [3]/[2]. In the argument that follows we need α2 (t) to have such values for all t ∈ Std(Pn ). Following [19, §3], for i ∈ I n and 1 ≤ r < n define √  ρr (t)/2 √ t [1+ρr (t)] [1−ρr (t)] n  , if i ∈ I+ ,  [ρr (t)]  (2.28) αr (t) = −α (t′ ), n if i ∈ I− , r    0, otherwise. n By Definition 2.23, αr (t) ∈ O for all t ∈ Std(Pn ) and 1 ≤ r < n. Moreover, if i ∈ I± √ √p and t ∈ Std(i) then α2 (t) = ± −1 t [3]/[2] by (2.24). It is straightforward to check that {αr (t)} is an alternating coefficient system. In particular, if t is standard, 1 ≤ r < n and sr t is not standard then ρr (t) = ±1 so that αr (t) = 0. Using Theorem 2.4, we fix an arbitrary seminormal basis {fst } for HtK (Sn ) that is compatible with the seminormal coefficient system defined by (2.28). Note that Definition 2.29, and hence the results that follow, do not depend on this choice of seminormal basis. 2.29. Definition. Suppose that 1 ≤ r < n and 1 ≤ s ≤ n. If r 6= 2 define X X O O (ys+ fiO − ys− f−i ), (ψr+ fiO − ψr− f−i ) and ysO = ψrO = γ i∈I+ γ i∈I+ and when r = 2 set ψ2O = X γ i∈I+ O κi (ψ2+ fiO − ψ2− f−i ), where κi =  t−1 , √ t ,  √[3] if e = 3, if e > 3. γ For convenience, set κ−i = κi , for i ∈ I+ . The scalars κi are needed to ensure O that ψ2 satisfies analogues of the quadratic and braid relations in Definition 1.5. By Definition 2.27, κi is invertible in O for all i ∈ I γ . The reason why κi depends only on e, and not on the quiver Γe , goes back to Lemma 1.16: if i ∈ I γ and e(i) 6= 0 or, equivalently, fiO 6= 0 then the possible values for i1 , i2 and i3 are tightly constrained. By Definition 2.23, the elements in {ψrO | 1 ≤ r < n} ∪ {ysO | 1 ≤ s ≤ n} belong to HγO . The aim is now to show that these elements, together with the idempotents {fiO | i ∈ I n }, generate HγO subject to relations that are similar to those in Theorem 2.19. This will imply that these elements induce an isomorphism Re (Sn ) ⊗Z F ∼ = Hξ (Sn ) ⊗F F. Before we start the proof we note the following consequence of Definition 2.29 and Lemma 2.12. Ultimately, this observation will imply that Hξ (An ) ⊗F F ∼ = Re (An ) ⊗Z F. 2.30. Corollary. Suppose that 1 ≤ r < n, 1 ≤ s ≤ n and i ∈ I γ . Then (ψrO )# = −ψrO , (ysO )# = −ysO and O (fiO )# = f−i . The first step is to give a new generating set for HγO . 2.31. Proposition. Suppose γ ∈ Qεn . Then HγO is generated by {ψrO | 1 ≤ r < n} ∪ {ysO | 1 ≤ s ≤ n} ∪ {fiO | i ∈ I γ }. QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS 23 Proof. Let Hγ be the O-subalgebra of HγO generated by the elements in the statement of the proposition. It is enough to show that Tr fiO ∈ Hγ , for 1 ≤ r < n and i ∈ I γ , since these elements generate HγO . Further, by Corollary 2.30, Hγ# = γ Hγ so it is enough to show that Tr fiO ∈ Hγ , for i ∈ I+ and 1 ≤ r < n. Let P O f+ = i∈I γ fiO . As remarked above, κi is an invertible scalar in O. Therefore, + γ O }. Hence, the O-module Hγ f+ contains the elements {ψr+ fiO , ys+ fiO , fiO | i ∈ I+ O O O Hγ f+ = Ht f+ by Theorem 2.19. This completes the proof.  For the rest of this paper, for d ∈ Z, 1 ≤ r ≤ n and i ∈ I γ we set ( d O γ (t yr − [d])fiO , if i ∈ I+ , hdi O (2.32) yr fi = γ d O O (t yr + [d])fi , if i ∈ I− . P + O − O Since yrO = i∈I γ (yr fi − yr f−i ) this is compatible with the two definitions + hdi of yr fiO used in the last section The rest of this section determines a set of defining relations for HγO for the generators of HγO from Proposition 2.31. Fortunately, much of the work has already been done because Theorem 2.19 and Corollary 2.22 give us a large number of relations. More precisely, they give the following list of relations, not involving ψ2O . 2.33. Lemma. Suppose that γ ∈ Qεn . The following identities hold in HγO : P O fiO fjO = δij fiO , (y1O )(Λ0 ,αi1 ) fiO = 0, i∈I γ fi = 1 ytO fiO = fiO ytO , ψrO fiO = fsOr ·i ψrO , O ψrO yr+1 fiO = (yrO ψrO + δir ir+1 )fiO , ψrO ytO = ytO ψrO , ψrO ψsO ψsO ψrO , yrO ytO = ytO yrO O yr+1 ψrO fiO = (ψrO yrO + δir ir+1 )fiO if t 6= r, r + 1, = if |r − s| > 1,  h1+ρr (i)i γ O (yr , − yr+1 )fiO , if ir → ir+1 and i ∈ I+     h1−ρ (i)i γ r O O  (y − y )f , if i ← i and i ∈ I  r r r+1 r+1 − i   (y h1−ρr (i)i − y O )f O , γ if i ← i and i ∈ I r r+1 r + r+1 i (ψrO )2 fiO = h1+ρ (i)i γ  (yrO − yr+1 r )fiO , , if ir → ir+1 and i ∈ I−      0, if i = i , r r+1    O fi , otherwise,  γ O O  (ψr+1 ψrO ψr+1 − t1+ρr (i) )fiO , if ir = ir+2 → ir+1 , and i ∈ I+    γ O O O 1−ρr (i) O   )fi , if ir = ir+2 ← ir+1 and i ∈ I− , (ψr+1 ψr ψr+1 + t γ O O O O O O O O ψr ψr+1 ψr fi = (ψr+1 ψr ψr+1 + 1)fi , if ir = ir+2 ← ir+1 and i ∈ I+ ,   γ O O O O (ψr+1 ψ ψ − 1)f , if ir = ir+2 → ir+1 , and i ∈ I−  r r+1 i   ψ O ψ O ψ O f O , otherwise, r+1 r r+1 i for all admissible i, j ∈ I γ and r, s, t satisfying 2 < r, s < n and 1 ≤ t ≤ n. γ γ Proof. First notice that if i ∈ / I+ ∪ I− then fiO = 0 by Lemma 2.26, so all of the γ γ relations above are trivially true. We may assume then that i ∈ I+ ∪ I− . The first three identities follow directly from Theorem 2.19 and Corollary 2.22. γ For the remaining formulas, observe that if 2 < r < n then i ∈ I+ if and only if sr ·i ∈ γ γ γ γ I+ and, similarly, i ∈ I− if and only if sr · i ∈ I− . Therefore, if i ∈ I+ the relations 24 CLINTON BOYS AND ANDREW MATHAS γ then they hold by Corollary 2.22. Note hold by virtue of Theorem 2.19 and if i ∈ I− γ that if i ∈ I− then there is a sign change in the last two relations, in comparison with Corollary 2.22, because ψrO fiO = −ψr− fiO and ytO fiO = −ys− fiO .  Next we need analogues of the relations in Lemma 2.33 for ψ1O . We could replace the next result with the single relation ψ1O = 0, however, this is not sufficient for our later arguments because the proof of Theorem 2.45 relies on the fact that the generators of Proposition 2.31 satisfy relations that are compatible with Definition 1.5. 2.34. Lemma. Suppose that γ ∈ Qεn . The following identities hold in HγO : ψ1O fiO = fsO1 ·i ψ1O , ψ1O ysO = ysO ψ1O , ψ1O ψrO = ψrO ψ1O , y2O ψ1O fiO = (ψ1O y1O + δi1 i2 )fiO , ψ1O y2O fiO = (y1O ψ1O + δi1 i2 )fiO ,  O (y − y2O )fiO , if i1 → i2 ,    1O  (y2 − y1O )fiO , if i1 ← i2 , (ψ1O )2 fiO =  0, if i1 = i2 ,    O fi , otherwise,  O O O O  (ψ2 ψ1 ψ2 − 1)fi , if i1 = i3 → i2 , ψ1O ψ2O ψ1O fiO = (ψ2O ψ1O ψ2O + 1)fiO , if i1 = i3 ← i2 ,   O O O O ψ2 ψ1 ψ2 fi , otherwise, γ for all admissible i ∈ I and r, s satisfying 2 < r < n and 3 ≤ s ≤ n. Proof. By definition, fiO 6= 0 if and only if i = res(s) for some standard tableau s. In particular, if i = (i1 , . . . , in ) then i1 = 0, i2 ∈ {−1, 1} and i3 ∈ {−2, −1, 1, 2}. Hence, it follows from Theorem 2.19 and Corollary 2.22 that ψ1+ = 0 = ψ1− . Therefore, ψ1O = 0 and the first three relations are trivially true. The next two relations hold because δi1 i2 = 0 whenever fiO 6= 0 and the quadratic relation for (ψ1O )2 holds in view of Theorem 2.19 and Corollary 2.22. For the final “braid” relation, if i1 = i3 → i2 or i1 = i3 ← i2 then fiO = 0 by the remarks at the start of the proof, so the braid relation is trivially true in these cases. In the remaining cases ψ1O ψ2O ψ1O = 0 = ψ2O ψ1O ψ2O since ψ1O = 0. This completes the proof.  It remains to determine the relations involving ψ2O . The first step is easy. 2.35. Lemma. Suppose that i ∈ I γ , 2 < r < n and 1 ≤ s ≤ n with t 6= 2, 3. Then ψ2O ψrO = ψrO ψ2O and ψ2O ysO = ysO ψ2O . Proof. Since ψ2O fiO = ±κi ψ2± fiO , where κi ∈ O is invertible for i ∈ I γ , the result follows directly from Theorem 2.19 and Corollary 2.22.  For the remaining relations we need a more precise description of how the generators of Definition 2.29 act on the seminormal basis. Suppose that s ∈ Std(i) and that u = (r, r + 1)s, where 1 ≤ r < n. Following [9, (4.21)], define  γ  −βr (s′ ), if i ∈ I− ,    ı̂r −cr (s)  t α (s)  r γ   , if i ∈ I+ and ir = ir+1 , [1 − ρ (s)] r (2.36) βr (s) = γ  tcr+1 (s)−ı̂r αr (s)[ρr (s)], if i ∈ I+ and ir = ir+1 + 1,     t−ρr (s) αr (s)[ρr (s)]  γ   , if i ∈ I+ and ir ∈ / {ir+1 , ir+1 + 1}. [1 − ρr (s)] QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS 25 Note that βr (s) = 0 if u is not standard because αr (u) = 0 whenever u ∈ / Std(Pn ). More explicit formulas for βr (s) can be obtained using (2.28), however, we will only need these in one special case; see (2.40) below. Note that if s is standard and i = res(s) then res(s′ ) = −i. Therefore, the four cases in (2.36) are mutually exclusive. We need to be slightly careful, however, because if i = res(s) and j = res(s′ ) then it is not usually true that ̂r = −ı̂r , for 1 ≤ r ≤ n. Following [9, Lemma 4.23] we can now describe the action of ψrO and yrO on the seminormal basis {fst }. This result is the only place where we explicitly use the assumption of Definition 2.27. 2.37. Proposition. Suppose that s, t ∈ Std(λ) for λ ∈ Pn and let i = res(s), j = res(s′ ) for i, j ∈ I γ . Fix 1 ≤ r < n and let u = (r, r + 1)s. Then   κi β2 (s)fut , if r = 2,    ı̂r+1 −cr+1 (s)  t  γ fst , if r 6= 2 and i ∈ I+ , βr (s)fut − δir ir+1 ψrO fst = [ρr (s)]    t̂r+1 −cr+1 (s)  γ  βr (s)fut − δir ir+1 fst , if r 6= 2 and i ∈ I− . [ρr (s)] Moreover, if 1 ≤ k ≤ n then ykO fst = ( [ck (s) − ı̂k ]fst , −[ck (s′ ) − ̂k ]fst , γ if i ∈ I+ , γ if i ∈ I− . Proof. Without loss of generality, we can assume that t = s by Theorem 2.4(a), so we need to compute ψrO fss and yrO fss . γ First consider ψrO fss when r 6= 2. If i ∈ I+ then ψrO fss = ψr+ fss and the lemma γ γ is a restatement of [9, Lemma 4.23]. Suppose then that i ∈ I− , so that j ∈ I+ and ψrO fs′ s′ is given by the formulas above. As # is an involution, using Corollary 2.8 for the third equality and Lemma 2.9 for the last equality, # # γs + ψrO fss = −(ψr+ )# fss = − ψr+ fss# = − ψ fs′ s′ , γs ′ r ′ # t̂r+1 −cr+1 (s ) γs  ′ s′ βr (s′ )fu′ s′ − δjr jr+1 =− f s γs ′ [ρr (s′ )] = αr (s)βr (s′ ) t̂r+1 −cr+1 (s) fus − δir ir+1 fss , ′ αr (s ) [ρr (s)] since [ρr (s′ )] = [−ρr (s)] = −t−ρr (s) [ρr (s)]. By Definition 2.27, αr (s′ ) = −αr (s) and βr (s′ ) = −βr (s), so this establishes the formula for ψrO fst when r 6= 2. Now consider ψ2O fss . If fiO 6= 0 then i2 6= i3 because fiO 6= 0 only if i is the γ residue sequence of some standard tableau. Therefore, if i ∈ I+ and fiO 6= 0 then γ the argument of the last paragraph shows that ψ2+ fst = β2 (s)fut and if i ∈ I− then P O ), it follows that ψ2O fst = −ψ2− fst = β2 (s)fut . As ψ2O = i∈I γ κi (ψ2+ fiO − ψ2− f−i + κi β2 (s)fut as claimed. γ For the action of ykO , if i ∈ I+ then ykO fss = yk+ fss = [ck (s) − ı̂k ]fss by [9, γ Lemma 4.23]. On the other hand, if i ∈ I− then, using Lemma 2.12 twice, # γ γ s s [ck (s′ ) − ̂k ]fs′ s′ = −[ck (s′ ) − ̂k ]fss . ykO fss = − (yk+ fs′ s′ )# = − γs ′ γs ′ 26 CLINTON BOYS AND ANDREW MATHAS as required.  We can now determine the remaining “KLR-like” relations satisfied by ψ2O . 2.38. Lemma. Suppose that i ∈ I γ and let j = s2 · i. Then ψ2O fiO = fjO ψ2O . γ γ Proof. If i ∈ / I+ ∪I− then fiO = 0 = fjO and there is nothing to prove. Therefore, we P γ γ may assume that i ∈ I+ ∪ I− . Recall that fγO = k∈I γ fkO is the identity element of HγO . By Proposition 2.37, X κk β2 (t) X X 1 ψ2O ftt = fst . ψ2O = ψ2O fγO = ψ2O fkO = γt γt γ γ γ k∈I k∈I t∈Std(k) s=s2 t k∈I t∈Std(k) If fst is a term in the right-hand sum, with t ∈ Std(k) and s = s2 t, then fst fiO = δik fst = δs2 ·i,s2 ·k fst = fjO fst , P by Theorem 2.4(b). Hence, ψ2O fiO = t∈Std(i) γ1t κi β2 (t)fst = fjO ψ2O , as required.  hdi γ Recall from (2.32) that if d ∈ Z and i ∈ I± then yr fiO = (td yrO ∓ [d])fiO . 2.39. Lemma. Suppose that γ ∈ Qεn and i ∈ I γ . Then:   h−ei h−ei y3O ψ2O fiO = ψ2O y2 + δi2 i3 fiO and ψ2O y3O fiO = y2 ψ2O + δi2 i3 fiO . Proof. Both identities are proved similarly so we consider only the first one. If fiO 6= 0 then i = res(s), for some standard tableau s, in which case i2 6= i3 . Hence, if fiO 6= 0 then δi2 i3 = 0 so we can assume that δi2 i3 = 0 in what follows. (We include the term for δi2 i3 because to prove Theorem A we need to compare the identity in the lemma with the relations in Definition 1.5.) Without loss of generality, we may γ assume that i ∈ I+ . P By Theorem 2.4(b), fiO = s∈Std(i) γ1s fss . Therefore, to prove the lemma it is h−ei enough to verify that y3O ψ2O fss = ψ2O y2 fss , for all s ∈ Std(i). Fix s ∈ Std(i) γ and set u = (2, 3)s and j = s2 · i ∈ I− so that j = res(u) if u is standard. If u is h−ei not standard then β2 (s) = 0 so y3O ψ2O fss = 0 = ψ2O y2 fss by Proposition 2.37. Suppose then that u is standard so that s↓3 = 1 2 3 and u↓3 = 1 3 . 2 h−ei Using Proposition 2.37 again, ψ2O y2 fss = −κi β2 (s)[−e]fus since y2O fss = 0. Simih−ei larly, y3O ψ2O fss = κi β2 (s)y3O fus = −κi β2 (s)[−e]fus . Hence, y3O ψ2O fss = ψ2O y2 fss in all cases, completing the proof.  The proof of the next result explains why κi is needed in the definition of ψ2O . γ Fix s ∈ Std(i) such that i ∈ I+ and (2, 3)s is standard. Then ρ2 (s) = 2 and either e = 3 and i2 → i3 , or e > 3 and i2 — / i3 . Hence, i2 6∈ {i3 , i3 + 1}, so by (2.36) and Definition 2.29 √ √p √ p t−ρ2 (s) −1 t [3][ρ2 (s)] −1 [3] √ (2.40) β2 (s) = =− . [1 − ρ2 (s)][2] t We can now determine the quadratic relation for ψ2O . QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS 2.41. Lemma. Suppose that i ∈ I γ . Then  O (y2 − y3O )fiO ,     (y O − y O )f O , 3 2 i (ψ2O )2 fiO =  0,     O fi , 27 if i2 → i3 , if i2 ← i3 , if i2 = i3 , otherwise. P γ Proof. It is enough to consider the case when i ∈ I+ . Since fiO = s∈Std(i) γ1s fss γ we are reduced to computing (ψ2O )2 fss , for s ∈ Std(i) and i ∈ I+ . Fix s ∈ Std(i) and let u = (2, 3)s ∈ Std(j). By Proposition 2.37, (ψ2O )2 fss = κi β2 (s)ψ2O fus = −κ2i β2 (s)2 fss . If 3 is in the first row of s then u is not standard so β2 (s) = 0 and (ψ2O )2 fss = 0. In this case, i2 → i3 and y2O fss = 0 = y3O fss , so the lemma holds. The only other possibility is that 3 is in the first column of s, so that ρ2 (s) = 2. Then i2 → i3 if e = 3 and i2 — / i3 if e > 3. Hence, using Definition 2.29 and (2.40), ( −3 t [3]fss , if i2 → i3 (and e = 3), O 2 2 2 (ψ2 ) fss = −κi β2 (s) fss = fss , if i2 — / i3 (and e > 3). Hence, if i2 — / i3 then (ψ2O )2 fiO = fiO as claimed. Finally, if i2 → i3 then (y2O − y3O )fss = (0 − [−e])fss = t−3 [3]fss = (ψ2O )2 fss , where the middle equality holds only because e = 3. This completes the proof.  Remark. The proof of Lemma 2.41 suggests that κi is uniquely determined, for i ∈ I γ . In fact, this is not quite true. What the proof shows is that the value of κi is uniquely determined by the quadratic relation satisfied by ψ2O . For the proof of our main results we only need ψ2O to satisfy a “deformed” version of the quadratic relation for ψ2 in Lemma 2.41. For example, we can obtain slightly hkei different relations by replacing yrO with yr , for some k ∈ Z. Such relations would require a different value for κi . Finally, it remains to check the braid relation for ψ2O and ψ3O . 2.42. Lemma. Suppose that i ∈ I γ . Then  O O O O  (ψ3 ψ2 ψ3 − 1)fi , O O O O O O O ψ2 ψ3 ψ2 fi = (ψ3 ψ2 ψ3 + 1)fiO ,   O O O O ψ3 ψ2 ψ3 fi , if i2 = i4 → i3 , if i2 = i4 ← i3 , otherwise, γ Proof. Again, it is enough to consider the case when i ∈ I+ . We fix s ∈ Std(i) and show that the two sides of the identity in the lemma act in the same way on fss . Let j = (2, 4) · i ∈ I γ . By Lemma 2.38 and Lemma 2.35, ψ2O ψ3O ψ2O fiO = fjO ψ2O ψ3O ψ2O , so ψ2O ψ3O ψ2O fiO = 0 unless j is the residue sequence of a standard tableau. Similarly ψ3O ψ2O ψ3O fiO = 0 unless j is the residue sequence of a standard tableau. Let s↓4 be the subtableau of s containing the numbers 1, 2, 3, 4. Then ) ( 1 2 3 4 1 2 3 1 2 4 1 2 1 2 , s↓4 ∈ , , 4 3 3 4, 3 4 γ since i ∈ I+ . We consider two cases. 28 CLINTON BOYS AND ANDREW MATHAS Case 1: e > 3: Inspecting the list of possibilities for s↓4 , in all cases i2 6= i4 and j 6= res(t) for any standard tableau t. Therefore, ψ2O ψ3O ψ2O fiO = 0 = ψ3O ψ2O ψ3O fiO , in agreement with the statement of the lemma. Case 2: e = 3: Except for the last tableau in the set above, i2 6= i4 and j is not a residue sequence for a standard tableau. Hence, as in Case 1, the lemma holds when i2 6= i4 as both sides are zero. Moreover, if fiO 6= 0 then the case i2 = i4 ← i3 does not arise, so the lemma is vacuously true in this case. It remains to consider the case when i2 = i4 → i3 , which occurs only if s↓4 is the last tableau in the set above. Noting that ψ3O fss = 0, Proposition 2.37 and (2.40) quickly imply that  t3 ψ2O ψ3O ψ2O − ψ3O ψ2O ψ3O fss = −κ2i β2 (s)2 fss = −fss , [3] where the last equality follows using (2.40) exactly as in the proof of Lemma 2.41. This completes the proof.  2.5. The isomorphism Re (An ) ∼ = Hξ (An ). We now have almost everything in place that we need to prove Theorem A. We first prove a stronger version of Theorem 1.9 over O. For this we need the following definition, which should be viewed as an O-deformation of Re (Sn ). The reader should compare this result with Theorem 2.19. 2.43. Definition. Suppose that γ ∈ Qεn . Let ṘγO be the unital associative O-algebra generated by the elements O {ψ̇1O , ψ̇2O , . . . , ψ̇n−1 } ∪ {ẏ1O , ẏ2O , . . . , ẏnO } ∪ {f˙iO | i ∈ I γ } subject to the relations (ẏ1O )(Λ0 ,αi1 ) f˙iO = 0, ẏtO f˙iO = f˙iO ẏtO , ψ̇ O ẏ O f˙O = ẏ O ψ̇ O + δi P ˙O f˙iO f˙jO = δij f˙iO , i∈I γ fi = 1, ẏrO ẏtO = ẏtO ẏrO , ψ̇rO f˙iO = f˙sOr ·i ψ̇rO ,   O ˙ ẏ2O ψ̇1O f˙iO = ψ̇1O ẏ1O + δi1 i2 f˙iO , 1 i2 fi , 1 2 i 1 1   h−ei h−ei + δi2 i3 f˙iO , ẏ3O ψ̇2O f˙iO = ψ̇2O ẏ2 ψ̇2O ẏ3O f˙iO = ẏ2 ψ̇2O + δi2 i3 f˙iO , ψ̇rO ẏtO = ẏtO ψ̇rO , ψ̇rO ψ̇sO = if t 6= r, r + 1, ψ̇sO ψ̇rO , if |r − s| > 1, if r = 1 or r = 2 then (ψ̇rO )2 f˙iO =  O O (ẏr − ẏr+1 )f˙iO ,    (ẏ O − ẏ O )f˙O , r+1  0,    ˙O f , i r i if ir → ir+1 , if ir ← ir+1 , if ir = ir+1 , otherwise,  O O O ˙O  (ψ̇r+1 ψ̇r ψ̇r+1 − 1)fi , if ir = ir+2 → ir+1 , O O O ˙O O O ψ̇r ψ̇r+1 ψ̇r fi = (ψ̇r+1 ψ̇rO ψ̇r+1 + 1)f˙iO , if ir = ir+2 ← ir+1 ,   O O O ˙O otherwise, ψ̇r+1 ψ̇r ψ̇r+1 fi , and if 2 < r < n then O O ẏr+1 ψ̇rO f˙iO = (ψ̇rO ẏrO + δir ir+1 )f˙iO , ψ̇rO ẏr+1 f˙iO = (ẏrO ψ̇rO + δir ir+1 )f˙iO , QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS 29  h1+ρr (i)i γ O (ẏr − ẏr+1 )f˙iO , if ir → ir+1 and i ∈ I+     h1−ρ (i)i γ r O  )f˙iO , if ir ← ir+1 and i ∈ I−  (ẏr+1 − ẏr   h1−ρr (i)i γ (ẏr+1 − ẏrO )f˙iO , if ir ← ir+1 and i ∈ I+ (ψ̇rO )2 f˙iO = h1+ρr (i)i ˙O γ (ẏrO − ẏr+1 )fi , if ir → ir+1 and i ∈ I−      0, if ir = ir+1 ,    ˙O fi , otherwise,  γ O O  − t1+ρr (i) )f˙iO , if ir = ir+2 → ir+1 and i ∈ I+ , ψ̇rO ψ̇r+1 (ψ̇r+1    γ O O 1−ρr (i) ˙O O   ψ̇ ψ̇ + t ) f , if i = i ← i and i ∈ I ( ψ̇ r r+2 r+1 −,  r+1 r r+1 i γ O ˙O O O O O O O ˙ ψ̇r ψ̇r+1 ψ̇r fi = (ψ̇r+1 ψ̇r ψ̇r+1 − 1)fi , , if ir = ir+2 → ir+1 and i ∈ I−   γ O O O O ˙  if ir = ir+2 ← ir+1 and i ∈ I+ , (ψ̇r+1 ψ̇r ψ̇r+1 + 1)fi ,    ψ̇ O ψ̇ O ψ̇ O f˙O , otherwise, r+1 r r+1 i γ for all admissible i, j ∈ I and all admissible r, s and t and where for d ∈ Z ( d O γ (t ẏr − [d])f˙iO , if i ∈ I+ , hdi ˙O ẏr fi = γ d O O ˙ (t ẏr + [d])fi , if i ∈ I− . If F is an O-module let ṘγF = ṘγO ⊗O F. To show that ṘγO is finitely generated as an O-module we need the following technical lemma, which is an analogue of [9, Lemma 4.31]. γ γ 2.44. Lemma. Suppose that 1 ≤ r ≤ n and i ∈ I γ . If i ∈ / I+ ∪ I− then f˙iO = 0 and γ if i ∈ I± then there exists a set Xr (i) ⊆ eZ × N such that Y (ẏrO ∓ [c])m fiO = 0 (c,m)∈Xr (i) in ṘγO . Proof. Arguing exactly as in proof of Lemma 1.16, if i ∈ I γ then f˙iO 6= 0 only if γ γ i1 = 0 and i2 = ±1. That is, f˙iO 6= 0 only if i ∈ I+ ∪ I− . Hence, we may assume γ γ that i ∈ I+ ∪ I− . Checking the relations in Definition 2.43, ṘγO has an automorphism #̇ such that (ψ̇rO )#̇ = −ψ̇rO , (ẏsO )#̇ = −ẏsO O and (f˙iO )#̇ = f˙−i , for all 1 ≤ r < n, 1 ≤ s ≤ n and i ∈ I γ . Therefore, it is enough to consider the γ case when i ∈ I+ . By Definition 2.43, ẏ1O f˙iO = 0, so we may take X1 (i) = {(0, 1)}. As ψ̇1O f˙iO = f˙sO1 ·i ψ̇1O , it follows that ψ̇1O = 0. Therefore, if f˙iO 6= 0 then 0 = (ψ̇1O )2 f˙iO = (ẏ1O − ẏ2O )f˙iO = −ẏ2O f˙iO , so ẏ2O = 0. Hence, we can set X2 (i) = {(0, 1)}, for all i ∈ Iγ. γ Now consider ẏ3O f˙iO , for i ∈ I+ . If i2 = i3 then the commutation relations h−ei O O O O O ˙ for ψ̇2 and ẏ3 give fi = (ẏ3 ψ̇2 − ψ̇2O ẏ2 )f˙iO = (ẏ3O + [−e])ψ̇2O f˙iO since ẏ2O = 0. O O O O Similarly, f˙i = ψ̇2 (ẏ3 +[−e])f˙i . Therefore, f˙iO = (ẏ3O +[e])(ψ̇2O )2 (ẏ3O +[−e])f˙iO = γ 0. Hence, we can assume that i2 6= i3 . If i2 — / i3 and i ∈ I+ then (ẏ3O − [−e])fiO = (ẏ3O − [−e])(ψ̇2O )2 f˙iO = (ẏ3O − [−e])ψ̇2O f˙sO2 ·i ψ̇2O = ψ̇ O (ẏ O + [−e] − [−e])f˙O ψ̇ O = 0. 2 2 s2 ·i 2 30 CLINTON BOYS AND ANDREW MATHAS Hence, if i2 — / i3 set X3 (i) = {(−e, 1)}. Similarly, if i2 → i3 then (ẏ3O − [−e])ẏ3O f˙iO = (ẏ3O − [−e])(ẏ2O − ψ̇2O )2 f˙iO = −(ẏ3O − [−e])(ψ̇2O )2 f˙iO = 0. Consequently, we can set X3 (i) = {(−e, 1), (0, 1)}. The case when i2 ← i3 is similar and easier with X3 (i) = {(0, 1)}. γ The last two paragraphs show that if 1 ≤ r ≤ 3 and i ∈ I+ then there exists a Q O m ˙O set Xr (i) ⊆ eZ × N such that (c,m)∈Xr (i) (ẏr − [c]) fi = 0. If 3 ≤ r < n and γ γ O i ∈ I+ then sr · i ∈ I+ . Moreover, the elements ψ̇3O , . . . , ψ̇n−1 and ẏ4O , . . . , ẏnO satisfy + + + + the same defining relations as ψ3 , . . . , ψn−1 , y4 , . . . , yn . Therefore, the inductive argument in [9, Lemma 4.31] shows that there exists a set Xr (i) ⊂ eZ × N such that Y γ (ẏrO − [c])m f˙iO = 0, for i ∈ I+ and 1 ≤ r ≤ n. (c,m)∈Xr (i) γ (Note that if 1 ≤ r ≤ 3, or if i ∈ I− , then the argument from [9] does not apply O O because ψ̇1 and ψ̇2 satisfy slightly different relations to the corresponding elements considered in that paper.)  Finally, we are able to prove the enhanced version of Theorem 1.9 that we use to prove our main result. If A is an O-algebra let HξA (Sn ) = HtO ⊗O A. 2.45. Theorem. Suppose that γ ∈ Qεn and that (O, t) is the idempotent subring defined in (2.28). Then ṘγO ∼ = HγO as O-algebras. Proof. By the results in Section 2.4, from Proposition 2.31 onwards, there is a unique surjective algebra homomorphism ṘγO ։ HγO such that ψ̇rO 7→ ψrO , ẏsO 7→ ysO and f˙iO 7→ fiO , for 1 ≤ r < n, 1 ≤ s ≤ n and i ∈ I γ . To prove that this map is an isomorphism we use the argument from [9, Theorem 4.32] to show that ṘγO is free as an O-module with the same rank as HγO . First, using the relations in Definition 2.43 it is straightforward to show that O ˙O fi , where fw (ẏ) is a polynomial ṘγO is spanned by elements of the form fw (ẏ)ψ̇w O O γ in O[ẏ1 , . . . , ẏn ], i ∈ I and for each w ∈ Sn we fix a reduced expression w = O = ψ̇rO1 . . . ψrOk . Hence, ṘγO is finitely generated as an O-module sr1 . . . srk and set ψ̇w by Lemma 2.44. Next, let m = xO be the maximal ideal of O and set F = O/m and ξ = t+m ∈ F. Then ξ has quantum characteristic e because if k ∈ Z then [k]t ∈ J (O) = m if and only if k ∈ eZ by Definition 2.11. By Definition 2.43, the relations in ṘγF collapse and become the KLR relations for ReF (Sn )γ given in Definition 1.5. That is, ṘγF ∼ = ReF (Sn )γ as F-algebras. Consequently, dimF ṘγF = dimF ReF (Sn )γ = rankO HγO , where the last equality follows by [3, Theorem 4.20] (alternatively, use Theorem 1.9). Since m is the unique maximal ideal m of O, and ṘγO is finitely generated as an O-module, Nakayama’s Lemma implies that ṘγO is free as an O-module of rank dimF HξF (Sn )γ = rankO HγO . Hence, as an O-module, ṘγO is free of the same rank as HγO . Since HγO is also free over O, it follows that the surjective algebra QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS 31 homomorphism ṘγO ։ HγO given in the first paragraph of the proof is actually an isomorphism and the theorem is proved.  Recalling (2.17), for γ ∈ Qεn define HξF (An )γ = HtO (An )γ ⊗O F. Then HξF (An )γ is a direct summand of HξF (An ) by Corollary 2.18. By construction, F is (isomorphic to) a subfield of F and the algebra HξF (An ) is the F -subalgebra of HξF (An ) generated by the elements T1 , . . . , Tn−1 . By Lemma 2.12 and Proposition 2.16, eγ = fγO ⊗ 1F is central idempotent in HξF (An ). Define HξF (An )γ = HξF (An )eγ . Then HξF (An )γ is the F -subalgebra of HξF (An )γ generated by T1 eγ , . . . , Tn−1 eγ . We are assuming that F is a field and that ξ ∈ F an element of quantum characteristic e. Recall from before Theorem A that a field F is large enough p √ for ξ if F contains squareroots ξ and 1 + ξ + ξ 2 whenever e > 3. (In particular, if e = 3 then any field is large enough for ξ.) 2.46. Theorem. Suppose that γ ∈ Qεn , e > 2 and that ξ ∈ F an element of quantum characteristic e. Let F be a large enough field for ξ of characteristic different from 2. Then HξF (An )γ ∼ = ReF (An )γ . Proof. Let (O, t) be the idempotent subring given in Lemma 2.25, starting from F and ξ, and let F = O/m, where m = xO is the maximal ideal of O. Now ṘγF ∼ = F F Hξ (Sn )γ by Theorem 2.45, so there is an isomorphism of F-algebras Θ : Re (Sn )γ −→ HξF (Sn )γ given by ψr ⊗ 1F 7→ ψrO ⊗ 1F , ys ⊗ 1F 7→ ysO ⊗ 1F and e(i) ⊗ 1F 7→ fiO ⊗ 1F , for 1 ≤ r < n, 1 ≤ s ≤ n and i ∈ I γ . By Corollary 2.30 the following diagram commutes: ReF (Sn )γ Θ # sgn ReF (Sn )γ HξF (Sn )γ Θ HξF (Sn )γ Therefore, Θ restricts to an isomorphism Θ : ReF (An )γ −→ HξF (An )γ . We have now shown that ReF (An )γ and HξF (An )γ are isomorphic over F but, of course, we want the isomorphism over F , which is a subfield of F. Since F is large enough for ξ, by Definition 2.29 the generators of HξF (Sn )γ listed in Proposition 2.31 all belong to HξF (Sn )γ , which we consider as a subalgebra of ReF (Sn )γ . The coefficients in the relations of Definition 2.43 also belong to HξF (Sn )γ . Hence, there is a surjective algebra homomorphism ReF (Sn )γ ։ HξF (Sn )γ . Counting dimensions, this map is an isomorphism so ReF (Sn )γ ∼ = HξF (Sn )γ as F -algebras. Applying Corollary 2.30, as above, it follows that ReF (An )γ ∼ = HξF (An )γ as required.  In view of Corollary 2.18, we obtain Theorem A from the introduction. 32 CLINTON BOYS AND ANDREW MATHAS 2.47. Corollary. Let F be a field of characteristic different from 2 and let ξ ∈ F be an element of quantum characteristic e. Suppose that e > 2 and that F is a large enough field for ξ. Then HξF (An ) ∼ = ReF (An ). Hence, as noted in Corollary A1, the alternating Hecke algebra HξF (An ) is a Z-graded algebra. In particular, F An is a Z-graded algebra when F is large enough for ξ = 1. 3. A homogeneous basis for HξF (An ) We have now proved Theorem A and Theorem B from the introduction. It remains to prove Theorem C, which gives the graded dimension of Re (An ). To do this we give a homogeneous basis for Re (An ) by combining the two graded cellular bases of Re (Sn ) defined by Hu and the second-named author [7]. In order to define these bases we need some definitions. Fix a partition λ ∈ Pn . If A = (r, c) and B = (s, d) are nodes of λ then A is strictly above B, or B is strictly below A, if r < s. Following Brundan, Kleshchev and Wang [4, §1], define integers n o n o i-nodes of λ − # removable i-nodes of λ , dA (λ) = # addable strictly below A strictly below A n o n o addable i-nodes of λ removable i-nodes of λ . dA (λ) = # − # strictly above A strictly above A 3.1. Definition (Brundan, Kleshchev and Wang [4, §1]). Let t be a standard λtableau, for λ ∈ Pn , and let A = t−1 (n). Then the degree deg t and codeg t of t are defined inductively by ( deg t↓(n−1) + dA (λ), if , n > 0, deg t = 1, if n = 0, ( codeg t↓(n−1) + dA (λ), if n > 0, codeg t = 1, if n = 0, Fix λ ∈ Pn . If 1 ≤ m ≤ n and t ∈ Std(λ) let colm (t) = c if m appears in column c of t and let rowm (t) = r if m appears in row r of t. Following [7] set Y Y yλ = ym and yλ′ = ym . 1≤m≤n colm (tλ )≡0 (mod e) 1≤m≤n rowm (tλ )≡0 (mod e) As we are considering the special case when Λ = Λ0 the definitions of yλ and yλ′ from [7] simplify and are equivalent to the formulas above. If t ∈ Std(λ) define permutations d(t) and d′ (t) in Sn by t = d(t)tλ and t = d′ (t)tλ , where Sn acts on t by permuting its entries. For each w ∈ Sn fix a reduced expression w = sr1 . . . srk and define ψw = ψr1 . . . ψrk ∈ Re (Sn ). In general, ψw depends upon the choice of reduced expression for w. 3.2. Definition (Hu and Mathas [7, Definitions 5.1 and 6.9]). Suppose that s, t ∈ Std(λ), for λ ∈ Pn . Set iλ = res(tλ ) and iλ = res(tλ ) and define ∗ ψst = ψd(s) yλ e(iλ )ψd(t) ′ and ψst = ψd′ (s) yλ′ e(iλ )ψd∗′ (t) . ′ By construction, ψst and ψst are homogeneous elements of Re (Sn ). QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS 33 3.3. Remark. For the reasons explained in [8, Remark 3.12], we are following the ′ conventions of [8, 15] here rather than those of [7]. In particular, the element ψst ′ defined above is equal to ψs′ t′ in the notation of [7]. 3.4. Theorem (Hu and Mathas [7] and Li [16]). Let Z be a commutative ring and suppose that e > 2 and n ≥ 0. Then Re (Sn ) is free as a Z-module with ′ homogeneous bases {ψst | s, t ∈ Std2 (Pn )} and {ψst | s, t ∈ Std2 (Pn )}. Moreover, 2 ′ if (s, t) ∈ Std (Pn ) then deg ψst = deg s + deg t and deg ψst = codeg s + codeg t. This result was first proved in [7] with some restrictions on the ring Z. Li’s [16] extension of this result to arbitrary rings is a difficult theorem. A second proof of this result, using geometry, is given in [23]. Although we will not need this, by [7, Theorems 5.8 and 6.11] both of the bases of Theorem 3.4 are graded cellular bases of Re (Sn ) in the sense of Graham and Lehrer [6, 7]. 3.5. Example. Set n = e = 3 and set s= 1 2 3, t= 1 2, 3 u= 1 3 2 1 and v = 2 . 3 Using the definitions, ψss = y3 e(012), ′ ψvv = y3 e(021), ψtt = e(012), ′ ψuu = e(021), ψtu = e(012)ψ2 , ′ ψut = e(021)ψ2 , ψut = ψ2 e(012), ′ ψtu = ψ2 e(021), ψuu = ψ2 e(012)ψ2 , ψtt′ = ψ2 e(021)ψ2 , ψvv = e(021), ′ = e(012). ψss ′ ′ Notice that ψtu = ψ2 e(021) = ψtu , ψuu = ψ22 e(021) = −y3 e(021) = −ψvv and, similarly, ψtt′ = −y3 e(012) = −ψss . Therefore, up to sign, the ψ and ψ ′ bases coincide with the basis of Re (S3 ) given in Example 1.8. ♦ We now use the two homogeneous bases for Re (Sn ) from Theorem 3.4 to construct homogeneous bases for Re (An ). The next result, which follows easily from the definitions, shows that the ψ and ψ ′ -bases are interchanged by the sign automorphism. 3.6. Lemma (Hu and Mathas [8, Proposition 3.26]). Suppose that s, t ∈ Std(Pn ). λ sgn Then ψst = (−1)ℓ(d(s))+ℓ(d(t))+deg t ψs′′ t′ . In particular, deg ψst = deg ψs′′ t′ . In fact, it follows easily from the definitions that deg t = codeg t′ for any standard tableau t. Hence, deg ψs′′ t′ = codeg s′ + codeg t′ = deg s + deg t = deg ψst as claimed. Recall from Proposition 1.19 that Re (Sn )γ ∼ = Rγε = Rγε+ ⊕ Rγε− is a (Z2 × ε+ ∼ Z)-graded algebra and that Re (An )γ = Rγ by Corollary 1.21. To find a basis for Re (An )γ we first give a basis of Re (Sn )γ that is homogeneous with respect to the (Z2 × Z)-grading. 3.7. Definition. Fix e > 2 and λ ∈ Pn . For s, t ∈ Std(λ) define elements sgn Ψ+ st = ψst + ψst sgn and Ψ− st = ψst − ψst . 34 CLINTON BOYS AND ANDREW MATHAS − Fix (s, t) ∈ Std2 (Pn ). By Lemma 3.6, Ψ+ st and Ψst are homogeneous with respect − to the Z-grading on Re (Sn ). Furthermore, by Corollary 1.21, Ψ+ st is even and Ψst ± is odd with respect to the Z2 -grading. Hence, the elements Ψst are homogeneous with respect to the (Z2 × Z)-grading on Re (Sn ). Fix (s, t) ∈ Std2 (Pn ) and set is = res(s) and it = res(t). By [8, (3.13)], if i, j ∈ I n (3.8) e(i)ψst e(j) = δis i δit j ψst ′ ′ and e(i)ψst e(j) = δis i δit j ψst Set ε1 (i) = e(i)− e(−i) and ε0 (i) = ε1 (i)2 = e(i)+ e(−i). Observe that (3.8) implies γ that if i ∈ I+ and (s, t) ∈ Std(Pn ) with is = res(s) ∈ I γ and it = res(t) ∈ I γ then   − − s t    Ψst if i = i ,  Ψst if i = i , (3.9) ε1 (i)Ψ+ −Ψ− if i = −is , and Ψ+ −Ψ− if i = −it , st st ε1 (i) = st st     0, otherwise, 0, otherwise. Since ε1 (−i) = −ε1 (i) and ε0 (i) = ε1 (i)2 , this readily implies the corresponding γ formulas for the action of εa (i) on Ψ± st , for all a ∈ Z2 and i ∈ I . The dominance order on Pn is the partial order D given by λ D µ if k X j=1 λj ≥ k X ̂=1 µj for all k ≥ 0 Write λ ⊲ µ if λ D µ and λ 6= µ. n For λ ∈ Pn define Std+ (λ) = {s ∈ Std(λ) | res(s) ∈ I+ }. We will use this set to index a homogeneous basis for Re (Sn ), with respect to its (Z2 × Z)-grading. The following simple combinatorial result is probably well-known. 3.10. Lemma. Suppose that n ≥ 0. Then X n! | Std+ (λ)| · | Std(λ)| = . 2 λ∈Pn λDλ′ Proof. Implicit in Theorem 3.4, is the well-known fact that n! = Since | Std(λ)| = | Std(λ′ )|, via the map t 7→ t′ , it follows that X n! 1 X = | Std(λ)|2 + | Std(λ)|2 2 2 λ∈Pn λ⊲λ′ = X λ∈Pn λ⊲λ′ P λ∈Pn | Std(λ)|2 . λ∈Pn λ=λ′  X | Std+ (λ)| + | Std+ (λ′ )| · | Std(λ)| + | Std+ (λ)| · | Std(λ)|. λ∈Pn λ=λ′  Recall from Section 1.5 that Deg : Re (Sn ) −→ Z2 × Z is the degree function for the (Z2 × Z)-grading on Re (Sn ). 3.11. Theorem. Let Z be a commutative ring such that 2 is invertible in Z and suppose that e > 2 and n ≥ 0. Then Re (Sn ) is free as a Z-module with basis − {Ψ+ st , Ψst | s ∈ Std+ (λ), t ∈ Std(λ) for λ ∈ Pn }. Moreover, this basis is homogeneous with respect to the (Z2 ×Z)-grading on Re (Sn ). QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS 35 Proof. We have already noted Ψ± st is homogeneous with respect to the (Z2 × Z)grading. More precisely, if (s, t) ∈ Std2 (Pn ) then Deg Ψ+ st = (0, deg s + deg t) and Deg Ψ− st = (1, deg s + deg t). Let Rn be the Z-submodule of Re (Sn ) spanned by the elements in the statement of the theorem. Fix s ∈ Std+ (λ) and t ∈ Std(λ), for some λ ∈ Pn . Since 2 is invertible in Z, ψst =   1 1 + sgn − and ψst = Ψ+ Ψst + Ψ− st st − Ψst . 2 2 sgn 1.16 Hence, ψst , ψs′′ t′ ∈ Rn since ψs′′ t′ = ±ψst by Lemma P P 3.6. Recall from Lemma n n that e(i) 6= 0 only if i ∈ I+ or i ∈ I− . Set e+ = i∈I n e(i) and e− = i∈I n e(i). − + By Theorem 3.4 and (3.8), as Z-modules, n e+ Re (Sn ) = hψst | (s, t) ∈ Std2 (Pn ) and res(s) ∈ I+ iZ ⊆ e+ Rn Similarly, since res(s′ ) = − res(s), Theorem 3.4 also implies that ′ n e− Re (Sn ) = hψst | (s, t) ∈ Std2 (Pn ) and res(s) ∈ I− iZ ⊆ e− Rn . Hence, e+ Rn ⊆ e+ Re (Sn ) ⊆ e+ Rn and e− Rn ⊆ e− Re (Sn ) ⊆ e− Rn , so that Re (Sn ) = e+ Re (Sn ) ⊕ e− Re (Sn ) = e+ Rn ⊕ e− Rn = Rn . We have now shown that the set of elements {Ψ± st } in the statement of the theorem span Re (Sn ). Let F be the field of fractions of Z. Using Lemma 3.10 to count F ∼ dimensions, it follows that {Ψ± st ⊗1F } is a basis of Re (Sn ) = Re (Sn )⊗Z F . Hence, {Ψ± } is Z-linearly independent, completing the proof.  st By Corollary 1.21, Re (An ) is the even component of Re (Sn ), with respect to the Z2 -grading. Hence, we have the following. 3.12. Corollary. Let Z be a commutative ring such that 2 is invertible in Z and suppose that e > 2 and n ≥ 0. Then Re (An ) is free as a Z-module with basis {Ψ+ st | s ∈ Std+ (λ) and t ∈ Std(λ) for λ ∈ Pn }. Moreover, this basis is homogeneous with respect to the Z-grading on Re (An ). 3.13. Example. Continuing the notation of Example 3.5, + Ψ+ ss = Y3 = −Ψuu + Ψ+ tt = 1 = Ψvv + + and Ψ+ tu = Ψ2 = −Ψtu . + + + Hence, {Ψ+ ab | a ∈ Std+ (λ) and b ∈ Std(λ)} = {Ψss , Ψtt , Ψtu } is the basis of Re (An ) ♦ constructed in Example 1.13. L If M = d∈Z Md is a Z-graded module then its graded dimension is the Laurent polynomial X dimq M = (dim Md ) q d ∈ A = N[q, q −1 ], d∈Z where q is an indeterminate over Z. Adding up the degrees of the homogeneous basis elements in Corollary 1.21 gives Theorem C from the introduction. 36 CLINTON BOYS AND ANDREW MATHAS 3.14. Corollary. Let F be a field of characteristic different from 2 and suppose that e > 2 and n ≥ 0. Then the graded dimension of Re (An ) is X X dimq Re (An ) = q deg s+deg t . λ∈Pn s∈Std+ (λ) t∈Std(λ) By (3.9), if γ ∈ Qεn then the basis of Re (An ) given in Corollary 3.12 restricts to give a basis of Re (An )γ . Note that if (s, t) ∈ Std2 (Pn ) and res(s) ∈ I γ then res(t) ∈ I γ . 3.15. Corollary. Fix γ ∈ Qεn and let Z be a commutative ring such that 2 is invertible in Z and suppose that e > 2 and n ≥ 0. Then Re (An )γ is free as a γ 2 Z-module with basis {Ψ+ st | (s, t) ∈ Std (Pn ) for res(s) ∈ I+ }. We next show that Re (An )γ is a graded symmetric algebra. Repeating the arguments leading to Corollary 3.15 we obtain a second homogeneous basis for Re (An )γ . We will use the two homogeneous bases of Re (An )γ to prove that Re (An )γ is graded symmetric. 3.16. Corollary. Fix γ ∈ Qεn and let Z be a commutative ring such that 2 is invertible in Z and suppose that e > 2 and n ≥ 0. Then Re (An )γ is free as a γ 2 Z-module with basis {Ψ+ st | (s, t) ∈ Std (Pn ) for res(s) ∈ I− }. Before we show that the blocks of Re (An ) are graded symmetric algebras we recall some definitions. A trace form on an algebra A is a linear map τ : A −→ F such that τ (ab) = τ (ba), for all a, b ∈ A. The algebra A is symmetric if A is equipped with a non-degenerate symmetric bilinear form θ : A × A → F which is associative in the following sense: θ(xy, z) = θ(x, yz), for all x, y, z ∈ A. A graded algebra A is a graded symmetric algebra if there exists a non-degenerate homogeneous trace form τ : A −→ F . Suppose that A is equipped with a homogeneous anti-isomorphism σ of order 2. In view of [7, Lemma 6.13], giving a nondegenerate trace form τ is equivalent to requiring that the bilinear form ha, bi = τ (abσ ) for all a, b ∈ A is non-degenerate. We work interchangeably with the trace form τ and its associated bilinear form. The algebras Re (Sn ) and Re (An ) are both symmetric algebras but their homogeneous trace forms are defined on the blocks Re (An )γ of these algebras, for γ ∈ Qεn . ′ ′ Recall that Qεn = Q+ n /∼, where α ∼ α if (Λi , α) = (Λ−i , α ), for all i ∈ I. Fix α ∈ Q+ . The defect of α is the non-negative integer n 1 def α = (Λ0 , α) − (α, α), 2 where ( , ) : P + × Q+ −→ Z is the pairing defined in Section 1.3. Hence, if α ∼ α′ then def α = def α′ . Therefore, if γ ∈ Qεn we can define the defect of γ to be def γ = def α, for any α ∈ γ. Set [ Pα = {λ ∈ Pn | iλ ∈ I α } and Pγ = Pα , α∈γ QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS 37 ε for α ∈ Q+ n and γ ∈ Qn . In the usual language from the representation theory of the symmetric groups, the partitions in Pγ have e-weight def γ. The following useful fact is straightforward to establish from the definitions. 3.17. Lemma (Brundan and Kleshchev [4, Lemma 3.11, 3.12]). Let α ∈ Q+ n and suppose that s ∈ Std(Pα ). Then deg s + codeg s = def α. As is well-known and easy to prove (see, for example, [17, Proposition 1.16]), the Iwhahori-Hecke Hξ (Sn ) is a symmetric algebra with trace form τ . Explicitly, P + a T let τα be the if h = w w ∈ Hξ (Sn ) then τ (h) = a1 . For α ∈ Q w∈Sn homogeneous component of τ of degree −2 def α restricted to Hξ (Sn )α . Let h , iα be the homogeneous bilinear form associated with τ . Let ⋆ be the unique homogeneous anti-isomorphism of Re (Sn ) that fixes each of ⋆ ′ ⋆ ′ the generators of Re (Sn ). Then ψst = ψts and (ψst ) = ψts , for all (s, t) ∈ Std2 (Pn ). The following result was first proved in [7]. 3.18. Theorem (Hu and Mathas [7, Theorem 6.7]). Suppose that α ∈ Q+ n and that F is a field. Then the KLR algebra Re (Sn )α is a graded symmetric algebra with homogeneous bilinear form h , iα of degree −2 def α. Moreover, if s, t ∈ Std(λ) and u, v ∈ Std(µ) then ( cst , if (u, v) = (s, t), ′ hψst , ψuv iα = 0, if (u, v) 4 (s, t), where cst is a non-zero element of F that depends only on s and t. sgn L Recall from (1.14) that Re (An )γ = . We will use the bilinα∈γ Re (Sn )α ear forms on Re (Sn )α , for α ∈ γ, to define a bilinear form on Re (An )γ . We do not take the obvious extension of these forms to Re (Sn )γ , however, because P the arguments below require a sgn-invariant form. If h ∈ Re (Sn )γ then h = i∈I γ e(i)hi . Hence, define the trace form τγ : Re (Sn )γ −→ F by (  γ α if i ∈ I+ ⊆ I+ , τα e(i)h ,   (3.19) τγ e(i)h = γ sgn α τα′ e(−i)h , if i ∈ I− ⊆ I− . Importantly, τγ (h) = τγ (hsgn ), for all h ∈ Re (Sn )γ . Let h , iγ be the corresponding bilinear form on Re (Sn )γ . Extend the dominance ordering D to standard tableaux by defining sDt if Shape(s↓m ) D Shape(t↓m ) for 1 ≤ m ≤ n, for s, t ∈ Std(Pn ). We can now prove that Re (An )γ is a graded symmetric algebra. 3.20. Theorem. Let F be a field of characteristic different from 2 and suppose that e > 2 and γ ∈ Qεn . Then Re (An )γ is a graded symmetric algebra with homogeneous bilinear form h , iγ of degree −2 def γ. Proof. By Theorem 3.20 and the definitions above, h , iγ is a (not necessarily associative) homogeneous bilinear form on Re (Sn )γ of degree −2 deg γ. By restriction, we can consider h , iγ as a bilinear form on Re (An )γ . By construction, h , iγ is an associative bilinear form on Re (An ). We need to show that h , iγ is non-degenerate on Re (An )γ . To do this we use the two bases of Re (An )γ given by Corollary 3.15 and Corollary 3.16. Fix λ, µ ∈ Pn γ γ and tableaux s, t ∈ Std(λ), u, v ∈ Std(µ) with res(s) ∈ I+ and res(u) ∈ I− . By 38 CLINTON BOYS AND ANDREW MATHAS assumption, res(s) 6= res(u) so hψst , ψuv iγ = τγ (ψst ψvu ) = τγ (ψvu ψst ) = 0 by (3.8). sgn sgn Hence, hψst , ψuv iγ = τγ (ψst ψvu ) = 0. Therefore, + sgn sgn hΨ+ st , Ψuv iγ = hψst + ψst , ψuv + ψuv iγ = hψst , ψuv iγ + hψst , ψuv iγ ( ±2cst , if (u′ , v′ ) = (s, t), sgn = 2τγ (ψst ψuv )= 0, if (u′ , v′ ) 4 (s, t). sgn sgn The second last equality follows because τγ (h) = τγ (hsgn ) for h ∈ Re (Sn )γ , by sgn (3.19), and the last equality follows from Theorem 3.20, since ψuv = ±ψu′ ′ v′ by + Lemma 3.6. Hence, by ordering the two bases {Ψst } and {Ψ+ uv } in a way that is compatible with dominance and reverse dominance, respectively, it follows that  + the Gram matrix hΨ+ st , Ψuv iγ is triangular with non-zero entries on the diagonal. Therefore, h , iγ is a non-degenerate associative bilinear form on HξF (An )γ of degree −2 def γ, so the theorem is proved.  Finally, we describe the blocks and irreducible modules of HξF (An ). R (S ) Let Res = ResRee (Ann) be the restriction functor from the category of finitely generated graded Re (Sn )-modules to the the category of finitely generated graded Re (An )-modules. Let Rn = {µ ∈ Pn | µr − µr+1 < e for all r ≥ 1} be the set of e-restricted partitions of n. By [2, Theorem 4.11], there is a unique self-dual irreducible graded Re (Sn )-module Dµ for each e-restricted partition µ and {Dµ hdi | µ ∈ Rn and d ∈ Z} is a complete set of pairwise non-isomorphic irreducible graded Re (Sn )-modules. By [7, Corollary 5.11], the module Dµ arises as a quotient of the corresponding graded Specht module [4, 7]. If M is an Re (Sn )-module let M sgn be the Re (Sn )-module that is isomorphic to M as a vector space but where the Re (Sn )-action is twisted by sgn. By [18, Theorem 3.6.6], (Dµ )sgn ∼ = Dm(µ) where m : Rn −→ Rn is the Mullineux map. Therefore, a straightforward application of Clifford theory implies that if µ 6= m(µ) then Res Dµ ∼ = Res Dm(µ) is an irreducible graded Re (An )-module and if µ = m(µ) µ µ then, over an algebraically closed field, Res Dµ = D+ ⊕ D− , for non-isomorphic µ µ irreducible graded Re (An )-modules D+ and D− . Set Rm⊲ = {µ ∈ Rn | m(µ) ⊲ µ} n and Rm n = {µ ∈ Rn | µ = m(µ)}. Clifford theory implies that every irreducible graded Re (An )-module arises in the manner described above, so we obtain the following. 3.21. Theorem. Suppose that F is an algebraically closed field of characteristic different from 2 and that e > 2. Then µ µ m {Dµ hdi | d ∈ Z and µ ∈ Rm⊲ n } ∪ {D+ hdi, D− hdi | d ∈ Z and µ ∈ Rn }. is a complete set of pairwise non-isomorphic irreducible graded Re (An )-modules. In the semisimple case, Rn = Pn and m(µ) = µ′ . If µ ∈ Pn and µ = µ′ then µ µ [19, Proposition 3.9] gives an explicit construction of the modules D+ and D− over the field of fractions K of the idempotent subring O from Definition 2.23. QUIVER HECKE ALGEBRAS FOR ALTERNATING GROUPS 39 Finally we turn to the blocks of Re (An ). By Corollary 1.15, M Re (An ) = Re (An )γ , γ∈Qεn where Re (An )γ is a two-sided graded ideal of Re (An ). Our last result says that if γ ∈ Qεn then Re (An )γ is a block, or indecomposable two-sided ideal, of Re (An ) except when def γ = 0 and |γ| = 1. In the traditional language of the symmetric groups, def γ = 0 if and only if the partitions in Pγ are e-cores and, in this case, |γ| = 1 if and only if Pγ = {µ}, where µ = m(µ) is a Mullineux self-conjugate partition. As µ is an e-core, Dµ is an irreducible Specht module and Res Dµ = µ µ D+ ⊕ D− , similar to the situation considered in the last paragraph. 3.22. Theorem. Suppose that F is a field of characteristic different from 2 and that e > 2. Let γ ∈ Qεn . Then: a) If |γ| = 2 or def γ > 0 then ReF (An )γ is an indecomposable two-sided graded ideal of ReF (An ). b) If F is algebraically closed, |γ| = 1 and def γ = 0 then ReF (An )γ is a direct sum of two conjugate matrix algebras. Proof. This follows by the general theory of covering blocks for Z2 -graded algebras as can be found, for example, in [24]. In more detail a block A of Hξ (Sn ) covers a block B of Re (An ) if B is a direct summand of the restriction of A to Re (An ). Since |Z2 | = 2 the blocks of Re (An ) are covered by at most two blocks of Hξ (Sn ) and, in particular, Re (An )γ is indecomposable if |γ| = 2. If |γ| = 1 and def γ > 0 then there exists a partition µ ∈ Rn ∩ Pγ such that µ 6= m(µ) ∈ Pγ . Therefore, Re (An )γ is a self-conjugate block, so that it is indecomposable. Finally, if F is algebraically closed, def γ = 0 and |γ| = 1 then Re (An )γ is the direct sum of two matrix algebras, in view of the remarks in the paragraph before the theorem.  References [1] C. Boys, Alternating quiver Hecke algebras, PhD thesis, University of Sydney, 2014. [2] J. Brundan and A. Kleshchev, Blocks of cyclotomic Hecke algebras and Khovanov-Lauda algebras, Invent. Math., 178 (2009), 451–484. [3] , Graded decomposition numbers for cyclotomic Hecke algebras, Adv. Math., 222 (2009), 1883–1942. [4] J. Brundan, A. Kleshchev, and W. Wang, Graded Specht modules, J. Reine Angew. Math., 655 (2011), 61–87. arXiv:0901.0218. [5] J. Brundan and C. Stroppel, Highest weight categories arising from Khovanov’s diagram algebra I: cellularity, Mosc. Math. J., 11 (2011), 685–722, 821–822. arXiv:0806.1532. [6] J. J. Graham and G. I. Lehrer, Cellular algebras, Invent. Math., 123 (1996), 1–34. [7] J. Hu and A. Mathas, Graded cellular bases for the cyclotomic Khovanov-Lauda-Rouquier algebras of type A, Adv. Math., 225 (2010), 598–642. arXiv:0907.2985. [8] , Quiver Schur algebras for linear quivers, Proc. Lond. Math. Soc. (3), 110 (2015), 1315–1386. arXiv:1110.1699. , Seminormal forms and cyclotomic quiver Hecke algebras of type A, Math. Ann., 364 [9] (2016), 1189–1254. arXiv:1304.0906. [10] N. Iwahori, On the structure of a Hecke ring of a Chevalley group over a finite field, J. Fac. Sci. Univ. Tokyo Sect. I, 10 (1964), 215–236 (1964). [11] G. James, The representation theory of the symmetric groups, Lecture Notes in Mathematics, 682, Springer, Berlin, 1978. [12] G. James and A. Mathas, A q-analogue of the Jantzen-Schaper theorem, Proc. London Math. Soc. (3), 74 (1997), 241–274. 40 CLINTON BOYS AND ANDREW MATHAS [13] V. G. Kac, Infinite-dimensional Lie algebras, Cambridge University Press, Cambridge, third ed., 1990. [14] M. Khovanov and A. D. Lauda, A diagrammatic approach to categorification of quantum groups. I, Represent. Theory, 13 (2009), 309–347. [15] A. Kleshchev, A. Mathas, and A. Ram, Universal graded Specht modules for cyclotomic Hecke algebras, Proc. Lond. Math. Soc. (3), 105 (2012), 1245–1289. arXiv:1102.3519. [16] G. Li, Integral Basis Theorem of cyclotomic Khovanov-Lauda-Rouquier algebras of Type A, 2014. arXiv:1412.3747. [17] A. Mathas, Iwahori-Hecke algebras and Schur algebras of the symmetric group, University Lecture Series, 15, American Mathematical Society, Providence, RI, 1999. [18] , Cyclotomic quiver Hecke algebras of type A, in Modular representation theory of finite and p-adic groups, G. W. Teck and K. M. Tan, eds., National University of Singapore Lecture Notes Series, 30, World Scientific, 2015, ch. 5, 165–266. arXiv:1310.2142. [19] A. Mathas and L. Neves, The irreducible characters of the alternating Hecke algebra, 2015, preprint. arXiv:1605.02859. [20] H. Mitsuhashi, The q-analogue of the alternating group and its representations, J. Algebra, 240 (2001), 535–558. [21] G. E. Murphy, The idempotents of the symmetric group and Nakayama’s conjecture, J. Algebra, 81 (1983), 258–265. [22] R. Rouquier, 2-Kac-Moody algebras, 2008, preprint. arXiv:0812.5023. [23] C. Stroppel and B. Webster, Quiver Schur algebras and q-Fock space, 2011, preprint. arXiv:1110.1115. [24] S. J. Witherspoon, A module-theoretic approach to Clifford theory for blocks, Proc. Amer. Math. Soc., 128 (2000), 661–670. School of Mathematics and Statistics F07, University of Sydney, NSW 2006, Australia. E-mail address: [email protected] E-mail address: [email protected]
4math.GR
Energy Saving Additive Neural Network Arman Afrasiyabi1? , Ozan Yildiz1? , Baris Nasir1 , Fatos T. Yarman Vural1 and A. Enis Cetin2 1 Computer Engineering Department, Middle East Technical University, Ankara, Turkey Email: {afrasiyabi.arman, oyildiz, bnasir, vural}@ceng.metu.edu.tr ? Equal contribution arXiv:1702.02676v1 [cs.NE] 9 Feb 2017 2 Electrical and Electronics Engineering, Bilkent University, Ankara, Turkey Email: [email protected] Abstract—In recent years, machine learning techniques based on neural networks for mobile computing become increasingly popular. Classical multi-layer neural networks require matrix multiplications at each stage. Multiplication operation is not an energy efficient operation and consequently it drains the battery of the mobile device. In this paper, we propose a new energy efficient neural network with the universal approximation property over space of Lebesgue integrable functions. This network, called, additive neural network, is very suitable for mobile computing. The neural structure is based on a novel vector product definition, called ef-operator, that permits a multiplierfree implementation. In ef-operation, the ”product” of two real numbers is defined as the sum of their absolute values, with the sign determined by the sign of the product of the numbers. This ”product” is used to construct a vector product in RN . The vector product induces the l1 norm. The proposed additive neural network successfully solves the XOR problem. The experiments on MNIST dataset show that the classification performances of the proposed additive neural networks are very similar to the corresponding multi-layer perceptron and convolutional neural networks (LeNet). I. I NTRODUCTION Artificial Neural Networks (ANN) have been shown to solve many real world problems, such as, computer vision, natural language processing, recommendation systems and many other fields [1]. Convolutional Neural Network (CNN) architectures achieve human performance in many computer vision problems including image classification tasks [2], [3], [4], [5], [6]. However, the number of parameters in these highperformance networks ranges from millions to billions which require computers capable of handling high computational complexity, high energy and memory size. Consequently, the minimal computational environment for such a network is a desktop computer with a powerful CPU and a dedicated highend GPU. Recent developments in VLSI industry create powerful mobile devices which can be used in many practical recognition applications. ANNs are already being used in drones and unmanned aerial vehicles for flight control, path estimation [7], obstacle avoidance and human recognition like abilities [8] (DJI Phantom 4). However, the current structure of the ANNs, especially, deep networks, prohibits us to implement these algorithms effec- tively on mobile devices due to high energy requirements. A typical neuron needs to perform three main tasks to produce an output: (i) an inner product operation involving multiplication of inputs by weights, (ii) addition, and (iii) pass the result of the inner product through an activation function. According to the [9], the multiplication operation is the most energy consuming operation. In this paper, we propose an l1 norm based energy efficient neural network, called additive neural network, that replaces the multiplication operation with a new energy efficient operator, called ef-operator. Instead of multiplications, we use sign multiplications and addition operations in a typical neuron. The sign multiplication of two real numbers is a simple bit operation. An addition consumes relatively lower energy compared to a regular multiplication as shown in [9] in most processors. Our object recognition experiments on MNIST and CIFAR datasets show that we are able to match the performance of the state of the art neural networks without performing any other changes on the ANN structure. In Section 2, we review the related work in energy efficient neural network design. In Section 3, we define a new vector product and the corresponding operator, called ef-operator. In Section 4, we introduce the additive neural network, based on the ef-operator. In Section 5, we made a brief analysis for the existence and convergence problems of the proposed additive neural network. Section 6, provides the experimental results to compare the performance of the proposed additive neural network with multi-layer perceptron and convolutional neural networks. Finally, Section 7 concludes the paper. II. R ELATED W ORK Due to large size of the parameter space, artificial neural networks are generally computationally prohibitive and become inefficient in terms of energy consumption and memory allocation. Several approaches from different perspectives have been proposed to design computationally efficient neural network structures to handle high computational complexity. We first introduced the l1 norm based vector product for some image processing applications in 2009 [10], [11], [12], [13]. We also proposed the multiplication free neural network structure in 2015 [14]. However, the recognition rate was below 10%of a regular neural network. In this article, we are able to match the performance of regular neural networks by introducing a scaling factor to the l1 norm based vector product and new training methods. We are only 0.034% below the recognition rate of a regular neural network in MNIST dataset. Other solutions to energy efficient neural networks include dedicated software for a specific hardware, i.e. neuromorphic devices [15], [16], [17], [18], [19]. Although such approaches reduces energy consumption and memory usage, they require special hardware. Our neural network framework can be implemented in ordinary microprocessors and digital signal processors. Sarwar et al. used the error resiliency property of neural networks and proposed an approximation to multiplication operation on artificial neurons for energy-efficient neural computing [20]. They approximate the multiplication operation by using the Alphabet Set Multiplier (ASM) and Computation Sharing Multiplication (CSHM) methods. In ASM, the multiplication steps are replaced by shift and add operators which are performed by some alphabet defined by a pre-computer bank. This alphabet is basically a subset of the lower order multiplies of the input. The multiplies that are not exist in the computed subset are approximated by rounding them to nearest existing multiplies. This method reduces the energy consumption since addition and bit shifting operations are much efficient than the multiplication. Therefore, the smaller sized alphabets result in a more efficient architecture. Additionally, they define a special case called Multipler-less Artificial Neuron (MAN), in which there is only one alphabet for each layer. This method provides more energy efficiency with a minimum accuracy loss. It should be noted that this method is applied on test stages, therefore, the training step still uses the conventional method. Han et al. proposed a model that reduces both computational cost and storage by feature learning [9]. Their approach consists of three steps. In the first step, they train the network to discriminate important features from redundant ones. Then, they remove the redundant weights, and occasionally neurons, according to a threshold value to obtain a sparser network. This step reduces the test step’s cost. At the final step they retrain the network to fine tune the remaining weights. They state that this step is much more efficient than using the fixed network architecture. They tested the proposed network architecture with ImageNet and VGG-16. The parameter size for these networks reduces between ×9 to ×13 without any accuracy loss. Abdelsalam et al. approximate the tangent activation function using the Discrete Cosine Transform Interpolation Filter (DCTIF) to run the neural networks on FPGA boards efficiently [21]. They state that DCTIF approximation reduces the computational complexity at the activation function calculation step by performing simple arithmetic operations on stored samples of the hyperbolic tangent activation function and input set. The proposed DCTIF architecture divides the activation function into three regions, namely, pass, process and sat- uration regions. In the pass region the activation function is approximated by y = x and in the saturation region the activation function is taken as y = 1. The DCTIF takes place in the process region. Parameters of the transformation should be selected carefully to find a balance between computational complexity and accuracy. They have shown that the proposed method achieve significant decrease on energy consumption while keeping the accuracy difference within 1% with conventional method. Rastegari et al. proposes two methods to provide efficiency on CNNs. The first method, Binary-Weight-Networks, approximates all the weight values to binary values [22]. In this way the network needs less memory (nearly ×32). Since the weight values are binary, convolutions can be estimated by only addition and subtraction, which eliminates the main power draining multiplication operation. Therefore, this method both provides energy efficiency and faster computations. The second method proposed by them is called XNORNetworks where both weights and inputs to the convolutional and fully connected layers are approximated by binary values. This extends the earlier proposed method by replacing addition and subtraction operations with XNOR and bitcounting operations. This method offers ×58 faster computation on CPU on average. While this method enables us to run CNNs on mobile devices, it costs 12% loss accuracy on average. III. A N EW E NERGY E FFICIENT O PERATOR Let x and y be two vectors in Rd . We define an new operator, called ef-operator, as the vector product of x and y as follows; x  y := d X sign(xi × yi )(|xi | + |yi |), (1) i=1 which can also be represented as follows; x  y := d X sign(xi )yi + sign(yi )xi , (2) i=1 where x = [x1 , . . . , xd ]T , y = [y1 , . . . , yd ]T ∈ Rd . The new vector product operation does not require any multiplications. The operation (xi × yi )(|xi | + |yi |) uses the sign of the ordinary multiplication but it computes the sum of absolute values of xi and yi . ef-operator, , can be implemented without any multiplications. It requires summation, unary minus operation and if statements which are all energy efficient operations. Ordinary inner product of two vectors induces the `2 norm. Similarly, the new vector product induces a scaled version of the `1 norm: xx= d X sign(xi × xi )(|xi | + |xi |) = 2||x||1 (3) i=1 Therefore, the ef-operator performs a new vector product, called `1 product of two vectors, defined in Eq. 1. We use following notation for a compact representation of ef-operation of a vector by a matrix. Let x ∈ Rd and W ∈ Rd×M be two matrices, then the ef-operation between W and x is defined as follows;  x  W := x  w1 ... x  wM T ∈ RM , the only difference in the additive neural network training is the computation of the derivatives of the argument, (a (x  W) + b), of the activation function with respect to the parameters, W, a, b, and input, x, as given below: ∂(a (4) where wj is jth column of W for j = 1, 2, . . . , M . We propose a modification to the representation of a neuron in a classical neural network, by replacing the vector product of the input and weight with the l1 product defined in efoperation. This modification can be applied to a wide range of artificial neural networks, including multi-layer perceptrons (MLP), recurrent neural networks (RNN) and convolutional neural networks (CNN). A neuron in a classical neural network is represented by the following activation function; (5) where W ∈ Rd×M , b∈ RM are weights and biases, respectively, and x ∈ Rd is the input vector. A neuron in the proposed additive neural network is represented by the activation function, where we modify the affine transform by using the ef-operator, as follows; f (a (x  W) + b), (7) (x  W) + b) = IM , ∂b (8) (∂a IV. A DDITIVE N EURAL N ETWORK WITH EF - OPERATOR f (xW + b), (x  W) + b) = Diag(x  W), ∂a (6) where is element-wise multiplication operator, W ∈ Rd×M , a, b ∈ RM are weights, scaling coefficients and biases, respectively, and x ∈ Rd is the input vector. The neural network, where each neuron is represented by the activation function defined in Eq. 6, is called additive neural network. Comparison of Eq. 5 and Eq. 6 shows that the proposed additive neural networks are obtained by simply replacing the affine scoring function (xW+b) of a classical neural network by the scoring function function defined over the ef-operator, (a (x  W) + b). Therefore, most of the neural networks can easily be converted into the additive network by just representing the neurons with the activation functions defined over ef-operator, without modification of the topology and the general structure of the optimization algorithms of the network. A. Training the Additive Neural Network Standard back-propagation algorithm is applicable to the proposed additive neural network with small approximations. Back-propagation algorithm computes derivatives with respect to current values of parameters of a differentiable function to update its parameters. Derivatives are computed iteratively using previously computed derivatives from upper layers due to chain rule. Activation function, f , can be excluded during these computations for simplicity as its derivation depends on the specific activation function and choice of activation function does not affect the remaining computations. Hence,  ∂(a  a1 (sign(Wi,1 ) + 2Wi,1 δ(xi )) (x  W) + b)   .. =  . ∂xi aM (sign(Wi,M ) + 2Wi,M δ(xi )) ≈a sign(wi ), (9) (x  W) + b) =(aj (sign(xi ) + 2xi δ(Wi,j )))ej ∂Wi,j ≈ aj xi ej , (10) where a, b ∈ RM , and W ∈ Rd×M are the parameters of the hidden layer, x ∈ Rd is the input of the hidden layer, M ei ∈ RM is the ith element of standard PM basis of R , wi is the ith column of W, sign(wi ) = j=1 sign(Wi,j )ej for i = 1, . . . , M , δ is the dirac delta function. The above derivatives can be easily calculated using the following equation suggested by [23]: ∂(a d sign(x) = 2δ(x). (11) dx Approximations to derive the above equation are based on the fact that δ(x) = 0, almost surely. B. Existence and Convergence of the Solution in Additive Neural Network In this section, first, we show that the proposed additive neural network satisfies the universal approximation property of [24], over the space of Lebesgue integrable functions. In other words. there exists solutions computed by the proposed additive network, which is equivalent to the solutions obtained by activation function with classical vector product. Then, we make a brief analysis for the convergence properties of the back propagation algorithm when the vector product is replaced by the ef-operators. 1) Universal Approximation Property: The universal approximation property of the suggested additive neural network is to be proved for each specific form of the activation function. In the following proposition, we suffice to provide the proofs of universal approximation theorem for linear and ReLU activation functions, only. The proof (if it exits) for a general activation function requires a substantial amount of effort, thus it is left to a future work. Proposition IV.1. The additive neural network, defined by the neural activation function with identity  f (a (x  W) + b) = a (x  W) + b,  y1 (x1 + sign(x1 ))  y1 (x1 + sign(x1 ))    y1 (x1 + 2sign(x1 ))   (x  W1 ) + b1 =    y2 (x2 + sign(x2 ))   y2 (x2 + sign(x2 ))  y2 (x2 + 2sign(x2 )) (15) (12) h1 = a1 or an activation function with Rectified Linear Unit, h2 = a2 f (a (x  W) + b) = ReLU (a (x  W) + b), (13) h4 = a3 is dense in L1 (In ). In order to prove the above proposition, the following two lemmas are proved first: Lemma IV.2. If activation function f is taken as identity (as in Eq. 12), then there exist additive neural networks, defined over the ef-operator, which can compute f (x) = sign(yT x + b), for any y ∈ Rd and b ∈ R. Proof. Constructing an additive neural network, defined over ef-operator, is enough to prove the lemma. We can construct explicitly a sample network for any given y ∈ Rd and b ∈ R. One such network consists of four hidden layers for d = 2, this network can easily extended into higher dimensions. Let x be [x0 , x1 ]T and y be [y0 , y1 ]T , then four hidden layers with following parameters can compute f (x) = sign(yT x + b). • • • • h3 = a3 Hidden layer 1, a1 = [y1 , y1 , y1 , y2 , y2 , y2 ]T , T b1 = [0,  0, 0, 0, 0, 0] ,  1 1 2 0 0 0 W1 = . 0 0 0 1 1 2 Hidden layer 2, a2 = [1], b2 = [b],  T W2 = 1 1 −2 1 1 −2 . Hidden  layer T3, a3 = 1 1 ,  T b3 = 0 0  , W3 = 2 1 . Hidden layer 4, a4 = [1], b4 = [0],  T 1 W4 = . −1 (h1  W2 ) + b2 = yT x + b   h + 2sign(h2 ) (h2  W3 ) + b3 = 2 h2 + sign(h2 ) (h3  W4 ) + b4 = sign(yT x + b) Lemma IV.3. If the function g(x) can be computable with activation function f (a (x  W) + b, (16) then there exist an additive neural network architectures with a Rectified Linear Unit activation function, f (a (x  W) + b) = ReLU (a (x  W) + b), (17) which can also compute g(x). Proof. This lemma can be proven using the following simple observations, • Observation 1: If (x  w) + b, g(x) = a (18) then, − g(x) = a0 • (x  w0 ) + b0 , (19) where a0 = a, w0 = −w, and b0 = −b. Observation 2: If g(x) = a (x  w) + b, (20) ((−x)  w00 ) + b00 , (21) then, g(x) = a00 • where a0 = a, w0 = −w, and b0 = b. Observation 3: If g(x) = a The function computed by this network can be simplified using the fact that, ∀a, u ∈ R and ∀b ∈ R+ , (14) Then, the hidden layers h1 , h2 , h3 and h4 can be represented as follows; (x  w) + b, (22) then, g(x) = a000 sign(a(u + bsign(u))) = sign(au). (x  W) + b) = a (ReLU (x)  w + ReLU (−x)  w000 ) + b000 , (23) where a000 = a, w000 = −w, and b000 = b. Lets assume that there exists an additive neural network, defined over the ef-operator, using identity as activation function which can compute the function g(x). We can extend each Fig. 1: The plots of loss changes in the stochastic gradient descent (SGD) algorithm in the training phase of XOR problem while using single hidden layer MLP. While the Figure (1.a) shows the the changes of loss in the network by using classical score function (c-operator), Figure (1.b) shows the loss changes in the same network with our proposed (ef-operator). The results have been obtained by training the network 200 times in 1000 epochs which are shown by different colors. layer using Observation 1, to compute both g(x) and −g(x). Afterwards, we can replace zeros on the weights introduced during previous extension on each layer using Observation 3, to replace the activation function with ReLU. This works, because either ReLU (x) or ReLU (−x) is 0. The modified network is an additive neural network with ReLU activation function, which can compute the function g(x). Proof of Proposition IV.1. This can be shown by the universal approximation theorem for bounded measurable sigmoidal functions [24]. This theorem states that finite sums of the form N N G(x; {αi }N i=1 , {yi }i=1 , {θi }i=1 ) = N X αi σ(yiT x + θi ), (24) multiplication operator. A classical neural network, represented by the activation function f (xW + b), containing M neurons with d dimensional input, requires d × M many multiplication operator to compute xW + b. On the other hand, the additive neural network, represented by the activation function, f (a (xW)+b) with the same number of neurons and input space requires M many multiplication operator to compute a (x  W) + b. This reduction on number of multiplications is especially important when input size is large or hidden layer contains large number of neurons. If activation function is taken as either identity or ReLU, then output of this layer can be computed without any complex operations, and efficiency of the network can be substantially increased. Multiplications can be removed entirely, if scaling coefficients, a are taken as 1. However, these networks may not represent some functions, and consequently may perform poorly on some datasets. 3) Optimization problems: Due to the sign operation performed in each neuron, the ef-operator creates a bunch of hyperoctants in the cost function at each layer of the additive neural network. Therefore, the local minima computed at each layer, depends on the specific hyperoctant for a set of weights. The change in the signs results in a jump from a hyperoctant to another one. For some datasets, some of the local minima may lie on the boundaries of the hyperoctants. Since the hyperoctants are open sets, this may leave some hyperoctands with nonexisting local minima. A gradient based search algorithm may update the weights such that the algorithm converges to the local minima on the boundary. If the step size and number of epochs are increased, then the updated weights leave the current hyperoctant without converging to a local minima on the boundary and new set of weights make the algorithm to converge to a local minima in another hyperoctant. However, the new hyperoctant may have the same problem. i=1 1 are dense in L (In ), where αi , θi ∈ R and x, yi ∈ Rd for i = 1, 2, . . . , N . It can be easily shown that sign function is a bounded sigmoidal function. Lemma IV.2 shows that, if the activation function is taken as identity, then there exist networks which compute sign(yiT x+θi ) for i = 1, 2 . . . , N . Lemma IV.3 shows that there are equivalent networks using ReLU as the activation function which compute the same functions. These networks can be combined with concatenation of layers of the additive neural networks to a single network. Also, proposed architecture contains fully connected linear layer at the output, and this layer can compute superposition of the computed sign functions yielding G(x). Since G(x) can be computable by the additive neural networks, and G(x) functions are dense in L1 (In ), then functions computed by the additive neural networks are also dense in L1 (In ). 2) Computational efficiency: The proposed additive neural network contains more parameters then the classical neuron representation in MLP architectures. However, each hidden layer can be computed using considerably less number of V. E XPERIMENTAL R ESULTS Multi-layer perceptron (MLP) [25] is used to measure the ability of the proposed additive neural network, in machine learning problems. MLP consists of a single input and output layer and multiple hidden layers. The size and the number of hidden layers can vary a great deal, depending on the problem domain. In this research, we use one, two and three hidden layers, respectively, in two different classification problems, namely XOR problem and character recognition of MNIST dataset. The input layer receives pattern sample x ∈ RD to the network. On the other hand, the hidden layer(s) contains biological inspired units called neurons which learns a new representations from the input patterns. Each neuron consists of a scoring function and an activation function. As discussed in the Section IV, the scoring function is an affine transform in the form of (xW + b) in the classic neural network where x and b are the parameters. In this study, we call the widely used classic scoring function (xW +b) as c-operator. As discussed Fig. 2: Plots of classification accuracies in different architectures with different score functions. Subplots (a) and (b) shows the results of MLP with 2 and 3 hidden layers using classic c-operator. Subplots (c) and (d) shows the results of MLP with 2 and 3 hidden layers using our proposed ef-operator. in the Section III and IV, the proposed score function, efoprerator, is an energy efficient alternative of the classical vector product. In addition to the score function, each neuron of a hidden layer also has an activation function that makes the network nonlinear. Several activation functions such as sigmoid, hyperbolic tangent (Tanh) and rectified linear unit (ReLU) functions have been used as the activation function. While some studies such as [3] have shown that ReLU outperform the others in most of the cases, we also examined sigmoid and Tanh in the following experiments. Finally, the last layer of MLP, called output layer, maps the final hidden layer to the scores of the classes by using its own score function. We used both the classical c-operator and the new ef-operator at the output layer to make the final decision. The aim of MLP is to find the optimal values for parameters W and b using backpropagation [26] and optimization algorithms such as stochastic gradient descent (SGD). In order to implement the network, Tensorflow [27], a python library for numeric computation, is used. In the first experiment, we examine the ability of additive neural network to partition a simple nonlinear space, solving the XOR problem. We compare the classical MLP with affine scoring function and additive neural network with ef-operator. Since a single hidden layer MLP with c-operator can solve XOR problem, we used one hidden layer in both classical and the proposed architectures. Mean squared error is used as cost function to measure the amount of loss in training phase of the network, and we fixed the number of neurons in the hidden layer to 10. The additive neural network with ef-operator could successfully solve the XOR problem and reached to 100% accuracy in this problem. We also investigate the rate of changes inloss changes at each epoch. It is also notable that some of the runs that are shown by colors, do not reach to minimum values in 1000 epochs. This shows that more epochs is needed in some runs. Generally, the number of epochs depends on learning rate and initialization condition, and the final epoch can be determined by some stopping criteria. However, in this study, we are only interested to see the variations in the cost; therefore, we fixed the number of epochs to 1000. Left and right sides of Fig. 1 show the change of loss in the MLP using c-operator and ef-operator, respectively, with ReLU as the activation function. We rerun the network for 200 times in 1000 epochs, and used k-fold cross validation to specify the learning-rate parameter of SGD. Each color of the plots shows the variations in loss or cost value (x axis) across the epochs (y axis) in one specific run of the network. As the figure shows, the cost value of the network with our proposed ef-operator decreases along the epochs and acts similar to classical affine operator, called c-operator. In the second experiment, we classified the digits of MNIST dataset of [2] which consists of handwritten examples to examine our proposed additive neural network in multiclass classification problem. MNIST dataset consists of 30,000 training samples and 5,000 test data. Each example is an image of a digit from 0 to 9. One-hot code is used to encode the class labels. Each example is an image of size 28 × 28, and each image is concatenated in a single vector to input the network. Therefore, the size of the input layer of the network is 784. We used cross-entropy based cost function and SGD to train the network. We used 150 number of examples in each iteration of SGD. In other words, the batch size is equal to 150. Table I contains the classification accuracies of the MLP architecture using three activation functions: ReLU, Tanh and Sigmoid with four different learning rates. As the table shows, our additive neural network over ef-operator reaches to the performance of classic MLP with c-operator. In other words, with a slightly sacrificing the classification performance we can use the proposed ef-operator which much more energyefficient. Note that, we have not used any regularization methods such as drop out used by Krizhevsky et al. [3], because we simply aim to show that our proposed ef-operator gives the learning ability to the deep MLP. Also Table. I shows that maximum of the performances have been obtained using ReLU activation function. We are also interested to see the variations in the classification performances during the epochs and along the epochs. With addition to MLP, we have used the proposed efoperator to learn the parameters of LeNet-5 [2] to classifying MNIST dataset. Table I contains the classification accuracy of LeNet-5 architecture that contains two conventional and one fully connected layer. We trained the network with SGD and cross-entropy based cost functions as we did on MLP case. It should be noted that we have used the conventional c-operator in the output layer of both MLP and LeNet-5 architectures. As shown in the table, the proposed ef-operator catches up the coperator with a small amount of loss. Figure 2 shows the results of the classification accuracies obtained from MLP based on our proposed ef-operator and traditionally used c-operator. The performances (shown in the y axis of the sub figures) obtained in successive epochs (shown in the x axis of the sub figures). In each epoch, the network is trained with all of the training examples. The plots of the subfigures are obtained using four different learning rates: 0.1, 0.005, 0.001 and 0.0005. Subplots (a) and (b) at the left of figure shows the results of c-operator in MLP with 2 and 3 hidden layers respectively, and subplots (c) and (d) shows the results of our proposed ef-operator. As Figure 2 shows, our operator effectively increases the classification performance as the number of epochs increases and reaches nearly to the original linear function. VI. C ONCLUSION In this study, we propose an energy efficient additive neural network architecture. The core of this architecture is the lasso norm based ef-operator that eliminates the energyconsumption multiplications in the conventional architecture. We have examined the universal approximation property of the proposed architecture over the space of Lebesgue integrable functions and test it in real world problems. We showed that ef-operator can successfully solve the nonlinear XOR problem. Moreover, we have observed that with sacrificing 0.39% and 0.69% accuracy, our proposed network can be used in the multilayer perceptron (MLP) and conventional neural network respectively to classify MNIST dataset. As a future work, we plan to test the proposed architecture in the state-of-the-art deep neural networks. ACKNOWLEDGMENT A. Enis Cetin’s work was funded in part by a grant from Qualcomm. R EFERENCES [1] Y. LeCun, Y. Bengio, and G. Hinton, Deep learning, Nature, vol. 521, no. 7553, pp. 436444, 2015. [2] Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner, Gradient-based learning applied to document recognition, Proceedings of the IEEE, vol. 86, no. 11, pp. 22782324, 1998. [3] [3] A. Krizhevsky, I. Sutskever, and G. E. Hinton, Imagenet classification with deep convolutional neural networks, in Advances in neural information processing systems, 2012, pp. 10971105. [4] [4] K. Simonyan and A. Zisserman, Very deep convolutional networks for large-scale image recognition, arXiv preprint arXiv:1409.1556, 2014. [5] Y. Taigman, M. Yang, M. Ranzato, and L. Wolf, Deepface: Closing the gap to human-level performance in face verification, in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition,2014, pp. 17011708. [6] C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich, Going deeper with convolutions, in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2015, pp. 19. [7] A. J. Calise and R. T. Rysdyk, Nonlinear adaptive flight control using neural networks, IEEE control systems, vol. 18, no. 6, pp. 1425, 1998. [8] A. Giusti, J. Guzzi, D. C. Cires an, F.-L. He, J. P. Rodr guez, F. Fontana, M. Faessler, C. Forster, J. Schmidhuber, G. Di Caro et al., A machine learning approach to visual perception of forest trails for mobile robots, IEEE Robotics and Automation Letters, vol. 1, no. 2, pp. 661667, 2016. [9] S. Han, J. Pool, J. Tran, and W. Dally, Learning both weights and connections for efficient neural network, in Advances in Neural Information Processing Systems, 2015, pp. 11351143. [10] H. Tuna, I. Onaran, and A. E. Cetin, Image description using a multiplier-less operator, IEEE Signal Processing Letters, vol. 16, no. 9, pp. 751753, 2009. [11] A. Suhre, F. Keskin, T. Ersahin, R. Cetin-Atalay, R. Ansari, and A. E. Cetin, A multiplication-free framework for signal processing and applications in biomedical image analysis, in 2013 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2013, pp. 11231127. [12] C. E. Akbas , O. G unay, K. Tas demir, and A. E. Cetin, Energy efficient cosine similarity measures according to a convex cost function, Signal, Image and Video Processing, pp. 18. [13] H. S. Demir and A. E. Cetin, Co-difference based object tracking algorithm for infrared videos, in 2016 IEEE International Conference on Image Processing (ICIP). IEEE, 2016, pp. 434438. [14] C. E. Akbas , A. Bozkurt, A. E. Cetin, R. Cetin-Atalay, and A. Uner, Multiplication-free neural networks, in 2015 23th Signal Processing and Communications Applications Conference (SIU). IEEE, 2015, pp. 24162418. [15] S. K. Esser, P. A. Merolla, J. V. Arthur, A. S. Cassidy, R. Appuswamy, A. Andreopoulos, D. J. Berg, J. L. McKinstry, T. Melano, D. R. Barch et al., Convolutional networks for fast, energy-efficient neuromorphic computing, arXiv preprint arXiv:1603.08270, 2016. [16] E. Painkras, L. A. Plana, J. Garside, S. Temple, F. Galluppi, C. Patterson, D. R. Lester, A. D. Brown, and S. B. Furber, Spinnaker: A 1-w 18-core system-on-chip for massively-parallel neural network simulation, IEEE Journal of Solid-State Circuits, vol. 48, no. 8, pp. 19431953, 2013. [17] T. Pfeil, A. Gr ubl, S. Jeltsch, E. M uller, P. M uller, M. A. Petrovici, M. Schmuker, D. Br uderle, J. Schemmel, and K. Meier, Six networks on a universal neuromorphic computing substrate, arXiv preprint arXiv:1210.7083, 2012. [18] S. Moradi and G. Indiveri, An event-based neural network architecture with an asynchronous programmable synaptic memory, IEEE transactions on biomedical circuits and systems, vol. 8, no. 1, pp. 98107, 2014. [19] J. Park, S. Ha, T. Yu, E. Neftci, and G. Cauwenberghs, A 65k-neuron 73-mevents/s 22-pj/event asynchronous micro-pipelined integrate-andfire array transceiver, in 2014 IEEE Biomedical Circuits and System Conference (BioCAS) Proceedings. IEEE, 2014, pp. 675678. [20] S. S. Sarwar, S. Venkataramani, A. Raghunathan, and K. Roy, Multiplierless artificial neurons exploiting error resiliency for energy-efficient neural computing, in 2016 Design, Automation & Test in Europe Conference & Exhibition (DATE). IEEE, 2016, pp. 145150. [21] A. M. Abdelsalam, J. Langlois, and F. Cheriet, Accurate and efficient hyperbolic tangent activation function on fpga using the dct interpolation filter, arXiv preprint arXiv:1609.07750, 2016. [22] M. Rastegari, V. Ordonez, J. Redmon, and A. Farhadi, Xnor-net: Imagenet classification using binary convolutional neural networks, arXiv preprint arXiv:1603.05279, 2016. [23] R. N. Bracewell, The Fourier transform and its applications, 3rd ed., ser. McGraw-Hill series in electrical and computer engineering; Circuits and systems. McGraw Hill, 2000, p. 97. [24] G. Cybenko, Approximation by superpositions of a sigmoidal function, Mathematics of control, signals and systems, vol. 2, no. 4, pp. 303314, 1989. [25] C. M. Bishop, Ed., Pattern Recognition and Machine Learning, Vol. I. Verlag New York, Inc. Secaucus, NJ, USA: Springer, 2007. [26] H. G. E. Rumelhart, D. E. and R. J. Williams, Learning representations byback-propagating errors, Nature, pp. 323, 533536, 1986. [27] M. Abadi, A. Agarwal, P. Barham, E. Brevdo, Z. Chen, C. Citro, G. S. Corrado, A. Davis, J. Dean, M. Devin, S. Ghemawat, I. Goodfellow, A. Harp, G. Irving, M. Isard, Y. Jia, R. Jozefowicz, L. Kaiser, M. Kudlur, J. Levenberg, D. Man e, R. Monga, S. Moore, D. Murray, C. Olah, M. Schuster, J. Shlens, B. Steiner, I. Sutskever, K. Talwar, P. Tucker, V. Vanhoucke, V. Vasudevan, F. Vi egas, O. Vinyals, P. Warden, M. Wattenberg, M. Wicke, Y. Yu, and X. Zheng, TensorFlow: Large-scale machine learning on heterogeneous systems, 2015, software available from tensorflow.org. TABLE I: Optimal classification results of classic function c-operator and our proposed ef-operator score functions in different MLP (in different learning rates) and LeNet-5 architectures. Architectures MLP (2 Hidden Layers) MLP (3 Hidden Layers) LeNet-5 - ReLU Tanh Sigmoid learning rate c-operator ef-operator c-operator ef-operator c-operator ef-operator 0.01 0.005 0.001 0.0005 0.01 0.005 0.001 0.0005 98.43 98.36 98.03 97.61 96.85 98.15 98.22 97.65 98.01 98.09 97.76 97.21 97.80 97.95 97.63 96.97 96.39 97.23 97.63 96.27 90.42 95.08 97.49 96.78 95.57 96.05 96.77 96.10 92.64 93.33 93.63 93.93 97.81 98.07 95.83 95.83 96.31 96.48 95.74 94.34 96.80 97.10 96.47 95.53 96.23 96.50 95.85 94.83 - 99.29 98.60 99.22 98.43 99.20 97.81
9cs.NE
Pre-print of paper that appeared in Searson, D. P., Willis, M. J., & Wright, A. (2012). Reverse Engineering Chemical Reaction Networks from Time Series Data. Statistical Modelling of Molecular Descriptors in QSAR/QSPR, Volume 2, 327-348, DOI: 10.1002/9783527645121.ch12 Reverse Engineering Chemical Reaction Networks from Time Series Data Dominic P. Searson1, Mark J. Willis2* and Allen Wright2 1 Northern Institute for Cancer Research, Newcastle University, United Kingdom. 2 School of Chemical Engineering and Advanced Materials, Newcastle University, United Kingdom. [email protected]; [email protected];[email protected] *Corresponding author. Tel. +44 (0)191 2227242 Abstract The automated inference of physically interpretable (bio)chemical reaction network models from measured experimental data is a challenging problem whose solution has significant commercial and academic ramifications. It is demonstrated, using simulations, how sets of elementary reactions comprising chemical reaction networks, as well as their rate coefficients, may be accurately recovered from non-equilibrium time series concentration data, such as that obtained from laboratory scale reactors. A variant of an evolutionary algorithm called differential evolution in conjunction with least squares techniques is used to search the space of reaction networks in order to infer both the reaction network topology and its rate parameters. Properties of the stoichiometric matrices of trial networks are used to bias the search towards physically realisable solutions. No other information, such as chemical characterisation of the reactive species is required, although where available it may be used to improve the search process. Keywords: network inference, differential evolution, model selection, stoichiometric matrix, kinetic models. 1 1 Introduction Effective tools for the reverse engineering of chemical reaction networks from laboratory scale time course concentration data are likely to become of increasing commercial and academic importance. For instance, a model of a reaction network – written as a coupled set of ordinary differential equations (ODEs) describing the dynamic behaviour of the system comprises the central numerical description of the reaction network in modern process simulation and optimisation software. Software of this nature is required for numerous reasons including accurate and economic plant design and process optimisation [1] and so methods, tools and procedures for rapidly establishing the reaction pathway from data using as little a priori information as possible are desirable. In particular, methods that can be applied to data obtained from reaction systems operating far away from chemical or biochemical equilibrium are of interest. This is because batch and semi-batch reactors – rather than continuous stirred tank reactor (CSTRs) – tend to be used in the fine chemical and pharmaceutical industries during the chemical development lifecycle. Furthermore, the increased uptake of high throughput technologies e.g. automated robotic workstations for performing many experiments in parallel, coupled with improved in situ sensor technology to provide rich data sets, is likely to provide an increase in the quantity and quality of non-equilibrium experimental reaction data. Currently, this data is generally only used for kinetic fitting - once a kinetic model structure has been postulated - but there exists the potential to extract more useful information, such as reaction network topologies as well as reaction stoichiometries, reaction rates, reaction fluxes and kinetic models ([1], [2], [3]). Without suitable prior knowledge, however, the deduction of a fully characterised, interpretable dynamic mathematical description of reaction network from observed time composition data alone is an ill-posed problem. This type of problem – which may be thought of as “reverse engineering” a useful description of a network from data – is usually very 2 difficult to solve uniquely. For instance, when there is little a priori knowledge of the nature of the entities within the network and when the measured data is corrupted with measurement noise, there are frequently many plausible networks that can explain the data ([4],[5]). One of the earliest advances in reaction network inference from non-equilibrium data was made by Bonvin and Rippin [2] who proposed a methodology - called target factor analysis (TFA) - to identify both the number of linearly independent reactions and also to test whether proposed reaction stoichiometries are consistent with the measured time series concentration data. The principal advantage of TFA is that no knowledge of reaction kinetics or fluxes is required. Once a set of plausible reaction stoichiometries is extracted, the user can then propose suitable ODE kinetic model descriptions and test these against the data. This work has subsequently been developed by a number of workers (e.g. [3], [6], [7], [8]) A contrasting approach is to parameterise a suitable ODE model structure directly from the observed data and to use the resulting model to infer the network properties. One such approach – referred to as the S-system methodology ([4], [5], [9], [10], [11], [12]) – has been investigated extensively in the biosciences for modelling non-equilibrium time series data (e.g. gene expression microarray data) – and forms part of the biochemical systems theoretic (BST) framework for the dynamic modelling and analysis of biological systems. The Ssystem model structure possesses a number of desirable properties. For instance, experimental time series can be used to estimate the parameters of S-system models that can both approximate the temporal dynamics of a connected network of entities and be used to infer the connective structure of the network. However, an estimated S-system model does not, in itself, provide any direct information about the number or nature of the reaction steps, e.g. stoichiometries or reaction orders. Domain dependent knowledge can be exploited to narrow the network search space by restricting the form of the ODE model used to explain the dynamic behaviour of the chemical 3 reaction network. For instance, elementary chemical and biochemical reactions, occurring in well mixed, relatively dilute, homogeneous phases – such as may be found in controlled laboratory batch and fed-batch experiments – often obey the law of mass action kinetics. This allows a class of physically interpretable ODE models with pseudo-linear properties to be formulated ([13], [14], [15], [16]). The pseudo-linear properties of these models allow classical regression techniques to be applied within the ODE model search process. In this paper we describe an approach, closely related to the pseudo-linear approaches described above, that uses a variant of the evolutionary computational method of differential evolution (DE) to search the space of elementary chemical reaction networks. DE [17] is employed to iteratively evolve a population of numerical vectors, each of which encodes the topology of a trial network of elementary reactions. Each trial network has a corresponding stoichiometric matrix, the properties of which may be used to determine whether the network is physically realisable. The objective function for the DE is designed so that the search is biased towards networks that are physically possible. In addition, for each trial network, the rate coefficients – and hence the vector of reaction rates - are identified from the estimated time derivatives of the measured concentration data using multiple linear regression. It is shown, using realistic amounts of noise corrupted time series data acquired from simulations of several chemical reaction networks in batch experiments, that the approach is effective at recovering the “true” network of elementary reactions and providing good estimates of the associated rate coefficients. The paper is structured in the following way. In Section 2, mathematical models of elementary reaction networks are discussed in order to provide a definition of the particular network inference problem. In Section 3, the numerical representation of possible network topologies is described. In Section 4, the objective function used for network search is presented. The procedure used to determine whether trial networks are physically valid is also 4 described for cases where chemical information is either available or not. In Section 5, the basic DE method and the self-adaptive variant of DE used to search for reaction networks is described. In Section 6, three case studies using simulated chemical reaction systems are presented. Finally, in Section 7 some conclusions and a discussion are presented. 2 Problem definition A materials balance for S chemical components taking place in R chemical reactions comprising a chemical reaction network can be written for certain classes of chemical reactors – batch, fed-batch (semi-batch) and continuous flow stirred tank reactor (CSTRs). These balances are often written to reflect the pragmatic assumptions that the (homogeneous phase) reactor is operating isothermally, is well mixed and that the overall density of the reaction mixture is not significantly changed by the occurrence of the chemical reactions within the reactor. In this paper we will, without loss of generality, consider batch reactions only, i.e. there are no materials added or removed during the course of an experiment. In this case a materials balance for each species can be written as: d [ xi ] = f i i = 1,..., S dt (1) where [xi] is the molar concentration of species i at time t. Eqn. (1) is a set of coupled ODEs that describes the dynamic behaviour of the reactive species due to chemical reactions, as represented by the S reaction fluxes fi. The flux terms fi are directly linked to the stoichiometries of the R reactions taking place and the kinetic rate terms of these reactions. For instance, consider the (S × R) stoichiometric matrix N containing the stoichiometric coefficients for each of the S species in the R reactions. 5  n11 ! n1R    N=… " … n ! nSR   S1  (2) Here, nij is the stoichiometric coefficient of the ith chemical species in the jth reaction. By convention, nij < 0 for a species that undergoes net consumption in a reaction, nij > 0 for a species that undergoes net production and nij = 0 for a species that is either not involved in the jth reaction or has no net change in it. The component balances may now be conveniently expressed in terms of N and the R individual reaction rates in matrix-vector form: dx = Nr dt (3) where r is the (R × 1) dimensional vector of reaction rates and x is the (S × 1) dimensional vector of species concentrations [x1],…,[xS] at time t. The R reaction rates constituting r are, in general, non linear functions of the concentrations x and linear functions of the rate coefficients. If elementary reactions are assumed then the form of the R rate terms in r is determined uniquely by the reactants in each of the R elementary equations. The law of mass action kinetics states that the rate of an elementary reaction may be assumed to be directly proportional to the collision frequency of the reactants, and hence the product of the reactant concentrations. Consider a bimolecular elementary chemical reaction with rate coefficient k involving a molecules of species x1 and b molecules of species x2 forming c molecules of species x3 and d molecules of species x4. k ax1 + bx2 → cx3 + dx4 (4) The rate r of this reaction at any time, according to the law of mass action, is: r = k[ x1 ]a [ x2 ]b (5) For example, consider the hypothetical chemical reaction network comprising four reactive species x1,…, x4 involved in two elementary reactions with rate coefficients k1 and k2: 6 k1 k2 x1 + x2 → x3 + x4 x3 → x4 (6) The stoichiometric matrix N and rate vector r for this network are: − 1 − 1 1 1 NT =   0 0 − 1 1 k [ x ][ x ] r= 1 1 2   k2 [ x3 ]  (7) Hence the S ODEs, for known initial conditions of the [xi], can be used to describe the temporal evolution of the species concentrations:  − k1[ x1 ][ x2 ]   − k [ x ][ x ]  dx 1 1 2  = Nr =   k1[ x1 ][ x2 ] − k2 [ x3 ] dt   k1[ x1 ][ x2 ] + k2 [ x3 ] (8) Note that any given row of N does not uniquely correspond to an elementary reaction, nor does any N correspond to a unique set of elementary reactions. For instance, the following reaction network has the same N as the network described by Eqn. (6). k1 k2 x1 + x2 → x3 + x4 x1 + x3 → x1 + x4 (9) Using the development above, the general problem of inferring a network of elementary reactions from time series concentration data can be stated as: using only noise corrupted measurements of x sampled from M experiments reconstruct one or more plausible elementary reaction networks, i.e. the number and nature of the elementary reactions, the corresponding stoichiometric matrix N, the rate coefficients and the reaction rates r. 3 Reconstruction of elementary reaction networks from data by network search Recently, Srividhya et al. [15] described a method to reconstruct (bio)chemical reaction networks from time series concentration data method by searching the space of networks of elementary unimolecular and bimolecular reactions in order to minimise an objective function that takes into account both the predictive ability and the parsimony of the proposed 7 reaction network. This search is stepwise in nature and is accomplished by adding or removing one reaction at a time from previously high performing networks of elementary unimolecular and bimolecular reactions. For each network (i.e. set of elementary reactions) evaluated, the corresponding reaction rate terms, multiplied by the appropriate stoichiometric coefficients, are used to set up a constrained regression problem in which the network rate coefficients are computed from the estimated derivatives of the time concentration data using a non-negative least squares method. The minimisation of an objective function that trades off the mean squared prediction error of the estimated derivatives against the number of reactions in each trial set is used to drive the stepwise search process. The advantages of this approach are that it is automated, non-subjective and that it exploits the fact that the rates of change of concentration (the fluxes fi) of the S species are linear combinations of the same R reaction rate terms. The principal disadvantages of this approach as presented in [15] are that firstly, it uses a stepwise method to search the space of reaction networks. Stepwise methods are essentially local search operators and are likely to be trapped in local minima, especially in noisy, high dimensional, multi-modal search spaces such as that typically encountered in network inference. This appears to be borne out by some the results presented in [15] in which the stepwise approach fails to recover the correct network for some fairly low complexity bimolecular reaction networks under noise-free conditions. Secondly, the search method does not penalise physically unrealisable reaction networks. For instance, consider the following trial network: k1 2 x1 → x2 k2 x1 → x2 (10) This is not physically possible, but such a network could nominally satisfy an objective function based on prediction error and network complexity alone. Thirdly, the method makes no provision for the use of a priori information about the reactive species (e.g. molecular weights, chemical composition). 8 In an attempt to address these issues, a method which takes into account these factors is presented in this paper. 3.1 Network search as a non-linear integer programming problem In order to search through the space of reaction networks it is first necessary to employ a suitable numerical representation of possible network topologies. In this paper, the topology of a reaction network containing up to qmax reactions is represented by a vector of integers. The search of the network space may then be formulated as the search for the optimal integer vector, i.e. an integer programming problem. An optimal solution is that which best satisfies an objective function that balances network complexity and physical validity against how well the network fits the data. Our integer representation of each of the qmax reactions is simply a description of the identities of the reactants and the products in each reaction. For instance, consider the case where the reactions are restricted to be either unimolecular or bimolecular with a maximum of two reactants and three productsi. Each reaction can then be represented by a sequence of five integers. The first two integers represent the identities of the reactants and the remaining three integers represent the identities of the products. A zero is used to “switch off” a reactant or product in a reaction. The purpose of this is to allow the representation of reactions of lower complexity than the specified maximum. Hence, each entry in the integer sequence can take a value in the range 0 to S. The topology of the whole network is represented by concatenating the qmax integer sequences into one vector. This is illustrated in Figure 1 where qmax = 4 and S = 3. The reaction representation rule is also illustrated for the five integers representing reaction 1. i The integer representation used can be easily modified to encompass reaction types of greater or lesser complexity than that illustrated. 9 Figure 1. Example of integer vector representation of the topology of a trial reaction network containing S = 3 species and a maximum of qmax = 4 reactions. In this case, reaction 4 is invalid and is excluded from the overall network. Note that the representation also allows the specification of physically unrealisable reactions, such as reaction 4 in Figure 1 which is: 2 x1 → x1 (11) Invalid reactions such as these are interpreted as “no reaction occurring” and are excluded from the trial network. Hence the actual size q of the network in Figure 1 is 3. This is accomplished by examining the columns of the trial network’s stoichiometric matrix and removing those that do not contain at least one positive and one negative coefficient. The ability to “switch off” reactions is an important feature because it is not assumed exactly how many reactions R are occurring in the unknown reaction network, but it is assumed that R < qmax where qmax is set to some “sensible” user defined limit. Whilst this representation excludes individual reactions that are physically unrealisable it does not prohibit entire networks with this property. The trial network illustrated in Figure 1, for instance, is not physically possible because the third reaction is inconsistent with the first 10 and second reactions. Such networks are not rejected out of hand, however, because any integer programming method employed to search the space of network topologies would require substantial modification in order to search the integer vector space in such a way that only trial solutions corresponding to physically realisable networks are generated. This would then limit the applicability and simplicity of the approach. Instead, we employ a soft constraint to guide the DE based integer programming method towards physically realisable solutions. This is discussed further in Section 4. 3.2 Estimation of the rate coefficients for trial reaction networks To evaluate how well any trial network topology fits the data it is necessary to estimate the rate coefficients. However, parameter estimation for each of the corresponding ODE models from time series concentration data usually requires the use of iterative optimisation techniques (e.g. gradient descent methods). This typically involves repeated numerical solution of the ODEs using many trial parameter sets until the simulation closely matches the experimental data (i.e. “kinetic fitting”). A drawback of this approach is that the numerical solution of the ODEs for each trial parameter set for each of the evaluated trial network topologies is - currently - prohibitively computationally expensive. To avoid the computational expense of numerical integration it is possible – prior to the network search procedure - to estimate the time derivatives for each of the S species from the measured time series concentration data [18]. This can be achieved by fitting non-linear “smoothing” functions to the concentration measurements and either numerically or analytically obtaining the derivatives at the required sample times from the fitted function. Examples of this in the literature include the use of forward differencing [15], feedforward artificial neural networks [18] and rational polynomials [16]. 11 Once estimates of the time derivatives are obtained, the rate coefficients for each trial network can be estimated from the data using least squares methods. This requires the formation of a response vector y and a predictor (model design) matrix X for each trial network. These can be related to the (q × 1) vector of the unknown rate coefficients k by a linear equation that may be solved using least squares to minimise the vector of errors ε. y = Xk + ε (12) Following the development in [15], this is outlined below for a single experiment. Let [xi]n represent the sampled concentration of the ith species at the nth time point during an experiment, where there are N time points, and let Di,n represent the estimated time derivative of the ith species concentration at the nth time point. An (N × q) matrix Xi can be formed for each species, the jth column of which comprises the unscaled kinetic rate term for the jth reaction, evaluated at each time point, multiplied by a coefficient vi,j. This coefficient is the molecularity of the ith species in the jth reaction multiplied by +1 if the the ith species is a product in the jth reaction, by -1 if it is a reactant, and by 0 if it does not take part in the jth reaction. For example, in the following trial network the coefficients are v1,1 = -2, v1,2 = 0, v2,1 = 1, v2,2 = -1, v3,1 = 0 and v3,2 = 1. k1 2 x1 → x2 k2 (13) x2 → x3 The Xi matrices for this network are shown in Eqn. (14).  − 2[ x1 ]2 n =1  2 2 [ x ] −  1 n=2 X1 =  !   2 − 2[ x1 ] n = N 0  [ x1 ]2 n =1   2 0  [ x1 ] n=2  X2 =  ! !   [ x1 ]2 0  n= N    0 [ x2 ]  n =1     0 [ x2 ]  − [ x2 ]  n=2  n=2  X =  3 ! ! !       − [ x2 ] 0 [ x2 ] n= N  n= N   − [ x2 ] n =1 (14) The Xi are then vertically concatenated to form the (SN × q) overall predictor matrix X. Similarly, the (SN × 1) response vector y is formed from the vertical concatenation of the S vectors yi each of which contains the N estimated time derivatives Di,n. The extension to M 12 multiple experiments is straightforward and yields an X of dimension (MSN × q) and y of dimension (MSN × 1). To compute k we use the least squares normal equation with the Moore-Penrose pseudoinverse (XTX)# to mitigate problems with co-linearity in X: k = ( X T X) # X T y (15) In our method, any reactions that yield rate coefficients that are negative or zero are simply deleted from the trial network. The corresponding elements in k and columns in X are also then deleted. The sum of squares of prediction errors of the estimated derivatives (SSED) for the rectified trial network can then be calculated as: SSE D = (y − Xk ) T (y − Xk ) (16) In the degenerate case, where there are no reactions remaining in the rectified trial network (q = 0), a value of infinity is assigned to the SSED. 4 Formulation of the objective function for network search An objective function based purely on the minimisation of prediction errors does not take into account the desired model characteristics. It is preferable to use one of the formal statistical metrics (information criteria; IC) that can be minimised to in order to balance the trade-off between model complexity (in this case, the number of reactions q) and how well the model fits the data, e.g. Akaike’s information criterion (AIC; [19]). However, it is seldom clear which is the “best” criterion to use. A number of ICs were tested and it was found that the Schwarz information criterion (SIC; [20]) appeared to yield the best all round performance. The SIC – sometimes referred to as the Bayesian information criterion - for a trial network can be written as: 13  SSE D   + p ln( N s ) SICD = N s ln  Ns  (17) where Ns is the sample size and p = q + 1 [21]. The SIC measure, however, does not discriminate between physically valid and physically unrealisable reaction networks. To guide the network search process, we propose the use of an additional term in the objective function to penalise trial networks that violate physical constraints. This is achieved my modifying the objective function in Eqn. (17) as follows:  SSE D   + ( p + α ) ln( N s ) SICD = N s ln  Ns  (18) where α = 0 for physically valid networks and α = qmax for physically invalid networks. The meaning of this is that physically invalid networks are penalised in terms of the SIC measure as if they were comprised of q + qmax elementary reactions rather than q reactions. Hence, physically unrealisable trial networks are not considered infeasible solutions - but they are strongly penalised. In terms of the evolutionary search process, this allows relatively high performing partial solutions – although formally invalid - to be explored early on in the expectation that these will be combined with other high performing partial solutions later in the search process. As the search progresses, the evolutionary process increasingly discriminates in favour of relatively high performing valid solutions (i.e. those for which α = 0). In this case the modified objective function reverts to the standard SIC. In order to determine whether a trial network is physically valid, two scenarios are considered. The first scenario is where additional physical information and/or chemical characterisation of the reactive species is available. The second scenario is where no additional physical information is available. These will be considered in turn. 14 4.1 Physical/chemical information available Physical and chemical properties of the reaction network that are conserved are referred to as reaction invariant properties. For example, the molecular weight, number of carbon atoms and number of oxygen atoms of a particular species do not change regardless of the nature and number of the chemical reactions occurring. If C such properties are known for the S species then a (C × S) conservation matrix A may be formed, where the entry at the ith column and jth row refers to the value of the jth conserved property for the ith species. The simplest case of A is probably the (1 × S) vector containing the molecular weights – or the ratios of the molecular weights - of the S species. Due to the conservation of the properties within A, the following relationship holds for physically realisable reaction networks [22]. AN = 0 (19) where N is the (S × q) stoichiometric matrix corresponding to the reaction network. Note that this property is independent of the kinetic behaviour of the network. If the relationship in Eqn. (19) does not hold for a trial network in the network search process, then α is set to qmax in the search objective function, as indicated in Section 3. 4.2 No physical/chemical information available If no conserved physical or chemical properties are available for the S species then a conservation matrix A can not be explicitly formed. However, it is still possible to make use of the relation given in Eqn. (19) even if A is unknown. This is because the transpose of any valid conservation matrix AT resides in the nullspace of the transpose of the trial network’s stoichiometric matrix NT. This can be seen by rewriting Eqn. (19) as: NT AT = 0 (20) Therefore, if NT does not have a nullspace then no conserved physical or chemical properties matrix A can exist and thus the network is physically unrealisable. The nullspace of NT for 15 any trial network can be calculated by means of the singular value decomposition. In practice, commands for computing nullspaces of matrices are built in to most modern numerical computing software, e.g. Mathematica, MATLAB etc. Usually the nullspace is computed in the form of a set of orthonormal basis vectors. There are also trial networks for which the nullspace of NT does exist but has rows that contain only zeros. In these cases, a solution of Eqn. (20) is algebraically possible, but the solution does not correspond to a set of physically possible conserved properties. For instance, the following reaction network topology has a nullspace of [-0.7071 -0.7071 0]T : x1 → x2 x1 → x2 + x3 (21) The interpretation of this is that A exists in the algebraic sense but that it only does so if all possible conserved properties for x3 are zero. However, the set of all possible conserved properties includes properties that cannot have zero values, e.g. mass. Therefore, such solutions are not physically realisable and so the trial network is penalised in Eqn. (18). In summary, if the nullspace of NT for a trial network either does not exist or contains one or more rows that contain only zeros, then α is set to qmax in the network search objective function. The network topology representation, rate coefficient estimation and the objective function for the network search problem have been defined in this and previous sections. In the next section, the population based evolutionary method of differential evolution for searching through the space of networks is discussed. 5 Differential evolution for searching the space of reaction networks Evolutionary algorithms (EAs) are inherently well suited for many search and optimisation problems: they can find near optima in astronomically large, multi-modal search spaces and they are robust across many problem classes. Differential evolution (DE) is an EA that was 16 originally conceived as a continuous variable optimisation method [17], and although not well very known, studies have shown DE to outperform other EAs for a variety of benchmark problems [23]. Further advantages of DE are that (a) it is compact and very simple to implement (b) it has relatively few parameters to set (c) it may easily be modified to operate with discrete, integer and continuous variables and mixtures thereof and (d) it can operate both as unconstrained optimiser and as a constrained optimiser with multiple constraints [24]. Before discussing the variant of DE used here, the “basic” DE method for continuous optimisation is outlinedii. 5.1 Basic DE optimisation method Consider a problem involving finding a vector z comprising the n continuous parameters z1, …, zn with values that minimise an objective function of these parameters f(z). The parameters in z generally have upper and lower bounds defined individually by the user for each element of z. In order to minimise f(z), DE performs search by simulated evolution on a population of P such trial vectors zi,g over G generations where i = 1,…, P and g = 1, …, G. The ith vector in the gth population contains the n individual trial parameters zi,j,g where j = 1, …, n. The underlying mechanism of DE is that each vector zi,g in the current population is used to generate a single mutated offspring mi,g. The mutated offspring is then compared directly with its parent on the objective function. If the offspring equals or surpasses its parent it replaces it in the next generation, otherwise the parent is retained. Eventually, the evolutionary processes of mutation and selection should drive the population towards the optimum values of the parameter vector z. The steps in the DE algorithm are outlined below. ii In the optimisation literature this version of DE is referred to as DE/rand/1/bin. 17 Step 1. DE initialisation The algorithm is initialised in the first generation g = 1 by randomly generating the P vectors zi,1 within the ranges specified by the upper and lower bounds for each parameter. Each zi,1 is then evaluated against the objective function in order to compute the values f(zi,1). Step 2. DE Mutation The mutation vector mi,g is created by replacing a probabilistically determined number of the elements of zi,g with corresponding elements from an “exploration” or “perturbation” vector vi,g. The perturbation vector itself is created by adding the scaled difference of two randomly selected vectors za2,g and za3,g from the current population to another randomly selected vector za1,g from the current population where i ≠ a1 ≠ a2 ≠ a3. v i , g = z a1, g + F (z a 2, g − z a 3, g ) (22) The “scaling factor” F is a user defined parameter of the DE and is often set in the range 0 < F ≤ 2. The other user defined parameters are the population size P, the number of generations G and the “crossover rate” CR. The latter falls in the range 0 ≤ CR ≤ 1 and is used to probabilistically determine what proportion of the elements of the current member zi,g are replaced with elements of the perturbation vector vi,g when creating mi,g. The mutated offspring vector mi,g is formed by means of a binomial crossover mechanism on zi,g and vi,g as follows. To determine the jth element mi,j,g in mi,g a random number aj is generated in the range 0 ≤ aj ≤ 1. If aj < CR then mi,j,g = vi,j,g otherwise mi,j,g = zi,j,g. That is, if the random number is below the crossover rate then a parameter value from the perturbation vector is used and, if not, the parameter value from the current individual is retained. The values in mi,g are then checked against the upper and lower bound constraints for each parameter. If any element of mi,g violates the bounds then it can either be replaced with a 18 random number generated within the bounds or truncated to the exceeded bound value. In this work, the latter option is used. Step 3. DE competition and population update Each mutated vector is then evaluated against the objective function f(mi,g) and the resulting value compared to that obtained by its parent f(zi,g). If f(mi,g) ≤ f(zi,g) then mi,g takes the place of zi,g in the next generation and zi,g+1 = mi,g. Otherwise, the current solution zi,g is retained and copied to the next generation and zi,g+1 = zi. The generation counter g is then set to g+1 and the algorithm returns to Step 2. Step 4. DE termination The above process is repeated until some termination criterion is reached, most commonly after the fixed number of generations G has elapsed. At this point the vector zi,G in the final population with the lowest value of the objective function is usually selected as the “best result” of the run. This does not have to be the case, however, as will be seen in Section 6. 5.2 Self-adaptive DE with integer variables We use a self-adaptive variant of DE where the evolved parameters vectors are interpreted as integer vectors that encode trial reaction network topologies as described in Section 3 using the modified SIC objective function in Eqn. (18). Modifying DE to produce vectors that contain integer elements is simple. The DE algorithm essentially operates as described above on continuous parameter vectors and the only difference is that, prior evaluating a vector zi,g (or mi,g) against the objective function, the elements of zi,g (or mi,g) are temporarily rounded to the nearest integer. Hence, by defining appropriate upper and lower bounds for each of the elements in z the DE can be made to operate as a non-linear integer search method within 19 specified ranges for each parameter. Note that the underlying vector representation within the DE remains continuous and that the rounded parameter vectors are only used for the purpose of being evaluated by the objective function. For the integer network representation described in Section 3.3 the lower and upper bounds for each continuous parameter zj in z are defined such that (-1/2 + δ) ≤ zj ≤ (S + ½ - δ) where δ is a some very small number. This is to ensure that equal lengths of the real number line are rounded correctly to the integers between 0 and S. One of the drawbacks of the version of DE outlined above is that it necessary to determine “good” values of the user defined control parameters, in particular the scaling factor F and crossover rate CR. The optimal values for these control parameters are, in general, problem dependent and usually a trial and error approach is required to tune them satisfactorily. To counter this, self-adaptive variants of DE exist in which F and CR are themselves evolved along with the parameters required to solve the problem. We use the self-adaptive DE proposed by Brest et al. [25] because it has been shown – using a suite of non-linear benchmark problems - that it equals or outperforms standard DE and other self-adapting DE variants. This self-adaptive modification to the DE method requires only minimal changes and is easy to implement. Each parameter vector in the population zi,g is linked to corresponding values of F and CR, referred to as Fi,g and CRi,g. In the initial population the values for Fi,g and CRi,g are randomly generated in the ranges 0.1 ≤ Fi,g ≤ 1 and 0 ≤ CRi,g ≤ 1. In Step 2 of the DE algorithm, before creating the mutant offspring mi,g, the values of Fi,g and CRi,g are first mutated to new values Fi,g and CRi,g. The mutated control parameters are then used instead of fixed values of F and CR to create mi,g. The Fi,g and CRi,g are created using the following probabilistic rules [25]. 20 Fl + a1Fu if a2 < τ 1 F i, g =  otherwise Fi , g if a4 < τ 2 a3 CR i , g =  otherwise CRi , g (23) where the a1, …, a4 are independent random numbers generated between 0 and 1 each time the computations in Eqn. (23) are carried out and τ1 and τ2 are mutation probabilities. The rules have the effect of mutating Fi,g to a new value between Fl and (Fl + Fu) with probability τ1 and mutating CRi,g to a new value between 0 and 1 with probability τ2. As in [25] we set τ1 = τ2 = 0.1 and Fl = 0.1 and Fu = 0.9. If the mutated vector mi,g outperforms its parent zi,g then the values of the control parameters in the following generations are updated as Fi,g+1 = Fi,g and CRi,g+1 = CRi,g. If not, the orginal values are kept and Fi,g+1 = Fi,g and CRi,g+1 = CRi, 6 Network identification case studies The proposed methods were evaluated using simulations of three hypothetical chemical reaction networks occurring in well-mixed, isothermal batch reactors within an inert solvent. The first reaction network comprises 5 species, the second 6 species and the third comprises 10 species. Reaction networks 1 and 2 are used to evaluate the methodology when there is no knowledge of any conserved physical properties and reaction network 3 is used to evaluate it when the ratios of the molecular weights of the reacting species are known. To generate the simulated experimental data, the corresponding ODEs for each network were numerically solved using an accurate adaptive step length solver. Periodically sampled concentration values were then obtained for each species in each experiment. Arbitrary time and concentration units are used. To simulate the effects of experimental error, the sampled concentration values for each species in each experiment were independently corrupted with additive Gaussian noise. The 21 noise was specified to have a standard deviation equal to 4 % of the range of the concentration signal in the experiment. The reaction systems are described below: Reaction network 1 The first hypothetical reaction network comprises five chemical species labelled x1, …, x5 involved in four reactions with rate coefficients k1 = 0.1, k2 = 0.2, k3 = 0.13 and k4 = 0.3 as shown in Eqn. (24). The initial reactants are x1 and x2. Four experiments were simulated in which the initial concentrations were: {[x1] = 0.33, [x2] = 1}, {[x1] = 1, [x2] = 0.33}, {[x1] = 1, [x2] = 1} and {[x1] = 0.75, [x2] = 1}. In each case, the species concentrations were sampled every time unit from 0 to 24 time units. k1 2 x1 → x2 k2 x1 → x3 (24) k3 x3 → x4 k4 x2 + x4 → x5 Figure 2 shows the data acquired from a typical experiment. For each species the “true” unknown concentration values are plotted against the noisy sampled data. 22 Figure 2. Simulated experimental concentration vs. time data for reaction network 1 (Expt. 2). The noisy sampled values (dots) are plotted against the underlying concentration values (lines). Reaction network 2 The second reaction network comprises six chemical species labelled x1, …, x6 involved in four chemical reactions with rate coefficients k1 = 0.2, k2 = 0.1, k3 = 0.15 and k4 = 0.05 as shown in Eqn. (25). Note that the fourth reaction is the reverse of the third reaction. k1 x1 + x2 → x3 + x4 k2 x2 + x3 → x5 k3 (25) x1 + x4 → x6 k4 x6 → x1 + x4 The initial reactants are x1 and x2. Again, four experiments were simulated with the following initial concentration values: {[x1] = 2.5, [x2] = 2.5}, {[x1] = 2.5, [x2] = 7.5}, {[x1] = 7.5, [x2] = 2.5} and {[x1] = 10, [x2] = 5}. In each case, the species concentrations were sampled every 0.5 time units from 0 to 15 time units. 23 Reaction network 3 The third network comprises ten chemical species labelled x1, …, x10 involved in six chemical reactions with rate coefficients k1 = 0.35, k2 = 0.25, k3 = 0.3, k4 = 0.4, k5 = 0.3 and k6 = 0.1 as shown in Eqn.(26). k1 x1 + x2 → x3 k2 k3 k4 x3 → x4 → x5 → x6 (26) k5 x4 → x7 + x8 k6 x5 → x9 + x10 It is assumed that chemical information, in the form of molecular weights, is available for each of the species in this network and so a (1 × 10) conservation matrix A comprising the ratios of the molecular weights, was formed as follows: AT = [1 3 4 4 4 4 1 3 2 2] (27) Again, the initial reactants are x1 and x2. For this network, three experiments were simulated with the following initial concentration values: {[x1] = 5, [x2] = 5}, {[x1] = 2, [x2] = 4}, {[x1] = 4, [x2] = 2}. In each experiment, the species concentrations were sampled every 0.1 time units from 0 to 5 time units. 6.2 Estimation of time derivatives Once the simulated experimental time series concentration data was generated, the time derivative of each species concentration value in each batch was approximated. This was accomplished by fitting a separate second order rational polynomial of the form in Eqn. (28) ˆ t is the predicted value of the ith species to each signal where t is the time value and [ x] concentration at time t. 24 [ xˆi ]t = p1t 2 + p2t + p3 t 2 + p4t + p5 (28) For each signal, the coefficients p1, …, p5 were estimated from the noisy concentration values [xi]t using the Levenberg-Marquardt non-linear least squares method. The approximate values of the time derivatives were subsequently obtained at each sampled data point using the analytical derivative of Eqn. (28). For a related S-system identification problem [18] it was observed that that, typically, the accuracy of approximated derivative values is poor at the beginning and end of each signal and so, prior to the network inference procedure, we remove the first and last 4 data points from each signal for each experiment. 6.3 DE settings Ten runs of the self-adaptive DE with the encoding described in Section 3.1 were performed for each reaction network in order to minimise the objective function in Eqn (18). DE, like other EAs, is a non-deterministic algorithm, and multiple runs are usually required to reliably assess its performance on a particular problem. Each run used a population size P = 400 and number of generations G = 2000. Runs were terminated early if the best value of the objective function obtained did not change for 500 generations. The value of qmax (the maximum number of elementary reactions allowed in each trial network) was set to 10. Hence, in each case the DE searched for an optimal vector containing 50 integers, each of which can take a value between 0 and S, e.g. for the third reaction system S = 10 and so the entire search space contains 1050 reaction networks. All runs were performed using MATLAB v7.1 on a 1.8 GHz Windows PC with 2 Gb of RAM. The time taken for each run averaged at around 10 minutes. 25 6.4 Model selection methodology Instead of choosing the “best” result (i.e. the lowest value of SICD) of each DE run as the solution to the network inference problem we instead performed a further step to choose a solution. This is because the trial network with the lowest SICD is not necessarily the trial network that yields the lowest SIC when its ODEs are numerically integrated and compared directly with the measured concentration data. Errors introduced during the derivative approximation step can result in the DE search finding a trial network with the lowest SICD but not necessarily the lowest SIC when numerically integrated. This is defined as SICC:  SSEC   + ( p + α ) ln( N s ) SICC = N s ln N s   (29) where SSEC is the sum of squared errors between the measured concentration data and the numerically integrated prediction of the ODEs corresponding to a trial network, all other terms are identical to those in the DE objective function defined in Eqn. (18). Hence, at the end of each DE run the ODES corresponding to each trial network in the entire final population were numerically solved and the predicted concentration values evaluated against the experimental data in terms of the SICC. The network with the lowest SICC was considered to be the solution of the run, although in practice it would be desirable to consider several of the best performing networks from each run. These could be treated as a working portfolio of plausible reaction networks that could then be examined for chemical plausibility or as the starting point for a set of further experiments to discriminate between network hypotheses. 6.5 Results The results of running the DE ten times for each of the hypothetical reaction networks are described below: 26 Reaction network 1 Each of the DE runs converged to the same value of SICD = -696.29 corresponding to the reaction network described by Eqn. (30) with the following estimated rate coefficients kˆ1 = 0.090, kˆ2 = 0.130, kˆ3 = 0.130, kˆ4 = 0.304 and kˆ5 = 0.073. Note that this network, although close to the true solution, is incorrect. It actually comprises the true network plus an additional fifth reaction (underlined in Eqn. (30)) which is stoichiometrically identical to the second reaction but gives rise to different kinetic terms in the corresponding ODEs. This is not a deficiency of the DE search process however, because the correct network topology actually yields a higher (i.e. worse) value of SICD = -674.650. It seems likely that errors introduced by the derivative approximation process have led to overfitting whereby a network with an additional incorrect reaction fits the concentration derivative data better than the correct network. kˆ1 2 x1 → x2 kˆ2 x1 → x3 kˆ3 (30) x3 → x4 kˆ4 x2 + x4 → x5 kˆ5 x1 + x2 → x2 + x3 However, the application of the model selection methodology outlined in the previous section yielded the correct reaction network topology for each of the DE runs – showing that the correct solution, whilst not having the lowest SICD, was in each case present in the final population of each run and has an SICC better than that obtained for the incorrect solution above. The estimated rate coefficients for the correct topology are kˆ1 = 0.090, kˆ2 = 0.191, kˆ3 = 0.132 and kˆ4 = 0.307 and are close to the true rate coefficients k1 = 0.1, k2 = 0.2, k3 = 0.13 27 and k4 = 0.3. Hence, it can be concluded that the true reaction network topology has been recovered from the data with satisfactory estimates of the rate coefficients. Reaction network 2 The ten DE runs converged on solutions with SICD values in the range -768.30 to – 778.79. Once again, in each case the network with the lowest SICD of the run did not correspond to the true reaction network. Typically, the solutions found tend to indicate overfitting in that they comprise the correct network with incorrect additional reactions. For example, one such incorrect network is shown in Eqn. (31) with estimated rate coefficients kˆ1 = 0.2, kˆ2 = 0.099, kˆ3 = 0.153, kˆ4 = 0.053 and kˆ5 = 0.009. Note that the rate coefficients for the correct reactions are close to the true coefficients and that the identified rate coefficient for the incorrect reaction is small in comparison to those for the correct reactions. kˆ1 x1 + x2 → x3 + x4 kˆ2 x2 + x3 → x5 kˆ3 x1 + x4 → x6 (31) kˆ4 x6 → x1 + x4 kˆ5 x3 + x5 → 2 x4 + x5 Again, the application of the model selection step on the final population of each DE run yielded, in each case, the correct reaction network topology with estimated rate coefficients kˆ1 = 0.200, kˆ2 = 0.099, kˆ3 = 0.155 and kˆ4 = 0.058. These are close to the true rate coefficients k1 = 0.2, k2 = 0.1, k3 = 0.15 and k4 = 0.05. 28 Reaction network 3 Unlike the previous hypothetical reaction networks, only six of the ten runs correctly identified the correct network topology after the SICC model selection step. This is in contrast with the previous examples in which, in every case, the model selection step yielded the true network topology. This is not too surprising because this network was purposely designed to be a challenging problem in that it contains a “backbone” of unimolecular reactions in series, all with rate coefficients that are similar in magnitude. This means that many of the concentration time series profiles are highly correlated. Typically, the incorrectly identified networks are very similar to the true network in structure. For example, the incorrect network from run 6 is shown in Eqn. (32) and has estimated rate coefficients kˆ1 = 0.339, kˆ2 = 0.249, kˆ3 = 0.267, kˆ4 = 0.409, kˆ5 = 0.299 and kˆ6 = 0.033. The majority of the true network has been recovered correctly; the only incorrect reaction (underlined) contains the species x5 as the reactant instead of the correct reactant x4. Note that this incorrect reaction network satisfies the mass conservation constraint AN = 0, as did the incorrect networks found in the other DE runs. kˆ1 x1 + x2 → x3 kˆ2 kˆ3 kˆ4 x3 → x4 → x5 → x6 kˆ5 (32) x5 → x7 + x8 kˆ6 x5 → x9 + x10 In the six of the ten runs that yielded the correct network topology the estimated rate coefficients were kˆ1 = 0.338, kˆ2 = 0.249, kˆ3 = 0.300, kˆ4 = 0.403, kˆ5 = 0.299 and kˆ6 = 0.100. Again, these are very close to the true rate coefficients k1 = 0.35, k2 = 0.25, k3 = 0.3, k4 = 0.4, k5 = 0.3 and k6 = 0.1. 29 A further set of DE runs were performed that did not make use of the molecular weight information in the A matrix. In this case, only one of the ten runs yielded the correct network after the model selection step. Of the incorrect networks found in the other nine runs, each was tested and found to violate the AN = 0 conservation constraint. This emphasises the network search procedure is enhanced by the incorporation of prior chemical knowledge, especially on “difficult” reaction networks. 7 Conclusions Reverse engineering the topology and dynamic behaviour of chemical and biological networks from noisy experimental time series data is a hard “inverse” problem. In this paper an evolutionary computational method for the identification of chemical reaction networks and the associated rate coefficients has been presented. Three case studies using data from simulated batch reactor experiments were used to demonstrate the technique and it was shown that it is possible to correctly identify the underlying chemical reaction networks and hence their stoichiometries and ODE models. Advantages of our approach are: (a) it is almost entirely automated in that only a few parameters such as the DE population size P, number of generations G and maximum network size qmax need to be specified by the user (b) it can be applied to non-equilibrium chemical reaction systems, e.g. batch and semi-batch reactor experiments (c) in contrast to TFA methods, it is not necessary to separately determine either the number of independent reactions or reaction stoichiometries (d) the topology of the elementary reactions and the corresponding rate coefficients are estimated simultaneously (e) a priori chemical information in the form of reaction invariant constraints (e.g. molecular weights) can, when available, be incorporated into the network search procedure in a natural manner (f) the use of selfadaptive DE to search the space of elementary reaction networks provides a straightforward, 30 robust optimisation method for the estimation of chemical reaction topologies and (g) the use of a population based search makes the subsequent use of a model selection procedure simple to apply. Currently there are limitations to the method, principally: (a) it is assumed that concentration measurements are available for all of the species. When this is not true, however, it may be possible to employ existing TFA related methods [2] for estimating concentration data for unmeasured species (b) most chemical and biological networks tend to be sparsely connected and to promote parsimonious solutions a penalty function (soft constraint) approach was used in this work. It is likely, however, that the use of a multi-objective EA approach (e.g. see [26]) should improve the method by promoting diversity of network complexity in the population (c) the current implementation has only been tested on simulated reaction networks comprising elementary reactions and it is as yet unclear how method performs – or could be modified to perform - when presented with observed data from networks containing “complex” reactions, i.e. reactions comprising one or more elementary reactions where the intermediates cannot be measured and/or exist only fleetingly as transitional states. Whilst the advantages of the incorporation of a priori chemical information have been demonstrated, it would be worthwhile considering the incorporation of additional system constraints in order to improve the robustness and reliability of the approach. Energy constraints, as well as those based on mass, could be used to enhance the network search process. For instance, a reaction – at constant temperature and pressure - can only occur if the Gibbs free energy of the reactants exceeds the Gibbs free energy of the products [27]. Future work will attempt to address the points discussed above in addition to testing the method on real experimental data from both “simple” reaction systems and from “complex” oscillating reaction networks such as that described in [28]. 31 Finally we note that the success of the current approach is dependent on the ability to satisfactorily estimate first derivative values from sufficiently dynamically rich time series concentration data. The method used here (rational polynomials) is fairly simple but for real data more robust methods such as that recently described in [29] may be more appropriate. Acknowledgement This work was supported by the UK Engineering and Physical Research Council (EPSRC). References [1] Maria G. A review of algorithms and trends in kinetic model identification. Chem. Biochem. Eng. Q. 2004; 18(3):195–222. [2] Bonvin D, Rippin, DWT. Target factor analysis for the identification of stoichiometric models. Chem. Eng. Sci. 1990; 45(12):3417-3426. [3] Brendel M, Bonvin D, Marquadt W. Incremental identification of kinetic models for homogeneous reaction systems. Chem. Eng. Sci. 2006; 61:5404-5420. [4] Kikuchi S, Tominaga D, Arita M, Takahashi K,Tomita M. Dynamic modelling of genetic networks using genetic algorithm and s-system. Bioinformatics. 2003; 19(5):643-650. [5] Noman N, Iba H. Inference of gene regulatory networks using s-system and differential evolution. In: GECCO ’05: Proceedings of the 2005 Conference on Genetic and Evolutionary Computation. ACM. 2005; 439-446. 32 [6] Fotopoulos J, Georgakis C, Stenger HG. Structured target factor analysis for the stoichiometric modeling of batch reactors. In: Proceedings of the 1994 American Control Conference. 1994; 1: 495-499. [7] Harmon JL, Duboc P, Bonvin, D. Factor analytical modeling of biochemical data. Comput. Chem. Eng. 1995; 19(12):1287-1300. [8] Amrhein M, Srinivasan B, Bonvin D. Target factor analysis of reaction data: use of data pre-treatment and reaction-invariant relationships, Chem. Eng. Sci. 1999; 54(5): 579-591. [9] Savageau MA. Biochemical systems analysis: I. Some mathematical properties of the rate law for the component enzymatic reactions. J. Theoret. Biol. 1969; 25:365-369. [10] Voit EO. The dawn of a new era of metabolic systems analysis, Biosilico. 2004; 2(5): 182-189. [11] Searson DP, Willis MJ, Horn SJ, Wright AR. Inference of chemical reaction networks using hybrid s-system models. Chemical Product and Process Modeling. 2007; 2 (10). [12] Vilela M, Chou I, Vinga S, Vasconcelos ATR, Voit EO, Almeida JS. Parameter optimization in s-system models. BMC Syst. Biol. 2008; 2:35. [13] Crampin EJ, Schnell S, McSharry PE. Mathematical and computational techniques to deduce complex biochemical reaction mechanisms. Prog. Biophys. Mol. Biol. 2004; 86(1): 77-112. 33 [14] Searson DP, Burnham SC, Willis MJ, Wright AR. Identification of chemical reaction mechanism from batch process data, In: Proceedings of the 17th IASTED International Conference on Modelling and Simulation. Montreal. 2006; Paper 530-102. [15] Srividhya J, Crampin EJ, McSharry PE, Schnell S. Reconstructing biochemical pathways from time course data. Proteomics. 2007; 7:828-838. [16] Burnham SC, Searson DP, Willis MJ, Wright AR. Inference of chemical reaction networks, Chem. Eng. Sci. 2008;63(4): 862-873. [17] Storn R, Price K. Differential evolution: a simple and efficient heuristic for global optimization over continuous spaces. J. Global Optim. 1997; 11(4): 341-359. [18] Voit EO, Almeida J. Decoupling dynamical systems for pathway identification from metabolic profiles. Bioinformatics. 2004; 20(11): 1670-1681. [19] Akaike H. A new look at the statistical model identification, IEEE Transactions on Automatic Control. 1974; 19(6):716–723. [20] Schwartz G. Estimating the dimension of a model. Ann. Stat. 1978; 6:461-464. [21] Burnham KP, Anderson DR. Model selection and multimodel inference: a practicaltheoretic approach, 2nd ed., Springer-Verlag, 2002. [22] Aris R, Mah RHS. Independence of chemical reactions. Industrial and 34 Engineering Chemistry Fundamentals. 1963; 2:90-94. [23] Vesterstroem J, Thomsen R. A comparative study of differential evolution, particle swarm optimization, and evolutionary algorithms on numerical benchmark problems. In: Proceedings of the IEEE Congress on Evolutionary Computation. 2004; 1980–1987. [24] Fan H, Lampinen J. A trigonometric mutation operation to differential evolution. J. Global Optim. 2003. 27:105–129. [25] Brest J, Greiner S, Bošković B, Mernik N, Žumer V. Self-adapting control parameters in differential evolution: a comparative study on numerical benchmark problems. IEEE Trans. Evol. Comput. 2006; 10(6):646-657. [26] Hinchliffe M, Willis MJ. Dynamic systems modelling using genetic programming. Comput. Chem. Eng. 2003; 27(12): 1841-1854. [27] Beard DA, Liang S, Qian H. Energy balance for analysis of complex metabolic networks. Biophysical Journal. 2002; 83(1): 79-86. [28] Novakovic K, Grosjean C, Scott SK, Whiting A, Willis MJ, Wright AR. Achieving pH and Qr oscillations in a phenylacetylene carbonylation reaction using an automated reactor system. Chem. Phys. Lett. 2007. 435(1-3): 142-147. 35 [29] Vilela M, Borges CCH, Vinga S, Vasconcelos ATR, Santos H, Voit EO, Almeida JS. Automated smoother for the numerical decoupling of dynamics models. BMC Bioinformatics. 2007; 8: 305. 36
9cs.NE
Variational collision avoidance problems on Riemannian manifolds arXiv:1804.00122v1 [cs.SY] 31 Mar 2018 Mishal Assif, Ravi Banavar, Anthony Bloch, Margarida Camarinha and Leonardo Colombo Abstract— In this article we introduce a variational approach to collision avoidance of multiple agents evolving on a Riemannian manifold and derive necessary conditions for extremals. The problem consists of finding non-intersecting trajectories of a given number of agents, among a set of admissible curves, to reach a specified configuration, based on minimizing an energy functional that depends on the velocity, covariant acceleration and an artificial potential function used to prevent collision among the agents. The results are validated through numerical experiments on the manifolds R2 and S 2 . I. INTRODUCTION Path planning and collision avoidance of multiple agents have been areas of significant interest in the past few decades due to its broad applications in power networks, biological networks, social networks, mechanical networks and so on. Finding trajectories that take a set of agents from one configuration to another while avoiding collisions and minimizing some quantity like energy or time has been an important problem with applications in a variety of domains [15]. Distributed protocols were proposed for various agent networks, including general linear dynamical networks, nonlinear system networks, and mobile robotic networks in the last years [6]. Nevertheless there still exist some gaps in the literature in the bridge of knowledge between multi-agent systems and geometric mechanics. Calculus of variations in the large, as presented in Milnor [16], has been exploited in the past for various applications. In Crouch and Silva Leite [11] the authors have used it to develop a theory of generalized cubic polynomials for dynamic interpolation problems on Riemannian manifolds. More recently, Bloch, Camarinha and Colombo [3] have used these variational methods to solve obstacle avoidance problems on Riemannian manifolds. In this article, inspired by the recent work [3], we seek to extend this method to find necessary conditions for optimal trajectories of multiple agents on a Riemannian manifold that seek to achieve a specified configuration while avoiding collisions among themselves. Specifically, the problem studied in this paper consists of finding non-intersecting trajectories of a given number of agents, among a set of admissible curves, to reach a specified configuration and minimizing an energy functional that depends on the velocity, covariant acceleration M. Assif (mishal [email protected]) is with Mechanical Engineering and R. N. Banavar ([email protected]) is with the Systems and Control Enginerring, Indian Institute of Technology Bombay, Mumbai, Maharashtra 400076, India. A. Bloch ([email protected]) is with Department of Mathematics, University of Michigan, 530 Church St. Ann Arbor, 48109, Michigan, USA. M. Camarinha ( [email protected]) is with CMUC, Department of Mathematics, University of Coimbra, 3001-501 Coimbra, Portugal . L. Colombo ([email protected]) is with Instituto de Ciencias Matemáticas (ICMAT), Calle Nicolás Cabrera 13-15, 28049, Madrid, Spain. and an artificial potential function used to prevent collision. To solve the problem, we employ techniques from calculus of variations on Riemannian manifolds taking into account that the problem under study can be seen as a higher order variational problem [4], [8], [10], [14]. The article is organized as follows. In section 2, we introduce some concepts from Riemannian geometry relevant to the rest of the article. In the next section, we define the variational collision avoidance problem on Riemannian manifolds and derive necessary conditions for the existence of extrema. In the following section we extend our analysis to Lie groups endowed with a left-invariant metric. We show how to apply the results of this work in particular examples: two agents moving on a Euclidean space, the sphere, and the collision avoidance of multiple rigid bodies on SO(3). II. P RELIMINARIES A. Preliminaries on Riemannian Geometry Let M be a smooth (C ∞ ) Riemannian manifold with Riemannian metric denoted by < ·, · > : Tx M × Tx M → R at each point x ∈ M , where Tx M is the tangent space of M at x. The length of a tangent vector is determined by its norm, ||vx || = hvx , vx i1/2 with vx ∈ Tx M , for each point x ∈ M. A Riemannian affine connection ∇ on M , is a map that assigns to any two smooth vector fields X and Y on M a new vector field, ∇X Y , called the covariant derivative of Y with respect to X satisfying ∇f X Y = f ∇X Y, and ∇X (f Y ) = X(f )Y + f ∇X Y for all vector fields X, Y ∈ X(M ) and f ∈ C ∞ (M ), where X(M ) denotes the set of vector fields on M . For the properties of ∇, we refer the reader to [5], [7], [16]. Consider a vector field W along a curve x on M . The n-th order covariant derivative of W along x is denoted by Dn+1 x Dn W with n ≥ 1. We denote by the n-th order dtn dtn+1 covariant derivative along x of the velocity vector field of x, n ≥ 1. Given vector fields X, Y and Z on M , the vector field R(X, Y )Z given by R(X, Y )Z = ∇X ∇Y Z − ∇Y ∇X Z − ∇[X,Y ] Z (1) defines the curvature tensor of M , where [X, Y ] denotes the Lie bracket of the vector fields X and Y . R is trilinear in X, Y and Z and a tensor of type (1, 3). Hence for vector fields X, Y, Z, W on M the curvature tensor satisfies ([16], p. 53) hR(X, Y )Z, W i = hR(W, Z)Y, Xi. (2) Let S be a submanifold of M and Ω ⊂ M be the set of all C 1 piecewise smooth curves x : [0, T ] → M such that dx x(0), dx dt (0) and x(T ) ∈ S are fixed, and dt (T ) ∈ Tx(T ) S. The set Ω is called the admissible set. For the class of curves in Ω we introduce the C 1 piecewise smooth one parameter admissible variation of a curve x ∈ Ω by α : (−, ) × [0, T ] → M ; (r, t) 7→ α(r, t) = αr (t) that satisfy α0 = x and αr ∈ Ω, for each r ∈ (−, ). The variational vector field associated to an admissible variation α is a C 1 -piecewise smooth vector field X along x defined by X(t) = D ∂r r=0 III. T HE VARIATIONAL COLLISION AVOIDANCE PROBLEM ON R IEMANNIAN MANIFOLDS Let M be a complete smooth Riemannian manifold. Let T , n and k be positive real numbers. Consider n agents evolving on M , and (pi0 , v0i ), with i = 1, 2..., n, points in T M corresponding to the initial positions and velocities of the agents. For each i = 1, . . . , n, consider the set Ωi ⊂ M of all C 1 piecewise smooth curve on M , xi : [0, T ] → M verifying the boundary conditions dxi (0) = v0i dt dxi (T ) ∈ Txi (T ) S xi (T ) = piT ∈ S, dt xi (0) = pi0 , α(r, t) ∈ Tx(t) Ω verifying the boundary conditions X(0) = 0, DX (0) = 0, dt X(T ) = 0 DX (T ) ∈ Tx(T ) M dt where the tangent space of Ω at x is the vector space Tx Ω of all C 1 piecewise smooth vector fields X along x verifying the former boundary conditions. Lemma 2.1 ([16], p.52): The one parameter variation satisfies  ∂α ∂α  ∂α D D2 α D2 ∂α = 2 +R , . 2 ∂r ∂t ∂t ∂r ∂r ∂t ∂t Next, assume that M is an n-dimensional complete Riemannian manifold. In this context the Riemannian distance between two points in M can be defined by means of the Riemannian exponential on M , that is, d(q, p) = kexp−1 q pk. We need to guarantee that the exponential map expq is a local diffeomorphism, so we assume that the point p must belong to a convex open ball around q. If we consider the geodesic from p to q given by γp,q (s) = expp (s exp−1 p q), dγp,q (s) is independent of s, we s ∈ [0, 1], then, because ds can write Z 1 2 dγp,q d2 (p, q) = (s) ds. ds 0 The proof of the following lemmas can be found in [13]. Lemma 2.2: Let M be a complete smooth Riemannian 2 manifold. Then d(p, q) = kexp−1 p qk is well defined ∀p, q ∈ M. Moreover, if α : (−, ) → M is a smooth curve, D ∂α E ∂ d(p, α(r)) =− (0), exp−1 p α(0) ∂r ∂r r=0 Lemma 2.3: If Xi (t) is smooth vector field along xi (t) ∈ Ωi , such that Xi (T ) = 0 and dXi (T ) ∈ Txi (T ) S dt then α(r, t) = exp(rXi (t)) is an admissible variation of xi (t) whose variational vector field is Xi . (the n agents reach a specified point on the submanifold S with velocity tangent to S) and define the functional J on Ώ = Ω1 ×...×Ωn n Z 2 2 1X T D 2 xi dxi (t) + k (t) J(x1 , x2 , ..., xn ) = 2 2 i=1 0 dt dt ! n X 2 + F (kexp−1 xj (t) xi (t)k ) dt j=1,j6=i where expx : V0 ⊂ Tx M → M is the geodesic exponential map, which is a smooth diffeomorphism of some open set around 0 ∈ Tx M onto an open set around x, F : R → R∗ is a smooth function from the reals to the extended reals such that F (0) = +∞. The functional is constructed as the sum of a combination of the velocity and covariant acceleration of the individual trajectories regulated by a parameter k and a function that penalizes collisions between the agents. Problem: The variational collision avoidance problem involves minimizing the functional J among Ώ. In order to minimize the functional J among the set Ώ we want to find curves x ∈ Ώ such that J(x) ≤ J(x̃), for all admissible curves x̃ in a C 1 neighborhood of x. Remark 3.1: Note that the factor 21 multiplying n X 2 F (kexp−1 xj (t) xi (t)k ) is to not count twice the j=1,j6=i same potential function for two agents to avoid collision between them. Theorem 3.1: Let xi ∈ Ωi . If α is an admissible variation of xi with variational vector field Xi , then Z T D D 4 xi D 2 xi d = Xi , − k 0 = J(αr ) dr dt4 dt2 r=0 0  D2 x dx  dx i i i +R , dt2 dt dt ! n E X −1 −1 0 2 − F (kexpxi (t) xj (t)k )expxi (t) xj (t) dt j=1,j6=i + l hD − X DXi D2 xi E D dxi D3 xi Eiti , + Xi , k − . dt dt dt dt3 t+ i−1 i=1 Proof: If α is an admissible variation of xi ∈ Ωi with variational vector field Xi , then Z T D D D2 α ∂α E D D2 α D2 α E d , + k J(αr ) = , dr dr dt2 dt2 ∂r∂t ∂t 0 ! n X −1 −1 0 2 ∂ 2 + F (kexpxj (t) α(t)k ) kexpxj (t) αr (t)k dt. ∂r j=1,j6=i By lemma 2.2 D E ∂ ∂ −1 2 kexp−1 α (t)k = − exp x (t), α (t) r j r xj (t) αr (t) ∂r ∂r By lemma 2.1 and the previous equation 2) xi is smooth on [0, T ] 2 3) Ddtx2 i (T ) ⊥ Txi (T ) S Proof: Assume x́ ∈ Ώ is a local minimizer of J. Consider a variation of x́, άr,i (t) := (x1 (t), .., αr,i (t), ..., xn (t)), where αr,i (t) is an admissible variation of Ωi with variational d = 0 ∀i ∈ 1, 2, ...n. vector field Xi . Then dr J(αr,i ) r=0 Let us consider Xi defined as h D4 x  D2 x dx  dx D2 x i f + R , − k dt4 dt2 dt dt dt2 n  X i −1 2 − F 0 (kexp−1 x (t)k ).(exp x (t)) j j xi (t) xi (t) j=1,j6=i Z T D 2 where f is a smooth real valued function on [0, T ] such that D ∂α D2 α E d J(αr ) = , f (ti ) = f 0 (ti ) = 0 and f (t) > 0, t 6= ti , i = i, ..., l. So, we dr dt2 ∂r dt2 0 have D  ∂α ∂α  ∂α D2 α E D D2 α ∂α E Z T + R +k , , , D 4 xi d ∂r ∂t ∂t ∂t2 ∂r∂t ∂t fk 4 = 0 = J(αr ) ! n dr dt r=0 D ∂α (t) E X 0 r −1 2 − F 0 (kexp−1 α (t)k ) , exp x (t) dt.  D2 x dx  dx xj (t) r αr (t) j D 2 xi i i i ∂r +R , −k 2 j=1,j6=i 2 dt dt dt ! dt n Integrating the first term by parts twice and the third term X −1 2 2 once, and applying Lemma 2.1 to the second term, we obtain F 0 (kexp−1 dt − xi (t) xj (t)k )expxi (t) xj (t)k that j=1,j6=i Z T D  D2 α ∂α  ∂α d D2 α Since f (t) is greater then zero outside a set of measure zero, ∂α D4 α J(αr ) = , 4 +R , − k dr ∂r dt dt2 ∂t ∂t dt2  D2 x dx  dx 0 D 4 xi D 2 xi i i i ! +R , − k − n E D X dt4 dt2 dt dt dt2 ∂ −1 2 n α (t), exp x (t) dt − F 0 (kexp−1 α(t)k )   X r αr (t) j xj (t) ∂r −1 2 j=1,j6=i =0 F 0 (kexp−1 xi (t) xj (t)k )expxi (t) xj (t) l − j=1,j6 = i hD E D Ei X D ∂α D2 α ∂α ∂α D3 α ti + , 2 + ,k − from which statement 1 follows. dt ∂r dt ∂r ∂t ∂t3 t+ i−1 i=1 Now, choose Xi ∈ Txi Ωi such that where the interval [0, T ] is partitioned as 0 = t0 < t1 < ... < tl = T such that in each subinterval xi is smooth. D 3 xi + D 3 xi − X (t ) = (t ) − (t ) ∀j = 1, .., l − 1 i j j 3 Taking r = 0 in the last equation, dt dt3 j DXi D 2 xi − D 2 xi + (tj ) = (t ) − (t ) ∀j = 1, .., l − 1 Z T D j dt dt2 dt2 j D 4 xi d J(αr ) r = 0 = Xi , DXi dr dt4 Xi (T ) = (T ) = 0 0 dt  D2 x ∂x  ∂x 2 D x i i i i Therefore, +R , −k 2 dt2 ∂t ∂t dt ! l−1 n  X E X d D 2 xi − D 2 xi + 2 −1 2 0 = J(α ) r = 0 = (t ) − (t ) − F 0 (kexp−1 x (t)k ).exp x (t) dt r i j j xj (t) xi (t) dr dt2 dt2 j i=1 j=1,j6=i l hD − X DXi D2 xi E D dxi D3 xi Eiti , + X , k − . i dt dt2 dt dt3 t+ i−1 i=1  Theorem 3.2: If x́ ∈ Ώ is a local minimizer of J, then ∀i ∈ 1, 2..., n 1)  D2 x dx  dx D 4 xi D 2 xi i i i + R , −k 2 4 2 dt dt dt dt dt n X −1 2 = F 0 (kexp−1 xj (t) xi (t)k ).(expxi (t) xj (t)) j=1,j6=i D 3 xi + D 3 xi − (tj ) − (t ) 3 dt dt3 j which implies that + D 2 xi − D2 xi + (t ) = (t ) j dt2 dt2 j 2 =0 D 3 xi + D 3 xi − (t ) = (t ) j dt3 dt3 j Since xi is a C 1 curve with continuous covariant derivatives up to order 3, xi is C 3 on [0, T ]. But, we have shown that xi is the solution of a fourth order smooth ODE, which means the fourth derivative can be expressed as a smooth function of derivatives upto order 3. The k th order derivative can be expressed as a smooth function of derivatives upto order k − 1, and so by induction, xi is smooth on [0, T ]. Hence, statement 2 follows. dXi i When Xi (T ) = 0, DX ∂t (T ) = dt (T ). Now, choose Xi ∈ Txi Ωi such that   2 DXi D xi (T ) Xi (T ) = 0, and (T ) = ΠTxi (T ) S dt ∂t2 where ΠTxi (T ) S V is the orthogonal projection onto Txi (T ) S DXi i of V ∈ Txi (T ) M . Since Xi (T ) = 0, dX dt (T ) = ∂t (T ) ∈ Txi (T ) S. By lemma 2.3, Xi is the variational vector field of an admissible variation. Therefore,   2 E D D 2 xi D xi d (T ) , (T ) =0 J(αr ) r = 0 = ΠTxi (T ) S dr ∂t2 ∂t2  2  D xi =⇒ ΠTxi (T ) S (T ) = 0 ∂t2 Hence statement 3 holds.  Remark 3.2: We now make some remarks on the previous result for the following scenarios: • If M is an n-dimensional manifold and S is an mdimensional submanifold, with m < n, then the conditions x(0) and dx dt (0) being fixed gives 2n independent boundary conditions, the condition x(T ) being fixed gives another n independent boundary conditions, and dx dt (T ) ∈ Tx(T ) S gives yet another n − m boundary conditions. Theorem 3.2 (3) gives an additional m boundary conditions. The fourth order boundary value problem given by Theorem 3.2 (1) along with the 4n boundary conditions forms a well posed problem. • If we were to change the endpoint boundary condition dxi i to be dx dt (T ) = vi (i.e dt (T ) is a fixed vector), then it easily follows that conditions (1) and (2) of Theorem 3.2 still hold, but condition (3) does not hold. This still results in 4n boundary conditions. • If we consider endpoint boundary conditions xi (T ) ∈ S (i.e xi (T ) is not fixed, but can be any element in S) i and dx dt (T ) ∈ Txi (T ) S, all the conditions in Theorem 3.2 still hold. But, in this case, we have 2n initial conditions, the endpoint conditions x(T ) ∈ S gives n − m conditions, and dx dt (T ) ∈ Tx(T ) S gives n − m boundary conditions. These 4n − 2m conditions, along with the m conditions given by Theorem 3.2 (3) gives only 4n − m boundary conditions. We expect to find another m conditions, similar to Theorem 3.2 (3), in this case. We explore such an extension of Theorem 3.2 to this situation in a future work as we comment in Section V. A. Example: Planar agents on an Euclidean space We consider the case of 2 agents evolving on M = R2 endowed with the Euclidean Riemannian metric. At time T = 0, the first agent (agent blue in Figure 1) is at p10 = (0, 0) with velocity v01 = (1, 0), and the second agent (agent green in Figure 1) is at p20 = (1, 0) with velocity v02 = (0, 1). At time T = 1 the first agent is at p11 = (1, 1) with velocity v11 = (0, 1), and the second agent is at p21 = (0, 1) with velocity v12 = (0, 1). At time T = 2 the first agent is at p12 = (0, 2) with velocity v21 ∈ Tp12 S1 , and the second agent is at p22 = (1, 2) with velocity v22 ∈ Tp22 S2 . Here, S1 = {(z 1 , z 2 ) ∈ R2 | k(z 1 , z 2 ) − (0.2, 2)k2 = 0.2}, and S2 = {(z 1 , z 2 ) ∈ R2 | k(z 1 , z 2 ) − (1, 1.8)k2 = 0.2}. Note that in this particular example, S (the submanifold in Theorem 3.2) is the disjoint union of the two circles shown in Figure 1. Here we have taken F : (0, ∞) → (0, ∞) 1 given by F (x) = , and the value of k = 0. Note that at x time T = 1, the boundary conditions are that mentioned in Remark 3.2. In this particular case, the argument of F is the usual Euclidean distance between two points. We show in Figure 1 some simulations of the trajectories given by Theorem 3.2. Note that the trajectories exhibit the usual Sshape of cubic polynomials. On R2 endowed with the Euclidean metric, exp−1 x1 (x2 ) = x2 − x1 . We denote by (xi (t), yi (t)) the trajectory of the i-th agent. The conditions of Theorem 3.2 (1) translate to x1 − x2 , x0000 1 = ((x2 − x1 )2 + ((y2 − y1 )2 )2 y1 − y2 y10000 = , ((x2 − x1 )2 + ((y2 − y1 )2 )2 x2 − x1 , x0000 2 = ((x2 − x1 )2 + ((y2 − y1 )2 )2 y2 − y1 y20000 = . ((x2 − x1 )2 + ((y2 − y1 )2 )2 Theorem 3.2 (3) gives y100 (2) = 0, x002 (2) = 0. along with the conditions x1 (0) = 0, y1 (0) = 0, x2 (0) = 1, y2 (0) = 0, x01 (0) y10 (0) x02 (0) = 0, y20 (0) = 1, = 1, = 0, x1 (1) = 1, y1 (1) = 1, x2 (1) = 0, y2 (1) = 1, x01 (1) y10 (0) x02 (1) = 0, y20 (0) = 1, x2 (2) = 1, y2 (2) = 2. = 0, = 1, x1 (2) = 0, y1 (2) = 2, x01 (2) y20 (2) = 0, = 0. B. Example: Agents on a 2-Sphere In this example, we consider 2 agents evolving on the 2-sphere S 2 = {x ∈ R3 | kxk2 = 1} endowed with the induced Riemannian structure from R3 . We have taken fixed position and velocity conditions p10 = (0.7, 0.3, 0.648), v01 = (1, 0, −1.08), p11 = (−0.7, 0.3, 0.648), v11 = (1, 0, 1.08), p20 = (0.7, 0.6, 0.3873), v02 = (0, −1, 1.55), p21 = (−0.7, 0.6, 0.3873), v12 = (0, 1, −1.55). As before, we have taken F : (0, ∞) → (0, ∞) given 1 by F (x) = , and the value of k = 0. Figure 2 shows x the trajectories satisfying Theorem 3.2 followed by the agents. Agent 1 and 2 follow the blue and brown trajectories 1 y (m) 2 1.5 0.5 1 0 0.5 −0.5 0 0 0.5 x (m) 1 −1 −1 Fig. 2. Fig. 1. Optimal Path traced by two agents evolving on −0.5 0 0.5 1 Optimal Path traced by two agents evolving on S 2 . R2 . respectively in 2. For x, y ∈ S 2 , y − hx, yix −1 exp−1 (hx, yi) p , x (y) = cos 1 − hx, yi2 −1 kexp−1 (hx, yi). x (y)k = cos For the purpose of computation, we parametrize S 2 with the (θ, φ) coordinates as x = (sinθsinφ, sinθcosφ, cosθ) If (θ(t), φ(t)) is the coordinate representation of the curve x(t), it can be shown that D4 x  0000 = θ + (5sin2θ)θ02 φ02 + (1 − 7cos2 θ)θ00 φ02 dt4 + (5 − 17cos2 θ)θ0 φ0 φ00 − (3sinθcosθ)φ002 ∂ + − (2sin2θ)φ0 φ000 + (sinθcos3 θ)φ04 ∂θ  φ0000 − 7θ0 θ00 φ0 − 5θ02 φ00 + (4cotθ)θ000 φ0 + (6cotθ)θ00 φ00 + (4cotθ)φ000 θ0 + (sin2θ − cotθ(5cos2 θ − 1))θ0 φ03  ∂ , − (6cos2 θ)φ02 φ00 − (2cotθ)φ0 θ03 ∂φ  D2 x dx  dx R , = 0. dt2 dt dt If (θi (t), φi (t)) denote the coordinate representation of the trajectory of the i-th agent, then 3.2 in local coordinates gives a 2 point boundary value problem in the variables (θi , φi ), which can be solved to obtain the optimal trajectories. IV. VARIATIONAL COLLISION AVOIDANCE PROBLEM ON L IE G ROUPS On a Lie group G, we can give an explicit notion of geodesic exponential. Let e be the identity element on G, and g denotes the Lie algebra associated with G, that is, g = Te G. A vector field X ∈ X(G) is called left-invariant if Th Lg (X(h)) = X(Lg (h)) = X(gh) for all g, h ∈ G. In particular for h = e this means that a vector field X is left-invariant if ġ = X(g) = Te Lg ζ for ζ = X(e) ∈ g. Note that if X is a left invariant vector field, then ζ = X(e) = Tg Lg−1 ġ. Given ζ ∈ g, we denote by Xζ the left-invariant vector field defined as Xζ (g) = Te Lg (ζ), ∀g ∈ G. Let φζt denote the flow of Xζ . Let U be some neighborhood of 0 ∈ g, the exponential function exp : U ⊂ g → G is defined as exp(ζ) = φζ1 (e). If G is equipped with a Riemannian structure, it is not in general true that the 2 notions of an exponential coincide. Geodesics on a Lie group are not generally the flow of a left-invariant vector field on G. A connection on G for which geodesics are flows of left-invariant vector fields is called a Cartan connection. Any inner product on g induces a left invariant Riemannian metric on G (see [7] p. 271). The restriction of such a e : g × g → g. Riemannian metric to g will be denoted by ∇ A Riemannian metric which is both left and right invariant is called bi-invariant. Unfortunately, the Riemannian metric being left-invariant does not guarantee the Levi-Civita connection it induces will be a Cartan connection. It can be shown that the Levi-Civita connection induced by a biinvariant Riemannian metric on G is also a Cartan connection (see [19] p. 156). In fact, on a connected Lie group, the converse of the statement is also true, i.e. if the Levi-Civita connection induced by a left-invariant Riemannian metric is also a Cartan connection, then the Riemannian metric is bi-invariant. In the following discussion, we exclusively deal with the case where G is endowed with a left-invariant Riemannian metric such that the Levi-civita connection it induces is also a Cartan connection. Therefore, assume that G endowed with a left-invariant Riemannian metric h·, ·i, with I : g × g → R the corresponding inner product on the Lie algebra g, a positive-definite symmetric bilinear form in g. The inner product I defines the metric h·, ·i completely via left translation (see for instance [7] pp. 273). Let x : I ⊂ R → G be a smooth curve on G. The body velocity of x is the curve v : I ⊂ R → g defined   dx by v(t) = Tx(t) Lx(t)−1 (t) . dt Let {e1 , . . . , en } be a basis of g. We denote by uL the left-invariant vector field associated with u ∈ g. The body n X velocity of x on the given basis is described by v = vi e i , i=1 where v1 , . . . , vn are the so-called pseudo-velocities of the curve x with respect to the given basis. The velocity vector can be written in terms of the pseudo-velocities as follows Denote by t → Ri (t) ∈ SO(3) a curve for the ith agent, i = 1, 2, 3 and let I be the (3 × 3)-identity matrix. The columns of the matrix Ri (t) represent the directions of the principal axis of the ith body at time t with respect to some reference system. Let so(3) = TI SO(3) be the Lie algebra of the Lie group SO(3), that is, the set of 3×3 skew-symmetric matrices, so(3) = {Ṙ(0)|R(t) ∈ SO(3), R(0) = I} = {Ω̂ ∈ R3×3 |Ω̂ is skew-symmetric}. n X dx (t) = Te Lx(t) v(t) = vi (t)(ei )L (x(t)). dt i=1 (3) When the body velocity is interpreted as a control on the Lie algebra, equations (3) give rise to the so called leftinvariant control systems discussed in [9]. Therefore our analysis also includes this class of kinematic control systems. To write the equations determining necessary conditions for existence of extrema in the variational collision avoidance problem, we must use the following formulas (see [1], Section 7 for more details). e vv = ∇ n X −1 −1 exp−1 y)), x y = Te Lx (expe (x e e ei , vi vj ∇ j i,j=1   D2 x 0 e vv , = T L v + ∇ e x dt2   D3 x 00 e v 0 v + 2∇ e v v0 + ∇ e v∇ e vv , = T L v + ∇ e x dt3  D4 x e v00 v + 3∇ e v 0 v 0 + 3∇ e v v 00 + ∇ e v0 ∇ e vv = Te Lx v 000 + ∇ 4 dt  e v∇ e v 0 v + 3∇ e v v0 + ∇ e vv , + 2∇  D2 x dx  dx   e 0 , v)v + R( e ∇ e v v, v)v , R , = T L R(v e x dt2 dt dt e denotes the curvature tensor associated with ∇. e where R Thus, as a consequence of Theorem 3.2 (1) we have the following result Corollary 4.1: The equations giving necessary conditions for the existence of minimizers in the variational collision avoidance problem where agents are defined on a Lie group G are e v00 vi + 3∇ e v 0 v 0 + 3∇ e v v 00 + ∇ e v0 ∇ e v vi 0 =v 000 + ∇ i i i i i i i i ev ∇ e v 0 vi + 3 ∇ e v v0 + ∇ e v vi + R(v e 0 , vi )vi + 2∇ i i i i i i   0 e e e + R(∇vi vi , vi )vi − k vi + ∇vi vi n  X  −1 2 −1 −1 − F 0 (kexp−1 (x x )k )exp (x x ) . i j e e j i It is well know that (see [2] for instance) so(3) ' R3 using the isomorphism   0 −Ω3i (t) Ω2i (t) 0 −Ω1i (t)  ' (Ω1i , Ω2i , Ω3i ) Ω̂i (t) =  Ω3i (t) 2 1 −Ωi (t) Ωi (t) 0 where Ωi = (Ω1i , Ω2i , Ω3i ) ∈ R3 . We consider the basis of so(3) represented by the canonical basis of R3 denoted by {e1 , e2 , e3 } and endow SO(3) with the left-invariant metric defined by the inner product 3 X I= Jki ek ⊗ ek where Jki are the elements of the diagonal k=1 matrix defining the kinematics structure of the rigid body, the inertia moments, with k = 1, 2, 3 for each i = 1, 2, 3 and {e1 , e2 , e3 } the dual basis of {e1 , e2 , e3 }. The Levi-Civita connection ∇ induced by h·, ·i determined by the inner product is completely determined by its restriction to so(3) and given by (see for instance [7] p. 281)  e v z = 1 v × z + 1 I−1 (v × (Iz) + w × (Iv) ∇ 2 2 where v = (v1 , v2 , v3 ) ∈ R3 and z = (z1 , z2 , z3 ) ∈ R3 . For simplicity in the exposition we consider the case of a symmetric rigid body with Jki = 1 with i, k = {1, 2, 3}. Then the formula above for the Levi-Civita connection e v z = 1 (v × z). By using equation (2), the reduces to ∇ 2 restriction of the curvature tensor to so(3) is defined by e z)w = − 1 (v × z) × w where v, z, w ∈ R3 . R(v, 4 For the collision avoidance problem we consider F : R+ → R+ as F (x) = x1 where the argument of F is the usual Euclidean distance between two elements on so(3) ' 1 2 R3 , that is, F (kexp−1 Q Rk ) = kexp−1 Rk2 with R, Q ∈ Q SO(3) and where exp : so(3) → SO(3) representing the matrix exponential on SO(3). By Corollary 4.1 the necessary conditions for the normal extremals for the variational collision avoidance problem are determined by the solutions of the equation j=1,i6=j A. Example: Collision avoidance of rigid bodies on SO(3) We clarify the notion of collision avoidance on SO(3) as follows: The idea is to ensure that n agents, each evolving on the manifold SO(3), do not attain the same orientation at any given instant of time. In this particular example, we consider a collision avoidance problem for the motion of three rigid bodies in the space where the configuration space of each agent is the Lie group G = SO(3). 3 3 vi000 =vi00 × vi + kvi0 + (vi0 × vi ) × vi + vi0 × vi 4 2 3 X exp−1 (Rj−1 Ri ) + . kexp−1 (Ri−1 Rj )k4 j=1,i6=j together with the equation Ṙi = Ri vi , and the boundary conditions R0 = R0i , Ri (T ) = RTi , vi (0) = v0i and vi (T ) = vTi for i = 1, 2, 3. V. C ONCLUSIONS AND F UTURE WORK We discussed the problem of collision avoidance of multiagent systems on a complete Riemannian manifold and derived, from the point of view of calculus of variations, necessary conditions for the existence of extrema in the problem. We have shown how the main result can be applied for the particular case of a compact Lie group, a Euclidean space, and a non Lie group example, i.e., the 2-sphere, S 2 . The study of these necessary conditions on symmetric spaces and reduction theories for variational problems has attracted considerable interest and has been carried out systematically by several authors. In future work we intend to extend the main results presented in this paper to this setting and explore numerical results for three dimensional agents as well as explore extensions of Theorem 3.2 as we commented in Remark 3.2. VI. ACKNOWLEDGMENTS The research of A. Bloch was supported by NSF grant DMS-1613819 and AFOSR grant 17RT0038. The research of M. Camarinha was partially supported by the Centre for Mathematics of the University of Coimbra – UID/MAT/00324/2013, funded by the Portuguese Government through FCT/MEC and co-funded by the European Regional Development Fund through the Partnership Agreement PT2020. The work of L. Colombo was partially supported by Ministerio de Economia, Industria y Competitividad (MINEICO, Spain) under grant MTM2016-76702-P and “Severo Ochoa Programme for Centres of Excellence” in R&D (SEV-2015-0554) and Juan de la Cierva Incorporación Fellowship. R EFERENCES [1] C. Altafini. Reduction by group symmetry of second order variational problems on a semi-direct product of Lie groups with positive definite Riemannian metric. ESAIM: Control, Optimisation and Calculus of Variations, 10(4):526-548, 2004. [2] A. Bloch, J. Baillieul, P. E. Crouch, J. E. Marsden, D. Zenkov. Nonholonomic Mechanics and Control. New York, NY: Springer-Verlag, 2nd ed. 2015. [3] A. Bloch, M. Camarinha, L. Colombo. Variational obstacle avoidance on Riemannian manifolds. in Proceedings of the IEEE International Conference on Decision and Control, 2017, pp. 146-150. [4] A. Bloch and P. Crouch. On the equivalence of higher order variational problems and optimal control problems. in Proceedings of the IEEE International Conference on Decision and Control, Kobe, Japan, 1996, pp. 1648-1653. [5] W. M. Boothby. An Introduction to Differentiable Manifolds and Riemannian Geometry. Orlando, FL: Academic Press Inc., 1975. [6] F. Bullo, J. Cortés and S. Martı́nez. Distributed control of robotic networks. A mathematical approach to robot coordination algorithms. Princeton University Press. Applied Mathematics series, 2009. [7] F. Bullo and A. D. Lewis. Geometric Control of Mechanical Systems. Springer-Verlag, 2004. [8] M. Camarinha. The geometry of cubic polynomials in Riemannian manifolds. Ph.D. thesis, Univ. de Coimbra. 1996. [9] L. Colombo and D. Dimarogonas. Variational Principles for Optimal Control of Left-Invariant Multi-Agent Systems with Asymmetric Formation Constraints. Preprint available at arXiv:1802.01224. [10] L. Colombo and D. Martı́n de Diego. Higher-order variational problems on Lie groups and optimal control applications. J. Geom. Mech. 6 (2014), no. 4, 451–478. [11] P. Crouch and F. Silva Leite. Geometry and the Dynamic Interpolation Problem. Proc. American Control Conference, 1131–1137, 1991. [12] P. Crouch and F. Silva Leite. The dynamic interpolation problem: on Riemannian manifolds, Lie groups, and symmetric spaces. J. Dynam. Control Systems. 1 (1995), no. 2, 177–202. [13] M. P. Do Carmo. Riemannian geometry. Birkhauser, 1992. [14] I. Hussein and A. Bloch. Dynamic Coverage Optimal Control for Multiple Spacecraft Interferometric Imaging. Journal of Dynamical and Control Systems, Vol. 13, Issue 1, pp 69-93, 2007. [15] M. Mesbahi and M. Egerstedt. Graph theoretic methods in multiagent networks. Princeton University Press, 2010. [16] J. Milnor, Morse Theory. Princeton, NJ: Princeton Univ. Press, 2002. [17] L. Noakes, G. Heinzinger and B. Paden. Cubic Splines on Curved Spaces. IMA Journal of Math. Control & Inf. 6, (1989), 465–473. [18] F. Silva Leite, M. Camarinha and P. Crouch, Elastic curves as solutions of Riemannian and sub-Riemannian control problems. Math. Control Signals and Systems. 13 (2000), no. 2, 140–155. [19] S. Sternberg. Curvature in mathematics and physics. Courier Corporation, 2013.
3cs.SY
A Probabilistic-Based Model for Binary CSP Amine Balafrej1 , Xavier Lorca1 , and Charlotte Truchet2 1 arXiv:1606.03894v1 [cs.AI] 13 Jun 2016 TASC - Mines-Nantes, INRIA, LINA UMR 6241 {Amine.Balafrej,Xavier.Lorca}@mines-nantes.fr 2 CELTIQUE, IRISA - UMR 6074, Rennes, France [email protected] Abstract. This work introduces a probabilistic-based model for binary CSP that provides a fine grained analysis of its internal structure. Assuming that a domain modification could occur in the CSP, it shows how to express, in a predictive way, the probability that a domain value becomes inconsistent, then it express the expectation of the number of arc-inconsistent values in each domain of the constraint network. Thus, it express the expectation of the number of arc-inconsistent values for the whole constraint network. Next, it provides bounds for each of these three probabilistic indicators. Finally, a polytime algorithm, which propagates the probabilistic information, is presented. 1 Introduction The core of constraint programming, i.e. its operational nature, depends on the propagation-research mechanism: the propagation part tries to infer new information from the current states of variables, while the search part, most of the time, consists of a depth-first exploration of the search space. Propagation and search must generally be intricated because of the NP-completeness of the CSPs. Thus, finding a fair balance between efficiency, in terms of calculation time, and effective performance in terms of filtering, has always been a major issue in the constraint programming community. This paper goes one step further by reporting a probabilistic analysis of the constraint network associated with each constraint satisfaction problem (CSP). This leads to a probabilistic-based model for binary CSP that allows us to better understand both the macro-structure (i.e., interactions between variables through the constraints) and the micro-structure as defined in [1] (i.e., interactions between compatible values) of a binary CSP. The contribution of this paper consists on a theoretical analysis of the constraint networks from a probabilistic point of view: 1. it is shown how to compute in a predictive way the probability for each value of a domain to be arc-inconsistent, under the hypothesis that a domain modification occurs in the CSP; 2. next, it is demonstrated how to aggregate this information for the whole domain and for the whole constraint network; 3. then, these results are approximated by lower bounds; 4. finally, a polytime algorithm is proposed to compute these probabilistic informations. 2 2 Amine Balafrej, Xavier Lorca, and Charlotte Truchet Background material and notations We consider the classical definition of binary constraint networks. A binary constraint network N is a triplet < X , D, C >, where X is a set of n variables, D the set of their finite domains, and C the binary constraints, which are assumed to be unique without loss of generality. We write: Cij the constraint between Xi and Xj , C(Xi ) the set of constraints involving Xi , and Γ (Xi ) = {Xj |∃Cij ∈ C}; Sij the set of solutions of Cij w = {(w, vj )|(w, vj ) ∈ Sij } the supports of w; S alone; Given a value w ∈ Di , Sij the set of solutions of the network, that is, the values in D1 × ... × Dn satisfying all the constraints; πi the i-th projection of Nn . Constraint propagation aims at detecting values in the domains that cannot satisfy at least one constraint. Propagation is based on the consistency property, for which there are several, more or less powerful, definitions. Definition 1 (Arc-consistency or AC). A value vi ∈ Di is AC for Cij if and only vi ). A domain Di is AC on Cij if and only if Di 6= ∅ and if ∃vj ∈ Dj , s.t. vj ∈ πj (Sij ∀vi ∈ Di , vi is AC on Cij . A domain Di is AC if and only if it is AC on any Cij ∈ C(Xi ). A constraint network N =< X , D, C > is AC if and only if any Di ∈ D is AC. Consequently, a value w ∈ Di is arc-inconsistent on a constraint Cij if and only if w πj (Sij ) = ∅. Such a value is written w̆. 3 A probabilistic-based model for CSP Constraint networks are difficult to analyze as a whole. Solving methods often focus on the state of one variable inside the network, which is called the microstructure. In addition, solving methods use criteria based on statistical information based on the past states of variable/constraint. However, such a point of view looses much information, since no information on the future state is considered and the global structure of the network is ignored. This section introduce an original probabilistic model for binary CSP that allows us to define criteria based on the future state of variables considering both the macrostructure and the microstructure of the constraint network. Assuming that a domain will be modified, we want to know which values will become more likely to be arc-inconsistent. We first introduce a probabilistic-based model of the network, which allows us to properly define the domain modifications as probabilistic events. Then, we give a calculation of the probability for a value to be arcinconsistent after a domain modification (here, removing a fixed number of values), considering the whole constraint network. Let N =< X , D, C > a constraint network, e , from N by associating to each domain Di a random we build a probabilized network N e e variable Di such that Di ⊂ Di . All these random variables are drawn independently, i.e., they are randomly and uniformly chosen as a fixed length subdomain of Di . In this network, we are interested in particular events: the domain modifications. We will consider what happens when a domain Di is reduced. Knowing that k values have been removed in Di , we randomize which k values have been removed from Di . The number of such values is denoted rk (Di ). A Probabilistic-Based Model for Binary CSP Di . . . Cij Dj Di . . . . . . w Sij w Cij Di Dj . . . . . . w Sij . . . (a) Initial state Dj . . . w Sij k w w . . . Cij . . . . . . (b) k < 4 k<4 3 . . . 4 . . . (c) k ≥ 4 Fig. 1. Probability of being arc-inconsistent on a constraint Cij for a single value w ∈ Di according to a possible distribution of k values removed from Dj . 3.1 Probabilistic model for arc-inconsistency First, we detail how to compute the probability for a value w of a given variable Xi to be arc-inconsistent on a constraint Cij given an event rk (Dj ). Second, we go one step further by evaluating the expectation of the number of arc-inconsistent values, in a domain Di of a variable Xi , according to a potential event, rkj (Dj ), occurring on the domain of a variable Xj in the neighborhood of Xi . w Consider the example provided by Figure 1, it first depicts the supports Sij of a value w ∈ Di on a constraint Cij (Figure 1(a)). An interesting question to predict the importance of the value w could be its capacity to be arc-inconsistent. Then, a basic information has to be formalized: if it is assumed that at most 3 values could be removed from Dj (Figure 1(b)) then, there is no chances for value w to be arc-inconsistent on Cij (none of the possible combinations of k < 4 values in Dj could remove all the supports of w); Otherwise, if it is assumed that at least 4 values could be removed from Dj (Figure 1(c)) then, there is a chance for a value w to be arc-inconsistent on Cij and we want to evaluate this chance. From a probabilistic point of view, this information can be translated into the probability for w of being arc-inconsistent on Cij according w to value(s) removal(s) in Dj . In the following the projection πj (Sij ) will be denoted by w πj . Proposition 1. For a value w ∈ Di , the probability of being arc-inconsistent on a e , knowing that k values have constraint Cij in the probabilized constraint network N been removed from Dj , is:  1, if |πjw | = 0 (a)        |πjw | Q k−|πjw |+` w Pcij (w̆ | rk (Dj )) = |Dj |−|πjw |+` , if k ≥ |πj | > 0 (b)   `=1      0, if |πjw | > k ≥ 0 (c) 4 Amine Balafrej, Xavier Lorca, and Charlotte Truchet Proof. We first recall that by definition we have |Dj | ≥ |πjw | and |Dj | ≥ k ≥ 0. For the cases (a) and (c) the proof is direct from Definition 1 (precisely arc-inconsistency for (a)). In order to build the proof for the case (b), we introduce, for a value w ∈ Di , the concept of k-Support which denotes any subset of k values of a given domain Dj containing all the support values for w on the constraint Cij . To choose a k-Support, you only need to choose (k − |πjw |) values outside the support values for w, hence the number of k-supports is:   |Dj | − |πjw | #k-Supports = k − |πjw | Then, for a value w ∈ Di , the probability of being arc-inconsistent on a constraint Cij knowing that k values have been removed from the domain Dj is the probability of removing one of the k-supports of w on Cij , thus |Dj |−|πjw | k−|πjw | Pcij (w̆ | rk (Dj )) = ( By developing the binomials, the fraction |πjw | Q and consequently to `=1 |Dj | k  w| |Dj |−|πj k−|π w | j |Dj | k ( ) ) leads to (|Dj |−|πjw |)! k! (k−|πjw |)! × |Dj |! k−|πjw |+` |Dj |−|πjw |+` t u D j1 kj3 values removed Cij1 Cij2 Di Cij3 D j3 D j2 w kj2 values removed kj3 values removed Fig. 2. The probability of being arc-inconsistent for a value in the constraint network An interesting information for the whole constraint network is the probability, for a value w ∈ Di , to be arc-inconsistent for any constraint involving Di . Figure 2 depicts an example of variable domain Di involved in three constraints with an event rkj (Dj ) in the domain of each variable Xj ∈ Γ (Xi ). For each event rkj (Dj ), a value w ∈ Di A Probabilistic-Based Model for Binary CSP 5 has a probability Pcij (w̆ | rkj (Dj )) of being arc-inconsistent on the constraint Cij . All these probabilities are aggregated and Proposition 2 provides the probability of being arc-inconsistent for a value w ∈ Di beyond the constraints themselves. Proposition 2. For a value w ∈ Di , the probability of being arc-inconsistent in the e , knowing that kj values have been removed from probabilized constraint network N each Dj ∈ Γ (Xi ), denoted PN (w̆ | ∀Xj ∈ Γ (Xi ), rkj (Dj )), is equal to 1−( Y (1 − Pcij (w̆ | rkj (Dj )))) (1) Xj ∈Γ (Xi ) Proof. For a value w ∈ Di , the probability of being arc-consistent on a constraint Cij , knowing the event rk (Dj ), is 1 − Pcij (w̆ | rkj (Dj )). Then, the probability of being arc consistent knowing that kj values have been removed from each Dj ∈ Γ (Xi ), is equal to: Y Xj ∈Γ (Xi ) (1 − Pcij (w̆ | rkj (Dj ))) And so, the probability of being arc-inconsistent is equal to 1−( Y (1 − Pcij (w̆ | rkj (Dj )))) Xj ∈Γ (Xi ) t u Once we are able to express the probability of being arc-inconsistent for a value w ∈ Di , we want to evaluate the number of arc-inconsistent values we expect found in Di . Propositions 3 express this expectation for a single domain and Propositions 4 generalises this result for the whole constraint network. Proposition 3. The expected number of arc-inconsistent values in a domain Di knowe i ), is ing that kj values have been removed from each Dj ∈ Γ (Xi ), denoted E(D e i) = E(D X wi ∈Di PN (w̆i ∈ Di | ∀Xj ∈ Γ (Xi ), rkj (Dj )) (2) Proof. For each value w ∈ Di , we define the random variable Yw s.t.   1 if w is inconsistent after reduction of (Dj ) for a Xj ∈ Γ (Xi ) Yw =  0 otherwise Note that Yw can take value 1 with probability PN (w̆ | ∀Xj ∈ Γ (Xi ), rkj (Dj )) and value 0 with probability 1 − PN (w̆ | ∀Xj ∈ Γ (Xi ), rkj (Dj )). Thus, E(Yw ) = 1 × PN (w̆ | .) + 0 × (1 − PN (w̆ | .)) = PN (w̆ | ∀Xj ∈ Γ (Xi ), rkj (Dj )) 6 Amine Balafrej, Xavier Lorca, and Charlotte Truchet The number of values in DiP that are arc-inconsistent knowing that kj values have been removed from each Dj is Yw : w∈Di e i ) = E( E(D X Yw ) = w∈Di X E(Yw ) w∈Di Consequently: e i) = E(D X PN (w̆i ∈ Di | ∀Xj ∈ Γ (Xi ), rkj (Dj )) wi ∈Di (3) t u Proposition 4. The expectation of the number of arc-inconsistent values for the whole e ), is: network, denoted E(N X X e) = E(N PN (w̆i ∈ Di | ∀Xj ∈ Γ (Xi ), rkj (Dj )) (4) Di ∈D wi ∈Di t u Proof. Similar to those of Proposition 3. Now we have a complete probabilistic-based model that allows us, given an event, to compute the probability of a value of being arc-inconsistent for a single constraint (Prop. 1) in addition to three interesting probabilistic indicator that are: – The probability for each value of being arc-inconsistent (Prop. 2). – The expected number of arc-inconsistent values for a given domain (Prop. 3). – The expected number of arc-inconsistent values for the whole constraint network (Prop. 4). The following corollaries provide bounds for each of these three probabilistic indicators. e , knowing that Corollary 1 For w ∈ Di , the probability of being arc-inconsistent in N kj values have been removed from each domain Dj of each variable Xj ∈ Γ (Xi ), is greater or equal than the maximum among the probabilities on each constraint: PN (w̆ | ∀Xj ∈ Γ (Xi ), rkj (Dj )) ≥ max {Pcij (w̆ | rkj (Dj ))} Xj ∈Γ (Xi ) Proof. Knowing that, ∀Xj ∈ Γ (Xi ), 0 ≤ Pcij (w̆ | rkj (Dj )) ≤ 1 we have Y (1 − Pcij (. | .)) ≤ 1 − Pcij (. | .) Xj ∈Γ (Xi ) (5) A Probabilistic-Based Model for Binary CSP 7 Considering the maximum value of Pcij (w̆ | rkj (Dj )): Y (1 − Pcij (. | .)) ≤ 1 − Xj ∈Γ (Xi ) max {Pcij (. | .)} Xj ∈Γ (Xi ) PN (w̆ | ∀Xj ∈ Γ (Xi ), rkj (Dj )) ≥ max {Pcij (. | .)} Xj ∈Γ (Xi ) t u We now can bound the expectation of the number of arc-inconsistent values in the domains, after a domain reduction. e i) Corollary 2 For a domain Di associated with a variable Xi , the expected value E(D of arc-inconsistent values in Di knowing that kj values have been removed from the domain of the variables Xj ∈ Γ (Xi ) is bounded by: X e i) ≥ |Di | ≥ E(D max {Pcij (w̆i | rkj (Dj ))} (6) wi Xj ∈Γ (Xi ) Proof. Straightforward from Prop. 3 and Cor. 1. t u e ) of arc-inconsistent values in the constraint netCorollary 3 The expected value E(N work N is greater or equal than: X X e) ≥ E(N max {Pcij (w̆i ∈ Di | rkj (Dj ))} (7) Xi ∈X wi ∈Di Xj ∈Γ (Xi ) Proof. Conclusion from Proposition 4 and Corollary 1 is straightforward. t u To sum up, we now have a formula providing a bound for the number of values that are expected to be removed in the constraint network, under the hypothesis of a domain modification. 3.2 Propagation of the probabilistic information Given a constraint network N , Algorithm 1 details how to compute the probability for each value of each domain to be arc-inconsistent (Corollary 1), and the lower bound of the expected number of arc-inconsistent values for all the domains (Corollary2). Algorithm 1 is an adaptation of a coarse grained AC algorithm, AC3 [2]. At the initialization step, from Lines 7 to 16, Algorithm 1 is initialized. Two elements have to be noticed: First, Line 11 populates the set of variables to analyze (i.e., each variable for which it is assumed its domain has been modified), according to the table R[]; Second, Lines 9 and 14 respectively initialized the expected value of arcinconsistent values in Di and, the default probability of being arc-inconsistent for each pair variable/value. Next, the computation of the expected results is ensured as follows. Line 21 calls the function Pcij that computes the probability for a given value vj ∈ Dj to be arc-inconsistent for a constraint Cij according to the assumption that R[i] values 8 Amine Balafrej, Xavier Lorca, and Charlotte Truchet Algorithm 1 ProbAC(X[], D[], C[], R[], {S1 [][], S2 [][] . . . Sn [][]}) Require: 1: X[], D[], C[]: variables, domains and constraints associated with the CSP 2: R[]: table of integers - R[i] represents the number of values that we assume to be removed (hypothesis) from the domain D[i] of X[i] 3: Si [][]: matrix of integers associated to Xi ∈ X - Si [w][j] represents the number of supports w (|πj (Sij )|) of w ∈ Di on the constraint Cij Ensure: 4: P[][]: P[i][j] represents a lower bound of the probability for the value j in the domain of X[i] to be arc-inconsistent . Corollary 1 5: E[]: E[i] represents a lower bound of the expected value of arc-inconsistent values in D[i] of X[i] . Corollary 2 6: EN represents a lower bound of the expected value of arc-inconsistent values in the constraint network . Corollary 3 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: Set of variables S ← ∅ ; EN ← 0 for all X[i] ∈ X[] do E[i] ← 0 if R[i] > 0 then S.add(X[i]) end if for all vi ∈ D[i] do P[i][vi ] ← 0 end for end for while S 6= ∅ do Variable xi ← S.remove() for all xj ∈ Γ (xi ) do for all vj ∈ D[j] do double tmp ← Pcij (v̆j | R[i]) if tmp > P[j][vj ] then EN ← EN − P[j][vj ] + tmp E[j] ← E[j] − P[j][vj ] + tmp P[j][vj ] ← tmp end if end for if bE[j]c > R[j] then R[j] ← bE[j]c S.add(X[j]) end if end for end while . Proposition 1 . Corollary 3 . Corollary 2 . Corollary 1 are assumed to be removed from Di (Proposition 1). Lines 22 and 25 allow to aggregate the previous information by maintaining the maximum value in the neighborhood of the variable xj according to formula provided by Corollary 1. Next, Lines 22 and 24 compute a lower bound on the expected value of arc-inconsistent values in the whole domain Dj according to formula provided by Corollary 2. Next, Lines 22 and 23 ag- A Probabilistic-Based Model for Binary CSP 9 gregate the information of Line 22 to provide a lower bound of the total number of expected arc-inconsistent values for the whole network (Corollary 3). Finally, Lines 28 to 30 manages the propagation of the information, by observing the evolution of the expected value of arc-inconsistent values in the domain Dj . The termination of Algorithm 1 is demonstrated from lemma 1 and line 17: it is ensured that S becomes empty and no variable enters S. Lemma 1. A variable Xi enters the set S at most |Di | times. Proof. Lines 28-30 of Algorithm 1 ensure that: a variable Xi enters the set S if and only if the number of values R[i] assumed to be removed from Di increases; for each variable Xi , the number of values R[i] assumed to be removed is monotonously increasing; for each variable Xi , |Di | is an upper bound for the number of values R[i] assumed to be removed. The last bullet has to be detailed. The number of values R[i] assumed to be removed from Di is computed as the integer portion bE[i]c of the expected value E[i]. That is, the expected value E[i] is an upper bound for R[i]. In addition, |Di | is an upper bound for E[i] (corollary 2). Thus, |Di | is an upper bound for R[i]. t u The initialization step (lines 7 to 16), has a time complexity O(nd). Next, at each run of the main loop algorithm (lines 17 to 33), a variable Xi is removed from the set S then the Proposition 1 is evaluated for each Cij and each vj ∈ Dj . Proposition 5. Algorithm 1 has a worst-case time complexity O(nmd3 ), where m = max {|Γ (Xi )|}. i=1..n Proof. Each time a variable Xi enters S, the probability Pcij (v̆j | R[i]) is evaluated for each value vj in the domain Dj of each variable Xj ∈ Γ (Xi ). In addition, a variable ei ) increases. In Xi enters S each time the lower bound R[i] of the expected value E(X the worst case, the lower bound R[i] increases each time by at most one. So, a variable Xi enters S at most d times. Therefore, For each of the n variables Xi in the constraint network, the probability Pcij (v̆j | R[i]) is evaluated at most mi d2 times, where mi = |Γ (Xi )|. Furthermore, evaluate the probability has a worst case time complexity of O(d). Thus, algorithm 1 has a worst case time complexity of O(nmd3 ), where m = max {mi }. t u i=1..n 4 Conclusion This work has presented a probabilistic-based model for classical binary CSPs. This is an original point of view which provides a fine grained analysis of the constraint network that allows us to better understand both the macro-structure (i.e., interactions between variables through the constraints) and the micro-structure (i.e., interactions between compatible values) of a binary CSP. 10 Amine Balafrej, Xavier Lorca, and Charlotte Truchet References 1. Jégou, P.: Decomposition of domains based on the micro-structure of finite constraintsatisfaction problems. In: Proceedings of the 11th National Conference on Artificial Intelligence. Washington, DC, USA, July 11-15, 1993. pp. 731–736 (1993) 2. Mackworth, A.K.: Consistency in networks of relations. Artificial Intelligence 8(1), 99 – 118 (1977)
8cs.DS
arXiv:cs/0003076v2 [cs.AI] 23 May 2001 Under consideration for publication in Theory and Practice of Logic Programming 1 Constraint Programming viewed as Rule-based Programming Krzysztof R. Apt CWI P.O. Box 94079, 1090 GB Amsterdam, the Netherlands and University of Amsterdam, the Netherlands (e-mail: [email protected]) Eric Monfroy Université de Nantes Institut de Recherche en Informatique de Nantes (IRIN) 2, rue de la Houssinire BP 92208, 44322 Nantes Cedex 03, France (e-mail: [email protected]) Abstract We study here a natural situation when constraint programming can be entirely reduced to rule-based programming. To this end we explain first how one can compute on constraint satisfaction problems using rules represented by simple first-order formulas. Then we consider constraint satisfaction problems that are based on predefined, explicitly given constraints. To solve them we first derive rules from these explicitly given constraints and limit the computation process to a repeated application of these rules, combined with labeling. We consider here two types of rules. The first type, that we call equality rules, leads to a new notion of local consistency, called rule consistency that turns out to be weaker than arc consistency for constraints of arbitrary arity (called hyper-arc consistency in (Marriott & Stuckey, 1998)). For Boolean constraints rule consistency coincides with the closure under the well-known propagation rules for Boolean constraints. The second type of rules, that we call membership rules, yields a rule-based characterization of arc consistency. To show feasibility of this rule-based approach to constraint programming we show how both types of rules can be automatically generated, as CHR rules of (Frühwirth, 1995). This yields an implementation of this approach to programming by means of constraint logic programming. We illustrate the usefulness of this approach to constraint programming by discussing various examples, including Boolean constraints, two typical examples of many valued logics, constraints dealing with Waltz’s language for describing polyhedral scenes, and Allen’s qualitative approach to temporal logic. Note. A preliminary version of this article appeared as (Apt & Monfroy, 1999). In this version we also present a framework for computing with rules on constraint satisfaction problems and discuss in detail the results of various experiments. 1 Introduction 2 Krzysztof R. Apt and Eric Monfroy 1.1 Background This paper is concerned with two styles of programming: constraint programming and rule-based programming. In constraint programming the programming process is limited to a generation of constraints and a solution of the so obtained constraint satisfaction problems (CSP’s) by general or domain dependent methods. In rule-based programming the programming process consists of a repeated application of rules. A theoretical basis for this programming paradigm consists of so-called production rules that were introduced in the seventies, see, e.g., (Luger & Stubblefield, 1998)[pages 171-186], though the idea goes back to the works of A. Thue and of E. Post in first half of twentieth century. The production rules are condition-action pairs, where the condition part is used to determine whether the rule is applicable and the action part defines the action to be taken. The most known programming language built around this programming paradigm was OPS5 of (Forgy, 1981). Recently, there has been a revival of interest in rule-based programming in the context of constraint programming. The earliest example is the CHR language of (Frühwirth, 1995) that is a part of the ECLi PSe system. (For a more recent and more complete overview of CHR see (Frühwirth, 1998).) The CHR rules extend the syntax of constraint logic programming by allowing two atoms in the conclusion and employing guards. These rules are predominantly used to write constraint solvers. Another example of a programming language in which rules play an important role is ELAN. It offers a logical environment for specifying and prototyping deduction systems by means of conditional rewrite rules controlled by strategies. ELAN is used to support the design of various rule-based algorithms such as constraints solvers, decision procedures, theorem provers, and algorithms expressed in logic programming languages, and to provide a modular framework for studying their combinations. A general overview of ELAN can be found in (Borovansky et al., 1998), whereas (Kirchner & Ringeissen, 1998) and (Castro, 1998) (to which we shall return in Section 11) describe applications of ELAN to constraint programming and constraint solving. Also, in the hybrid functional and object-oriented language programming language CLAIRE of (Caseau & Laburthe, 1996) rules are present. CLAIRE was designed to apply constraint programming techniques for operations research problems. The rule-based programming is supported by means of production rules that can be naturally used to express constraint propagation. It is useful to mention here that also logic programming and constraint logic programming are rule-based formalisms. However, these formalisms use rules differently than rule-based programming described above. This distinction is usually captured by referring to forward chaining and backward chaining. In rule-based programming, as discussed above, forward chaining is used while in logic programming and constraint logic programming backward chaining is employed. Intuitively, forward chaining aims at a simplification of the considered problem and it maintains equivalence, while backward chaining models reasoning by cases, where each Constraint Programming viewed as Rule-based Programming 3 case is implicitly represented by a different rule. Both forms of chaining can be combined and in fact such a combination is realized in the CHR language, in which the CHR rules model forward chaining while the usual Prolog rules model backward chaining. 1.2 Overview of Our Approach The traditional way of solving CSP’s consists of combining constraint propagation techniques with search. Constraint propagation aims at reducing a CSP to an equivalent one but simpler. In case of finite domains the most basic approach to search consists of labeling, a repeated enumeration of the domains of the successive variables. The aim of this paper is to show that constraint programming can be entirely rendered by means of rule-based programming. To this end we provide a framework in which one computes on CSP’s by means of rules represented by simple firstorder formulas. In this approach the constraint propagation is achieved by repeated application of the rules while search is limited to labeling. This yields a framework for constraint programming more related to logic than the usual one based on algorithms achieving local consistency. The rules we shall consider are implications built out of simple atomic formulas. In our study we focus on two types of rules. The first type, that we call equality rules, are of the form x1 = s1 , . . ., xn = sn → y 6= t where x1 , . . ., xn , y are variables and s1 , . . ., sn , t are elements of the respective variable domains. The computational interpretation of such a rule is: if for i ∈ [1..n] the domain of the variable xi equals the singleton {si }, then remove the element t from the domain of y. The second type of rules, that we call membership rules, are of the form x1 ∈ S1 , . . ., xn ∈ Sn → y 6= t where • x1 , . . ., xn are variables and S1 , . . ., Sn are subsets of the respective variable domains, • y is a variable and t is an element of its domain. The computational interpretation of such a rule is: if for i ∈ [1..n] the domain of the variable xi is included in the set Si , then remove the element t from the domain of y. To illustrate the use of these rules we study CSP’s that are built out of predefined, explicitly given finite constraints. Such CSP’s often arise in practice. Examples include Boolean constraints, constraints dealing with Waltz’s language for describing polyhedral scenes, Allen’s temporal logic, and constraints in any multi-valued logic. To solve such CSP’s we explore the structure of these explicitly given constraints 4 Krzysztof R. Apt and Eric Monfroy first. This information is expressed in terms of valid equality and membership rules. The computation process for a CSP built out of these constraints is consists of two phases: a generation of the rules from the explicitly given constraints and a repeated application of these rules, combined with labeling. To characterize the effect of the generated equality and membership rules we use the notions of local consistency. These notions approximate in a loose sense the notion of “global consistency”, see, e.g., (Tsang, 1993). We show that the first type of rules leads to a local consistency notion that turns out to be weaker than arc consistency for constraints of arbitrary arity. We call it rule consistency. When the original domains are all unary or binary, rule consistency coincides with arc consistency. When additionally the predefined constraints are the truth tables of the Boolean connectives, these rules are similar to the well-known Boolean propagation rules, (see, e.g., (Frühwirth, 1998)[page 113]). As a side effect, this shows that the Boolean propagation rules characterize arc consistency. Rule consistency is thus a generalization of the Boolean propagation to non-binary domains. We also show that the membership rules lead to a notion of local consistency that coincides with arc consistency. This yields a rule-based implementation of arc consistency. To show feasibility of this rule-based approach to constraint programming, we automatically generate both types of rules, for an explicitly given finite constraint, as rules in the CHR language. When combined with a labeling procedure such CHR programs constitute automatically derived decision procedures for the considered CSP’s, expressed on the constraint programming language level. In particular, we automatically generate the algorithms that enforce rule consistency and arc consistency. The availability of the algorithms that enforce rule consistency and arc consistency on the constraint programming language level further contributes to the automation of the programming process within the constraint programming framework. In fact, in the case of such CSP’s built out of predefined, explicitly given finite constraints, the user does not need to write one’s own CHR rules for the considered constraints and can simply adopt all or some of the rules that are automatically generated. In the final example of the paper we also show how using the equality rules and the membership rules, we can implement more powerful notions of local consistency. Alternatively, the generated equality rules and membership rules could be fed into any of the generic Chaotic Iteration algorithms of (Apt, 1999a) and made available in such systems as the ILOG solver. This would yield rule consistency and an alternative implementation of arc consistency. The algorithms that for an explicitly given finite constraint generate the appropriate rules that characterize rule consistency and arc consistency have (unavoidably) a running time that is exponential in the number of constraint variables and consequently are in general impractical. To test the usefulness of these algorithms for small finite domains we implemented them in ECLi PSe and successfully used them on several examples including the ones mentioned above. The fact that we could handle these examples shows that this Constraint Programming viewed as Rule-based Programming 5 approach is of practical value and in particular can be used to automatically derive practical decision procedures for constraint satisfaction problems defined over small finite domains. Also it shows the usefulness of the CHR language for an automatic generation of constraint solvers and of decision procedures. 1.3 Organization of the Paper The rest of the paper is organized as follows. In the next section we clarify the syntax of the rules and explain how one can compute with them. In Section 3 we illustrate the use of these computations by means of an example. In Section 4 we prove that the outcomes of the computations we are interested in are unique. In Section 5 we introduce some semantic aspects of the rules and in Section 6 we formalize the concept of a CSP is built out of predefined constraints. Next, in Section 7 we introduce the notion of rule consistency and discuss an algorithm that can be used to generate the minimal set of rules that characterize this notion of local consistency. Then, in Section 8 we compare rule consistency with arc consistency. In Section 9 we study membership rules and discuss an algorithm analogous to the one of Section 7. This entails a notion of local consistency that turns out to be equivalent to arc consistency. In Section 10 we discuss the implementation of both algorithms. They generate from an explicit representation of a finite constraint a set of CHR rules that characterize respectively rule consistency and arc consistency. We also illustrate the usefulness of these implementations by means of several examples. Finally, in Section 11 we discuss other works in which a link was made between constraint programming and rule-based programming and in Section 12 we assess the merits of our approach. In the appendix we summarize the tests carried out by means of our implementation of both algorithms. 2 Computing with Rules In what follows we introduce specific type of rules and explain how one can compute with them on constraint satisfaction problems. First, we introduce constraints. Consider a sequence of variables X := x1 , . . ., xn where n ≥ 0, with respective domains D1 , . . ., Dn associated with them. So each variable xi ranges over the domain Di . By a constraint C on X we mean a subset of D1 × . . . × Dn . Given an element d := d1 , . . ., dn of D1 × . . . × Dn and a subsequence Y := xi1 , . . ., xiℓ of X we denote by d[Y ] the sequence di1 , . . ., diℓ . In particular, for a variable xi from X, d[xi ] denotes di . Next, we define the rules we are interested in. Definition 2.1 • Let x be a variable, a an element and S a set. By an atomic formula we mean one of the following formulas: x = a, x 6= a, x ∈ S. • By a rule we mean an expression of the form A1 , . . ., Am → B1 , . . ., Bn , where each Ai and Bj is an atomic formula. ✷ 6 Krzysztof R. Apt and Eric Monfroy In what follows a rule will be always associated with some constraint. Then every atomic formula x = a or x 6= a (respectively, x ∈ S) will be such that a belongs to the domain of x (respectively, S is a subset of the domain of x). Subsequently, we explain how to compute using the rules in presence of constraints. First, we limit our considerations to the rules of the form A1 , . . ., Am → x 6= a. We need to explain how to turn the disequality formula into an action. This is done by identifying the disequality x 6= a with the assignment Dx := Dx − {a}, where Dx is the current domain of x. In other words, we interpret x 6= a as an action of removing the value a from the current domain of the variable x. This leads us to the definition of an application of such a rule. We need some semantic notions first. Definition 2.2 Consider a constraint C on a sequence of variables X, a variable x of X, and a tuple d ∈ C. • Given an atomic formula A involving x we define the relation |=d A as follows: — |=d x = a iff d[x] = a, — |=d x 6= a iff d[x] 6= a, — |=d x ∈ S iff d[x] ∈ S. • Given a sequence of atomic formulas A := A1 , . . ., Am we define |=d A iff |=d Ai for all i ∈ [1..m]. ✷ Definition 2.3 Consider a constraint C on a finite sequence of variables X and a rule of the form A → xi 6= a involving only variables from X. Suppose that for all d ∈ C we have |=d A. Let C ′ be the constraint obtained from C by removing the element a from the domain Di of the variable xi and by removing from C all tuples d such that d[xi ] = a. Then we call the constraint C ′ the result of applying the rule A → xi 6= a to C. If a ∈ Di , then we say that this is a relevant application of the rule A → xi 6= a to C. If C ′ coincides with C, we say that this application of the rule A → xi 6= a to C maintains equivalence. ✷ So the application of the rule A → xi 6= a to a constraint C on the sequence x1 , . . ., xn of variables with respective domains D1 , . . ., Dn results in the constraint C ′ on the variables x1 , . . ., xn with respective domains D1 , . . ., Di−1 , Di′ , Di+1 , . . ., Dn , where • Di′ = Di − {a}, • C ′ = C ∩ (D1 × . . . × Di−1 × Di′ × Di+1 , . . ., Dn ). We say then that the constraint C is restricted to the domains D1 , . . ., Di−1 , Di′ , Di+1 , . . ., Dn . Now that we defined the result of a single application of a rule we proceed to define computations. To this end we first introduce constraint satisfaction problems. By a constraint satisfaction problem, in short CSP, we mean a finite sequence of Constraint Programming viewed as Rule-based Programming 7 variables X with respective domains D, together with a finite set C of constraints, each on a subsequence of X. We write it as hC ; x1 ∈ D1 , . . ., xn ∈ Dn i, where X := x1 , . . ., xn and D := D1 , . . ., Dn . By a solution to hC ; x1 ∈ D1 , . . ., xn ∈ Dn i we mean an element d ∈ D1 ×. . .×Dn such that for each constraint C ∈ C on a sequence of variables X we have d[X] ∈ C. We call a CSP consistent if it has a solution. Two CSP’s with the same sequence of variables are called equivalent if they have the same set of solutions. We now modify the definition of an application of a rule to a constraint to an application of a rule to a CSP. To this end we attach each rule to a constraint to which it is supposed to be applied. Even though the constraints change during the computations we consider, it will be always clear from the context to which constraint a given rule is attached. Definition 2.4 Consider a CSP P and a rule A → xi 6= a attached to a constraint C of P. Suppose that for all d ∈ C we have |=d A. Define a CSP P ′ on the same variables as P as follows: • the domain of xi in P ′ equals Di − {a}, where Di is the domain of xi in P, • the domains of other variables in P ′ are the same as in P, • the constraints of P ′ are obtained by restricting the constraints of P to the new domains. We say then that the CSP P ′ is the result of applying the rule A → xi 6= a to P. If a ∈ Di , then we say that this is a relevant application of the rule A → xi 6= a to P. ✷ Finally, we introduce the crucial notion of a computation. Definition 2.5 Consider a set of rules R of the form A → x 6= a and an initial CSP P. By a computation by means of R starting at P we mean a maximal sequence of CSP’s P1 , . . ., Pi , . . . such that each Pj+1 is the result of a relevant application of a rule from R to Pj . ✷ Note that when the set of rules R is finite or when all domains in P are finite, all computations starting at P are finite. The reason is that in each of these two cases the number of elements mentioned in the conclusions of the rules in R is finite. But each element can be removed from a domain only once and we insist that in computations each rule application is relevant, from which the claim follows. If a computation is finite, then no application of a rule from the considered set of rules R to the final CSP is relevant, i.e., this final CSP is closed under the rules in R. The computations are a means to reduce the domains of the variables while preserving the equivalence of the considered CSP. The computations here considered are in general insufficient for solving a CSP and in the case of CSP’s with finite domains they have to be combined with labeling. Labeling can be modeled in the above rule-based framework by introducing a rule that splits a given CSP into two, the union of which is equivalent to the given CSP. The addition of such a rule to 8 Krzysztof R. Apt and Eric Monfroy the considered framework leads to no conceptual difficulties and is omitted. On the other hand, various forms of labeling strategies, like the one in which variable with the smallest domain is chosen first, cannot be captured on this level. The above string of definitions allowed us to define computations in which the actions are limited to the applications of rules of the form A → x 6= a acting on CSP’s. By limiting our attention to such type of rules we do not lose any expressiveness. Indeed, consider first a rule of the form A → x = a. To compute with it we interpret the equality x = a as the assignment Dx := Dx ∩ {a}, where Dx is the current domain of x. Then each rule A → x = a is equivalent to the conjunction of the rules of the form A → x 6= b with b ∈ D − {a}, where D is the original domain of x. Next, consider a rule of the form A → x ∈ S. To compute with it we interpret the atomic formula x ∈ S as the assignment Dx := Dx ∩ S, where Dx is the current domain of x. Then each rule A → x ∈ S is equivalent to the conjunction of the rules of the form A → x 6= b with b ∈ D − S, where D is the original domain of x. Finally, each rule of the form A → B1 , . . ., Bm is equivalent to the conjunction of the rules of the form A → Bi for i ∈ [1..m]. Note that the rules of the form x1 = a1 , . . ., xn = an → y 6= b are more expressive than so-called dependency rules of database systems (see, e.g., (Ullman, 1988)). These are rules of the form x1 = a1 , . . ., xn = an → y = b. We just explained how to model them by means of rules of the form x1 = a1 , . . ., xn = an → y 6= b. However, modeling in the other direction is not possible, as can be seen by taking the variables x, y, each with the domain {0, 1, 2}, and the constraint C on x, y represented by the following table: x y 0 0 2 1 0 2 Then the rule x = 0 → y 6= 2 is not equivalent to a conjunction of the dependency rules. 3 An Example We now show how we can use the rules for computing by means of an example kindly provided to us by Victor Marek. We solve here a simple logic puzzle from (Fleming, 2000). Below, given a set of variables x1 , . . ., xn , each with the domain D we denote the following set of rules: {xi = a → xj 6= a | i, j ∈ [1..n], i 6= j, a ∈ D} Constraint Programming viewed as Rule-based Programming 9 by all different (x1 , . . ., xn ). These rules formalize the requirement that the variables x1 , . . ., xn are all different. The puzzle is as follows. To stave off boredom on a rainy Saturday afternoon, Ms. Rojas invented a game for Denise and her two other children to play. Each child selected a different household object (no two of which were in the same room) to describe to the others, who would try to guess the item and its location in the house. Can you match each child with the item he or she selected to describe, as well as the room of the house (one is the living room) in which each is located? Here are the clues provided: 1. The three children are Byron, the child who selected the book, and the one whose item is in the den; 2. The rug is in the dining room; 3. Felicia selected the picture frame. To solve this puzzle we use nine variables, • child1 , child2 , child3 , to denote the three children, Byron, Denise and Felicia, • roomB , roomD , roomF , to denote the rooms of, respectively, Byron, Denise and Felicia, • itemB , itemD , itemF , to denote the objects selected by, respectively, Byron, Denise and Felicia. We postulate that the domain of child1 is {Byron}, of child2 is {Denise} and of child3 is {F elicia}. Next, we assume that each roomi variable has the set {den, dining, living} as its domain and each itemi variable has the set {book, frame, rug} as its domain. The initial set up of the story is formalized by the following rules: • all different (roomB , roomD , roomF ), • all different (itemB , itemD , itemF ). This yields 36 rules but we shall group the rules with the same premise, so we shall actually have 18 rules. The rules we shall need below will be, from the first set: (r1) roomB = dining → roomD 6= dining, roomF 6= dining, (r2) roomB = living → roomD 6= living, roomF 6= living, (r3) roomD = living → roomB 6= living, roomF 6= living, and from the second set: (r4) itemB = rug → itemD 6= rug, itemF 6= rug, (r5) itemF = frame → itemB 6= frame, itemD 6= frame. Next, the first clue is formalized by means of eight rules out of which the only ones of relevance below will be (c1.1) → itemB 6= book, (c1.2) itemD = book → roomD 6= den. 10 Krzysztof R. Apt and Eric Monfroy The second clue is formalized by means of six rules out of which the only one of relevance below will be (c2) itemB = rug → roomB 6= den, roomB 6= living. Finally, the third clue is formalized by means of two rules: (c3.1) → itemF 6= rug, (c4.1) → itemF 6= book. So in total we have 34 rules but we shall use below only the ten rules made explicit. The initial CSP has nine variables as introduced above and one single “universal” constraint that consists of the Cartesian product of all the variable domains. The computation consists of twelve steps and proceeds as follows. 1. Using the rule (c3.1) the domain of itemF is limited to {book, frame}. 2. Using the rule (c3.2) the domain of itemF is further limited to {frame}. Thus itemF = frame is established. 3. Using the rule (r5) and the fact itemF = frame just established the domain of itemB is limited to {book, rug}. 4. Using the rule (c1.1) the domain of itemB is further limited to {rug}. Thus itemB = rug is established. 5. Using the rule (r5) and the fact itemF = frame established in step 2 the domain of itemD is limited to {book, rug}. 6. Using the rule (r4) and the conclusion itemB = rug of step 4 the domain of itemD is further limited to {book}. Thus itemD = book is established. 7. Using the rule (c2) and the fact itemB = rug established in step 4 the domain of roomB is limited to {dining, living}. 8. Again using the rule (c2) and the fact itemB = rug established in step 4 the domain of roomB is further limited to {dining}. Thus roomB = dining is established. 9. Using the fact roomB = dining established in step 8 and the rule (r1) the domain of roomD is limited to {den, living}. 10. Using the fact itemD = book established in step 6 and the rule (c1.2), the domain of roomD is further limited to {living}. Thus roomD = living is established. 11. Using the fact roomB = dining established in step 9 and the rule (r2) the domain of roomF is limited to {den, dining}. 12. Using the fact roomD = living established in step 10 and the rule (r3) the domain of roomF is further limited to {den}. Thus roomF = den is established. At this stage one can check that the resulting CSP with all singleton domains is closed under all 34 rules. This yields the solution to the puzzle represented by the following table: Constraint Programming viewed as Rule-based Programming child room item Byron Denise Felicia dining living den rug book frame 11 4 Outcomes of Computations A natural question arises whether the outcome of computations using a finite set of rules is unique. The answer is positive. To prove it we need a lemma concerning iterations of inflationary and monotonic functions. Definition 4.1 Consider a partial ordering (D, ⊑ ) with the least element ⊥ and a finite set of functions F := {f1 , . . ., fk } on D. • By an iteration of F we mean an infinite sequence of values d0 , d1 , . . . defined inductively by d0 := ⊥, dj := fij (dj−1 ), where each ij is an element of [1..k]. • We say that an increasing sequence d0 ⊑ d1 ⊑ d2 . . . of elements from D eventually stabilizes at d if for some j ≥ 0 we have di = d for i ≥ j. • A function f on D is called inflationary if x ⊑ f (x) for all x. • A function f on D is called monotonic if x ⊑ y implies f (x) ⊑ f (y) for all x, y. ✷ We now need the following lemma from (Apt, 1999b). Lemma 4.2 Consider a partial ordering (D, ⊑ ) with the least element ⊥ and a finite set of monotonic functions F on D. Suppose that an iteration of F eventually stabilizes at a common fixpoint d of the functions from F . Then d is the least common fixed point of the functions from F . It follows that all iterations of F that eventually stabilize at a common fixpoint stabilize at the same element. We now prove the desired result. Theorem 4.3 Fix an initial CSP P. Consider a finite set R of rules of the form A → x 6= a. Then all computations by means of R starting at P yield the same CSP. Proof 12 Krzysztof R. Apt and Eric Monfroy We already noted in Section 2 that all such computations are finite. Suppose that P := hC ; x1 ∈ D1 , . . ., xn ∈ Dn i. We consider now the following partial ordering (D, ⊑ ). The elements of D are the sequences (E1 , . . ., En ) such that Ei ⊆ Di for i ∈ [1..n], ordered componentwise w.r.t. the reversed subset ordering ⊇. So (D1 , . . ., Dn ) is the least element ⊥ in this ordering and (E1 , . . ., En ) ⊑ (F1 , . . ., Fn ) iff Ei ⊇ Fi for i ∈ [1..n]. We replace in each rule each premise atom xi = a by xi ∈ {a} and xi 6= a by xi ∈ Di − {a}. Since for all d ∈ D1 × . . . × Dn we have |=d xi = a iff |=d xi ∈ {a} and |=d xi 6= a iff |=d xi ∈ Di − {a}, it follows that the applications of the original and of the resulting rules coincide. This allows us to confine our attention to the rule each premise of which is of the form z ∈ S. Consider now a membership rule z1 ∈ S1 , . . ., zm ∈ Sm → y 6= a associated with a constraint C from C defined on a set of variables Y . We interpret this rule as a function on the just defined set D as follows. First, denote by C̄ the extension “by padding” of C to all the variables x1 , . . ., xn , i.e. C̄ ⊆ D1 × . . . × Dn and d ∈ C̄ iff d[Y ] ∈ C. Next, given a constraint E and its variable z denote the set {d[z] | d ∈ E} by E[z]. Finally, assume for simplicity that y is xn . The function f that corresponds to the rule z1 ∈ S1 , . . ., zm ∈ Sm → y 6= t is defined as follows:   (E1 , . . ., En − {a}) if (C̄ ∩ (E1 × . . . × En ))[zi ] ⊆ Si f (E1 , . . ., En ) := for i ∈ [1..m],  (E1 , . . ., En ) otherwise. Denote the set of so defined functions by F . By definition each function f ∈ F is inflationary and monotonic w.r.t. the componentwise reversed subset ordering ⊇. Now, there is a one-one correspondence between the common fixpoints of the functions from F at which the iterations of F eventually stabilize and the outcomes of the computations by means of R starting at P. In this correspondence a common fixpoint (E1 , . . ., En ) is related to the CSP hC ′ ; x1 ∈ E1 , . . ., xn ∈ En i closed under the rules of R, where C ′ are the constraints from C restricted to the domains E1 , . . ., En . The conclusion now follows by Lemma 4.2. 5 Semantic Aspects of Rules We now introduce a number of semantic notions concerning rules. Definition 5.1 Consider a constraint C. • We say that the rule A → B is valid for C if for all tuples d ∈ C |=d A implies |=d B. • We say that the constraint C is closed under the rule A → B if (|=d A for all tuples d ∈ C) implies (|=d B for all tuples d ∈ C). Constraint Programming viewed as Rule-based Programming 13 • We say that the rule A → B is feasible for C if for some tuple d ∈ C we have |=d A. • We say that the rule A → B for the constraint C extends the rule A′ → B if A contains all variables of A′ and for all tuples d ∈ C |=d A implies |=d A′ . • Given a set of rules R, we call a rule minimal in R if it is feasible and it does not properly extend a valid rule in R. ✷ To illustrate them consider the following example. Example 5.2 Take as a constraint the ternary relation that represents the conjunction and(x, y, z). It can be viewed as the following table: x y z 0 0 1 1 0 1 0 1 0 0 0 1 In other words, we assume that each of the variables x, y, z has the domain {0, 1} and view and(x, y, z) as the constraint on x, y, z that consists of the above four triples. It is easy to see that the rule x = 0 → z 6= 1 is valid for and(x, y, z). Further, the rule x = 0, y = 1 → z 6= 1 extends the rule x = 0 → z 6= 1 and is also valid for and(x, y, z). However, out of these two rules only x = 0 → z 6= 1 is minimal. Finally, both rules are feasible, while the rules x = 0, z = 1 → y 6= 0 and x = 0, z = 1 → y 6= 1 are not feasible. ✷ Note that the definition of an application of a rule is so designed that a link with semantics is kept in the following sense: if a rule r is valid for a constraint C, then C is closed under r. Rules that are not feasible are trivially valid. Note also that a rule that extends a valid rule is valid, as well. So validity extends “upwards”. Note the use of the condition “A contains all variables of A′ ” in the definition of the relation “the rule A → B extends the rule A′ → B”. Without it we would have the following paradoxical situation. Consider the variables x, y, z, all on the domains {0, 1}, and the constraint C on x, y, z defined by C := {(0, 0, 0), (1, 0, 1)}. Then the rules x = 0 → z 6= 1 and y = 0 → z 6= 1 are both valid for C and for all d ∈ C we have that |=d x = 0 implies |=d y = 0. So without the mentioned condition we would have that the rule x = 0 → z 6= 1 extends the rule y = 0 → z 6= 1, which would imply that the first rule is not minimal. In the sequel the following observation will be useful. Note 5.3 14 Krzysztof R. Apt and Eric Monfroy Consider two finite and non-empty constraints C and E such that C ⊆ E and a set of rules R. Then C is closed under all valid rules from R for E iff it is closed under all minimal valid rules in R for E. Proof Suppose that C is closed under all minimal valid rules in R for E. Take a rule r from R that is valid for E. Case 1. r is feasible for E. Then, because E is finite, r extends some minimal valid rule r′ in R for E. But C is closed under r′ , so it is closed under r, as well. Case 2. r is not feasible for E. Then r is not feasible for C either since C ⊆ E. Consequently, since C is nonempty, C is closed under r. In what follows we confine our attention to computations involving two types of rules: • equality rules: these are rules of the form x1 = s1 , . . ., xm = sm → y 6= a; we abbreviate them to X = s → y 6= a, where X = x1 , . . ., xm and s = s1 , . . .sm , • membership rules: these are rules of the form x1 ∈ S1 , . . ., xm ∈ Sm → y 6= a; we abbreviate them to X ∈ S → y 6= a, where X = x1 , . . ., xm and S = S1 , . . .Sm . By specializing in the last clause of Definition 5.1, defining a minimal rule, the set R of rules to the set of equality rules and to the set of membership rules we obtain the notions of a minimal equality rule and of a minimal membership rule. For equality and membership rules the following straightforward characterization of the “extends” relation will be of use. Note 5.4 i. An equality rule x1 = s1 , . . ., xm = sm → y 6= a extends an equality rule z1 = t1 , . . ., zn = tn → y 6= a iff z1 = t1 , . . ., zn = tn is a subsequence of x1 = s1 , . . ., xm = sm . ii. A membership rule x1 ∈ S1 , . . ., xm ∈ Sm → y 6= a extends a membership rule z1 ∈ T1 , . . ., zn ∈ Tn → y 6= a iff z1 , . . ., zn is a subsequence of x1 , . . ., xm and for each i ∈ [1..n] we have Sπ(i) ⊆ Ti , where zi equals xπ(i) . ✷ Given a CSP with finite domains we would like to solve it by considering computations starting at it. But where do we get the rules from? Note that given a constraint C and a rule r that is valid for C, the constraint C is trivially closed under r. Consequently, an application of r to C is not relevant, i.e., it does not affect C. So to obtain some change we need to use rules that are not valid for the initial constraints. This brings us to the notion of a CSP based on another one. 6 CSP’s Built out of Predefined Constraints In the introduction we informally referred to the notion of a CSP “being built out of predefined, explicitly given constraints.” Let us make now this concept formal. Constraint Programming viewed as Rule-based Programming 15 We need two auxiliary notions first, where in preparation for the next definition we already consider constraints together with the domains over which they are defined. Definition 6.1 • Given a constraint C ⊆ D1 × . . . × Dn and a permutation π of [1..n] we denote by C π the relation defined by (a1 , . . ., an ) ∈ C π iff (aπ(1) , . . ., aπ(n) ) ∈ C and call it a permutation of C. • Given two constraints C ⊆ D1 × . . . × Dn and E ⊆ D1′ × . . . × Dn′ we say that C is based on E if — Di ⊆ Di′ for i ∈ [1..n], — C = E ∩ (D1 × . . . × Dn ). ✷ So the notion of “being based on” involves the domains of both constraints. If C is based on E, then C is the restriction of E to the domains over which C is defined. Definition 6.2 We assume that the “predefined constraints” are presented as a given in advance CSP BASE. Suppose that each constraint C of a CSP P is based on a permutation of a constraint of BASE. We say then that P is based on BASE. ✷ In the above definition the use of permutations of constraints allows us to abstract from the variable ordering used in BASE. The following example illustrates this notion. Example 6.3 Consider the well-known full adder circuit. It is defined by the following formula: add(i1 , i2 , i3 , o1 , o2 ) ≡ xor(i1 , i2 , x1 ), and(i1 , i2 , a1 ), xor(x1 , i3 , o2 ), and(i3 , x1 , a2 ), or(a1 , a2 , o1 ), where and, xor and or are defined in the expected way. We can view the original constraints as the following CSP: BOOL := hand(x, y, z), xor(x, y, z), or(x, y, z) ; x ∈ {0, 1}, y ∈ {0, 1}, z ∈ {0, 1}i. BOOL should be viewed just as an “inventory” of the predefined constraints and not as a CSP to be solved. Now, any query concerning the full adder can be viewed as a CSP based on BOOL. For example, in Section 10 we shall consider the query add(1, x, y, z, 0). It corresponds to the following CSP based on BOOL: h xor(i1 , i2 , x1 ), and(i1 , i2 , a1 ), xor(x1 , i3 , o2 ), and(i3 , x1 , a2 ), or(a1 , a2 , o1 ) ; i1 ∈ {1}, i2 ∈ {0, 1}, i3 ∈ {0, 1}, o1 ∈ {0, 1}, o2 ∈ {0}, a1 ∈ {0, 1}, a2 ∈ {0, 1}, x1 ∈ {0, 1} i. ✷ In what follows we consider computations that start with a CSP based on some CSP BASE. In these computations we wish to maintain equivalence between the successive CSP’s. To this end the following simple observation is crucial. 16 Krzysztof R. Apt and Eric Monfroy Note 6.4 Consider two constraints C and E such that C is based on E. Let A → x 6= a be a rule valid for E. Then the application of A → x 6= a to C maintains equivalence. Proof Assume that the rule A → x 6= a can be applied to C, i.e., that for all d ∈ C we have |=d A. Suppose now that the rule A → x 6= a to C does not maintain equivalence. Then for some d ∈ C we have d[x] = a. C is based on E, so d ∈ E. By the validity of the rule for E we get d[x] 6= a. This yields a contradiction. This observation provides us with a way of maintaining equivalence during a computation: it suffices to use at each step a rule that is valid for a permutation C π of a constraint of BASE. Such a rule is then attached (i.e., applied) to the constraint based on C π . This is what we shall do in the sequel. Depending on the type of rules used we obtain in this way different notions of local consistency. 7 Rule Consistency In this section we consider a CSP P based on some finite CSP BASE and study computations that use exclusively equality rules. The rules are obtained from the constraints of BASE; each of them is valid for a permutation C π of a constraint C of BASE and is applied to the constraint of P based on C π . By Note 6.4 the successive CSP’s are all equivalent to the initial CSP P. The computation ends when a CSP is obtained that is closed under the rules used. This brings us to a natural notion of local consistency expressed in terms of equality rules. Definition 7.1 Consider a CSP P based on a CSP BASE. Let C be a constraint of P. For some constraint f (C) of BASE and a permutation π, C is based on f (C)π . • We call the constraint C rule consistent (w.r.t. BASE) if it is closed under all equality rules that are valid for f (C)π . • We call the CSP P rule consistent (w.r.t. BASE) if all its constraints are rule consistent. ✷ In what follows we drop the reference to BASE if it is clear from the context. Example 7.2 Take as the base CSP BASE := hand(x, y, z) ; x ∈ {0, 1}, y ∈ {0, 1}, z ∈ {0, 1}i and consider the following four CSP’s based on it: 1. 2. 3. 4. hand(x, y, z) hand(x, y, z) hand(x, y, z) hand(x, y, z) ; ; ; ; x ∈ {0}, y ∈ Dy , z ∈ {0}i, x ∈ {1}, y ∈ Dy , z ∈ {0, 1}i, x ∈ {0, 1}, y ∈ Dy , z ∈ {1}i, x ∈ {0}, y ∈ Dy , z ∈ {0, 1}i, Constraint Programming viewed as Rule-based Programming 17 where Dy is a subset of {0, 1}. We noted in Example 5.2 that the equality rule x = 0 → z 6= 1 is valid for and(x, y, z). In the first three CSP’s its only constraint is closed under this rule, while in the fourth one it is not closed since 1 is present in the domain of z whereas the domain of x equals {0}. So the fourth CSP is not rule consistent. One can show that the first two CSP’s are rule consistent, while the third one is not rule consistent since it is not closed under the valid equality rule z = 1 → x 6= 0. When trying to generate all valid equality rules Note 5.3 allows us to confine our attention to the minimal valid equality rules. We now introduce an algorithm that given a finite constraint generates the set of all minimal valid equality rules for it. We collect the generated rules in a list. We denote below the empty list by empty and the result of insertion of an element r into a list L by insert(r, L). By an assignment to a sequence of variables X we mean here an element s from the Cartesian product of the domains of variables of X such that for some d ∈ C we have d[X] = s. Intuitively, if we represent the constraint C as a table with rows corresponding to the elements (tuples) of C and the columns corresponding to the variables of C, then an assignment to X is a tuple of elements that appears in some row in the columns that correspond to the variables of X. This algorithm has the following form, where we assume that the considered constraint C is defined on a sequence of variables VAR of cardinality n. Equality Rules Generation algorithm L := empty; FOR i:= 0 TO n-1 DO FOR each subset X of VAR of cardinality i DO FOR each assignment s to X DO FOR each y in VAR-X DO FOR each element d from the domain of y DO r := X = s → y 6= d ; IF r is valid for C and it does not extend an element of L THEN insert(r, L) END END END END END END The test that one equality rule does not extend another can be easily implemented by means of Note 5.4.i. The following result establishes correctness of this algorithm. Theorem 7.3 Given a constraint C the Equality Rules Generation algorithm produces in L the set of all minimal valid equality rules for C. 18 Krzysztof R. Apt and Eric Monfroy Proof First note that in the algorithm all possible feasible equality rules are considered and in the list L only the valid equality rules are retained. Additionally, a valid equality rule is retained only if it does not extend a rule already present in L. Finally, the equality rules are considered in the order according to which those that use less variables are considered first. By virtue of Note 5.4.i this implies that if a rule r2 extends a rule r1 , then r1 is considered first. As a consequence precisely all minimal valid equality rules are retained in L. The above algorithm is completely straightforward and consequently inefficient. It is easy to see that given a constraint defined over n variables, O(n·2n ·d2 ) rules are considered in it, where d is the size of the largest variable domain. This shows that in practice this algorithm is impractical for large domains and for constraints with many variables. By representing the rules explicitly one could improve the running time of this algorithm, trading time for space. Then the test that one rule does not extend another could be eliminated from the algorithm by representing explicitly the partial ordering defined by the relation “equality rule r1 extends equality rule r2 ”. Each time an equality rule that is valid for C would be found, all the rules that extend it would be now disregarded in further considerations. This would reduce the number of rules considered and improve the average running time. However, it is difficult to quantify the gain obtained and in the worst case still all the rules would have to be considered. In Section 10 and the appendix we present some empirical results showing when the Equality Rules Generation becomes infeasible. 8 Relating Rule Consistency to Arc Consistency To clarify the status of rule consistency we compare it now to the notion of arc consistency. This notion was introduced in (Mackworth, 1977a) for binary relations and was extended to arbitrary relations in (Mohr & Masini, 1988). Let us recall the definition. Definition 8.1 • We call a constraint C on a sequence of variables X arc consistent if for every variable x in X and an element a in its domain there exists d ∈ C such that a = d[x]. That is, each element in each domain participates in a solution to C. • We call a CSP arc consistent if all its constraints are arc consistent. ✷ The following result relates for constraints of arbitrary arity arc consistency to rule consistency. Theorem 8.2 Consider a CSP P based on a CSP BASE. If P is arc consistent, then it is rule consistent w.r.t. BASE. Proof Constraint Programming viewed as Rule-based Programming 19 Assume that P is arc consistent. Choose a constraint C of P and consider an equality rule X = s → y 6= a that is valid for f (C)π , where f and π are as in Definition 7.1. Suppose by contradiction that C is not closed under this rule. So for X := x1 , . . ., xk and s := s1 , . . ., sk the domain of each variable xj in P equals {sj } and moreover a ∈ D, where D is the domain of the variable y in P. By the arc consistency of P there exists d ∈ C such that d[y] = a. Because of the form of the domains of the variables in X, also d[X] = s holds. Additionally, because P is based on BASE, we have d ∈ f (C)π . But by assumption the equality rule X = s → y 6= a is valid for f (C)π , so d[y] 6= a. A contradiction. The converse implication does not hold in general as the following example shows. Example 8.3 Take as the base the following CSP BASE := hC ; x ∈ {0, 1, 2}, y ∈ {0, 1, 2}i where the constraint C on x, y that equals the set {(0, 1), (1, 0), (2, 2)}. So C can be viewed as the following table: x y 0 1 2 1 0 2 Next, take for D1 the set {0, 1} and D2 the set {0, 1, 2}. Then the CSP hC ∩ (D1 × D2 ) ; x ∈ D1 , y ∈ D2 i, so h{(0, 1), (1, 0)} ; x ∈ {0, 1}, y ∈ {0, 1, 2}i is based on BASE but is not arc consistent since the value 2 in the domain of y does not participate in any solution. Yet, it is easy to show that the only constraint of this CSP is closed under all equality rules that are valid for C. ✷ We now show that if each domain has at most two elements, then the notions of arc consistency and rule consistency coincide. More precisely, the following result holds. Theorem 8.4 Let BASE be a CSP each domain of which is unary or binary. Consider a CSP P based on BASE. Then P is arc consistent iff it is rule consistent w.r.t. BASE. Proof The ( ⇒ ) implication is the contents of Theorem 8.2. To prove the reverse implication suppose that some constraint C of P is not arc consistent. We prove that then C is not rule consistent. The constraint C is on some variables x1 , . . ., xn with respective domains D1 , . . ., Dn . For some i ∈ [1..n] some a ∈ Di does not participate in any solution to C. 20 Krzysztof R. Apt and Eric Monfroy Let Di1 , . . ., Diℓ be the sequence of all domains in D1 , . . ., Di−1 , Di+1 , . . ., Dn that are singletons. Suppose that Dij := {sij } for j ∈ [1..ℓ] and let X := xi1 , . . ., xiℓ and s := si1 , . . ., siℓ . Consider now the equality rule X = s → xi 6= a and take f (C)π , where f and π are as in Definition 7.1. For appropriate domains D1′ , . . ., Dn′ of BASE we have f (C)π ⊆ D1′ × . . . × Dn′ . Next, take some d ∈ f (C)π such that d[X] = s. We show that d ∈ C. Since C = f (C)π ∩ (D1 × . . . × Dn ) it suffices to prove that d ∈ D1 × . . . × Dn . For each variable xj lying inside of X we have d[xj ] = sj ∈ Dj . In turn, for each variable xj lying outside of X its domain Dj has two elements, so, by the assumption on BASE, Dj is the same as the corresponding domain Dj′ of f (C)π and consequently d[xj ] ∈ Dj , since d ∈ D1′ × . . . × Dn′ . So indeed d ∈ C and hence d[xi ] 6= a by the choice of a. This proves validity of the equality rule X = s → xi 6= a for f (C)π . But C is not closed under this rule since a ∈ Di , so C is not rule consistent. 9 Membership Rule Consistency In this section we consider computations that use exclusively membership rules. In the previous section we saw that the notion of rule consistency is weaker than that of arc consistency for constraints of arbitrary arity. Here we show that by using the membership rules we obtain a notion of local consistency that coincides with arc consistency. First, let us clarify the notion of a membership rule by considering the following example. Example 9.1 Consider a constraint on variables x, y, z, each with the domain {+, −, l, r}, that is defined by the following table: x y z + − l − r + − r l − + − − r l This constraint is the so-called fork junction in the language of (Waltz, 1975) for describing polyhedral scenes. Note that the following three membership rules r1 := x ∈ {+, −} → z 6= l, r2 := x ∈ {+} → z 6= l, Constraint Programming viewed as Rule-based Programming 21 and r3 := x ∈ {−}, y ∈ {l} → z 6= l are all valid. The membership rules r2 and r3 extend r1 while the membership rule r1 extends neither r2 nor r1 . Further, the membership rules r2 and r3 are incomparable in the sense that none extends the other. ✷ Now, in analogy to Definition 7.1, we introduce the following notion. Definition 9.2 Consider a CSP P is based on a CSP BASE. Let C be a constraint of P. For some constraint f (C) of BASE and a permutation π, C is based on f (C)π . • We call the constraint C membership rule consistent (w.r.t. BASE) if it is closed under all membership rules that are valid for f (C)π . • We call a CSP membership rule consistent (w.r.t. BASE) if all its constraints are membership rule consistent. ✷ We now have the following result. Theorem 9.3 Consider a CSP P based on a CSP BASE. Then P is arc consistent iff it is membership rule consistent w.r.t. BASE. Proof ( ⇒ ) This part of the proof is a simple modification of the proof of Theorem 8.2. Assume that P is arc consistent. Choose a constraint C of P and consider a membership rule X ∈ S → y 6= a that is valid for f (C)π , where f and π are as in Definition 6.2. Suppose by contradiction that C is not closed under this rule. So for X := x1 , . . ., xk and S := S1 , . . ., Sk the domain of each variable xj is included in Sj and moreover a ∈ D, where D is the domain of the variable y. By the arc consistency of P there exists d ∈ C such that d[y] = a. Because of the form of the domains of the variables in X, also d[xi ] ∈ Si for i ∈ [1..k] holds. Additionally, because P is based on BASE we have d ∈ f (C)π . But by assumption the rule X ∈ S → y 6= a is valid for f (C)π , so d[y] 6= a. A contradiction. ( ⇐ ) This part of the proof is a modification of the proof of Theorem 8.4. Suppose that some constraint C of P is not arc consistent. We prove that then C is not membership rule consistent. The constraint C is on some variables x1 , . . ., xn with respective domains D1 , . . ., Dn . For some i ∈ [1..n] some a ∈ Di does not participate in any solution to C. Take f (C)π , where f and π are as in Definition 9.2. For appropriate domains ′ D1 , . . ., Dn′ of BASE we have f (C)π ⊆ D1′ × . . . × Dn′ . Let Di1 , . . ., Diℓ be the sequence of domains in D1 , . . ., Di−1 , Di+1 , . . ., Dn that ′ ′ are respectively different than D1′ , . . ., Di−1 , Di+1 , . . ., Dn′ . Further, let X := xi1 , . . ., xiℓ and S := Di1 , . . ., Diℓ . Consider now the membership rule X ∈ S → xi 6= a. Take some d ∈ f (C)π such that d[xij ] ∈ Dij for j ∈ [1..ℓ]. We show that d ∈ C. Since C = f (C)π ∩ (D1 × 22 Krzysztof R. Apt and Eric Monfroy . . . × Dn ) it suffices to prove that d ∈ D1 × . . . × Dn . For each variable xj lying inside of X we have d[xj ] ∈ Dj . In turn, for each variable xj lying outside of X its domain Dj is the same as the corresponding domain Dj′ of f (C)π in BASE and consequently d[xj ] ∈ Dj , since d ∈ D1′ × . . . × Dn′ . So indeed d ∈ C and hence d[xi ] 6= a by the choice of a. This proves validity of the rule X ∈ S → xi 6= a for f (C)π . But C is not closed under this membership rule since a ∈ Di , so C is not membership rule consistent. Example 8.3 shows that the notions of rule consistency and membership rule consistency do not coincide. To see this difference better let us reconsider the CSP discussed in this example. We noted there that this CSP is not arc consistent and that it is rule consistent. From the above theorem we know that this CSP is not membership rule consistent. In fact, consider the following membership rule: x ∈ {0, 1} → y 6= 2. This membership rule is valid for the base constraint C but the restricted constraint C ∩ (D1 × D2 ) is not closed under this rule. In conclusion, the membership rules are more powerful than the equality rules. As in Section 7 we now provide an algorithm that given a constraint generates the set of all minimal valid membership rules. We assume here that the considered constraint C is defined on a sequence of variables VAR of cardinality n. Instead of assignments that are used in the Equality Rules Generation algorithm we now need a slightly different notion. To define it for each variable x from VAR recall that we denoted the set {d[x] | d ∈ C} by C[x]. By a weak assignment to a sequence of variables X := x1 , . . ., xk we mean here a sequence S1 , . . ., Sk of subsets of, respectively, C[x1 ], . . ., C[xk ] such that some d ∈ C exists such that d[xi ] ∈ Si for each i ∈ [1..k]. Intuitively, if we represent the constraint C as a table with rows corresponding to the elements of C and the columns corresponding to the variables of C and we view each column as a set of elements, then a weak assignment to X is a tuple of subsets of the columns that correspond to the variables of X that “shares” an assignment. In the algorithm below the weak assignments to a fixed sequence of variables are considered in decreasing order in the sense that if the weak assignments S1 , . . ., Sk and U1 , . . ., Uk are such that for i ∈ [1..k] we have Ui ⊆ Si , then S1 , . . ., Sk is considered first. Membership Rules Generation algorithm L := empty; FOR i:= 0 TO n-1 DO FOR each subset X of VAR of cardinality i DO FOR each weak assignment S to X in decreasing order DO FOR each y in VAR-X DO FOR each element d from the domain of y DO Constraint Programming viewed as Rule-based Programming 23 r := X ∈ S → y 6= d ; IF r is valid for C and it does not extend an element of L THEN insert(r, L) END END END END END END The test that one membership rule does not extend another can be implemented using Note 5.4.ii. The following result establishes correctness of this algorithm. Theorem 9.4 Given a constraint C the Membership Rules Generation algorithm produces in L the set of all minimal valid membership rules for C. Proof The proof is analogous to that of Theorem 7.3. We only need to check that the membership rules are considered in such an order that if a rule r2 extends a rule r1 , then r1 is considered first. This follows from directly from Note 5.4.ii. 10 Applications In this section we discuss the implementation of the Equality Rules Generation and Membership Rules Generation algorithms and discuss their use on selected domains. 10.1 Constraint Handling Rules (CHR) In order to validate our approach we have realized in the Prolog platform ECLi PSe a prototype implementation of both the Rules Generation algorithm and the Membership Rules Generation algorithm. We made a compromise between memory usage and performance so that we could tackle some non-trivial problems (in terms of size of the domains of variables, and in terms of arity of constraints) in spite of the exponential complexity of the algorithms. These implementations generate CHR rules that deal with finite domain variables using an ECLi PSe library. Constraint Handling Rules (CHR) of (Frühwirth, 1995) is a declarative language that allows one to write guarded rules for rewriting constraints. These rules are repeatedly applied until a fixpoint is reached. The rule applications have a precedence over the usual resolution step of logic programming. A CHR program is a finite set of CHR rules. These rules are basically of two types (there is a third type of rules which is a combination of the first two types): simplification rules and propagation rules. When all guards are satisfied, a simplification rule replaces constraints by simpler ones while preserving logical equivalence, 24 Krzysztof R. Apt and Eric Monfroy whereas a propagation rule adds logically redundant constraints. More precisely, these rules have the following form: simplification H1 , . . . , Hi <=> G1 , . . . , Gj | B1 , . . . , Bk propagation H1 , . . . , Hi ==> G1 , . . . , Gj | B1 , . . . , Bk where • • • • i > 0, j ≥ 0, k ≥ 0, the multi-head H1 , . . . , Hi is a non-empty sequence of CHR constraints, the guard G1 , . . . , Gj is a sequence of built-in constraints, the body B1 , . . . , Bk is a sequence of built-in and CHR constraints. Our equality rules and membership rules can be modelled by means of propagation rules. To illustrate this point consider some constraint cons on three variables, A, B, C, each with the domain {0, 1, 2}. The Rules Generation algorithm generates rules such as (A, C) = (0, 1) → B 6= 2. This rule is translated into a CHR rule of the form: cons(0,B,1) ==> B##2. Now, when a constraint in the program query unifies with cons(0,B,1), this rule is fired and the value 2 is removed from the domain of the variable B. In turn, the Membership Rules Generation algorithm generates rules such as (A, C) ∈ ({0}, {1, 2}) → B 6= 2. This rule is translated into the CHR rule cons(0,B,C) ==>in(C,[1,2]) | B##2 where the in predicate is defined by in(X,L):- dom(X,D), subset(D,L). So in(X,L) holds if the current domain of the variable X (yielded by the built-in dom of ECLi PSe ) is included in the list L. Now, when a constraint unifies with cons(0,B,C) and the current domain of the variable C is included in [1,2], the value 2 is removed from the domain of B. So for both types of rules we achieve the desired effect. In the examples below we combine the rules with the same premise into one rule in an obvious way and present these rules in the CHR syntax. 10.2 Generating the rules We begin by discussing the generation of equality rules and membership rules for some selected domains. The times given refer to an implementation ran on a Silicon Graphics O2 with 64 Mbytes of memory and a 180 MHZ processor. Boolean constraints As the first example consider the Boolean constraints, for example the conjunction constraint and(X,Y,Z) of Example 5.2. The Equality Rules Generation algorithm generated in 0.02 seconds the following six equality rules: and(1,1,X) ==> X##0. and(X,0,Y) ==> Y##1. Constraint Programming viewed as Rule-based Programming and(0,X,Y) and(X,Y,1) and(1,X,0) and(X,1,0) ==> ==> ==> ==> 25 Y##1. X##0,Y##0. X##1. X##1. Because the domains are here binary we can replace the conclusions of the form U ## 0 by U = 1 and U ## 1 by U = 0. These rules are somewhat different than the well-known rules that can be found e.g. in (Frühwirth, 1998)[page 113], where instead of the rules and(1,1,X) ==> X##0. and(1,X,0) ==> X##1. and(X,1,0) ==> X##1. the rules and(1,X,Y) ==> X = Y. and(X,1,Y) ==> X = Y. and(X,Y,Z), X = Y ==> Y = Z. appear. We shall discuss this matter in Section 11. In this case, by virtue of Theorem 8.4, the notions of rule and arc consistency coincide, so the above six equality rules characterize the arc consistency of the and constraint. Our implementations of the Equality Rules Generation and the Membership Rules Generation algorithms yield here the same rules. Three valued logic Next, consider the three valued logic of (Kleene, 1952)[page 334] that consists of three values, t (true), f (false) and u (unknown). We only consider here the crucial equivalence relation ≡ defined by the truth table ≡ t f u t f u t f u f t u u u u that determines a ternary constraint with nine triples. We obtain for it 20 equality rules and 26 membership rules. Typical examples are equiv(X,Y,f) ==> X##u,Y##u. and equiv(t,X,Y) ==> in(Y,[f, u]) | X##t. Six valued logic In (Van Hentenryck et al., 1992) the constraint logic programming language CHIP is used for the automatic test-pattern generation (ATPG) for the digital circuits. To this end the authors define a specific six valued logic and provide 26 Krzysztof R. Apt and Eric Monfroy some rules (expressed in the form of so-called demons) to carry out the constraint propagation. The and6 constraint in question is defined by means of the following table: and6 0 1 0 1 d dnot e enot 0 0 −− −− 0 0 0 1 d dnot e enot d dnot e enot −− −− 0 0 d dnot e enot −− −− d −− −− −− −− dnot d −− e 0 −− dnot 0 enot The Equality Rules Generation algorithm generated 41 equality rules in 0.15 seconds, while the Membership Rules Generation algorithm generated 155 membership rules in 14.35 seconds. The generated rules enforce, respectively, rule consistency and arc consistency, while it is not clear what notion of local consistency is enforced by the (valid) rules of (Van Hentenryck et al., 1992)[page 133] because some of the latter ones allow equalities between the variables in the premise. This makes the comparison in terms of strength of the entailed notion of local consistency difficult. It is clear that our approach is more systematic and fully automatic. (In fact, we found two typo’s in the rules of (Van Hentenryck et al., 1992)[page 133].) Propagating signs As a next example consider the rules for propagating signs in arithmetic expressions, see, e.g., (Davis, 1987)[page 303]. We limit ourselves to the case of multiplication. Consider the following table: × neg neg zero pos unk pos zero neg unk zero pos unk zero zero zero zero unk zero unk unk neg zero pos unk This table determines a ternary constraint msign that consists of 16 triples, for instance (neg, neg, pos) that denotes the fact that the multiplication of two negative numbers yields a positive number. The value “unk” stands for “unknown”. The Equality Rules Generation algorithm generated in 0.08 seconds 34 equality rules. A typical example is msign(X,zero,Y) ==> Y##pos,Y##neg,Y##unk. In turn, the Membership Rules Generation algorithm generated in 0.6 seconds 54 membership rules. A typical example is msign(X,unk,Y) ==> in(Y,[neg, pos, zero]) | X##pos,X##neg Constraint Programming viewed as Rule-based Programming 27 that corresponds to the following two membership rules for the constraint msign(X,Z,Y): (Z, Y ) ∈ ({unk}, {neg, pos, zero}) → X 6= pos and (Z, Y ) ∈ ({unk}, {neg, pos, zero}) → X 6= neg. Waltz’ language for describing polyhedral scenes Waltz’ language consists of four constraints. One of them, the fork junction was already mentioned in Example 9.1. The Equality Rules Generation algorithm generated for it 12 equality rules and the Membership Rules Generation algorithm 24 membership rules. Another constraint, the so-called T junction, is defined by the following table: x y z r r r r l + l − l r l l In this case the Equality Rules Generation algorithm and the Membership Rules Generation algorithm both generate the same output that consists of just one rule: t(X,Y,Z) ==> X##’l’,X##’-’,X##’+’,Y##’r’,Y##’-’,Y##’+’. So this rule characterizes both rule consistency and arc consistency for the CSP’s based on the T junction. For the other two constraints, the L junction and the arrow junction, the generation of the equality rules and membership rules is equally straightforward. 10.3 Using the rules Next, we show by means of some examples how the generated rules can be used to reduce or to solve specific queries. Also, we show how using compound constraints we can achieve local consistency notions that are stronger than arc consistency for constraints of arbitrary arity. Waltz’ language for describing polyhedral scenes The following predicate describes the impossible scene given in Figure 1 and taken from (Winston, 1992)[page 262]: imp(AF,AI,AB,IJ,IH,JH,GH,GC,GE,EF,ED,CD,CB):S1=[AF,AI,AB,IJ,IH,JH,GH,GC,GE,EF,ED,CD,CB], S2=[FA,IA,BA,JI,HI,HJ,HG,CG,EG,FE,DE,DC,BC], append(S1,S2,S), S :: [+,-,l,r], 28 Krzysztof R. Apt and Eric Monfroy F A I J H G E D B C Fig. 1. Impossible scene arrow(AF,AB,AI), l(BC,BA), arrow(CB,CD,CG), l(DE,DC), arrow(ED,EG,EF), l(FA,FE), fork(GH,GC,GE), arrow(HG,HI,HJ), fork(IA,IJ,IH), l(JH,JI), line(AF,FA), line(AB,BA), line(AI,IA), line(IJ,JI), line(IH,HI), line(JH,HJ), line(GH,HG), line(FE,EF), line(GE,EG), line(GC,CG), line(DC,CD), line(ED,DE), line(BC,CB). where the supplementary constraint line is defined by the following table: x y + − l r + − r l Here and elsewhere we use the ECLi PSe built-in :: to declare variable domains. When using the equality rules obtained by the Equality Rules Generation algorithm and associated with the fork, arrow, t, l, and line constraints, the query imp(AF,AI,AB,IJ,IH,JH,GH,GC,GE,EF,ED,CD,CB) reduces in 0.009 seconds the variable domains to AF ∈ [+,-, l], AI ∈ [+,-], AB ∈ [+,-,r], IJ ∈ [+,-,l,r], IH ∈ [+,-,l,r], JH ∈ [+,-,l,r], GH ∈ [+,-,l,r], GC ∈ [+,-,l,r], GE ∈ [+,-,l,r], EF ∈ [+,-], ED ∈ [+,-,l], CD ∈ [+,-,r], and CB ∈ [+,-,l]. But some constraints remain unsolved, so we need to add a labeling mechanism to prove the inconsistency of the problem. On the other hand, when using the membership rules, the inconsistency is detected without any labeling in 0.06 seconds. Constraint Programming viewed as Rule-based Programming 29 In the well-known example of the cube given in Figure 12.15 of (Winston, 1992)[page 260] the membership rules are also more powerful than the equality rules and both sets of rules reduce the problem but in both cases labeling is needed to produce all four solutions. Comparing the constraint solver based on the membership rules to the constraint solver based on the equality rules is not easy: although propagation is more efficient with the membership rules, the solver based on the equality rules can sometimes be faster depending on the structure of the problem and on whether the labeling is needed. We also compared the solvers generated by the implementations of the Equality Rules Generation and Membership Rules Generation algorithms to the approach described in (By, 1997) and based on meta-programming in Prolog. We ran the same examples and drew the following conclusions. For small examples our solvers were less efficient than the ones of By (with factors varying from 2 to 10). However, for more complex examples, our solvers became significantly more efficient, with factors varying from 10 to 500. This can be attributed to the increased role of the constraint propagation that reduces backtracking and that is absent in By’s approach. Temporal reasoning In (Allen, 1983)’s approach to temporal reasoning the entities are intervals and the relations are temporal binary relations between them. (Allen, 1983) found that there are 13 possible temporal relations between a pair of events, namely before, during, overlaps, meets, starts, finishes, the symmetric relations of these six relations and equal. We denote these 13 relations respectively by b,d,o,m,s,f,b-,d-,o-,m-,s-,f-,e and their set by TEMP. Consider now three events, A, B and C and suppose that we know the temporal relations between the pairs A and B, and B and C. The question is what is the temporal relation between A and C. To answer it (Allen, 1983) provided a 13 × 13 table. This table determines a ternary constraint between a triple of events, A, B and C that we denote by allen. For example, (overlaps, before, before) ∈ allen since A overlaps B and B is before C implies that A is before C. Using this table, the Equality Rules Generation algorithm produced for the constraint allen 498 equality rules in 31.16 seconds. In contrast, we were unable to generate all membership rules in less than 24 hours. This shows the limitations of our implementation. We tried the generated set of equality rules to solve the following problem from (Allen, 1983): “John was not in the room when I touched the switch to turn on the light.”. We have here three events: S, the time of touching the switch; L, the time the light was on; and J, the time that John was in the room. Further, we have two relations: R1 between L and S, and R2 between S and J. This problem is translated into the CSP hallen ; R1 ∈ [o−, m−], R2 ∈ [b, m, b−, m−], R3 ∈ TEMPi, where allen is the above constraint on the variables R1, R2, R3. 30 Krzysztof R. Apt and Eric Monfroy To infer the relation R3 between L and J we can use the following query 1 : R1::[o-,m-], R2::[b,m,b-,m-], R3::[b,d,o,m,s,f,b-,d-,o-,m-,s-,f-,e], allen(R1,R2,R3), labeling([R1,R2,R3]). We then obtain the following solutions in 0.06 seconds: (R1,R2,R3) ∈ {(m-,b,b), (m-,b,d-), (m-,b,f-), (m-,b,m), (m-,b,o), (m-,b-,b-), (m-,m,e), (m-,m,s), (m-,m,s-), (m-,m-,b-), (o-,b,b), (o-,b,d-), (o-,b,f-), (o-,b,m), (o-,b,o), (o-,b-,b-), (o-,m,d-), (o-,m,f-), (o-,m,o), (o-,m-,b-)}. To carry on (as in (Allen, 1983)), we now complete the problem with: “But John was in the room later while the light went out.”. This is translated into: “L overlaps, starts, or is during J”, i.e., R3 ∈ [o,s,d]. We now run the following query: R1::[o-,m-], R2::[b,m,b-,m-], R3::[o,s,d], allen(R1,R2,R3), labeling([R1,R2,R3]). and obtain four solutions in 0.04 seconds: (R1,R2,R3) ∈ {(m-,b,o), (m-,m,s), (o-,b,o), (o-,m,o)}. Three valued logic Next, consider the and3 constraint in the three valued logic of (Kleene, 1952)[page 334] represented by the truth table and3 t f u t f u t f u f f f u f u Typical examples of the 16 generated equality rules and of the 18 generated membership rules are: and3(u,u,X) ==> X##0. and and3(X,Y,Z) ==> in(X,[0, u]) | Z##1. Consider now the query: 1 Since no variable is instantiated, we need to perform labeling to effectively apply the rules. Constraint Programming viewed as Rule-based Programming 31 [X,Y,Z,T,U]::[0,1,u], and3(X,Y,Z), and3(T,U,Z), Z##0,Y##u, X##u. Using the membership rules we reach the answer in the form of a complete assignment to all the variables, namely X = 1,Y = 1,Z = 1,T = 1,U = 1, whereas using only the equality rules we do not obtain any reduction and labeling is needed to produce the same answer. Full adder It is often the case that dealing with a compound constraint directly yields a stronger notion of local consistency than when dealing with each of its constituents separately. A prototypical example is the well-known alldifferent binary disequality constraint on n variables that can be decomposed into n·(n−1) 2 constraints. Then arc consistency enforced on alldifferent is stronger than arc consistency enforced on each of the disequality constraints separately. The same phenomenon arises for rule consistency. We illustrate it by means of the already discussed in Example 6.3 full adder circuit. It can be defined by the following constraint logic program (see, e.g., (Frühwirth, 1998)) that uses the Boolean constraints and, xor and or: add(I1,I2,I3,O1,O2):[I1,I2,I3,O1,O2,A1,A2,X1]:: 0..1, xor(I1,I2,X1), and(I1,I2,A1), xor(X1,I3,O2), and(I3,X1,A2), or(A1,A2,O1). The query add(I1,I2,I3,O1,O2) followed by a labeling mechanism generates the explicit definition (truth table) of the full adder constraint with eight entries such as full_adder(1,0,1,1,0). We can now generate the equality rules for the compound constraint (here the full adder constraint) that is defined by means of some basic constraints (here the and, or and xor constraints). These rules refer to the compound constraint and allow us to reason about it directly instead of by using the rules that deal with the basic constraints. In the case of the full adder constraint the Equality Rules Generation algorithm generated 52 equality rules in 0.27 seconds. The constraint propagation carried out by means of these equality rules is more powerful than the one carried out by means of the equality rules generated for the and, or and xor constraints. For example, the query [X,Y,Z]::[0,1], full_adder(1,X,Y,Z,0) reduces Z to 1 whereas the query [X,Y,Z]::[0,1], add(1,X,Y,Z,0) does not reduce Z at all. So rule consistency for a compound constraint defined by means of the basic constraints is indeed in general stronger than the rule consistency for the basic constraints treated separately. In fact, in the above case the equality rules for the full adder constraint yield the relational (1,5)-consistency notion of (Dechter & 32 Krzysztof R. Apt and Eric Monfroy van Beek, 1997), whereas by virtue of Theorem 8.4, the equality rules for the and, or and xor constraints yield a weaker notion of arc consistency. 11 Related Work 11.1 Relation Between Constraint Programming and Rule-Based Programming In a number of papers a link was made between constraint programming and rulebased programming. To start with, in (Montanari & Rossi, 1991) a general study of constraint propagation was undertaken by defining the notion of a relaxation rule and by proposing a general relaxation algorithm that implements constraint propagation by means of a repeated application of the relaxation rules. However, this abstract view of constraint programming cannot be realized in a simple way since the application of a relaxation rule is a complex process. In (Apt, 1998) we showed how constraint programming can be couched in proof theoretic terms by viewing the programming process as the task of proving the original CSP. In the proposed framework two types of rules were proposed: deterministic ones and the splitting ones. Further, the deterministic rules were either concerned with domain reduction or constraint reduction. In the former case the rules were called domain reduction rules and in the latter case constraint reduction rules. Such rules are high-level abstractions and on the implementation level they can involve complex computations. It is useful to see that the rule-based approach to constraint programming proposed in this paper is an instance of this proof theoretic view of constraint programming. Namely, the equality rules and the membership rules are examples of the domain reduction rules while labeling, the formal treatment of which is omitted here, is an example of a splitting rule. The important gain is that the implementation of the considered here equality rules and membership rules boils down to a straightforward translation of them into the CHR syntax. This leads to an implementation of this approach to constraint programming by means of constraint logic programming. The important limitation is that this approach applies only to the CSP’s built out of predefined, explicitly given finite constraints. A similar approach to constraint programming to that of (Apt, 1998) was proposed in (Castro, 1998). In his approach the proof rules are represented as rewrite rules in the already mentioned in the introduction programming language ELAN. The rules use a richer syntax than here considered by referring to arbitrary constraints and to expressions of the form x ∈ D, where D is the current domain of the variable x. In particular no constraint specific rules were considered. Instead, the emphasis was on showing how the general techniques of constraint programming, in particular various search strategies, can be expressed in the form of rules. Constraint Programming viewed as Rule-based Programming 33 11.2 Generation of Rules Let us turn now to an overview of the recent work on rules generation. Building upon the work presented in (Apt & Monfroy, 1999) two articles appeared in which algorithms were presented that aim at improving the expressivity of the rules and at a more economic representation. In (Ringeissen & Monfroy, 2000) rules similar to equality rules were considered. The most significant improvement is the use of parameters (i.e., unspecified constants) that leads to a decrease in the number of generated rules. Parameters are also a means for deducing equalities of variables in the right-hand side of rules. For instance, consider the following two rules with parameters a1 and a2 for a constraint C taken from (Ringeissen & Monfroy, 2000): x1 = a1 → x2 = a1 ∧ x3 = 1 (1) x2 = a2 → x1 = a2 ∧ x3 = 1 (2) Rule (1) means that whatever the value of x1 is, x2 is equal to x1 and x3 is equal to 1. From rules (1) and (2) an equality between the variables on the right-hand side of the rule can be deduced (note that the resulting rule can always be applied): → x2 = x1 ∧ x3 = 1 To generate such rules with parameters (Ringeissen & Monfroy, 2000) combine unification in finite algebra with a rule generation algorithm. The size of the generated set of rules significantly depends on an ordering on variables. It still needs to be clarified what is the counterpart of the notion of a minimal rule in this framework and whether the generated rules with parameters enforce rule-consistency. Sets of rules generated in (Abdennadher & Rigotti, 2000) are even more compact and more expressive: multiple occurrences of variables and conjunction of constraints with shared variables are allowed in the left-hand side of rules. Moreover, the user has the possibility to specify the admissible syntactic form of the rules: more specifically, right-hand sides of rules can consists of more complex constraints than (dis)-equality constraints. Here are two examples of rules (taken from two different sets of rules of (Abdennadher & Rigotti, 2000)): and(x, x, z) → x = z. (3) and(x, y, z), neg(x, y) → z = 0. (4) In rule (3) equality between variables is deduced using a double occurrence of the variable x in the head, and rule (4) defines interaction between two constraints, and and neg. (Abdennadher & Rigotti, 2000) also investigated what form of local consistency is enforced by the rules generated by their algorithms. When using the given constraint together with equality (between a variable and a value) on the left-hand side, and only disequality (between a variable and a value) on the right-hand side of the rules, the generated rules enforce rule consistency. However, in general, the enforced 34 Krzysztof R. Apt and Eric Monfroy local consistency is stronger than rule consistency. In particular, it is plausible that membership rule consistency (i.e., arc consistency) is enforced when disequality constraints are allowed both on the right- and left-hand sides of rules. In (Apt, 2000) two sets of rules for Boolean constraints were compared. One of them is the one presented in Subsection 10.2 and the other the already mentioned set of rules from (Frühwirth, 1998)[page 113] (with one difference irrelevant for the subsequent discussion). While both sets of rules enforce the arc consistency, it turns out that they are not equivalent. In fact, if a Boolean CSP with non-empty domains is closed under the rules from the second set, then it is closed under the rules from the first set. The converse does not hold since the CSP hx ∧ y = z ; x ∈ {1}, y ∈ {0, 1}, z ∈ {0, 1}i is closed under the first set of rules but not under the second one, since it is not closed under the rule and(1,X,Y) ==> X = Y. 11.3 Local Consistency Notions In this paper we considered local consistency by focusing on individual, arbitrary, non-binary, constraints. In the literature algorithms for achieving such notions of local consistency usually concentrated on achieving arc consistency of non-binary CSP’s. Among them the algorithm CN of (Mackworth, 1977b), and GAC4 of (Mohr & Masini, 1988) are respectively based on ideas similar to the AC-3 and AC-4 algorithms for binary constraints. However, in practice CN is usable only for ternary constraints and small domains, and has a large worst-case time complexity. On the other hand, the large space complexity of GAC4 makes it usable only for constraints of small size. The GAC-schema of (Bessière & Régin, 1997) was designed to enforce arc consistency on non-binary constraints while keeping a reasonable time and space complexity. It is based on an AC-7 like schema and allows constraints to be given explicitly, either in a positive way as in our case, or in a negative way, i.e., in the form of “forbidden” tuples, or implicitly in the form of predicates. In order to make our framework as general as the GAC-schema, we could think of generating the allowed tuples by testing all possible tuples. However, this would almost always be impractical because of space considerations. In (Bessière, 1999) the following opinion was voiced on non-binary constraints: “Perhaps we should accept the idea that the constraint solving tool of the next years will apply different levels of local consistency on different constraints at each node of the search tree, ...”. Our framework is amenable to such a view since we can generate rules for enforcing various types of local consistencies. For example, we can generate some equality rules for some constraints and some membership rules for other constraints, and then apply only the resulting set of rules. Another consideration is that our constraint solving process consists of two separate phases: first a generation of the rules (a sort of compilation of the truth table of a constraint) which is done once and for all, followed by the application of the rules. Thus, the set of generated rules can be modified during the application phase, for example by combining some rules (for a more efficient application of the rules), Constraint Programming viewed as Rule-based Programming 35 by removing some rules or by strengthening some conditions to weaken the domain reduction process. While preparing this revised version of the paper we noted that a similar notion to our rule consistency notion was introduced in the context of the theory of fuzzy sets, see (Pedrycz & Gomide, 1998)[pages 252-261]. The notion there considered deals with rules of the form “if x is A, then y is B”, where A and B are fuzzy sets. In spite of the same name used (namely, rule consistency), the uses of both notions are different. In our case, we employ it to reduce a specific CSP to a smaller one that is rule consistent but can be inconsistent, while in the case of the fuzzy set theory the corresponding notion is used to detect conditions for “potential inconsistency” that arises when the rules express contradictory knowledge. Finally, let us mention that rule generation appears in other areas of computer science. Typical examples are: programs for machine learning that construct a model of the knowledge using decision trees and production rules (see, e.g., (Quinlan, 1993)) inductive logic programming, a logic-based approach to machine learning where logic programming rules are inferred from positive and negative examples and a background knowledge (see, e.g., (Muggleton & de Raedt, 1994)), and data mining that aims at extracting high-level representations in the form of patterns and models from data (see, e.g., (Agrawal et al., 1996) where so-called association rules are generated.). 12 Conclusions The aim of this paper was to provide a framework in which constraint programming can be entirely reduced to rule-based programming. It involved constraint satisfaction problems built out of explicitly given constraints. In the case the latter constraints are defined over small finite domains these CSP’s can be often solved by means of automatically generated constraint propagation algorithms. We argued that such CSP’s often arise in practice and consequently the methods here developed can be of practical use. We believe that the approach of this paper could be applied to a study of various decision problems concerning specific multivalued logics and this in turn could be used for an analysis of digital circuits (see, e.g., (Muth, 1976) where a nine valued logic is used). Other applications could involve non-linear constraints over small finite domains and the analysis of polyhedral scenes in presence of shadows (see (Waltz, 1975)). The introduced notion of rule consistency is weaker than arc consistency and can be in some circumstances the more appropriate one to use. For example, for the case of temporal reasoning considered in the last section we easily generated all 498 equality rules that enforce rule consistency whereas 24 hours turned out not be enough to generate the membership rules that enforce arc consistency. (For a more precise summary of the tests carried out see the appendix.) In this paper, we focused on systematic and automated aspects of rule-based constraint solvers. At present stage it is difficult to compare the performance of our method (based on rule generation and subsequent rule application) with other 36 Krzysztof R. Apt and Eric Monfroy methods based on classical constraint propagation algorithms. The reason is that our approach is currently implemented by means of CHR rules that are applied on top of Prolog while the built-in constraint propagation algorithms are usually implemented at a lower level. Finally, the notions of rule consistency and membership rule consistency could be parametrized by the desired maximal number of variables used in the rule premises. Such parametrized versions of these notions could be useful when dealing with constraints involving a large number of variables. Both the Equality Rules Generation algorithm and the Membership Rules Generation algorithm and their implementations can be trivially adapted to such parametrized notions. The approach proposed in this paper could be easily integrated into constraint logic programming systems such as ECLi PSe . This could be done by providing an automatic constraint propagation by means of the equality rules or the membership rules for flagged predicates that are defined by a list of ground facts, much in the same way as now constraint propagation for linear constraints over finite systems is automatically provided. Acknowledgements We would like to thank Thom Frühwirth, Andrea Schaerf and all three referees for several useful suggestions. Victor Marek provided material for Section 3 and suggested Section 4. References Abdennadher, S., & Rigotti, C. (2000). Automatic generation of propagation rules for finite domains. Pages 18–34 of: Dechter, R. (ed), Proceedings of the sifth interbational conference on principles and practice of constraint programming (CP’00). Lecture Notes in Computer Science, vol. 1894. Singapore: Springer-Verlag. Agrawal, R., Mannila, H., Srikant, R., Toivonen, & Verkamo, A. Inkeri. (1996). Fast discovery of association rules. Pages 307–328 of: Fayyad, U. M., Piatetsky-Shapiro, G., Smyth, P., & Uthurusamy, R. (eds), Advances in knowledge discovery and data mining. AAAI Press. Allen, J.F. (1983). Maintaining knowledge about temporal intervals. Communications of acm, 26(11), 832–843. Apt, K. R. (1998). A proof theoretic view of constraint programming. Fundamenta informaticae, 33(3), 263–293. Available via http://arXiv.org/archive/cs/. Apt, K. R. (1999a). The essence of constraint propagation. Theoretical computer science, 221(1–2), 179–210. Available via http://arXiv.org/archive/cs/. Apt, K. R. (1999b). The rough guide to constraint propagation. Pages 1–23 of: Jaffar, J. (ed), Fifth international conference on principles and practice of constraint programming (cp’99). Lecture Notes in Computer Science 1713. Alexandra, Virginia, USA: SpringerVerlag. Invited Lecture. Available via http://arXiv.org/archive/cs/. Apt, K. R., & Monfroy, E. (1999). Automatic generation of constraint propagation algorithms for small finite domains. Pages 58–72 of: Jaffar, J. (ed), Fifth international conference on principles and practice of constraint programming (cp’99). Lecture Notes in Computer Science. Alexandra, Virginia, USA: Springer-Verlag. Available via http://arXiv.org/archive/cs/. Constraint Programming viewed as Rule-based Programming 37 Apt, K.R. (2000). Some remarks on Boolean constraint propagation. Pages 91 – 107 of: Apt, K. R., Kakas, A. C., Monfroy, E., & Rossi, F. (eds), New trends in constraints. Lecture Notes in Artificial Intelligence, vol. 1865. Springer-Verlag. Available via http://arXiv.org/archive/cs/. Bessière, C. (1999). Non-binary constraints. Pages 24–27 of: Jaffar, J. (ed), Proceedings of the fifth interbational conference on principles and practice of constraint programming (CP’99). Lecture Notes in Computer Science, vol. 1713. Alexandra, Virginia, USA: Springer-Verlag. Invited lecture. Bessière, C., & Régin, J. C. (1997). Arc consistency for generalized constraint networks: preliminary results. Pages 398–404 of: Proceedings of the international joint conference on artificial intelligence (IJCAI’97). Borovansky, P., Kirchner, C., Kirchner, H., Moreau, P.-E., & Ringeissen, Ch. (1998). An Overview of ELAN. Kirchner, C., & Kirchner, H. (eds), Proceedings of the Second International Workshop on Rewriting Logic and its Applications. Electronic Notes in Theoretical Computer Science, vol. 15. Pont-à-Mousson (France): Elsevier. By, T. (1997). Line labelling by meta-programming. Tech. rept. CS-97-07. University of Sheffield. Caseau, Y., & Laburthe, F. (1996). Introduction to the CLAIRE programming language. Tech. rept. Departement Mathématiques et Informatique, Ecole Normale Supérieure, Paris, France. Castro, C. (1998). Building constraint satisfaction problem solvers using rewrite rules and strategies. Fundamenta informaticae, 33(3), 263–293. Davis, E. (1987). Constraint propagation with interval labels. Artificial intelligence, 32(3), 281–331. Dechter, R., & van Beek, P. (1997). Local and global relational consistency. Theoretical computer science, 173(1), 283–308. Fleming, J. (2000). Rainy day games. Dell Logic Puzzles 67, 7. Forgy, C.L. (1981). The OPS5 user’s manual. Tech. rept. CMU-CS-81-135. CarnegieMellon University. Frühwirth, T. (1998). Theory and practice of constraint handling rules. Journal of logic programming, 37(1–3), 95–138. Special Issue on Constraint Logic Programming (P. Stuckey and K. Marriot, Eds.). Frühwirth, Thom. (1995). Constraint Handling Rules. Pages 90–107 of: Podelski, Andreas (ed), Constraint programming: Basics and trends. LNCS 910. Springer-Verlag. (Châtillon-sur-Seine Spring School, France, May 1994). Kirchner, C., & Ringeissen, C. (1998). Rule-based constraint programming. Fundamenta informaticae, 34(3), 225–262. Kleene, S. C. (1952). Introduction to metamathematics. New York: van Nostrand. Luger, G.F., & Stubblefield, W. A. (1998). Artificial intelligence. Third edn. Reading, Massachusetts: Addison-Wesley. Mackworth, A. (1977a). Consistency in networks of relations. Artificial intelligence, 8(1), 99–118. Mackworth, A. K. (1977b). On reading sketch maps. Pages 598–606 of: Proceedings of the international joint conference on artificial intelligence (IJCAI’77). Marriott, K., & Stuckey, P. (1998). Programming with constraints. Cambridge, Massachusetts: The MIT Press. Mohr, R., & Masini, G. (1988). Good old discrete relaxation. Pages 651–656 of: Kodratoff, Y. (ed), Proceedings of the 8th European Conference on Artificial Intelligence (ECAI). Pitman Publishers. 38 Krzysztof R. Apt and Eric Monfroy Montanari, U., & Rossi, F. (1991). Constraint relaxation may be perfect. Artificial intelligence, 48, 143–170. Muggleton, S., & de Raedt, L. (1994). Inductive logic programming: Theory and methods. Journal of logic programming, 19,20, 629–680. Muth, P. (1976). A nine-valued circuit model for test generation. IEEE Transactions on Computers, C-25(6), 630–636. Pedrycz, W., & Gomide, F. (1998). An introduction to fuzzy sets. Cambridge, Massachusetts: The MIT Press. Quinlan, J.R. (1993). C4.5: Programs for machine learning. San Francisco, CA: Morgan Kaufmann. Ringeissen, C., & Monfroy, E. (2000). Generating propagation rules for finite domains: a mixed approach. Pages 150–172 of: Apt, K. R., Kakas, A. C., Monfroy, E., & Rossi, F. (eds), New trends in constraints. Lecture Notes in Artificial Intelligence, vol. 1865. Springer-Verlag. Sabin, Daniel, & Freuder, E. 1994 (May). Contradicting conventional wisdom in constraint satisfaction. Borning, A. (ed), PPCP’94: Second workshop on principles and practice of constraint programming. Tsang, E. (1993). Foundations of constraint satisfaction. Academic Press. Ullman, J.D. (1988). Principles of database and knowledge-base systems, volume i. Principles of Computer Science Series. Computer Science Press. Van Hentenryck, P., Simonis, H., & Dincbas, M. (1992). Constraint satisfaction using constraint logic programming. Artificial intelligence, 58, 113–159. Waltz, D. L. (1975). Generating semantic descriptions from drawings of scenes with shadows. Pages 19–91 of: Winston, P. H. (ed), The psychology of computer vision. McGraw Hill. Winston, P.H. (1992). Artificial intelligence. Third edn. Reading, Massachusetts: AddisonWesley. Appendix Table 1 illustrates the generation of the equality rules and the membership rules for various natural constraints. The first column gives the name of the constraint, the second its arity, the third the cardinality of the domains of variables, and the fourth the cardinality of the constraint. The subsequent two columns show the outcome of the Equality Rule Generation algorithm: first the number of equality rules generated, and then the computation time in seconds; the last two columns provide this information for the membership rules. The fork, t, msign, allen, and fulladder constraints represent the previously described constraints. The noti and andi constraints, where i ∈ {3, 4, 6, 8, 9}, represent the usual not and and operators for multi-valued logics. The b10m constraint is the multiplication of digits from 0 to 9, i.e., b10m(X, Y, C, Z) stands for the constraint X ∗ Y = Z + 10 ∗ C defined over the intervals [0..9]. The “−” symbol means that we were unable to generate the rules in less than 24 hours. The constraints for multi-valued logics are presented in a way that shows the impact of the domain size and of the cardinality of the constraint in case of the same arity and a similar structure. In spite of its exponential running time, the Equality Rules Generation 39 Constraint Programming viewed as Rule-based Programming Constraint Arity Domain Size Cardinality Equality Rules Gen. (in s.) Member. Rules Gen. (in s.) f ork t 3 3 4 4 5 4 12 1 0.05 0.02 24 1 0.65 0.07 not not3 not4 not6 not8 not9 2 2 2 2 2 2 2 3 4 6 8 9 2 3 4 6 8 9 4 6 8 12 16 18 0.01 0.02 0.02 0.03 0.05 0.07 4 6 8 12 16 18 0.19 0.29 0.5 0.14 0.67 1.57 and and3 and4 and6 and8 and9 3 3 3 3 3 3 2 3 4 6 8 9 4 9 16 24 64 81 6 16 26 41 96 134 0.02 0.04 0.08 0.15 0.57 1.07 6 18 43 155 622 1294 0.08 0.13 0.6 14.35 351.16 1777 msign f ulladder b10m allen 3 5 4 3 4 2 10 13 16 8 100 409 34 52 362 498 0.08 0.29 14.83 31.16 54 52 − − 0.6 0.38 − − Table 1. Generation of equality and membership rules algorithm is still usable. On the other hand, the Membership Rules Generation algorithm is much more costly for larger problems. Sometimes it also generates too many rules for medium size problems (such as and9 ) and thus becomes unusable. In general, it is difficult to decide which notion of local consistency should be used to solve a given CSP. In particular (Sabin & Freuder, 1994) showed that in the case of CSP’s consisting of binary constraints maintaining full arc consistency during the backtracking search can be often more efficient than a more limited of constraint propagation embodied in the so-called forward checking. However, empirical results for CSP’s involving non-binary are missing and it is quite conceivable that for such CSP’s imposing full arc consistency during the backtracking search can be too costly. For these CSP’s a weaker form of constraint propagation, such as rule consistency, could be an alternative.
6cs.PL
This paper is accepted for presentation at IEEE International Conference on Acoustics, Speech and Signal Processing (IEEE ICASSP), 2018. GENERALIZATION OF DEEP NEURAL NETWORKS FOR CHEST PATHOLOGY CLASSIFICATION IN X-RAYS USING GENERATIVE ADVERSARIAL NETWORKS Hojjat Salehinejad?† , Shahrokh Valaee? , Tim Dowdell† , Errol Colak† , and Joseph Barfett† ? arXiv:1712.01636v2 [cs.CV] 12 Feb 2018 † Department of Electrical & Computer Engineering, University of Toronto, Toronto, Canada Department of Medical Imaging, St. Michael’s Hospital, University of Toronto, Toronto, Canada [email protected], [email protected], {dowdellt,colake,barfettj}@smh.ca ABSTRACT Medical datasets are often highly imbalanced with overrepresentation of common medical problems and a paucity of data from rare conditions. We propose simulation of pathology in images to overcome the above limitations. Using chest X-rays as a model medical image, we implement a generative adversarial network (GAN) to create artificial images based upon a modest sized labeled dataset. We employ a combination of real and artificial images to train a deep convolutional neural network (DCNN) to detect pathology across five classes of chest X-rays. Furthermore, we demonstrate that augmenting the original imbalanced dataset with GAN generated images improves performance of chest pathology classification using the proposed DCNN in comparison to the same DCNN trained with the original dataset alone. This improved performance is largely attributed to balancing of the dataset using GAN generated images, where image classes that are lacking in example images are preferentially augmented. Index Terms— Chest X-ray, data augmentation, deep convolutional neural network (DCNN), generative adversarial network (GAN), simulated images. 1. INTRODUCTION In the medical domain, preservation of patient privacy is paramount, and hence access to data is often intrinsically limited to research groups [1], [2]. Medical datasets, similar to financial [3] and genomics [4] datasets, are also very limited because they are often imbalanced [5]. Such imbalances in datasets potentially make the training of neural networks with equally high accuracy across classes technically challenging. Some medical problems are commonly encountered in hospital settings which leads to a substantial amount of data associated with them. However, rare conditions or syndromes such as Birt-Hogg-Dube syndrome are expected to have limited amounts of data in clinical databases [6]. The challenge of image availability across classes may be partially met by data augmentation techniques, for example, The authors thank the support of NVIDIA Corporation with the donation of the Titan X GPUs used for this project. applying transformations to images to augment the dataset. The importance of balancing datasets is highlighted by the fact that deep neural networks may be most valuable in the work up of rare or challenging diseases, which practitioners at a common skill level may fail to recognize or misinterpret [7]. Generative adversarial networks (GANs) have shown to effectively generate artificial data indiscernible from their real counterparts [8]. Some examples are statistical parametric speech synthesis [9], learning representations of emotional speech [10], noise reduction in low-dose computed tomography (CT) [11], and retinal image synthesis [12]. We propose the simulation of medical pathology in images as a means of augmenting data in a controlled fashion. Simulated data can be used to increase the number of images available and hence provide a means to balance datasets for the training of deep neural networks. An ideal data simulation scheme would be capable of generating an arbitrary number of synthetic images, which mimic the features of real images in any given class with sufficient diversity for the successful training of a deep network. In this manuscript, we propose the use of a deep convolutional generative adversarial network (DCGAN) for the generation of chest X-rays that mimic common chest pathologies. The synthetic images are used to balance and augment a labeled set of chest X-rays for the training of the proposed deep convolutional neural network (DCNN) across five pathological classes. 2. PROPOSED METHOD We propose a DCGAN tailored for training with chest Xrays as in Figure 1. The generated artificial chest X-rays are concatenated with the real X-rays to balance and expand the training dataset to train the proposed DCNN. This DCNN performs chest pathology classification as is demonstrated in Figure 2. These models are discussed in details below. 2.1. Generating Chest X-Rays GANs are composed of two neural networks, a Generator G and a Discriminator D, which compete with each other over the available training data to improve their performance. The Latent Random Variable z~pz(z) x x x or x x G 1x1 4x4x1024 256x256 Sigmoid Function Loss o y L (D,G) Real/Synthetic Decision D 128x128x32 8x8x512 16x16x256 64x64x64 32x32x128 Fig. 1: Architecture of the DCGAN and training it with real chest X-rays. where ŷ → 0 and ŷ → 1 state that the input chest X-ray is synthesized or real, respectively. The Generator network G trains so as to propose artificial images that the Discriminator network D(x) cannot distinguish from real images. The adversarial competition between G and D can be represented as Reshape & Projection 8x8x512 16x16x256 32x32x128 64x64x64 128x128x32 1x128 x x or x max-pooling 256x256 x x max-pooling max-pooling max-pooling Cardiomegaly Pneumothorax Edema Effusion Normal 1x5 56 x2 6 25 64x64x72 64x64x72 32x32x128 16x16x256 256x256x48 1x1024 1x4096 Deep Convolutional Neural Network MLP Fully Connected Layers Fig. 2: Architecture of the DCNN and its training with real and generated chest X-rays from DCGAN to classify abnormalities. min max L(D, G) = G DCGAN generates chest X-rays using DCNNs for both the G and D components of the model [13]. The trained G, models the underlying probability distribution pg of the training data for the set of exported chest X-rays x and proposes artificial mappings G(z, θg ) from the prior input noise variable pz (z), where θg is the set of learning parameters of the DCNN in the Generator. As demonstrated in Figure 1, a 128 dimensional vector z such that zi ∼ unif orm(−1, 1) is projected to a spatially extended convolutional representation with 1,024 feature maps. Since chest X-rays contain subtle features, high resolution images are mostly of interest for machine learning purposes in medical imaging. Therefore, a series of six fractionally-strided convolutions (instead of four convolutions [13]) convert the projected and reshaped noise vector z into a 256 × 256 pixel chest X-ray x̂. The Discriminator network D(x, θd ) receives a generated image x̂ or a real chest X-ray x and after passing that through six convolution layers, as presented in Figure 1, produces an output ô, stating whether the input image is real or synthesized such that 1 ŷ = s.t. ŷ ∈ [0, 1] (1) 1 + e−ô 4x4x1024 Generated Images 256x256 Generated Images 1x128 32x32x128 64x64x64 128x128x32 Trained Generator Network G(z) Real Images Reshape & Projection 8x8x512 16x16x256 Real Images Latent Random Variable z~pz(z) 4x4x1024 Backpropagatoin to min max L (D,G) Discriminator Network D(x) Generator Network G(z) D E (x)[logD(x)] + x∼pdata E [log(1 − D(G(z)))] z∼pz (z) (2) where the Discriminator maximizes the loss value L(D, G) while the Generator tries to minimize it. To train D, G works in a feed forward fashion without back propagation, and vice versa to train G [14]. 2.2. Classification of Chest X-Rays The trained Generator of the discussed DCGAN is used to generate artificial chest X-rays as demonstrated in Figure 2. The shuffled concatenation of real and synthesized chest Xrays is then fed into the proposed DCNN for detection and classification of pathology in chest X-rays. AlexNet is a successful DCNN architecture that is composed of five convolutional layers for feature extraction followed by three fully-connected layers for classification [15]. The proposed DCNN for chest pathology classification in this paper is fundamentally similar to AlexNet, however, uses different kernel sizes, feature map sizes, and convolution layers as illustrated in Figure 2. For an input chest X-ray x256×256 , a convolution kernel of size 5 × 5 performs the convolution operation to generate the feature map m as 4 X 4 X (m) h(m) = σ( xi,j · wi,j + b(m) u,v u,v ), (3) i=0 j=0 for u ∈ {0, ..., 255} and v ∈ {0, ..., 255}, where σ(·) is the rectified linear unit (ReLU) activation function, b(m) is the bias vector, and w(m) is the weight matrix. The ReLU is (a) (b) (c) (d) (e) (f) (g) (h) (i) (j) Fig. 3: Samples of real (R) and synthesized (S) chest X-rays: (a) Pulmonary Edema-R; (b) Pulmonary Edema-S; (c) Normal-R; (d) Normal-S; (e) Pneumothorax-R; (f) Pneumothorax-S; (g) Cardiomegaly-R; (h) Cardiomegaly-S; (i) Pleural Effusion-R; (j) Pleural Effusion-S. The white arrow points to the pathologic condition. defined as f (x) = max(0, x), which takes advantage of its non-saturating and non-linear properties as well as the tendency to enable more efficient learning than tanh or sigmoid activation functions [15]. A max-pooling layer after the convolution layer down-samples the latent representation by a constant factor, usually taking the maximum value over nonoverlapping sub-regions such as Oi,j = max{h(m) (4) q,r }, PNG files after down-sampling to 256×256 pixels to have a balance between preserving resolution and computational complexity (i.e. number of free parameters) of the models. For all the experiments, 1,000 real chest X-rays with equal contribution from each class are selected for validation and the same number for testing of the model. for q, r ∈ {(2i, 2j), (2i+1, 2j), (2i, 2j +1), (2i+1, 2j +1)}, where the max-pooling kernel is a square with side length of L = 2. This operation helps to obtain translation-invariant representations. The max-pooled features, after the multiple convolutional and max-pooling layers, are reshaped as a vector, f, and are fed to a multi-layer perceptron (MLP) network with one hidden layer as illustrated in Figure 2. The output layer of MLP for the input vector f is A team of radiologists removed inappropriate generated chest X-rays from the respective class directories and in order to keep the training dataset balanced across different classes, the DCGAN was trained with a dataset of 2,000 chest X-rays per class. The parameters of the models were as follows: the mini-batch size was 64, the number of training iterations was 20, an Adam optimizer was implemented with adaptive learning rate, starting between 2×10−4 and 2×10−3 depending on the dataset size, and momentum of 0.5. The proposed DCNN for pathology classification was trained over 100 iterations using a mini-batch size of 128, an Adam optimizer with sigmoid decay adaptive learning rate starting at 1 × 10−3 and a momentum term of 0.5. The weights of the convolutional layers were selected using a normal distribution and biases of 0.1. The ReLU activation functions were implemented before the max-pooling layers. L2 regularization was set to 1 × 10−4 with early-stopping. Cross validation was performed 10 times prior to reporting results. |f|−1 yc = φ( X fj · wj,c + bc ) (5) j=0 where |f| = 4, 096 is the length of vector f and w is the weight of connections between the layers containing f and the output layer y. The softmax function φ(·) assigns a probability to each output unit, which corresponds to each class c, such as ehc (6) φ(hc ) = PP hj j=1 e where c ∈ {Pneumothorax, Pulmonary Edema, Pleural Effusion, Normal, Cardiomegaly}, hc is the input to the output layer, and C = 5 is the number of chest X-ray classes [16]. 3. EXPERIMENTS We discuss the details of implementation and our obtained results in this section. 3.2. Technical Details of Training 3.3. Performance Evaluation Generated images were evaluated by qualitative and quantitative means. First, a board certified radiologist reviewed the images for features appropriate to the five defined classes. Second, the proportion of real and artificial chest X-rays were varied to create concatenated datasets and the results of the trained DCNN model were assessed on the test data. 3.1. Data With the approval from our institutional ethics review board, search of our hospital’s Radiology Information System (RIS) was undertaken using the Montage Search and Analytics engine. The dataset contained 15,781 Normal exams, 17,098 examples of Cardiomegaly, 14,510 Pleural Effusions, 5,018 examples of Pulmonary Edema, and 4,013 examples of Pneumothorax. These images were exported and anonymized as 3.3.1. Qualitative Evaluation by a Radiologist Real and artificial images were presented to a radiologist as shown in Figure 3 and were visually examined. The artificial and real chest X-rays show similar characteristics, though the synthetic ones are of comparatively low resolution. For example in Figure 3 we demonstrate increased attenuation of the lung parenchyma in an example of pulmonary edema, a 30000 Real Imbalanced Dataset Real Balanced Dataset GAN Contribution to Balance the Imbalanced Real Dataset 15098 16415 17686 27178 28183 20000 15000 Accuracy (%) 15098 13781 10000 5000 2013 0 2013 Cardiomegaly Normal 2013 3018 2013 20132013 Effusion Edema Pneumothorax Chest X-ray Labels Fig. 4: Number of samples for imbalanced dataset of real chest Xrays, balanced dataset of real chest X-rays, and balanced dataset of real chest X-rays using DCGAN synthesized chest X-rays. The total number of chest X-rays per label in the balanced dataset is the summation of corresponding blue and orange bars (i.e. 30,196). pleural line in the case of pneumothorax, an enlarged cardiac silhouette in the case of cardiomegaly, as well as bilateral pleural effusions. The generated images convincingly demonstrate the range of pathology under examination and can be classified for the training of a deep neural network. 3.3.2. Chest Pathology with DCGAN Generated X-Rays Deep neural networks trained with a combination of real and artificial data have potential advantage over networks trained with real data alone, including a larger quantity of data as well as a better diversified dataset. Our original hospital dataset of chest X-rays, like many clinical datasets, is highly imbalanced and dominated by normal cases and common clinical conditions. Rare conditions by virtue of their low prevalence are underrepresented in such datasets. We trained the proposed DCNN using a real imbalanced dataset (DS1), real balanced dataset (DS2), and augmented dataset with DCGAN synthesized chest X-rays to balance the imbalanced real dataset (DS3). As Figure 4 shows, each image class in the balanced dataset had 30,196 samples, which was twice the maximum number of available samples in the real imbalanced dataset (i.e. for Cardiomegaly). The accuracy of predictions for the DCNN is presented in Table 1. The augmented dataset DS3 outperforms the original dataset across all classes. A mean classification accuracy of 92.10% was achieved using the proposed method, where data was augmented by DCGAN generated images to train the proposed DCNN. This performance is more than 20% higher than that obtained by the same DCNN architecture trained only by the original data. The greatest performance improvement was seen in the pneumothorax class, which was the class with the fewest native images. Accuracy and standard deviation of the proposed DCNN on the validation dataset for training iterations over DS1, DS1 DS2 DS3 Cardiomegaly 79.15 71.73 95.31 Normal 77.75 72.53 95.02 Pleural Effusion 73.64 51.23 91.19 Pulmonary Edema 65.86 50.12 89.68 Pneumothorax 57.99 48.92 88.84 Total 70.87±0.47 58.90±0.48 92.10±0.41 12510 100 Chest Pathology Classification Accuracy(%) Number of Chest X-rays 25000 Table 1: Classification accuracy of the DCNN is improved by balancing the original dataset with DCGAN generated chest X-rays. DS1: Imbalanced dataset of real radiographs; DS2: Balanced dataset of real X-rays; DS3: Balanced dataset of real images with synthesized X-rays. 90 80 70 60 50 Real Imbalanced Dataset (DS1) Real Balanced Dataset (DS2) DCGAN Synthesized+Imbalanced Real Dataset (DS3) 40 30 0 20 40 Iteration 60 80 100 Fig. 5: Accuracy (solid line) and standard deviation (shaded region) of the DCNN on the validation dataset during training iterations over the DS1, DS2, and DS3 datasets. DS2, and DS3 datasets are presented in Figure 5. The DCNN trained with DS3 has achieved higher accuracy comparing with the DS1 and DS2. The plot show that the DCNN trained on DS3 has almost converged after 90 iterations. The same DCNN trained on DS1 and DS2 is overfitted after 22 and 31 iterations, respectively, to a lower accuracy. The plot clearly shows effectiveness of the added diversity to the dataset by the generated chest X-rays using the DCGAN, which helps to improve generalization performance of the DCNN for chest pathology classification in X-rays and avoid over-fitting. 4. CONCLUSION In this paper, we have shown that artificial data generated by DCGAN can augment real datasets to provide both a greater quantity of data for training of large neural networks and can balance the dataset, resulting in substantial improvement in classification performance in the most anemic classes. We obtained best results with a combination of real and artificial data used to train the DCNN. The reported results in this paper suggest that data augmentation using synthesized images increases the diversity of training dataset and therefore, improves generalization performance of deep learning for classification of unseen data. 5. REFERENCES [1] Elisa Bertino, Beng Chin Ooi, Yanjiang Yang, and Robert H Deng, “Privacy and ownership preserving of outsourced medical data,” in Data Engineering, 2005. ICDE 2005. Proceedings. 21st International Conference on. IEEE, 2005, pp. 521–532. [2] Hojjat Salehinejad, Shahrokh Valaee, Tim Dowdell, and Joseph Barfett, “Image augmentation using radial transform for training deep neural networks,” in Acoustics, Speech and Signal Processing (ICASSP), 2018 IEEE International Conference on. IEEE, 2018. [3] Hojjat Salehinejad and Shahryar Rahnamayan, “Customer shopping pattern prediction: A recurrent neural network approach,” in Computational Intelligence (SSCI), 2016 IEEE Symposium Series on. IEEE, 2016, pp. 1–6. [4] Farhad Pouladi, Hojjat Salehinejad, and Amir Mohammad Gilani, “Recurrent neural networks for sequential phenotype prediction in genomics,” in Developments of E-Systems Engineering (DeSE), 2015 International Conference on. IEEE, 2015, pp. 225–230. [5] Der-Chiang Li, Chiao-Wen Liu, and Susan C Hu, “A learning method for the class imbalance problem with medical data sets,” Computers in biology and medicine, vol. 40, no. 5, pp. 509–518, 2010. [6] Michael L Nickerson, Michelle B Warren, Jorge R Toro, Vera Matrosova, Gladys Glenn, Maria L Turner, Paul Duray, Maria Merino, Peter Choyke, Christian P Pavlovich, et al., “Mutations in a novel gene lead to kidney tumors, lung wall defects, and benign tumors of the hair follicle in patients with the birt-hogg-dube syndrome,” Cancer cell, vol. 2, no. 2, pp. 157–164, 2002. [7] Maciej A Mazurowski, Piotr A Habas, Jacek M Zurada, Joseph Y Lo, Jay A Baker, and Georgia D Tourassi, “Training neural network classifiers for medical decision making: The effects of imbalanced datasets on classification performance,” Neural networks, vol. 21, no. 2, pp. 427–436, 2008. [8] Weixuan Tang, Shunquan Tan, Bin Li, and Jiwu Huang, “Automatic steganographic distortion learning using a generative adversarial network,” IEEE Signal Processing Letters, vol. 24, no. 10, pp. 1547–1551, 2017. [9] Takuhiro Kaneko, Hirokazu Kameoka, Nobukatsu Hojo, Yusuke Ijima, Kaoru Hiramatsu, and Kunio Kashino, “Generative adversarial network-based postfilter for statistical parametric speech synthesis,” in Proc. 2017 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP2017), 2017, pp. 4910– 4914. [10] J. Chang and S. Scherer, “Learning representations of emotional speech with deep convolutional generative adversarial networks,” in 2017 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2017, pp. 2746–2750. [11] Jelmer M Wolterink, Tim Leiner, Max A Viergever, and Ivana Isgum, “Generative adversarial networks for noise reduction in low-dose ct,” IEEE Transactions on Medical Imaging, 2017. [12] Pedro Costa, Adrian Galdran, Maria Ines Meyer, Meindert Niemeijer, Michael Abràmoff, Ana Maria Mendonça, and Aurélio Campilho, “End-to-end adversarial retinal image synthesis,” IEEE Transactions on Medical Imaging, 2017. [13] Alec Radford, Luke Metz, and Soumith Chintala, “Unsupervised representation learning with deep convolutional generative adversarial networks,” arXiv preprint arXiv:1511.06434, 2015. [14] Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio, “Generative adversarial nets,” in Advances in neural information processing systems, 2014, pp. 2672–2680. [15] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton, “Imagenet classification with deep convolutional neural networks,” in Advances in neural information processing systems, 2012, pp. 1097–1105. [16] Mark Cicero, Alexander Bilbily, Errol Colak, Tim Dowdell, Bruce Gray, Kuhan Perampaladas, and Joseph Barfett, “Training and validating a deep convolutional neural network for computer-aided detection and classification of abnormalities on frontal chest radiographs,” Investigative radiology, vol. 52, no. 5, pp. 281–287, 2017.
1cs.CV
VARIATIONS ON BARBĂLAT’S LEMMA arXiv:1411.1611v3 [math.OC] 4 Mar 2016 BÁLINT FARKAS 1, a AND SVEN-AKE WEGNER 2 Abstract. It is not hard to prove that a uniformly continuous real function, whose integral up to infinity exists, vanishes at infinity, and it is probably little known that this statement runs under the name “Barbălat’s Lemma.” In fact, the latter name is frequently used in control theory, where the lemma is used to obtain Lyapunov-like stability theorems for non-linear and non-autonomous systems. Barbălat’s Lemma is qualitative in the sense that it asserts that a function has certain properties, here convergence to zero. Such qualitative statements can typically be proved by “soft analysis”, such as indirect proofs. Indeed, in the original 1959 paper by Barbălat, the lemma was proved by contradiction and this proof prevails in the control theory textbooks. In this short note we first give a direct, “hard analyis” proof of the lemma, yielding quantitative results, i.e. rates of convergence to zero. This proof allows also for immediate generalizations. Finally, we unify three different versions which recently appeared and discuss their relation to the original lemma. 1. Direct proof of Barbălat’s Lemma In 1959, Barbălat formalized the intuitive principle that a function whose integral up to infinity exists, and whose oscillation is bounded, needs to be small at infinity. Theorem 1. (Barbălat’s Lemma [1, p. 269]) Suppose that f : [0, ∞) → R is uniformly continuous Rt and that limt→∞ 0 f (τ )dτ exists. Then limt→∞ f (t) = 0 holds. Barbălat’s original proof, as well as its reproductions in textbooks, e.g., Khalil [5, p. 192], Popov [6, p. 211] and Slotine, Li [9, p. 124], are by contradiction. Our first aim in this note is to give a direct proof of Theorem 1 which also reveals the essence of the statement and enables us to generalize Barbălat’s Lemma to vector valued functions without difficulty. This is based on the following two lemmas. Lemma R s2. Let f : [0, ∞) → R be a continuous function. We define S : [0, ∞) → R via S(t) := sups>t t f (τ )dτ and put ω(a, b, δ) := sup{|f (x)−f (y)| | x, y ∈ (a, b) with |x−y| 6 δ} for a < b 6 ∞ and δ > 0. Then |f (t)| 6 S(t)1/2 + ω(t, t + S(t)1/2 , S(t)1/2 ) holds for t > 0. Proof. Fix t > 0. If S(t) = 0, then f (t) = 0 and the assertion follows immediately. Also, if S(t) = ∞, then there is nothing to prove. Suppose therefore 0 < S(t) < ∞, put s = S(t)1/2 > 0, and compute |f (t)| = 6 6 Z 1 t+s f (t)dτ s t Z Z  1 t+s 1 t+s f (t) − f (τ ) dτ f (τ )dτ + s t s t Z 1 t+s f (τ )dτ + ω(t, t + s, s) s t 2010 Mathematics Subject Classification: Primary 26A06, Secondary 26A12, 26A16, 26A42, 46E39. Key words and phrases: Barbălat’s Lemma, Hölder continuous functions, Sobolev spaces. 1 Bergische Universität Wuppertal, FB C – Mathematik, Gaußstraße 20, 42119 Wuppertal, Germany, Phone: +49 (0) 202 / 439 - 2673, Fax: +49 (0) 202 / 439 - 3724, E-Mail: [email protected]. 2 Nazarbayev University, Department of Mathematics, School of Science and Technology, 53 Kabanbay Batyr Ave, 010000 Astana, Kazakhstan, Phone: +7 (8) 7172 / 69 - 4671, E-Mail: [email protected]. a Bálint Farkas was supported by the Hungarian Research Fund (OTKA 100461). 1 6 = 1 S(t) + ω(t, t + s, s) s S(t)1/2 + ω(t, t + S(t)1/2 , S(t)1/2 ) as desired.  We recall that given a uniformly continuous function f : [0, ∞) → R, a function ω : [0, ∞) → R is said to be a modulus of continuity for f if limt→0 ω(t) = ω(0) = 0 and |f (t) − f (τ )| 6 ω(|t − τ |) for all t, τ ∈ [0, ∞). Lemma 3. Let f : [0, ∞) R s→ R be uniformly continuous and let ω be a modulus of continuity for f . Consider S(t) = sups>t | t f (τ )dτ |. Then we have |f (t)| 6 S(t)1/2 + ω(S(t)1/2 ) for all t > 0. Proof. Let f and ω be given. We define ω(t) := ω(0, ∞, t), where ω(0, ∞, ·) is the function defined in Lemma 2. Then, ω(t) 6 ω(t) holds for all t > 0. Since ω(a, b, t) 6 ω(0, ∞, t) holds for all a < b 6 ∞, we can use Lemma 2 to obtain |f (t)| 6 S(t)1/2 + ω(t, t + S(t)1/2 , S(t)1/2 ) 6 S(t)1/2 + ω(S(t)1/2 ) 6 S(t)1/2 + ω(S(t)1/2 ) as desired.  We now give the direct proof of Barbălat’s Lemma. Proof of Theorem 1. Let f be uniformly continuous and ω be a modulus of continuity for f . By the Cauchy criterion for indefinite integrals, we obtain (with a direct proof!) that S(t) → 0 for t → ∞. Therefore, Lemma 3 yields |f (t)| 6 S(t)1/2 + ω(S(t)1/2 ) → 0 for t → ∞.  Since Lemmas 2 and 3 remain true for functions with values in a Banach space E (the proofs are verbatim the same), we immediately obtain the next generalization. Theorem 4. Let E be a Banach space and suppose that f : [0, ∞) → E is uniformly continuous such Rt  that limt→∞ 0 f (τ )dτ exists. Then limt→∞ f (t) = 0 holds. 2. Barbălat’s Lemma in a different context We pointed out that all proofs of Barbălat’s Lemma given in the relevant textbooks are indirect. On the other hand, there appeared recently several “alternative versions” in the literature whose proofs, or hints for a proof, are based on direct estimates. Tao [7, Lemma 1] states that limt→∞ f (t) = 0 holds, whenever f ∈ L2 (0, ∞) and f ′ ∈ L∞ (0, ∞). Desoer and Vidyasagar [3, Ex. 1 on p. 237] indicate that it is enough to require that f and f ′ are in L2 (0, ∞) and Teel [8, Fact 4] notes that in the latter the Lebesgue exponent 2 can be replaced by p ∈ [1, ∞). Here, f ′ can be interpreted in the sense of distributions or, equivalently, in the sense that f is absolutely continuous with the almost everywhere existing derivative being essentially bounded. Indeed, the three results extend the classical statement, that for 1 6 p < ∞ all functions in the Sobolev space W 1,p (0, ∞) tend to zero for t → ∞ (see, e.g., Brezis [2, Corollary 8.9]) to the “mixed Sobolev space”  W 1,p,q (0, ∞) = f | f ∈ Lp (0, ∞) and f ′ ∈ Lq (0, ∞) for p = 2, q = ∞, and p = q ∈ [1, ∞), respectively. Our first aim in this section is to prove the following common generalization of the results of Tao [7], Desoer and Vidyasagar [3], and Teel [8]. Theorem 5. Let p ∈ [1, ∞) and q ∈ (1, ∞]. Every function f ∈ W 1,p,q (0, ∞) tends to zero at infinity. Notice, that our proof below shows that all three alternatives are immediate consequences of the original Barbălat Lemma. The latter cannot be applied a priori, but in view of the following lemma. Lemma 6. Let p ∈ [1, ∞) and q ∈ (1, ∞] be arbitrary. A function f ∈ W 1,p,q (0, ∞) is bounded and uniformly continuous. More precisely, f is q−1 q -Hölder continuous if q < ∞ and Lipschitz-continuous if q = ∞. 2 Proof. For the proof let q ′ ∈ [1, ∞) be such that 1/q ′ + 1/q = 1 holds, where we use the convention 1/∞ = 0. In particular, we read (q − 1)/q = 1/q ′ = 1 if q = ∞. By our assumptions we have Z y f ′ (s)ds f (y) − f (x) = x for almost every x, y ∈ [0, ∞). Thus, f can be identified with a continuous function satisfying Z y ′ |f (x) − f (y)| 6 f ′ (s)ds 6 |x − y|1/q kf ′ kq . x Here we used Hölder’s inequality for q, q ′ with 1/q + 1/q ′ = 1, so that f is indeed Hölder continuous with exponent 1/q ′ = (q − 1)/q. Let r := p(q − 1)/q. Then we have r > 0 and r+1 d dx |f (x)| holds. For x ∈ [0, ∞) we thus obtain Z r+1 r+1 |f (x)| = |f (0)| + (r + 1) x 0 = (r + 1)|f (x)|r−1 f (x)f ′ (x) |f (x)|r−1 f (x)f ′ (x) ds 6 |f (0)|r+1 + (r + 1)kf krp · kf ′ kq , where the last step is again an application of Hölder’s inequality for q, q ′ with 1/q + 1/q ′ = 1.  Lemma 6 enables us to employ the original Barbălat Lemma to prove Theorem 5. Proof of Theorem 5. By Lemma 6 the function f is bounded and uniformly continuous, hence so is |f |p . Indeed, we have by the mean-value theorem |f (x)|p − |f (y)|p ≤ sup |t|6kf k∞ p|t|p−1 · |f (x) − f (y)| = pkf kp−1 ∞ |f (x) − f (y)|. (1) This inequality implies the asserted uniform continuity of |f |p . By assumption, we can apply Barbălat’s Lemma and obtain the statement.  Tao’s formulation [7, 3rd paragraph on p. 698] might erroneously establish the impression that his alternative [7, Lemma 1] uses a weaker assumption than Barbălat’s Lemma, but has the same conclusion. Our second aim in this section is to illustrate that this is not the case. The following example of a function which satisfies the assumptions of Barbălat’s Lemma, but not those of [7, Lemma 1] combines two effects. The difference between Lebesgue and improper Riemann integral on the one hand, and that between uniform continuity and having a bounded derivative on the other. Example 7. Let f (x) = 0 for x ∈ [0, 2) and f (x) = (−1)n fn (x) for x ∈ [n, n + 1) with n > 2 and  1 1  x ∈ [n, n + 21 n− 3 ),  (x − n) 2 , 1 1 1 1 fn (x) = (n + n− 3 − x) 2 , x ∈ [n + 12 n− 3 , n + n− 3 ),  1  0, x ∈ [n + n− 3 , n + 1), i.e., f looks as follows. 0 2 4 6 8 10 √ P Rt n √1 Straightforward computations show that limt→∞ 0 f (τ )dτ = 32 ∞ exists and that f is n=2 (−1) n 2 ′ ∞ uniformly continuous. On the other hand f 6∈ L (0, ∞) and f 6∈ L (a, ∞) for any a > 0. For given 1 6 p < ∞, the function f in Example 7 can easily be modified such that f 6∈ Lp (a, ∞) holds. With some additional work, it is also possible to construct a single f such that f 6∈ Lp (a, ∞) is true for all 1 6 p < ∞. Finally, in all these cases f can also be changed into a C ∞ –function; 3 |f ′ | is then bounded on any finite interval, but unbounded at infinity. Thus, for every p ∈ [1, ∞) and q ∈ (1, ∞] there is a function f to which Barbălat’s Lemma can be applied, but which fails the assumptions of Theorem 5. Concerning the other direction, it is easy to construct a function f that satisfies the condition R ∞ of [7, Lemma 1], i.e., f ∈ L2 (0, ∞) and f ′ ∈ L∞ (0, ∞), but whose improper Riemann integral 0 f (t)dt does not exist. Thus, Tao’s alternative is incomparable with the original Barbălat Lemma. The same is true for the statement of Theorem 5 whenever p 6= 1. Only in the case p = 1, Theorem 5 is a special case of Barbălat. Let f ∈ W 1,1,q with q ∈ (1, ∞]. By Lemma 3, f is uniformly R ∞ continuous and bounded. Therefore, f ∈ L1 (0, ∞) implies that the improper Riemann integral 0 f (t)dt exists. 3. Rates of convergence In this section we use the methods of Section 1 to derive estimates for the speed of decay in the previous versions of Barbălat’s Lemma so as to make the statement quantitative. We start with a modification of Theorem 1. Rt Theorem 8. Suppose that for f : [0, ∞) → R the limit limt→∞ 0 f (τ )dτ exists, and that f is Hölder continuous of order α ∈ (0, 1], i.e., ω(τ ) = cτ α is a modulus of continuity for a constant c > 0. Then Rs we have |f (t)| 6 (1 + c)S(t)α/(1+α) for t > 0, where S(t) = sups>t | t f (τ )dτ |. Proof. It is enough to repeat the proof of Lemmas 2 and 6 but with s = S(t)1/(1+α) .  Next, we specialize to the situation of Theorem 5. Corollary 9. Let f ∈ W 1,p,q (0, ∞) for some p ∈ [1, ∞) and ∞]. Then we have |f (t)|p 6 R ∞ q ∈ (1, p p−1 ′ (q−1)/(2q−1) (1 + pkf k∞ kf kq )S(t) for t > 0, where S(t) = t |f (τ )| dτ . Proof. By Lemma 6, under our assumptions, f is bounded, and τ 7→ kf ′ kq τ (q−1)/q is a modulus of continuity for f . As in equation (1) in the proof of Theorem 5, we conclude that ω(τ ) = ′ (q−1)/q is a modulus of continuity of |f |p . It is therefore enough to apply Theorem pkf kp−1 ∞ kf kq τ 8 to the latter function and to α = (q − 1)/q to obtain the assertion, because then α/(1 + α) = (q − 1)/(2q − 1).  We point out that Corollary 9 contains the quantitative versions of the results of Tao [7, Lemma 1], Desoer and Vidyasagar [3, Ex. 1 on p. 237], and Teel [8, Fact 4]. We finish this short note by illustrating how Barbălat’s Lemma, and its variations are typically used in the control theoretic literature, for instance, to obtain (asymptotic) stability of solutions of ordinary differential equations. The next example is taken from Hou, Duan, Guo [4, Example 3.1]. Example 10. Consider the system ( ė(t) = −e(t) + θ(t)ω(t), θ̇(t) = −e(t)ω(t), with ω bounded and continuous. For some solution (e, θ) of this equation we define V = e2 + θ2 and compute V̇ (t) = −2e2 (t) 6 0 for every t > 0. Thus, V and therefore e and θ are bounded. We put f := 2e2 and in view of the positivity of V and f we obtain Z R f (t)dt = 0 Z R −V̇ (t)dt = −V (R) + V (0) 6 V (0), 0 so that f ∈ L1 (0, ∞). Since f˙(t) = 4ė(t)e(t) = −4e(t)2 + 4θ(t)e(t)ω(t) holds and θ, e, ω are bounded, we conclude f˙ ∈ L∞ (0, ∞). That is f ∈ W 1,1,∞ (0, ∞) and by Theorem 5 it follows f (t) → 0 for t → ∞. From the definition of f we finally obtain that also e(t) → 0 for t → ∞. Acknowledgements. The authors would like to thank the referees and the editor for their careful work and their valuable comments. 4 References 1. I. Barbălat, Systèmes d’équations différentielles d’oscillations non Linéaires, Rev. Math. Pures Appl. 4 (1959), 267– 270. 2. H. Brezis, Functional Analysis, Sobolev Spaces and Partial Differential Equations, Springer-Verlag, New York, 2011. 3. C. A. Desoer and M. Vidyasagar, Feedback Systems: Input-Output Properties, Academic Press, New York-London, 1975. 4. M. Hou, G. Duan and M. Guo, New versions of Barbălat’s lemma with Applications, J. Control Theory Appl. 8 (2010) no. 4, 545–547. 5. H. K. Khalil, Nonlinear Systems, Macmillan Publishing Company, New York, 1992. 6. V. M. Popov, Hyperstability of Control Systems, Springer-Verlag, New York, 1973. 7. G. Tao, A simple alternative to the Barbălat Lemma, IEEE Trans. Automat. Control 42 (1997) no. 5, 698. 8. A. R. Teel, Asymptotic convergence from Lp Stability, IEEE Trans. Automat. Control 44 (1999) no. 11, 2169–2170. 9. J.-J. E. Slotine and W. Li, Applied Nonlinear Control, Englewood Cliffs, New Jersey, 1991. 5
3cs.SY
UNIVERSAL LOCALLY FINITE MAXIMALLY HOMOGENEOUS SEMIGROUPS AND INVERSE SEMIGROUPS arXiv:1704.00641v4 [math.GR] 22 Nov 2017 IGOR DOLINKA AND ROBERT D. GRAY Abstract. In 1959, P. Hall introduced the locally finite group U, today known as Hall’s universal group. This group is countable, universal, simple, and any two finite isomorphic subgroups are conjugate in U. It can be explicitly described as a direct limit of finite symmetric groups. It is homogeneous in the model-theoretic sense since it is the Fraı̈ssé limit of the class of all finite groups. Since its introduction Hall’s group, and several natural generalisations, have been widely studied. In this article we use a generalisation of Fraı̈ssé’s theory to construct a countable, universal, locally finite semigroup T , that arises as a direct limit of finite full transformation semigroups, and has the highest possible degree of homogeneity. We prove that it is unique up to isomorphism among semigroups satisfying these properties. We prove an analogous result for inverse semigroups, constructing a maximally homogeneous universal locally finite inverse semigroup I which is a direct limit of finite symmetric inverse semigroups (semigroups of partial bijections). The semigroups T and I are the natural counterparts of Hall’s universal group for semigroups and inverse semigroups, respectively. While these semigroups are not homogeneous, they still exhibit a great deal of symmetry. We study the structural features of these semigroups and locate several well-known homogeneous structures within them, such as the countable generic semilattice, the countable random bipartite graph, and Hall’s group itself. 1. Introduction In his beautiful 1959 paper [15] Philip Hall proved that there is a unique countable universal locally finite homogeneous group U . Here universal means that every finite group arises as a subgroup of U , and the word homogeneous is in the sense of Fraı̈ssé (see [23, Chapter 6]), and means that in Hall’s universal group any isomorphism between finite subgroups extends to an automorphism of U . Indeed, the class of finite groups forms an amalgamation class and Hall’s group is the unique Fraı̈ssé limit of this class. In addition to proving the existence of this group, Hall showed that U has many interesting properties including: • It may be obtained concretely as a direct limit of symmetric groups by repeated applications of Cayley’s Theorem in the following way. Take any group G0 of order at least three. Then Cayley’s Theorem can be applied to embed G0 as a subgroup of the symmetric group G1 = SG0 . This process can then be repeated, embedding G1 into the symmetric group G2 = SG1 and so on. • Any two isomorphic finite subgroups of U are conjugate in U . In fact, any isomorphism between finite subgroups of U is induced by an inner automorphism. • For any m > 1 the set of all elements of order m forms a single conjugacy class, and every element of U can be written as a product of two elements of order m. This implies that U is a simple group. • It contains 2ℵ0 distinct copies of each countable locally finite group. In their book [29, Chapter 6] Kegel and Wehrfritz remark that a universal locally finite group is in some sense a universe in which to do finite group theory. Hall’s group is both a direct limit of symmetric groups, and a universal locally finite simple group. It thus provides an example of central importance in the theory of infinite locally finite 2010 Mathematics Subject Classification. 20M20, 20M10, 03C07, 20F50. Key words and phrases. Hall’s universal countable homogeneous group, homogeneous structures, maximally homogeneous semigroup, amalgamation. 1 2 IGOR DOLINKA AND ROBERT D. GRAY groups; see [21, 29]. Other related work on locally finite simple groups, and direct limits of symmetric groups, may be found in [22, 30, 32, 40]. Sylow subgroups of Hall’s group were investigated in [6]. The Grothendieck group of finitely generated projective modules over the complex group algebra of Hall’s group was considered in [7]. More recently Hall’s group has arisen in work relating to the Urysohn space [2, 8]. In [8] it is shown that there exists a universal action of Hall’s locally finite group on the Urysohn space U by isometries. Hall’s group appears as an example in the work of Samet [38] on rigid actions of amenable groups, and in the topological Galois theory developed in [3]. Interesting new results on the automorphism group of U have been obtained in very recent work of Paolini and Shelah [36]. The work of the present article begins with a question posed by Manfred Droste at the international conference “The 83rd Workshop on General Algebra (AAA83)”, Novi Sad, Serbia, March 2012, who asked whether there is an analogue of Hall’s universal group for semigroups. The analogue of the symmetric group in semigroup theory is the full transformation semigroup Tn of all maps from an n-element set to itself under composition. One would expect, therefore, the correct semigroup-theoretic analogue of Hall’s group to be a limit of finite full transformation semigroups. By Cayley’s Theorem for semigroups (see [26, Theorem 1.1.2]) every finite semigroup is a subsemigroup of some Tn , hence any infinite limit of finite full transformation semigroups will be universal and locally finite. On the other hand such a semigroup cannot be homogeneous. In fact by Fraı̈ssé’s Theorem, no countable universal locally finite semigroup can be homogeneous since the class of finite semigroups does not form an amalgamation class [5, Section 9.4]. This leads naturally to the question of how homogeneous a countable universal locally finite semigroup can be. As we shall see, there is a well-defined notion of the maximal amount of homogeneity that such a semigroup can possess. We call such semigroups maximally homogeneous. In more detail, if S is a semigroup and T is a subsemigroup of S, we say that Aut(S) acts homogeneously on copies of T if for any subsemigroups T1 , T2 ≤ S, if T1 ∼ =T ∼ = T2 then every isomorphism φ : T1 → T2 extends to an automorphism of S. For fixed S we can consider the class C(S) of isomorphism types of finite semigroups T on which Aut(S) acts homogeneously. The class C(S) provides a measure of the level of homogeneity of S. As S ranges over all countable universal locally finite semigroups, the classes C(S) form a partially ordered set under inclusion, which (as we shall see in Proposition 3.1 and Theorem 3.3) has a maximum element B. A countable universal locally finite semigroup S is said to be maximally homogeneous if C(S) = B. We shall prove that, up to isomorphism, there is a unique countable universal locally finite semigroup T , which is a limit of finite full transformation semigroups, and is maximally homogeneous. For inverse semigroups, the analogue of the symmetric group is the symmetric inverse semigroup In of all partial bijections from an n-element set to itself under composition of partial maps (see [31] for a general introduction to inverse semigroup theory). As for the case of semigroups, there is a well-defined notion of maximally homogeneous universal locally finite inverse semigroup. We shall prove that there is a unique countable universal locally finite inverse semigroup I, which is a limit of symmetric inverse semigroups, and is maximally homogeneous. The semigroups T and I are the natural counterparts of Hall’s universal group for semigroups and inverse semigroups, respectively. While these semigroups are not homogeneous, they exhibit a great deal of symmetry and richness in their algebraic and combinatorial structure. Since they are not homogeneous they cannot be constructed using Fraı̈ssé’s Theorem. We instead make use of a well-known generalisation of Fraı̈ssé’s theory called the Hrushovski construction which, among other things, was used as the basis of the construction of some important counterexamples in model theory; see [27]. We refer the reader to [13, Section 3] for a description of this method. This generalisation of Fraı̈ssé’s theory allows one to construct structures where the automorphism group acts homogeneously only on a privileged class of substructures; see [33, Section 2.4]. Further generalisations are possible, including a general category-theoretic version of the Fraı̈ssé construction which can be found in [10] and [11]. In LOCALLY FINITE MAXIMALLY HOMOGENEOUS SEMIGROUPS 3 particular, the machinery from the paper [11] could also be applied to obtain the existence and uniqueness results which we give in Section 4. After proving the existence and uniqueness of T and I, the rest of the article will be devoted to investigating their structure. In particular we shall see that several well-known homogeneous structures may be found in the subgroup and idempotent structure of these semigroups, including the countable generic semilattice, the countable random bipartite graph, and Hall’s universal group itself. This paper is comprised of nine sections including the introduction. In Section 2 we introduce all the necessary definitions and notation from semigroup and model theory needed for what follows. The notions of maximally homogeneous semigroup and inverse semigroup are discussed in Section 3 together with the connection to the notion of an amalgamation base. Section 4 is devoted to proving the existence and uniqueness of T and I. In Section 5 we prove our main results about the structure of I (Theorem 5.1). The main results about the structural properties of T are given in Sections 6 and 7 (summarised in Theorem 6.1). In Section 8 we make some comments about the problem of determining which infinite semigroups arise as subsemigroups of T , and the corresponding question for I. Finally, in Section 9 we discuss the relationship between T and full transformation limit semigroups obtained by iterating Cayley’s Theorem, and the analogous question for I. 2. Preliminaries 2.1. Locally finite groups and semigroups. A group G is said to be locally finite if every finite subset of G generates a finite subgroup. For a comprehensive introduction to the theory of locally finite groups we refer the reader to the book [29]. Here we recall just a few basic facts. If Gi (i ∈ N) is a countable collectionS of finite groups such that Gi is a proper subgroup of Gi+1 for all i ∈ N, then the union G = i≥0 Gi of this chain G0 ≤ G1 ≤ G2 ≤ . . . is a countably infinite locally finite group. Formally, we have a sequence of finite groups G0 , G1 , . . . and embeddings (that is, injective homomorphisms) σi : Gi → Gi+1 and the S union G = i≥0 Gi is the direct limit of the direct system {Gi , αji }, where αji is defined to be σi σi+1 . . . σj−1 for i < j. For basic concepts in group theory we refer the reader to [37]. In particular, the definition of the direct limit of a direct system of groups may be found in [37, Chapter 1, pages 22-23]. Conversely, if G is a countably infinite locally finite group then by enumerating the elements of G = {g0 , g1 , g2 , . . .} and considering the sequence of subgroups Hi (i ∈ N), where Hi is the subgroup of G generated by {g0 , g1 , . . . , gi }, it is not difficult to see that there exists a countable S collection of finite subgroups Gi (i ∈ N) of G, such that Gi ≤ Gi+1 for all i, and G = i≥0 Gi . For a proof of this see [29, Lemma 1.A.9]. When we have a sequence of finite groups Gi (i ∈ N) and embeddings σi : Gi → Gi+1 we shall sometimes omit specific reference to the names of the mappings σi and talk about a chain of embeddings of finite groups G0 → G1 → G2 → . . . and speak of the direct limit of this chain which, as discussed above, may be thought of as being the union of this countable collection of finite groups, with respect to this sequence of embeddings. In the special case that each of the groups Gi is isomorphic to some finite symmetric group, we say that the direct limit is an Sn -limit group. So an Sn -limit group is a direct limit of some chain Si1 → Si2 → Si3 → . . . . of embeddings of finite symmetric groups where i1 < i2 < i3 < · · · . The Sn -limit groups have been well studied in the theory of infinite locally finite groups [34]. In particular they give one interesting source of examples of infinite locally finite simple groups. 4 IGOR DOLINKA AND ROBERT D. GRAY In this article, we shall say that a group is universal if it embeds every finite group. By Cayley’s Theorem every finite group embeds in some finite symmetric group. From this it is easily seen that any countably infinite Sn -limit group is universal. Hall’s group, which was discussed in the introduction above, is a particularly nice example of a countably infinite Sn limit group. As explained above, Hall’s group U may be constructed by iterating Cayley’s Theorem. Namely, let G0 = G be any finite group with at least 3 elements. Then it embeds, via the right regular representation g 7→ ρg where xρg = xg for all x ∈ G, into the symmetric group G1 = SG , which in turn embeds into G2 = SG1 , and so on. In this way, we obtain a chain of embeddings of finite symmetric groups G0 → G1 → G2 → . . . and Hall’s group U is the direct limit of this chain. A semigroup S is called locally finite if every finitely generated subsemigroup of S is finite. In the same way as for groups, the direct limit of a countable chain of embeddings of finite semigroups S0 → S1 → S2 → . . . is a countable locally finite semigroup, and every countable locally finite semigroup arises in this way. Given a non-empty set X, the collection of all mappings from X to X together with the operation of composition of maps forms a semigroup called the full transformation semigroup TX on X. In the case that X = [n] = {1, 2, . . . , n} we write Tn for TX . In the special case that each of the semigroups Si in the above chain of embeddings is isomorphic to some finite full transformation semigroup, we say that the direct limit is a Tn -limit semigroup, or alternatively a full transformation limit semigroup. So a full transformation limit semigroup is a direct limit of some chain T i1 → T i2 → T i3 → . . . of embeddings of finite full transformation semigroups. We shall call a semigroup universal if it embeds every finite semigroup. By Cayley’s Theorem for finite semigroups every countably infinite full transformation limit semigroup semigroup is universal. The symmetric inverse semigroup IX on a non-empty set X consists of all partial bijections from X to X under composition of partial maps. In the case that X = [n] = {1, 2, . . . , n} we write In for IX . Inverse semigroups obtained as direct limits of chains of embeddings of symmetric inverse semigroups I i1 → I i2 → I i3 → . . . where i1 < i2 < i3 < . . . will be called symmetric inverse limit semigroups, or In -limit inverse semigroups. Any symmetric inverse limit semigroup is locally finite. The Vagner–Preston Theorem [26, Theorem 5.1.7] implies that any finite inverse semigroup embeds in some finite symmetric inverse semigroup, and from this it follows that any symmetric inverse limit semigroup is universal, in the sense that it embeds every finite inverse semigroup. 2.2. Homogeneous structures. The main objects of interest for us in this paper are structures, both algebraic and combinatorial (relational), with a high degree of symmetry. Excellent recent surveys on the subject of homogeneous structures are [13], and [33] for relational structures, and our notation and conventions follow closely the paper [13]. Let L be a countable first-order language. Given an L-structure M we shall use M to denote both the structure and its domain. We use Aut(M ) to denote the automorphism group of M . An L-structure M is called homogeneous if whenever A1 , A2 ⊆ M are finitely generated substructures of M , and f : A1 → A2 is an isomorphism, then there is an automorphism g ∈ Aut(M ) extending f . A non-empty class C of finitely generated L-structures is called an amalgamation class if it is closed under isomorphisms, and has three properties called the Hereditary Property (HP), Joint Embedding Property (JEP), and the Amalgamation Property (AP); see [13, Definition 1.3]. We shall not repeat all of these definitions here since we shall LOCALLY FINITE MAXIMALLY HOMOGENEOUS SEMIGROUPS 5 give a generalisation of these ideas in Section 4 below. It would be good however to recall the definition of the amalgamation property here: (AP) if A0 , A1 , A2 ∈ C and f1 : A0 → A1 and f2 : A0 → A2 are embeddings, then there is a B ∈ C and embeddings g1 : A1 → B and g2 : A2 → B such that f1 g1 = f2 g2 . Throughout the paper, the order of composition of functions is left-to-right. Consequently, we write functions to the right of their arguments. The age of an L-structure M , denoted Age(M ), is the class of all structures isomorphic to some finitely generated substructure of M . Fraı̈ssé’s theorem [13, Theorem 1.6] (see also [23, page 163-4]) says that the age of a homogeneous structure is an amalgamation class and, conversely, if C is an amalgamation class of countable finitely generated L-structures, with countably many isomorphism types, then there is a countable homogeneous L-structure M with age C. The structure M is determined uniquely up to isomorphism by C and is called the Fraı̈ssé limit of C, or the generic structure of the class C. The following well-known examples of Fraı̈ssé limits will play an important role in this article. • The class of finite linear orders is an amalgamation class with Fraı̈ssé limit (Q, ≤). • The class of finite semilattices is an amalgamation class. Its Fraı̈ssé limit is denoted Ω. • The class of finite bipartite graphs is an amalgamation class. Its Fraı̈ssé limit is the countable random bipartite graph. This is the unique countable bipartite graph such that each part of the bipartition is infinite, and for any two finite disjoint sets U and V from one part, there is a vertex w in the other part such that w is adjacent to every vertex of U and to no vertices of V . The random bipartite graph is not a homogeneous graph, but is homogeneous in the language of bipartite graphs which has an additional binary relation symbol interpreted as the bipartition. • The class of finite groups is an amalgamation class. Its Fraı̈ssé limit is Philip Hall’s universal locally finite group U . 2.3. Amalgamation of semigroups and inverse semigroups. It is well known that the class of finite semigroups does not form an amalgamation class, and this applies to the class of finite inverse semigroups as well. The first example showing this for semigroups was given in the 1957 PhD thesis of Kimura; see [5, Section 9.4] where Kimura’s example is reproduced. For the class of finite inverse semigroups see [16, 18] where a simple counterexample is credited to C. J. Ash. It is then an immediate consequence of Fraı̈ssé’s Theorem that there does not exists a countable universal locally finite homogeneous semigroup, and there does not exist a countable universal locally finite homogeneous inverse semigroup. One is then naturally led to ask the question: How homogeneous can a countable universal locally finite semigroup be? We also have the analogous question for inverse semigroups. Let S be a countable universal locally finite semigroup and let T be a finite semigroup. If Aut(S) acts homogeneously on copies of T then what restriction does this put on T ? We know that Aut(S) cannot act homogeneously on every finite T , but we would like S to act homogeneously on as many of its subsemigroups as possible. This can be made precise via the notion of an amalgamation base, as we now explain. Let C be a class of structures of a fixed signature. An amalgam in C consists of a triple of structures A0 , A1 , A2 ∈ C and a pair of embeddings f1 : A0 → A1 and f2 : A0 → A2 . Often we suppress the names of the mappings and simply talk about the amalgam A1 ← A0 → A2 . We call A0 the base of this amalgam. If there exists a structure B ∈ C and embeddings g1 : A1 → B and g2 : A2 → B such that f1 g1 = f2 g2 , then we say that the original amalgam A1 ← A0 → A2 can be embedded into some structure from C. In this language, the class C has the amalgamation property if any amalgam in C can be embedded into some structure from C. Furthermore, a structure A0 from C is said to be an amalgamation base for C if every amalgam in C with base A0 can be embedded into some structure from C. 6 IGOR DOLINKA AND ROBERT D. GRAY Now, as already remarked above, finite groups have the amalgamation property, so every finite group is an amalgamation base for the class of finite groups. However, this fails for finite semigroups, and thus the class of amalgamation bases for finite semigroups is a proper subclass of finite semigroups. Similarly, there exist finite inverse semigroups which are not amalgamation bases for the class of finite inverse semigroups. Let A denote the class of all amalgamation bases for finite inverse semigroups, and let B be the class of all amalgamation bases for finite semigroups. We note in passing that there is a stronger notion of amalgamation for semigroups and inverse semigroups which has also received attention in the literature, namely, that of being a strong amalgamation base. A finite semigroup S is a strong amalgamation base for the class of finite semigroups if every amalgam A1 ← S → A2 of finite semigroups with base S can be embedded into some finite semigroup B in such a way that the intersection of the images of A1 and A2 in B is equal to the image of S in B. There is an analogous definition for inverse semigroups. Of course, by definition, any strong amalgamation base is an amalgamation base. Throughout this paper we shall always work with the weaker notion of amalgamation base defined above, and never with strong amalgamation bases. It follows from results in [17, 18] and [35] that a finite inverse semigroup S belongs to A if and only if S is J -linear, i.e. the set of principal ideals of S form a chain under inclusion. In particular, the symmetric inverse semigroup IX belongs to A for any finite set X. 2.4. Properties of the class B. A characterisation of the finite semigroups in B is not yet known. In this subsection we will list some examples that are known to belong to this class. Of particular importance to the results in this paper is that the full transformation semigroup Tn and its opposite Tnopp both belong to B. We recall that for a semigroup S, S opp denotes the semigroup defined on the set S with the operation ∗ given by x ∗ y = yx for all x, y ∈ S. This is called the opposite semigroup of S. Lemma 2.1. If S is an amalgamation base for the class of all finite semigroups then so is S opp . Proof. It is easy to see that, in general, if φ : A → B is a homomorphism between semigroups then φ : Aopp → B opp is also a homomorphism. Now, consider an amalgam T ← S opp → V with embeddings f and g, respectively. Then using the same mappings T opp ← S → V opp is also an amalgam of finite semigroups. Since S is assumed to belong to B, there is a finite semigroup W and embeddings h : T opp → W and k : V opp → W embedding this amalgam into W . Then h, k embed the initial amalgam into the finite semigroup W opp. Hence, S opp ∈ B.  The results of Shoji [39] together with this lemma show that Tn and Tnopp belong to B. It is also known that any member of B must be J -linear [19], and that B includes semigroup reducts of all members of A. More generally, if S is a J -linear semigroup and the algebra CS is semisimple then S ∈ B; see [35]. In particular any J -linear finite inverse semigroup, and so any finite group, belongs to B. Throughout the paper we will make repeated use of the fact that the semigroups mentioned in this paragraph all belong to the class B. On the other hand, not all J -linear finite semigroups belong to B: for example, it was proved in [20] that a finite completely simple semigroup belongs to B if and only if it is a group. 2.5. Semigroup theory notation and definitions. For general background in semigroup theory we refer the reader to [26]. If S is a semigroup we write T ≤ S to mean that T is a subsemigroup of S, and write T < S to mean that T ≤ S and T 6= S. Green’s relations are an important tool for studying the ideal structure of semigroups. Given a semigroup S, we define for a, b ∈ S: a R b ⇔ aS 1 = bS 1 , a L b ⇔ S 1 a = S 1 b, a J b ⇔ S 1 aS 1 = S 1 bS 1 , where S 1 denotes S with an identity element adjoined, unless S already has one. Furthermore, we let H = R ∩ L and D = R ◦ L , and remark that D is the join of the equivalence relations R and L because it may be shown that R ◦ L = L ◦ R. In general H is a subset of LOCALLY FINITE MAXIMALLY HOMOGENEOUS SEMIGROUPS 7 both R and L , while R and L are both subsets of D, which is in turn a subset of J . In general the relations D and J are distinct, but for periodic semigroups they coincide; see [26, Proposition 2.1.4]. Recall that a semigroup S is called periodic if for every s ∈ S there are natural numbers m and n such that sm+n = sm . Clearly every finite semigroup, and every locally finite semigroup, is periodic. In particular J = D in every locally finite semigroup. The R-class of an element a is denoted by Ra , and in a similar fashion we use the notation La , Ja , Ha and Da . An H -class Ha of a semigroup is a group if and only if it contains an idempotent. The group H -classes are exactly the maximal subgroups of the semigroup. In situations where there is more than one semigroup under consideration we shall sometimes use the notation KaS and K S for K ∈ {R, L, J, H, D} and K ∈ {R, L , J , H , D}, to specify that we are taking the relation, or equivalence class, in the semigroup S. The inclusion relation between principal ideals naturally gives rise to quasi-order relations ≤K on a semigroup S for K ∈ {R, L , J }: for example, we write a ≤R b if aS 1 ⊆ bS 1 , and similarly we define ≤L and ≤J . Also, for two K -classes C and C ′ we write C ≤K C ′ if a ≤K b for some a ∈ C and b ∈ C ′ . Green’s relations in in the full transformation semigroup TX are easy to characterise (see e.g. [26, Exercise 2.6.16]). For f, g ∈ TX we have: f R g if and only if ker(f ) = ker(g); f L g if and only if im(f ) = im(g); and f J g if and only if f D g if and only if rank(f ) = rank(g). Here rank(f ) = | im(f )|, and ker(f ) is the equivalence relation on [n] where (i, j) ∈ ker(f ) if and only if if = jf . Consequently, f and g belong to the same H -class if and only if both their kernels and images coincide. Let X be a non-empty set and choose and fix some κ ≤ |X|. Let Dκ denote the D-class in TX of all transformations of rank κ. The R-classes of Dκ are then indexed by the set of partitions of X into κ non-empty parts, while the L -classes are indexed by the set of subsets of X of cardinality κ. Given a partition P with κ non-empty parts, and a subset A of X of cardinality κ, we shall use HP,A to denote the H -class given by intersecting the corresponding R- and L -classes of Dκ . It is well known, and easy to prove, that the H -class HP,A is a group if and only if the set A is a transversal of the partition P , that is, there is exactly one element from the set A in each part of the partition P . We shall write A ⊥ P to denote that A is a transversal of P . If A ⊥ P then HP,A is isomorphic to the symmetric group SA . An element a of a semigroup S is regular if there exists b ∈ S such that aba = a. A semigroup S is regular if all of its elements are regular. The full transformation semigroup TX is an example of a regular semigroup. We say that an element a′ is an inverse of an element a in a semigroup S if both aa′ a = a and a′ aa′ = a′ . It may be shown that a semigroup is regular if and only if every element has at least one inverse. An inverse semigroup is a semigroup in which each element has exactly one inverse. Inverse semigroups are most naturally viewed as algebraic structures in the (2,1)-signature {·, −1 }, where x−1 denotes the unique inverse of x. Thus, we have xx−1 x = x and x−1 xx−1 = x−1 . In addition, it may be shown that −1 is an involution satisfying (xy)−1 = y −1 x−1 , and that the set of all idempotents of an inverse semigroup form a commutative subsemigroup; see [26, Section 5]. An inverse subsemigroup T of an inverse semigroup S is a subsemigroup T of S which is closed under taking inverses. This is equivalent to saying that T is a substructure of S in the (2,1)-signature. The Vagner–Preston Theorem [26, Theorem 5.1.7] shows that any inverse semigroup is a subsemigroup of some symmetric inverse semigroup. In more detail, if S is an inverse semigroup, the map from S to IS which sends each x ∈ S to the partial bijection ρx : Sx−1 → Sx, where tρx = tx for all t ∈ Sx−1 , gives an embedding of S into IS . In the symmetric inverse semigroup IX , the inverse α−1 of the element α is the inverse of the mapping α, in the usual sense. The L -, D- and J -relations in IX are just the same as in TX , while we have f R g if and only if f and g have the same domain, which we write as dom(f ) = dom(g). Hence, for Hf to be a group we must have dom(f ) = im(f ) from which it follows that Hf is isomorphic to the symmetric group on dom(f ). 8 IGOR DOLINKA AND ROBERT D. GRAY A J -class J in an arbitrary semigroup S gives rise to the associated principal factor J ∗ = J ∪ {0}, with multiplication: ( ab if a, b, ab ∈ J a·b= 0 otherwise. It is known that J ∗ is either a 0-simple semigroup or a semigroup with zero multiplication; see [26, Theorem 3.1.6]. Under some additional finiteness hypotheses, such as being periodic, a regular 0-simple principal factor J ∗ will be completely 0-simple in which case the Rees Theorem [26, Theorem 3.2.3] states that it will be isomorphic to a Rees matrix semigroup M0 [G; I, Λ; P ]. See [26, Subsection 3.2] for more details on completely 0-simple semigroups and the Rees matrix semigroup construction. We use B(I, G) to denote the Rees matrix semigroup M0 [G; I, I; P ] where P is the I ×I identity matrix. This is called a Brandt semigroup over G. It is a completely 0-simple inverse semigroup, and every completely 0-simple inverse semigroup arises in this way; see [26, Theorem 5.1.8]. 2.6. Graphs, posets, and semilattices. We view graphs as structures with a single symmetric irreflexive binary relation, denoted by ∼. If Γ is a graph we use V Γ to denote its vertices and EΓ its set of edges which are the 2-sets {u, v} such that u ∼ v and v ∼ u. A semigroup is called a semilattice if it is commutative and all of its elements are idempotents. A meet-semilattice is a poset (P, ≤) such that any pair of elements x, y ∈ P has a well-defined greatest lower bound x∧y. These two definitions are equivalent: if a semigroup S is a semilattice then the partial order ≤ given by e ≤ f if and only if ef = f e = e is a meet semilattice, and conversely given a semilattice (P, ≤) the semigroup (P, ∧) is a commutative semigroup of idempotents; see [26, Proposition 1.3.2]. 2.7. Combinatorial structures in semigroups. Let D be a D-class of a semigroup S. Since D = R ◦ L = L ◦ R, we can label the R-classes and the L -classes contained in D by index sets I and Λ, respectively, so that each H -class contained in D is of the form Hiλ = Ri ∩ Lλ . To record the distribution and structure of the idempotents of S within D, following [14, 24] we define a bipartite graph associated with D, denoted GH(D), called the Graham–Houghton graph of D. The graph GH(D) is defined to be the bipartite graph with vertex set the disjoint union I ∪· Λ, where I and Λ are the two parts of the bipartition, and where i ∈ I is adjacent to λ ∈ Λ if and only if Hiλ is a group. Equivalently, i and λ are adjacent in GH(D) if and only if Ri ∩ Lλ contains an idempotent. Semilattices arise naturally within inverse semigroups. The set of idempotents E(S) of an inverse semigroup S is a commutative subsemgrioup of S, and therefore is a semilattice, which we shall call the semilattice of idempotents of the inverse semigroup S. 3. Universal maximally homogeneous semigroups As discussed above, there is no countable universal locally finite homogeneous semigroup, and there is no such inverse semigroup either. The results in this section will describe the maximum degree of homogeneity that can be possessed by a countable universal locally finite semigroup or inverse semigroup. Let S be a semigroup and let T be a subsemigroup of S. Recall from above that we say that Aut(S) acts homogeneously on copies of T if for any subsemigroups T1 , T2 ≤ S, if T1 ∼ =T ∼ = T2 then every isomorphism φ : T1 → T2 extends to an automorphism of S. Proposition 3.1. Let S be a countable universal locally finite semigroup and let T be a finite semigroup. If Aut(S) acts homogeneously on copies of T , then T belongs to the class B of all amalgamation bases for finite semigroups. Proof. Let f1 : T → U1 and f2 : T → U2 be embeddings where U1 , U2 are finite semigroups. Since S is universal there are embeddings g1 : U1 → S and g2 : U2 → S. Set V1 = U1 g1 and V2 = U2 g2 . Since Aut(S) acts homogeneously on copies of T it follows that the isomorphism LOCALLY FINITE MAXIMALLY HOMOGENEOUS SEMIGROUPS 9 g1−1 f1−1 f2 g2 : T f1 g1 → T f2 g2 extends to an automorphism α ∈ Aut(S). Let W be the subsemigroup of S generated by V1 α ∪ V2 . Then the mappings g1 α : U1 → W and g2 : U2 → W complete the amalgamation diagram, and the proof.  Note that the universality hypothesis is necessary in this proposition. For example, the universal countable homogeneous semilattice Ω is a countable locally finite semigroup, while Aut(Ω) acts homogeneously on all finite semilattices, some of which are not J -linear and thus do not belong to the class B. The following analogue for inverse semigroups may be shown in a similar way. Proposition 3.2. Let I be a countable universal locally finite inverse semigroup and let T be a finite inverse semigroup. If Aut(I) acts homogeneously on copies of T , then T belongs to the class A of all amalgamation bases for finite inverse semigroups, that is, T is J -linear. We call a universal locally finite semigroup S maximally homogeneous, or B-homogeneous, if Aut(S) it acts homogeneously on copies of T for every T in B. Similarly we talk about universal locally finite inverse semigroups which are maximally homogeneous, also called A-homogeneous, meaning their automorphism group acts homogeneously on copies of T for all T in A. We would like to identify universal locally finite maximally homogeneous semigroups, and inverse semigroups, and study their properties. The most natural class of universal locally finite semigroups is given by full transformation limit semigroups, defined in Subsection 2.1. Our first main result shows that maximally homogeneous semigroups exist, and in the class of full transformation limit semigroups there is a unique example up to isomorphism. Theorem 3.3. There is a unique maximally homogeneous full transformation limit semigroup. This result will be proved in Section 4. We call the semigroup in this theorem the maximally homogeneous full transformation limit semigroup, and denote it by T . For inverse semigroups we have the following analogous result. Theorem 3.4. There is a unique maximally homogeneous symmetric inverse limit semigroup. This result will also be proved in Section 4. We call the inverse semigroup in this theorem the maximally homogeneous symmetric inverse limit semigroup and denote it by I. Remark 3.5. If S is a homogeneous inverse semigroup then it is obvious that its semilattice of idempotents E(S) is a homogeneous semilattice. It is important to stress that I is not a homogeneous inverse semigroup, so it is not immediate that E(I) is homogeneous. Moreover, it is not possible to prove that E(I) is homogeneous simply by considering the action of Aut(I) on E(I). Indeed, since the only semilattices in A are chains, and since I is universal for finite inverse semigroups and thus in particular embeds all finite semilattices, it follows from Proposition 3.2 that Aut(I) does not act homogeneously on all of its finite subsemilattices. Similarly, the action of Aut(T ) on E(T ) will certainly not give a proof that the Graham– Houghton graphs of T are homogeneous. Indeed, Aut(T ) will not act homogeneously on copies of the 2-element left zero semigroup L2 inside a given D-class since L2 is not in B. This is because the only finite completely simple semigroups that belong to B are finite groups [20]. The action of Aut(T ) induces an action on the set of idempotents which by restricting to a particular D-class gives an action of Aut(T ) on the Graham–Houghton graph. In terms of this action, the above observation says that Aut(T ) does not act two-arc transitively on the Graham–Houghton graph. In fact, even homogeneous semigroups can have Graham–Houghton graphs which are not homogenous. Indeed1 if S is the combinatorial completely 0-simple semigroup represented as a Rees matrix semigroup with structure matrix   1 1 0 0 P = 0 0 1 1 1We thank Thomas Quinn–Gregson of the University of York for bringing this example to our attention. 10 IGOR DOLINKA AND ROBERT D. GRAY then S is homogeneous, but its Graham–Houghton graph is the disjoint union of two copies of the complete bipartite graph K1,2 which is not a homogeneous bipartite graph. 4. Fraı̈ssé amalgamation and the proofs of the existence and uniqueness of T and I In this section we shall make use of a generalisation of Fraı̈ssé’s Theorem called the Hrushovski construction. We follow the description of this method given in [13, Section 3]. We work with a class K of finite L-structures and a distinguished class of substructures A ⊑ B, which is expressed by saying ‘A is a nice substructure of B’. If B ∈ K then an embedding f : A → B is called a ⊑-embedding if f (A) ⊑ B. We shall assume that ⊑ satisfies the following conditions: (N1) If A ∈ K then A ⊑ A (so isomorphisms are ⊑-embeddings). (N2) If A ⊑ B ⊑ C for A, B, C ∈ K then A ⊑ C (so, if f : A → B and g : B → C are ⊑-embeddings then f g : A → C is also a ⊑-embedding). Note that whether an embedding f : A → B is a ⊑-embedding just depends on the substructure induced on f (A). In particular, if f : A → B is a ⊑-embedding then so is αf : A → B for any α ∈ Aut(A). We say that (K, ⊑) is an amalgamation class if: • K is closed under isomorphisms, has countably many isomorphism types, and countably many embeddings between any two members of K; • K is closed under ⊑-substructures; • K has the JEP for ⊑-embeddings: if A1 , A2 ∈ K then there exists B ∈ K and ⊑embeddings fi : Ai → B (i = 1, 2); • K has the AP for ⊑-embeddings: if A0 , A1 , A2 ∈ K and f1 : A0 → A1 and f2 : A0 → A2 are ⊑-embeddings then there exists B ∈ K and ⊑-embeddings gi : Ai → B (i = 1, 2) with f1 g1 = f2 g2 . Now it will be useful to extend the notion of a nice substructure to certain countable structures. Suppose M is a countable L-structure such that there are finite substructures Mi of M (i ∈ N) with [ Mi . M1 ⊑ M2 ⊑ M3 ⊑ . . . and M = i∈N For a finite A ≤ M we define A ⊑ M if A ⊑ Mi for some i ∈ N. This does not depend on the choice of substructures Mi above provided the following condition holds: (N3) Let A ⊑ B ∈ K and A ⊆ C ⊆ B with C ∈ K. Then A ⊑ C. Theorem 4.1 (Theorem 3.2 in [13]). Suppose (K, ⊑) is an amalgamation class of finite Lstructures and ⊑ satisfies (N1) and (N2). Then there is a countable L-structure M and finite substructures Mi ∈ K (i ∈ N) such that S (1) M1 ⊑ M2 ⊑ M3 ⊑ . . . and M = i∈N Mi ; (2) every A ∈ K is isomorphic to a ⊑-substructure of M ; (3) (Extension property) if A ⊑ M is finite and f : A → B ∈ K is a ⊑-embedding then there is a ⊑-embedding g : B → M such that af g = a for all a ∈ A. Moreover, M is determined up to isomorphism by these properties and if A1 , A2 ⊑ M and h : A1 → A2 is an isomorphism then h extends to an automorphism of M (which can be taken to preserve ⊑). We call this latter property ⊑-homogeneity and M is the generic structure of the class (K, ⊑). As in Fraı̈ssé’s original theorem, this result also has a converse; see [13, Theorem 3.3]. 4.1. Proof of Theorem 3.4. In this section we shall apply the above theorem to prove Theorem 3.4. For Theorem 3.3 we just give a sketch of how it may be proved using the same general approach. Definition 4.2. For S, T ∈ A write S ⊑ T if and only if S is an inverse subsemigroup of T . LOCALLY FINITE MAXIMALLY HOMOGENEOUS SEMIGROUPS 11 Note that if S ⊑ T applies then necessarily S and T are both J -linear. Lemma 4.3. (A, ⊑) is an amalgamation class and ⊑ satisfies (N1) and (N2). Proof. Since ⊑ is just the restriction of ≤ to the members of A (in the (2,1)-signature), (N1) holds trivially, and (N2) is immediate. Also, since the structures in A are finite and the language L is finite, A is closed under isomorphisms, contains only countably many isomorphism types and countably many embeddings between any pair of elements of A. We have already seen that, vacuously, A is closed under ⊑. To see that (A, ⊑) is an amalgamation class, we need to verify that it satisfies the JEP and the AP with respect to nice embeddings. Indeed, given A1 , A2 ∈ A, by applying the Vagner–Preston Theorem we obtain embeddings fi : Ai → IAi , i = 1, 2. Furthermore, let gi : IAi → IA1 ∪A · 2 be the obvious natural embeddings; so Ai (i = 1, 2) embeds into B = IA1 ∪A · 2 via fi gi . These are ⊑-embeddings because IA1 ∪A · 2 ∈ A. To complete the proof, we must verify that A has the amalgamation property for ⊑-embeddings. Let A0 , A1 , A2 ∈ A and f1 : A0 → A1 , and f2 : A0 → A2 be ⊑-embeddings. Then since A0 ∈ A there is a finite inverse semigroup B and embeddings gi : Ai → B (i = 1, 2) such that f1 g1 = f2 g2 . Now by the Vagner–Preston Theorem there is an embedding h : B → IB . Then gi h : Ai → IB are ⊑-embeddings since Ai ∈ A by assumption and IB belongs to A.  Combining the above lemma with Theorem 4.1 gives a countable (2,1)-algebra I and finite S inverse semigroups Pi ∈ A (i ∈ N) such that P1 ⊑ P2 ⊑ . . . and I = i∈N Pi . This implies I is an inverse semigroup; furthermore, it is universal for the class of finite inverse semigroups. Moreover, it also follows from Theorem 4.1 that I is A-homogeneous, and is the unique countable A-homogeneous inverse semigroup which can be written as such a union of members Pi of A. To complete the proof of Theorem 3.4 we need to show that I is an In -limit inverse semigroup by converting the chain P1 ⊑ P2 ⊑ . . . into a chain of finite symmetric inverse semigroups. Lemma 4.4. Let S be an A-homogeneous inverse semigroup. The following are equivalent: (i) S is universal for finite inverse semigroups and there are finite inverse subsemigroups S Si ∈ A (i ∈ N) such that S1 < S2 < . . . and S = i∈N Si ; (ii) S is an In -limit inverse semigroup, S i.e. there are inverse subsemigroups Ti of S (i ∈ N) such that T1 < T2 < . . . and S = i∈N Ti where each Ti ∼ = Ini for some ni ∈ N. S Proof. (ii)⇒(i): It follows from the Vagner–Preston Theorem that S = i∈N Ti is universal for finite inverse semigroups, whence (i) is achieved since each Ti ∼ = Ini belongs to A. (i)⇒(ii): We claim that for each i ∈ N there is an inverse subsemigroup Ui of S such that Ui contains Si as an inverse subsemigroup and Ui ∼ = ISi . To see this, first embed Si into ISi by the Vagner–Preston Theorem. By universality of S there is an embedding ISi → S; let Vi be the image of ISi under this embedding. Then Vi is an inverse subsemigroup of S which in turn contains a subsemigroup Si′ such that Si′ ∼ = Si . Since Si ∈ A we can apply A-homogeneity to get an automorphism α of S such that Si′ α = Si , and then set Ui = Vi α, completing the proof of the claim. S Now since each Ui is finite and S = i∈N Si there exist 1 = i0 < i1 < i2 < . . . such that S1 = Si0 ≤ Ui0 ≤ Si1 ≤ Ui1 ≤ Si2 ≤ Ui2 ≤ . . . S Hence, we have Ui0 ≤ Ui1 ≤ . . . and S = j∈N0 Uij , where Uij ∼ = I|Sij | . The proof is now completed by setting Tj = Uij−1 for all j ≥ 1.  This lemma tells us that I is indeed an In -limit inverse semigroup, which completes the existence part of Theorem 3.4. Uniqueness now also follows from Theorem 4.1. Indeed, the conditions (1) and (2) of that theorem are clearly satisfied. The extension property (3) holds as a consequence of the assumption of A-homogeneity. This completes the proof of Theorem 3.4. 12 IGOR DOLINKA AND ROBERT D. GRAY 4.2. Proof of Theorem 3.3. The proof of Theorem 3.3 is similar to the proof of Theorem 3.4. For S, T ∈ B we write S ⊑ T if and only if S is a subsemigroup of T . Then using Cayley’s Theorem for semigroups, and the definition of B, it may be seen that (B, ⊑) is an amalgamation class and ⊑ satisfies (N1) and (N2). Applying Theorem 4.1 gives a countable universal locally finite semigroup T which is B-homogeneous, that is, it is maximally homogeneous. Moreover, S there is a sequence of finite semigroups Pi ∈ B (i ∈ N) such that P1 ⊑ P2 ⊑ . . . and T = i∈N Pi . The proof of Theorem 3.3 is then completed by the following lemma which is proved in the same way as Lemma 4.4 but with Tn in place of In , and Cayley’s Theorem for semigroups applied instead of the Vagner–Preston Theorem. Also, for the (ii)⇒(i) direction of the proof of the following result we need to appeal to the fact that for all n the full transformation semigroup Tn belongs to B. Lemma 4.5. Let S be a B-homogeneous semigroup. The following are equivalent: (i) S is universal for finite semigroups S and there are finite subsemigroups Si ∈ B (i ∈ N) such that S1 < S2 < . . . and S = i∈N Si ; (ii) S is a Tn -limit semigroup, S i.e. there are subsemigroups Ti of S (i ∈ N) such that T1 < T2 < . . . and S = i∈N Ti where each Ti ∼ = Tni for some ni ∈ N. 5. Homogeneous structures within the inverse semigroup I The aim of this section is to prove the following result which gives several structural properties of the semigroup I. Theorem 5.1. Let I be the maximally homogeneous symmetric inverse limit semigroup. Then (1) I is locally finite and universal for finite inverse semigroups. (2) I/J is a chain with order type Q. (3) Every maximal subgroup is isomorphic to Hall’s group U . (4) The semilattice of idempotents E(I) is isomorphic to the universal countable homogeneous semilattice. (5) J = D and all principal factors are isomorphic to the Brandt semigroup B(N, U ). We note that (I/R, ≤R ), (I/L , ≤L ) and (E(I), ≤) are all isomorphic, since I is an inverse semigroup, so part (4) also serves as a description of the R and L orders of I. The rest of this section will be devoted to proving Theorem 5.1. Part (4) takes the most work, so we shall deal with it last. Part (1) was established in the proof of Theorem 3.4. 5.1. The order type of I/J . First note that since I is a union of J -linear inverse semigroups it follows that I/J is a chain. This chain is certainly countable since I is countable. To show that it has order type (Q, ≤) it would now suffice to show that it is dense and without end-points. For that it suffices to observe that Aut(I) acts 2-homogeneously on I/J . In fact Aut(I) acts k-homogeneously on I/J for any k, as we now show. First we record a general fact about inverse semigroups. Lemma 5.2. Let S be an inverse semigroup and let J, K be J -classes of S with J ≤ K. Then for any f ∈ E(K) there exists e ∈ E(J) such that ef = f e = e. Proof. Pick an arbitrary idempotent g ∈ J. There exist s, t ∈ S 1 such that sf t = g. Thus g = sf t = ss−1 sf tt−1 t = s(s−1 gt−1 )t, so s−1 gt−1 J g. Now, e = s−1 gt−1 = (ss−1 )f (t−1 t) is an idempotent, it belongs to J, and we have f e = ef = (ss−1 )f (t−1 t)f = (ss−1 )f 2 (t−1 t) = (ss−1 )f (t−1 t) = e.  This immediately generalises to Corollary 5.3. Let S be an inverse semigroup and let J0 < J1 < · · · < Jk be a chain of J -classes of S. Then there exist ei ∈ Ji , 0 ≤ i ≤ k, such that {e0 , e1 , . . . , ek } ≤ S with e0 < e1 < · · · < ek , i.e. ei ej = ej ei = emin(i,j) for all i, j. LOCALLY FINITE MAXIMALLY HOMOGENEOUS SEMIGROUPS 13 Corollary 5.4. Given any two chains J0 < J1 < · · · < Jk and J0′ < J1′ < · · · < Jk′ of J -classes in I there is an α ∈ Aut(I) such that Ji α = Ji′ for all 0 ≤ i ≤ k. Proof. This follows from the previous corollary together with the condition of A-homogeneity, since the isomorphism between finite chains of idempotents e0 < e1 < · · · < ek and e′0 < e′1 < · · · < e′k extends to an automorphism of I, and automorphisms map J -classes onto J -classes.  Theorem 5.1(2) now follows since Corollary 5.4 implies that (I/J , ≤) is a countable dense linear order without endpoints, and thus must be isomorphic to (Q, ≤). 5.2. Maximal subgroups. By A-homogeneity, Aut(I) acts transitively on the set E = E(I) as each idempotent forms a trivial subsemigroup which is J -linear. It follows that for all e, f ∈ E, He ∼ = Hf i.e. all maximal subgroups of I are isomorphic. Now fix e ∈ E. Since I is universal, it embeds every finite group. Each of these embeddings is into some group H -class of I which, since all such groups are isomorphic, implies that He is universal. Local finiteness of He follows from local finiteness of I. We claim that He is homogeneous. Indeed, if φ : G1 → G2 is an isomorphism between finite subgroups of He then eφ = e. Since groups are J -linear, by A-homogeneity φ extends to φ̂ ∈ Aut(I). Since eφ̂ = e it follows that φ̂ ↾He ∈ Aut(He ) and it extends φ. Thus He is the countable universal locally finite homogeneous group U . This completes the proof of part (3) of Theorem 5.1. 5.3. Principal factors. Since I is locally finite, and thus periodic, it follows that J = D and that every principal factor of I is isomorphic to a completely 0-simple semigroup. Transitivity of Aut(I) on E(I) implies that any two principal factors of I are isomorphic. This shows every principal factor is isomorphic to a Brandt semigroup over U (by [26, Theorem 5.1.8]). Let J be a J -class of I. For every n ∈ N the finite inverse semigroup B({1, . . . , n}, 1G ) embeds in I, since I is universal, and thus it embeds in J. From this it follows that J has infinitely many R- and L -classes. Since I is countable, this proves that J ∗ ∼ = B(N, U ). This completes the proof of part (5) of Theorem 5.1. 5.4. The semilattice of idempotents. The rest of this section will be devoted to proving part (4) of Theorem 5.1. This requires more work than the other parts of Theorem 5.1 due to the fact that Aut(I) does not act homogeneously on the semilattice E(I) of idempotents; see Remark 3.5. We shall make use of the following characterisation of the countable universal homogeneous semilattice Ω. Theorem 5.5. ([1, Theorem 4.2], cf. [9, Theorem 2.5]) Let (Ω, ∧) be a countable semilattice. Then Ω is the universal homogeneous semilattice if and only if the following conditions hold: (i) no element is maximal or minimal; (ii) any pair of elements has an upper bound; (iii) Ω satisfies the following axiom (∗) depicted in Figure 1: for any α, γ, δ, ε ∈ Ω such that δ, ε ≤ α, γ 6≤ δ, γ 6≤ ε, α 6≤ γ, and either δ = ε, or δ k ε and γ ∧ ε ≤ γ ∧ δ, there exists β ∈ Ω such that δ, ε ≤ β ≤ α and β ∧ γ = δ ∧ γ (in particular, β k γ). Here the notation α k β means that α and β are incomparable, where α and β are elements of a poset. Let ψ : S → IS where xψ = ρx be the embedding given by the Vagner–Preston Theorem. In the particular case when x = e ∈ E(S) we have ρe = idSe . When S = In and ε ∈ S is an idempotent, it follows that ε is the identity mapping on the subset dom ε = im ε of {1, . . . , n}, and then im ρε = In ε = {γ ∈ In : im γ ⊆ im ε}. This motivates us to define, for each X ⊆ {1, . . . , n}, the set b = {γ ∈ In : im γ ⊆ X}, X 14 IGOR DOLINKA AND ROBERT D. GRAY α α γ γ β ǫ δ ǫ δ∧γ ⇒ ∃β δ β∧γ =δ∧γ ǫ∧γ Figure 1. Illustration of property (∗) in the characterisation of the countable universal homogeneous semilattice. dε = im ρε . The operation b defines an injective map so that we have im b : P({1, . . . , n}) → P(In ), b (Here we use the notation P(A) to denote the power set of all subsets of a set A.) It X 7→ X. b ∩ Yb , from which it follows that \ is easy to see that for all X, Y ⊆ {1, . . . , n} we have X ∩Y =X b is a semilattice embedding from E(S) into E(IS ). In the special case that S = In , the semilattice E(In ) is isomorphic to (P({1, . . . , n}), ∩) via the map ε 7→ im ε and, similarly, E(IIn ) is isomorphic to (P(In ), ∩). We conclude that b gives rise to a semilattice embedding of E(In ) into E(IIn ). Proposition 5.6. Suppose we have A, C, D, E ⊆ {1, . . . , n} such that the conditions of the left-hand side of axiom (∗) are satisfied, that is D ∪ E ⊆ A, C 6⊆ D, C 6⊆ E, A 6⊆ C, and either b ∪E b ⊆ In we have D b ⊆ B ⊆ A, b D = E, or D k E and C ∩ E ⊆ E ∩ D. Then setting B = D b b b b E ⊆ B and B ∩ C = D ∩ C. b ⊆ B and E b ⊆ B are obvious from the definition of B. Since D ⊆ A we have Proof. Both D b ⊆ A, b and since E ⊆ A we have E b ⊆ A, b thus B = D b ∪E b ⊆ A. b To complete the proof, observe D that b = (D b ∪ E) b ∩C b = (D b ∩ C) b ∪ (E b ∩ C) b =D \ \ B∩C ∩C ∪E ∩ C. b ∩ C. b Otherwise, D k E and E ∩ C ⊆ D ∩ C which implies \ If D = E then this equals D ∩C =D b=D b ∩ C. b \ \ \ E ∩C ⊆ D ∩ C and so again we obtain B ∩ C ∩C =D  Proof of Theorem 5.1 (4). Since I is an In -limit inverse semigroup it follows that for any e, f ∈ E(I) there exists g ∈ E(I) such that g ≥ e and g ≥ f . Since Aut(I) acts transitively on E(I) it follows that there are no maximal or minimal idempotents. So it just remains to verify property (∗). Suppose α, γ, δ, ε ∈ E(I) satisfy the conditions of the left-hand side of axiom (∗). Since I is an In -limit inverse semigroup there exists S ≤ I with S ∼ = In for some n and {α, γ, δ, ε} ⊆ S. Let ψ : S → IS be the Vagner–Preston embedding. It follows from Proposition 5.6 that there is an element β ∈ E(IS ) such that ρα , ργ , ρδ , ρε , β (where ρx = xψ) satisfy the right-hand side of (∗). Since S ∼ = In and IS are both J -linear we can apply the extension property of I (Theorem 4.1 part (3)) to obtain S ≤ V ≤ I where V ∼ = IS and β ′ ∈ E(V ) such ′ that α, γ, δ, ε, β satisfy the right-hand side of axiom (∗). Now by Theorem 5.5 it follows that E(I) is the countable universal homogeneous semilattice.  6. Homogeneous structures within the semigroup T In this section we shall prove some results about the structure of the universal maximally homogeneous full transformation limit semigroup T . LOCALLY FINITE MAXIMALLY HOMOGENEOUS SEMIGROUPS 15 Theorem 6.1. Let T be the maximally homogeneous full transformation limit semigroup. Then (1) T is locally finite and universal for finite semigroups. (2) T /J is a chain with order type Q. (3) Every maximal subgroup is isomorphic to Hall’s group U . (4) T is regular and idempotent generated, J = D and all principal factors are isomorphic to each other. (5) The Graham–Houghton graph of every D-class of T is isomorphic to the countable random bipartite graph. In the process of proving part (5) of Theorem 6.1, another interesting structural property of T that we shall establish is that it is isomorphic to its opposite; see Theorem 7.5. Parts (1), (3) and (4) are the most straightforward to prove, so we begin with them. Proofs of parts (1), (3) and (4) of Theorem 6.1. Part (1) is an immediate consequence of the definition of T and Cayley’s Theorem for semigroups. (3) The argument is very similar to Theorem 5.1(3). Every finite group belongs to B. In particular the trivial group belongs to B which implies Aut(T ) acts transitively on E(T ). It follows that all the maximal subgroups of T are isomorphic to each other. Fix and idempotent e in T and consider the group He . The group He is universal and locally finite because T has both of these properties. Since every finite group belongs to B, we can then see that the group He is homogeneous as a consequence of B-homogeneity of T . (4) Since a union of regular semigroups is regular, and Tn is regular, it follows that T is regular. To see that T is idempotent generated first recall that, by [25], for every n ∈ N we have hE(Tn )i = (Tn \ Sn ) ∪ {id[n] }. Let n > 1 and consider the embedding f : Tn−1 → Tn where for each α ∈ Tn−1 the mapping αf is given by ( iα if 1 ≤ i ≤ n − 1 i(αf ) = n if i = n. Since the full transformation semigroup is in B the map f is a ⊑-embedding and hence by the extension property, for every embedding Tn−1 ⊑ T there is a ⊑-embedding g : Tn → T such that af g = a for all a ∈ Tn−1 . Since T is a Tn -limit semigroup, for every element s ∈ T there is a subsemigroup U ≤ T with s ∈ U and U ∼ = Tk . Setting n = k + 1 this gives an embedding Tn−1 ⊑ T such that the image of Tn−1 contains the element s. But now since f (Tn−1 ) ⊆ Tn \ Sn ⊆ hE(Tn )i it follows that s ∈ hE(Tn g)i. Since s was arbitrary this proves that T is an idempotent generated semigroup. Since T is locally finite, it is periodic, and hence J = D. Finally, transitivity of Aut(T ) on E(T ) implies that any two principal factors of T are isomorphic.  6.1. Proof of Theorem 6.1(2). Clearly, a union of J -linear semigroups is J -linear, and thus in particular every Tn -limit semigroup S has the property that S/J is a chain. To show that T /J has order type Q, we first observe that as a consequence of [19, Theorem 1] we have the following lemma. Lemma 6.2. If φ : S → T is an embedding of regular semigroups and x, y ∈ S are such that T > JT . JxS > JyS then Jxφ yφ Now we prove a result analogous to the one holding for I regarding the action of the automorphism group on chains of J -classes, but with a different argument. Lemma 6.3. Let r < m ≤ n ∈ N. In Tn , for any f ∈ E(Dm ) there is an e ∈ E(Dr ) such that ef = f e = e. Proof. Assume that f=  A1 A2 · · · a1 a2 · · · Am am  , 16 IGOR DOLINKA AND ROBERT D. GRAY where ai ∈ Ai . This notation means that f is a transformation from Tn with image {a1 , a2 , . . . , am } such that, for each i, the preimage of ai is the set Ai . Since f is an idempotent it follows that ai ∈ Ai for all i. Now if we set set   A1 A2 · · · Ar−1 Ar ∪ · · · ∪ Am e= , a1 a2 · · · ar−1 ar then e is an idempotent since ar ∈ Ar ∪ · · · ∪ Am , we have e ∈ Dr since | im(e)| = r, and it may then easily be verified that ef = f e = e.  Corollary 6.4. Given a chain Ji1 < Ji2 < · · · < Jim of J -classes in Tn , for all 1 ≤ j ≤ m there exist eij ∈ Jij such that {ei1 , . . . , eim } is a subsemigroup isomorphic to an m-element chain. Lemma 6.5. For any two chains J0 < J1 < · · · < Jk and J0′ < J1′ < · · · < Jk′ of J -classes in T there exists α ∈ Aut(T ) such that Ji α = Ji′ for all 0 ≤ i ≤ k. Proof. In T , choose representatives ai ∈ Ji and biS∈ Ji′ , 0 ≤ i ≤ k. Since T is a Tn -limit semigroup, it is a union of its subsemigroups T = j≥0 Tj such that Tj ∼ = Tij . So there is an ∼ m ∈ N such that a0 , a1 , . . . , ak , b0 , b1 , . . . , bk ∈ Tm = Tim . Now, by Corollary 6.4, within Tm we have idempotents ei J ai and fi J bi such that e0 < e1 < · · · < ek and f0 < f1 < · · · < fk . Now φ : {e0 , . . . , ek } → {f0 , . . . , fk }, ei φ = fi , is an isomorphism between two members of B, since by [35] any chain semilattice belongs to B, and thus it extends to φ̂ ∈ Aut(T ) with Ji φ̂ = Ji′ for 0 ≤ i ≤ k.  Since T is countably infinite, Theorem 6.1(2) is now an immediate consequence of Lemma 6.5. 7. The Graham–Houghton graph of J -classes in T In this section we prove part (5) of Theorem 6.1. Since the principal factors of T are all isomorphic to each other, there is (up to isomorphism) only one Graham–Houghton graph Γ = Γ(T ) to investigate. Our aim in this section is to show that Γ is isomorphic to the countable random bipartite graph. This bipartite graph was defined in Subsection 2.2 above. We shall find it useful to make use of the following alternative characterisation of the countable random bipartite graph. Let Γ be a bipartite graph with bipartition V Γ = X ∪· Y . We say Γ satisfies property (⋄) if (1) |X| = |Y | = ℵ0 , (2) for every pair of non-empty finite subsets A and B of X with A ∩ B = ∅ there is a vertex y ∈ Y such that y ∼ a for all a ∈ A, and y 6∼ b for all b ∈ B, and (3) for every pair of non-empty finite subsets C and D of Y with C ∩ D = ∅ there is a vertex x ∈ X such that x ∼ c for all c ∈ C, and y 6∼ d for all d ∈ D. It is easy to see that this is equivalent to the defining property of the countable random bipartite graph given in Subsection 2.2. Thus, any countable bipartite graph satisfying property (⋄) is isomorphic to the random bipartite graph. Throughout, let D be a fixed D-class of T . We use Λ to denote the set of all L -classes of D, while I will stand for the set of R-classes of D. Recall from Subsection 2.7 that Γ = GH(D) has V Γ = I ∪· Λ and edges (i, λ) ∈ EΓ if and only if Hiλ is a group. Our aim is in fact to prove that Γ is has property (⋄), namely: (a) |I| = |Λ| = ℵ0 ; (b) for any non-empty subsets Ω, Σ ⊆ Λ with Ω ∩ Σ = ∅ there exists i ∈ I such that all Hiω (ω ∈ Ω) are groups and none of the Hiσ (σ ∈ Σ) are groups; (c) the dual of (b) with I and Λ interchanged. We will show that property (a) follows from the construction of T . We will prove (b) directly, while we will provide an indirect proof of (c) by showing that T ∼ = T opp and then appeal to (b). Proving (b) relates to the following combinatorial question. Recall that if P is a partition of LOCALLY FINITE MAXIMALLY HOMOGENEOUS SEMIGROUPS 17 A′2 ... A′1 A′k M B1′ ... Bl′ B2′ Figure 2. Illustration of Lemma 7.1. The set Y decomposes into the disjoint union of the shaded part M , the head, and the non-shaded parts A′i and Bi′ , the petals. [m] = {1, 2, . . . , m}, and A is a susbet of [m], we write P ⊥ A to mean that A is a transversal of P . Let A1 , A2 , . . . , Ak , B1 , B2 , . . . , Bl be a family of distinct t-element subsets of [m]. Then one can ask under what conditions on these sets can we guarantee that there is a partition P of [m] into t non-empty parts, such that P ⊥ Ai for all 1 ≤ i ≤ k and P 6⊥ Bj for all 1 ≤ j ≤ l? For example, if the sets Ai , Bj are all pairwise disjoint then it is easy to find such a partition P . More generally, we can give a sufficient condition for such a set P to exist, given by measuring the extent to which the sets Ai , Bj overlap with each other. Lemma 7.1 (Flower Lemma). Let A1 , A2 , . . . , Ak , B1 , B2 , . . . , Bl be a family of distinct telement subsets of [m] with k, l ≥ 1 and t ≥ 2. For each 1 ≤ i ≤ k set A′i = Ai \ (A1 ∪ . . . ∪ Ai−1 ∪ Ai+1 ∪ . . . ∪ Ak ∪ B1 ∪ . . . ∪ Bl ), and for 1 ≤ j ≤ l set Bj′ = Bj \ (A1 ∪ . . . ∪ Ak ∪ B1 ∪ . . . ∪ Bj−1 ∪ Bj+1 ∪ . . . ∪ Bl ). Let Y = A1 ∪ . . . ∪ Ak ∪ B1 ∪ . . . ∪ Bl , let Y ′ = A′1 ∪ . . . ∪ A′k ∪ B1′ ∪ . . . ∪ Bl′ and set M = Y \ Y ′ . If |M | < t then there exists a partition P of [m] into t non-empty parts, such that P ⊥ Ai for all 1 ≤ i ≤ k and P 6⊥ Bj for all 1 ≤ j ≤ l. Proof. We call Y the flower, M the flower head and the sets A′i , Bj′ the petals; see Figure 2. The definitions in the statement decompose the flower into a disjoint union of its head and petals as follows: Y = M ∪· A′1 ∪· . . . ∪· A′k ∪· B1′ ∪· . . . ∪· Bl′ . Since |Ai | = |Bj | = t and |M | < t it follows that each of the petals A′i and Bj′ is non-empty. Note that in general Y could be a proper subset of [m]. We construct a partition P with the desired properties in the following way. Begin with sets P1 , P2 , . . . , Pt all empty. We will describe an algorithm for adding all the elements from [m] to these sets, in such a way as to create non-empty sets P1 , P2 , . . . , Pt defining the required partition P of [m]. (i) Place the elements from M in distinct sets, say P1 , . . . , P|M | . This is possible since t > |M |. (ii) For each 1 ≤ i ≤ k the elements from Ai \ A′i have already been distributed among the Pi , each one in a distinct set. We now add the remaining elements from A′i to the sets Pi in such a way that Ai is a transversal of the sets Pi . This is possible since there are t sets, and |Ai | = t. (iii) For each 1 ≤ j ≤ l, add all of the elements from Bj′ to the classes in such a way that Bj is not a transveral of the family of sets Pi . If Bj′ = Bj , since |Bj | = t ≥ 1 this may done 18 IGOR DOLINKA AND ROBERT D. GRAY by assigning all of the elements to the set P1 . Otherwise, choose b ∈ Bj \ Bj′ and put all of the elements from the non-empty set Bj′ into the unique set Pj which contains b. (iv) Put all of the elements from [m] \ Y into the class P1 . It is now easy to see that the partition P with parts P1 , P2 , . . . , Pt has the property that Ai ⊥ P for all 1 ≤ i ≤ k while P 6⊥ Bj for all 1 ≤ j ≤ l.  The main vehicle for proving (b) above (and thus Theorem 6.1(5)) is the following result about finite full transformation semigroups. Proposition 7.2. Let n ∈ N be such that n ≥ 3 and let 1 < r < n. Then there is an m ∈ N and an embedding φ : Tn → Tm such that for any collection of elements a1 , . . . , ak , b1 , . . . , bl ∈ Dr ⊆ Tn , with k ≥ 1 and l ≥ 1, all coming from distinct L -classes, there exists an element c ∈ Tm such that in Tm we have cDa1 φ and cDb1 φ, and Rc ∩ Lai φ is a group for all 1 ≤ i ≤ k while Rc ∩ Lbj φ is not a group for all 1 ≤ j ≤ l. Proof. Set X = {1, . . . , n}; also, let Y be a finite non-empty set with Y ∩ X = ∅. Define ι : TX → TX∪Y such that αι is given by  zα if z ∈ X, z(αι) = z if z ∈ Y. Note that ι is an injective semigroup homomorphism, and that for any α ∈ TX we have rank(αι) = rank α + |Y |. Fix e ∈ E(Dr ) in TX . Let Re be the R-class of e in TX . Set ε = eι ∈ TX∪Y . The semigroup TX acts on the set Rε ∪ {0} where the action (Rε ∪ {0}) × TX → Rε ∪ {0} is given by  γ(αι) if γ(αι) ∈ Rε , γ ·α = 0 otherwise. Here, γ(αι) is simply a product of two elements of TX∪Y . Using the fact that ι is a homomorphism, it follows easily that this is a right action of TX on Rε ∪ {0}. Set Z = Rε ∪ {0}. The semigroup TX acts on X in the obvious way and it also acts on Z as above; thus TX acts on X ∪· Z. This action gives rise to a homomorphism ψ : TX → TX∪Z where for α ∈ TX the mapping αψ is given by  uα if u ∈ X, u(αψ) = u · α if u ∈ Z = Rε ∪ {0}. The homomorphism ψ is injective since if α, β ∈ TX with α 6= β then there is an x ∈ X with xα 6= xβ. Consequently, x(αψ) 6= x(βψ), so αψ 6= βψ. Lemma 7.3. Let α ∈ Dr ⊆ TX . Then TX∪Y im(αψ) = im α ∪ Hαι ∪ {0}. Proof. The restriction of αψ to X gives Xα = im α. Now consider the set Z(αψ), that is, the image of the set Z = Rε ∪ {0} under αψ. For any q ∈ Rǫ if q(αψ) = q · α 6= 0 then TX∪Y . Therefore Z(αψ) ⊆ H TX∪Y ∪ {0}. q · α = q(αι) ∈ Hαι αι Conversely, since TX∪Y is regular, there is an idempotent f in the R-class of αι in T . Now f (αι) = αι and hence by Green’s Lemma [26, Lemma 2.2.1], in TX∪Y , right multiplication by αι TX∪Y . defines a bijection Lf → Lαι which maps the H -class Rε ∩ Lf bijectively onto the set Hαι TX∪Y ∪ {0} ⊆ Z(αψ). This completes the proof.  Thus Hαι TX∪Y ∩ H TX∪Y = ∅. Claim. Let α, β ∈ Dr ⊆ TX . If (α, β) 6∈ L then Hαι βι Proof of claim. Since TX∪Y is a regular semigroup and TX is a regular subsemigroup of TX∪Y , if (αι, βι) ∈ L it would follow that (α, β) ∈ L (see [26, Proposition 2.4.2]), a contradiction.  LOCALLY FINITE MAXIMALLY HOMOGENEOUS SEMIGROUPS 19 Note that TX∪Y |Hαι | = (rank ε)! = (r + |Y |)! In particular, this can be made arbitrarily large by varying Y . Now choose Y so that (r + |Y |)! > n + 1 and let a1 , . . . , ak , b1 , . . . , bl ∈ Dr ⊆ TX = Tn be as in the statement of Proposition 7.2. Further, let Ai = im ai and Bi = im bi for all i. Set Ci = Hai ι and Di = Hbi ι . By the claim immediately above for any i, j we have Ci ∩ Cj = ∅, Ci ∩ Dj = ∅ and Di ∩ Dj = ∅ whenever the sets are distinct. By Lemma 7.3, we have im(ai ψ) = Ai ∪ Ci ∪ {0}, im(bi ψ) = Bi ∪ Di ∪ {0}, and since all ai and bj are elements of Tn it follows that |A1 ∪ · · · ∪ Ak ∪ B1 ∪ · · · ∪ Bl ∪ {0}| ≤ n + 1. We are now in a position to apply Lemma 7.1. Set Ai = im(ai ψ) = Ai ∪ Ci ∪ {0} for 1 ≤ i ≤ k and Bi = im(ai ψ) = Bi ∪ Di ∪ {0} for 1 ≤ i ≤ l. For i 6= j we have Ci ∩ Cj = ∅, Ci ∩ Dj = ∅ and Di ∩ Dj = ∅, and for all i we have Ci ∩ (A1 ∪ · · · ∪ Ak ∪ B1 ∪ · · · ∪ Bl ∪ {0}) = ∅, and Di ∩ (A1 ∪ · · · ∪ Ak ∪ B1 ∪ · · · ∪ Bl ∪ {0}) = ∅. In the terminology of Lemma 7.1 the sets Ci and Dj are subsets of the petals. Specifically, for all i and j we have Ci ⊆ A′i and Dj ⊆ B′j . Also in the terminology and notation of Lemma 7.1 we have the head of the flower M satisfies M ⊆ A1 ∪ · · · ∪ Ak ∪ B1 ∪ · · · ∪ Bl ∪ {0} and since Ai = im(ai ), Bj = im(bj ) with ai , bj ∈ Dr we have M ⊆ {1, 2, . . . , n} ∪ {0} and so |M | ≤ n + 1. We chose Y so that (r + |Y |)! > n + 1. It follows that |Ai | = |Bi | = r + (r + |Y |)! + 1 > (r + 1) + (n + 1) ≥ (r + 1) + |M | > |M |. So we have a family of subsets Ai , Bj of X ∪ Z all of size |Ai | = |Bi | = r + (r + |Y |)! + 1. such that |Ai | = |Bj | > |M | for all i and j. Thus the conditions of Lemma 7.1 are satisfied. Applying Lemma 7.1 we conclude that there exists a partition P of X ∪ Z into r + (r + |Y |)! + 1 non-empty parts, such that P ⊥ Ai for all 1 ≤ i ≤ k and P 6⊥ Bj for all 1 ≤ j ≤ l. Let c ∈ TX∪Z be a mapping with ker(c) = P . Then we have X = {1, 2, . . . , n} and we have constructed an injective homomorphism ψ : TX → TX∪Z , and found an element c ∈ TX∪Z such that cDa1 ψ and cDb1 ψ and Rc ∩ Lai ψ is a group for all 1 ≤ i ≤ k and Rc ∩ Lbj ψ is not a group for all 1 ≤ j ≤ l. This completes the proof of Proposition 7.2.  7.1. Proof of Theorem 6.1(5). We need to show that the Graham–Houghton graph Γ has property (⋄). For this we need to show that the conditions (a), (b) and (c) all hold. Recall that D is a fixed D-class of T , Λ is the set of all L -classes of D, and I is the set of R-classes of D. The bipartite graph Γ has V Γ = I ∪· Λ and edges (i, λ) ∈ EΓ if and only if Hiλ is a group. Property (a), that |I| = |Λ| = ℵ0 , follows easily from the construction of T . Indeed, since, as already observed, all the principal factors are isomorphic to each other, and T is regular and universal for finite semigroups, every finite right zero semigroup embeds in D and since in any such semigroup all the elements must belong to distinct H -classes it follows that D has infinitely many L -classes. Similarly, since arbitrary finite left zero semigroups embed, D also has infinitely many R-classes. There are countably many in each case since T itself is countable. To prove property (b) we shall apply Proposition 7.2. Let Ω and Σ be disjoint non-empty subsets of Λ. Let α1 , . . . , αk be a transversal of the L -classes Ω, and β1 , . . . , βl be a transversal of 20 IGOR DOLINKA AND ROBERT D. GRAY the L -classes Σ. Since T is a Tn -limit semigroup, there exists a subsemigroup S ≤ T such that S∼ = Tn for some n and with O = {α1 , . . . , αk , β1 , . . . , βl } ⊆ S. Since the elements from the set O all come from distinct L -classes if T and S ≤ T , it follows that the elements from O all belong to distinct L -classes of the semigroup S. Applying Proposition 7.2 to α1 , . . . , αk , β1 , . . . , βl in Tn we conclude that there is an m ∈ N and an embedding ψ : S → Tm such that there exists c ∈ Tm such that in S we have cDα1 ψ, cDβ1 ψ, Rc ∩ Lαi ψ is a group for all 1 ≤ i ≤ k, and Rc ∩ Lβj ψ is not a group for all 1 ≤ j ≤ l. Now by the extension property there exists an embedding θ : Tm → T such that ψθ = idS . Let i0 ∈ I be the index of the R-class of cθ in T . We claim that (b) is satisfied by taking i0 ∈ I. For this, we use the following general fact about periodic semigroups. Lemma 7.4. Let S and T be periodic semigroups and let f : S → T be an embedding. Then T is a group. for all x ∈ S, HxS is a group if and only if Hxf Proof. Since S is periodic, HxS is a group if and only if xk = x for some k > 1. However, since f is an isomorphism between S and Sf , the latter condition holds if and only if (xf )k = xf , T is a group.  which holds if and only if Hxf Applying this lemma it follows that in T we have that Rcθ ∩ Lαi is a group for all 1 ≤ i ≤ k and Rcθ ∩ Lβj is not a group for all 1 ≤ j ≤ l. This completes the proof of (b). To prove (c) it will suffice to show T ∼ = T opp . Recall that from Lemma 2.1 in Subsection 2.4 it follows that for any n ≥ 1 both Tn and Tnopp belong to the class C. Theorem 7.5. Let T be the maximally homogeneous full transformation limit semigroup. Then T ∼ = T opp . S Proof. Upon writing T = j∈N Tj as a union of subsemigroups such that Tj ∼ = Tij for some S opp opp ∼ opp opp where Tj ij we easily conclude that T = j∈N Tj = Tij . Hence, T opp is a direct opp limit of semigroups from B. The semigroup T is also clearly countable and is universal for finite semigroups by the left Cayley Theorem for semigroups. It now follows from Lemma 4.5 that if T opp is B-homogeneous then T opp ∼ = T . We now prove that T opp is B-homogeneous by verifying that it has the B-extension property, which is equivalent to B-homogeneity since T opp is countable. Let S be a finite subsemigroup of T opp with S ∈ B. Then S is a subsemigroup of Tjopp for some j, implying that S opp ∈ B is a subsemigroup of Tj ∼ = Tij . Observe that the domains of S and S opp are equal. Consider an embedding S → U ∈ B; the same mapping is an embedding S opp → U opp ∈ B. Now apply the extension property for T to conclude that there is an embedding U → T , which is the identity mapping when restricted to the set S opp . But now this same map is an embedding U opp → T opp which is the identity mapping when restricted to the set S. This completes the proof.  Condition (c) now follows from (b) by applying Theorem 7.5. Indeed, choose and fix an isomorphism θ : T → T opp . Fix a D-class of T . Since Aut(T opp ) acts transitively on the set of idempotents in T opp , and T opp is regular, we may choose θ so that the image of the set D ⊆ T under θ is equal to the same set D ⊆ T opp . Restricted to the set D the map θ maps E(D) bijectively to E(D) in such a way that for any pair of idempotents e, f we have eRf in T if and only if eθL f θ in T opp , and dually eL f in T if and only if eθRf θ. It follows that the mapping θ induces an automorphism of the Graham–Houghton graph of D which swaps the two parts of the bipartition. The existence of this automorphism, together with the fact that we have already established property (b) for Γ, implies that Γ also satisfies property (c). This completes the proof that Γ is the countable universal homogeneous bipartite graph and thus concludes the proof of Theorem 6.1. Note that one consequence of the argument given in the previous paragraph is the following combinatorial result about finite transformation semigroups, which is the natural left-right dual to Proposition 7.2. LOCALLY FINITE MAXIMALLY HOMOGENEOUS SEMIGROUPS 21 Corollary 7.6. Let n, r ∈ N with n ≥ 3 and 1 < r < n. Let a1 , . . . , ak , b1 , . . . , bl ∈ Dr (where k, l ≥ 1) be representatives of distinct R-classes of Dr ⊆ Tn . Then there exists m ∈ N and an embedding ψ : Tn → Tm such that there is a c ∈ Tm with the property that Rai ψ ∩ Lc is a group for all i and Rbj ψ ∩ Lc is not a group for all j. It is not obvious how we would prove this corollary directly and combinatorially (i.e. how to find m, ψ and c) except by going via the argument above which uses the isomorphism T ∼ = T opp . It relates to the following general combinatorial problem: Let P1 , P2 , . . . , Pk , Q1 , Q2 , . . . , Ql be a family of distinct partitions of [m] = {1, 2, . . . , m} each with exactly t non-empty parts. Under what conditions on these partitions can one guarantee that there is a t-element subset A of [m] such that A ⊥ Pi for all 1 ≤ i ≤ k and A 6⊥ Qj for all 1 ≤ j ≤ l? 7.2. The principal factors of T . We have seen that all the principal factors of T are isomorphic to each other, and that their Graham–Houghton graphs are isomorphic to the countable random bipartite graph. Let J be a fixed J -class of T . We do not currently have any characterisation of the principal factor J ∗ . Since T is locally finite, and T is regular, it follows that J ∗ is a completely 0-simple semigroup. If CS is the class of all finite completely 0-simple semigroups then (CS, ⊑) is an amalgamation class, in the sense of Theorem 4.1, where ⊑ denotes the subsemigroup relation restricted to semigroups from CS. This is straightforward to prove by combining results from [28] with [4, Theorem 4]. The class CS also clearly satisfies (N1)–(N3) and from this, combined with Theorem 4.1 the following result readily follows. Theorem 7.7. Up to isomorphism, there is a unique countable universal CS-homogeneous completely 0-simple semigroup S. Problem 1. Is it true that every principal factor of T is isomorphic to the semigroup S? 7.3. The right and left ideal structure of T . We have seen that the J -classes of T have order type (Q, ≤). For I we proved that the semilattice of idempotents is isomorphic to the countable universal homogeneous semilattice. Since I is an inverse semigroup it follows that both I/R and I/L are also isomorphic to the countable universal homogeneous semilattice. It is reasonable to ask whether either or both of the posets (T /R, ≤R ) or (T /L , ≤L ) admit a similar nice description in terms of homogeneous structures. First of all, since T ∼ = T opp , we ∼ have a poset isomorphism (T /L , ≤L ) = (T /R, ≤R ). One natural guess might have been that this is the countable generic partially ordered set, that is, the Fraı̈ssé limit of the class of finite partially ordered sets. The same could be conjectured for the Rees order of idempotents of T , (E(T ), ≤), defined by e ≤ f if and only if ef = f e = e. These conjectures turn out not to be true. Namely, we have: Proposition 7.8. Neither (T /L , ≤L ) nor (E(T ), ≤) is isomorphic to the countable universal homogeneous poset. Proof. Since T is universal we can find distinct e, f, g ∈ E(T ) with ef = f e = g (i.e. a copy of V3 , the non-chain 3-element semilattice, in T ). Then ge = g = gf , so Lg < Le , Lg < Lf and Le k Lf . Now suppose, for the sake of a contradiction, that P = (S/L , ≤L ) is isomorphic to the countable universal homogeneous poset. It follows from [1, Axiom 1 φ20 ] that there is an element h ∈ E(T ) such that Lh ≤ Le , Lh ≤ Lf and Lh k Lg . If we had such an h then h ≤L e would imply he = h and similarly we would conclude hf = h. It would follow hg = hef = hf = h, that is h ≤L g, a contradiction. This argument easily adapts to the Rees order of idempotents of T .  We currently do not know a good characterisation of the poset (T /L , ≤L ). It may be shown that this poset has the following properties: (i) it is universal, (ii) it is dense and without minimal or maximal elements, and (iii) Aut(T ) acts transitively on finite chains of L -classes. It may also be shown that the Rees order of E(T ) has the properties analogous to (i)–(iii). Problem 2. Give descriptions of the posets (T /L , ≤L ) and (E(T ), ≤). Are they isomorphic to restricted Fraı̈ssé limits of some kind, in the sense of Theorem 4.1? 22 IGOR DOLINKA AND ROBERT D. GRAY 8. Subsemigroups of T and I In the main results above, Theorems 5.1 and 6.1, we saw that I embeds every finite inverse semigroup, and T embeds every finite semigroup. As mentioned in the introduction above, Hall’s group U not only embeds every finite group, but also embeds every countable locally finite group. Given this, it is natural to ask: which semigroups embed into T , and which inverse semigroups embed into I? These are more difficult questions than the corresponding question for U . We shall discuss the problem for T . The situation for I is similar. Every subsemigroup of T is of course countable and locally finite. We do not know whether the converse is true. Problem 3. Does every countable locally finite semigroup embed into T ? S Let S be a countably infinite locally finite semigroup. We can write S = i≥0 Si where the Si are distinct finite subsemigroups of S with Si ⊆ Si+1 for all i. Since each Si is finite we know that for each i ≥ 0 there is an embedding φi : Si → T . If each Si belonged to the class B then using the extension property from Theorem 4.1 it is not hard to see that the embeddings φi could be chosen in such a way that for each i, the map φi : Si → T is the restriction of φi+1 : Si+1 → T . In this way the union of the maps φi for i ≥ 0 would define an embedding of S into T . Let us say that a semigroup S is a B-limit semigroup if S is the direct limit of a countable chain of embeddings of distinct finite semigroups S0 → S1 → S2 → . . . where Si ∈ B for all i ≥ 0. The above discussion shows that every B-limit semigroup embeds into T . Of course, more generally, any subsemigroup of a B-limit semigroup embeds into T . This leads to the following straightforward result. Proposition 8.1. Let S be a countably infinite semigroup. The following are equivalent: (1) S embeds into T ; (2) S embeds into some Tn -limit semigroup; (3) S embeds into some B-limit semigroup. Proof. Since T is a Tn -limit semigroup, and since Tn ∈ B for all n, it follows that (1) implies (2) and that (2) implies (3). The fact that (3) implies (1) follows from the discussion preceding the statement of the proposition.  By Cayley’s Theorem every finite semigroup embeds into some finite full transformation semigroup. From above we are led to the following related question: Problem 4. Is every countable locally finite semigroup isomorphic to a subsemigroup of some full transformation limit semigroup? Related to the question of which semigroups embed into T , more generally we do not know the answer to the following very natural question: Problem 5. Does there exist a countable semigroup which embeds every countable locally finite semigroup? For the inverse semigroup I the obvious analogue of Proposition 8.1 holds, and we have the corresponding open questions. Problem 6. Does every countable locally finite inverse semigroup embed into I? 9. The semigroups Cn and Vn As explained in the introduction, P. Hall’s universal group in not only an Sn -limit group, but it can be expressed as an Sn -limit in a particularly nice way via successive embeddings arising from repeated application of Cayley’s Theorem. It is natural to look for correspondingly nice descriptions of T as a Tn -limit semigroup, and of I as a In -limit inverse semigroup. We LOCALLY FINITE MAXIMALLY HOMOGENEOUS SEMIGROUPS 23 currently do not know of any such nice descriptions. The purpose of this section is to explain why the obvious approach of trying to obtain T by repeated iteration of Cayley’s Theorem for semigroups does not work, and the corresponding observation for I. Fix a natural number n. Let S0 = Tn and then define the directed chain of full transformation semigroups S0 → S1 → S2 → . . . where for each i ≥ 0 we have Si+1 = TSi and the embeddings are given in each case by taking the right regular representation. We use Cn to denote the direct limit of this chain of semigroups. It is easy to see that for all natural numbers n the semigroup Cn is a monoid. On the other hand, the semigroup T is not a monoid. Indeed, since T is universal it contains at least two distinct idempotents. Also, since Aut(T ) acts transitively on members of B in T it follows that Aut(T ) acts transitively on the set of idempotents E(T ) of T . This would be impossible if T were a monoid, since any automorphism of a monoid must clearly fix its identity element. Therefore T cannot be isomorphic to Cn for any value of n. However, there is a natural monoid analogue T ′ of the semigroup T with the same definition but working in the category of monoids, and working with submonoids. One could then ask whether or not T ′ and Cn are isomorphic for some value of n. In a similar way as for the semigroup T , one may show that every maximal subgroup of T ′ is isomorphic to Hall’s universal homogeneous group. We shall now show that this is not true of the semigroup Cn , and thus T ′ and Cn cannot be isomorphic. To this end, let S = Tn and let ψ : S → TS be the right regular representation map where αψ = ρα . For any α ∈ Tn set fix α = {i ∈ [n] : iα = i} and fix ρα = {γ ∈ Tn : γα = γ}. For any α ∈ Tn we have fix ρα = {γ ∈ Tn : im γ ⊆ fix α}. This is because γα = γ holds if and only if α acts as the identity on im γ, that is, im γ ⊆ fix α. The size of the set fix ρα is of course just the number of maps from an n-element set into a set of size | fix α|. From this it immediately follows that if | fix α| < | fix β| then | fix ρα | < | fix ρβ |. Now suppose 1 < r < n and r ≥ 5. Fix an idempotent   1 2 3 ··· r r + 1 ··· n e= . 1 2 3 ··· r r ··· r Fix two elements of order two in the maximal subgroup He defined as follows:    1 2 3 4 ··· r r + 1 ··· n 1 2 3 4 5 ··· r r + 1 ··· α= , β= 2 1 3 4 ··· r r ··· r 2 1 4 3 5 ··· r r ···  n . r We use the shorthand α = (12) and β = (12)(34) for these elements of the maximal subgroup He . The elements α and β both have order 2, but they are not conjugate in He since they have a different number of fixed points. By the observations above, αψ and βψ are two elements in the H -class Heψ of TTn both of order two, but they are not conjugate in Heψ since they have different numbers of fixed points. Repeating this argument, we conclude that for every i ≥ 1 the images of the elements α and β under the embeddings S0 → . . . → Si are not conjugate inside the unique maximal subgroup of Si to which they both belong. It follows that the elements that α and β represent in Cn both have order two, but are not conjugate in the maximal subgroup of Cn to which they belong. But in Hall’s group any two elements of order two are conjugate to each other. It follows that the maximal subgroup of Cn containing e ∈ S0 ⊆ Cn is not isomorphic to Hall’s group. This argument can easily be extended to prove the same result starting with any e ∈ S0 = Tn of rank r, where 2 ≤ r ≤ n − 1. Thus for all n ≥ 2 the semigroup Cn is not isomorphic to the universal maximally homogeneous locally finite monoid T ′ . An easy adaptation of the above argument can be used to prove that the inverse semigroup Vn is never isomorphic to the universal locally finite maximally homogeneous inverse monoid I ′ We do not know much about the semigroups Cn and Vn . 24 IGOR DOLINKA AND ROBERT D. GRAY Problem 7. Do we have Cn ∼ = Cm for all n, m ≥ 1? We ask the same question for Vn . It is not too hard to prove that for any n ≥ 2, both (Cn /J , ≤) and (Vn /J , ≤) are isomorphic to 1 + Q + 1. Also, the ideas in the proof of Theorem 5.1(4) suffice to prove that the semilattice (E(Vn ), ≤) satisfies condition (∗) in part (iii) of Theorem 5.5. However, E(Vn ) does have unique maximal and minimal idempotents. By applying results and arguments from [9], [1] and [12, pages 33-34] it may be shown that E(Vn ) is isomorphic to any nontrivial interval in Ω, which in turn is isomorphic to the countable universal homogeneous semilattice monoid with zero. Acknowledgements. This work was supported by the London Mathematical Society Research in Pairs (Scheme 4) grant “Universal locally finite partially homogeneous semigroups and inverse semigroups” (Ref: 41530), to fund a 9-day research visit of the first named author to the University of East Anglia (Summer 2016). The research of I. Dolinka was supported by the Ministry of Education, Science, and Technological Development of the Republic of Serbia through the grant No.174019. This research of R. D. Gray was supported by the EPSRC grant EP/N033353/1 “Special inverse monoids: subgroups, structure, geometry, rewriting systems and the word problem”. The authors would like to thank the anonymous referee for their helpful comments, and also to thank the handling editor of the paper Manfred Droste whose comments led to the questions that are now posed in Section 8. References [1] M. H. Albert and S. N. Burris. Finite axiomatizations for existentially closed posets and semilattices. Order, 3(2):169–178, 1986. [2] P. J. Cameron and S. Tarzi. Limits of cubes. Topology Appl., 155(14):1454–1461, 2008. [3] O. Caramello. Topological Galois theory. Adv. Math., 291:646–695, 2016. [4] G. T. Clarke. On completely regular semigroup varieties and the amalgamation property. In Semigroups (Proc. Conf., Monash Univ., Clayton, 1979), pages 159–165. Academic Press, New York-London, 1980. [5] A. H. Clifford and G. B. Preston, The Algebraic Theory of Semigroups, Vol. II. Mathematical Surveys, No. 7. American Mathematical Society, Providence, R.I., 1961. [6] M. Dalle Molle. Sylow subgroups which are maximal in the universal locally finite group of Philip Hall. J. Algebra, 215(1):229–234, 1999. [7] S. Donkin. K0 of Hall’s universal group. J. Algebra, 306(1):47–61, 2006. [8] M. Doucha. Universal actions of locally finite groups on metric and Banach spaces by isometries. arXiv:1612.09448, 2016. [9] M. Droste. Finite axiomatizations for universal domains. J. Logic Comput., 2(2):119–131, 1992. [10] M. Droste and R. Göbel. A categorical theorem on universal objects and its application in abelian group theory and computer science. In Proceedings of the International Conference on Algebra, Part 3 (Novosibirsk, 1989), volume 131 of Contemp. Math., pages 49–74. Amer. Math. Soc., Providence, RI, 1992. [11] M. Droste and R. Göbel. Universal domains and the amalgamation property. Math. Structures Comput. Sci., 2:137–159, 1993. [12] M. Droste, D. Kuske, and J. K. Truss. On homogeneous semilattices and their automorphism groups. Order, 16(1):31–56 (2000), 1999. [13] D. Evans. Homogeneous structures, omega-categoricity and amalgamation constructions. Lecture notes from talks given at the Hausdorff Institute for Mathematics (Bonn, September 2013). (Available online at: wwwf.imperial.ac.uk/∼dmevans/Bonn2013 DE.pdf). [14] R. L. Graham. On finite 0-simple semigroups and graph theory. Math. Systems Theory, 2:325–339, 1968. [15] P. Hall. Some constructions for locally finite groups. J. London Math. Soc., 34:305–319, 1959. [16] T. E. Hall. Free products with amalgamation of inverse semigroups. J. Algebra, 34:375–385, 1975. [17] T. E. Hall. Representation extension and amalgamation for semigroups. Quart. J. Math. Oxford Ser. (2), 29(115):309–334, 1978. [18] T. E. Hall. Finite inverse semigroups and amalgamation. In Semigroups and their applications (Chico, Calif., 1986), pages 51–56. Reidel, Dordrecht, 1987. [19] T. E. Hall and M. S. Putcha. The potential J -relation and amalgamation bases for finite semigroups. Proc. Amer. Math. Soc., 95(3):361–364, 1985. [20] T. E. Hall and K. Shoji. Finite bands and amalgamation bases for finite semigroups. Comm. Algebra, 30(2):911–933, 2002. [21] B. Hartley. Simple locally finite groups. In Finite and locally finite groups (Istanbul, 1994), volume 471 of NATO Adv. Sci. Inst. Ser. C Math. Phys. Sci., pages 1–44. Kluwer Acad. Publ., Dordrecht, 1995. LOCALLY FINITE MAXIMALLY HOMOGENEOUS SEMIGROUPS 25 [22] K. Hickin. Universal locally finite central extensions of groups. Proc. London Math. Soc. (3), 52(1):53–72, 1986. [23] W. Hodges. A shorter model theory. Cambridge University Press, Cambridge, 1997. [24] C. H. Houghton. Completely 0-simple semigroups and their associated graphs and groups. Semigroup Forum, 14(1):41–67, 1977. [25] J. M. Howie. The subsemigroup generated by the idempotents of a full transformation semigroup. J. London Math. Soc., 41:707–716, 1966. [26] J. M. Howie. Fundamentals of semigroup theory, volume 12 of London Mathematical Society Monographs. New Series. The Clarendon Press, Oxford University Press, New York, 1995. [27] E. Hrushovski. A new strongly minimal set. Ann. Pure Appl. Logic, 62(2):147–166, 1993. Stability in model theory, III (Trento, 1991). [28] T. Imaoka. Free products with amalgamation of semigroups,. PhD Thesis, Monash University, Clayton, 1977. [29] O. H. Kegel and B. A. F. Wehrfritz. Locally finite groups. North-Holland Publishing Co., Amsterdam-London; American Elsevier Publishing Co., Inc., New York, 1973. [30] N. V. Kroshko and V. I. Sushchansky. Direct limits of symmetric and alternating groups with strictly diagonal embeddings. Arch. Math. (Basel), 71(3):173–182, 1998. [31] M. V. Lawson. Inverse semigroups: The theory of partial symmetries. World Scientific Publishing Co., Inc., River Edge, NJ, 1998. [32] F. Leinen and O. Puglisi. Some results concerning simple locally finite groups of 1-type. J. Algebra, 287(1):32– 51, 2005. [33] D. Macpherson. A survey of homogeneous structures. Discrete Math., 311(15):1599–1634, 2011. [34] U. Meierfrankenfeld. Locally finite, simple groups. Lecture notes for the course “Group Theory II” given at the Michigan State University, 107 pp., East Lansing, MI, 1997. (Available online at: www.math.msu.edu/∼meier/Classnotes/LFG/LFG.pdf). [35] J. Okniński and M. S. Putcha. Embedding finite semigroup amalgams. J. Austral. Math. Soc. Ser. A, 51(3):489–496, 1991. [36] G. Paolini and S. Shelah. The automorphism group of Hall’s Universal Group. arXiv:1703.10540, 2017. [37] D. J. S. Robinson. A course in the theory of groups. Graduate Texts in Mathematics, 80. Springer-Verlag, New York-Berlin, 1982. [38] I. Samet. Rigid actions of amenable groups. Israel J. Math., 173:61–90, 2009. [39] K. Shoji. The full transformation semigroups of finite rank are amalgamation bases for finite semigroups. Comm. Algebra, 44(8):3278–3289, 2016. [40] S. Thomas and R. Tucker-Drob. Invariant random subgroups of strictly diagonal limits of finite symmetric groups. Bull. Lond. Math. Soc., 46(5):1007–1020, 2014. Department of Mathematics and Informatics, University of Novi Sad, Trg Dositeja Obradovića 4, 21101 Novi Sad, Serbia E-mail address: [email protected] School of Mathematics, University of East Anglia, Norwich NR4 7TJ, England, UK E-mail address: [email protected]
4math.GR
Popular Matchings with Lower Quotas Meghana Nasre1 and Prajakta Nimbhorkar2 1 2 Indian Institute of Technology, Madras, India ([email protected]) Chennai Mathematical Institute, India ([email protected]) arXiv:1704.07546v2 [cs.DS] 26 Apr 2017 Abstract We consider the well-studied Hospital Residents (HR) problem in the presence of lower quotas (LQ). The input instance consists of a bipartite graph G = (R∪H, E) where R and H denote sets of residents and hospitals respectively. Every vertex has a preference list that imposes a strict ordering on its neighbors. In addition, each hospital h has an associated upper-quota q + (h) and lower-quota q − (h). A matching M in G is an assignment of residents to hospitals, and M is said to be feasible if every resident is assigned to at most one hospital and a hospital h is assigned at least q − (h) and at most q + (h) residents. Stability is a de-facto notion of optimality in a model where both sets of vertices have preferences. A matching is stable if no unassigned pair has an incentive to deviate from it. It is well-known that an instance of the HRLQ problem need not admit a feasible stable matching. In this paper, we consider the notion of popularity for the HRLQ problem. A matching M is popular if no other matching M 0 gets more votes than M when vertices vote between M and M 0 . When there are no lower quotas, there always exists a stable matching and it is known that every stable matching is popular. We show that in an HRLQ instance, although a feasible stable matching need not exist, there is always a matching that is popular in the set of feasible matchings. We give an efficient algorithm to compute a maximum cardinality matching that is popular amongst all the feasible matchings in an HRLQ instance. Digital Object Identifier 10.4230/LIPIcs... 1 Introduction In this paper we consider the Hospital Residents problem in the presence of Lower Quotas (HRLQ). The input to our problem is a bipartite graph G = (R∪H, E) where R denotes the set of residents, and H denotes the set of hospitals. Every resident as well as hospital has a non-empty preference ordering over a subset of elements of the other set. Every hospital h ∈ H has a non-zero upper-quota q + (h) denoting the maximum number of residents that can be assigned to h. In addition, every hospital h also has a non-negative lower-quota q − (h) denoting the minimum number of residents that have to be assigned to h. The goal is to assign residents to hospitals such that the upper and lower quotas of all the hospitals are respected (that is, it is feasible) as well as the assignment is optimal with respect to the preferences of the participants. I Definition 1. A feasible matching M in G = (R ∪ H, E) is a subset of E such that |M (r)| ≤ 1 for each r ∈ R and q − (h) ≤ |M (h)| ≤ q + (h) for each h ∈ H, where M (v) is the set of neighbors of v in M . Stability is a de-facto notion of optimality in settings where both sides have preferences. A matching M (not necessarily feasible) is said to be stable if there is no blocking pair with respect to M . A resident-hospital pair (r, h) blocks M if r is unmatched in M or prefers h over M (r), and either |M (h)| < q + (h) or h prefers r over at least one resident in M (h). licensed under Creative Commons License CC-BY Leibniz International Proceedings in Informatics Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany XX:2 Popular Matchings with Lower Quotas There are simple instances of the HRLQ problem where there is no feasible matching that is stable. We give an example here: Let R = {r}, H = {h1 , h2 }, q + (h1 ) = q + (h2 ) = 1, q − (h1 ) = 0, and q − (h2 ) = 1. Let preference list of r be hh1 , h2 i. That is, r prefers h1 over h2 . The only stable matching here is M1 = {(r, h1 )} which is not feasible as |M1 (h2 )| < q − (h2 ). On the other hand, the only feasible matching M2 = {(r, h2 )} is not stable as (r, h1 ) is a blocking pair with respect to M2 . This raises the question, given an HRLQ instance G, does G admit a feasible stable matching? This can be answered by constructing an HR instance G+ by disregarding the lower quotas of all hospitals in G. It is well-known that the Gale-Shapley algorithm [5] computes a stable matching M in G+ . Furthermore, from the “Rural Hospitals Theorem" it is known that, in every stable matching of G+ , each hospital is matched to the same capacity [6, 16]. Thus G admits a stable feasible matching if and only if M is feasible for G. The HRLQ problem is motivated by practical scenarios like assigning medical interns (residents) to hospitals. While matching residents to hospitals, rural hospitals often face the problem of being understaffed with residents, for example the National Resident Matching Program in the US [3, 15, 16]. In such real-world applications declaring that there is no feasible stable matching is simply not a solution. On the other hand, any feasible matching that disregards the preference lists completely is socially unacceptable. We address this issue by relaxing the requirement of stability by an alternative notion of namely popularity. Our output matching M has two desirable criteria – firstly, it is a feasible matching in the instance, assuming one such exists, and hence no hospital remains understaffed. Secondly, the matching respects preferences of the participants, in particular, no majority of participants wish to deviate to another feasible matching in the instance. Our contribution: We consider the notion of popularity for the HRLQ problem. Popularity is a relaxation of stability and can be interpreted as overall stability. We define it formally in Section 2. In this work, we present an efficient algorithm for the following two problems in an HRLQ instance. 1. Computing a maximum cardinality matching popular in the set of feasible matchings. We give an O(|R|(|E| + |H|)) time algorithm for this problem. 2. Computing a popular matching amongst maximum cardinality feasible matchings. We give an O(|R|2 (|E| + |H|)) time algorithm for this problem. Our algorithms are based on ideas introduced in earlier works on stable marriage (SM) and HR problems[11, 3, 14]. However, in SM and HR problem, a popular matching is guaranteed to exist because a stable matching always exists and it is also popular. On the other hand, in the HRLQ setting even a stable matching may not exist. Yet, we prove that a feasible matching that is popular amongst all feasible matchings always exists and is efficiently computable. We believe that this is not only surprising but also a useful result in practical scenarios. Moreover, our notion of popularity subsumes the notions proposed in [3] and [14] and is more general than both. In [3], popularity is proved using linear programming, but our proofs for popularity are combinatorial. Overview of the algorithm: Our algorithms are reductions, that is, given an HRLQ instance G, both our algorithms construct instances G0 and G00 of the HR problem such that there is a natural way to map a stable matching in G0 (respectively, G00 ) to a feasible matching in G. Moreover, any stable matching in G0 (G00 ) gets mapped to a maximum cardinality matching that is popular amongst all the feasible matchings in G (respectively, a matching that is popular amongst all maximum cardinality matchings in G). Organization of the paper: We define the notion of popularity in Section 2. The reduction for computing a maximum cardinality popular matching amongst feasible matchings is given Meghana Nasre and Prajakta Nimbhorkar in Section 3 and its correctness is proved in Section 4. Finally, Section 5 describes the reduction for computing a matching that is popular amongst maximum cardinality feasible matchings and its correctness. Related work: The notion of popularity was first proposed by Gärdenfors [7] in the stablemarriage (SM) setting, where each vertex has capacity 1, and have been well-studied since then [2, 10, 11, 9, 4, 12]. A linear-time algorithm to compute a maximum cardinality popular matching in an HR instance is given in [3] and [14] with different notions of popularity. Furthermore, for the SM and HR problem, it is known that a matching that is popular amongst the maximum cardinality matchings exists and can be computed in O(mn) time [11, 14]. The reductions in our paper are inspired by the work of [3, 4, 11, 14]. In all these earlier works, the main idea is to execute Gale and Shapley algorithm on the HR instance and then allow unmatched residents to propose with increased priority [11] certain number of times. As mentioned in [11], this idea was first proposed in [13]. The HRLQ problem has been recently considered in [1] and [8] in different settings. 2 Notion of Popularity The notion of popularity uses votes from vertices to compare two matchings. For r ∈ R, and any matching M in G, if r is unmatched in M then, M (r) = ⊥. A vertex prefers any of its neighbours over ⊥. For a vertex u ∈ R ∪ H, let x, y ∈ N (u) ∪ {⊥}, where N (u) denotes the neighbours of u in G. We define voteu (x, y) = 1 if u prefers x over y, −1 if u prefers y over x and 0 if x = y. Given two matchings M1 and M2 in the instance, for a resident r ∈ R, we define voter (M1 , M2 ) = voter (M1 (r), M2 (r)). Voting for a hospital: A hospital h is assigned q + (h)-many votes to compare two matchings M1 and M2 ; this can be viewed as one vote per position of the hospital. If a position is not filled in a matching, we put a ⊥ there, so that |M1 (h)| = |M2 (h)| = q + (h). In our voting scheme, the hospital h is indifferent between M1 and M2 as far as its |M1 (h) ∩ M2 (h)| positions are concerned. To compare between the two sets of residents M1 (h)\M2 (h) and M2 (h)\M1 (h), a hospital can decide any pairing of the elements of these two sets. We denote this correspondence by corrh . Under this correspondence, for a resident r ∈ M1 (h) \ M2 (h), corrh (r, M1 , M2 ) is the resident in M2 (h) \ M1 (h) corresponding to r. We define voteh (M1 , M2 ) = X voteh (r, corrh (r, M1 , M2 )) r∈M1 (h)\M2 (h) A hospital h prefers M1 over M2 if voteh (M1 , M2 ) > 0. We can now define popularity. I Definition 2. A matching M1 is more popular than M2 (denoted as M1  M2 ) if P P v∈R∪H votev (M1 , M2 ) > v∈R∪H votev (M2 , M1 ). A matching M is popular if there is no matching M 0 such that M 0  M . There are several ways for a hospital to define the corr function. For example, a hospital h may decide to order and compare the two sets in the decreasing order of preferences (as in [14] or in the most adversarial order (as in [3]). That is, the order due to which h gives the least votes to M1 when comparing it with M2 . We believe that our definition offers flexibility to hospitals to compare residents in M1 (h) \ M2 (h) and M2 (h) \ M1 (h) according to their custom designed criteria. Decomposing M ⊕ M 0 : In the one-to-one setting, where M ⊕ M 0 for any two matchings M and M 0 is a collection of vertex-disjoint paths and cycles. Our setting is many-to-one XX:3 XX:4 Popular Matchings with Lower Quotas and hence M ⊕ M 0 has a more complex structure. Here, we recall a simple algorithm to decompose edges of M ⊕ M 0 into (possibly non-simple) alternating paths and cycles from [14]. Consider the graph G̃ = (R ∪ H, M ⊕ M 0 ), for any two feasible matchings of the HRLQ instance. We note that the degree of every resident in G̃ is at most 2 and the degree of every hospital in G̃ is at most 2 · q + (h). Consider any connected component C of G̃ and let e ∈ M be any edge in C. We show how to construct a unique maximal M -alternating path or cycle ρ containing e: Start with ρ = hei. Use the following inductive procedure. 1. Let r ∈ R be one end-point of ρ, and let (r, M (r)) ∈ ρ. We grow ρ by adding the edge (r, M 0 (r)). Similarly if (r, M 0 (r)) ∈ ρ, add (r, M (r)) to ρ. 2. Let h ∈ H be an end-point of ρ, and let the last edge (r, h) on ρ be in M \ M 0 . We extend ρ by adding corrh (r, M, M 0 ) if is not equal to ⊥. A similar step is performed if the last edge on ρ is (r, h) ∈ M 0 \ M . 3. We stop the procedure when we complete a cycle (ensuring that the two adjacent residents of a hospital are corr for each other according to the hospital), or the path can no longer be extended. Otherwise we go to Step 1 or Step 2 as applicable and repeat. Labels on edges: While comparing a matching M1 with another matching M2 , the voting scheme induces a label on edges of M2 with respect to M1 . Let (r, h) ∈ M2 . The label of (r, h) is (a, b) where a = voter (M1 (r), M2 (r)) and b = voteh (corrh (r, M2 , M1 ), r). Thus a, b ∈ {−1, 1}. 3 Reduction to HR problem In this section we present our reduction from an HRLQ instance G = (R ∪ H, E) to an HR instance G0 = (R0 ∪ H0 , E 0 ). To compute a largest size feasible matching that is popular amongst all feasible matchings, we compute a stable matching M 0 in G0 . We show that there is a natural map from any stable matching M 0 in G0 to a feasible matching M in G. Before we describe the reduction in detail, we provide some intuition. Our reduction simulates the following algorithm: Execute the hospital-proposing Gale-Shapley algorithm on G by disregarding lower quotas of all hospitals. Let M0 be a matching obtained. If some hospitals are under-subscribed1 in M0 , they apply with increased priority to residents (in order of preference) and a new matching M1 is obtained. If there are deficient hospitals in M1 , they again apply with an even higher priority. This process is repeated until there is no deficient hospital. This is achieved by reducing G to an HR instance G0 described below: We first describe the vertices in G0 . The set H0 : For each hospital h ∈ H we have ` copies h0 , . . . , h`−1 of h in H0 . Here P ` = 2 + h∈H q − (h). We need to define the capacities2 of all hospitals h ∈ H0 (recall G0 is an HR instance, so we do not have lower quotas for h ∈ H0 ). The hospitals in H0 and their capacities are as described below: H0 Capacities of h ∈ H0 : q + (hs ) + s q (h ) 1 2 = {h0 , . . . , h`−1 | h ∈ H} = q + (h), − = q (h), s ∈ {0, 1} s ∈ {2, . . . , ` − 1} We say that a hospital is under-subscribed in a matching M if |M (h)| < q + (h) and is deficient if |M (h)| < q − (h) We use the term capacity for the hospitals in an HR instance whereas the term quota for hospitals in an HRLQ instance. Meghana Nasre and Prajakta Nimbhorkar XX:5 We call hospital hs ∈ H0 a level-s copy of h. Note that if h ∈ H has zero lower-quota, then h1 , . . . , h`−1 have zero capacity in H0 . For a hospital h ∈ H, we denote by qh the sum of the capacities of all level copies of h in G0 . The following observation is immediate. I Observation 1. For a hospital h ∈ H, the sum of capacities of all level copies of h in G0 is qh = 2 · q + (h) + (` − 2) · q − (h). The set R0 : The set of residents R0 consists of the set R along with a set of dummy residents Dh corresponding to every hospital h ∈ H. The set R0 and Dh are as defined below: ! [ [ 0 Dhs R = R∪ Dh where Dh = ∀h ∈ H h∈H Here and Dhs Dhs = = {dsh,1 , . . . , dsh,q+ (h) }, {dsh,1 , . . . , dsh,q− (h) }, s∈{0,...,`−2} s ∈ {0, 1} s ∈ {2, . . . , ` − 2} We refer to Dh as dummy residents corresponding to h and Dhs as level-s dummy residents corresponding to h. For h ∈ H, if q − (h) = 0, then Dhs = ∅ for each s ∈ {2, . . . , ` − 1}. The following observation captures the number of dummy residents corresponding to every hospital h ∈ H. I Observation 2. For a hospital h ∈ H, the total number of dummy residents corresponding h in R0 is |Dh | = 2 · q + (h) + (` − 3) · q − (h). Preference lists: We denote by hlistr i and hlisth i the preference lists of r and h in G respectively. Furthermore, hDhs i denotes the strict list consisting of elements of Dhs in increasing order of indices. Finally, ◦ denotes the concatenation of two lists. We now describe the preferences of hospitals and residents in G0 . Hospitals’ preference lists: Consider a hospital hs ∈ H0 for s ∈ {1, . . . , ` − 2} and let q denote the capacity of hs . The preference list of hs is of the form: q-dummy residents of level-(s − 1), followed by preference list of h in G, followed by q dummy residents of level-s. For h0 , the preference list is the preference list of h in G followed by capacity many dummy residents of level-0. Finally, for h`−1 , there are dummy residents of level-(` − 2) followed by preference list of h in G. For hs ∈ H0 , s=0 : s=1 : s=2 : s ∈ {3, 4, . . . , ` − 2} : s=`−1 : hlisth i ◦ hDh0 i hDh0 i ◦ hlisth i ◦ hDh1 i hd1h,k , . . . , d1h,q+ (h) i ◦ hlisth i ◦ hDh2 i, hDhs−1 i ◦ hlisth i ◦ hDhs i (`−2) hDh i ◦ hlisth i k = q + (h) − q − (h) + 1 Residents’ preference lists: For r ∈ R For h ∈ H, dsh,i ∈ Dh s=0 s = 1, i ∈ {1, . . . , q + (h) − q − (h)} s = 1, i ∈ {q + (h) − q − (h) + 1, . . . , q + (h)} s ∈ {2, . . . , ` − 2} 3.1 : : : : : : hlistr i`−1 ◦ hlistr i`−2 ◦ . . . ◦ hlistr i0 hh0 , h1 i hh1 i hh1 , h2 i hhs , hs+1 i Properties of the stable matching M 0 in G0 With respect to a stable matching M 0 in G0 we introduce the following definitions. XX:6 Popular Matchings with Lower Quotas I Definition 3. Level-s resident: A non-dummy resident r ∈ R0 is said to be at level-s in M 0 if r is matched to a level-s hospital in M 0 . Let R0s denote the set of level-s residents. I Definition 4. Active hospital: A hospital hs is said to be active in M 0 if M 0 (hs ) contains at least one non-dummy resident. Otherwise, (when all positions of hs are matched to dummy residents), hs is said to be inactive. In the following lemma, we state some invariants for any stable matching M 0 in G0 . These invariants allow us to define a natural map from M 0 to a matching M in G, and to show that M is feasible as well as popular among feasible matchings. 1. 2. 3. 4. 5. I Lemma 5. The following hold for any stable matching M 0 in G0 : For any h ∈ H, M 0 matches at most q + (h) non-dummy residents across all its level copies in G0 . The matching M 0 in G0 leaves only the level-(` − 1) copy of any hospital (if it exists) under-subscribed. Let hs ∈ H0 be active in M 0 . Then, a. At least one position of hs−1 is matched in M 0 to a dummy resident at level-(s − 1). b. For 0 ≤ j ≤ s − 2, hj is inactive in M 0 and all positions of hj are matched to dummy residents of level-(j). c. For s + 2 ≤ j ≤ ` − 1, hj is inactive in M 0 and all positions of hj are matched to dummy residents of level-(j − 1). For any h ∈ H, at most two consecutive level copies hs and hs+1 are active in M 0 . A level-s resident r in M 0 does not have any hospital h in its preference list which is active at level-(s + 2) or more in M 0 . Proof of 1: Consider the set of dummy residents corresponding to a hospital Proof. S`−2 (s−1) h ∈ H i.e. s=0 Dhs . With the exception of h2 , for any hs , Dh are the most preferred + s s q (h ) dummy residents of h . Thus these dummy residents can never remain unmatched in M 0 . The only dummy residents that are not the first choice of any hospital and hence can remain unmatched are the subset of Dh1 consisting of the first q + (h) − q − (h) dummy residents from Dh1 . This is because, by construction of G0 , only the last q − (h) dummy residents from Dh1 are present in the preference list of h2 as its top q + (h2 ) top-choices. Thus the total number of dummy residents for h is given by |Dh | = 2·q + (h)+(`−3)·q − (h). Total capacity of all the copies of h in G0 is qh = 2 · q + (h) + (` − 2) · q − (h). Number of dummy residents in Dh that can remain unmatched in any stable matching M 0 in G0 is at most q + (h) − q − (h). Thus the number of true residents matched to h in M 0 is at most qh − |Dh | + q + (h) − q − (h) which is q + (h). Proof of 2: Consider a hospital h ∈ H. For each copy hs of h in H0 , where s < ` − 1, the dummy residents of level s have hs as their first choice. Further, their number is same as q + (hs ). Thus hs can not remain undersubscribed in any stable matching M 0 of G0 , otherwise these dummy residents will form a blocking pair with hs . Proof of 3a: For the sake of contradiction, assume that hs−1 is not matched to any level-(s − 1) dummy resident and still hs is matched to a non-dummy resident. As there are exactly q + (hs ) many level-(s − 1) dummy residents in the preference list of hs , and each level-(s − 1) dummy resident has only hs−1 and hs in its preference list, this means that there is a level-(s − 1) dummy resident d unmatched in M 0 . But hs prefers any level-(s−1) dummy resident over any non-dummy resident. Thus (d, hs ) forms a blocking pair with respect to M 0 , contradicting the stability of M 0 . Proof of 3b: If hs is active and hj is matched to a non-dummy resident r for some 0 ≤ j ≤ s − 2, then (r, h(s−1) ) is a blocking pair with respect to M’. This is because, Meghana Nasre and Prajakta Nimbhorkar XX:7 (s−1) as proved above, h(s−1) must be matched to at least one resident in Dh , and h(s−1) (s−1) prefers any non-dummy resident over any dummy resident in Dh . s j Proof of 3c: If h is active then h can not be active for s + 2 ≤ j ≤ ` − 1 else h(s+1) (s+1) must be matched to a resident from Dh as proved above, and then each non-dummy 0 s resident r in M (h ) forms a blocking pair with hj contradicting the stability of M 0 . But if hs is active, then hj can not be matched to a dummy resident from Dhj either, otherwise a resident in M 0 (hs ) forms a blocking pair with hj . The later is true because any resident in listh prefers hj over hs for j > s and hj prefers any resident in listh to any dummy resident in Dhj . Hence hj must be matched to only dummy residents in (j−1) Dh . Proof of 4: Assume the contrary. Thus let h be a hospital such that there are two levels i and j, j < i − 1, where hi and hj are matched to one or more non-dummy residents. Further, assume that hi is matched to ri and hj be matched to rj . Then, by Invariant 4 above, hi−1 must be matched to at least one (i − 1)-level dummy resident. But, by the structure of preference lists, hi−1 prefers a non-dummy resident, and hence rj , over any (i − 1)-level dummy resident. Also, rj prefers hi−1 over hj since j < i − 1. Thus (rj , hi−1 ) forms a blocking pair in G0 with respect to M 0 , contradicting the stability of M 0. Proof of 5: Let there be an edge (r, ht ) in G0 such that r is a level-s resident and t ≥ s+2 and ht is active in M 0 . Then, by Invariant 3a, hs+1 has at least one level-(s + 1) dummy resident in M 0 (hs+1 ). As r has edge to ht , r also has an edge to hs+1 by construction of G0 . Also, again by construction of G0 , r prefers any level-(s + 1) hospital over any level-s hospital and hs+1 prefers any non-dummy resident in its preference list over any level-(s + 1) dummy resident. Thus (r, hs+1 ) forms a blocking pair with respect to M 0 in G0 , contradicting its stability. J 4 Maximum cardinality popular matching In this section, we show how to use the reduction in the previous section to compute a maximum cardinality matching that is popular amongst all feasible matchings.. Thus, amongst all feasible matchings, our algorithm outputs the largest popular matching. We call such a matching a maximum cardinality popular matching. Our algorithm reduces the HRLQ instance G to an HR instance G0 as described in Section 3. We then compute a stable matching M 0 in G0 . Finally, to obtain a matching M S`−1 0 s  in G we describe a simple map function. For every h ∈ H, let M (h) = R ∩ s=0 M (h ) . Note that M (h) denotes the set of non-dummy residents matched to any copy hs of h in M 0 . Thus, a resident r is matched to a hospital h in M if and only if r is matched to a level-s copy of h in M 0 for some s ∈ {0, . . . , ` − 1}. We say that M = map(M 0 ). We now show some useful invariants about the matching M = map(M 0 ). Division of R and H into subsets: We divide the residents and hospitals in G into subsets depending upon a matching M 0 in G0 . Let Ri be the set of non-dummy residents matched to a level-i hospital hi in M 0 . We define the same set Ri in G as well. Further, define Hj to be the set of hospitals h ∈ H such that R ∩ M 0 (hj ) 6= ∅, that is, level-j copy hj of h is matched to at least one non-dummy resident in M 0 . Define the unmatched residents to be in R0 . Also, a non-lower-quota hospital h such that M (h) = ∅ is defined to be in H1 , and a lower-quota hospital h with M (h) = ∅ is defined to be in H`−1 . The following lemma summarizes the properties of the sets Ri and Hj . XX:8 Popular Matchings with Lower Quotas I Lemma 6. Let M = map(M 0 ) where M 0 is a stable matching in G0 . Then, the following hold: 1. Each hospital is present in at most two sets Hj , Hj+1 for some j. We say that h ∈ Hj ∩ Hj+1 . 2. If h ∈ Hj ∩ Hj+1 , then there is no edge from h to any r ∈ Ri where i ≤ j − 1. 3. All the non-lower-quota hospitals that are undersubscribed in M are in H1 . Moreover, no hospital that is undersubscribed in M is in H0 . 4. All the deficient lower-quota hospitals from M are in H`−1 . 5. If a non-lower-quota hospital is undersubscribed, it has no edge to any resident in R0 . If a lower-quota hospital is deficient, it does not have an edge to any resident in Ri for i < ` − 1. Similarly an unmatched resident does not have an edge to any hospital in H1 ∪ . . . ∪ H`−1 . 6. Let h ∈ H be such that |M (h)| > q − (h). Then h ∈ / H2 ∪ . . . ∪ H`−1 . Proof. We prove each statement below: Proof of 1: This directly follows from part 4 of Lemma 5. Proof of 2: Follows from part 5 of Lemma 5. Proof of 3: Let h be undersubscribed in M . Thus |M (h)| < q + (h). We show that h∈ / H0 by showing that h0 cannot be active in M 0 . For the sake of contradiction, let (r, h0 ) ∈ M 0 . Thus r ∈ hlisth i. As h is undersubscribed in M , h0 must be matched in M 0 to at least one dummy resident in Dh0 , and consequently, h1 must be matched to at least one dummy resident in Dh1 . But r prefers h1 over h0 in G0 and h1 prefers any resident from hlisth i over any resident in Dh1 . Thus (r, h1 ) forms a blocking pair w.r.t. M 0 , contradicting the stability of M 0 in G0 . Hence h0 cannot be active in M 0 and hence h∈ / H0 . Let h be a non-lower-quota hospital undersubscribed in M . By construction of G0 , the hospitals h2 , . . . , h`−1 have capacity zero and hence cannot be matched to any resident in M 0 . Therefore h ∈ / H2 ∪ . . . ∪ H`−1 . Combining with the above argument, h ∈ / H0 , and hence h ∈ H1 . Proof of 4: If a lower-quota hospital h is deficient in M , one of its copies is undersubscribed in M 0 . By part 2 of Lemma 5 only h`−1 can remain undersubscribed in M 0 . Moreover, as h`−1 is undersubscribed, no hs , s < ` − 1 can be active, otherwise its matched resident creates a blocking pair with h`−1 . Proof of 5: Let there be an edge (r, h) in G such that h is a non-lower-quota hospital undersubscribed in M , and let r ∈ R0 . By part 3 above, h ∈ H1 . If r is unmatched in M and hence in M 0 , then (r, h0 ) blocks M 0 . This is because, since h1 is active in M 0 implies that M 0 (h0 ) must contain a dummy resident in Dh0 . But h0 prefers any resident in hlisth i over any resident in Dh0 and r prefers h0 since r in unmatched in M 0 . If r is matched in M and hence in M 0 , it must be matched to a hospital h̄ ∈ H0 in M , and hence to h̄0 in M 0 . But any resident prefers a level-1 hospital over any level-0 hospital in its preference list. Also note that since h ∈ H1 and is undersubscribed, M (h0 ) = Dh0 . Thus, M (h1 ) contains at least one dummy resident from Dh1 . Since h1 prefers r over a dummy resident in Dh1 , it is clear that (r, h1 ) forms a blocking pair with respect to M 0 . A similar argument applies to the case when h is a deficient lower-quota hospital in M . Now let a resident r be unmatched in M and hence in M 0 , and suppose there is an edge (r, h) where h ∈ Hi for i > 0. As h ∈ Hi , by part 3a of Lemma 5, M 0 (h0 ) contains at least one dummy resident in Dh0 . As (r, h) is an edge in G, r ∈ hlisth i. But h0 prefers Meghana Nasre and Prajakta Nimbhorkar any resident in hlisth i over any resident in Dh0 , thus (r, h0 ) blocks M 0 contradicting its stability. Proof of 6: For the sake of contradiction, assume that h ∈ Hs for s ≥ 2 and still |M (h)| > q − (h). In this case, q − (h) > 0 otherwise in G0 , q + (h2 ) = . . . = q + (h(`−1) ) = 0 and hence h ∈ / Hs for any s ≥ 2. We consider two cases: Case 1: h ∈ Hs for s ≥ 3: Consider the matching M 0 in G0 . In this case, by part 3b of Lemma 5, the level copies h0 and h1 are inactive and M 0 (hi ) = Dhi for i ∈ {0, 1}. But then, as in the proof of part 1 of Lemma 5, all the dummy residents must be matched in M 0 . Recall that all the dummy residents in Dh except the first q + (h) − q − (h) ones in Dh1 are top choices of some copy of h. Moreover, for each s except s = 1, q + (hs ) = |Dhs |. Thus the only dummy residents that can remain unmatched in a stable matching in G0 are the first q + (h) − q − (h) dummy residents from Dh1 . As they are matched in M 0 by above argument, |M (h)| ≤ |R ∩ M 0 (h)| ≤ qh − |Dh | ≤ q − (h). This contradicts our assumption that |M (h)| > q − (h). (s−1) Case 2: h ∈ H1 ∩ H2 : Then, in G0 , M 0 (h0 ) = Dh0 , M 0 (hs ) = Dh for 3 ≤ s ≤ ` − 1 by 0 1 parts 3b and 3c of Lemma 5 respectively. Thus M (h ) has no resident from D0 (h) and M 0 (h2 ) has no resident from Dh2 . Let k be the number of non-dummy residents matched to h1 in M 0 . If k ≥ q − (h), then at most first q + (h) − q − (h) dummy residents from Dh1 are present in M 0 (h1 ). Thus all the positions of h2 get matched to residents from Dh1 . Recall that |Dh1 | = q + (h) = q + (h1 ) whereas q + (h2 ) = q − (h) and only the last q − (h) residents from Dh1 are present in the preference list of h2 . Thus h2 can not be active in M 0 , contradicting the assumption that h ∈ H1 ∩ H2 . Therefore k < q − (h). Thus exactly k positions of h2 are matched to dummy residents from D1 (h). We claim that the remaining q + (h2 )−k = q − (h)−k positions of h2 must be matched to non-dummy residents in M 0 . If not, then h2 must be matched to some dummy resident in D2 (h), as h2 is their top choice. This contradicts the above statement that M 0 (h2 ) has no resident from Dh2 . Thus total number of non-dummy residents matched to h in M is k + q − (h) − k = q − (h) contradicting the assumption that |M (h)| > q − (h). J Throughout the following discussion, assume that M is a matching which is a map of a stable matching M 0 in G0 and N is any feasible matching in G. We prove below that M is in fact feasible in G. I Theorem 7. If G admits a feasible matching, then M = map(M 0 ) is feasible for G. Proof. Suppose M is not feasible. Thus, there is a deficient lower-quota hospital h in M . Let N be a feasible matching in G. Consider decomposition of M ⊕ N into (possibly nonsimple) paths and cycles as described in Section 2. As h is deficient in M and not deficient in N , there must be a path ρ in M ⊕ N ending in h. Moreover, if the other end of ρ is a hospital h0 then |M (h0 )| − |N (h0 )| > 0. Note that in this case, ρ has even-length and hence ends with a M -edge. The other case is where ρ ends in a resident r and hence ends with a N -edge. We consider the two cases below: ρ ends in a hospital h0 : As h is deficient in M , h ∈ H`−1 by part 4 of Lemma 6. Also, since |M (h0 )| > |N (h0 )| ≥ q − (h0 ), by part 6 of Lemma 6, h0 ∈ H0 ∪ H1 . Thus ρ starts at H`−1 and ends in H0 or H1 . Let ρ = hh, r1 , h1 , r2 , h2 , . . . , rt , ht , r0 , h0 i, where (ri , hi ) ∈ M and (r0 , h0 ) ∈ M . We show below that such a path ρ can not exist and hence M must be feasible. XX:9 XX:10 Popular Matchings with Lower Quotas By part 5 of Lemma 6, h has edges only to residents in R`−1 . Hence r1 ∈ R`−1 and hence h1 ∈ H`−1 . By part 2 of Lemma 6, h1 has no edges to residents in R0 ∪ . . . ∪ R`−3 . Therefore r2 ∈ R`−1 ∪ R`−2 and h2 ∈ H`−1 ∪ H`−2 . Thus each hi ∈ ρ can not be in Hj , for any j < `−i. But h0 ∈ H0 ∪H1 and hence r0 ∈ R0 ∪R1 . Therefore ht ∈ / H3 ∪. . .∪H`−1 0 by part 2 of Lemma 6, otherwise (ht , r ) edge can not exist in G. In other words, ρ has to contain at least one hospital from each level i, 1 ≤ i ≤ ` − 1. Thus t ≥ ` − 2. Moreover, all the hospitals in ρ which are in H`−1 ∪ . . . ∪ H2 are lower-quota hospitals. Thus ρ has at least t + 1 = ` − 1 lower-quota hospitals. Note that this count includes repetitions, as a hospital can appear multiple times in ρ. However, any hospital in H2 ∪ . . . ∪ H`−1 can not be matched to more than q − (h) residents in M by part 6 and hence can appear at most q − (h) times on ρ. But then the sum of lower quotas of all the hospitals is ` − 2, contradicting that ρ has a total of ` − 1 occurrences of lower-quota hospitals. Thus such a path ρ can not exist and M must be feasible. ρ ends in a resident r: Now consider the case where ρ ends at a resident r. Then the last edge on ρ must be a N -edge and hence r is unmatched in M . Therefore r ∈ R0 . Let ρ = hh, r1 , h1 , r2 , h2 , . . . , rt , ht , ri where (ri , hi ) ∈ M for 1 ≤ i ≤ t and the remaining edges are in N . Consider the first hospital, say hj on ρ such that hj ∈ H2 and for each hi , i < j, hi ∈ H3 ∪ . . . ∪ H`−1 . Such an hj has to exist by the argument given for the previous case. Moreover, j ≥ ` − 2 as ρ has to contain at least one hospital from each level as described in the previous case. Thus the number of occurrences of lower-quota hospitals on ρ exceeds the sum of lower quotas and hence such a ρ can not exist. This completes the proof of the lemma. J In Lemma 8 and Theorem 9 below, we give crucial properties of the division of R and H that will be helpful in proving popularity of the matching M which is a map of a stable matching M 0 in G0 . I Lemma 8. Let N be any feasible matching. Let (r, h) ∈ M and (r0 , h) ∈ N such that r0 =corrh (r, M, N ). Further let h ∈ Hj ∩ Hj+1 and r ∈ Rj+1 . Further, let r0 ∈ Rj . Then the label on (r0 , h) edge is (−1, −1). Proof. Clearly r0 is not matched to h in M , as corr(r) is picked only from M (h) ⊕ M 0 (h) and r0 ∈ M 0 (h). Let r0 ∈ M (h0 ). Assume, for the sake of contradiction, that (r0 , h) does not have (−1, −1) label. Consider the same edge in G0 . In G0 , this is an edge between a j-level resident and a j + 1-level hospital. The label on (r0 , h) in G can not be (×, 1), as this cause the label on the (r0 , hj+1 ) edge in G0 to be (1, 1). This is because, if h prefers r0 over r in G, the preference remains same in G0 as well. On the other hand, r0 prefers any j + 1-level hospital over any j-level hospital, and hence hj+1 over h0j . So it must be the case that the label on (r0 , h) in G must be (1, −1). But in this case, in G0 , hj is matched to one of its last dummies since hj+1 is active. Thus (r0 , hj ) forms a blocking pair with respect to M 0 in G0 . This proves that the label on (r0 , h) in G must be (−1, −1). J Let ρ be a path in M ⊕N where M is the map of a stable matching M 0 in G0 and N is any feasible matching in G. Here ρ is constructed according to the decomposition described in Section 2. Furthermore, the labels on edges of N \ M are assigned as described in Section 2. The following theorem is similar to the one proved in [11] for the stable marriage setting. We adapt the proof here for our setting. I Theorem 9. Let ρ = hh0 , r1 , h1 , r2 , h2 , . . . , ht , rt+1 i. Moreover, let h0 ∈ Hp ∩ Hp+1 and rt+1 ∈ Rq . Then the number of (1, 1) edges in ρ is at most the number of (−1, −1) edges plus q − p. Thus (rk , hk ) ∈ M for all k and (hk , rk+1 ) ∈ N with rk+1 =corrhk (rk , M, N ). Meghana Nasre and Prajakta Nimbhorkar Proof. We prove this by induction on the number of (−1, −1) edges. Note that, except h0 , all the hi s are matched in M 0 , and hence we can consider them at the same level as their matched residents. Base case: Let ρ have no (−1, −1) edges. As ρ starts at h ∈ Hp ∩ Hp+1 , r1 has to be in level-p + 1 or above. This is because there is no edge from h to a resident in R0 ∪ . . . ∪ Rp−1 , and if r1 ∈ Rp then the label on (h0 , r1 ) must be (−1, −1) by Lemma 8. By assumption, there is no (−1, −1) edge in ρ. So r1 ∈ Rj for some j, p + 1 ≤ j ≤ `. Therefore h1 ∈ Hj . Thus the path can only use edges from a hospital at a lower level to a resident at the same or higher level. Further, there is no (1, 1) edge in Hk × Rk for any k. So (1, 1) edges can appear in ρ only when it goes from a hospital in a lower level to a resident in a higher level. So there can be at most q − p many (1, 1) edges on ρ. Induction step: Let the theorem hold for at most i − 1 many (−1, −1) edges. Let (hk , rk+1 ) be one such edge. Further, let hk ∈ Ha and rk+1 ∈ Rb . Consider the two subpaths ρ1 = hh0 , . . . , rk i and ρ2 = hhk+1 . . . , rt+1 . As the number of (−1, −1) edges in each of ρ1 and ρ2 is less than i, the induction hypothesis holds. Therefore, the number of (1, 1) edges in ρ1 is at most a − p plus the number of (−1, −1) edges in ρ1 . Similarly, the number of (1, 1) edges in ρ2 is q − b plus the number of (1, 1) edges in ρ2 . The number of (−1, −1) edges in ρ is one more than the total number of (−1, −1) edges in ρ1 and ρ2 . Hence the number of (1, 1) edges in ρ is at most the number of (−1, −1) edges in ρ plus a − p + q − b − 1. As there is an edge between hk and rk+1 , b ≥ a − 1 by Invariant 2. Thus a − p + q − b − 1 ≤ q − p, which completes the proof. J The following theorem shows that M is a popular matching amongst all the feasible matchings in G. I Theorem 10. Let N be any feasible matching in G. 1. If ρ is an alternating cycle in the decomposition of M ⊕N , then ∆(M ⊕ρ, M ) ≤ ∆(M, M ⊕ ρ). 2. If ρ is an alternating path in the decomposition of M ⊕ N with exactly one end-point matched in M , then ∆(M ⊕ ρ, M ) ≤ ∆(M, M ⊕ ρ). 3. If ρ is an alternating path in the decomposition of M ⊕N with both the end-points matched in M then ∆(M ⊕ ρ, M ) ≤ ∆(M, M ⊕ ρ). Proof. 1. Let ρ be an alternating cycle in M ⊕ N . Further, let (r, h) ∈ M . Consider ρ0 = ρ \ {(r, h)} is an alternating path from h to r which starts and ends at the same level. Hence the number of (1, 1) edges on ρ0 is at most the number of (−1, −1) edges on ρ0 . The same holds for ρ. 2. Let ρ be an alternating path in M ⊕ N with exactly one end-point matched in M . Thus ρ has even length, and both its end-points are either hospitals or both are residents. Consider the first case. So let ρ = hh0 , r1 , h1 , . . . , rt , ht i where (ri , hi ) ∈ M for all i. Thus |M (h0 )| < |N (h0 )| ≤ q + (h0 ), and hence h0 is under-subscribed. Then by part 3 of Lemma 6 and feasibility of M , h0 ∈ / H0 . By feasibility of N , ht ∈ H0 ∪ H1 . As (rt , ht ) ∈ M , r ∈ R0 ∪ R1 by the definition of levels. Consider the subpath ρ0 = ρ \ {(rt , ht )} i.e. the path obtained by removing the edge (rt , ht ) from ρ. Applying Theorem 9 to ρ0 with p ≥ 1 and q = 0 or q = 1, we get that the number of (1, 1) edges on ρ0 is at most the number of (−1, −1) edges on ρ0 . Consider the case when both the end-points of ρ are residents. Thus ρ = hr0 , h1 , r1 , . . . , ht , rt i where (hi , ri ) ∈ M for all i. Again consider ρ0 = ρ \ {(ht , rt )}. As r0 is unmatched in M , r0 ∈ R0 by the definition of levels. Applying Theorem 9 to XX:11 XX:12 Popular Matchings with Lower Quotas ρ0 with q = 0, we get that the number of (1, 1) edges on ρ0 is at most the number of (−1, −1) edges on ρ0 . 3. Consider the case when both the end-points of the alternating path ρ are matched in M . Thus one end-point of ρ is a hospital whereas the other end-point is a resident. Let ρ = hr0 , h0 , . . . , rt , ht i where (ri , hi ) ∈ M for all i. Hence |M (ht )| > |N (ht )| ≥ q − (ht ) by feasibility of N . Therefore ht ∈ H0 ∪ H1 by part 6 of Lemma 6 which implies that rt ∈ R0 ∪ R1 . Consider the subpath ρ0 = ρ \ {(r0 , h0 ), (rt , ht )}. Thus ρ0 begins at h0 and ends at rt . Applying Theorem 9 with q = 1 and 0 ≤ p ≤ ` gives that the number of (1, 1) edges on ρ0 , and hence on ρ, is at most one more than the number of (−1, −1) edges on ρ. These votes in favor of N are compensated by the end-points r0 and ht as r0 is unmatched in N and |M (ht )| > |N (ht )|. This completes the proof of the theorem. J The following lemma proves that M is a maximum cardinality popular matching in G. I Lemma 11. For any feasible matching N in G such that |N | > |M |, ∆(N, M ) < ∆(M, N ). Proof. Consider M ⊕ N . There is an alternating path ρ in M ⊕ N such that ρ has both the end-points unmatched/undersubscribed in M and the path begins and ends with edges in N . Let ρ = hh0 , r1 , h1 , . . . , rt , ht , rt+1 i where (ri , hi ) ∈ M for each i. As h0 is undersubscribed in M , and rt+1 is unmatched in M , by the definition of levels and part 3 of S(`−1) Lemma 6, h0 ∈ j=1 Hj and rt+1 ∈ R0 . Further, by part 5 of Lemma 6, there is no edge from h0 to any r ∈ R0 and no edge from rt+1 to any h ∈ H1 ∪ . . . ∪ H`−1 . The path ρ S(`−1) begins in j=1 Hj and has to end in R0 , and the only edges to R0 are from vertices in H0 ∪ H1 . Further, each ri , i ≤ t is matched in M and hence the corresponding hospital hi is at the same level as ri . By part 2 of Lemma 6, if hi ∈ H2 ∪ . . . ∪ H(`−1) then ri+1 ∈ / R0 for any i. Therefore there must be an edge (hi , ri+1 ) on ρ such that hi ∈ H1 and ri ∈ R0 and 1 ≤ i ≤ t − 1. By Lemma 8, this edge must be labelled (−1, −1). Now consider the two subpaths ρ1 = hh0 , r1 , h1 , . . . , ri i and ρ2 = hhi+1 , ri+2 , . . . , ht , rt+1 i. These are the subpaths obtained by removing the subpath ri , hi , ri+1 , hi+1 from ρ. By assumption, hi ∈ H1 and ri+1 ∈ R0 , hence ri ∈ R1 and hi+1 ∈ H0 . Therefore, applying Theorem 9 to ρ1 and ρ2 gives that the number of (1, 1) edges on ρ1 and ρ2 are at most the number of (−1, −1) edges on them. Thus N does not get more votes than M on ρ1 or ρ2 . Further, M gets two more votes on the (hi , ri+1 ) edge. Hence the lemma follows. J 5 Popular matching amongst maximum cardinality feasible matchings In this section, we modify the reduction in Section 3 to obtain a matching that is popular amongst all the maximum cardinality feasible matchings of the HRLQ instance. The reduction is very similar to the one described in Section 3 except for the number of copies of P each hospital. The HR instance G0 described in Section 3, has ` = 2 + h∈H q − (h) copies corresponding to each hospital in G. 5.1 Reduction to HR instance Given HRLQ instance G = (R ∪ H, E), the corresponding HR instance G00 = (R00 ∪ H00 , E 00 ) P is as follows. We set ` = |R| + h∈H q − (h). We start with the vertices in G00 . The set H00 : For every hospital h ∈ H, we have ` copies of h in H00 . The set H00 and the Meghana Nasre and Prajakta Nimbhorkar XX:13 capacities are as given below. H00 Capacities of h ∈ H00 : q + (hs ) + s q (h ) = {h0 , . . . , h`−1 | h ∈ H} = = q + (h), − q (h), s ∈ {0, . . . , |R| − 1} s ∈ {|R|, . . . , ` − 1} The following observation is immediate. I Observation 1. For a hospital h ∈ H, the sum of capacities of all level copies of h in G00 is qh = |R| · q + (h) + (` − 2) · q − (h). The set R00 : The set of residents R00 consists of the set R along with a set of dummy residents Dh corresponding to every hospital h ∈ H. The set R00 and Dh are as defined below:  S S Dh = s∈{0,...,`−1} Dhs ∀h ∈ H R00 = R ∪ h∈H Dh where where Dhs = {dsh,1 . . . , dsh,q+ (h) }, s ∈ {0, |R| − 1} and Dhs = {dsh,1 . . . , dsh,q− (h) }, s ∈ {|R|, . . . , ` − 2} Here Dh is the set of dummy residents corresponding to h and Dhs is the set of level-s dummy residents corresponding to h. Note that Dhs = ∅ for each s ∈ {|R|, . . . , ` − 1} if q − (h) = 0. The following observation captures the number of dummy residents corresponding to every hospital h ∈ H. I Observation 2. For a hospital h ∈ H, the total number of dummy residents corresponding h in R00 is |Dh | = |R| · q + (h) + (` − 3) · q − (h). Preference lists: Recall that the preference list of a resident r in G is denoted by hlistr i and that of a hospital h is hlisth i. Hospitals’ preference lists: For hs ∈ H00 : s=0 : s ∈ {1, . . . , |R| − 2} : s = |R| − 1 : s ∈ {|R|, . . . , ` − 2} : s=`−1 : hlisth i ◦ hDh0 i hDhs−1 i ◦ hlisth i ◦ hDhs i |R|−2 |R|−2 |R|−1 hdh,k , . . . , dh,q+ (h) i ◦ hlisth i ◦ hDh i, s−1 s hDh i ◦ hlisth i ◦ hDh i (`−1) hDh i ◦ hlisth i k = q + (h) − q − (h) + 1 Residents’ preference lists: For r ∈ R : For h ∈ H, dsh,i ∈ Dh : s ∈ {0, . . . , ` − 2} \ {|R| − 1} : s = |R| − 1, i ∈ {1, . . . , q + (h) − q − (h)} : s = |R| − 1, i ∈ {q + (h) − q − (h) + 1, . . . , q + (h)} : hlistr i(`−1) ◦ . . . ◦ hlistr i0 hhs , hs+1 i hh(|R|−1) i hh(|R|−1) , h|R| i The following lemma summarizes properties of a stable matching M 00 in G00 . It is an analogue of Lemma 5 from Section 3. The proof is similar to the proof of Lemma 5; we omit it here. I Lemma 12. The following hold for any stable matching M 00 in G00 : 1. For any h ∈ H, M 00 matches at most q + (h) non-dummy residents across all its level copies in G00 . XX:14 Popular Matchings with Lower Quotas 2. The matching M 00 in G00 leaves only the level-(` − 1) copy of any hospital (if it exists) under-subscribed. 3. Let hs ∈ H00 be active in M 00 . Then, a. At least one position of hs−1 is matched in M 00 to a dummy resident at level-(s − 1). b. For 0 ≤ j ≤ s − 2, hj is inactive in M 00 and all positions of hj are matched to dummy residents of level-(j). c. For s + 2 ≤ j ≤ ` − 1, hj is inactive in M 00 and all positions of hj are matched to dummy residents of level-(j − 1). 4. For any h ∈ H, at most two consecutive level copies hs and hs+1 are active in M 00 . 5. A level-s resident r in M 00 does not have any hospital h in its preference list which is active at level-(s + 2) in M 00 . 5.2 Popularity of the matching In order to compute a matching that popular amongst all the maximum cardinality feasible matchings, we execute the following algorithm. Construct the graph G00 and compute a stable matching M 00 in G00 . Because of the invariants on M 00, there exists a natural map from S `−1 00 s 00 M 00 to a matching M in G. Let M (h) = R∩ s=0 M (h ) . We prove that M = map(M ) is popular amongst all maximum cardinality feasible matchings in G. Division of residents and hospitals into subsets: As in Section 4, we divide residents and hospitals into subsets based on a stable matching M 00 in G00 . Thus Ri is the set of nondummy residents matched to a level-i hospital hi in M 00 , Hi is the set of hospitals that are active at level-i in M 00 , unmatched residents are in R0 . Also, if M (h) = ∅ then h ∈ H(|R|−1) if q − (h) = 0 and h ∈ H`−1 if q − (h) > 0. The following lemma summarizes the properties of a matching M in G where M = map(M 00 ) and M 00 is a stable matching in G00 . I Lemma 13. Let M be a matching in G such that M = map(M 00 ) and M 00 is a stable matching in G00 . 1. Each hospital is present in at most two sets Hj , Hj+1 for some j. We say that h ∈ Hj ∩ Hj+1 . 2. If h ∈ Hj ∩ Hj+1 , then there is no edge from h to any r ∈ Ri where i ≤ j − 1. 3. All the non-lower-quota hospitals that are undersubscribed in M are in H(|R|−1) . 4. All the deficient lower-quota hospitals from M are in H(`−1) . 5. If a non-lower-quota hospital is undersubscribed, it has no edge to any resident in R0 . If a lower-quota hospital is deficient it does not have an edge to any resident in Ri for i ≤ ` − 1. Similarly an unmatched resident does not have an edge to any hospital in H1 ∪ . . . ∪ H`−1 . 6. Let h ∈ H be such that |M (h)| > q − (h). Then h ∈ / H|R| ∪ . . . ∪ H(`−1) . In Theorem 14 below, we prove that M = map(M 00 ) is feasible in G if M 00 is stable in G00 . I Theorem 14. If G admits a feasible matching then the map M of any stable matching M 00 in G00 is feasible. Proof. The proof is analogous to that of Theorem 7. Assume, for the sake of contradiction, that M is not feasible and hence there is a hospital h such that |M (h)| < q − (h). We need to consider M ⊕ N where N is a feasible matching in G. As N is feasible, |N (h)| ≥ q − (h) and hence there must be a path ρ in the decomposition of M ⊕ N with h as one of its end-points. The first case is that the other end-point of ρ is a hospital h0 and hence the last edge of ρ must be a M -edge (call this Case 1). In the second case, the other end-point of ρ is a a resident r, implying last edge of ρ is a N -edge (call this Case 2). Meghana Nasre and Prajakta Nimbhorkar Consider Case 1. As the path ends at h0 with an M -edge, |M (h0 )| > |N (h0 )| ≥ q − (h0 ). Then, by part 6 of Lemma 13, h0 ∈ H0 ∪ . . . ∪ H(|R|−1) . Also, by part 4 of Lemma 13, h ∈ H(`−1) . Then, by a similar argument as in the proof of Theorem 7, the length of ρ exceeds the sum of lower-quotas of all the hospitals and hence such a path can not exist. When ρ ends in a resident r, and hence the last edge is a N -edge, r is unmatched in M and hence must be in R0 . A similar argument applies in this case as well, for the sub-path of ρ where we consider the first hospital hj such that hj ∈ H|R| and for each hi , i < j, hi ∈ H(|R|+1) ∪ . . . ∪ H(`−1) . We omit the details. J We need the following lemma and theorem for proving popularity of M . They are analogues of Lemma 8 and Theorem 9 respectively from Section 4. I Lemma 15. Let M1 be any feasible matching. Let (r, h) ∈ M and (r0 , h) ∈ M1 such that r0 =corrh (r, M, M1 ). Further let h ∈ Hj ∩ Hj+1 and r ∈ Rj+1 . Further, let r0 ∈ Rj . Then the label on (r0 , h) edge is (−1, −1). Let ρ be a path in M ⊕M1 where M is the map of a stable matching M 00 in G00 and M1 is any feasible matching in G. Here ρ is constructed according to the decomposition described in Section 2. The labels are assigned according to the voting described in Section 2. I Theorem 16. Let ρ = hh0 , r1 , h1 , r2 , h2 , . . . , ht , rt+1 i. Moreover, let h0 ∈ Hp ∩ Hp+1 and rt+1 ∈ Rq . Then the number of (1, 1) edges in ρ is at most the number of (−1, −1) edges plus q − p. Thus (rk , hk ) ∈ M for all k and (hk , rk+1 ) ∈ M1 with rk+1 =corrhk (rk , M, M1 ). Now we prove that M is a maximum cardinality feasible matching in G. I Theorem 17. There is no feasible matching N such that |N | > |M |. Proof. For contradiction, assume that there exists a feasible matching N in G such that |N | > |M |. Then, in the decomposition of M ⊕ N , there must be a path with both endpoints unmatched / under-subscribed in M . Let ρ be such a path. One end-point of ρ must be a hospital h and other end-point must be a resident r. Then |M (h)| < |N (h)| and hence S`−1 h ∈ i=|R|−1 Hi by part 3 of Lemma 13. Also, r ∈ R0 by the way division of R into subsets is defined. Let ρ = hr, h0 , r0 , h1 , r1 , . . . , ht , rt , hi where (hi , ri ) ∈ M for 0 ≤ i ≤ t. As an unmatched resident has edges only to hospitals in H0 (cf. part 5 of Lemma 13), h0 ∈ H0 and hence r0 ∈ R0 since r0 = M (h0 ). Now again, by part 2 of Lemma 13, r0 has no edge to any Si hospital in H2 ∪ . . . ∪ H(`−1) . Hence h1 ∈ H0 ∪ H1 . Continuing this argument, hi ∈ j=0 Hj . S|R|−2 But then h has no edge to any resident in j=0 and so rt ∈ R|R|−1 . Therefore t ≥ |R| − 1. But then the number of residents on ρ is |R| + 1, which is not possible. Hence there is no augmenting path with respect to M in G. J In the theorem below, we prove that M is popular amongst all the feasible matchings of maximum cardinality. I Theorem 18. Let N be any feasible matching in G. 1. If ρ is an alternating cycle in M ⊕ N , then ∆(M ⊕ ρ, M ) ≤ ∆(M, M ⊕ ρ). 2. If ρ is an alternating path in M ⊕ N with one end-point matched in M , then ∆(M ⊕ ρ, M ) ≤ ∆(M, M ⊕ ρ). Proof. Let ρ be an alternating cycle in M ⊕ N . Further, let (r, h) ∈ ρ ∩ M . Then ρ0 = ρ \ {(r, h)} is an alternating path from h to r which starts and ends at the same level. Hence the number of (1, 1) edges on ρ0 is at most the number of (−1, −1) edges on ρ0 . The same holds for ρ. XX:15 XX:16 Popular Matchings with Lower Quotas Let ρ be an alternating path in M ⊕ N with exactly one end-point matched in M . Thus ρ has even length, and both its end-points are either hospitals or both are residents. Consider the first case. So let ρ = hh0 , r1 , h1 , . . . , rt , ht i where (ri , hi ) ∈ M for all i. Also, as N is feasible, q + (h) ≥ |N (h)| > |M (h)|. By part 3 of Lemma 13 and feasibility of S`−1 S|R|−1 S|R|−1 M , h0 ∈ i=|R|−1 Hi . By feasibility of N , ht ∈ i=0 Hi . As (rt , ht ) ∈ M , r ∈ i=0 by the definition of levels. Consider the subpath ρ0 = ρ \ {(rt , ht )} i.e. the path obtained by removing the edge (rt , ht ) from ρ. Applying Theorem 16 to ρ0 with p ≥ |R| − 1 and q ≤ |R| − 1, we get that the number of (1, 1) edges on ρ0 is at most the number of (−1, −1) edges on ρ0 . Consider the case when both the end-points of ρ are residents. Thus ρ = hr0 , h1 , r1 , . . . , ht , rt i where (hi , ri ) ∈ M for all i. Again consider ρ0 = ρ \ {(ht , rt )}. As r0 is unmatched in M , r0 ∈ R0 by the definition of levels. Applying Theorem 16 to ρ0 with q = 0, we get that the number of (1, 1) edges on ρ0 is at most the number of (−1, −1) edges on ρ0 . J Meghana Nasre and Prajakta Nimbhorkar References 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 P. Biró, T. Fleiner, R. W. Irving, and D. F. Manlove. The college admissions problem with lower and common quotas. Theoretical Computer Science, 411(34-36):3136–3153, 2010. P. Biró, R. W. Irving, and D. Manlove. Popular matchings in the marriage and roommates problems. In 7th International Conference on Algorithms anc Complexity CIAC, pages 97–108, 2010. F. Brandl and T. Kavitha. Popular Matchings with Multiple Partners. CoRR, abs/1609.07531, 2016. Á. Cseh and T. Kavitha. Popular Edges and Dominant Matchings. In Proceedings of the Eighteenth Conference on Integer Programming and Combinatorial Optimization, pages 138–151, 2016. D. Gale and L. Shapley. College Admissions and the Stability of Marriage. American Mathematical Monthly, 69:9–14, 1962. D. Gale and M. Sotomayor. Some remarks on the stable matching problem. Discrete Applied Mathematics, 11(3):223 – 232, 1985. P. Gärdenfors. Match making: Assignments based on bilateral preferences. Behavioral Science, 20(3):166–173, 1975. K. Hamada, K. Iwama, and S. Miyazaki. The Hospitals/Residents Problem with Lower Quotas. Algorithmica, 74(1):440–465, 2016. M. Hirakawa, Y. Yamauchi, S. Kijima, and M. Yamashita. On the structure of popular matchings in the stable marriage problem – who can join a popular matching? In 3rd International Workshop on Matching Under Preferences (MATCH-UP), 2015. C.-C. Huang and T. Kavitha. Popular matchings in the stable marriage problem. Information and Computation, 222:180 – 194, 2013. 38th International Colloquium on Automata, Languages and Programming (ICALP 2011). T. Kavitha. A Size-Popularity Tradeoff in the Stable Marriage Problem. SIAM Journal on Computing, 43(1):52–71, 2014. T. Kavitha. Popular half-integral matchings. In 43rd International Colloquium on Automata, Languages, and Programming, ICALP 2016, July 11-15, 2016, Rome, Italy, pages 22:1–22:13, 2016. Z. Király. Better and Simpler Approximation Algorithms for the Stable Marriage Problem. Algorithmica, 60(1):3–20, 2011. M. Nasre and A. Rawat. Popularity in the Generalized Hospital Residents Setting. CoRR, abs/1609.07650, 2016. A. E. Roth. The evolution of the labor market for medical interns and residents: A case study in game theory. Journal of Political Economy, 92(6):991–1016, 1984. A. E. Roth. On the allocation of residents to rural hospitals: A general property of twosided matching markets. Econometrica, 54(2):425–427, 1986. XX:17
8cs.DS
arXiv:1401.5900v1 [cs.NE] 23 Jan 2014 Gaussian-binary Restricted Boltzmann Machines on Modeling Natural Image Statistics Jan Melchior Institüt für Neuroinformatik Ruhr-Universität Bochum Bochum, 44780, Germany [email protected] Nan Wang Institüt für Neuroinformatik Ruhr-Universität Bochum Bochum, 44780, Germany [email protected] Laurenz Wiskott Institüt für Neuroinformatik Ruhr-Universität Bochum Bochum, 44780, Germany [email protected] Abstract We present a theoretical analysis of Gaussian-binary restricted Boltzmann machines (GRBMs) from the perspective of density models. The key aspect of this analysis is to show that GRBMs can be formulated as a constrained mixture of Gaussians, which gives a much better insight into the model’s capabilities and limitations. We show that GRBMs are capable of learning meaningful features both in a two-dimensional blind source separation task and in modeling natural images. Further, we show that reported difficulties in training GRBMs are due to the failure of the training algorithm rather than the model itself. Based on our analysis we are able to propose several training recipes, which allowed successful and fast training in our experiments. Finally, we discuss the relationship of GRBMs to several modifications that have been proposed to improve the model. 1 Introduction Inspired by the hierarchical structure of the visual cortex, recent studies on probabilistic models used deep hierarchical architectures to learn high order statistics of the data [Karklin and Lewicki(2009), Köster and Hyvärinen(2010)]. One widely used architecture is a deep believe network (DBN), which is usually trained as stacked restricted Boltzmann machines (RBMs) [Hinton and Salakhutdinov(2006), Bengio et al.(2006), Erhan et al.(2010)]. Since the original formulation of RBMs assumes binary input values, the model needs to be modified in order to handle continuous input values. One common way is to replace the binary input units by linear units with independent Gaussian noise, which is known as Gaussian-binary restricted Boltzmann machines (GRBMs) or Gaussian-Bernoulli restricted Boltzmann machines [Krizhevsky(2009), Cho et al.(2011)] first proposed by [Welling et al.(2004)]. The training of GRBMs is known to be difficult, so that several modifications have been proposed to improve the training. [Lee et al.(2007)] used a sparse penalty during training, which allowed them to learn meaningful features from natural image patches. [Krizhevsky(2009)] trained GRBMs on natural images and concluded that the difficulties are mainly due to the existence of high-frequency noise in the images, which further prevents the model from learning the important structures. [Theis et al.(2011)] illustrated that in terms of likelihood estimation GRBMs are already outperformed by simple mixture models. Other researchers focused on improving the model in the 1 view of generative models [Ranzato et al.(2010), Ranzato and Hinton(2010), Courville et al.(2011), Le Roux et al.(2011)Le Roux, Heess, Shotton, and Winn]. [Cho et al.(2011)] suggested that the failure of GRBMs is due to the training algorithm and proposed some modifications to overcome the difficulties encountered in training GRBMs. The studies above have shown the failures of GRBMs empirically, but to our knowledge there is no analysis of GRBMs apart from our preliminary work [Wang et al.(2012)], which accounts the reasons behind these failures. In this paper, we extend our work in which we consider GRBMs from the perspective of density models, i.e. how well the model learns the distribution of the data. We show that a GRBM can be regarded as a mixture of Gaussians, which has already been mentioned briefly in previous studies [Bengio(2009), Theis et al.(2011), Courville et al.(2011)] but has gone unheeded. This formulation makes clear that GRBMs are quite limited in the way they can represent data. However we argue that this fact does not necessarily prevent the model from learning the statistical structure in the data. We present successful training of GRBMs both on a two-dimensional blind source separation problem and natural image patches, and that the results are comparable to that of independent component analysis (ICA). Based on our analysis we propose several training recipes, which allowed successful and fast training in our experiments. Finally, we discuss the relationship between GRBMs and above mentioned modifications of the model. 2 Gaussian-binary restricted Boltzmann machines (GRBMs) 2.1 The model A Boltzmann Machine (BM) is a Markov Random Field with stochastic visible and hidden units T T [Smolensky(1986)], which are denoted as X := (X1 , . . . , XM ) and H := (H1 , . . . , HN ) , respectively. In general, we use bold letters denote vectors and matrices. The joint probability distribution is defined as 1 − T1 E(X,H) e 0 , ZZ Z 1 := e− T0 E(x,h) dx dh P (X, H) := Z (1) (2) where E (X, H) denotes an energy function as known from statistical physics, which defines the dependence between X and H. The temperature parameter T0 is usually ignored by setting its value to one, but it can play an important role in inference of BMs [Desjardins et al.(2010)]. The partition function Z normalizes the probability distribution by integrating over all possible values of X and H, which is intractable in most cases. So that in training BMs using gradient descent the partition function is usually estimated using sampling methods. However, even sampling in BMs remains difficult due to the dependencies between all variables. An RBM is a special case of a BM where the energy function contains no terms combining two different hidden or two different visible units. Viewed as a graphical model, there are no lateral connections within the visible or hidden layer, which results in a bipartite graph. This implies that the hidden units are conditionally independent given the visibles and vice versa, which allows efficient sampling. The values of the visible and hidden units are usually assumed to be binary, i.e. Xm , Hn ∈ {0, 1}. The most common way to extend an RBM to continuous data is a GRBM, which assumes continuous values for the visible units and binary values for the hidden units. Its energy function [Cho et al.(2011), Wang et al.(2012)] is defined as E (X, H) : = M X (Xi − bi )2 i = 2σ 2 − N X j c j Hj − M,N X i,j XT WH ||X − b||2 T − c H − , 2σ 2 σ2 Xi wij Hj σ2 (3) (4) where ||u|| denotes the Euclidean norm of u. In GRBMs the visible units given the hidden values are Gaussian distributed with standard deviation σ. Notice that some authors 2 [Krizhevsky(2009), Cho et al.(2011), Melchior(2012)] use an independent standard deviation for each visible unit, which comes into account if the data is not whitened [Melchior(2012)]. The conditional probability distribution of the visible given the hidden units is given by P (X|h) = R (1,4) R e M Y i (11) = M Y i = M Y i = (5) i = = P (X, h) P (x, h) dx T h M Xi wi∗ ||Xi −bi ||2 Q T ec h e σ2 − 2σ2 M Q cT h e 2 xi w T h i∗ − ||xi −bi || σ2 2σ2 (6) dx i e R R T h Xi wi∗ ||Xi −bi ||2 − σ2 2σ2 2 xi w T h i∗ − ||xi −bi || σ2 2σ2 e e− e − (7) dxi T h||2 ||Xi −bi −wi∗ 2σ2 ||xi −bi −wT h||2 i∗ 2σ2 (8) dxi  T N Xi ; bi + wi∗ h, σ 2 | {z } (9) = P (Xi |h)  N X; b + Wh, σ 2 , (10) where wi∗ and w∗j denote the ith row and the jth column of the weight matrix, respectively. N x; µ, σ 2 denotes a Gaussian distribution with mean µ and variance σ 2 . And N X; µ, σ 2 denotes an isotropic multivariate Gaussian distribution centered at vector µ with variance σ 2 in all directions. From (7) to (8) we used the relation 2 −x2 + 2bx + 2ax − b2 2σ 2 2 −x + 2bx + 2ax − b2 + a2 − a2 + 2ab − 2ab = 2σ 2 2 2 −(x − a − b) + a + 2ab . (11) = 2σ 2 The conditional probability distribution of the hidden units given the visibles can be derived as follows P (x, H) P (12) P (H|x) = P (x, h) ax (x − b) − σ2 2σ 2 = h 2 (1,4) e − ||x−b|| 2σ2 e   xT w cj + σ2 ∗j Hj j = P 2 e − ||x−b|| 2σ2 N Y j N Q e   xT w cj + σ2 ∗j hj (13) j h = N Q e   xT w cj + σ2 ∗j Hj P e . (14) } (15)   xT w cj + σ2 ∗j hj hj =⇒ P (Hj = 1|x) | = 1+e 3 {z = P (Hj |x) 1   xT w − cj + σ2 ∗j P (H|x) turns out to be a product of independent sigmoid functions, which is a frequently used non-linear activation function in artificial neural networks. 2.2 Maximium likelihood estimation Maximum likelihood estimation (MLE) is a frequently used technique for training probabilistic models like BMs. In MLE we have a data set X˜ = {x̃1 , . . . , x̃L } where the observations x̃l are assumed to be independent and identically distributed (i.i.d.). The goal is to find the optimal parameters Θ̃ that maximize the likelihood of the data, i.e. maximize the probability that the data is generated by the model [Bishop(2006)]. For practical reasons one often considers the logarithm of the likelihood, which has the same maximum as the likelihood since it is a monotonic function. The log-likelihood is defined as ln P (X˜ ; Θ) = ln L Y P (x̃l ; Θ) = l=1 L X ln P (x̃l ; Θ). (16) l=1 We use the average log-likelihood per training case denoted by ℓ̂. For RBMs it is defined as !+ * D E X −E(x̃,h) ℓ̂ := ln P (X̃ ; Θ) = ln − ln Z, e x̃ h (17) x̃ where x̃ ∈ X˜ . And hf (u)iu denotes the expectation of the function f (u) with respect to variable u. The gradient of the ℓ̂ turns out to be the difference between the expectations of the energies gradient under the data and model distribution, which is given by + *   X e−E(x̃,h)  ∂E (x̃, h)  ∂ ℓ̂ (17,2) 1 X X −E(x,h) ∂E (x, h) Z − (18) − − = e P e−E(x̃,h′ ) ∂θ ∂θ Z ∂θ x h h′ (1 ) = − * X h h Z x̃ ∂E (x̃, h) P (h|x̃) ∂θ + + x̃ * X h ∂E (x, h) P (h|x) ∂θ + . (19) x In practice, a finite set of i.i.d. samples can be used to approximate the expectations in (19). While we can use the training data to estimate the first term, we do not have any i.i.d. samples from the unknown model distribution to estimate the second term. Since we are able to compute the conditional probabilities in RBMs efficiently, Gibbs sampling can be used to generate those samples. But Gibbs-sampling only guarantees to generate samples from the model distribution if we run it infinite long. As this is impossible, a finite number of k sampling steps are used instead. This procedure is known as Contrastive Divergence - k (CD-k) algorithm, in which even k = 1 shows good results [Hinton(2002)]. The CD-gradient approximation is given by + * * + (k) X X ,h ∂ ℓ̂ ∂E (x̃, h) k ∂E x ≈− , (20) + P (h|x̃) P (h|x ) ∂θ ∂θ ∂θ (k) h h x̃ x where x(k) denotes the samples after k steps of Gibbs sampling. The derivatives of the GRBM’s energy function with respect to the parameters are given by ∂E (X, H) ∂b ∂E (X, H) ∂c ∂E (X, H) ∂W ∂E (X, H) ∂σ X−b , σ2 = − = −H, (21) (22) T = = XH , σ2 2 XT WH ||X − b||2 + , − σ3 σ3 − 4 (23) (24) and the corresponding gradient approximations (20) become    (k)  ∂ ℓ̂ x −b x̃ − b − ≈ , ∂b σ2 σ2 x(k) x̃ E D  ∂ ℓ̂ ≈ hP (h = 1|x̃)ix̃ − P h = 1|x(k) , ∂c x(k) + * * T + T x(k) P h = 1|x(k) ∂ ℓ̂ x̃P (h = 1|x̃) − ≈ , ∂w σ2 σ2 x(k) x̃   ∂ ℓ̂ ||x̃ − b||2 − 2 x̃T W P (h = 1|x̃) ≈ ∂σ σ3 x̃ * + (k) 2 (k) T ||x − b|| − 2 x W P h = 1|x(k) − , σ3 (k) (25) (26) (27) (28) x T where P (h = 1|x) := (P (h1 = 1|x) , · · · , P (hN = 1|x)) , i.e. P (h = 1|x) denotes a vector of probabilities. 2.3 The marginal probability distribution of the visible units From the perspective of density estimation, the performance of the model can be assessed by examining how well the model estimates the data distribution. We therefore take a look at the model’s marginal probability distribution of the visible units, which can be formalized as a product of experts (PoE) or as a mixture of Gaussians (MoG))1 . 2.3.1 In the Form of Product of Experts We derive the marginal probability distribution of the visible units P (X) by factorizing the joint probability distribution over the hidden units. X P (X) = P (X, h) (29) h (1,4) = N X 2 Y XT w∗j 1 − ||X−b|| 2σ2 ec j + σ 2 h j e Z j (30) hj hj ∈{0,1} = (11) = =  N  2 2 XT w 1 Y cj + σ2 ∗j − ||X−b|| − ||X−b|| 2 2 2N σ 2N σ +e e Z j  N  2 ||b+N w∗j ||2 −||b||2 ||X−b−N w∗j ||2 1 Y +cj − − ||X−b|| 2 2 2 2N σ 2N σ 2N σ +e e Z j N M h  1 Y √ 2πN σ 2 N X; b, N σ 2 Z j +e =: (31) ||b+N w∗j ||2 −||b||2 2N σ2 +cj N 1 Y pj (X). Z j N X; b + N w∗j , N σ 2 i (32) (33) (34) Equation (34) illustrates that P (X) can be written as a product of N factors, referred to as a product of experts [Hinton(2002)]. Each expert pj (X) consists of two isotropic Gaussians with the same variance N σ 2 . The first Gaussian is placed at the visible bias b. The second Gaussian is shifted 1 Some part of this analysis has been previously reported by [Freund & Haussler(1992)]. Thanks to the anonymous reviewer for pointing out this coincidence. 5 relative to the first one by N times the weight vector w∗j and scaled by a factor that depends on w∗j and b. Every hidden unit leads to one expert, each mode of which corresponds to one state of the corresponding hidden unit. Figure 1 (a) and (b) illustrate P (X) of a GRBM-2-2 viewed as a PoE, where GRBM-M -N denotes a GRBM with M visible and N hidden units. Figure 1: Illustration of a GRBM-2-2 as a PoE and MoG, in which arrows indicate the roles of the visible bias vector and the weight vectors. (a) and (b) visualize the two experts of the GRBM. The red (dotted) and blue (dashed) circles indicate the center of the two Gaussians in each expert. (c) visualizes the components in the GRBM. Denoted by the green (filled) circles, the four components are the results of the product of the two experts. Notice how each component sits right between a red (dotted) and a blue (dashed) circle. 2.3.2 In the Form of Mixture of Gaussians Using Bayes’theorem, the marginal probaility of X can also be formalized as: P (X) = X P (X|h) P (h) (35) h = X h = N X; b + Wh, σ M √ 2πσ 2 | Z {z P (h:h∈H0 ) + N X j=1 + | j=1 k>j √ M 2πσ 2 Z e | Z e +cj } P (hj :hj ∈H1 ) √ M 2πσ 2 2 2 −||b|| h+ ||b+Wh|| 2σ2 (36)  ||b+w∗j ||2 −||b||2 2σ2 {z T ec Z N X; b, σ 2 M √ 2πσ 2 N −1 X N X +..., }  2 N X; b + w∗j , σ 2 ||b+w∗j +w∗k ||2 −||b||2 2σ2 {z P (hjk :hjk ∈H2 ) +cj +ck }  N X; b + w∗j + w∗k , σ 2  (37) where Hk denotes the set of all possible binary vectors with exactly k ones and M − k zeros P −1 PN P respectively. As an example, N j=1 h∈H2 P (h) sums over the k>j P (hjk : hjk ∈ H2 ) = probabilities of all binary vectors having exactly two entries set to one. P (H) in (36) is derived as 6 follows P (H) = (1,4) = = (11) = Z 1 Z P (x, H) dx Z T ec H M Y e (38) T H xi wi∗ ||x −b ||2 − i2σ2i σ2 T M Z T H xi wi∗ ||xi −bi ||2 ec H Y e σ2 − 2σ2 dxi Z i   Z ||x −b −wT H||2 T M T H)2 −b2 i i ec H Y (bi +wi∗ i i∗ 2σ2 2σ2 dxi e e Z i M P = (39) (40) (41) (b +wT H)2 −b2 i M i∗ i ec H  √ 2σ2 2πσ 2 ei Z √ M 2πσ 2 ||b+WH||2 −||b||2 T 2σ2 ec H+ Z T = dx i (42) (43) Since the form in (37) is similar to a mixture of isotropic Gaussians, we follow its naming convention. Each Gaussian distribution is called a component of the model distribution, which is exactly the conditional probability of the visible units given a particular state of the hidden units. As well as in MoGs, each component has a mixing coefficient, which is the marginal probability of the corresponding state and can also be viewed as the prior probability of picking the corresponding component. The total number of components in a GRBM is 2N , which is exponential in the number of hidden units, see Figure 1 (c) for an example. The locations of the components in a GRBM are not independent of each other as it is the case in MoGs. They are centered at b+ Wh, which is the vector sum of the visible bias and selected weight vectors. The selection is done by the corresponding entries in h taking the value one. This implies that only the M + 1 components that sum over exactly one or zero weights can be placed and scaled independently. We name them first order components and the anchor component respectively. All 2N − M − 1 higher order components are then determined by the choice of the anchor and first order components. This indicates that GRBMs are constrained MoGs with isotropic components. 3 Experiments 3.1 Two-dimensional blind source separation The general presumption in the analysis of natural images is that they can be considered as a mixture of independent super-Gaussian sources [Bell and Sejnowski(1997)], but see [Zetzsche and Rohrbein(2001)] for an analysis of remaining dependencies. In order to be able to visualize how GRBMs model natural image statistics, we use a mixture of two independent Laplacian distributions as a toy example. The independent sources s = (s1 , s2 )T are mixed by a random mixing matrix A yielding x̃′ = As, where p (si ) = √ − 2|si | e √ 2 . It is common to whiten the data (see Section 4.1), resulting in x̃ = Vx̃′ = VAs, D (44) (45) E 1 T −2 where V = x̃′ x̃′ is the whitening matrix calculated with principle component analysis (PCA). Through all this paper, we used the whitened data. In order to assess the performance of GRBMs in modeling the data distribution, we ran the experiments for 200 times and calculated the ℓ̂ for test data analytically. For comparision, we also 7 calculated the ℓ̂ over the test data for ICA2 , an isotropic two-dimensional Gaussian distribution and the true data distribution3 . The results are presented in Table 1, which confirm the conclusion of [Theis et al.(2011)] that GRBMs are not as good as ICA in terms of ℓ̂. Table 1: Comparision of ℓ̂ between different models ℓ̂ ± std Gaussian GRBM ICA data distribution −2.8367 ± 0.0086 −2.8072 ± 0.0088 −2.7382 ± 0.0091 −2.6923 ± 0.0092 To illustrate how GRBMs model the statistical structure of the data, we looked at the probability distributions of the 200 trained GRBMs. About half of them (110 out of 200) recovered the independent components, see Figure 2 (a) as an example. This can be further illustrated by plotting the Amari errors4 between the true unmixing matrix A−1 and estimated model matrices, i.e. the unmixing matrix of ICA and the weight matrix of the GRBM, as shown in Figure 3. One can see that these 110 GRBMs estimated the unmixing matrix quite well, although GRBMs are not as good as ICA. This is due to the fact that the weight vectors in GRBMs are not restricted to be orthogonal as in ICA. For the remaining 90 GRBMs, the two weight vectors pointed to the opposite direction as shown in Figure 2 (b). Accordingly, these GRBMs failed to estimate the unmixing matrix, but in terms of density estimation these solutions have the same quality as the orthogonal ones. Thus all the 200 GRBMs were able to learn the statistical structures in the data and model the data distribution pretty well. For comparison, we plotted the probability distribution of a learned GRBM with four hidden units, see Figure 2 (c), in which GRBMs can always find the two independent components correctly. To further show how the components contribute to the model distribution, we randomly chose one of the 110 GRBMs and calculated the mixing coefficients of the anchor and the first order components , as shown in Table 2. The large mixing coefficient for the anchor component indicates that the model will most likely reach hidden states in which none of the hidden units are activated. In general, the more activated hidden units a state has, the less likely it will be reached, which leads naturally to a sparse representation of the data. Table 2: The mixing coefficients of a successfully-trained GRBM-2-2, GRBM-2-4 and an MoG-3. P P P P P P (h) P (h) P (h) P (h) P (h) h∈H1 h∈H0 GRBM-2-2 GRBM-2-4 MoG-3 0.9811 0.9645 0.9785 0.0188 0.0352 0.0215 h∈H2 h∈H3 h∈H4 7.8856e-05 3.4366e-04 – – 1.2403e-10 – – 6.9977e-18 – 2 For the fast ICA algorithm [Hyvärinen(1999)] we used for training, the ℓ̂ for super Gaussian sources can DP E N T ln 2 cosh2 w∗j x̃l also be assessed analytically by ℓ̂ = − + ln | det W|. x̃l j=1 3 As Dwe know the E true data distribution, the exact ℓ̂ √ ℓ̂ = − 2 |u1∗ x̃l | + |u2∗ x̃l | − ln 2 + ln | det U|, where U = (VA)−1 . 4 1 2N can be calculated by x̃l The Amari error [Bach and Jordan(2002)]! between two matrices A and B is defined as: N P N P |(AB−1 )ij | |(AB−1 )ij | − 1. + max |(AB−1 max |(AB−1 ) | ) | i=1 j=1 k ik k kj 8 (b) GRBM-2-2 4 4 2 2 0 0 x2 x2 (a) GRBM-2-2 −2 −2 −4 −4 −2 0 x1 2 4 −4 −2 0 x1 (a) (b) (c) GRBM-2-4 (d) MoG-2-3 4 4 2 2 0 0 x2 x2 −4 2 4 2 4 −2 −2 −4 −4 −4 −2 0 x1 2 −4 4 (c) −2 0 x1 (d) Figure 2: Illustration of the log-probability densities. The data is plotted in blue dots. (a)GRBM-2-2 which learned two independent components. (b)GRBM-2-2 which learned one independent component with opposite directions. (c)GRBM-2-4. (d)An isotropic MoG with three components. The arrows indicate the weight vectors of GRBM, while the crosses denote the means of the MoG components. Comparing (a) and (d), the contribution of the second order component is so insignificant that the probability distribution of the GRBM with four components is almost the same as the MoG with only three components. P P The dominance of h∈H0 P (h) and all h∈H1 P (h) can also be seen in Figure 2 by comparing a GRBM-2-2 (a) with an two dimensional MoG having three isotropic components denoted by MoG2-3 (d). Although the MoG-2-3 has one component fewer than the GRBM-2-2, their probability distributions are almost the same. 3.2 Natural image patches In contrast to random images, natural images have a common underlying structure which could be used to code them more efficiently than with a pixel-wise representation. [Olshausen and Field(1996)] showed that sparse coding is such an efficient coding scheme and that it is in addition a biological plausible model for the simple cells in the primary visual cortex. [Bell and Sejnowski(1997)] showed that the independent components provide a comparable representation for natural images. We now want to test empirically whether GRBMs generate such biological plausible results like sparse coding and ICA. We used the imlog natural image Database of [van Hateren and van der Schaaf(1998)] and randomly sampled 70000 grey scale image patches with a size of 14 × 14 pixels. The data was whitened using Zero-phase Component Analysis (ZCA), afterwards it was divided into 40000 training and 30000 testing image patches. We followed the training recipes mentioned in Section 4, since training a GRBM on natural image patches is not a trivial task. In Figure 4, we show the learned weight vectors namely features or filters, which can be regarded as receptive fields of the hidden units. They are fairly similar to the filters learned by ICA [Bell and Sejnowski(1997)]. Similar to the 2D experiment, we calculated the anchor and first order mixing coefficients, as shown in Table 3. The coefficients are much smaller compared to the anchor and first order coefficients of the GRBMs in the two dimensional case. However, they are 9 1.0 0.9 0.8 Amari error 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0 ICA GRBM Random matrix Figure 3: The Amari errors between the real unmixing matrix and the estimations from ICA and the 110 GRBMs. The box extends from the lower to the upper quantile values of the data, with a line at the median. The whiskers extend from the box to show the range of the reliable data points. The outlier points are marked by “+”. As a base line, the amari errors between the real unmixing matrices and random matrices are provided. Figure 4: Illustration of 196 learned filters of a GRBM-196-196. The plot has been ordered from left to right and from top to bottom by the increasing average activation level of the corresponding hidden units. still significantly large, considering that the total number of components in this case is 2196 . Similar to the two-dimensional experiments, the more activated hidden units a state has, the less likely it will be reached, which leads naturally to a sparse representation. To support this statement, we plotted the histogram of the number of activated hidden units per training sample, as shown in Figure 5. Table 3: The mixing coefficients of GRBMs-196-196 per component (the Partition function was estimated using AIS). P P P P (h) P (h) P (h) h∈H0 GRBM-196-196 h∈H1 0.04565 0.00070 h∈H\{H0 ∪H1 } 0.95365 We also examined the results of GRBMs in the over-complete case, i.e. GRBM-196-588. There is no prominent difference of the filters compared to the complete case shown in Figure 4. To further compare the filters in the complete and over-complete case, we estimated the spatial frequency, location and orientation for all filters in the spatial and frequency domains, see Figure 6 and Figure 7 respectively. This is achieved by fitting a Gabor function of the form used 10 0.25 frequency 0.20 0.15 0.10 0.05 0.00 28 56 84 112 140 The # of activated hidden units 168 196 Figure 5: The histogram of the number of activated hidden units per training sample. The histograms before and after training are plotted in blue (dotted) and in green (solid), respectively. by [Lewicki and Olshausen(1999)]. Note that the additional filters in the over-complete case increase the variety of spatial frequency, location and orientation. (a) GRBM−196−196 (b) GRBM−196−588 Figure 6: The spatial layout and size of the filters, which are described by the position and size of the bars. Each bar denotes the center position and the orientation of a fitted Gabor function within 14×14 grid. The thickness and length of each bar are propotional to its spatial-frequency bandwidth. 4 Successful Training of GRBMs on Natural Images The training of GRBMs has been reported to be difficult [Krizhevsky(2009), Cho et al.(2011)]. Based on our analysis we are able to propose some recipes which should improve the success and speed of training GRBMs on natural image patches. Some of them do not depend on the data distribution and should therefore improve the training in general. 4.1 Preprocessing of the Data The preprocessing of the data is important especially if the model is highly restricted like GRBMs. Whitening is a common preprocessing step for natural images. It removes the first and second order statistics from the data, so that it has zero mean and unit variance in all directions. This allows train11 (a) GRBM−196−196 (b) GRBM−196−588 fy fy 0 0.5 fx 1 0 0.5 fx 1 Figure 7: A polar plot of frequency tuning and orientation of the learned filters. The crosshairs describe the selectivity of the filters, which is given by the 1/16-bandwidth in spatial-frequency and orientation, [Lewicki and Olshausen(1999)]. ing algorithms to focus on higher order statistics like kurtosis, which is assumed to play an important role in natural image representations [Olshausen and Field(1996), Hyvärinen et al.(2001)]. The components of GRBMs are isotropic Gaussians, so that the model would use several components for modeling covariances. But the whitened data has a spherical covariance matrix so that the distribution can be modelled already fairly well by a single component. The other components can then be used to model higher order statistics, so that we claim that whitening is also an important preprocessing step for GRBMs. 4.2 Parameter Initialization The initial choice of model parameters is important for optimization process. Using prior knowledge about the optimization problem can help to derive an initialization, which can improve the speed and success of the training. For GRBMs we know from the analysis above that the anchor component, which is placed at the visible bias, represents most of the whitened data. Therefore it is reasonable in practice to set the visible bias to the data’s mean. Learning the right scaling is usually very slow since the weights and biases determine both the position and scaling of the components. In the final stage of training GRBMs on whitened natural images, the first components are scaled down extremely compared to the anchor component. Therefore, it will usually speed up the training process if we initialize the parameters so that the first order scaling factors are already very small. Considering equation (37), we are able to set a specific first order scaling factor by initializing the hidden bias to ||b + w∗j ||2 − ||b||2 + ln τj , (46) 2σ 2 so that the scaling is determined by τj , which should ideally be chosen close to the unknown final scaling factors. In practice, the choice of 0.01 showed good performance in most cases. The learning rate for the hidden bias can then be set much smaller than the learning rate for the weights.   √ √ 6 6 , , √N +M According to [Bengio(2010)], the weights should be initialized to wij ∼ U − √N +M cj = − where U (a, b) is the uniform distribution in the interval [a, b]. In our experience, this works better than the commonly used initialization to small Gaussian-distributed random values. 4.3 Gradient Restriction and Choices of the Hyperparameters The choice of the hyper-parameters has an significant impact on the speed and success of training GRBMs. For successful training in an acceptable number of updates, the learning rate needs to be sufficiently big. Otherwise the learning process becomes too slow or the algorithm converges to a local optimum where all components are placed in the data’s mean. But if the learning rate is chosen too big, the gradient can easily diverge resulting in a number overflow of the weights. This effect 12 Method CD-1 PCD-1 CD-10 PCD-10 PT-10 Time per epoch in s 2.1190 2.1348 10.8052 10.8303 21.4855 Table 4: Comparison of the CPU time for training a GRBM with different methods. becomes even more crucial as the model dimensionality increases, so that a GRBM with 196 visible and 1000 hidden units diverges already for a learning rate of 0.001. We therefore propose restricting the weight gradient column norms ∇w:j to a meaningful size to prevent divergence. Since we know that the components are placed in the region of data, there is no need for a weight norm to be bigger than twice the maximal data norm. Consequently, this natural bound also holds for the gradient and can in practice be chosen even smaller. It allows to choose big learning rates even for very large models and therefore enables fast and stable training. In practice, one should restrict the norm of the update matrix rather than the gradient matrix to also restrict the effects of the momentum term and etc. Since the components are placed on the data they are naturally restricted, which makes the use of a weight decay useless or even counter productive since we want the weights to grow up to a certain norm. Thus we do recommend not to use a weight decay regularization. A momentum term adds a percentage of the old gradient to the current gradient which leads to a more robust behavior especially for small batch-sizes. In the early stage of training the gradient usually varies a lot, a large momentum can therefore be used to prevent the weights from converging to zero. In the late stage however, it can also prevent convergence so that in practice a momentum of 0.9 that will be reduced to zero in the final stage of training is recommended. 4.4 Training Method Using the gradient approximation, RBMs are usually trained as described in Section 2.2. The quality of the approximation highly depends on the set of samples used for estimating the model expectation, which should ideally be i.i.d. But Gibbs sampling usually has a low mixing rate, which means that the samples tend to stay close to the previously presented samples. Therefore, a few steps of Gibbs sampling commonly leads to a biased approximation of the gradient. In order to increase the mixing rate [Tieleman(2008)] suggested to use a persistent Markov chain for drawing samples from the model distribution, which is referred as persistent Contrastive Divergence (PCD). [Desjardins et al.(2010)] proposed to use parallel tempering (PT), which selects samples from a persistent Markov chain with a different scaling of the energy function. In particular, [Cho et al.(2011)] analyzed PT algorithm for training GRBMs and proposed a modified version of PT. In our experiments all methods above lead to meaningful features and comparable ℓ̂, but differ in convergence speed as shown in Figure 8. As for PT, we used original algorithm [Desjardins et al.(2010)] together with weight restrictions and temperatures from 0.1 to 1 with stepsize 0.1. Although, PT has a better performance than CD, it has also a much higher computational cost as shown in Table 4. 5 Discussion The difficulties of using GRBMs for modeling natural images have been reported by several authors [Krizhevsky(2009), Bengio et al.(2006)] and various modifications have been proposed to address this problem. [Ranzato and Hinton(2010)] analyzed the problem from the view of generative models and argued that the failure of GRBMs is due to the model’s focus on predicting the mean intensity of each pixel rather than the dependence between pixels. To model the covariance matrices at the same time, they proposed the mean-covariance RBM (mcRBM). In addition to the conventional hidden units hm , 13 -277.35 Log Likelihood -277.45 -277.55 -277.65 CD-1 PCD-1 CD-10 PCD-10 PT-10 -277.75 -277.85 20 40 Epoch 60 80 100 Figure 8: Evolution of the ℓ̂ of a GRBM 196-16 on the whitened natural image dataset for CD, PCD using a k of 1, 10 each and PT with 10 temperatures. The learning curves are the average over 40 trials. The learning rate was 0.1, an initial momentum term of 0.9 was multiplied with 0.9 after each fifth epoch, the gradient was restricted to one hundredth of the maximal data norm (0.48), no weight decay was used. there is a group of hidden units hc dedicated to model the covariance between the visible units. From the view of density models, mcRBMs can be regarded as improved GRBMs such that the additional hidden units are used to depict the covariances. The conditional probabilities of mcRBM are given by P (X|hm , hc ) = N (X; Σ W hm , Σ) , (47)  −1 where Σ = C diag(Phc ) CT [Ranzato and Hinton(2010)]. By comparing (47) and (9), it can be seen that the components of mcRBM can have a covariance matrix that is not restricted to be diagonal as it is the case for GRBMs. From the view of generative models another explanation for the failure of GRBMs is provided by [Courville et al.(2011)]. Although they agree with the poor ability of GRBMs in modeling covariances, [Courville et al.(2011)] argue that the deficiency is due to the binary nature of the hidden units. In order to overcome this limitation, they developed the spike-and-slab RBM (ssRBM), which splits each binary hidden unit into a binary spike variable hj and a real valued slab variable sj . The conditional probability of visible units is given by   N X 1 P (X|s, h, ||X||2 < R) = N X; Λ−1 w∗j sj hj , Λ−1  , (48) B j=1 where Λ is a diagonal matrix and B is determined by integrating the Gaussian PN N (X; Λ−1 j=1 w∗j sj hj , Λ−1 ) over the ball ||X||2 < R [Courville et al.(2011)]. In contrast to the conditional probability of GRBMs (9), w∗j in (48) is scaled by the continuous variable sj , which implies that the components can be shifted along their weight vectors. We have shown that GRBMs are capable of modeling natural image patches and that the reported failures are due to the training procedure. [Lee et al.(2007)] showed also that GRBMs could learn meaningful filters by using a sparse penalty. But this penalty changes the objective function and introduced a new hyper-parameter. [Cho et al.(2011)] addressed these training difficulties, by proposing a modification of PT and an adaptive learning rate. However, we claim that the reported difficulties of training GRBMs with PT 14 are due to the mentioned gradient divergence problem. With gradient restriction we were able to overcome the problem and train GRBMs with normal PT successfully. 6 Conclusion In this paper, we provide a theoretical analysis of GRBM and showed that its product of experts formulation can be rewritten as a constrained mixture of Gaussians. This representation gives a much better insight into the capabilities and limitations of the model. We use two-dimensional blind source separation task as a toy problem to demonstrate how GRBMs model the data distribution. In our experiments, GRBMs were capable of learning meaningful features both in the toy problem and in modeling natural images. In both cases, the results are comparable to that of ICA. But in contrast to ICA the features are not restricted to be orthogonal and can form an over-complete representation. However, the success of training GRBMs highly depends on the training setup, for which we proposed several recipes based on the theoretical analysis. Some of them can be further generalized to other datasets or directly applied like the gradient restriction. In our experience, maximizing the ℓ̂ does not imply good features and vice versa. Prior knowledge about the data distribution will be beneficial in the modeling process. For instance, our recipes are based on the prior knowledge of the natural image statistics, which is center peaked and has heavy tails. It will be an interesting topic to integrate prior knowledge of the data distribution into the model rather than starting modeling from scratch. Considering the simplicity and easiness of training with our proposed recipe, we believe that GRBMs provide a possible way for modeling natural images. Since GRBMs are usually used as first layer in deep belief networks, the successful training of GRBMs should therefore improve the performance of the whole network. 15 References [Bach and Jordan(2002)] F. R. Bach and M. I. Jordan. Kernel independent component analysis. Journal of Machine Learning Research, 3:1–48, 2002. [Bell and Sejnowski(1997)] A. Bell and T. Sejnowski. The “independent components” of natural scenes are edge filters. Vision Research, 37(23):3327–3338, 12 1997. ISSN 00426989. [Bengio(2010)] X. Glorot Bengio. Understanding the difficulty of training deep feedforward neuralnetworks. AISTATS, 2010. [Bengio(2009)] Y. Bengio. Learning deep architectures for AI. Foundation and Trends in Machine Learning., 2(1):1–127, 2009. Also published as a book. Now Publishers, 2009. [Bengio et al.(2006)] Y. Bengio, P. Lamblin, D. Popovici, and H. Larochelle. Greedy layer-wise training of deep networks. In Proceedings of the Conference on Neural Information Processing Systems, pages 153–160, 2006. [Bishop(2006)] C. M. Bishop. Pattern Recognition and Machine Learning, chapter 8, pages 359– 422. Springer, Secaucus, NJ, USA, 2006. ISBN 0387310738. [Cho et al.(2011)] K. Cho, A. Ilin, and T. Raiko. Improved learning of gaussian-bernoulli restricted boltzmann machines. In Proceedings of the International Conference on Artificial Neural Networks, 10–17, 2011. [Courville et al.(2011)] A. C. Courville, J. Bergstra, and Y. Bengio. A spike and slab restricted boltzmann machine. Journal of Machine Learning Research, 15:233–241, 2011. [Desjardins et al.(2010)] G. Desjardins, A. Courville, Y. Bengio, P. Vincent, and O. Delalleau. Parallel tempering for training of restricted boltzmann machines. In Proceedings of the International conference on Artificial Intelligence and Statistics, 2010. [Erhan et al.(2010)] D. Erhan, Y. Bengio, A. C. Courville, P. Manzagol, P. Vincent, and Y. Bengio. Why does unsupervised pre-training help deep learning? Journal of Machine Learning Research, 11:625–660, 2010. [Freund & Haussler(1992)] Y. Freund, and D. Haussler(1992) Unsupervised learning of distributions of binary vectors using two layer networks. Proceedings of the Conference on Neural Information Processing Systems, 912 – 919. [Hinton and Salakhutdinov(2006)] G. E. Hinton and R. Salakhutdinov. Reducing the dimensionality of data with neural networks. Science, 313(5786):504–507, 7 2006. [Hinton(2002)] G. E. Hinton. Training products of experts by minimizing contrastive divergence. Neural Computation, 14:1771–1800, 8 2002. ISSN 0899-7667. [Hyvärinen(1999)] A. Hyvärinen. Fast and robust fixed-point algorithms for independent component analysis. IEEE Transactions on Neural Networks, 10(3):626–634, 1999. [Hyvärinen et al.(2001)] A. Hyvärinen, J. Karhunen, and E. Oja. Independent component analysis. John Wiley & Sons, USA, 2001. ISBN 0-471-40540-X. [Karklin and Lewicki(2009)] Y. Karklin and M.S. Lewicki. Emergence of complex cell properties by learning to generalize in natural scenes. Nature, 457:83–86, 1 2009. [Köster and Hyvärinen(2010)] U. Köster and A. Hyvärinen. A two-layer model of natural stimuli estimated with score matching. Neural Computation, 22(9):2308–2333, 2010. [Krizhevsky(2009)] A. Krizhevsky. Learning multiple layers of features from tiny images. Master’s thesis, University of Toronto, Toronto, 4 2009. [Le Roux et al.(2011)Le Roux, Heess, Shotton, and Winn] N. Le Roux, N. Heess, J. Shotton, and J. Winn. Learning a generative model of images by factoring appearance and shape. Neural Computation, 23(3):593–650, 12 2011. [Lee et al.(2007)] H. Lee, C. Ekanadham, and A. Y.Ng. Sparse deep belief net model for visual area v2. In Proceedings of the 20th Conference on Neural Information Processing Systems. MIT Press, 2007. [Lewicki and Olshausen(1999)] M. S. Lewicki and B. A. Olshausen. Probabilistic framework for the adaptation and comparison of image codes. Journal of teh Optical Society of America, 16 (7):1587–1601, 7 1999. 16 [Melchior(2012)] J. Melchior. Learning natural image statistics with gaussian-binary restricted boltzmann machines. Master’s thesis, ET-IT Dept., Univ. of Bochum, Germany, 2012. [Olshausen and Field(1996)] B. A. Olshausen and D. J. Field. Natural image statistics and efficient coding. Networks, 7(2):333–339, 5 1996. ISSN 0954-898X. [Ranzato and Hinton(2010)] M. Ranzato and G. E. Hinton. Modeling pixel means and covariances using factorized third-order boltzmann machines. In Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition, pages 2551–2558, 2010. [Ranzato et al.(2010)] M. Ranzato, A. Krizhevsky, and G. E. Hinton. Factored 3-way restricted boltzmann machines for modeling natural images. Journal of Machine Learning Research, 9: 621–628, 2010. [Smolensky(1986)] P. Smolensky. Information processing in dynamical systems: foundations of harmony theory. In Parallel distributed processing: explorations in the microstructure of cognition, pages 194–281. MIT Press, Cambridge, MA, USA, 1986. ISBN 0-262-68053-X. [Theis et al.(2011)] L. Theis, S. Gerwinn, F. Sinz, and M. Bethge. In all likelihood, deep belief is not enough. Journal of Machine Learning Research, 12:3071–3096, 11 2011. [Tieleman(2008)] T. Tieleman. Training restricted boltzmann machines using approximations to the likelihood gradient. In Proceedings of the 25th Annual International Conference on Machine Learning, pages 1064–1071, New York, NY, USA, 2008. ACM. ISBN 978-1-60558-205-4. [van Hateren and van der Schaaf(1998)] J. H. van Hateren and A. van der Schaaf. Independent component filters of natural images compared with simple cells in primary visual cortex. Proceedings of the Royal Society, 265(1394):359–366, 1998. PMC1688904. [Wang et al.(2012)] N. Wang, J. Melchior, and L. Wiskott. An analysis of gaussian-binary restricted boltzmann machines for natural image. In Michel Verleysen, editor, Proceedings of the 20th European Symposium on Artificial Neural Networks, Computational Intelligence and Machine Learning, pages 287–292, Bruges, Belgium, Arpil 2012. [Welling et al.(2004)] M. Welling, M. Rosen-Zvi, and G. E. Hinton. Exponential family harmoniums with an application to information retrieval. In Proceedings of the 17th Conference on Neural Information Processing Systems. MIT Press, 12 2004. [Zetzsche and Rohrbein(2001)] C. Zetzsche and F. Rohrbein. Nonlinear and extra-classical receptive field properties and the statistics of natural scenes. Network Comp Neural Sys, 12:331–350, Aug 2001. 17
9cs.NE
Inter-Operator Resource Management for Millimeter Wave, Multi-Hop Backhaul Networks Omid Semiari† , Walid Saad† , Mehdi Bennis‡ , and Zaher Dawy∗ † arXiv:1704.03620v2 [cs.GT] 19 May 2017 ∗ Wireless@VT, Bradley Department of Electrical and Computer Engineering, Virginia Tech, Blacksburg, VA, USA, Email: {osemiari,walids}@vt.edu ‡ Centre for Wireless Communications-CWC, University of Oulu, Finland, Email: [email protected] Department of Electrical and Computer Engineering, American University of Beirut, Lebanon, Email: [email protected] Abstract—In this paper, a novel framework is proposed for optimizing the operation and performance of a large-scale, multihop millimeter wave (mmW) backhaul within a wireless small cell network (SCN) that encompasses multiple mobile network operators (MNOs). The proposed framework enables the small base stations (SBSs) to jointly decide on forming the multihop, mmW links over backhaul infrastructure that belongs to multiple, independent MNOs, while properly allocating resources across those links. In this regard, the problem is addressed using a novel framework based on matching theory that is composed to two, highly inter-related stages: a multi-hop network formation stage and a resource management stage. One unique feature of this framework is that it jointly accounts for both wireless channel characteristics and economic factors during both network formation and resource management. The multi-hop network formation stage is formulated as a one-to-many matching game which is solved using a novel algorithm, that builds on the so-called deferred acceptance algorithm and is shown to yield a stable and Pareto optimal multi-hop mmW backhaul network. Then, a one-to-many matching game is formulated to enable proper resource allocation across the formed multi-hop network. This game is then shown to exhibit peer effects and, as such, a novel algorithm is developed to find a stable and optimal resource management solution that can properly cope with these peer effects. Simulation results show that, with manageable complexity, the proposed framework yields substantial gains, in terms of the average sum rate, reaching up to 27% and 54%, respectively, compared to a non-cooperative scheme in which inter-operator sharing is not allowed and a random allocation approach. The results also show that our framework improves the statistics of the backhaul sum rate and provides insights on how to manage pricing and the cost of the cooperative mmW backhaul network for the MNOs. I. I NTRODUCTION Network densification based on the concept of small cell networks (SCNs) is seen as the most promising solution to cope with the increasing demand for wireless capacity [1]. SCNs are built on the premise of a viral and dense deployment of small base stations (SBSs) over large geographical areas so as to reduce the coverage holes and improve the spectral efficiency [2]. However, such a large-scale deployment of SBSs faces many challenges in terms of resource management, network modeling, and backhaul support [2]. In particular, providing backhaul support for a large number of SBSs that can be deployed at adverse locations within a geographical area has emerged as one of the key challenges This research was supported by the U.S. National Science Foundation under Grants CNS-1460316 and CNS-1617896. facing the effective operation of future heterogeneous SCNs [3]. In particular, due to the density of SCNs, mobile network operators (MNOs) will not be able to maintain an expensive and costly deployment of fiber backhauls to service SBSs as shown in [4] and [3]. Instead, MNOs are moving towards the adoption of wireless backhaul solutions that are viewed as an economically viable approach to perform backhauling in dense SCNs. In fact, MNOs expect that 80% of SBSs will connect to the core network via wireless backhaul as detailed in [3] and [5]. Existing works have proposed a number of solutions for addressing a handful of challenges facing SCN backhauling [3]–[24]. The authors in [12] propose a fair resource allocation for the out-band relay backhaul links. The proposed approach developed in [12] aims to maximize the throughput fairness among backhaul and access links in LTE-Advanced relay system. In [13], a backhaul resource allocation approach is proposed for LTE-Advanced in-band relaying. This approach optimizes resource partitioning between relays and macro users, taking into account both backhaul and access links quality. Dynamic backhaul resource provisioning is another important problem in order to avoid outage in peak traffic hours and under-utilizing frequency resources in low traffic scenarios. In this regard, in [14], a dynamic backhaul resource allocation approach is developed based on evolutionary game theory. Instead of static backhaul resource allocation, the authors take into account the dynamics of users’ traffic demand and allocate sufficient resources to the base stations, accordingly. Although interesting, the body of work in [12]– [14] does not consider the potential deployment of millimeter wave communication at the backhaul network and is primarily focused on modeling rather than resource management and multi-hop backhaul communication. Providing wireless backhaul links for SBSs over millimeter wave (mmW) frequencies has recently been dubbed as one of the most attractive technologies for sustaining the backhaul traffic of SCNs [3]–[11], due to the following promising characteristics, among others: 1) The mmW spectral band that lies within the range 30-300 GHz will deliver high-capacity backhaul links by leveraging up to 10 GHz of available bandwidth which is significantly larger than any ultra-wideband system over sub-6 GHz frequency band. In addition, high beamforming gains are expected from mmW antenna arrays, with large number of elements, to overcome path loss [9], 2) more importantly, mmW backhaul links will not interfere with legacy sub-6 GHz communications in either backhaul or access links, due to operating at a different frequency band. Even if the access network operates over the mmW frequency band such as in self-backhauling architectures, mmW communications will generally remain less prone to interference, due to the directional transmissions, short-range links, as well as susceptibility to the blockage [25], and 3) over the past few years, research for utilizing mmW frequencies for wireless backhaul networks has become an interesting field that attracted a lot of attention in both academia and industry [3]–[11], [26]. As an example, in 2014, a total of 15 telecom operators, vendors, research centers, and academic institutions (including Nokia, Intel, and operators Orange and Telecom Italia) have launched a collaborative project in Europe, called MiWaveS, to develop mmW communications for 5G backhaul and access networks [26]. However, compared to existing ultra-dense networks over sub-6 GHz band, the major challenges of mmW backhaul networks can be listed as follows: 1) MmW backhaul links will typically operate over much shorter range than their sub-6 Ghz counterparts (usually do not exceed 300 meters [16], [27]), and, thus, more SBSs will be required to provide backhaul support for the users within a certain geographical area. Therefore, mmW SBS deployments are expected to be even denser, compared to the already dense sub-6 GHz networks [28]. Such ultra dense network will require fast and efficient network formation algorithms to establish a multi-hop backhaul link between the core network and each demanding SBS, 2) the backhaul network must be significantly reliable. However, the received signal power of mmW signals may significantly degrade if the backhaul link is blocked by an obstacle. For SBSs that are deployed in adverse locations, such as urban furniture, the received signal power may degrade due to rain or blockage by large vehicles. One solution is to increase the density of SBSs such that if a backhaul link between two SBSs is blocked, the demanding SBS can establish a reliable link with another SBS. However, this solution will increase the cost of the backhaul network for the MNO. In our work, we have motivated the use of cooperation between MNOs to achieve a robust and economically efficient backhaul solution, and 3) due to the directional transmissions of the mmW signals, broadcast control channels can lead to a mismatch between the control and data planes at mmW frequency bands [29]. Therefore, fully centralized approaches that rely on receiving control signals from a central station over broadcast channels may not be practical, thus, motivating the adoption of suitable distributed algorithms for an effective resource management. Several recent studies have studied the viability of mmW as a backhaul solution as presented in [10] and [15]–[20]. For instance, the work in [10] proposes a model based on stochastic geometry to analyze the performance of the selfbackhauled mmW networks. The work in [15] analyzes the performance of a dual-hop backhaul network for mmW small cells. In [16], the authors perform channel measurements and provide insights for the mmW small cell backhaul links. In [17], the performance of adaptive and switching beamforming techniques are investigated and evaluated for mmW backhaul networks. Moreover, the impact of diffraction loss in mmW backhaul network is analyzed in [19]. The authors in [18] propose a multi-objective optimization framework for joint deployment of small cell base stations and wireless backhaul links. In [20], the authors propose an autonomous beam alignment technique for self-organizing multi-hop mmW backhaul networks. In [28], the authors have motivated the use of a multi-hop mmW backhaul as a viable solution for emerging 5G networks and they analyzed the impact of the deployment density on the backhaul network capacity and power efficiency. Moreover, in [30], the authors have proposed a multi-hop backhaul solution with a TDMA MAC protocol for WiMAX. The body of work in [10] and [15]–[20] solely focuses on physical layer metrics, such as links’ capacity and coverage. In addition, it is focused only on single-hop or dual-hop backhaul networks, while new standards such as IEEE 802.11ay envision fully multi-hop networks. The work presented in [28] does not provide any algorithm to determine how SBSs must form a multi-hop mmW backhaul network. Moreover, the proposed model in [28] is too generic and does not capture specific characteristics of a mmW network, such as susceptibility to blockage and directional transmissions. Last but not the least, no specific analysis or algorithm is provided for resource management in multi-hop mmW backhaul networks. The solution presented in [30] is not directly applicable to the mmW backhaul networks, as mmW is substantially different from WiMAX systems. In fact, authors in [30] focus primarily on the routing and link activation protocols in order to minimize the interference among active links. Such a conservative approach will yield an inefficient utilization of the mmW frequency resources, since interference scenario in WiMAX systems is completely different with directional mmW communications. Furthermore, the body of work in [10], [15]–[20], [28], and [30] does not account for the effect of backhaul cost in modeling backhaul networks. In fact, these existing works typically assume that all infrastructure belong to the same MNO which may not be practical for dense SCNs. In wireless networks, the backhaul cost constitutes a substantial portion of the total cost of ownership (TCO) for MNOs as indicated in [4] and [3]. In fact, it is economically inefficient for an individual MNO to afford the entire TCO of an independent backhaul network as demonstrated in [4], [3], and [24]. The main advantages of inter-operator backhaul sharing is to reduce the number of required sites/radio access technology (RAT) interfaces per MNO to manage backhaul traffic, site rent, capital expenditures (CAPEX) by avoiding duplicate infrastructure, site operating expenditures (OPEX), and electricity costs [31]. Moreover, inter-operator mmW backhaul architectures are more robust against the blockage and link quality degradation compared to the schemes in which operators act independently and non-cooperatively [6]. This stems from the fact that cooperation increases flexibility to establish new backhaul links that can easily bypass obstacles. Therefore, MNOs will need to share their backhaul network resources with other MNOs that require backhaul support for their SBSs [24]. Hence, beyond the technical challenges of backhaul management in SCNs, one must also account for the cost of sharing backhaul resources between MNOs. To address such economic challenges, a number of recent works have emerged in [11] and [21]–[24]. The work in [24] motivates a business model for an SCN where multiple MNOs share the SBSs that are deployed on the street lights of dense urban areas. In [21] an economic framework is developed to lease the frequency resources to different MNOs by using novel pricing mechanisms. In [22], the authors propose a cost evaluation model for small cell backhaul networks. This work highlights the fact that integrating heterogenous backhaul technologies is mandatory to achieve a satisfactory performance in a backhaul network. Moreover, they show that the TCO of an SCN is much higher than conventional cellular networks. Therefore, it is more critical to consider backhauling cost in small cell backhaul network design. The authors in [23] propose a model where MNOs buy energy from the renewable power suppliers for their mmW backhaul network and solve the problem as a Stackelberg game between MNOs and power suppliers. In [11], we studied the problem of resource management for the mmW-microwave backhaul networks with multiple MNOs. The approach in [11] considers both cost and the channel state information (CSI) to allocate backhaul resources to the SBSs. The provided solutions in [21]–[24] focus solely on the economic aspects of the backhaul network, while a suitable backhaul network model must integrate the cost constraints with the physical constraints of the wireless network. In addition, [11] does not consider multihop backhaul networks. Moreover, the backhaul model studied in [11] is restricted to the case in which only two MNOs are in the network. The main contribution of this paper is to propose a novel framework to model and analyze resource management and pricing for facilitating inter-operator sharing of multi-hop, mmW backhaul infrastructure in dense SCNs. In particular, the proposed framework is formulated using suitable techniques from matching theory [32] so as to provide a distributed solution for managing the resources over multi-hop backhaul links. In the formulated model, the SBSs of one MNO can act as anchored BSs (A-BSs) to provide backhaul support to other, demanding BSs (D-BSs) that may belong to other MNOs. The proposed framework is composed of two highly-interrelated matching games: a network formation game and a resource management game. The goal of the network formation game is to associate the D-BSs to A-BSs for every hop of the backhaul links. This game is shown to exhibit peer effects thus mandating a new algorithmic approach that differs from classical matching works in [32] and [33]. To solve this game, we propose a distributed algorithm that is guaranteed to converge to a two-sided stable and Pareto optimal matching between the A-BSs and the D-BSs. Once the stable and optimal network formation solution is found, we propose a second matching game for resource management that allocates the sub-channels Fig. 1: An example of mmW-MBN with multiple MNOs. SBSs with the same color belong to the same MNO. of each A-BS to its associated D-BSs, determined by the first matching game. The proposed approach considers the cost of the backhaul jointly with the links’ achievable rates to allocate the sub-channels to the D-BSs. To solve this resource management matching game with peer effects, we propose a novel distributed algorithm that yields a two-sided stable and Pareto optimal matching between the sub-channels and the D-BSs. We compare the performance of the proposed cooperative mmW multi-hop backhaul network (mmW-MBN) and compare the results with non-cooperative mmW-MBN. Simulation results show that MNOs cooperation provides significant gains in terms of network’s average backhaul sum rate, reaching up to 30%, compared to the non-cooperative mmW-MBN. The results also show that the cooperation among MNOs will significantly improve the statistics of the backhaul rate per SBS. The rest of this paper is organized as follows. Section II describes the system model and formulates the problem. Section III presents our distributed approach to solve the network formation problem. Section IV provides the proposed solution to solve the resource allocation problem. Section V provides the simulation results and Section VI concludes the paper. II. S YSTEM M ODEL Consider a mmW-MBN that is used to support the downlink transmissions of M SBSs within the set M. Each SBS belong to one of N MNOs within the set N S . The set M can be decomposed into N subsets M , with n n∈N Mn = M and T M = ∅, where M represents the subset of SBSs n n n∈N belonging to MNO n. The SBSs are distributed uniformly in a planar area with radius dmax around a macro base station (MBS), m0 , located at (0, 0) ∈ R2 . The MBS is connected to the core network over a broadband fiber link, as shown in Fig. 1, and is shared by all MNOs. The SBSs can be connected to the MBS via a single-hop or a multi-hop mmW link. The mmW-MBN can be represented as a directed graph G(M, E), in which the SBSs are the vertices and E is the set of edges. TABLE I: Variables and notations Notation M N K e(m0 , m) Mn MD-BS m0 ζe ∈ {0, 1} rm (k, m0 ; ζ) D m D Pm πj Qm 1mm0 Description Number of SBSs Number of MNOs Number of sub-channels Backhaul link from m0 to m Set of SBSs belonging to MNO n SBSs for whom SBS m0 serves as an A-BS State of link e Rate for D-BS m over sub-channel k Preference profile of D-BSs over A-BSs Preference profile of D-BSs over sub-channels Network formation matching for j-th hop Quota of A-BS m Indicates if m and m0 belong to same MNO Each edge, e(m0 , m) ∈ E, represents a mmW backhaul link from SBS m0 to m. Hereinafter, for any link, the transmitting and the receiving SBSs (over the backhaul) will be referred to, respectively, as the A-BSs and the D-BSs. Thus, in our model, an SBS can be either a D-BS or an A-BS. Each A-BS m will serve up to Qm D-BSs, while each D-BSs will be connected to one A-BS. To show that an arbitrary D-BS m is connected to an A-BS m0 , we use the following binary variable ( 1 if e(m0 , m) ∈ E, 0 e (m , m) = (1) 0 otherwise, where e (m0 , m) = 0 implies that no backhaul link exists from SBS m0 to m. Finally, we denote by MD-BS the subset m0 of SBSs for whom SBS m0 serves as an A-BS. In other words, 0 MD-BS m0 = {m ∈ M| e (m , m) = 1}. The backhaul links are carried out over a mmW frequency band, composed of K subchannels, within the set K, each of a bandwidth w. A summary of our notation is provided in Table I. A. Channel Model The state of a backhaul link is defined as a Bernoulli random variable ζm0 m with success probability ρm0 m to determine if the link is LoS or NLoS. In fact, ζm0 m = 1, if e(m0 , m) is LoS, otherwise, ζm0 m = 0. Based on the field measurements carried out in [8] and [34]–[36], the large-scale path loss of the link e(m0 , m), denoted by LdB (m0 , m) in dB, is given by   4πd0 LdB (m0 , m) = 10 log10 (l(m0 , m)) = 20 log10 λ   ky m − y m0 k + 10α log10 + χ, d ≥ d0 , (2) d0 where λ is the wavelength at carrier frequency fc = 73 GHz, d0 is the reference distance, and α is the path loss exponent. Moreover, ky m − y m0 k is the Euclidean distance between SBSs m and m0 , located, respectively, at y m ∈ R2 and y m0 ∈ R2 . In addition, χ is a Gaussian random variable with zero mean and variance ξ 2 . Path loss parameters α and ξ will naturally have different values, depending on the state of the link. In fact, depending on whether the link is LoS or NLoS, these values can be chosen such that the path loss model in (2) will provide the best linear fit with the field measurements carried out in [8]. The benefit of the free space path loss model Notation M N K E Mdm w ρe rm (m0 , x) A m PkK µj rm,th r̄m (m0 ) Description Set of SBSs Set of MNOs Set of sub-channels Set of backhaul links Set of SBSs of distance d from m Bandwidth of each sub-channel Expected value of ζe Rate of D-BS m from A-BS m0 , given x Preference profile of A-BSs over D-BSs Preference profile of sub-channels over D-BSs Resource allocation matching for j-th hop Backhaul minimum rate requirement for m Average rate for m over all sub-channels used in (2), compared with other models such as the alphaplus-beta model, is that it is valid for all distances above the reference distance d0 and the model parameters α and χ have concrete physical interpretations. In addition, the field measurements in [37]–[39] show that the mmW channel delay spread can be large, reaching up to more than 100 ns, for the outdoor deployment of mmW SBSs in urban areas. To this end, for any link e(m0 , m), a slowvarying frequency flat fading channel hm0 km is considered over sub-channel k. Hence, conditioned to the link state ζ, the achievable rate for a given link e(m0 , m) over sub-channel k will be given by  0 rm (k, m ; ζ) = w log2 1+ (3)  pm0 ,k ψ(m0 , m)l (m0 , m) |hm0 km |2 P , 00 00 2 2 00 00 m00 6=m,m0 pm ,k ψ(m , m)l (m , m) |hm km | + σ where pm0 ,k and σ 2 denote, respectively, the transmit power of A-BS m0 over sub-channel k and the noise power. To strike a balance between system performance and complexity, uniform power allocation is assumed. Here, we assume that total transmit power pt,m0 is distributed uniformly over all subchannels, such that pm0 ,k = pt,m0 /K [40]–[43]. The uniform power allocation assumption is also due to the fact that at a high SNR/SINR regime, as is expected in a mmW network with relatively short-range links and directional transmissions, it is well known that optimal power allocation policies such as the popular water-filling algorithm will ultimately converge to the uniform power allocation [43]. Moreover, ψ(m0 , m) represents the combined transmit and receive antenna gains. The antenna gain pattern for each BS is assumed to be sectorized and is given by [10]: ( Gmax , if θ < |θm |, G(θ) = (4) Gmin , otherwise, where θ and θm denote, respectively, the azimuth angle and the antennas’ main lobe beamwidth. Moreover, Gmax and Gmin denote, respectively, the antenna gain of the main lobe and side lobes. It is assumed that for a desired link between A-BS m0 and D-BS m, ψ(m0 , m) = G2max . Moreover, ψ(m00 , m) of an interference link from A-BS m00 to the target D-BS m is assumed to be random. Using (3), we can write the achievable rate for the link e(m0 , m) over the allocated sub-channels as follows: X rm (m0 ; x) = rm (k, m0 ; ζ)xm0 km , (5) k∈K where x is the resource allocation vector with elements xm0 km = 1, if SBS m0 transmits to m over sub-channel k, otherwise, xm0 km = 0. In (5), we remove the dependency on ζ in the left-hand side to simplify the notations. Here, considering a decode-and-forward scheme, we note that, if an SBS m is connected to the MBS via a multi-hop link of length n, then rm (m0 ; x) will be limited by 1/n times the minimum (bottleneck) of all link rates over the multi-hop connection [44]. In addition, by averaging with respect to ζ, the average achievable rate over all sub-channels for D-BS m assigned to A-BS m0 will be " # X 0 0 r̄m (m ) = E rm (m , k; ζ) , (6) k∈K = P(ζm0 ,m = 1) X + P(ζm0 ,m = 0) X X sub-channels of each A-BS m to their corresponding D-BSs in MD-BS m . The network formation problem can be formulated as follows: X X t e (m0 , m)r̄m (m0 ) − κm qm argmax 0 1mm0 , (10a) m∈M m0 ∈Md m s.t. e (m0 , m) + e (m, m00 ) k∈K (7) k∈K = ρm 0 m formation and resource allocation. E rm (m0 , k; ζ)xm0 km rm (m0 , k; ζ)xm0 km , Fig. 2: Proposed multi-stage framework for joint backhaul network rm (m0 , k; ζ = 1)xm0 km +e (m00 , m0 ) ≤ 2, ∀m, m0 , m00 ∈ M, X e (m0 , m) ≤ 1, ∀m ∈ M, X + (1 − ρm0 m ) 0 rm (m , k; ζ = 0)xm0 km . (8) k∈K For dense urban areas, the number of obstacles blocking an arbitrary link e(m0 , m) increases as ky m − y m0 k increases. Such severe shadowing will significantly reduce the received signal power, particularly, for street-level deployment of mmW SBSs over urban furniture such as lamp posts. Therefore, the communication range of each SBS will be limited to a certain distance d, where d depends on the density of the obstacles, as suggested in [16] and [27]. To this end, we define Mdm as Mdm = {m0 ∈ M, m0 6= m ky m − y m0 k ≤ d}, (10c) m0 ∈Md m k∈K X (10b) (9) which effectively represents the set of SBSs with which m is able to communicate over an LoS or an NLoS link. B. Network formation and resource allocation in mmW-MBN with multiple MNOs We consider a cooperative, inter-operator mmW-MBN in which, under proper pricing incentives, the SBSs of each MNO may act as A-BSs for other SBSs belonging to other MNOs. We let qm be a unit of price per sub-channel of SBS m ∈ Mn , as determined by MNO n. That is, if xmkm0 = 1 for m ∈ Mn and m0 ∈ Mn0 , where n 6= n0 , MNO n0 will have to pay qm to MNO n. To solve the resource management problem for the proposed mmW-MBN, we need to first determine the backhaul links, e (m0 , m), and then specify the rate over each link, rm (m0 , x). To this end, as illustrated in Fig. 2, we must solve two interrelated problems: 1) network formation problem that determines E, and 2) resource allocation problem to assign e (m0 , m) ≤ Qm0 , ∀m0 ∈ M, (10d) m∈Md m0 e (m0 , m) + e (m, m0 ) ≤ 1, ∀m, m0 ∈ M, (10e) e (m0 , m) ∈ {0, 1}, ∀m, m0 ∈ M, (10f) where 1mm0 = 1, if both SBSs m and m0 belong to different MNOs, otherwise, 1mm0 = 0. In addition, κm is a weighting scalar that scales the cost of a link with respect to Pits rate. The t 0 total cost of a link e(m0 , m) for m is qm 0 = qm0 k∈K xm km . Constraint (10b) is to avoid any cycles. In addition, (10c) indicates that each D-BS must be assigned to at most one A-BS. Moreover, (10d) indicates that each A-BS m0 can be assigned to up to Qm0 D-BSs. Constraint (10e) ensures that all links are directional. That is, an SBS m may transmit to m0 or receive its traffic from m0 , however, cannot do both simultaneously. The solution of problem (10a)-(10f) yields E for the mmWMBN graph G(M, E) which also determines MD-BS for all m0 m0 ∈ M. Next, the sub-channels of each A-BS m0 must be allocated to its assigned D-BSs in MD-BS m0 . Each MNO n seeks to minimize the cost of its backhaul network, while maximizing the rate for each one of its SBSs m ∈ Mn . To this end, the cooperative backhaul resource allocation problem can be formulated at each D-BS m with e (m0 , m) = 1 as follows: argmax x s.t. X [rm (k, m0 ; ζ) − κm qm0 1m0 m ] xm0 km , (11a) k∈K rm (m0 ; x) ≤ 1 rm0 (m00 ; x), |MD-BS | + 1 0 m m0 ∈ MD-BS m00 , (11b) rm (m0 ; x) ≥ rm,th , X xm0 km ≤ K, (11c) (11d) k∈K X xm0 km ≤ 1, (11e) m∈π(m0 ) xm0 km ∈ {0, 1}, (11f) where |.| denotes the set cardinality and rm,th denotes the minimum required rate for SBS m which is typically determined by the traffic that is circulating over the downlink of the radio access network. Constraint (11b) ensures that the backhaul capacity of each A-BS m0 will be shared between its all assigned D-BSs in MD-BS as well as m0 ’s traffic. That m0 D-BS is why |Mm0 | is increased by one in (11b). This scheme allows every A-BS receiving its traffic from the core network in addition to the traffic of the associated D-BSs. Prior to solving the proposed resource management problem, in (10a)-(10f) and (11a)-(11f), we note that the solution of network formation problem will depend on the resource allocation and vice versa. That is because for any multi-hop backhaul connection, the rate of a backhaul link e(m0 , m), rm (m0 , x), depends on the network formation MD-BS m0 , as shown in (11b). Moreover, to associate a D-BS m to an ABS in Mdm , the backhaul rates for A-BSs must be considered. Following, we propose a novel approach that allows to jointly solve these two problems1 . III. M ATCHING T HEORY FOR M ULTI -H OP BACKHAUL N ETWORK F ORMATION The problems in (10a)-(10f) and (11a)-(11f) are 0-1 integer programming which do not admit closed-form solutions and have exponential complexity [46]. To solve these problems, we propose a novel approach based on matching theory, a suitable mathematical framework that allows the derivation of a decentralized solution with tractable complexity for combinatorial allocation problems as shown in [32], [33], and [47]. In particular, a matching game is essentially a two-sided assignment problem between two disjoint sets of players in which the players of one set must be matched to the players of the other set, according to some preference profiles. A preference profile  is defined as a reflexive, complete, and transitive binary relation between the elements of a given set. We denote by m the preference profile of player m. Consequently, a m b means player m prefers a more than b. To jointly solve the network formation and resource allocation problems, we propose a multi-stage framework, as shown in Fig. 2, using which the mmW-MBN can be formed as follows: G1 (A1 ∪ D1 , E1 ) → G2 (A2 ∪ D2 , E2 ) → · · · → GJ (AJ ∪ DJ , EJ ), 1 We (12) note that the Dijkstra’s algorithm cannot be applied to the network formation and resource allocation problems at hand, since the convergence of this algorithm is contingent upon assuming a constant weight for each link, which must be independent of the weights at other links [45]. However, due to the intererence term in (3), this assumption will not be valid. where the arrows in (12) indicate the transformation from sub-graph Gj to Gj+1 , where Aj+1 o= Dj and n S Sj+1 Dj+1 = m ∈ m0 ∈Aj+1 Mdm0 m ∈ / j 0 =1 Aj 0 . Each subgraph Gj (Aj ∪ Dj , Ej ) is defined as a directed graph from the set of A-BSs Aj to the set of D-BSs Dj via directed links in Ej . Initially, A1 = {m0 }, and D1 = Mdm0 . Each stage j corresponds to the formation and resource management of j-th hop of the backhaul links. In fact, at each stage j, we address the following two problems: 1) in Subsections III-AIII-B, we find Ej of sub-graph Gj that solves problem (10a)(10f), given the rate of each backhaul link from the previous stages, and 2) in Section IV, we solve (11a)-(11f) for subgraph Gj to allocate the sub-channels of each A-BS in Aj to its associated D-BSs. The variable J, resulting from the proposed solution, will yield the maximum number of hops for the multi-hop backhaul link from the MBS to SBSs. The ∗ final graph G(M, SJE ) is the overlay of all sub-graphs in (12), ∗ such that E = j=1 Ej . A. Multi-hop backhaul network formation problem as a matching game At each stage j, the backhaul network formation problem can be cast as a one-to-many matching game [48] which is defined next. Definition 1. Given two disjoint sets Aj and Dj , the network formation policy πj can be defined as a one-to-many matching relation, πj : Aj ∪ Dj → Aj ∪ Dj , such that 1) ∀m ∈ Dj , if πj (m) 6= m, then πj (m) ∈ Aj , 2) ∀m0 ∈ Aj , if πj (m0 ) 6= m0 , then πj (m0 ) ⊆ Dj , 3) πj (m) = m0 , if and only if m ∈ πj (m0 ), 4) ∀m0 ∈ Aj , |πj (m0 )| ≤ Qm0 , where πj (m) = m indicates that SBS m is unmatched. The quota of A-BS m0 , Qm0 , represents the maximum number of D-BSs that can be assigned to m0 . The relationship of the matching πj with the link formation Ej is such that m ∈ πj (m0 ) is equivalent to e (m0 , m) = 1. In addition, the matching policy πj by definition satisfies the constraints in (10c)-(10f). To complete the definition of the matching game, we must introduce suitable utility functions that will subsequently be used to define the preference profiles of all players. In the proposed mmW-MBN, in addition to the achievable rate, the cost of cooperation among MNOs must be considered in the preference relations of the SBSs. Here, we define the utility of D-BS m ∈ Dj that seeks to evaluate a potential connection to an A-BS m0 ∈ Aj , Um (m0 ), as Um (m0 ) = min (r̄m (m0 ), rm0 (πj−1 (m0 ), x)) − κm qm0 1mm0 , (13) where r̄m (m0 ) is given by (8). Here, we note that rm0 (πj−1 (m0 ), x) is determined at stage j − 1. If j = 1, then SBS m is directly connected to the MBS. The first term in (13) captures the fact that achievable rate for D-BS m is bounded by the backhaul rate of A-BS m0 . The second term indicates that D-BS m ∈ Mn considers the cost of the backhaul link, if the A-BS does not belong to MNO n. However, if the A-BS belongs to MNO n, the cost will naturally be zero. Furthermore, the utility of an A-BS m0 ∈ Aj that evaluates the possibility of serving a D-BS m ∈ Dj , Vm0 (m) will be: Vm0 (m) = r̄m0 (m) + κm0 qm0 1mm0 . (14) In fact, (14) implies that A-BS m0 aims to maximize the backhaul rate, while considering the revenue of providing backhaul support, if 1mm0 6= 0. Based on the utilities in (13) and (14), the preference profiles of D-BSs and A-BSs will be given by: 0 0 0 m01 D m m2 ⇐⇒ Um (m1 ) > Um (m2 ), m1 A m0 D m2 ⇐⇒ V m0 (m1 ) > V m0 (m2 ), (15) (16) Algorithm 1 Millimeter-Wave Mesh Backhaul Network Formation Algorithm Inputs: Aj , Dj , A , D m. m0 Output: πj . 1: Initialize: Temporary set of the rejected D-BSs Dr = Dj . Tentative set Aa = ∅ of accepted D-BSs by A-BS m0 , ∀m0 ∈ Aj . m0 Let Sm = Aj ∩ Mdm , ∀m ∈ Dj . 2: while Dr 6= ∅ do 3: For each D-BS m ∈ Dr , find the most preferred A-BS, m0∗ ∈ Sm , based on D m . Each D-BS m sends a link request signal to its corresponding m0∗ . a 4: Add m to Am0∗ and remove m0∗ from Sm . If Sm = ∅, remove m from Dr . 5: Each A-BS m0 ∈ Aj receives the proposals, tentatively accepts Qm0 of the most preferred applicants from Aa , based on A m0 m0 and reject the rest. a 0 6: Remove rejected D-BSs from Am0 for every A-BS m and add them to Dr . Remove accepted D-BSs from Dr . 7: end while A where  and  denote, respectively, the preference relations for D-BSs and A-BSs. Here, we assume that if Um (m0 ) ≤ 0, A-BS m0 ∈ Mn0 will not be acceptable to D-BS m ∈ Mn . This allows MNO n to choose the control parameter κm in (13), to prevent the formation of any link between a given D-BS m and any A-BS m0 that is charging a high price for using its sub-channels. Given this formulation, we next propose an algorithmic solution for the proposed matching game that will allow finding suitable network formation policies. B. Proposed mmW-MBN formation algorithm To solve the formulated game and find the suitable network formation policy πj for stage j, we consider two important concepts: two-sided stability and Pareto optimality. A twosided stable matching is essentially a solution concept that can be used to characterize the outcome of a matching game. In particular, two-sided stability is defined as follows [32]: Definition 2. A pair of D-BS m ∈ Dj and A-BS m0 ∈ Aj in network formation policy πj , (m0 , m) ∈ πj , is a blocking A 00 pair, if and only if m0 D m πj (m) and m m0 m for some 00 0 m ∈ πj (m ). A matching policy πj is said to be two-sided stable, if there is no blocking pair. The notion of two-sided stability ensures fairness for the SBSs. That is, if a D-BS m prefers the assignment of another D-BS m00 , then m00 must be preferred by the A-BS πj (m00 ) to m, otherwise, πj will not be two-sided stable. While two-sided stability characterizes the stability and fairness of a matching problem, the notion of Pareto optimality, defined next, can characterize the efficiency of the solution. Definition 3. A matching policy πj is said to be Pareto optimal (PO), if there is no other matching πj0 such that πj0 is equally preferred to πj by all D-BSs, πj0 (m) D m πj (m), ∀m ∈ Dj , and strictly preferred over πj , πj0 (m) D m πj (m) for some D-BSs. To find the stable policy πj , the deferred acceptance (DA) algorithm, originally introduced in [49], can be adopted. Hence, we introduce Algorithm 1 based on the DA algorithm which proceeds as follows. Initially, no D-BS in Dj is assigned to an A-BS in Aj . The algorithm starts by D-BSs sending a link request signal to their most preferred A-BS, based on 0 their preference relation D m . Next, each A-BS m receives the request signals and approves up to Qm0 of the most preferred D-BSs, based on A m0 and rejects the rest of the applicants. The algorithm follows by rejected D-BSs applying for their next most preferred A-BS. Algorithm 1 converges once each D-BS m is assigned to an A-BS or is rejected by all A-BS in Aj ∩ Mdm . Since it is based on a variant of the DA process, Algorithm 1 is guaranteed to converge to a stable matching as shown in [49]. Moreover, among the set of all stable solutions, Algorithm 1 yields the solution that is PO for the D-BSs. Here, we note that the role of an SBS will change dynamically according to the changes of the CSI. However, due to the slow-varying channels, the CSI will remain relatively static within the channel coherence time (CCT), and consequently, the role of SBSs can be considered fixed within one CCT. The proposed distributed solution in Algorithm 1 allows the SBSs to update their preference profiles, which depend on the CSI, and accordingly their role, after each CCT period. Given πj resulted from Algorithm 1, the sub-channels of each A-BS m0 ∈ Aj must be allocated to the D-BSs in πj (m0 ). To this end, we next propose a distributed solution to solve the backhaul resource allocation problem. IV. M ATCHING T HEORY FOR D ISTRIBUTED BACKHAUL R ESOURCE M ANAGEMENT To solve the problem in (11a)-(11f), centralized approaches will require MNOs to share the information from their SBSs with a trusted control center. Therefore, centralized approaches will not be practical to perform inter-operator resource management. To this end, we formulate the problem in (11a)-(11f) in each stage j as a second matching game and propose a novel distributed algorithm to solve the problem. The resulting resource allocation over stage j will determine the rate for each backhaul link in j-th hop. As discussed in the previous section, this information will be used to find the network formation policy πj+1 of the next stage j + 1. A. Resource management as a matching game 0 To allocate the sub-channels of an A-BS m ∈ Aj to its associated D-BSs in πj (m0 ), we consider a one-to-many matching game µj composed of two disjoint sets of mmW sub-channels, K, and the D-BSs in πj (m0 ) associated to ABS m0 . The matching µj can be formally defined, similar to the network formation matching π in Definition 1. However, unlike in the network formation matching game, here, we do not introduce any quota for the D-BSs. There are two key reasons for not considering quotas in our problem which can be explained as follows. First, for a resource allocation problem with minimum rate requirement, as presented in (11b) and (11c), a quota cannot be determined a priori for an SBS. That is because the number of sub-channels required by a given SBS is a function of the CSI over all sub-channels between an A-BS m0 and all D-BSs assigned to m0 . Therefore, sub-channel allocation for one D-BS will affect the number of required sub-channels by other D-BSs. This is a significant difference from classical solutions based on matching theory such as in [33], [47], [48], and [50]. The second practical reason for not using a fixed quota in our resource allocation problem is that there is no clear approach to determine the suitable quota values as a function of the various system metrics, such as CSI. On the other hand, with no constraint on the maximum number of sub-channels to be allocated to a D-BS, a distributed matching algorithm may assign all the sub-channels to a few of D-BSs, resulting in an inefficient allocation. Therefore, considering the significant impact of quota on the resource allocation, it is more practical to limit the number of allocated sub-channels by the natural constraint of the system, as presented in constraint (11b). Therefore, we let a D-BS m assign a utility Ψm (k; µj ) to a sub-channel k, where (m, k) ∈ / µj , only if X k0 ∈µj (m) rm (k 0 , πj (m)) < 1 rπj (m) (m00 ; x), |MD-BS | + 1 πj (m) (17) where m00 is the A-BS that serves πj (m), i.e., m00 = πj−1 (πj (m)). Otherwise, Ψm (k; µj ) = −∞, meaning that sub-channel k is not acceptable to D-BS m, given the current matching µj . In fact, (17) follows the rate constraint in (11b) and prevents the D-BS m from being allocated to unnecessary sub-channels. With this in mind, we define the utilities and preferences of sub-channels and D-BSs, considering the rate constraints, CSI, and the cost of each sub-channel. For any D-BS m, the utility that m achieves when being matched to a sub-channel k will be given by: ( rm (k, πj (m)), if (17) is held, Ψm (k; µj ) = (18) −∞, otherwise. Here, note that (18) does not include the price of the subchannels. That is because the sub-channel price qπj (m) is equal for all sub-channels and will not affect the preference of the D-BS. The utility of sub-channels is controlled by their corresponding A-BS. The utility that is achieved by sub-channel k when being matched to a D-BS m will be: Φk (m) = rm (k, πj (m)) + κπj (m) qπj (m) 1mπj (m) . (19) In (19), the second term represents the revenue obtained by A-BS πj (m) for providing backhaul support to D-BS m over sub-channel k. The scaling factor κπj (m) enables the A-BS to balance between the achievable rate and the revenue. In fact, as κπj (m) increases, a given A-BS will tend to assign more resources to D-BSs of other MNOs. Similar to (15) and (16), the preference profiles of sub-channels and D-BSs are given by D k1 Pm k2 ⇐⇒ Ψm (k1 ) > Ψm (k2 ), m1 PkK m2 ⇐⇒ Φk (m1 ) > Φk (m2 ), (20) (21) D where Pm and PkK denote, respectively, the preference profiles of D-BS m and sub-channel k. B. Proposed resource allocation algorithm for mmW-MBNs Here, our goal is to find a two-sided stable and efficient PO matching µj between the sub-channels of A-BS m0 and the D-BSs in πj (m0 ), for every A-BS m0 ∈ Aj . From (18), we observe that the utility of a D-BS and, consequently, its preference ordering depend on the matching of the other DBSs. This type of game is known as a matching game with peer effect [51]. This is in contrast with the traditional matching games in which players have strict and non-varying preference profiles. For the proposed matching game, we can make the following observation. Proposition 1. Under the mmW-MBN specific utility functions in (18) and (19), the conventional DA algorithm is not guaranteed to yield a stable solution. Proof. We prove this using an example. Let Dj = {m1 , m2 }, D D k PD k . k P D k and k2 Pm with preference profiles k1 Pm 2 3 m2 1 1 2 m1 3 Moreover, let K = {k1 , k2 , k3 } with preference profiles m1 PkKi m2 , for i = 1, 2, and m2 PkK3 m1 . Considering achievable rates rm1 (k1 ), rm2 (k2 ) and rm2 (k3 ) are greater than rth , DA algorithm yields a matching µ where µ(k1 ) = {m1 }, µ(k2 ) = ∅, and µ(k3 ) = {m2 }. However, (m2 , k2 ) form a blocking pair, which means µ is not stable. Thus, we cannot directly apply the DA algorithm to our problem and we need to adopt a novel algorithm that handles blocking pairs and achieves a stable solution. To this end, we proposed a distributed resource allocation scheme in Algorithm 2. The algorithm proceeds as follows. For every A-BS m0 ∈ Aj , the initial set of rejected sub-channels is Kr = K. The algorithm initiates by each sub-channel k ∈ Kr sending a request signal to its most preferred D-BS, based on (21). The D-BSs receive the requests and accept a subset of most preferred sub-channels, based on (20), that satisfy their minimum rate requirement and reject the rest. The rejected sub-channels are added to Kr . Accepted sub-channels and the sub-channels that are rejected by all D-BSs in πj (m0 ) are Algorithm 2 Backhaul Resource Allocation Algorithm Inputs: Aj , πj , rth . Output: µj . 1: for i = 1, i ≤ |Aj |,i + + do 2: Initialize: Set A-BS m0 to i-th element of Aj . Temporary set of the rejected sub-channels Kr = K. Tentative sets Djm = ∅ and rm (m0 ) = 0 for each D-BS m ∈ πj (m0 ). For each sub-channel k, let Ck = πj (m0 ). 3: while Kr 6= ∅ do 4: For each sub-channel k ∈ Kr , find the most preferred D-BS, m∗ ∈ πj (m0 ), based on PkK . A-BS sends a link request signal ∗ to the corresponding m∗ for each sub-channel. Add k to Djm ∗ and remove m from Ck . 5: If Ck = ∅, remove k from Kr . 6: Each D-BS m ∈ πj (m0 ) receives the proposals and tentatively D accepts the most preferred sub-channel from Djm , based on Pm and adds the corresponding rate of the accepted sub-channels to rm (m0 ). 7: If (17) is not met, add the next most preferred sub-channel and update rm (m0 ), otherwise, reject the rest of sub-channels. 8: Remove rejected sub-channels from Djm for every D-BS m and add them to Kr . Remove accepted sub-channels from Kr . D for every D-BS. 9: Update µj and Pm 10: end while 11: Based on current allocation, update Ψm (k; µj ) for D-BSs with 1mm0 = 0. 12: Let K0r = {k ∈ K|µj (k) = k}. 13: while K0r 6= ∅ do 14: Remove an arbitrary sub-channel k from K0r and allocate it to its most preferred D-BS m from πj (m0 ), with 1mm0 = 0, if (17) is held. D , and r (m0 ). 15: Update µj , Pm m 16: end while 17: end for removed from Kr . Moreover, in step 9, D-BSs update their D . The rejected sub-channels apply for their next preferences Pm most preferred D-BS from their preference profile. Algorithm 2 proceeds until Kr is an empty set. Next, any unmatched sub-channel k ∈ K is assigned to the most preferred D-BS m with 1mm0 = 0. The algorithm converges once all subchannels are matched. Throughout this algorithm, we note that the corresponding A-BS sends the matching requests to D-BSs on the behalf of its sub-channels. The proposed Algorithm 2 exhibits the following properties. Theorem 1. Algorithm 2 is guaranteed to converge to a twosided stable matching µj between sub-channels and D-BSs. Moreover, the resulting solution, among all possible stable matchings, is Pareto optimal for sub-channels. Proof. Algorithm 2 will always converge, since no subchannel will apply for the same D-BS more than once, through steps 3-12 or 13-16. Next, we show that the proposed algorithm always converges to a two-sided stable matching. To this end, let D-BS m and sub-channel k form a blocking pair D 0 (m, k). That is, mPkK µj (k) and kPm k , where k 0 ∈ µj (m). We show that such a blocking pair does not exist. To this end, we note that there are two possible cases for sub-channel k: 1) k ∈ K0r , and 2) k ∈ / K0r , in step 12. If k ∈ K0r in step 12, that means k is unmatched and the minimum rate requirement is satisfied for all D-BSs, including m. Thus, (m, k) is a blocking pair only if 1mm0 = 0, otherwise, m will not accept more sub-channels. However, in step 14, k will be assigned to its most preferred D-BS µj (k) with 1µj (k)m0 = 0, meaning that µj (k)PkK m. Hence, (m, k) cannot be a blocking pair. Next, if k ∈ / K0r , then k is matched to a D-BS µj (k) prior to step 12. Here, mPkK µj (k) implies that k has applied for m D before µj (k) and is rejected. Thus, k 0 Pm k, for all k 0 ∈ µj (m). Therefore, (m, k) cannot be a blocking pair and matching µj is two-sided stable. To prove Pareto optimality, we show that no sub-channel k can improve its utility by being assigned to another D-BS D m, instead of µj (k). If mPkK µj (k), it means k 0 Pm k, for all 0 k ∈ µj (m), due to the two-sided stability of µj . Hence, a new matching µ0j that allocates k to m instead of a sub-channel k 0 ∈ µj (m) will make (m, k 0 ) to be a blocking pair for µ0j . Therefore, no other stable matching exists that improves the utility of a sub-channel. Here, we note that the proposed solution is Pareto optimal within each subgraph, corresponding to each stage, and it is assumed that network formation in subsequent subgraphs will not affect the utility functions in (13) and (14) for the SBSs in previous subgraphs. This assumption is valid, since a given D-BS will experience random interference from the interfering A-BSs. Given that the number of interfering ABSs is large, which is true for backhaul networks that are supporting many SBSs, the average interference power in (13) and (14) will not depend on the network formation in subsequent subgraphs. Hence, the preference profiles of the D-BSs and A-BSs, and the consequent matching within each subgraph will be independent of the other subgraphs. Therefore, given that matching within each subgraph is Pareto optimal and is not affected by other subgraphs, the overall network formation is Pareto optimal in terms of maximizing the sum-rate. C. Complexity Analysis of the Proposed Multi-stage Solution First, we analyze the network formation complexity of an arbitrary stage j from Algorithm 1. For the purpose of complexity analysis, we consider the maximum number of requesting signals that D-BSs in Dj will send to the A-BSs in Aj before Algorithm 1 converges. In the worst-case scenario, i.e., the scenario with the highest conflict among D-BSs, all D-BSs in Dj have the same preference ordering. Let m01 m m02 m · · · m m0|Aj |−1 m m0|Aj | , (22) be the preference ordering of all D-BSs m ∈ Dj , where Aj = {m01 , m02 , · · · , m0|Aj | }. Hence, only Qm0i D-BSs will be accepted by the A-BS m0i during the i-th iteration of Algorithm 1. Moreover, the number of iterations I is an integer that satisfies I−1 X i=1 Qm0i < |Dj | ≤ I X Qm0i . (23) i=1 Therefore, the total number of requests sent by D-BSs will be   |Dj | + |Dj | − Qm01 + |Dj | − Qm01 − Qm02 + · · · , TABLE II: Simulation parameters Notation fc pt,m0 , pt,m M N Ω K (ξLoS ,ξNLoS ) (αLoS ,αNLoS ) d0 Gmax Gmin θm σ2 dmax d rth q Parameter Carrier frequency Transmit power for MBS & SBSs Total number of SBSs Number of MNOs Available Bandwidth Number of sub-channel Standard deviation of path loss Path loss exponent Path loss reference distance Antenna main lobe gain Antenna side lobe gain beam width Noise power Radius of simulation area SBSs communication range Required rate per SBS Unit of price per sub-channel V. S IMULATION R ESULTS Value 73 GHz 40 and 30 dBm 3 to 65 3 to 5 5 GHz 50 (4.2, 7.9) [8] (2, 3.5) [8] 1 m [8] 18 dB [10] −2 dB [10] 10◦ [10] Ω −174 dBm/Hz+10 log10 K 400 m 200 m [16], [27] 1 Mbps $1 I−1   X + |Dj | − Qm01 − · · · − Qm0I−1 = I|Dj | − (I − i)Qm0i , i=1 = I|Dj | − I I X i=1 Qm0i + I X iQm0i ≤ I X iQm0i , (24) i=1 i=1 where (23) is used to derive the inequality in (24). For the special case in which Qm0i = Q, ∀m0i ∈ Aj , (23) implies that (I − 1)Q < |Dj |. Hence, (24) can be simplified to I X i=1 iQm0i = 1 1 Q(I)(I + 1) < Q 2 2  |Dj | +1 Q   |Dj | +2 . Q (25) Therefore, the complexity of stage j in Algorithm 1 is O(|Dj |2 ), which admits a second-order polynomial relation with respect to the number of D-BSs. Similarly, for Algorithm 2, the worst case scenario is when all sub-channels of A-BS m0 have the same preference ordering for D-BSs in πj (m0 ) and only one sub-channel is accepted over each iteration. Therefore, the number of requesting signals sent from A-BS m0 to its associated D-BSs in πj (m0 ) will be at most K + (K − 1) + · · · + (K − |πj (m0 )| + 1) , 1 =|πj (m0 )|K − (|πj (m0 )|) (|πj (m0 )| + 1) < KQm0 , (26) 2 where the inequality in (26) results from having 0 ≤ |πj (m0 )| ≤PQm0 . Therefore, the total number of requesting 0 0 signals is m0 ∈Aj KQm0 . For Qmi = Q, ∀mi ∈ Aj , the complexity of Algorithm 2 in stage j is O(KQ|Aj |). Thus, the overall complexity of an arbitrary stage j of the proposed distributed solution is O(|Dj |2 + |Aj |). This result implies that the complexity of the proposed distributed solution, composed of Algorithms 1 and 2, is bounded by a second-order polynomial with respect to the network size. This result shows that the proposed approach yields a solution with a manageable complexity for the two interrelated integer programming problems in (10a)-(10f) and (11a)-(11f). For our simulations, we consider a mmW-MBN with an MBS located at (0, 0) ∈ R2 and up to M = 65 SBSs distributed uniformly and randomly within a planar area with radius dmax = 400 m. The simulation parameters are summarized in Table II. Moreover, the number of SBSs is considered to be equal for all MNOs. We compare our proposed approach with the following three other approaches: 1) Optimal solution obtained via an exhaustive search which finds the resource allocation that maximizes the backhaul sum rate. In fact, this benchmark explores all the possibilities for sub-channel allocation with uniform transmission power. 2) Non-cooperative scheme which follows the proposed algorithms for both network formation and resource allocation, however, cooperation among MNOs is not allowed. That is, the SBSs of an MNO do not provide backhaul support to the SBSs of other MNOs. 3) Random allocation that assigns D-BSs randomly to an ABS within their communication range, subject to the constraints in (10b)-(10f). In addition, each A-BS randomly allocates sub-channels to its assigned D-BSs, subject to the constraints in (11b)-(11f). All statistical results are averaged over a large number of independent runs. A. Achievable backhaul sum rate of the mmW-MBN Fig. 3a shows a performance comparison between the proposed framework with the optimal solution, non-cooperative, and random allocation approaches, for a mmW-MBN with K = 7 sub-channels, up to M = 20 SBSs, and N = 2 MNOs. Due to the computational complexity of the exhaustive search, for this comparison figure, a relatively small network size is considered. In Fig. 3a, the optimal solution and the random allocation provide, respectively, an upper and lower bound on the achievable sum-rate of the given network. Fig. 3a shows that the proposed cooperative framework based on matching theory yields a promising performance comparable with results from the optimal solution. In fact, the performance gap will not exceed 3.2% with the network size up to M = 20 SBSs. In addition, the results in Fig. 3a show that the proposed solution improves the sum-rate up to 21% and 36% compared to, respectively, the non-cooperative and the random allocation scheme. In Fig. 3b, the average sum rate resulting from the proposed cooperative approach is compared with both the noncooperative and random allocation schemes, for a dense mmW-MBN with N = 5 MNOs and up to M = 65 SBSs. From Fig. 3b, we can see that the average sum rate increases as the number of SBSs increases. This is due to the fact that more SBSs will be able to connect to the MBS via a multi-hop backhaul link. Fig. 3b shows that, the proposed approach outperforms both the non-cooperative and random allocation schemes for all network sizes. In fact, the proposed framework increases the average sum rate by 27% and 54%, 120 120 Proposed cooperative mmW-MBN Non-cooperative mmW-MBN Random allocation 110 100 Average sum rate (Gbps) Average sum rate (Gbps) 100 90 80 70 60 50 40 20 2 4 6 8 10 12 Number of SBSs 14 16 18 60 40 20 Proposed cooperative mmW−MBN Non−cooperative mmW−MBN Exhaustive search Random allocation 30 80 0 20 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 Average LoS probability 0.8 0.9 1 Fig. 4: Average sum rate versus the average LoS probability ρ. (a) 120 1 0.9 0.8 80 0.7 Emprical CDF Average sum rate (Gbps) 100 60 Proposed cooperative mmW−MBN Non−cooperative mmW−MBN Random allocation One MNO scenario 40 0.6 0.5 0.4 0.3 20 0.2 0 1 3 5 7 9 Number of SBSs per MNO 11 13 (b) Fig. 3: Average sum rate resulting from the proposed cooperative mm-MBN approach, non-cooperative scheme, random allocation, and the optimal solution as the number of SBSs varies. respectively, compared to the non-cooperative and random allocation schemes, for M = 65 SBSs. From this figure, we can clearly see that the average sum rate and, hence, the spectral efficiency of the network is significantly improved in multi-MNO scenarios compared with the network scenario with only one MNO. That is because directional transmissions over the millimeter wave frequencies allow different MNOs to efficiently reuse the available bandwidth which, in turn, results in higher spectral efficiency. In Fig. 4, we compare the average sum rate for the proposed approach with the non-cooperative and random allocation schemes, versus the average LoS probability. The primary goal here is to analyze the severe impact of the blockage on the network performance. In particular, Fig. 4 shows that blockage degrades the sum rate up to six times, when ρ decreases from 1 to 0. However, the results in Fig. 4 show that the proposed approach is more robust against blockage, compared to the non-cooperative and random allocation schemes. In fact, the Proposed cooperative mmW-MBN Non-cooperative mmW-MBN Random allocation 0.1 0 40 60 80 100 120 140 Average sum−rate (Gbps) Fig. 5: The CDF of the average sum rate resulting from the proposed cooperative mmW-MBN, the non-cooperative baseline, and the random allocation approach. proposed approach yields up to 25% and 42% performance gains for ρ = 1, respectively, compared to the non-cooperative and random allocation schemes. We note that for extreme blockage scenarios, e.g., ρ = 0, 0.2, it is expected that the gains will be small, since the achievable rate for most of the links is degraded by blockage. However, we can observe that as more LoS backhaul links become available, the performance gap increases. The main reason for this trend is that the backhaul rate for each A-BS increases, as ρ increases, which can support higher rates for its associated D-BSs. The average sum rate increases by 27% for the proposed cooperative mmWMBN, as ρ increases from 0.6 to 1. B. Statistics of the achievable rate for the mmW-MBN Fig. 5 shows the cumulative distribution function (CDF) of the average sum rate for the proposed cooperative approach, compared to the non-cooperative and random allocation schemes, for N = 5 MNOs and M = 60 SBSs. Cooperation cost per MNO ($) 20 0.9 18 0.8 16 Empirical CDF 0.7 0.6 0.5 0.4 0.3 Cooperative Cooperative Cooperative Cooperative Cooperative Cooperative 0.2 0.1 0 0 10 20 30 40 mmW-MBN, ρ = 0 mmW-MBN, ρ = 0.2 mmW-MBN, ρ = 0.4 mmW-MBN, ρ = 0.6 mmW-MBN, ρ = 0.8 mmW-MBN, ρ = 1 50 60 70 80 90 100 110 120 130 140 150 Average sum rate (Gbps) Price per sub−channel ($) 1 1500 No cooperation 14 1000 12 10 8 500 6 4 Cooperative with low cost 2 0 10 20 30 40 50 60 70 80 Weighting scalar κm (Mbps/$) 90 100 0 Fig. 6: The empirical CDF of the sum rate for different average LoS Fig. 7: Cooperation cost per MNO as a function of both sub-channel probabilities. price and the weighting parameter κm . The results show that the proposed cooperative approach substantially improves the statistics of the average sum rate. For example, Fig. 5 shows that the probability of achieving a 80 Gbps target sum rate is 90%, 36%, and 20%, respectively, for the proposed approach, the non-cooperative scheme, and the random allocation. Fig. 6 shows the empirical CDF of the average sum rate for different average LoS probabilities, for N = 5 MNOs and M = 20 SBSs. From this figure, we can see that severe blockage with small ρ significantly degrades the performance of the mmW-MBN. Interestingly, we can observe that with ρ = 1, the average sum rate does not fall below the 40 Gbps. However, as the probability of LoS decreases to 0.2, the probability of the average sum rate be less than 40 Gbps is 42%. mechanism for an MNO, if the model parameter κm and the budget for other MNOs are known. This initial result can be considered as a primary step towards more complex models, which may consider dynamic pricing policies and competing strategies for MNOs. Moreover, we note that the economic gains of the proposed cooperative framework are indirectly reflected in the performance gains of the proposed scheme, compared to the non-cooperative and random allocation approaches, as shown in Figs. 3a-5. Such an increase in the data rate of the backhaul network, resulting from the cooperative framework, will provide additional revenues for the MNOs, either by offering services with higher QoS to the users, or by increasing the users served by each SBS. Here, we note that the revenue for each MNO explicitly depends on the cost of maintenance per SBS, leasing the spectrum, deployment of SBSs, providing power supply for SBSs, service plans by MNOs and other specific metrics that may differ from one geographical area to another. Therefore, there is no direct and general mechanism to map the physical layer metrics, such as rate into revenue. However, such a mapping is definitely being used by the economic departments of global operators to define their KPI performance metrics. Consequently, in Fig. 7, we have shown the robustness of the proposed framework with regard to the pricing mechanisms. In fact, we have shown that the proposed resource management framework allows MNOs to choose whether to cooperate or not, depending on the system metrics, including the rate, their available budget, and the pricing policy by other MNOs. C. Economics of the proposed mmW-MBN framework Fig. 7 provides a design guideline to manage pricing and the cost of the cooperative mmW-MBN for the MNOs. In this figure, the cost of cooperation per MNO is shown as the price per sub-channel q and the weighting parameter κ vary, for N = 3 MNOs and M = 15 SBSs. The weighting parameter κm , which is first defined in (10a) allows each MNO to control the cost of its backhaul network, with respect to q that is determined by other MNOs. Here, we explicitly define the backhaul cost for an MNO n ∈ N , as the total money that MNO n must pay to other MNOs for receiving backhaul support to the SBSs in Mn . A larger κm implies that the MNO has less incentive to cooperate with other MNOs. Hence, as shown in Fig. 7, no cooperation will happen between MNOs, as both q and κm increase, labeled as the no cooperation region. As an example, if the budget of an arbitrary MNO n is $500 and q = $10 is chosen by other MNOs, from Fig. 7, we can see that MNO n must choose κm ≥ 40 Mbps/$ in order to keep the cost less than its budget. In addition, Fig. 7 will provides a systematic approach to determine a suitable pricing D. Snapshot of the mmW-MBN Fig. 8 shows a snapshot of the mmW multi-hop backhaul network (mmW-MBN) for both the proposed cooperative scheme and the non-cooperative baseline approach. In this figure, each circle shows a small cell base station (SBS) and corresponding pair (m, n) means SBS m belongs to MNO n (m ∈ Mn ). Moreover, the MBS is shown by a triangle. For Proposed cooperative mmW−MBN Non−cooperative mmW−MBN 300 300 (3,1) (3,1) 200 (2,1) 100 (1,1) (5,1) (9,2) (7,2) 0 (4,1) −100 (10,2) (6,2) −200 −300 −300 −200 −100 (2,1) (8,2) y−coordinate (m) y−coordinate (m) 200 0 100 100 (1,1) (8,2) (5,1) (9,2) (7,2) 0 (4,1) −100 (10,2) (6,2) −200 200 300 x−coordinate (m) −300 −300 −200 −100 0 100 200 300 x−coordinate (m) (a) Proposed cooperative mmW-MBN (b) Non-cooperative mmW-MBN Fig. 8: A snapshot of multi-hop mmW backhaul network via the proposed cooperative scheme and the non-cooperative baseline approach. (a) 120 Cooperative mmW-MBN, N = 3 Non-cooperative mmW-MBN, N = 3 Cooperative mmW-MBN, N = 5 Non-cooperative mmW-MBN, N = 5 Cooperative mmW-MBN, N = 3 Non-cooperative mmW-MBN, N = 3 Cooperative mmW-MBN, N = 5 Non-cooperative mmW-MBN, N = 5 100 Overhead of resource management policy 8 Overhead of network formation policy E. Complexity analysis (b) 9 7 6 5 4 3 80 60 40 20 2 1 2 4 6 8 Number of SBSs per MNO 10 0 2 4 6 8 10 Number of SBSs per MNO Fig. 9: The average overhead of the network formation and resource allocation algorithms. illustration purposes, we show the network for N = 2 MNOs and a total of M = 10 SBSs, and the quota for each A-BS is Qm = 5. From Fig. 8b, we first observe that SBS 9 ∈ M2 is not connected to the non-cooperative mmW-MBN, since no other SBS belonging to MNO 2 is located within SBS 9’s communication range. That is, MNO 2 must increase the density of its SBSs to provide ubiquitous backhaul connectivity. However, deploying additional SBSs will increase the costs for the MNO, including site rental costs, power consumption, and cell maintenance, among others. In contrast, the proposed cooperative scheme provides backhaul support for the SBS 9 ∈ M2 via SBS 1 ∈ M1 that belongs to the MNO 1, as shown in Fig. 8a. Second, Fig. 8 shows that SBS 8 ∈ M2 is connected to ABSs 7 ∈ M2 and 5 ∈ M1 , respectively, in the non-cooperative and proposed cooperative mmW-MBNs. We can easily observe that the proposed cooperative scheme provides a shorter path via a two-hop backhaul link for the SBS m = 8, compared to the non-cooperative approach. In Fig. 9, the average signaling overhead of the proposed network formation and the resource allocation algorithms are analyzed, respectively, in (a) and (b). Here, the overhead captures the number of messages that must be exchanged between A-BSs and D-BSs. Fig. 9.a shows that the overhead of the proposed network formation policy increases with the number of SBS per MNOs, since the sets of A-BSs and D-BSs grow as more SBSs are deployed. However, we can see that the algorithm converges fast for all network sizes. Moreover, it can be observed that the proposed cooperative approach increases the overhead by 28% for M = 18 SBSs. This is because the proposed approach allows each SBS to communicate with more number of SBSs, compared to the non-cooperative scheme. Similarly, in Fig. 9.b, the overhead of the resource allocation algorithm increases as the number of SBSs increases. Regarding the complexity of the proposed approach, we note the followings:1) an optimal solution will require an exponential complexity which is not tractable for dense mmW network deployments, while the proposed approach yields a close-to-optimal performance, as shown in Fig. 3b, while requiring a manageable signaling overhead, 2) in this work, we have considered MBS as the only gateway, with a fiber backhaul, to the core network. Therefore, the scenario that is considered in our simulation is an extreme case, as in practice, there will be more than one gateway for up to M = 65 SBSs. Clearly, increasing the number of gateways will reduce the size of the problem, i.e., the number of SBSs to be managed, and 3) communication signals required by the proposed scheme will be incorporated within the common control signals of the system. VI. C ONCLUSION In this paper, we have proposed a novel distributed backhaul management approach for analyzing the problem of resource management in multi-hop mmW backhaul networks. In particular, we have formulated the problem within a matching- theoretic framework composed of two, dependent matching games: a network formation game and a resource management game. For the network formation game, we have proposed a deferred acceptance-based algorithm that can yield a twosided stable, Pareto optimal matching between the A-BSs and D-BSs. This matching represents the formation of the multihop backhaul links. Once the network formation game is determined, we have proposed a novel algorithm for resource management that allocates the sub-channels of each A-BSs to its associated D-BSs. We have shown that the proposed resource management algorithm is guaranteed to converge to a two-sided stable and Pareto optimal matching between the sub-channels and the D-BSs. Simulation results have shown that the proposed cooperative backhaul framework provides substantial performance gains for the network operators and incentivizes sharing of the backhaul links. R EFERENCES [1] Cisco, “Cisco visual networking index: Global mobile data traffic forecast update, 2015-2020,” Whitepaper, February 2016. [2] T. Q. S. Quek, G. de la Roche, I. Guvenc, and M. Kountouris, Small Cell Networks: Deployment, PHY Techniques, and Resource Management. Cambridge University Press, 2013. [3] Interdigital, “White paper: Small cell millimeter wave mesh backhaul,” Interdigital, Inc, February 2013. [4] S. Hur, T. Kim, D. J. Love, J. V. Krogmeier, T. A. Thomas, and A. Ghosh, “Millimeter wave beamforming for wireless backhaul and access in small cell networks,” IEEE Transactions on Communications, vol. 64, no. 10, pp. 4391–4403, October 2013. [5] J. Hoadley and P. Maveddat, “Enabling small cell deployment with hetnet,” IEEE Wireless Communications, vol. 19, no. 2, pp. 4–5, April 2012. [6] S. Rangan, T. S. Rappaport, and E. Erkip, “Millimeter-wave cellular wireless networks: Potentials and challenges,” Proceedings of the IEEE, vol. 102, no. 3, pp. 366–385, March 2014. [7] F. Boccardi, R. W. H. Jr, A. Lozano, T. L. Marzetta, and P. Popovski, “Five disruptive technology directions for 5G,” IEEE Communications Magazine, vol. 52, no. 2, pp. 74–80, Feb. 2014. [8] A. Ghosh, R. Ratasuk, P. Moorut, T. S. Rappaport, and S. Sun, “Millimeter-Wave enhanced local area systems: A high-data-rate approach for future wireless networks,” IEEE Journal on Selected Areas in Communications, vol. 32, no. 6, pp. 1152 –1163, June 2014. [9] D. Liu, L. Wang, Y. Chen, M. Elkashlan, K. K. Wong, R. Schober, and L. Hanzo, “User association in 5G networks: A survey and an outlook,” IEEE Communications Surveys and Tutorials, vol. 18, no. 2, pp. 1018– 1044, 2016. [10] S. Singh, M. N. Kulkarni, A. Ghosh, and J. G. Andrews, “Tractable model for rate in self-backhauled millimeter wave cellular networks,” IEEE Journal on Selected Areas in Communications, vol. 33, no. 10, pp. 2196–2211, Oct 2015. [11] O. Semiari, W. Saad, Z. Daw, and M. Bennis, “Matching theory for backhaul management in small cell networks with mmwave capabilities,” in 2015 IEEE International Conference on Communications (ICC), London, UK, June 2015. [12] G. Liebl, T. M. de Moraes, A. Soysal, and E. Seidel, “Fair resource allocation for the relay backhaul link in LTE-advanced,” in Proc. of IEEE Wireless Communications and Networking Conference (WCNC), Shanghai, China, April 2012. [13] S.Yi and M. Lei, “Backhaul resource allocation in LTE-advanced relaying systems,” in Proc. of IEEE Wireless Communications and Networking Conference (WCNC), Shanghai, China, April 2012. [14] I. V. Loumiotis, E. F. Adamopoulou, K. P. Demestichas, T. A. Stamatiadi, and M. E. Theologou, “Dynamic backhaul resource allocation: An evolutionary game theoretic approach,” IEEE Transactions on Communications, vol. 62, no. 2, pp. 691–698, February 2014. [15] A. Ahmed and D. Grace, “A dual-hop backhaul network architecture for 5g ultra-small cells using millimetre-wave,” in 2015 IEEE International Conference on Ubiquitous Wireless Broadband (ICUWB), Montreal, Canada, Oct. 2015. [16] M. Peter, R. J. Weiler, T. Kuhne, B. Goktepe, J. Serafimoska, and W. Keusgen, “Millimeter-wave small-cell backhaul measurements and considerations on street-level deployment,” in 2015 IEEE Globecom Workshops (GC Wkshps), San Diego, USA, Dec. 2015. [17] I. Siaud, A. M. Ulmer-Moll, M. A. Bouzigues, and N. Cassiau, “Adaptive and spatial processing for millimeter wave backhaul architectures,” in Proc. of 2015 IEEE International Conference on Ubiquitous Wireless Broadband (ICUWB), Montreal, Canada, Oct 2015. [18] X. Xu, W. Saad, X. Zhang, X. Xu, and S. Zhou, “Joint deployment of small cells and wireless backhaul links in next-generation networks,” IEEE Communications Letters, vol. 19, no. 12, pp. 2250–2253, Dec 2015. [19] B. Malila, O. Falowo, and N. Ventura, “Millimeter wave small cell backhaul: An analysis of diffraction loss in NLOS links in urban canyons,” in Proc. of IEEE AFRICON, Addis Ababa, Sept 2015. [20] H. Miao and M. Faerber, “Self-organized multi-hop millimeter-wave backhaul network: Beam alignment and dynamic routing,” in Proc. of 2015 European Conference on Networks and Communications (EuCNC), Paris, June 2015. [21] S. Sengupta and M. Chatterjee, “An economic framework for dynamic spectrum access and service pricing,” IEEE/ACM Transactions on Networking, vol. 17, no. 4, pp. 1200–1213, August 2009. [22] M. Mahloo, P. Monti, J. Chen, and L. Wosinska, “Cost modeling of backhaul for mobile networks,” in Proc. of IEEE International Conference on Communications (ICC) workshops, Sydney, June 2014. [23] D. Li, W. Saad, and C. S. Hong, “Decentralized renewable energy pricing and allocation for millimeter wave cellular backhaul,” IEEE Journal on Selected Areas in Communications, vol. 34, no. 5, pp. 1140–1159, May 2016. [24] Interdigital, “White paper: Street lightsmall cells âĂŞa revolution in mobile operator network economics,” Interdigital, Inc, Oct. 2014. [25] T. Bai, R. Vaze, and R. W. Heath, “Analysis of blockage effects on urban cellular networks,” IEEE Transactions on Wireless Communications, vol. 13, no. 9, pp. 5070–5083, Sept 2014. [26] M. consortium, “Heterogeneous wireless network with mmwave small cell access and backhauling,” White Paper, available at http://www.miwaves.eu/publications.html, Jan. 2015. [27] T. S. Rappaport, W. Roh, and K. Cheun, “Smart antennas could open up new spectrum for 5G,” IEEE Spectrum, Available: http://spectrum.ieee.org/telecom/wireless/smart-antennas-could-openup-new-spectrum-for-5g, Aug. 2014. [28] X. Ge, S. Tu, G. Mao, C. X. Wang, and T. Han, “5g ultra-dense cellular networks,” IEEE Wireless Communications, vol. 23, no. 1, pp. 72–79, February 2016. [29] Q. Li, H. Niu, G. Wu, and R. Q. Hu, “Anchor-booster based heterogeneous networks with mmwave capable booster cells,” in Proc. of Globecom 2013 Workshop-Emerging Technologies for LTE-Advanced and Beyond-4G, Atlanta, GA, 2013. [30] G. Narlikar, G. Wilfong, and L. Zhang, “Designing multihop wireless backhaul networks with delay guarantees,” Wireless Networks, vol. 16, no. 1, pp. 237–254, 2010. [31] K. Taga, G. Peres, B. Grau, and C. Schwaiger, “Network cooperation, making it work and creating value,” White Paper, available at http: // www.adlittle.com/ viewpoints.html?&view=632, 2013. [32] A. E. Roth and M. A. O. Sotomayor, Two-sided matching: A study in game-theoretic modeling and analysis. Cambridge Uni. Press, 1992. [33] E. Jorswieck, “Stable matchings for resource allocation in wireless networks,” in Proc. of 17th International Conference on Digital Signal Processing (DSP), Corfu, Greece, July 2011. [34] M. K. Samimi, T. S. Rappaport, and G. R. MacCartney, “Probabilistic omnidirectional path loss models for millimeter-wave outdoor communications,” IEEE Wireless Communications Letters, vol. 4, no. 4, pp. 357–360, Aug 2015. [35] S. Biswas, S. Vuppala, J. Xue, and T. Ratnarajah, “An analysis on relay assisted millimeter wave networks,” in Proc. of IEEE International Conference on Communications (ICC), Kuala Lumpur,Malaysia, May 2016. [36] M. K. Samimi and T. S. Rappaport, “3-D millimeter-wave statistical channel model for 5G wireless system design,” IEEE Transactions on Microwave Theory and Techniques, vol. 64, no. 7, pp. 2207–2225, July 2016. [37] ——, “Broadband millimeter-wave propagation measurements and models using adaptive-beam antennas for outdoor urban cellular communica- [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] [49] [50] [51] tions,” IEEE Transactions on Antennas and Propagation, vol. 61, no. 4, pp. 1850–1859, April 2013. M.-D. Kim, J. Liang, J. Lee, J. Park, and B. Park, “Directional multipath propagation characteristics based on 28GHz outdoor channel measurements,” in Proc. of 10th European Conference on Antennas and Propagation (EuCAP), Davos, Switzerland, April 2016. P. B. Papazian, C. Gentile, K. A. Remley, J. Senic, and N. Golmie, “A radio channel sounder for mobile millimeter-wave communications: System implementation and measurement assessment,” IEEE Transactions on Microwave Theory and Techniques, vol. 64, no. 9, pp. 2924–2932, Sept 2016. L. X. Cai, L. Cai, X. Shen, and J. W. Mark, “Rex: A randomized exclusive region based scheduling scheme for mmwave wpans with directional antenna,” IEEE Transactions on Wireless Communications, vol. 9, no. 1, pp. 113–121, January 2010. M. Kim, Y. Kim, and W. Lee, “Resource allocation scheme for millimeter wave-based WPANs using directional antennas,” ETRI Journal, vol. 36, no. 3, pp. 385–395, June 2014. H. Kwon, Y. H. Kim, and B. D. Rao, “Uniform power allocation with thresholding over rayleigh slow fading channels with QAM Inputs,” in Proc. of IEEE 78th Vehicular Technology Conference (VTC Fall), Las Vegas, USA, Jan 2013. H. Moon, “Waterfilling power allocation at high snr regimes,” IEEE Transactions on Communications, vol. 59, no. 3, pp. 708–715, March 2011. M. Sikora, J. N. Laneman, M. Haenggi, D. J. Costello, and T. E. Fuja, “Bandwidth- and power-efficient routing in linear wireless networks,” IEEE Transactions on Information Theory, vol. 52, no. 6, pp. 2624– 2633, June 2006. E. W. Dijkstra, “A note on two problems in connexion with graphs,” Numer. Math., vol. 1, no. 1, pp. 269–271, Dec. 1959. [Online]. Available: http://dx.doi.org/10.1007/BF01386390 K. Seong, M. Mohseni, and J. M. Cioffi, “Optimal resource allocation for OFDMA downlink systems,” in IEEE International Symposium on Information Theory, Seattle, Washington, July 2006. Q. Ye, M. A. Shalash, C. Caramanis, and J. G. Andrews, “Distributed resource allocation in device-to-device enhanced cellular networks,” IEEE Trans. Comm., vol. 63, no. 2, pp. 441–454, December 2015. Y. Gu, W. Saad, M. Bennis, M. Debbah, and Z. Han, “Matching theory for future wireless networks: fundamentals and applications,” IEEE Communications Magazine, vol. 53, no. 5, pp. 52–59, May 2015. D. Gale and L. Shapley, “College admissions and the stability of marriage,” Amer. Math. Monthly, vol. 69, pp. 9 –15, 1962. Z. Zhou, M. Dong, K. Ota, and Z. Chang, “Energy-efficient contextaware matching for resource allocation in ultra-dense small cells,” IEEE Access, vol. 3, pp. 1849–1860, 2015. E. Bodine-Baron, C. Lee, A. Chong, B. Hassibi, and A. Wierman, “Peer effects and stability in matching markets,” in Proc. of the 4th International Conference on Algorithmic Game Theory, Amalfi, Italy, July 2011. Omid Semiari (S’14) received the B.Sc. and M.Sc. degrees in communication systems from University of Tehran in 2010 and 2012, respectively. He is currently a PhD candidate at the Bradly department of Electrical and Computer Engineering at Virginia Tech. In 2014, he has worked as an intern at Bell Labs, on anticipatory, context-aware resource management. In 2016, he has joined Qualcomm CDMA Technologies (QCT) for a summer internship, working on LTE-Advanced modem design. Mr. Semiari is the recipient of several research fellowship awards, including DAAD (German Academic Exchange Service) scholarship and NSF student travel grant. He has actively served as a reviewer for flagship IEEE Transactions and conferences and participated as the technical program committee (TPC) member for a variety of workshops at IEEE conferences, such as ICC and GLOBECOM. His research interests include wireless communications and networking, millimeter wave communications, contextaware resource allocation, matching theory, and signal processing. Walid Saad (S’07, M’10, SM’15) received his Ph.D degree from the University of Oslo in 2010. Currently, he is Associate Professor at the Department of Electrical and Computer Engineering at Virginia Tech, where he leads the Network Science, Wireless, and Security (NetSciWiS) laboratory, within the Wireless@VT research group. His research interests include wireless networks, game theory, cybersecurity, unmanned aerial vehicles, and cyber-physical systems. Dr. Saad is the recipient of the NSF CAREER award in 2013, the AFOSR summer faculty fellowship in 2014, and the Young Investigator Award from the Office of Naval Research (ONR) in 2015. He was the author/co-author of five conference best paper awards at WiOpt in 2009, ICIMP in 2010, IEEE WCNC in 2012, IEEE PIMRC in 2015, and IEEE SmartGridComm in 2015. He is the recipient of the 2015 Fred W. Ellersick Prize from the IEEE Communications Society. In 2017, Dr. Saad was named College of Engineering Faculty Fellow at Virginia Tech. From 2015 âĂŞ 2017, Dr. Saad was named the Steven O. Lane Junior Faculty Fellow at Virginia Tech. He currently serves as an editor for the IEEE Transactions on Wireless Communications, IEEE Transactions on Communications, and IEEE Transactions on Information Forensics and Security. Mehdi Bennis (Senior Member, IEEE) received his M.Sc. degree in Electrical Engineering jointly from the EPFL, Switzerland and the Eurecom Institute, France in 2002. From 2002 to 2004, he worked as a research engineer at IMRA-EUROPE investigating adaptive equalization algorithms for mobile digital TV. In 2004, he joined the Centre for Wireless Communications (CWC) at the University of Oulu, Finland as a research scientist. In 2008, he was a visiting researcher at the Alcatel-Lucent chair on flexible radio, SUPELEC. He obtained his Ph.D. in December 2009 on spectrum sharing for future mobile cellular systems. Currently Dr. Bennis is an Adjunct Professor at the University of Oulu and Academy of Finland research fellow. His main research interests are in radio resource management, heterogeneous networks, game theory and machine learning in 5G networks and beyond. He has co-authored one book and published more than 100 research papers in international conferences, journals and book chapters. He was the recipient of the prestigious 2015 Fred W. Ellersick Prize from the IEEE Communications Society, the 2016 Best Tutorial Prize from the IEEE Communications Society and the 2017 EURASIP Best paper Award for the Journal of wireless communications and networks.. Dr. Bennis serves as an editor for the IEEE Transactions on Wireless Communication
7cs.IT
Implementation of the Programming Language Dino – A Case Study in Dynamic Language Performance Vladimir N. Makarov arXiv:1604.01290v1 [cs.PL] 5 Apr 2016 Red Hat [email protected] Abstract design of the language, its type system and particular features such as multithreading, heterogeneous extensible arrays, array slices, associative tables, first-class functions, pattern-matching, as well as Dino’s unique approach to class inheritance via the ‘use’ class composition operator. The second part of the article describes Dino’s implementation. We outline the overall structure of the Dino interpreter and justin-time compiler (JIT) and the design of the byte code and major optimizations. We also describe implementation details such as the garbage collection system, the algorithms underlying Dino’s data structures, Dino’s built-in profiling system, and the various tools and libraries used in the implementation. Our goal is to give an overview of the major implementation decisions involved in a dynamic language, including how to implement a stable and portable JIT. The third part studies the effect of design choices and major optimizations on Dino’s performance on x86-64, AARCH64, and Powerpc64. We examine the choice to use a register-transfer virtual machine instead of a stack-based design and the effects of byte code combining, just-in-time compilation, and type inference with byte code specialization. The fourth part compares Dino’s performance with other popular dynamic language implementations, in order to better understand the combined effect of all described optimizations. Performance results are given for the same three platforms as in the previous part. We conclude by giving possible directions of further research based on Dino, whether by testing new optimizations or studying ways to improve the JIT. The article gives a brief overview of the current state of programming language Dino in order to see where its stands between other dynamic programming languages. Then it describes the current implementation, used tools and major implementation decisions including how to implement a stable, portable and simple JIT compiler. We study the effect of major implementation decisions on the performance of Dino on x86-64, AARCH64, and Powerpc64. In brief, the performance of some model benchmark on x86-64 was improved by 3.1 times after moving from a stack based virtual machine to a register-transfer architecture, a further 1.5 times by adding byte code combining, a further 2.3 times through the use of JIT, and a further 4.4 times by performing type inference with byte code specialization, with a resulting overall performance improvement of about 47 times. To put these results in context, we include performance comparisons of Dino with widely used implementations of Ruby, Python 3, PyPy and JavaScript on the three platforms mentioned above. The goal of this article is to share the experience of Dino implementation with other dynamic language implementors in hope that it can help them to improve implementation of popular dynamic languages to make them probably faster and more portable, using less developer resources, and may be to avoid some mistakes and wrong directions which were experienced during Dino development. Categories and Subject Descriptors preters General Terms D.3.4 [Processors]: Inter- Languages, Performance, Algorithms 2. Language Overview Keywords Dynamic Language, Language Design, Interpreters, Optimizations, JIT In this section we describe the current version of the Dino programming language. This section does not aim to give a formal or comprehensive specification, and there is a possibility that the omitted details might raise questions for the reader. However, our goal is to give a high-level language overview in order to see how the features of the language compare to those of similar dynamic languages and to understand how the implementation methods used for Dino are applicable to other languages. The best way to proceed will be to give a series of small example programs. To start with, the following is a Dino implementation of the Sieve of Eratosthenes: 1. Introduction Programming language Dino has a long history. Originally it was designed, implemented, and used as a simple dynamically typed scripting language in a small computer game company. During its long life, the language and its implementation were dramatically changed. The implementation was changed many times by using new tools, new virtual machines, by adding new optimizations. Therefore its development could be a good case study of dynamic language implementation, simple, portable, and with a performance competitive with JIT implementations of other popular dynamic languages. The first part of the article contains brief overview of the current version of the programming language Dino. We describe the basic Dino Implementation 1. 2. 3. 4. 5. 6. 7. 8. 1 val SieveSize = 8191; var i, prime, k, count = 0, flags = [SieveSize : 1]; for (i = 0; i < SieveSize; i++) if (flags[i]) { prime = i + i + 3; k = i + prime; for (;;) { if (k >= SieveSize) 2018/1/17 9. 10. 11. 12. 13. 14. 15. The table element with value 10.0 is stored under a string key, while an array and another table are used as keys for the table elements in lines 2 and 3 respectively. As in the case of arrays, tables can be mutable or immutable, and elements of mutable tables can be modified, added and removed. break; flags[k] = 0; k += prime; } count++; } putln (count); 2.2 Functions, Closures, and Fibers Functions in Dino are first class values. In other words, they can be assigned to variables, passed as parameters, returned as results from other functions and be stored within data structures. Here are some example function declarations and function calls: An initial design goal was to make Dino resemble C whenever reasonable in order to reduce the learning curve for programmers familiar with C. According to a commonly used classification of programming languages, Dino can therefore be thought of as a curly-bracket language. Variables in Dino can hold values of any type, so Dino is a dynamically typed language. The scalar value types include char (Unicode character), integer (64-bit signed integers), long (multiprecision integers) and float1 . Dino types are themselves values2 . Variables in Dino should be declared (lines 1 and 2). The declaration scope of a variable starts from the declaration point and finishes at the end of the block containing the declaration3 . It can finish earlier if the identifier is redeclared in the block. The declaration scope includes nested blocks but excludes scopes of other declarations with the same identifier in the nested blocks4 . If a variable is declared by a val declaration (line 1), then it is a constant whose value cannot be changed. 1. 2. 3. 4 5. 7. 8. 9. 10. The structured value types include arrays. In the above example, the variable flags holds an array of integers of size SieveSize. Each element of the array is initialized to integer value 1 (line 2). Different elements of an array can hold values of different types. Arrays are mutable by default, i.e. their elements can be modified, removed, and new elements can be inserted. An array can be transformed to become immutable by a special operation. Slices of an array can be referenced and be used as operands of some operations. For example, the Sieve of Eratosthenes program from the previous section can be rewritten using slices: val flags = [SieveSize : 1]; var i, prime, count = 0, SieveSize = 8191; for (i = 0; i < SieveSize; i++) if (flags[i]) { prime = i + i + 3; flags[i + prime:SieveSize:prime] = 0; count++; } putln (count); fun incr (base) {fun (incr_val) {base + incr_val;}} 1. fiber t (n) {for (var i = 0; i < n; i++) putln (i);} 2. t(100); // the following code will not wait for t finish 3. for (var i = 0; i < 1000; i++) putln ("main", i); To synchronize threads, Dino provides a basic wait statement: wait (cond) [stmt]; Thread is concurrent but not parallel. In other words, the multithreading is implemented by so-called green threads, with the Dino interpreter alternately executing statements from different threads6 . Simple statements, e.g. statements that do not contain function calls, are atomic, i.e. cannot be interrupted by another thread. Line 6 in the above example contains an array slice. This slice refers to elements at indices starting from i+prime up to Sievesize (exclusive) with step prime. While array elements are referenced by integer indices, Dino also includes the associative array type table whose elements are referenced by keys that can be arbitrary values. Table values can be built using the tab [] constructor: 2.3 Classes and Objects Some programming languages attempt to unify the functional and object-oriented approaches. For example, in Scala a function is just another kind of object, and a function call invokes the method apply on the corresponding object. Dino takes a bit of a different approach to unifying the two concepts. A class in Dino is defined as a special kind of function which 1. tab ["string key" : 10.0 2. [1, 2] : 2, 3. tab [3, 4] : [1, 2]] 1 Dino floats are IEEE 754-1985 double precison floating point numbers. type of type values is denoted by the keyword type. 3 A block is a series of statements and declarations enclosed in curlybrackets. 4 Scope rules in Dino were originally more relaxed, permitting an identifier to be referenced before its declaration, but they were changed to the current ones when an interactive REPL environment was implemented. 5 Functions filter and fold are defined in the standard Dino environment. multithreading system in Dino has existed without any change since its very first version, as the original application of Dino (scripting dinosaur movements in a simulation) did not require any more complex form of parallelism. There are plans to make threads parallel, e.g. by implementing them as OS-level threads. This will likely change the semantics of Dino threads in the future. 2 The Dino Implementation filter (fun (a) {a > 0;}, v); fold (fun (a, b) {a * b;}, v, 1); According to Dino scope rules, a declaration should be present before any usage of the declared identifier. Thus, in the case of mutually recursive functions, we need to include a forward declaration. Lines 1-4 of the above example provide an illustration. Lines 7 and 8 provide an example of the use of anonymous functions. We pass the anonymous functions as parameters to the filter and fold functions5 . Function values in Dino always exist within a context, as the functions can refer to outside declarations. A function value considered along with its context is called a closure. The last line in the above example illustrates the use of closures. The function incr returns an anonymous function which in turn returns the sum of its parameter incr val and the parameter base given to the corresponding call of incr. A fiber in Dino is a function which executes concurrently from its point of invocation. A fiber call being executed is called a thread. Here is an example: 2.1 Array, Slices, and Tables 1. 2. 3. 4. 5. 6. 7. 8. 9. fun even; fun odd (i) {i == 0 ? 0 : even (i - 1);} fun even (i) {i == 0 ? 1 : odd (i - 1);} putln (odd (1000000)); 6 The 2 2018/1/17 returns an entity called a block instance7 representing the created object. The inner declarations of the block instance are publicly visible by default. Here are some example class declarations: 1. 2. 3. 4. 5. class class fun fun } creating an object of the class and assigning it to a variable declared using val: 1. 2. 3. num (i) {fun print {put (i);}} binop (l, r) { print_op; print {l.print(); print_op (); r.print ();} 2.4 Pattern Matching Pattern matching is a useful instrument for distinguishing and decomposing values and extracting their parts into variables. Dino’s pattern matching mechanism can be used in a variable declaration or in a pmatch-statement. The following is an example of pattern matching in a declaration: Line 1 contains the declaration of a class num with one function print and one public variable i whose value is initialized by the call to the class. Lines 2 to 5 contain the declaration of an abstract class binop with two variables l and r, a defined function print and a function print op which declared but not yet defined. Dino has a powerful class/function composition operator use which can be used to inlay declarations from one class into another. This operator can be used to emulate inheritance (including multiple inheritance), traits, and dynamic dispatching. Here is a continuation of the above example: 6. 7. 8. 9. 1. try { 2. var [a, b, 2, ...] = v; 3. ... 4. } catch (patternmatch) { 5. putln ("your assumption is wrong"); 6. } class add (l, r) { use binop former l, r later print_op; fun print_op {put (" + ");} } The declaration on line 2 checks that the value of v is an array of at least 3 elements and that the third element of v is equal to 2. If this is not the case, an exception will occur. The values of the first and second elements of v will be assigned to newly declared variables a and b respectively. The following is an example of pattern matching in a pmatchstatement: Line 7 contains a use-clause which inlays the declarations (functions and variables) from class binop, making them available within the scope of add. The former-clause overrides the l and r variables from binop with the l and r variables defined earlier in the declaration of add. Likewise, the later-clause overrides the print op function inlaid from binop with the print op function defined later in the declaration of add. The use-clause provides a safe and powerful way to support object oriented programming. It has the following semantics: 1. pmatch (v) { 2. case [...]: putln ("array"); continue; 3. case [a, ...]: 4. if (a == 0) break; 5. putln ("array with non-zero 1st element"); 6. case node (v) if v != 0: 7. putln ("object of class node with nozero value"); 8. case _: putln ("anything else"); 9. } 1. Declarations from the class mentioned by the use-clause are inlaid into the current class. 2. Declarations from the current class that occur before the useclause override inlaid declarations mentioned in the formerclause. The pmatch-statement tries to match a value with the patterns in the case clauses and executes the code corresponding to the first matched pattern. The scope of variables defined in the pattern extends to statements within the case clause. A continue statement within a case clause means that pattern matching should resume and continue to the subsequent case clauses. A break statement exits the pmatch statement. There is an implicit break at the end of each case clause. The above example illustrates the possibilities of the pmatch statement, but the program used for the example is artificial. The following is a more realistic program using classes and pattern matching: 3. Declarations from the current class that occur after the useclause override inlaid declarations mentioned in the laterclause. 4. Declarations in the current class must match any inlaid declarations that they override.8 5. A declaration from the original class mentioned by the useclause can be renamed and thus made available in the current class instead of simply being overridden. A class that references another class via a use-clause becomes a subtype of the referenced class. The subtyping relation is transitive. To test subtyping of a class or object, the standard function isa can be used9 : 1. 2. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. isa (add, binop); isa (add (num (1), num (2)), binop); Dino provides syntactic sugar for declaring a singleton, which functions as an abbreviation for declaring an anonymous class, 7 We prefer to use the term block instance instead of the widely used ‘activation record’ or ‘stack frame’ as an activation record is usually allocated on the call stack, whereas a Dino block instance is allocated in the heap. 8 An exact definition of what it means for two declarations to match is not given here. An example of matching declarations is a pair of functions with the same number of parameters. 9 Pattern matching can also be used for this purpose. Dino Implementation obj coords { var x = 450, y = -200; } class tree {} class leaf (i) {use tree;} class node (l, r) {use tree;} fun exists_leaf (test, t) { pmatch (t) { case leaf (v): test (v); case node (l, r): exists_leaf (test, l) || exists_leaf (test, r); } } fun has_odd_leaf (t) { exists_leaf (fun (n) {type (n) == int && n % 2 == 1;}, t); } 2.5 Standard Environment The Dino standard environment contains a variety of built-in functions (input/output, higher order functions, regexp functions, functions for array/table manipulations, etc.) and classes (mostly describing various exceptions). 3 2018/1/17 The first implementation of associative tables in Dino was based on classical hash tables with buckets. The implementation was later changed to resizable hash tables without buckets11 . Conflict resolution is achieved by secondary hashing. Such an approach permits to decrease pointer chasing and results in more compact hash table representations and better data locality. With the right choice of maximal load factor for the hash table, the implementation using secondary hashing compared to the implementation using buckets can be 1.5 times faster on modern processors12 . The hash table implementation based on secondary hashing was later adapted for use in the GCC compiler. The Dino interpreter employs numerous optimizations to improve performance. Below we discuss optimizations which are important from the performance point of view or widely described in research literature. This environment is small in comparison with the standard libraries of popular dynamic languages. The creation of a full set of standard libraries requires a lot of efforts and has not been a priority as Dino was more of a research project for a long time. That said, there is one unique feature in the Dino standard environment: a predefined class for the creation of parsers for programming languages or natural languages. The class implements an enhanced Earley parser algorithm with simple syntax directed translation. It can parse according to ambiguous grammars, producing either a compact representation of all possible parse trees or a minimal cost parsing tree when costs are assigned to the grammar rules. The parser can perform syntax recovery, finding the minimal number of ignored tokens which produces a correct abstract syntax tree (AST). It is also fairly fast, being capable of parsing about 250,000 lines of C language code per second on modern CPUs10 . Here is an example where the Earley’s parser built into Dino is used to parse a tiny programming language: 3.1 Byte Code Dispatch Although a lot of articles and discussions about dynamic language implementations are focused on byte code dispatch, in our experience the choice of dispatch method was found to be relatively unimportant for the performance of the Dino implementation. In the direct threaded code method, each byte code instruction contains the address of the code responsible for execution of the next byte code instruction [Bell] [Ertl]. For example, the Ruby VM uses direct threaded code by default [Sasada]. Although the code required for dispatch is very simple (read the address and jump to it), implementing the direct threaded strategy requires a nonstandard extension to the C language which allows labels to be treated as values [GCC]. The use of this extension prevents the compiler from performing some optimizations on the interpreter code (e.g. predictive commoning). The direct dispatch method is based on a standard C switch statement. Each case of the switch statement contains an implementation of a different byte code instruction. Dino implementation experience shows that a proper direct dispatch implementation is more efficient on modern architectures. By ‘proper’, we mean that the compiler should be forced to generate optimized code for the switch statement if the number of all byte code intructions is less than 25613 . The optimization results in the code for direct dispatch being compiled to a number of machine instructions comparable to that of the machine code for direct threaded dispatch. To take advantage of hardware branch prediction, some authors proposed to replicate instructions or to make a direct switch at the end of each code responsible for executing a byte code instruction [Casey]. This might work well when we have a small benchmark that takes advantage of the hot path, but in most real programs the bytecode will generally have different instructions adjacent to one another. The larger and more complex the benchmarks, and the more different types of byte code instructions the VM provides, the worse this approach will perform. The performance rapidly becomes worse than that of direct dispatch. In early Dino implementation, the use of a proper direct dispatch implementation improved code performance for a simple loop benchmark up to 3% (on a modern x86-64 architecture) compared to the next-best direct threaded dispatch method. Unfortu- expose yaep.*; val grammar = "TERM ident=301, num=302, if=303, then=304, for=305, do=307, var=308; program = program stmt # list (0 1) stmt = ident ’=’ expr ’;’ # asgn (0 2) | if expr then stmt else stmt # if (1 3 5) | for ident ’=’ expr expr do stmt # for (1 3 4 6) | ’{’ program ’}’ # block (1) | var ident ’;’ # var (1) | error expr = expr ’+’ factor # plus (0 2) factor = factor ’*’ term # mult (0 2) term = ident # 0 | ’(’ expr ’)’ # 1"; val p = parser (); // create an Earley parser p.set_grammar (grammar); // set grammar fun syntax_error; // forward decl of error reporting func val abstract_tree = p.parse (token_vector, syntax_error); 3. Implementation Unfortunately, the article size does not permit a description of all design decisions, algorithms and optimizations in full detail. Only a high level overview is given, and only some important elements of the implementation are described in more detail. Figure 1 represents the general structure of the current Dino implementation[Makarov] and the flow of data through it. Dino interpreter can be used in one of two modes. The first mode is a read-eval-print loop (REPL) where a completed statement undergoes all processing stages including execution. The second mode is the standard batch mode, where the interpreter first processes all program files to generate byte code of the entire program and then executes the byte code. Program byte code can be saved in a readable form, modified and read back for execution. The interpreter includes a function-level JIT compiler which is implemented with the aid of a C compiler. The Dino program can load and execute PIC object files created from C code using a foreign function interface. The interpreter uses a memory heap with garbage collection. The heap can be automatically extended by demand. The interpreter performs a simple escape analysis to transform heap allocations into stack ones. The garbage collector uses a combination of the mark-and-sweep and the fast mark-and-copy strategies to prevent heap fragmentation and decrease program memory requirements [GCH]. 11 The hash function used in Dino is based on MurMur hashing [Appleby]. hash table implementations provide the same functionality and approximately the same overall table sizes and rate of growth. Hashing benchmarks from the old version of the computer language shootout were used for the comparison [Benchmarks]. 13 For example, it is possible to force the GCC compiler to omit range checking and zero extension of the opcode value. The resulting code for x86/x86-64 has less than half the instructions compared to the code generated for a switch statement by default. 12 Both 10 The implementation of Earley’s parser used in Dino achieves 255,700 lines per second when parsing a preprocessed 67,000 line C file on 4.2GHz Intel i7-4790K. Peak memory usage for parser internal data was about 3.9MB. Dino Implementation 4 2018/1/17 Figure 1. Overall Dino data flow The benefit of RTL is even greater when we take into account the ability to perform optimizations on the byte code, including instruction combining, instruction specialization, and colour based variable allocation. These optimizations are very difficult or even impossible to implement for SB virtual machines. The current Dino byte code format includes multi-operand instructions with 1-5 operands (usually 3), control flow instructions (blocks, branches, calls, etc.), as well as instructions representing declarations such as vdecl (variable declaration) and fdecl (function, class, and fiber declarations). Dino byte code has two representations: an in-memory format for execution and a human-readable representation which can be output, modified, and input back by the interpreter for further execution. The Dino code nately, the latest Dino implementation uses more than 256 byte code instructions. Therefore we started to use the direct threaded code method as the best possible dispatch method for such number of byte code instructions. A much greater performance improvement can be reached by focusing on other issues than the choice of byte code dispatch. The most important aspect of the design is choosing the right byte code architecture for efficient execution. 3.2 Virtual Machine and Bytecode Design Stack-based (SB) virtual machines (VMs) are a fairly popular design for implementation of dynamic language interpreters. For example, the Ruby VM uses a stack-based architecture [Sasada] [Shaughnessy]. Stack based byte code is compact and simple. The previous implementation of Dino VM used a stack-based design as well. The current implementation is based on a register transfer language (RTL). Changing the virtual machine architecture from a stack-based to a register-transfer-language VM architecture improved code performance up to 3 times, which is bigger than the speedup reported in [Shi]14 . The main advantage of RTL is a reduced number of instructions, as one RTL instruction can correspond to 3 or more SB byte code instructions. In many cases, the reduced number of instructions decreases the overhead of byte code dispatch and reduces the amount of operand shuffling and type checking. Moreover, there is greater scope for applying compiler optimizations to the bytecode interpreter itself if it is based on an RTL rather than an SB design. var i, n = 1000; for (i = 0; i < n; i++); is compiled to byte code which includes the following segments (given in human-readable representation): 0 block fn="ex.d" ln=1 pos=1 next=730 vars_num=29 tvars_num=3 ... 372 vdecl ... ident=i ident_num=268 decl_scope=0 var_num=27 373 vdecl ... ident=n ident_num=269 decl_scope=0 var_num=28 ... 788 ldi ... op1=28 op2=1000 // 28 <- i1000 789 ldi ... next=791 op1=27 op2=0 // 27 <- i0 790 btltinc ... next=792 op1=27 bcmp_op2=28 bcmp_res=29 pc=790 791 btlt ... op1=27 bcmp_op2=28 bcmp_res=29 pc=790 792 bend ... 14 There are many RTL design details which could influence performance and may account for the difference in speedup. For example, the addressing system in Dino bytecode allows an instruction to address both local and temporary variables as well as variables in global scope. Dino Implementation 5 2018/1/17 3.3 Optimizations the generated C code provided through a UNIX pipe. The C compiler produces a position independent code (PIC) object file which is stored in the operating system’s standard temporary directory17 . After successful compilation, the interpreter loads the object file and calls the compiled function. This approach has many advantages. First of all, it results in a simple and portable JIT implementation. In the Dino interpreter, the JIT implementation required less than 100 new lines of C code, and can be used with any native C compiler. As the C language has a stable and well-defined standard, Dino’s portable JIT implementation will continue to work in the future. On the other hand, if we had used the special-purpose interfaces provided by LLVM and GCC for JIT compilation, we would potentially need to update the interpreter in order to be compatible with future compiler versions. Machine code generation by passing a C source file to the GCC frontend gives only a slight performance penalty compared to generation using the GCC JIT plugin18 . In fact, JIT compilation of a small Dino function takes only about 50-70ms using GCC with -O3 on modern Intel CPUs19 . Choosing the right byte code representation is crucial, but there are other techniques which are important for attaining good performance. 3.3.1 Byte Code Combining Reducing the number of executed instructions provides a performance advantage, due to reduced dynamic dispatch overhead and an increased scope for applying compiler optimizations when building the Dino bytecode interpreter. The use of RTL representation is one way of achieving this. The same result can also be achieved by creating new bytecode instructions and using them to replace frequently executed chains of operations. Such an optimization is performed by the Dino interpreter. An analogous approach can be found in [Abdelrahman], where this optimization is called concatenation, or in [Casey], where it is called combining instructions into superinstructions. The following example illustrates how the Dino interpreter transforms byte code corresponding to an empty for loop: 3.3.4 Type-inference and Byte code Type Specialization label: addi op1, op1, i1; lt res, op1, op2; bt res, label => label: addi op1, op1, i1; blt res, op1, op2, label => label: btltinc op1, op2, i1, res, label Dino is a dynamically typed programming language. Nevertheless, the types of many expressions and operands can be recognized during compilation time. Unfortunately, even the peak optimization modes of industrial C compilers used for JIT are not powerful enough to figure out the types of byte code operands and to remove unnecessary operand type checking. Type recognition (inference) with byte code specialization can help significantly to improve JIT performance. For example, when we know the types of operands, byte code specialization can transform the general add instruction into an integer variant iadd or a floating point variant fadd. On our model benchmark, qualitative byte code specialization improves JIT performance about 4.5 times. With the addition of combined and specialized instructions, the number of different byte code instructions in Dino is 254. The type inference algorithm in Dino consists of the following major steps: Byte code combining improves the performance of the model benchmarks described in section 4 by about 1.5 times. 3.3.2 Pure Function Calls A function is called pure if it has no side effects and its result always depends only on its argument values. When a pure function is called many times with the same arguments, we don’t need to calculate its result again. Dino interpreter can save values of arguments and corresponding results of pure function calls and then reuse the results instead of performing the calculations again. This optimization can improve the performance of some benchmarks such as factorial or Fibonacci by an order of magnitude. 3.3.3 Just-in-time Compilation 1. Building an all-program control flow graph (CFG) consisting of basic blocks and control flow edges connecting them. Performance of frequently executed code can be improved by justin-time compilation (JIT) to machine code. There are a number of approaches to selecting which unit of code to compile. The most frequently used approach is trace-based selection. Examples of trace-based JIT implementations include the PyPy implementation of Python and most widely used JavaScript implementations. JIT compilation can be implemented through a specialized JIT framework (e.g. JVM15 ) or by using more general compiler frameworks such as LLVM or the GCC JIT plugin [Lattner] [Malcolm]. The Dino interpreter uses function-level JIT. Function compilation is triggered by the first call. The function’s byte code is translated into C function code. For each type of byte code instruction there is a corresponding C inline function. When building the Dino interpreter, these functions are copied to a C-preprocessed file, which is included in the generated C code during JIT compilation16 . Thus, the C translation of a function’s byte code consists mostly of calls to these functions. A C compiler is called with 2. Calculating available results of byte code instructions – this is a forward data-flow problem on the CFG. 3. Using the availability information, building def-use chains connecting possible operands and results of byte code instructions and variables. 4. Calculating the types of byte code instruction operands and results – this is a forward data-flow problem on the def-use graph. This algorithm is capable of recognizing the types of different usages of a variable even if the variable holds values of different types during an execution. This is a major difference from type inference in statically typed languages. Dino has a number of language features and edge cases (such as higher order functions, closures, threads and the possibility of accessing an uninitialized variable) that make comprehensive type 15 If JVM is used for the implementation, the bytecode obviously has to be Java bytecode. 16 The C inline functions implementing the byte code instructions are declared static. Thus, GCC does not optimize or generate separate machine code for these functions; they are inlined only if they are used. This considerably increases the speed of JIT compilation. Another important factor that increases the compilation speed is the fact that the preprocessed file contains only declarations that are used by the inline functions, rather than the full set of declarations from the Dino interpreter. Dino Implementation 17 These days, UNIX systems usually store their temporary directory in memory. 18 Experiments with the JIT plugin benchmark from GCC’s testsuite show that compilation using the GCC JIT plugin is about 20% faster than compiling from source code on a Xeon E5-2697 v3 machine. 19 A heapsort function was used for the measurement on a Xeon E5-2697 v3 machine. 6 2018/1/17 inference difficult. Therefore we do not recognize all operand types which it is theoretically possible to recognize. %abstract expr :: generic_pos; %abstract operation :: expr; %abstract binary_operation :: operation %other left_operand, right_operand : expr ; %abstract unary_operation :: operation %other operand : expr ; mult :: binary_operation; typeof :: unary_operation; ... 3.3.5 Code Reuse in Class Composition A naive implementation of the class composition operator use that duplicates declarations can create a lot of additional code. Therefore special attention during the implementation of Dino and the design of its byte code was paid to avoiding this problem. In fact, no code duplication is produced by the current Dino implementation of operator use. Byte code corresponding to a function defined in one class and inlaid into another class is always reused. 3.3.6 Optimization Hints The following are excerpts from the bytecode description: After analyzing his program’s behaviour, the programmer usually has the best knowledge about what should and should not be optimized. Therefore Dino allows the programmer to attach optimization hints to functions. Currently, Dino defines hints to request inlining, JIT compilation, or pure function optimization. Let us look at how optimization hints can be used to tune the performance of the ‘meteor-contest’ benchmark from the new version of the computer language shootout [Meteor]. Using the built-in Dino profiler (option -p), we obtain the following output: ... %abstract icode :: %root; %abstract bcode :: icode %other next : bcode info : %root ; %abstract op1 :: bcode %other op1 : int_t ; %abstract op2 :: op1 %other op2 : int_t ; %abstract op3 :: op2 %other op3 : int_t ; %abstract op3i :: op3; add :: op3; addi :: op3i; ** Calls *** Time **** Name ********************************* 761087 0.43 -- search1: "meteor.d": 229 561264 0.07 -- ctz: "meteor.d": 28 1260 0.01 -- GoodPiece: "meteor.d": 37 ... 0.51 -- All Program We know that ctz is a small function and by inlining it we can remove significant call overhead. Function search1 is larger, and it may be better to compile it into native code using the JIT compiler. After adding hints !inline and !jit to the corresponding functions, we obtain the following profiler output: ** Calls *** Time **** Name ********************************* 761087 0.15 -- search1: "meteor.d": 229 ... 0 0.00 -- ctz: "meteor.d": 28 ... 0.17 -- All Program Coding a parser manually can complicate language development. Therefore the Dino parser is implemented using a parser generator called Msta. Msta is a superset of YACC/Bison, supporting LALR(k)/LR(k) grammars with any fixed k ≥ 0. Msta also includes more sophisticated error recovery algorithms and implements many useful optimizations20 . Msta generates about 25% faster parsers than Bison21 . The third COCOM tool used by Dino is Shilka, a generator of fast keyword recognizers. There are several components of the Dino implementation that need to perform recognition of reserved identifiers, e.g. Dino keywords, bytecode instruction names, and bytecode instruction fields. Shilka’s functionality is analogous to that of the GNU gperf package but its implementation uses minimal pruned O-tries. This approach makes Shilka up to 40% faster than gperf22 . The COCOM toolset also includes a library called Ammunition. This library contains different packages useful for compiler/interpreter implementations, such as source position handling, error reporting, memory allocation handling, hash tables, sparse sets, Earley parser etc. The Dino implementation actively uses most of these. 3.4 Used Tools and Libraries The development of dynamic languages is usually an ongoing process. Thus, it is important to develop tools that make it easier to implement and modify the language interpreter. The COCOM toolset provides several tools that are used by the Dino implementation. The most useful one is Sprut, a compiler of internal representation (IR) descriptions. The description is given in an object oriented format. The Sprut compiler generates code to create, access, modify, traverse, read and write the described IR format. Additionally, in debug mode Sprut can generate code to check constraints and relations given in the IR description. There are four IR descriptions included in the Dino implementation. The first is a high-level IR used for semantic checking. The second is the Dino bytecode format. The third format is a part of the foreign function interface and is used to specify run-time data which should be visible to external C functions. The last format describes all run-time data used by the Dino interpreter. The following are some excerpts from the semantic IR description: 20 Msta can extract regular or LALR portions of an LR grammar and generate the corresponding portion of the parser as a DFA or LALR stack machine. 21 When a preprocessed 67,000 lines C file is parsed on 4.2GHz Intel i74790K, Msta is about 26% and 36% faster than Bison and Byacc correspondingly. 22 Shilka on i7-4790K was 38% faster than gperf when recognizing 38 million C language keywords out of 120 million identifiers. The sequence of identifiers was taken from a large C source file. ... %abstract ir_node :: %root; %abstract generic_pos :: ir_node %other pos : position_t ; Dino Implementation 7 2018/1/17 Additionally, the Dino implementation uses the GMP (multiprecision integer arithmetic), iconv (different encodings support), and ONIGURUMA regex libraries. • fib – recursive Fibonacci function. 4. Effect of implementation decisions and optimizations • object – object instantiation. One of the reasons for wide adoption of dynamic languages is the high-level nature of their operation. Usually, performance of lowlevel operations is the weak point of dynamic language implementations. Thus, we have chosen a benchmark which allows us to study the performance of low-level operations. The nested loops benchmark from the old version of the computer language shootout could serve well for this purpose [Benchmarks]. The Dino version of this benchmark consists of the following code: • sort – sorting using the heapsort algorithm. • except – exception handling. • method – object method calls. • sieve – Sieve of Eratosthenes algorithm. • stat – calculation of statistical moments. • random – random number generation. • thread – passing data from a producer thread to a consumer thread. • start – an empty program that does nothing. • compile – a program that consists of a very long series of assignment statements. fun main { var n = argv [0] < 1 ? 1 : int (argv[0]); var a, b, c, d, e, f, x = 0; for (a = 0; a < n; a++) for (b = 0; b < n; b++) for (c = 0; c < n; c++) for (d = 0; d < n; d++) for (e = 0; e < n; e++) for (f = 0; f < n; f++) x++; putln (x); } main (); We ran this benchmark using different Dino VMs and optimizations on three platforms: x86-64, AARCH64, and Powerpc64. The machines used for testing were a 4.2GHz Intel 4790K, a 2.4Ghz Applied Micro AARCH64 X-gene, and a 3.2GHz Power8 running Linux Fedora Core 21. Version 4.9.2 of GCC was used for JIT compilation. Each test was run 3 times on an unloaded machine and the minimal time was taken. The same command line argument (25) was passed to the Dino script in all runs. Table 1 contains the CPU times of different runs of the benchmark in seconds. Stack based VM RTL VM The above + code combining The above + JIT The above + type inference and byte code specialization Intel Haswell 6.51 2.12 1.38 0.61 0.14 Applied Micro X-gene 34.23 13.08 6.92 2.13 0.24 IBM Power8 24.99 8.84 4.69 2.20 0.11 6. Conclusion and Perspectives Table 1. Performance effect of design decisions and optimizations (CPU time given in seconds). There are many venues for future research on Dino. The effect of new optimizations (such as improved type inference or fast variable allocation using a linear scan algorithm [Poletto]) can be investigated. We also have plans to use Dino to research various JIT approaches. One way of improving JIT can be achieved by maintaining a C compiler process (or a pool of compiler processes) on standby in order to avoid the overhead of starting up a compiler during JIT compilation of each function. A very important research goal is to find improved ways of implementing JIT based on GCC, as it is the most portable compiler infrastructure currently available24 . It is fairly reasonable to doubt 5. Comparison with a few dynamic language implementations To demonstrate overall Dino performance in comparison with popular implementations of Ruby, Python and Javascript on a wider set of benchmarks, a subset of the old version of the computer language shootout was used [Benchmarks]. This subset includes the following benchmarks: 23 This can be considered an illustration of the difficulties of porting dedicated JIT systems to a new architecture. 24 GCC-5.0 includes support for 48 targets in its public repository, while LLVM-3.6 supports only 12 targets. • loop – execution of empty loop body. • hash – associative table operations. • fact – recursive factorial function. Dino Implementation Test machines used to run the benchmarks were a 3.4GHz i54670 (x86-64 Haswell), a 2.4GHz Applied Micro X-gene (AARCH64), and a 3.5GHz Power7 (Powerpc64) running Linux Fedora Core 21. Language implementations used for the comparison include the Python-3.3.x interpreter, the Ruby-2.0.x interpreter, and the JavaScript-1.8.x SpiderMonkey and TraceMonkey JITs. Results for the PyPy-2.2.x trace JIT for Python and the Scala-2.10.x JVM JIT are given only for x86-64 as these systems are not yet implemented on the AARCH64 architecture23 . The absence of results for PyPy on Powerpc64 is due to the same reason. Finally, although Scala and the JVM are implemented on Powerpc64, unavailability of Scala on the machine used for testing prevented us from obtaining the corresponding results. Tables 2, 3, and 4 contain benchmark execution times on x8664, AARCH64, and Powerpc64 platforms respectively. All times are scaled relative to the execution time of the Dino version of the benchmark program. The best results for the Dino version of the factorial and Fibonacci benchmarks were achieved by using pure-function optimization. The best result for the Dino version of the random number generator benchmark was achieved by using function inlining. Results for some JavaScript benchmark programs are absent because the language does not support features needed for their implementation, or because JavaScript versions of these benchmark programs could not be found. On AARCH64 the result for the JavaScript ‘hash’ benchmark is given with JIT disabled, as JITenabled execution failed. Scala results for the ‘compile’ benchmark are absent, as Scala failed to compile it. 8 2018/1/17 Dino Python Ruby PyPy JS Scala Loop 1.0 416 237 23.7 204 10.7 Hash 1.0 2.2 2.8 0.5 1.1 1.1 Fact 1.0 156 44.6 0.6 52.4 3.3 Fib 1.0 483 148 68 167 114 Except 1.0 9.0 4.6 0.5 8.9 Method 1.0 7.8 1.9 0.3 1.4 Object 1.0 6.0 2.5 0.1 0.8 Sieve 1.0 54.6 8.3 6.9 7.8 2.8 Sort 1.0 9.4 3.1 1.2 0.5 0.5 Stat. 1.0 3.6 4.6 1.5 7.1 Random 1.0 34.6 13.4 1.3 0.7 1.3 Thread 1.0 190 194 76.5 - Start 1.0 26.3 25.5 22.1 0.8 377 Compile 1.0 3.9 2.0 21.3 1.9 - Table 2. Performance of Dino vs. performance of other language implementations on Intel Haswell. All execution times of benchmark programs are given relative to the execution time of the corresponding Dino version. Dino Python Ruby JS Loop 1.0 222 170 282 Hash 1.0 0.5 2.8 1.4 Fact 1.0 68.8 32.3 31.6 Fib 1.0 1116 542 471 Except 1.0 12.4 6.0 - Method 1.0 4.7 1.7 - Object 1.0 2.8 1.4 - Sieve 1.0 40.3 8.5 16.2 Sort 1.0 5.3 3.7 2.5 Stat. 1.0 2.5 3.8 - Random 1.0 15.5 13.1 6.5 Thread 1.0 149 118 - Start 1.0 246 655 1.0 Compile 1.0 2.6 1.6 0.5 Table 3. Performance of Dino vs. performance of other language implementations on Applied Micro X-gene. All execution times of benchmark programs are given relative to the execution time of the corresponding Dino version. Dino Python Ruby JS Loop 1.0 25.3 17.6 27.0 Hash 1.0 0.5 1.7 3.0 Fact 1.0 65.9 43.0 53.8 Fib 1.0 592 390 453 Except 1.0 12.9 20.0 - Method 1.0 4.3 1.6 - Object 1.0 6.1 3.1 - Sieve 1.0 25.1 7.6 14.2 Sort 1.0 4.3 4.2 2.8 Stat. 1.0 2.0 5.2 - Random 1.0 6.9 11.4 4.6 Thread 1.0 166 62.8 - Start 1.0 62.5 46.1 2.7 Compile 1.0 2.4 1.5 0.7 Table 4. Performance of Dino vs. performance of other language implementations on Power7. All execution times of benchmark programs are given relative to the execution time of the corresponding Dino version. Dino could be a solution. Comparison of GCC-based JIT and the light-weight JIT with different points of view (generated code performance, efforts to implement, used resources, startup time etc) would be quite an interesting topic for research. There are also plans to develop Dino from a research language into a language which could be widely used in practice. Features planned for this purpose include type annotation, light-weight specialized JIT, native OS thread support for parallelism, rewritten standard libraries, and a more convenient foreign function interface. In addition to native support for parallelism, a more sophisticated model could be provided for synchronization. During the long history of the Dino programming language, a lot of research has been done. Part of this research was described in this article, including the effect of major implementation decisions on performance, some tools which can be used to simplify the implementation, and ways to implement a simple, portable, and stable JIT. We hope that the results reported in this article could help to find ways to improve popular dynamic language implementations to make them faster and more portable, using fewer developer resources. that any JIT compiler written from scratch can achieve the same level of portability. A possible way to improve a GCC-based JIT compiler is to investigate which GCC optimizations actually improve the performance of the C code generated by the JIT compiler. As described earlier, type inference is essential, as GCC is not able to propagate constants which represent operand types in a dynamic language program, nor can it remove code for checking operand types25 . Some optimizations in GCC, e.g. loop invariant code motion, may also not work as well as expected when applied to C code generated by a JIT compiler. This problem could be solved by improving the optimizations in GCC or by implementing some additional byte code level optimizations in the interpreter26 . Another way to improve a GCC-based JIT compiler could be to find the right combination of GCC optimizations which is fast enough but still considerably improves the performance of the generated C code. Such a combination should aim to balance the time of JIT compilation itself against the execution time of the generated code. Some machine learning approaches could be used in order to find the best combination of optimizations depending on features of the generated code [CompilerDesign]. Still GCC-based JIT can be quite expensive for some targets which have memory constraints or do not support files in memory. One such target is CYGWIN environment[Cygwin] where using GCC-based JIT results in a performance degradation in most cases. A simple light-weight JIT implementation specialized for References [Abdelrahman] B. Vitale and T.S. Abdelrahman. “Catenation and specialization for Tcl virtual machine performance”, Proc. of the Int’l Workshop on Interpreters, Virtual Machines and Emulators, pp. 42-50, Washington, DC, June 2004. 25 Conditional constant propagation on C code generated by a JIT compiler can be considered to be analogous to type inference on dynamic language code [Morgan] [Muchnick]. 26 Even if we would need to implement the majority of optimizations on the byte code level, GCC will still be useful as a non-optimizing but highly portable C compiler. Dino Implementation [Appleby] A. Appleby. MurmurHash http://murmurhash.googlepages.com/ 2.0, [Bell] J. Bell. “Threaded code”, Comm. ACM, vol. 16, no. 6, pp. 370-372, 1973. 9 2018/1/17 [Benchmarks] The Great Win32 Computer Language Shootout, http://dada.perl.it/shootout/ [Casey] K. Casey, M. A. Ertl, and D. Gregg. “Optimizing indirect branch prediction accuracy in virtual machine interpreters.”, ACM Transactions on Programming Languages and Systems, vol. 29, no. 6, 2007. [CompilerDesign] K. Vaswani. “Statistcial and Machine Learning Techniques in Compiler Design”, “The Compiler Design Handbook: Optimizations and Machine Code Generation”, Second Edition, CRC Press, 2007. [Cygwin] https://www.cygwin.com/ [Ertl] M.A. Ertl, D. Gregg. “The behavior of efficient virtual machine interpreters on modern architectures”, Euro-Par 2001 Parallel Processing, pp. 403-413, 2001, Springer. [GCH] R. Jones. “Garbage Collection Handbook: Art of Automatic Memory Management”, 2011, Chapman and Hall/CRC. [GCC] The GNU compiler collection, Labels as Values, https://gcc.gnu.org/onlinedocs/gcc-5.1.0/gcc/Labels-asValues.html#Labels-as-Values [Lattner] Chris Lattner and Vikram Adve. LLVM: A compilation Framework for Lifelong Program Analysis and Transformation, International Symposium on Code Generation and Optimization, March 2004. [Makarov] Vladimir Makarov, The Programming Language Dino, https://github.com/dino-lang/dino [Malcolm] David Malcolm, GCC JIT wiki page, https://gcc.gnu.org/wiki/JIT [Meteor] Description of meteor contest benchmark, http://benchmarksgame.alioth.debian.org/u32/performance.php?test=meteor [Morgan] Robert Morgan. “Building an Optimizing Compiler”, Digital Press, 1998. [Muchnick] S. Muchnick. “Advanced Compiler Design and Implementation”, Morgan Kaufmann, 1997. [Poletto] M. Poletto and V. Sarkar, “Linear Scan Register Allocation”, ACM Transactions on Programming Languages and Systems, 1999, vol. 21, no. 5, pp. 895-913. [Sasada] K. Sasada. “YARV: yet another RubyVM: innovating the ruby interpreter”, in Companion to the 20th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, ACM, New York, NY, USA, pp. 158-159. [Shaughnessy] Pat Shaughnessy. “Ruby Under a Microscope: An Illustrated Guide to Ruby Internals”, No Starch Press, 2013. [Shi] Y. Shi, K. Casey, and M. Anton Ertl, and D. Gregg. “Virtual machine showdown: Stack versus registers”. ACM Transactions on Architecture and Code Optimization (TACO), Volume 4 Issue 4, January 2008 Article No. 2. Dino Implementation 10 2018/1/17
6cs.PL
Quanta: a Language for Modeling and Manipulating Information Structures Bruce Long, Computer Science Department, University of Westminster, London Abstract. We present a theory for modeling the structure of information and a language (Quanta) expressing the theory. Unlike Shannon’s information theory, which focuses on the amount of information in an information system, we focus on the structure of the information in the system. For example, we can model the information structure corresponding to an algorithm or a physical process such as the structure of a quantum interaction. After a brief discussion of the relation between an evolving state-system and an information structure, we develop an algebra of information pieces (infons) to represent the structure of systems where descriptions of complex systems are constructed from expressions involving descriptions of simpler information systems. We map the theory to the Von Neumann computing model of sequences/conditionals/repetitions, and to the class/object theory of object-oriented programming (OOP). puter objects and systems of objects. Furthermore, while that paper is presented in the language of mathematics, this paper is presented in the language of computer science, i.e. a specification of syntax and semantics. A language (Quanta) is developed for describing objects and classes and an engine is described for using the Quanta descriptions (in documents) to infer what actions or sequences of actions would be identical to some description and to actually do those actions to accomplish a task or instantiate a class. While the theory presented here is focused on macro-sized open systems, Quanta can also represent small closed information systems; thus, the name “Quanta.” Table of Contents A common method of representing the structure of an information system is to use the formalism of a state machine where states are mapped to states on transitions. The use of group theory to represent state systems is an example [Armstrong]. A reasonable alternative view to a state machine model of state systems is suggested by the fact that a state system, whether in a computer or some “physical” system, can be seen as a container of information. In fact, it is common knowledge in computer science that the number of bits of information (b) is related to the number of states (s) by [Shannon]: 1 Introduction ...................................................................................... 1 2 The Structure of Information .......................................................... 1 2.1 From States to Bits ................................................................... 1 2.1.1 The Computer Memory Example ....................................... 1 2.2 The Theory and Formalism .................................................... 3 2.2.1 Proof, Identity, and Normalization ..................................... 3 2.2.2 The Quanta engine and the Context Hierarchy .................. 3 2.2.3 Shortcuts and Connection to the Outside World ................ 4 2.2.4 Quanta Shortcuts, Autonames, and Auto-Optimization ..... 4 2.2.5 Infons................................................................................... 4 2.2.6 Sub-Infons and Identity....................................................... 5 2.2.7 Literals................................................................................. 5 2.2.8 Reference and Quanta Names............................................. 5 2.2.9 Membership and Identity .................................................... 6 2.2.10 Sequences of Infons as Partial Orderings ......................... 7 2.2.11 Declaring the Type of the Elements in a Sequence .......... 8 2.2.12 Integer Ranges and Sequences.......................................... 8 2.2.13 Blocks: Collections + Set Theoretic Union ...................... 9 2.2.14 Automatic References and Inter-Sequential Relations... 10 2.2.15 Strings and Sequences..................................................... 11 2.2.16 For Infons and Variables................................................. 11 2.2.17 Data Queries.................................................................... 11 2.2.18 Boolean Queries .............................................................. 12 2.2.19 Conditionals .................................................................... 12 2.2.20 The All Matching Infon .................................................. 12 2.2.21 Referencing Infons.......................................................... 12 2.2.22 Assertions from Classes .................................................. 13 2.2.23 Set Theoretic Constructions............................................ 13 2.2.24 Arrays .............................................................................. 13 2.2.25 Commands: Affecting the World.................................... 13 3 Techniques for using Quanta ........................................................ 14 3.1 Describing Functions without Side Effects ............................. 14 3.2 Describing Sequences for Serializing and Parsing .................. 14 3.3 Describing Algorithmic Structures .......................................... 14 3.4 Mapping to the Outside World ................................................ 15 3.5 Describing Functions with Side Effects................................... 16 3.6 Describing, Creating, and Manipulating Objects .................... 16 3.7 Other Techniques ..................................................................... 16 2 THE STRUCTURE OF INFORMATION 2.1 From States to Bits s = 2b. In this paper, a model of the World-as-state-system is given in terms of information structures rather than state correlations1. An interesting way to develop such a theory would be to start with a state-transition based formalism such as group theory or the formalism of Petri nets [Murata] and use the above identity to generate a bit-centric view. However, here we shall merely consider, as an example, the operation of computer memory as it evolves deterministically through a sequence of states under the control of a program, and extract a number of “observations” which we shall use to generate the formal theory. The example is not meant to “prove” the observations; rather, it is intended merely to provide an intuitive foundation for questioning the formalism produced. 2.1.1 The Computer Memory Example In this section, we provide examples of the evolution of computer memory cells to illustrate intuitively what is meant by the “structure of information.” While these examples are of a digital system with discrete transitions between states, the formalism produced can also be used to represent continuous transitions such as those undergone by q-bits. Consider a 16 bit word of computer memory; that is, a 216 state system that can honor references to its entire value, hi and lo bytes, and sixteen independent one bit values numbered from 0 to 15, and which evolves deterministically. There are many different ways that such a system can evolve. First, let us consider such a system where a program and data external to it can contribute to its evolution, i.e., an open system. As an open system there are no limits to how our system can evolve. It may, for example, successively take on the values composing an entire database. Though our system is only 16 bits, in an openly evolving system any amount of information can be received by observing the system as it changes. Open systems can 4 Bibliography ................................................................................... 17 1 INTRODUCTION In the paper The Structure of Information [Long] a mathematical model of information is presented. This paper is based upon that theory but is not directly inferred from it. While that paper focuses on representing very simple closed systems, this paper focuses on describing complex open systems such as macro-sized physical or com- 1 In theory, a state-based methodology should be as expressive as a bit-based one; however, it can be shown that in many state-transition based formalisms a conflation of the concepts equality-as-structuralisomorphism and equality-as-numerical-identity causes information to be lost in the formalism. This loss of information makes it hard to model several phenomena such as intensional contexts and mereological relations. be characterized in several ways. If each value of the system through time is mapped to some other state such as its previous state or the start state, then an open system is one where the mappings can be to values of other, external, systems. An open system can also be characterized as one in which the map itself has state and changes. We can make several observations from the above that will lead into a discussion of closed systems. First we notice that as a state system evolves through a series of states, new information may be required to ensure that the system remains deterministic. In the above example, a static 16 bit system contained only 16 bits, but if it changed states even once it may require up to 32 bits to remain deterministic. O1: The map, program, function, etc. that determines how a system evolves is, itself, a piece of information whose contents become inferable from the changes or patterns of change in the system in question. We also note that all of the information necessary to produce a sequence of values in such systems exists when the program starts. As the state of the system changes, no new information is generated. Rather, the information that already existed at the start of the program becomes expressed in the progression of state values. The exact pattern a piece of information goes through, the way it interconnects with other information in a sequence, is the structure of that information. O2: While we can refer to a piece of information at a particular place or time, we can also refer to that piece of information as it extends through time or space and interconnects with other pieces of information. Now we can develop the concept of a closed system. For a particular state system that evolves, let us include with it all the information in external systems that will have a bearing on how that system evolves; that is, all the information that determines its state. However, let us not include any extra information; that is, if a particular state of an external system could change without affecting the sequence of values our system-under-question takes, it is not included. Such systems are closed. If a system does not evolve then it is closed by itself. It can easily be shown that if a closed system evolves, each state maps to exactly one unique state. In other words, the mapping function produces a one to one map from the list of possible states to that same list. We will use this as a definition of closed systems. D1: A closed system either does not evolve or evolves according to a mapping function that maps the set of possible states one-to-one onto itself. By using different references into a closed system we can have different views of its evolution. This will be useful in specifying information structures. Consider a closed 16-bit system. Referred to as a single entity it has 216 states but cannot evolve. If we divide it into two bytes, we can, for example, use the hi byte as a “program” to specify something about the evolution of the lo byte. Of course there are only 256 such “programs” possible. We would then retrieve the full 16 bits by observing the state of the lo byte and observing which program it was running. We could produce longer sequences by having 15 bits for our “program” and 1 bit for the evolving state system. This “dividing” of a piece of information into sub parts that evolve vs. programs that determine how it evolves can make the evolving piece act like an open system. That is, states can map to more than one value. We will use this as our definition of an open system. D2: If a closed system has sub-parts j and k such that k evolves based on j, then k is called an open system. From the above discussion, and from general computer science knowledge that information pieces such as bytes divide into smaller pieces such as bits, we make the following observation: O3: Pieces of information divide into sub-parts. The size of the parts can be measured in bits or in number of states, but the addition of part sizes is done by adding bits. Also from the preceding discussion we make this observation about describing the structure of a piece of information: O4: To completely describe the structure of a piece of information, enumerate its sub-parts and their inter-mappings. Suppose that two pieces of information, both of which are sub-parts of a closed system, interact. For example, suppose the hi byte of our 16-bit system affects the lo byte by copying its bit 0 into bit 0 of the lo byte. Clearly, if something is not done to preserve the lo bit 0, its old value will be lost and we will no longer have a closed system. Either that information can be simultaneously copied into the hi bit 0, or a more complex “information circuit” can be created involving three or more pieces of information. Said another way, the information which will be referenced by “lo bit 0” is the same information that was previously referenced by “hi bit 0.” Some other reference must be made to refer to the old “lo bit 0.” Because in this scenario we needed to talk about the “same” information we have at least an initial, intuitive reason to assert that that information has (numerical) identity. Notice that, unlike in traditional mathematics [Devlin, 1993], this (informatic) identity is not the same as equality. In fact, there are no a priori Identity Criteria [Guarino] in this theory. All identities will either be asserted or inferred by a process of elimination over a closed system. More than one bit may have the value 1 or the value 0, but merely because the two values are equal does not imply that as information pieces they are numerically identical.2 In fact, suppose that both bits-to-be-swapped have the value ‘1.’ Still, the swap would have taken place, though the numerical state of the system would not have changed. This conflation of two notions of identity can cause a loss of relevant information. O5: Pieces of information have numerical identity. This identity is not implied by equality of value. Observation O4 requires that sub-parts of information pieces be mapped to each other, but it does not specify how the mapping is to be done. The example just given suggests that specifying identities is the method of mapping. In the example, the new value of bit 0 of the lo byte is identical to the old value of the hi byte’s bit 0. Clearly, mappings more complex than identity are needed. For example, what about the mapping that A=B+C? In the information structure formalism that follows, such complex mappings can be made by mapping sub-parts and super-parts to each other. O6: Mappings among the parts of a piece of information are made by specifying identities that hold among them, their sub-parts, and super-parts. From the observations made so far, the structure of an information system is specified by describing the identities that hold among a collection of information nodes which have sub-parts. Suppose that we have 5 nodes A, B, C, D, and E, of one byte each. Perhaps the nodes represent five “const” bytes that do not change, or perhaps they represent a single machine byte that undergoes four state changes. If we do not want to mention their sub-parts (e.g., bits), we can assert that none of them are identical, or that there are some that are identical to others, or that all are identical. In the first case, our total information is five bytes, while in the last case there is only one byte, through five copies of it. A more complex situation can occur when we refer to sub-parts. We might map the bits of A to those of B, then those of B to those of C. A simple and not very useful structure would be where there were no identities among the nodes. In a slightly more complex structure, perhaps pairs of nodes are related. For example, perhaps the bits of A map to B, those of C map to D, 2 An argument with a similar conclusion is made in Stonier’s Information and the Internal Structure of the Universe. 2 and perhaps the low four bits of E map to its high four bits. In more complex structures, however, longer chains or sequences occur. For example, the bits of A might map to B, those of B map to C which maps to D then to E. Such sequences occur in character strings storing complex data, arrays of interrelated data, streams delivering a protocol, and memory cells and other state systems as they progress through time. While such partial orderings could be represented without special features of a language, they are so common that a practical language would have facilities for representing them. In fact, isolated information pieces not identical to anything can be seen as a single element sequence, all systems that can be represented under this model can be represented as collections of interrelated sequences. O7: In systems of any complexity, information is mapped into partially ordered sequences, and representing systems by representing sequences and their interrelations is easier than doing so by representing only information nodes. Consider a collection of information pieces C and a sequence S where each element in S divides into two parts S.ref and S.val where each S.val is a member of C such that whenever two S.ref’s are equal, their corresponding S.val’s are identical. We will call the S.ref’s references, and the S.val’s referents. An example of such a system is where an array is the C, instances of looking up a value in the array are the S’s, and for each such instance the array index is S.ref, and the value referenced is S.val. Other examples are the mechanism for using pointers into memory and that for using a hash table. O8: There are structures where the value of one piece of information can be used to refer to another piece of information. 2.2 The Theory and Formalism In this section, we develop a theory for representing information structures in a way that merges the features of ontology language and programming language. There are two aspects of the development: the theory apart from any notation that represents it, and the definition of a language called Quanta which is an embodiment of the theory. We separate the theory from its embodiment in a notation to better facilitate the creation of improved versions and new notations to be formed around the theory. While Quanta will function as a powerful ontology and modeling language, it can, at the same time be used as a full fledged programming language. Because a correctly built Quanta engine can recreate or adjust programs to fit new or special hardware situations as described in an ontology, it is suggested that Quanta would be as useful as an intermediate language in a Grid Services Platform, as well as for traditional programming tasks such as scientific and business applications or high speed virtual reality games. In order to keep notation-independent theory separate from the Quanta specification, all discussion that is specifically about Quanta will be presented within tables. We begin by specifying a modification of BNF [Barrett] that we will use and defining syntax for Quanta tokens and comments. The syntax for Quanta is specified in the following BNF style form: 1. 2. 3. 4. 5. 6. 7. 8. 9. Terminal symbols are underlined. Non-terminal symbols are in italics. Symbols in bold are being defined. Alternative items are either on a new line or in the form (a | b). Optional items are enclosed in square brackets. Items in curly braces can appear zero or more times. Case is unimportant. Some items are explained in English or by example. The start symbol is infon. Token Alpha-or-‘_’ { Alpha-or-‘_’} Comments // Comment … | /* ….. */ ( Block comments are nestable) 2.2.1 Proof, Identity, and Normalization The problem of merging ontology language with programming language is illustrated by noting the difference between algorithms that run programming interpreters or compilers and those of languages such as DAML/OWL. We wish to have a language that can be efficiently compiled or interpreted, yet the proof algorithm of DAML/OWL is a graph traversal based on modus ponens [Lissila]. Such an algorithm does not easily map to the von Neumann block/loop/conditional statement architecture of traditional programming languages. One method of creating programs in logic is the method of Prolog [Ghezzi]. However, the method used in Prolog is insufficient because, as before, without the explicit block/loop/conditional statements of imperative languages, Prolog is too hard or too inefficient to use for many purposes such as game programming, application programming, or scientific computation. The observations that information has identity and that the structure of information is given in terms of such identities provides an alternative that will solve the problem. Rather than use a graph-traversal method based on modus ponens, we will use a graph traversal based on the substitution of identicals as in equational logic [Ramsamujh]. As we shall see, we can map the block/loop/conditional methodology to our variant of the equational logic if the items that are substituted are pieces of information and the criterion for substitutability is informatic identity. For logic and math, the equations logic works in its regular way; for example, a problem might use the identity X(Y+Z)==XY+XZ to solve an equation. Since the items that are substitutable are information we can have chains of identities mapping information through hardware. For example, Patients_info == CertainPlaceInDatabase == ResultsFromWebService == ResultsFromHttpInteraction == OperatingSystemInteraction could be a chain of identity relations that the engine uses to find a patient’s information. Likewise, the identities describing how information flows through time or in through another sequence can be used to specify or control the evolution of a computer object or physical system. We summarize in the following statement: S1: All operations on information in this theory are based on the substitution of identicals in non-intensional contexts, or on operations that are compositions of such substitutions. Under this model, the notions of “executing code” and ”evaluating expressions” are not as useful as that of “normalizing information.” The code “2+3” could be “executed” by generating code that calculated the answer, or it could be “evaluated” to obtain the answer. In this theory we say that 2+3 is the information we want, and “5” is identical information in a normal form. The former will have the latter substituted for it. A normal form is obtained by applying identity substitutions until the desired form is reached or until there are no more identities that apply. When a system that changes over time is normalized, as will be discussed later, the resulting system is an executing program. In other words, it is not the case that Quanta programs can be compiled and then optionally run. Rather, when they are normalized they are executing programs whether that happened via substituting the results of interpretation, compilation, or a combination of such methods, and whether executed on a single processor on a distributed grid. S2: The decision of which identity substitutions to make is based on the goal of reaching a normal form or some other desired form for a given piece of information. 2.2.2 The Quanta engine and the Context Hierarchy In the use of a Quanta engine, a file of Quanta code is parsed and an in-memory image is created. This image can be thought of as a snapshot of the state of a Quanta engine in time. Next, that image is submitted to be normalized. When it is normalized, the results of queries 3 will have been compiled, programs will be running or have finished, and the state of the external world may have changed or be changing. A reference to the object created will be returned which can be used to find the results of queries, get handles to programs, erase the object, or even use in future jobs. This process can be done by a person, a shell, or another program or service. Thus, a plain interface to a Quanta engine may be a CLI; however, a GUI or other type of interface can be imagined as well. In our test bed there are parse and normalize member functions. We also have a shell that calls them and a test tool that calls that shell. A normalized Quanta object will contain names of data sets, running programs, external systems, classes, and all the identity statements defining these items. It is useful to be able to normalize new objects in the context of those already normalized in order to access their namespace. When an object is normalized, a reference to it is returned new object passed in for normalization can use that reference to assert “I am a member of this object.” Since Quanta names have scope local to where they are defined, this creates a context hierarchy that can be used to run multiple objects without namespace collisions. Consider an example situation. When the Quanta engine is first run, it loads a top level object called “World.” World typically includes libraries defining basic types, local system resources, external systems, and user information. It may also contain running programs that maintain the system. As an example, a user may then create a (very simple) object such as “2+3” and submit it for normalization where it will be transformed into “5.” The shell automatically dereferences the returned reference and displays the results. More complex code might include programs or commands to run, or queries that contain references to the objects modeled in World. A new reference will be returned which can be used to access the new object. A reference to World or its members can also be used in a call to parse. Literal strings in Quanta can be delimited in a number of ways, but if a string is a serialization of a type of which World contains a map to that string format, the parser can use that map to read in the string thus making delimiters unnecessary in unambiguous cases. For example, World might contain a date type and a map to a string format. Then, in code parsed under the context of World, if the parser can tell that a certain string is a date, dates in that form can be used as literals and quotes are not needed around the string. Q1: A Quanta engine parses Quanta code into a memory image of a snapshot of a system at an instant. It normalizes such snapshots to create dynamic models and returns a reference to the model. Given such a reference, parsing and normalizing can be done in the context of (i.e., as a member of) an already-normalized object to access its namespace. Various UI types can be made to provide tools for parsing, normalizing, accessing, and deleting objects. The exact method used by a Quanta engine to choose and apply identity substitutions is not prescribed here, and is implementation dependent. However, literal forms should generally be preferred to symbolic forms. 2.2.3 Shortcuts and Connection to the Outside World Often, given a list of assertions in the current informatics theory, statements can be inferred that are not necessarily in the given list. This is analogous to theorems in mathematics. D3: Statements that hold given a collection of assertions in this (informatics) theory are called shortcuts. Because information processing devices can access actual information from the world outside the processing engine, references in the logic can refer to or manipulate objects or systems in the external world. For example, a name in the language might produce information from an I/O stream when dereferenced. Information from those systems can be recognized as such by asserting or inferring an identity relation between the information from the dereferenced name and information from the external entity. For example, information from such a name might be asserted or inferred to come from a video camera, and the information entering the video camera might be asserted or inferred to come from some physical scene. Perhaps, given a sufficient model, the contents of the images can be inferred from the stream. This is an advantage over traditional logics where a barrier between language and reality exists [Read, 5-34]. D4: Names of information sources that automatically produce information from or push side-effects onto the external world are called autonames. 2.2.4 Quanta Shortcuts, Autonames, and Auto-Optimization The Quanta syntax can be used to describe complex information structures by implying various identity relations. In addition to these relations, there are a number other sources of identity assertion that the engine can use to optimize performance. They are shortcuts and Autonames. Shortcuts are assertions kept by an engine that could be deduced from given identities. They are akin to theorems in mathematics. For example, given the axioms defining arithmetic, the Quanta shortcut: for x:<numbers> :: %x * 0 == 0; could be deduced. It states the theorem x * 0 == 0. Other shortcuts might provide functions for such tasks as retrieving web pages via http, calling specific web services, or constructing application objects. Autonames are Quanta names that are recognized by the engine and are given special identities. For example, in our test bed for Quanta, the calculation of sum of two numbers is evaluated without recourse to the axioms of arithmetic using a fast addition function written in C++ (for addition of literals). Autonames are one way for an engine to provide a connection to a file or I/O system. In advanced engines, logs can be kept of what identities are applied for various problems. These log files could be examined to find series of identity substitutions that are applied often, and a shortcut could be created automatically. Some such shortcuts may be links to binary code. Likewise, for names that are dereferenced often, a dereferencing procedure of compiled into binary code could be made into an Autoname. 2.2.5 Infons A term is needed that is less ambiguous than either “piece of information” or “state system.” For example, state system could mean a statesystem-at-an-instant, a state-system-over-its-lifetime, a time-slice from a state-system, a state-system-over-an-interval etc. Furthermore, the term “state system” connotes a physical system separate from any content that its state may hold. Keith Devlin uses the term infon to refer to “a piece of information.” [Devlin: 1991] That term will be used here. More precisely, we use it to mean a collection of one or more constant states or pieces of information. By “constant”, we mean unchanging or even a-temporal. Thus, an infon can be a state system at an instant or over an interval in which the same piece of information is held. However, it can also be a system over time in which each item in the infon is one of the states of the system as it changes over time. The notion of time is not built into the concept of an infon; we will have to add it later. The items in an infon need not be connected with each other in any way. They could be the states of a system over time (time-slices), but they could as easily be the eight bits of a byte or the bytes in a megabyte. The usage for infons will be analogous to that of sets. In fact, the theory is modeled after ZF set theory [Devlin: 1993], but where all objects are infons and literal values are used instead of the empty set to generate the theory3. Sub- 3 ZF set theory uses the empty set as the foundation of all its objects. For practical reasons, the current theory uses literal values for that 4 sequently infons will be defined more formally; however, here the definition of infon is informal. Intuitively, one can think of an infon as a state system, but perhaps the best translation is “piece of information.” Since almost everything can be modeled as a state system [Malitz], almost everything is considered an infon: computer memory, chunks of memory, data-structures, objects, web-services, even people, atoms, and institutions. D5: Infons are pieces of information. That is, they are state systems viewed from the bit-centric point of view. S4 allows us to infer the members of an infon if we know the members of an identical infon. We can refer to the identities implied through containment with either of the notations: Contains: some specification and Is Member of: some specification. 2.2.7 Literals Q3: Infons Literal values are used as infons with which the engine has direct contact. At least some literals must have an equal operator defined. Quanta provides literals for indefinitely large integers, strings, and Boolean values. Syntax S5: Literal values are infons. Infon ( Infon ) // Infons can be enclosed in parenthesis. CollectionInfon DifferenceInfon IntersectionInfon ComplementInfon BoolInfon LargeIntInfon StringInfon NameInfon IdentityInfon ForInfon VarInfon MatchInfon ArrayInfon ContainInfon PartialIDInfon ConditionalInfon SequenceClassInfon SequenceContainsInfon IntRange BoolQryInfon CommandInfon Q4: Literals Many equivalent methods could be used to describe the structure of infons. The following lists the infons of Quanta. Syntax BoolInfon ( true | false ) LargeIntInfon A string of digits terminated by a non-digit. StringInfon Token “This is a string\n” // All C escapes are supported. ‘This is a string\n’ // Strings can contain embedded new-lines. A here document as in UNIX scripts. ‘Chunked’ binary stream as in HTTP. Automatic parsing of context-defined, serializable types. Identities implied 1. LargeInts have arithmetic operations defined for them, as well as gt, lt, ge, and le comparison operators. Later in this paper the algebraic identities will be defined. Other functions may be added to the language later. 2. Strings are “sequences” which are defined later. This implies a range of access functions and identities providing access to characters, sub-strings, and even named sections defined by a sort of regular expression. Identities implied 1. All identities implied by the infon type chosen are implied for this infon. 2.2.6 Sub-Infons and Identity By observation O3, infons can have sub-infons just as state-systems can have sub-systems, i.e., information can be subdivided into smaller information pieces such as where objects have members and bytes divide into bits. It should be emphasized that an infon just is its members. It is not a structure such as a list which would take some structural memory even if the list contained nothing. An infon with no members contains zero bits and has only one state. This mereological type of containment also implies that infon membership cannot be circular, though infons can contain circular references. We will use words such as containment, membership, is an element of, and so on to signify sub-infonship. S3: Infons can have sub-infons which are also infons. (O3) The relation between an infon and its members is: S4: Two infons are informatically identical if and only if they have the (informatically identical) same sub-infons. purpose. It would be interesting to remake this theory using (zero-bit) null infons {} as the foundation. Autonames 1. The arithmetic and comparison operators for LargeInts are implemented as autonames. 2.2.8 Reference and Quanta Names By observation O8, we can use one infon to refer to another infon. In logic and traditional set theory, entities can be named at will. In an actual physical system, however, references are themselves information and take up memory in a state system. S5: Infons can refer to other infons according to the principle that all equal names are defined to refer to identical infons. This notion of reference is important for several reasons. First, it can be used to spell out the “logic” of references so that the engine can make inferences about them. Secondly, information cannot divide into parts indefinitely but must stop at bits. One requirement is to be able to refer to an infon and then refer to its sub-infons. If logical simplicity were the main disiratum it would suffice to have the ability to declare that a particular infon is to be used as a reference. That reference could save sub-parts such that one part selected the parent infon while the next part selected the desired sub-part. It is significantly more efficient, however, to build such hierarchical referencing into the language. In Quanta, names are 5 segmented using the ‘dot’ as a separator as is typical in programming languages such as C++. Successive segments refer to members of the infons referred to be the preceding segments. Here is the notation for Quanta’s references, called names: Q5: Names Syntax NameInfon <NameSegment> NameSegment Infon [$] [. NameSegment] Identities implied 1. All equal names refer to identical infons by definition; thus, they can substitute for each other. Names are equal if they have the same number of segments and corresponding segments are equal, perhaps determined by the equal operators for literals. 2. If a name <N> refers to an infon j, then adding a segment <O> to <N> ensures that <N.O> refers to a sub-infon of j. That is, <N> always contains <N.O>. Comments and Examples 1. Names in Quanta have the same logical properties as names and functions in programming languages. If they refer to changes, they can even act like functions that affect the state of their parent or functions with external side-effects. Logically they are similar to maps in set theory. 2. Quanta names are not abstract entities, but entities that exist as information structures in a state system. 3. Some examples suggest usage: <World.England.Queen> <Sqrt.9> <Sum.[5,3]> (The square brackets in these examples delimit Quanta’s literal arrays, which are defined later.) 4. The infons of a name segment can be of any type. So, names can be used as arrays, and maps. 5. In cases where the syntax is unambiguous, alternate syntaxes are acceptable and will be used in this paper. Examples are: Sqrt(9) Sum(5.3) 5+3 World.England.Queen 6. The optional dollar sign ($) in name segments will be explained in Q9. if A contains B then B is a member of A. Because of this, there are two different ways inferences that can be made for each operator. While these inferences should not be ruled out, we can make the engine’s task easier by preferring one direction of inference to the other. There are three ways that a language can benefit from preferring a single direction of inference for identity and containment. First, an engine must navigate a maze of identities in order to arrive at a normal or desired from for a given piece of information. This is essentially a graph traversal where each identity is an edge. By preferring a single direction through each edge, and by verifying that each edge leads to an actual transform, it can be shown that, because the goal is usually a normal form of the information, and each transform, presumably, bring the infon closer to that form, an edge will not usually be applicable more than once. Except for the special cases, this relieves the engine of having to keep track of every node it visited in the graph. For example, a transform that maps “2+3” to “5” will not be encountered again in the same context because “5” does not match “2+3.” The special case involves transforms involve the order of elements. For example, the assertion that addition is commutative, which in Quanta reads: for x:<numbers>, y:<numbers>:: %x + %y == %y + %x would apply to 2+3 as well as to 3+2, thus the engine would be in an endless loop. This problem can be overcome by detecting order-based assertions and only applying those only if the parameters are unsorted by some ordering criteria. Thus, 3+2 would be transformed into 2+3, but since [2, 3] is sorted, the transform would not occur again. The second benefit to having a preferred direction of inference for identity and containment operators is that it provides an automatic method for specifying normal forms. Programmers simply arrange assertions so that the transform most often desired is applied. For example, since the form “5” is preferred to “2+3” in most cases, the assertion of identity would be arranged to that substituting the former for the latter happened as the preference. When alternate forms for information are desired, the identity can be transversed in the opposite direction. Lastly, having a preferred direction of inference allows the engine to guess when names are being defined vs. used. This is especially useful when defining sequences. In sequences, items of the sequence are often mapped to their predecessor. It would be unwieldy to always have to specify when a “current” value vs. a “preceding” value was being referred to. With a preferred direction of inference, it can be assumed that one side of the identity statement refers to the “new” value, and the other side the “old” value. Thus the identity assertion “<A> == <A>+1” can mean close to what it means in traditional programming. The “l-value” gets the normalization of the “r-value.” Q6: Identity Assertions Syntax // L-Value and R-Value are synonyms for infon. IdentityInfon L-Value == R-Value 2.2.9 Membership and Identity Identities implied Because equality does not imply identity, equality operators cannot directly be used to determine identity. Therefore, it is necessary to explicitly declare identity much of the time. Declaring identity between two items means that they have the same (identical) members (S4). It is useful to be able to also declare that one item contains all the members of the other item, and perhaps more (partial identity). Likewise, it is useful to be able to declare that the one contains the other and may also contain other items (containment). 1. L-Value and R-Value are identical infons. Statement S4 generates three binary operators asserting identity, partial identity, and containment. Naturally, these three operators are bidirectional; if A is identical to B, then B is identical to A, if A is partially identical to B then the members of B are members of A, and 6 Comments and Examples Q8: Containment 1. Though identity is symmetric, transforms in Quanta proceed from LValue to R-Value in normal cases. Syntax 2. Later, sequences and “sequential contexts” will be discussed. When an L-Value is a name in a sequential context, then it refers to the “next” value in the sequence. R-Values in a sequential context refer to the “current” value in the sequence. ContainInfon Type-Class : [Item] 3. Some simple examples are: <Company.CEO> == ”Fred Smith” <Person.Age>==<Person.Age>+1 4. // Type-Class and Item are synonyms for infon. Identities implied 1. Item is a member of Type-Class. Comments and Examples 1. The preferred inference for containment is that item is a member of Type-Class so that anything the holds for all members of TypeClass holds for Item. This is used to generalize. <Person>=={<name>==”Bob Smith”; <age>==42; <ShoeSize>==9;} 2. If the above assertion is true, then “<Person.age>==42” is true. This defines three fields for <Person>. There may be more fields, but they will map to these three. That is, these three are sufficient for determining identity. Statistical inferences are possible. Suppose 50% of the items in Type-Class are green and the rest are blue. Then asserting that Item is a Type-Class asserts those probabilities over Item. The current Quanta engine does not support such inferences. 3. Some examples are: <Customers> : <Bob>; // Bob is a customer. <Dog> : <Fido>; <Loves> : {<Lover>==<Alice>; <Loved>==<Bob>}; // A relation. 4. The “item” can be left out if a name is not needed. This example assumes the reader knows about collections, which are defined later; however, it is an intuitive example. Q7: Partial Identity Syntax // L-Value and R-Value are synonyms for infon. PartialIdInfon L-Value := R-Value Identities implied 1. L-Value contains all the members of R-Value, and perhaps more. Comments and Examples 1. Transforms relying on partial identities in Quanta proceed from LValue to R-Value in normal cases. That is, the preferred inference here is that L-Value contains something, not that members of RValue are members of L-Value. 2. When an L-Value is a name in a sequential context, then it refers to the “next” value in the sequence. R-Values in a sequential context refer to the “current” value in the sequence. 3. An example similar to that for identity assertions. <Person>:={<name>==”Bob Smith”; <age>==42; <ShoeSize>==9;} Unlike with the identity assertion, the possibility that there are more fields that do not map to these three is left open here. The identities of name, age, and ShoeSize are not enough, by themselves, to determine the identity of Person. 2.2.10 Sequences of Infons as Partial Orderings Observation O7 in section 1 implies that because infons map to each other, often in long sequences, the ability to represent partially ordered sequences is important in an information structure language. An example of such usage is in representing sequences of events through time as described in Lamport’s Time, Clocks, and the Ordering of Events in a Distributed System [Lamport]. Lamport represents such an ordering using a “Happened-Before” relation between events. Sequences of infons are not necessarily temporal, and therefore are not necessarily separated by events. For example, sequences of characters in a string are not, in general, temporally situated. Later we shall add the notion of events to sequences to help represent temporality. Currently, we shall adapt Lamport’s partial ordering to collections of infons by associating a next and previous field with each infon in a sequence. We also associate a first and last field with each sequence, along with size and a numerical reference to each infon in the sequence. Lastly, we define that there is a method for referring to sub-sequences within a given sequence. S6: A collection C of infons is a sequence S if each infon in C is associated a next and previous infon in C and S has references to first and last infons in C such that first.previous and last.next are {}, and the other next and previous fields work to form a doubly linked list which includes every member of C. S is also associated with a numeric size field which is the number of infons in the sequence. S7: Each infon in a sequence S can be referenced by a numeric index in the standard way where S[0]==first, and S[size-1]==last. S8: A sub-collection of the items in a sequence S is a sub-sequence if all of its members are sequential in the doubly linked list. Subsequences can be referred to by a start and end reference into S or by a start index and a size specification for the sub-sequence. It is important to realize that what is being defined is a collection of names and the relations among their referents, not a fancy doubly linked list. The names will be used as a model. Perhaps no values in the model will be known, but perhaps some will. For example, if it asserted that a particular sequence has size=100, then the system knows only that fact. A query for the fifth item, for example, will fail. Likewise, if the system knows all the values in a sequence but not, explicitly, the size field, it may be able to deduce the size by counting 7 the items in the collection. The mode of operation is to gather as much information as is needed, and to infer other infons by applying the principle of substitution of identity. Suppose it is asserted that a certain field contains the size of a sequence, and that a different area of memory contains the items in the sequence. A query for the sequence might trigger a query for the size which would be substituted for the results of reading the size field. Similarly, the first part of a sequence may be stored in one database while the second part of the sequence is stored in, for example, a local file. These identity mappings can be asserted, allowing the engine to find the data for querying or manipulation. In section 2, a number of constructs for representing information structures are developed. For many of these constructs, there is a simple way of creating a partial ordering out of it. For example, a notation for collecting pieces of information into a single group can be modified to also order those pieces. For consistency, our syntax will be to add a dollar sign ($) to a construct when we desire to activate the extended semantics. For example, a string “Hello” can have extra semantics applied to it by $”Hello”, and a collection {A, B, C} can be ordered by ${A, B, C}. One can think of the $ as short for “sequence.” Now we suggest an exception to the normal method of naming entities that may seem strange at first. We have defined a number of fields that sequences have such that (in normal Quanta) we would expect to refer to an entire sequence S with the notation <S>. Likewise, we would expect to refer to the first node (for example) in S with the notation <S.first>. The problem is that in many cases we wish to refer to a particular item in the sequence, and we wish to reference it, not by a numeric index or by a series of “.next” fields, but as the infon “just after” the previously referred to infon. Therefore, for many information structure languages it will be useful to allow the normal reference to a sequence refer to this “current element” and use a special notation to refer to the structure as a whole. As is specified in Q9, we use a $ to indicate this difference. We now consider the Quanta notation for representing sequences. Q9: Sequence Structure 7. <N.prev> == A node for the previous infon in the sequence or {}. 8. <N.value> == The actual infon in the sequence. 2.2.11 Declaring the Type of the Elements in a Sequence Infons, in our notation, are static entities that do not change. They might be considered “const” entities. If we wish to model an entity that changes over time we shall have to represent it as a sequence of infons. Suppose, for example, that we wish to represent an integer stored in computer memory that can change over time. In C++ the notation to declare such an entity is: int i; // i is an integer that can change. In Quanta, we can create a class <ints> which is the infon containing all integers. We could then assert: <ints> : <i>; // <i> is a const integer. While this looks similar to the C++ notation, it declares that <i> is a single integer value, that is, a “const” integer. The equivalent information structure is a sequence of integer infons. One way to declare such a thing is to declare a sequence then assert that all of its elements are integers. This method is tedious, and we would like for Quanta to look as similar to traditional programming languages as possible, so we develop two shorthand notations for Quanta. Q10: Sequence Types Syntax // Type-Class and Item are synonyms for infon. SequenceClassInfon $NameInfon Q9: Sequence Structure SequenceContainsInfon Type-Class $: Item Syntax notes Identities implied 1. When describing or populating a sequence (vs. using one), it is useful to be able to refer to the infon “just after” the previously referred to infon. Thus, for names of sequences a special case is made in the way their names refer to them. If a name segment that refers to a sequence ends with a dollar sign ($), the reference is to the entire sequence. Otherwise, the reference is to a particular element in the sequence. The determination of this element will be discussed in Q13. This syntax was defined in Q5. 1. The resulting SequenceClassInfon is a sequence of whatever type is named by NameInfon. That is, all the members of the resulting sequence are members of the infon named by NameInfon. 2. In the resulting SequenceContainsInfon, Item is a sequence of which, all members are of type Type-Class. A number of syntactic constructs for generating sequences will be considered after this. However, all of them have in common that they produce a number of named sub-infons, or fields. More precisely, a sequence contains the following sub-infons. 1. 2. Identities implied For a sequence S: 1. <S$.first> == A node for the first infon in the sequence. 2. <S$.last> == A node for the last infon in the sequence. 3. <S$.size> == The number of infons in the sequence. If n and m are number from 0 to size-1: 4. <S$.n > == A node for the nth element of the sequence. 5. <S$.[n, m] > == A subsequence starting at position n and of size m. Comments and Examples Because $<ints> is the class of all sequences-where-all-membersare-integers, a SequenceClassInfon can be used to declare a sequence of integers. $<ints> : <i>; 2. // i is an integer that changes value over time. An even easier method is to use a SequenceContainsInfon which is similar to the ContainsInfon, but which automatically declares a sequence. <ints> $: <i>; // i is an integer that changes value over time. 2.2.12 Integer Ranges and Sequences Collections and sequences of integers are quite common, and Quanta has a special notation for declaring them. For a sequence node N: 6. <N.next> == A node for the next infon in the sequence or {}. 8 Q11: Integer Ranges and Sequences Q12: Blocks, Collections, and Infon Union Syntax Syntax // StartInt and EndInt are synonyms for infons evaluating to integers. CollectionInfon [$] { { [#] Infon ;} [ …; ] } [$] { [#] Infon { , [#] Infon } [, …] } IntRange [$] StartInt .. EndInt Identities implied 1. The resulting infon is collection of integers in the specified range. 2. If a dollar sign ($) is included, the collection is also a sequence. Comments and Examples 1. 5..10 2. $5..10 // A sequence of integers from 5 to 10. 3. $10..5 // A sequence of integers from 10 to 5. Identities implied 1. The infon resulting from a CollectionInfon contains all listed infons that are not marked with a “#”, and all the members of the listed infons that are marked with a “#”. 2. If the last element in a CollectionInfon list is the token “…”, then there may be other elements in the collection which are not present. If the element is not present, then the list is exhaustive with regard to non-identical elements, and the whole can be considered identical to the parts. 3. If the resulting CollectionInfon C is marked with a “$” sign, then C is a sequence where the order of the items in the list corresponds to the order in C. If C is marked with a “$” sign, then all items in C marked with a “#” must also be sequences. Such items are subsequences in C. 4. In the next section, it is defined that certain sequences S1 can contain other sequences S2. Because the S2 sequences must be contained in a sequence, a CollectionInfon containing such a sequence will automatically be a sequence, even if the dollar sign marker is not present. // The collection of integers {5, 6, 7, 8, 9, 10} 2.2.13 Blocks: Collections + Set Theoretic Union Observation O3, which states that infons divide into sub-infons, suggests that as long as we do so in a mereological fashion we can form new infons by collecting other infons. S9: Each infon has a specific number of “bits” associated with it, and accounting for identities among its sub-infons, this number is identical to the number of bits of its sub-infons. (That is, bits must add correctly.) S10: For a collection C of infons an infon k can be formed which has as its members all of the members of C (provided that S9 is not violated.) Comments and Examples 1. By S10 we can list individual infons to create a new infon, but O3 also suggests that we can list a group of infons by specifying their “parent” infon. { <a>==5; <b>==6; <c>==7;} S11: A collection of infons C can be specified by a list of members and/or by referring to a “parent” infon P and asserting that all the members of P are in the collection C. In Quanta we use the familiar notation of enclosing items in curly braces. If we mark an item with a “#” symbol it means that we include not the item itself, but all of its sub-infons (in accordance with S11). There are two syntaxes for CollectionInfons. The first uses semicolons (;) as terminating symbols while the second uses commas (,) as separating symbols. The choice of syntax has no semantic affect, and is a matter of preference. Generally, the semicolon syntax looks better for long statements: And the comma syntax looks better for short lists: { red, green, blue} 2. As an example of identity statement 1, in <A>=={red, green, blue} <A> contains three elements, which are the strings ‘red’, ‘green’, and ‘blue’. Likewise, in: Observation O7 suggests that many collections C of infons have identity relations such that the sub-infons of C form sequences of infons, and that language constructs for specifying relations among infons and their sub-infons can be usefully enhanced by adding semantics for asserting a partial order among the sub-infons. In Quanta we specify that a collection (or block) is a sequence by prepending a “$” to it, as in ${Eenie, Menie, Minie, Moe}. Now we look at the block grouping construct. <B>=={red, green, {a, b, c}, blue} <B> contains four elements, which are the strings ‘red’, ‘green’, and ‘blue’, and the collection {a, b, c}. However, in: <C>=={red, green, #{a, b, c}, blue} <C> contains six elements, which are the strings ‘red’, ‘green’, ‘a’, ‘b’, ‘c’, and ‘blue’. 3. As defined in identity statement 2, while <A>=={<X>==red; <Y>==green; <Z>==blue;} implies that <A> is identical to the three elements such that <A.X>==red, <A.Y>==green, and <A.Z>==blue, and no other infons exist that are not identical to one of these three. However, in: <A>=={<X>==red; <Y>==green; <Z>==blue; …;} while <A.X>==red, and so on, the “…” implies that there may be other infons as well such that the inference that <A> is identical to the three items cannot be made. 9 4. Identity statement 3 implies that <S>==${red, green, blue} is a sequence where <S$.first>==red, etc. Further: ${red, green, ${a, b, c}, blue} == ${red, green, a, b, c, blue} Q13: Ordered References to Parts of Sequences Syntax No new syntax is required, this applies to all definitions of sequences. Namely, CollectionInfons, ForInfons, and strings. Identities implied 2.2.14 Automatic References and Inter-Sequential Relations 1. While a sequence is simply an ordered collection, there are many uses for them when attempting to model complex information structures. For example, a string of characters can be a sequence. The characters in a string need not have any sub-structure, but they usually do. What would be useful is to be able to name the relevant sub-sequences and elements in a string in a useful way, then to map those names together as appropriate. We can easily provide Quanta names for the parts of a string by using sequences in a way analogous to regular expressions. Thus, for example, one section of the string might consist of a decimal number which is to be used as the length of another section to come later. Or perhaps a section of a string contains elements to be mapped into a spreadsheet (e.g., a string mapped to a spreadsheet file.) Names of arrays, lists, trees, and so on can be declared and mapped into the string. Quanta takes advantage of the fact that the basic elements of a regular expression are sequence, repetition, and disjunction (or conditional) to map Quanta blocks, Quanta for-loop style structures, and Quanta conditionals to reproduce the functionality of regular expressions. (The for structures and conditionals will be defined later.) Many times, mapping a sequence to itself through regular expression defined names is insufficient. It is usually the case that sequences map to other variables, and even other sequences. In addition to mapping strings or other sequences to themselves, another use for mapping the elements in a sequence is mapping the sequence of values that a system goes through as it evolves through time. For example, an integer in memory evolves through a sequence of values. It is especially true that such “temporal” sequences often map, not to themselves, but to each other and to constant values. If we can successfully notate the relations among all the sequences (temporal or not) and constants we will be able to represent any information structure. As with regular expressions, the Quanta block, for-structures, and conditionals provide the necessary logic. To obtain all these features we do not need to add any extra semantics to these constructs. The general method is to use one sequence P, which contains the sequences to be mapped C1, C2, … Cn, such that the order of P gives order to successive additional statements about the Cx’s. In other words, P contains regular expressions for each Cx, but the segments of the regular expressions are interspersed so that they can refer to each others parts. The formal description with examples will clarify this. However, because of the nature of the representation the notation is analogous to Von Neumann-style “block, loop, conditional” architecture, and is thus quite intuitive. Still, it is important to remember that we are not specifying an algorithm, but a collection of names and associated identity statements which we can use as a model of an information structure. The model could be used to assert “an entity like this exists”, but as easily it could be used to create or query such entities. 2. If the definition of a sequence S contains references to S’s subinfons which are also sequences T, named <T>, the following rules apply. a. References to T which are the entire left side of an IdentityInfon or a PartialIDInfon are labeled L-values. All other references to T are labeled R-values. b. If <T> is an R-value, it refers to the item in the sequence T that was last referred to as an L-Value. c. If <T$> is an R-value, it refers to the entire sequence T. d. If <T> is an L-value, it refers to the item in the sequence T that is the .next field of the element in T last referred to as an L-Value. e. If <T$> is an L-value, it refers to a sub-sequence whose first member is the .next field of the element in T last referred to as an L-Value, and which has the same size as the sequence on the right side of the an IdentityInfon or PartialIDInfon. f. The sequence S is defined to contain all of any such membersequences so that the last reference to a member-sequence marks the end of the member-sequence. As mentioned in Q12, a CollectionInfon or ForInfon which contains the type of construct just described is automatically a sequence even if the “$” mark is left off. Comments and Examples 1. In the following example, the entire sequence <FunSequence> is initialized at once. { <strings> $: <FunSequence$> == {Eenie, Meenie, Minie, Moe}; } 2. This example defines the same sequence in parts. { <strings> $: <FunSequence> == Eenie; <FunSequence> == Menie; <FunSequence$> == {Minie, Moe}; } 3. Here, values from several sequences are mapped in various ways. The connection with traditional assignment is apparent. { <ints> $: <Bobs_Age>==1; <Bobs_Age>==<Bobs_Age>+1; <ints> $: <Sams_Age>==<Bobs_Age> } After several more constructs are developed, extended examples of regular expression style mapping and multiple-sequence structures are given. 10 2.2.15 Strings and Sequences Identities implied Strings in Quanta are sequences. Thus, for example, given: 1. a forInfon contains in instance of its infon for each permutation of the variables in its header. If those infons contain varInfons, then each variInfon is replaced with the value of the variable whose token it matches. 2. In addition to the identities in the forInfon’s infon field, any identities that hold among the elements of the variable ranges hold among the new infons. 3. If a forInfon is marked by a “$”, then that forInfon is a sequence. The order of the sequence is determined by which tokens in the variable list are also marked by “$”. Going across the variable list from left to right, each permutation of the “$” marked variables produces a sub-sequence in the forInfon. Successive variables are nested in their predecessor’s sub-sequence. <PersonsName> == “Ralph”; the following are true: <PersonsName$.size>==5; <PersonsName$.first>==R; <PersonsName$.[1,3]>==alp; Quanta has a special syntax for generating strings as sequences. Q14: Strings as Sequences Syntax String (extended syntax) $ StringInfon StringInfon can contain Quanta names or Quanta code enclosed in percent signs (%). Comments and Examples 1. This example produces 5 integer infons, all with the value 10: Identities implied 1. If the embedded code can be transformed into a string or has an <asString> member the string will be inserted as a substring into the original string. 2. Embedded code can produce new strings that also have embedded code which will be evaluated. Thus, entire protocols can be produced with just a string and names that expand it. Comments and Examples 1. $“The sum of 5 and 3 is % 5+3 %.” 2. { <FirstName>==Bruce; <LastName>==Long; <FullName>==$”%<FirstName>% %<LastName>%”; <Greeting>== $”Hello %<FullName>%. Welcome!”; for x:1..5 :: 10; Note: the “1..5” is an IntRange infon. 2. The following infon has an infinity of members and is part of a definition of mathematical groups and therefore of numbers: for x:<numbers>, y:<numbers> :: <sum.[%x,%y]>==<sum.[%y,%x]> 3. Here we define a “square” function: for x:<numbers> :: <square.%x> == %x * %x 4. Here we set <A> to be a sequence that ranges, in order, over a two dimensional array where the x dimension of the array contains <x_size> elements, and the y dimension contains 5 elements: <A> == $for $x : 0..(<x_size>-1), $y : 0..4 :: <MyData.[%x, %y]> Here, <A$.first> would be identical to <MyData.[0,0]> } 2.2.16 For Infons and Variables In addition to references and the collection/membership/identity constructs, the “for/variable” construct is one of the primary infon constructors. It is analogous to the universal quantifier from logic, as well as to the for loop from traditional programming languages. Given one or more infons to use as the range for variables, the for construct declares an infon for each permutation of the variables’ members. All of those infons together make up the forInfon. The forInfon can also be made into a sequence by using ranges for variables that are sequences. Q15: For Infons and Variables Syntax VarDef [$] token : infon ForInfon [$] for VarDef {, VarDef} :: Infon Applies the variables defined in VarDefs to the Infon which may contain VarInfons. Each variable ranges over all the members of the infon associated with it. for x:<numbers>, y:<numbers> :: <sum.[%x,%y]>==<sum.[%y,%x]> VarInfon % token 2.2.17 Data Queries A query for information in Quanta is simply an infon that is normalized and its resultant form is fetched for viewing or processing. A simple example is: 5+3 A more complex query will rely on the existence of a model: <OurCompany.Schedule.<dates.[“May 12, 2004”]>> Or <CDrive.Mydocs.SprdSheet1.cells.[E,32]> Given an appropriate model, queries could be made to fetch any type of information from sources such as P2P networks, web or grid services, databases, etc. To fetch an entire dataset, a predefined collection (infon) can be requested or a “for structure” can be created to join and process data. As we shall show, algorithms can be specified so that data can be further processed in a query. However, Quanta is not merely a model-and-query language. Complex programs such as applications or 3D games could be described and instantiated. 11 2.2.18 Boolean Queries In many queries, and in particular in the condition part of a Conditional infon, a Boolean value is needed that tells whether a particular situation obtains. For example, one may want to query whether the Evening Star is identical to the Morning Star: <OurSystem.EveningStar>==<OurSystem.MorningStar>. One could merely submit the query and if the resulting reference to an infon was null, it would mean the system thus described did not exist and thus it was false. However, it is often preferable to have results in a true/false form. To represent such a query in Quanta, simply append a question mark (“?”) to the end of any infon descriptor. Q17: Conditional Infons Syntax ConditionalInfon [$] If BoolInfon, infon [ else infon ] Identities implied 1. If BoolInfon is true, this is identical to the first infon. If it is false, if there is an else clause, it is identical to the infon in the else clause. Otherwise, see rule 2. 2. If neither the first or second infons can be applied, then if the if clause is marked by a “$” the result is an empty sequence ${}. Otherwise the result is {}. If the dollar sign is present, both infons should evaluate to sequences. <OurSystem.EveningStar>==<OurSystem.MorningStar>?. The construct could be placed in an if-else infon or used in any other query. Notice that the shift from retrieving information and verifying that the retrieval was successful to a retrieving of either true of false causes a loss of information. Suppose that a quantity <n> is unknown. The query: 5+3 will normalize to “8”, but the query 5+<n> is already in normal form because the engine cannot normalize it further. Thus, we can tell from the result that the query was not completed because <n> could not be found. When we shift to a pure true/false model, such information is lost. 2.2.20 The All Matching Infon As with ZF set theory, a method of selecting infons that match a certain description is needed [Devlin, 1993]. Classes of objects can be made by defining “the collection of all infons where X obtains” then declaring an infon to be a member of that class. Q18: All Matching Infons Syntax MatchInfon @ Infon Identities implied Q16: Boolean Query Infons 1. Syntax Comments and Examples BooleanQryInfon Infon ? 1. Identities implied 1. The normal form of a BooleanQryInfon is a BoolInfon. If the result is “true”, then infon exists as it is described. If the result is “false” the infon does not exist as described. Comments and Examples 1. The fact that many BooleanQryInfons result in true and many in false is a good example of why identity cannot be inferred from equality. If it could, then “2+2?”, which evaluates to true would mean the same as “<NuclearReactions>:<sun>?”, which would imply that the question “what is 2+2?” has the same content as “is the sun a nuclear reaction?” This is an example of why state-based representations (vs. bit-based representations) struggle to represent the meaning of content. 2.2.19 Conditionals The logical meaning of conditionals used here is only indirectly related to the truth-functional, disjunctive meaning from the predicate calculus [Jeffrey]. Logically, the boolInfon is used as an index into an array of classes, and the chosen class is asserted. In practice, the engine can merely evaluate the condition then consult the correct block infon. The syntax should seem familiar. Contains all and only those infons of which infon is a description. The following defines <RedThings> as a class that contains all and only infon with a color field that is Red. Next a particular apple is asserted to be in that class. { <RedThings> = @{<colors>:<color>==Red}; <RedThings>:<MyApple>; } 2.2.21 Referencing Infons If a name for an infon appears by itself it is ambiguous whether it is being defined or used. Consider the infon: {<MyInfon>} This could be interpreted as a definition for <MyInfon> as a member of the main object, or it could be a reference to a name already defined elsewhere. In Quanta, it is the latter. In order to specify that <MyInfon> is a sub-name in an object (as in the former case), simply use it in an identity statement: { <MyInfon>=={…} }. If an identity statement is not given, the implied meaning is that the infon being named can be substituted for this name. In the following example, <Top> == { <MyInfon>==Hello; <OurInfon>=={<MyInfon>}; } if we were to look up the value of <Top.OurInfon> it would be {Hello}. 12 2.2.22 Assertions from Classes Similar to set theory, the mechanism for generalizing in Quanta is to define an infon that contains all and only the infons that have the property to be generalized over, then declare that the item to be described is a member of that infon. This method is used for all generalization whether generalizing static types such as ints or structs, generalizing sequences of actions into a function, describing classes of objects, or even templates over classes or “templates of templates” and so on. In most cases, a class such as <ints>, for example, which is defined as a class that contains all 32 bit integers, is used by asserting that it contains a particular infon. For example, to declare an integer called <ShoeSize>, use the form: <ints> : <ShoeSize> This notation can be combined with an assertion of identity: <ints> : <ShowSize> == 12 In some cases, however, an anonymous variable is needed. For such a case, the name can be left out entirely: zero-based arrays. Such literal arrays have been used several times already to provide parameter lists for Quanta names. For example, in the name: <sum.[5,3]> the “[5,3]” is a literal array. The advantage of using arrays to pass parameters is that a non-literal array can be passed in to represent very large or equation-defined lists of parameters. For example, an infinite series could be summed by using a for structure that ranged over the integers to specify an infinite array of terms to add. An array is simply an infon whose members have numeric indices. Q20: Literal Arrays Syntax ArrayInfon [ [Infon] {, Infon} ] Identities implied 1. <ints> : As we will see shortly, this notation is used to call functions that cause any object to change state. For example: <print.[“Hello World!”]>: Comments and Examples 1. This is equivalent to print(“Hello World!”): 2.2.23 Set Theoretic Constructions In addition to the union operation provided by CollectionInfons, it is useful to have Difference, Intersection, and Complement constructors. Q19: Set Theoretic Constructions Syntax DifferenceInfon difference ( Infon , Infon ) IntersectionInfon intersection Infon ComplementInfon ( complement | not ) Infon Identities implied 1. A DifferenceInfon contains all and only those members of the left infon that are not in the right infon. 2. An IntersectionInfon contains all and only those infons that are members of every member of Infon. 3. A ComplementInfon contains all and only those infons that are not members of Infon 2.2.24 Arrays While sequences provide a partial order, and even a full order if one considers that numeric indices can usually be used to map into a sequence, it is useful to have a simple method of creating simple, The following defines a simple array [red, green, blue] Or with an alternate syntax: Here, <print.[“Hello World!”]> is a collection of all occasions where “Hello World” is printed in a particular context. (Obviously, this collection cannot be completely dereferenced.) The added colon means something like “One of these occurrences goes here.” Until this makes sense, the intuition that such a construct is a function call will suffice. Each infon in the list is assigned a numeric name starting from zero. There are no sub-sequences allowed in the notation. In fact, for efficient processing, arrays are not sequences. {<0>==red; <1>==green;, <2>==blue}. So, for example, if <A>==[red, green, blue]; then <A.0>==red. 2.2.25 Commands: Affecting the World Thus far we have used identities to model, query for information, and to query for Boolean “true or false” information. Lastly, we look at using identities to do the reverse of querying, commanding. Just as the actions of other computers and physical systems can be modeled as an information structure, the actions of the engine running the query can also be modeled as information structures. So given a description of an information structure, perhaps in Quanta, it makes sense to assert “make this description true” even though such an assertion does not immediately seem like an assertion. Because there is no major type distinction between these two kinds of information structure, the engine can use the same algorithm of substituting identicals to process such “queries.” We add a new infon type to Quanta called a command infon. It is merely an infon marked with a “!”. Q21: Command Infons Syntax CommandInfon Infon ! Precedence for ‘!” is lower than for all other infons. Identities implied 1. This type of infon is identical to the event it describes, and therefore it is identical to all infons that would describe the same event. This is why when such an infon is normalized, the event “happens.” (The actual working of this identity is simple and intuitive, but the linguistic expression of it seems strange. The examples below will clarify.) Comments and Examples 13 1. The following example is of simple assignment: <A>==5! Suppose an infon exists that maps the above infon to a “set” function: for x:<ints>:: (<A>==%x!) == <Set.[A.%x>]>; Then the infon <A>==5! will be transformed into the form of a call to the set function. Such functions may be autonames that modify memory, call an operating system, or perhaps call a C function. Or, perhaps they are not autonames, but they call autonames. 2. The following example might be read “allocate a const integer named <A>: assert concatenation, repeated structures, conditional structures, and nested structures. To describe the contents, the sections of the sequence described by the syntax specification can be named and mapped to literal values, other items in the sequence, functions, etc. They can also be declared to be a member of a class in order to limit their values to some sub-set of the values allowed for their type. Such a mapping can be used to both when reading and when writing sequences. The example that follows illustrates using Quanta collections to assert concatenation, and Quanta for-infons to assert repetition. We define a sequence where the first item is an integer named Length and the successive items are chars numbered from 0 to Length. ${ <ints>:<Length>, #$for $i: $0..<Length> :: <char>:<%i> <ints> : <A> ! } While the following means allocate a non-const integer: <ints> $: <A> ! The next example means allocate a sequence of integers: <ints> $: <A$> ! The precise mechanism for such allocations is implementation dependent; however, complex allocations should perhaps be built out of identity assertions rather than hard coded. This will allow the engine to decide the optimal execution. 3. Commands made from collections, for-infons, and the other infons will also be handled by substituting identities or by autonames. 4. When named classes are used to make an assertion is in described in 2.2.22, such classes which contain commands can be thought of as function calls with side-effects. Programmers need not describe all the identities such a “function call” makes. For example, a function that writes a line of text to a consol might look like: <writeln.[“Hello World”]>: Or in the alternate syntax, writeln(“Hello World”): 5. Classes called as specified in 2.2.22 which do not have commands in them can, nevertheless, alter the state of the world if they are called as commands by appending a “!”. For example, a class that describes a number begin incremented can be commanded: increment (<A>):! 3 TECHNIQUES FOR USING QUANTA We now move from a theoretical mode to a practical one where we look at how common programming tasks can be implemented in Quanta. 3.1 Describing Functions without Side Effects To describe a function that does not change the state of any system, merely use a for-infon to define names that range over all the values the function can take as its inputs. While functions of any complexity can be defined, we illustrate using a simple example. Here is a function definition that takes an integer parameter and normalizes to its value plus one. for x:<ints> :: <oneMore. %x> == %x +1; Next, we use the” Match –All” infon (@) to create a class of all items like those just described, and we name it <charArrays>. <charArrays> == @ // <charArrays> is the infon of all infons where: ${ <ints>:<Length>, #$for $i: $0..<Length> :: <char>:<%i> } Now let us use the sequence class we just defined to describe a new sequence. Our new sequence will contain an identifying header that is the string “HEAD”, then it will contain a single character, and lastly, if the character was “A” then the following item is a <charArray> otherwise nothing. We will name our sequence <Seq>. <Seq$> == ${ <strings>:<Header> == “HEAD”; <char>:<condition>; #$if (<condition> == “A” )? <charArray>; } Let us now provide more detail be asserting <Seq$> == ${HEAD, A, 5, #${a,b,c,d,e}} In the sequence we just described, the following is true: { <Seq.Header> == <Seq.0> == <Seq.first> == “HEAD”; <Seq.condition> == <Seq.1> == <Seq.first.next> == A; <Seq.3> == b; }? The sequence construction tools in these examples can be used to describe any describable sequence. By creating multiple sequences, naming their parts, and mapping the names to each other, multiple sequences can be interrelated. However, in cases where the parts of sequences are not known in advance, because perhaps the sequences contain conditionals or items of varying length, such mappings can be awkward. The constructs described in Q13 make this task easier. We examine these next. 3.3 Describing Algorithmic Structures The memory cells of a computer, as well as any physical system that changes state over time can be seen as sequences ordered through time. When a number of such systems interact through time, the system comprised of all of them can be described by documenting the interrelations among their respective sequences. Recall that the notation described in Q13 implies that the two following sequence notations are equivalent: <chars> $: <Seq$> == ${A, B, C, D} 3.2 Describing Sequences for Serializing and Parsing Describing a sequence involve describing part or all of its syntax and part or all of its contents. To describe syntax we need to be able to and 14 ${ <chars>$:<Seq> == A; <Seq> == B; <Seq> == C; <Seq> == D; } However, in the latter notation, sequences can be interspersed. For example, the two sequences: <chars> $: <Start> == ${A, B, C,} and <chars> $: <End> == ${ X, Y, Z} can be combined using the notation: ${ <chars>$:<Start> == A; <chars>$:<End> == X; <Start> == B; <End> == Y; <Start> == C; <End> == Z; } 3.4 Mapping to the Outside World Suppose an object exists on another machine, or perhaps in the nonvirtual world, and we which to read and alter the state of that system. Realistic examples are an online database, a robot body, or a remote computer. All of these examples are merely complex state systems, and control of them comes in the form of operations that alter the state in a predictable way, or read the state in some way. We will consider the simple case of reading and altering a byte of memory. First, we declare that the byte exists. We will name it <B>: <byte> $: <B>; This asserts that a sequence ($:) of bytes exists, and names it <B>. If we wanted to assert that <B> was a constant, we could have asserted: <byte> : <B>; We can assert that our sequence starts (as of the time of the assertion) with a particular value: <byte> $: <B> == 5; This does not make <B> == 5, rather, it informs the engine of the fact. The assertion could potentially be wrong. We can assert that the next (second) value is one more than the previous: This interspersing of elements allows us to describe interrelated sequences in way that resembles the traditional von Neumann method for specifying algorithms. In the following example, note how blocks, with local sequences (variables) can be nested, and how for-structures and conditional infons nest and operate in the expected way given the identities they imply as specified in part 2. { <strings>:<CourseIDs> == {math, english, science, history}; #$for $Course : <CourseIDs> :: { <ints> $: <RunningTotal> == 0; #$for $Student : <Courses.%Course.Students> :: { #$if (<Courses.%Course.%Student.Status> == completed)? <RunningTotal> == <RunningTotal> + <Courses.%Course.%Student.Score> } <Courses.%Course.TotalScores> == <RunningTotal>; } } This use of syntax seems even more familiar when commands are used in the “algorithms”: ${ // print a simple multiplication table #$for $x:$0..10 :: { #$for $y:$0..10 :: write(%x * %y, “ “):; writeln():; } } While the above item certainly appears to be an algorithm, it is better characterized as a description of an information structure. This is because the engine is free to manipulate the system by substituting identicals. Thus, for example, a particular structure may be distributed over a large computing grid, or the items may be done in a different, but equivalent, order. Furthermore, the above is an assertion of fact; it could be made into a query (“?”) or what would normally be expected, a command (“!”). <B> == <B>+1; Again, this merely alerts the engine to a fact. If we wish to tell the engine to make the next infon in the sequence be a certain value, we use the command marker (“!”): <B> == 10!; But how does the engine know how to read or write such values? The notation <B>==10! means roughly, “create a new infon, which is the next item in the sequence <B$> and make it identical to 10.” Thus, this infon can be mapped as well as any other. We posit a function (perhaps an autoname) called WebSvc that calls a web service. #for x:0..255 :: { (<B> == %x!) ==<WebSvc.[ChangeValue,<IpAddr>, …, %x]>; <B> == <WebSvc.[ReadValue, <IpAddr>, …]>; } The first line in the for infon maps changes to <B> to a web service, while the second line maps reads of <B> to the service. This example illustrates mapping a simple assignment to an external object. The engine could do a lot with such a map by iterating over many such calls. However, by mapping more complex Quanta structures such as for infons or collections, entire datasets can be manipulated at once. Furthermore, such maps need not call functions, but could create a small compilation unit which, when combined with others could be linked into a binary that executes complex tasks, and the executed. Similarly, actions can be mapped to other machines, and more than one mapping can be defined so that a cleverly designed engine can choose the optimal ones. Thus, a task can be defined apart from any machine that may run it, and the engine can choose the optimal execution method whether that is function calls, compilation on the local machine, or farming out all the sub-parts to a Grid. In this way, Quanta programs can be made machine independent, and yet be made to take advantage of special hardware so that the potential exists for the creation of faster-than-C execution. If a particular system cannot be altered, the engineer coding in Quanta should not provide a map for it. Thus, for example, a function which will send an email to Aristotle should not be written, as its assertions would be false (unless the engineer also invents a time machine!) If an engine is capable of allocating memory to create objects as commanded by: 15 <ints> $: <B>! the engine must also provide an implicit or explicit mapping to be used to read and change its value. 3.5 Describing Functions with Side Effects 3.7 Other Techniques There are a number of techniques that are not fully developed here. For example, it would be useful to represent intensional contexts such as beliefs, desires, intentions, etc. It would also be useful to be able to represent systems with continuous state transitions such as qubits. A function that modifies a system can be written by creating an algorithm that calls functions that are mapped to external systems. Suppose we wish to have <B> as defined in the previous section take on a series of values: $for $v: 1..10 :: <B>==%v!; If we wish to generalize this action we must create the class of all such actions and declare a member of that class to exist at the right time. // <CountB> is the action. <CountB> == @ $for $v: 1..10 :: <B>==%v!; // We now call that action two times: <CountB>:; <CountB>:; Suppose we wish to add a parameter to the function so that the sequence need not end at 10. for maxVal : 1..255 :: <CountB.%maxVal> == @ $for $v: 1..%maxVal :: <B>==%v!; Functions where the internal algorithm is not modeled can also be created by mapping them to autonames. This technique could be used to create functions such as “print” or “beep” without having to specify their information structure. 3.6 Describing, Creating, and Manipulating Objects An object traditionally has the properties of polymorphism, encapsulation, and inheritance. Inheritance relations can be defined using the set theoretic operations. Polymorphism can be achieved by carefully defining the types and constraints used to define names of sub-infons for objects. Lastly, encapsulation can be achieved by writing functions that modify the object and making those function sub-infons of the object. By asserting that every items in the sequences of member variables is identical to one of the “member functions”, it will be a contradiction to directly modify a variable. We create a class of objects called <SimpleObjs> which contain two integers, one of which has an “increment” member function. <SimpleObjs> == @ { <ints> $: <NumOfPets>; <ints> $: <age>; <incAge> == @((<age>==<age>+1) ! ); } We create, initialize, and manipulate a <SimpleObjs>: { <SimpleObjs> : MySO == {<NumOfPets>==2; <age>==35;}; <MySO.incAge>:; print (<MySO.age>); } 16 4 BIBLIOGRAPHY Allen, James, and George Ferguson. DAML-Time Homepage. Oct. 2002. Dept. of Computer Science, University of Rochester. <http://www.cs.rochester.edu/~ferguson/daml/>. Armstrong, M A. Groups and Symmetry. New York: SpringerVerlag, 1988. Barrett, William A., et al. Compiler Construction: Theory and Practice. Vol. 2. Chicago: Science Research Associates, Inc., 1986. Boolos, George S. and Jeffrey, Richard. Computability and Logic. New York: Cambridge UP, 1974. Brickley, Dan, et al. W3C Semantic Web. 10 Oct. 2002. W3C. <http://www.w3.org/2001/sw/>. Ramsamujh, Taje. Equational Logic and Abstract Algebra. Mar. 2001. Dept. of Mathematics, Florida International University. <http://www.spcollege.edu/central/maa/ proceedings/2001/ramsamujh.pdf>. Read, Stephen. Thinking about Logic. Oxford: Oxford UP, 1995. Shannon, Claude E., and Warren Weaver. The Mathematical Theory of Information. Chicago: University of Illinois P, 1963. Stonier, Tom. Information and the Internal Structure of the Universe. London: Springer-Verlag, 1990. Stroustrup, Bjarne. The C++ Programming Language. 3rd ed. N.p.: Addison-Wesley, 1999. Deutsch, David. "Quantum theory, the Church-Turing principle and the universal quantum computer." Proceedings of the Royal Society of London A 400 (1985): 97-117. Devlin, Keith. Logic and Information. New York: Cambridge UP, 1991. Devlin, Keith. The Joy of Sets: Fundamentals of Contemporary Set Theory. 2nd ed. New York: Springer-Verlag New York, Inc, 1993. Dretske, Fred. Knowledge and the Flow of Information. Cambridge: MIT P, 1981. Foster, Ian, et al. Physiology of the Grid: An Open Grid Services Architecture for Distributed Systems Integration (Draft version). 17 Feb. 2002. The Globus Project. <http://www.globus.org/research/papers/ogsa.pdf>. Ghezzi, Carlo, and Mehdi Jazayeri. Programming Language Concepts. New York: John Wiley and Sons, 1982. Guarino, Nicola, and Christopher Welty. "Identity, Unity, and Individuality: Towards a Formal Toolkit for Ontological Analysis." Proceedings of ECAI-2000: The European Conference on Artificial Intelligence. (2000). Jeffrey, Richard. Formal Logic: Its Scope and Limits. 3rd ed. New York: McGraw-Hill, Inc., 1991. Lamport, Leslie. "Time, Clocks, and the Ordering of Events in a Distributed System." Communications of the ACM 21 (1978): 558-565. Lissila, Ora, and Ralph Swick. Resource Description Framework (RDF) Model and Syntax Specification. Feb. 1999. World Wide Web Consortium. <http://www.w3.org/TR/REC-rdf-syntax/#model>. Long, Bruce. “The Structure of Information.” http://perun.hscs.wmin.ac.uk/pages/bruce/ (2003). Malitz, J. Introduction to Mathematical Logic. New York: Springer-Verlag, 1979. Murata, T. Petri Nets: Properties, Analysis and Applications Proceedings of the IEEE, Vol. 77, No 4, April, 1989, pp. 541-580. Oqbuji, Uche, and Roxane Ouellet. DAML Reference. May 2002. <http://www.xml.com/pub/a/2002/05/01/damlref.html>. OWL Web Ontology Language 1.0 Reference. Ed. Dan Connolly, et al. 29 July 2002. W3C. <http://www.w3.org/TR/owl-ref/>. 17
6cs.PL
Classification of entities via their descriptive sentences Chao Zhao arXiv:1711.10317v1 [cs.AI] 28 Nov 2017 Harbin Institute of Technology [email protected] Min Zhao Baidu Inc. [email protected] Abstract Hypernym identification of open-domain entities is crucial for taxonomy construction as well as many higher-level applications. Current methods suffer from either low precision or low recall. To decrease the difficulty of this problem, we adopt a classification-based method. We pre-define a concept taxonomy and classify an entity to one of its leaf concept, based on the name and description information of the entity. A convolutional neural network classifier and a K-means clustering module are adopted for classification. We applied this system to 2.1 million Baidu Baike entities, and 1.1 million of them were successfully identified with a precision of 99.36%. 1 Introduction Entity classification aims to determine the type (e.g., person, location) of a certain entity. It is important for several natural language processing (NLP) tasks, such as question answering, textual entailment, machine reading, and text summarization. It is also a crucial resource to introduce the conceptlevel features to enhance the generalization power of machine learning systems (Paulheim and Fümkranz, 2012). There are two main methods for entity classification: named entity recognition and classification (NERC) and entity hypernym extraction. The former assumes that the type of an entity can be determined from its context. The classification tags utilized in NER systems are often coarse and do not involve all types of entities. Fine-grained NER faced with the difficulty of creating sufficient training data. The latter method can obtain extremely fine-grained categories of one entity, but it has to rely on an ontology to further obtain more general concepts. It also requires the cooccurrence of the entity and its hypernym in one sentence, which can make the recall lower. If there is no hypernym word in the context of the entity, and the context does not contain much information to determine the classification, these two methods could not work well, and we have to rely on external knowledge sources. In this paper, we propose another method for entity classification. Rather than inferring the type of an entity from the context, we classify it according to its descriptive sentences. A descriptive sentence is used to describe certain attributes of an entity, and is a natural source for humans to recognize Yi Guan Harbin Institute of Technology [email protected] the type of the unknown entity. For example, from the sentence “The logo of Baidu is a bear paw.”, we have no idea what Baidu is through the context information. But from a description of Baidu: Baidu, incorporated on 18 January 2000, is a Chinese web services company We can easily conclude that Baidu is a C OMPANY. Motivated by this idea, we propose a classification-based method for entity classification. We first pre-define a hierarchical concept taxonomy, and then try to classify an entity to a leaf of this taxonomy, based on its description and name information. Our contributions are three-fold: • We propose a simple classification-based method for entity classification, based on the description and name of the entity. • We introduce a clustering module to alleviate the data noise and imbalance problem during training, as well as to select the highly confident predicted entities from the prediction set to improve the precision. • We utilize this architecture on 2.1 million open-domain entities to verify its efficiency. Approximately 1.1 million entities are successfully identified, with a precision of 99.36%. 2 Methods This section presents the dataset and the method used for entity classification. 2.1 Dataset and task The entities and their corresponding descriptions utilized are from Baidu Baike. It contains nearly 15 million Chinese pages until now, which is much larger than that of Wikipedia (nearly 1 million). 12.4 million entities out of 15 have been linked to the Baidu Concept Base, a concept taxonomy, by the features from keywords, tags, or key-value tables, with a precision of 98%. We call them as known entities. Another 2.6 million unknown entities had not been linked because of the lack of or low quality of these features. The original model is therefore helpless for these entities, yet we want to identify their hypernyms according to their descriptions. Linking entities to existing concept base can be naturally regarded as a classification task. We first manually select a mini concept taxonomy from the Baidu concept base, and regard the leaf nodes as classification labels. This operation decreases the number of classes to make the classification easier. As shown in left part of Table 1, the mini-taxonomy contains 48 classes. These concepts are selected because they are necessary and fine-grained enough to support subsequent applications. They cover more than 98.6% of the known entities in Baidu Baike. 2.2 Pipeline The workflow of our method is shown in Figure 1, which contains three main modules: pre-processing, model training, and post-processing. Figure 1: The workflow of the identification system. Pre-processing is introduced to select entities that contain descriptions. Kazama and Torisawa (2007) directly regard the first sentence of an entity page as its description. However, we estimate from a sampled data of Baidu Baike and find that only approximately 84% of entity pages hold such assumption. To increase this percentage, we only regard the first sentence of an entity page as its description when it meets at least one of two requirements: • The first sentence begins with the entity name (the title of entity page); or • The head of the first sentence in its dependency tree is a verb phrase; The unsatisfied entity pages are directly filtered. After filtering, the precision of the descriptions is increased to 97%. Nearly 9.7 million and 2.1 million entities are reserved from known and unknown entity sets, respectively, which constitute our training and prediction set. The training set has two problems that need to be addressed. First, since the precision of current entity-hypernym relationships is approximately 98%, the other 2% should be regarded as the noise, which would lead to performance decline for a non-specially designed model (Zhu and Wu, 2004). Second, since different concepts (classes) correspond to different numbers of entities (see Table 1), the training set is imbalanced, which would cause poor performance in minority classes. Instances in minority classes would also suffer from higher noise. We adopt a standard convolutional neural network (CNN) classifier (Kim, 2014) for text classification. To solve the noise and imbalance problem, we first train the CNN model using small-sized balanced data. Based on the trained model, we obtain the vector representation of all training and predict entities. Then, we use a clustering-based re-sampling method to select the highly confident entities from the total training data, to obtain another large-sized training set. In this set, the noise and imbalance problems are alleviated. We re-train the CNN classifier accordingly and obtain the final classification model, which is used to predict the hypernyms of unknown entities. To increase the precision of the prediction, we introduce a post-processing module to select the highly confident predicted entities. The details of the CNN classifier, the clustering and re-sampling module, and the post-processing module are described below. 2.3 CNN classifier As shown in Figure 2, the CNN classifier has two input channels: the character-level name information and the wordlevel descriptive sentences, which relies on a word segmenter. We add special <start> and <end> symbols to both sides of the entity name, to help the CNN model capture the prefix and suffix features. The name information is removed from the description, to avoid feature redundancy. If the name is surrounded by the title mark (), a special Chinese punctuation to indicate the titles of books, films, and more, it would be moved along with the title to the name channel. Figure 2: The architecture of the CNN classifier. The input of the name channel is “Google Inc.”, while that of the description channel is “established in April, 1998 by Larry...”. The embedding of words has dimensionality of 200, which are pre-trained from Baidu Baike articles using the skip-gram model (Mikolov et al., 2013). The characterlevel and word-level embedding tables are shared, because the single character word is common in Chinese. Since the skip-gram model has a threshold to ignore less frequent words, these words do not have pre-trained embedding and would be assigned to random embedding. A common way to enhance the word embedding is to concatenate their corresponding part-of-speech (POS) and syntax embedding (Wang and Chang, 2016; Chen and Manning, 2014). These features are reported to be beneficial to the hypernym identification. We therefore concatenate them to the word embeddings (shown in Figure 2 with different colors). The POS tagger, dependency parser, and the earlier segmenter are supported by the Baidu NLP Cloud service. Followed by a convolutional layer, a max-pooling layer, and two dense layers, we obtain the probability distribution of the input entity over the 48 classes. 2.4 Clustering and re-sampling We first sample a relatively small number of entities randomly from each class and train a CNN model based on this small balanced set. The output of the pooling layer is a concatenated vector, and can be regarded as the representation of the entity. We expect that the entities in the same class would be close in the representation space. In other words, when we run a clustering algorithm over these entities, the cluster partition should be similar with the inherent classifications. If the percentage of a class in one cluster is tiny (e.g., less than p%), we would suspect the entities in this class as noise and remove them. This would cause false filtering, but it would be better to remove several correctly labeled entities, rather than keep the falsely labeled ones. In this way, part of noise can be discarded. The imbalanced problem is still alleviated with the undersampling strategy. Balanced training data is fair for minority classes, while imbalanced data is better for the majority. To compromise, the size of sampled data in each class is still correlated with that of entire training data, but the proportion is smoothed by the logarithmic function. We first set a reference sample size N . For one class c, we denote the number of entities in c by Pc before noise filtering, and Qc after filtering, where Pc ≥ Qc . There are three conditions (All the entities below refer to those belonging to class c): 1. If Pc > N and Qc ≥ N , we would completely sample N̂c = N × (1 + log10 ( QNc )) entities from c; Figure 3: Resampling from the clusters. The ellipses represent the clusters and the color refers to the class. The noise is first removed from the original data. The class-level sampling fails to sample data from the center cluster, while the cluster-level sampling avoids this situation. The sampling process is simulated via the random.sample() method in Python. achieve. We must select the highly confident predicted entities from the entire prediction set. Similar to the methods to detect noise data, this process also relies on the clustering results. In most cases, one cluster has both known and unknown entities. As shown in Figure 4, we can easily obtain the class distribution of known entities. The motivation of the confidence evaluation is intuitive: If most of the known entities are labeled as F, and a test entity in the same cluster is also labeled as F by the classifier, then we have high confidence that this entity is correctly labeled. We grade the predict confidence of an unknown entity as four levels, according to the percentage of this class in the known entities: L1 (>99%), L2 (99%-50%), L3 (50%-5%), and L4 (<5%). If there are only test entities in a cluster, we simply label the confidence of a test entity as L5 if there are more than 50% entities labeled as the same class with it, or L6 otherwise. 2. If Pc > N but Qc < N , we rank the clusters in descending order by the number of filtered entities in c, and recall these filtered entities in order to make Qc exactly larger or equal to N . It then becomes the first condition; 3. If Pc < N , we directly take all the entities (filtered and remained) to the sampled data. The final problem is the sampling method. It relies on the clustering results we obtained. Instances in the large-sized class would be partitioned into many small clusters. If we under-sample in the class-level, we have the risk of not sampling entities from small-sized clusters, and may lead to the wrong classification for the predict entities in the same cluster. We therefore sampled from the cluster level in a proportional way, which can better guarantee that the sampled subset can cover all clusters. An example is shown in Figure 3, which compares the results of sampling from the class or cluster level. 2.5 Post-processing To add predicted data into current taxonomy, we have to guarantee the precision benchmark of 95%, which is hard to Figure 4: The confidence evaluation according to the class distribution of known entities. The unknown entities are represent with , while other symbols represent the classes of known entities. Symbol in the  is the prediction result of the unknown entity. 3 3.1 Experiment The first classifier To train the first classifier with the small balanced dataset, we randomly sampled 1,000 entities from each class, and split the training/validation set with ratio of 0.7/0.3 (the numbers of entities are 33,600/14,400). Since parameter tuning was the only purpose, there was no separate test set. The structure and parameter were set as follows, according to the performance of the validation set: The convolutional layer used filters with the window size as 1, 2, 3, 4, and each size contained 60 feature maps for every channel. The dimension of the pooling layer, therefore, was 480, and that of the hidden layer was 200. Two dropout layers with rates of 0.5, as well as an L2 -norm constraint for dense-layer parameters were utilized for regularization. Rectified linear units (ReLUs) were adopted as the activation function of the convolutional layer and the first dense layer. The softmax cross entropy was used as the loss function. The optimizer adopted the Adam algorithm Kingma and Ba (2014) with a learning rate of 0.001 and a mini-batch size of 500. The performance of the trained classifier on each class of the validation set is shown in Table 1. All macro P , R, and F1 measures are 0.88. We evaluated the influence of POS and syntax features on the final performance. The introduction of POS features increased the macro-F1 from 87.95% to 88.36%. However, the continued concatenation of dependency tagging features decreased the measure to 88.06%. Similar results were reported by Sang and Hofmann (2009). It may be caused by the relatively low precision of the Chinese dependency parser. Therefore, we only concatenated the POS tagging features to the word embedding. We also tried to change CNN to long short-term memory networks (LSTMs), to combine the word and character sequences as representation vectors. We found that, neither replacing CNN with LSTM on the name channel nor description channel can cause a large slump of macro-F1 measure by more than 10%. A possible reason is that the LSTMs without the attention mechanism focus more on the last part of the sentence, where the information for hypernym identification may not exist. 3.2 Clustering With the help of the classifier, we obtained the vector representation of all entities, with the dimensionality of 480. We run the K-means algorithm to partition these entities, and K is arbitrarily set as 10,000. The statistical quantities of these clusters are shown in Figure 5. Figure 5 a) shows that the number of clusters which possess more than 1,000 entities is roughly equal to that of clusters with less than 1,000 entities. Figure 5 b) and c) indicate that approximately one half of the clusters are almost pure, in which more than 99% of the entities belong to the same class. We further analyzed the clusters of different classes. For each class, we select the clusters where this class has the most number of entities, and draw the boxplot of these numbers. The results are shown in Figure 6. The large-sized classes are more likely to be partitioned into large clusters. This indicates that despite the large numbers, the descriptions of these entities in the same class are not arbitrary. They instead have high similarity, and therefore the classification-based method is reasonable. Figure 5: a) and b) show the distribution of size and information entropy of clusters, and c) shows the distribution of the percentage of the largest class in one cluster. All of the left y-axes represent the number of clusters, and right y-axes represent the corresponding cumulative distribution. Figure 6: The boxplot described above. We also draw the number of entities in the known set, as well as the second training set for comparison. These refer to the right logscaled axis. 3.3 The second classifier We re-sampled training entities from these clusters using the strategy described in Section 2.4. Compared with the previous training set, the size of this re-sampled set enlarged from 33,600 to 154,479 (see Table 1). It can better represent the entire training set. Based on this set, we re-trained the second classifier from scratch, and then applied it to predict the hypernym of unknown entities. The post-processing module then partitioned these entities into six confidence levels. The precision of the predicted results was evaluated manually, by sampling a small subset. For simplicity, we refer to a confidence level of one class as a group. We randomly selected at least 40 entities from each group and labeled the predicted hypernyms as right or wrong. More than 10,000 entities are evaluated in total. In particular, entities being classified as “Other” would be linked to the higher-level concepts. For example, if a film is classified as V IDEOW ORKS -OTHER, we would regard it as a V IDEO WORK and therefore labeled this prediction as correct. The precision of each class c in the entire predict set was estimated by two ways: 1. Estimation at the class level: we sampled m entities from class c for manual evaluation in all, and r of them were right identified. The precision was calculated by p1 = r/m; 2. Estimation at the group level: we denote by n the size of class c. Its i-th confidence level Li has ni entities with precision of P pi , which was estimated by the first way. Then p2 = ( i pi · ni )/n Since the evaluation subset was not uniformly sampled, we regarded P2 as the primary estimation of the class-level precision. The size of some groups was less than 100, which would make small contributions to the expansion of our taxonomy. Therefore, we did not evaluate them. We tried to correct the wrongly labeled entities while evaluating but found it difficult and time-consuming in practice. Therefore, the recall of the results could not be evaluated. Fortunately, we were more concerned about the precision, and the absence of recall was acceptable. 4 4.1 Results and discussion Results Table 1 shows the details of the precision of each group. Generally speaking, the precision declines from level 1 to level 4. Level 1 has a perfect performance, because they are selected from the almost pure clusters. The number of entities belonging to this level, as a result, is not very much, except several classes like E NTERPRISE, P ERSON and P OETRY. Instances of other concrete classes concentrated mainly on level 2 and level 3. There are still 49.7% of the classes in level 2 with a precision of more than 94%, and this percentage decreases to 8.7% in level 3. The special “Other” classes, which contain the remaining concepts not listed in the taxonomy, center on the fourth level with a relatively lower precision. It is because these “Other” classes contain more messy concepts, and are unlikely to be clustered into the relatively pure groups. Instances in the fifth and sixth levels come from the clusters consisting of only predict entities, and there are two situations. If it is an accidental consequence caused by the Kmeans algorithm, the precision of this cluster would be affected by its nearest clusters. If it is caused because no similar entities existing in the known set, the precision would be low. Finally, we choose the groups in which the precision is more than 94%, and add these entities to our existed taxonomy. 1.1 million out of 2.1 million are selected in this way, and the percentage is approximately 55%. According to the second precision estimation method, our selected subset has the precision of 99.36%. 4.2 discussion The first sentence of an instance page from the web encyclopedia is an ideal source for the entity categorization task. The page editor would write the first sentence more clearly. In many cases, it is a standard definition sentence. On the other hand, when the editors try to write a new article, they may refer to the existing pages of the same kind of instances, leading to the similar form of sentences among these instances. Since the precision of the knowledge base is more important, we designed the post-processing module to divide the predicted results into different confidence levels, and evaluate each level separately. In essence, it is a strategy to assign confidence to predicted instances according to the support number of similar training instances. The largest contribution to the high precision comes from the E NTERPRISE type, in which the names of entities have obvious suffix features (e.g., Inc.) and therefore a simple classifier can obtain satisfactory results. However, even we do not consider these entities, the precision of prediction set before and after the post-processing is 80.72% and 98.76%, respectively, which can still show the effectiveness of confidence-based filtering to the high precision. The prerequisite of the classification strategy is the predefined taxonomy, which makes the categorization process more controllable compared with the hypernym extraction methods, but also restricts the granularity of the hypernym concept. How fine-grained should an identified category be depends on the subsequent tasks. Consider Phenobarbital as an example. For a medical ontology which is used for clinical support, it should be described as a hypnotics/anticonvulsants or in more detail. In other applications, like the intension detection of medical QA web, it is enough for the system to know it is a medicine, and therefore the coarse-grained categorization is acceptable. 4.3 Limitations Despite the application background, it would be better to find a taxonomy that can compromise the granularity of the hypernym and the classification precision. In the clusters, we find that several clusters in the same class correspond to different sub-classes. The P ERSON class, for example, is partitioned as ACTOR, S INGER, W RITER, and more, which shows the potentiality of the classifier for finer-grained classification. Another limitation is the selection of descriptive sentences. Instead of regarding the first sentence of the Baidu Baike pages as the description, it is better to train a discriminator to select high-quality descriptions from web text. In this way, the entity set would not be restrained to those involved in Baidu Baike. We utilized a simple CNN text classifier and flattened the hierarchical structure of the taxonomy during classification. More elaborate operations should further improve the performance. 5 5.1 Related works Hypernym extraction Hypernym extraction is utilized to find the hypernym of a certain entity from the sentences where the hypernym and the entity occur together. For example, from the sentence “... such authors as Herrick and Shakespeare.” we can derive that “Herrick” and “Shakespeare” are authors. Such methods are mainly based on the lexical or syntactic patterns. They were designed manually at the beginning by Hearst and Hearst (1992), and then were mined automatically using machine learning techniques (Snow, Jurafsky, and Ng, 2004; Ritter, Soderland, and Etzioni, 2009; Kozareva and Hovy, 2010). These methods require the co-occurrence of hypernym-hyponym pairs in one sentence, and often suffer from relatively lower precision or recall (Seitner et al., 2016), because of the arbitrariness of the natural language. validation set predict set level 1 P R F #num P1 P2 #num P level 2 #num P 1. Film 0.81 0.95 0.88 8568 0.72 0.79 571 5764 0.94 883 0.32 1347 0.4 2. TV play 0.89 0.9 0.9 3425 0.89 0.87 2086 0.94 835 0.9 504 0.5 3. TV program 0.88 0.99 0.93 5404 0.61 0.73 363 0.52 4053 0.77 985 0.62 3 4. Other 0.59 0.54 0.56 6831 0.77 0.77 0.77 8 5. songs 0.91 0.93 0.92 10271 0.86 0.97 3072 6. albums 0.86 0.94 0.9 1575 7. Other 0.79 0.72 0.76 27436 0.62 0.56 8. novels 1 Taxonomy Works Video works Music works Literature works 9. poetry 10. Other Publications 1 603 0.65 218 0.33 940 1 471 0.52 163 0.45 5807 0.97 594 0.48 98 0.91 0.97 0.94 8660 0.88 0.94 3531 1 3693 0.94 913 0.71 519 0.76 0.68 0.72 30141 0.61 0.60 0.88 0.85 0.87 6266 0.9 0.95 0.93 12670 0.74 0.63 203 13. Opera 0.9 0.79 0.84 6362 14. Other 0.86 0.68 0.76 15957 0.39 0.33 level 5 #num P 0.73 0.70 5 1 0.68 0.55 level 6 #num P 3 1 27423 0.56 5 1 8 5 1 21455 0.65 8686 0.49 4 2741 1 1401 0.61 2116 0.38 3 6274 0.87 4892 0.35 1294 0.5 7 1418 1 0.52 3825 0.39 1115 14760 0.3 898 0.94 0.94 0.94 12562 0.78 0.72 1200 1 5214 16. Book 0.78 0.89 0.83 34347 0.62 0.77 6718 1 17. Periodical 0.94 0.98 0.96 2264 0.81 0.89 6 18. Other 0.93 0.81 0.86 2827 0.71 0.71 1 4991 4 0.77 299 0.32 1156 0.9 21072 0.77 4956 0.45 881 0.92 119 1609 0.65 418 0.83 1 0.94 230 1 601 0.71 1 63179 0.78 8751 0.55 1964 0.65 11 80 20. Enterprise 0.98 0.93 0.96 678962 0.68 0.99 624168 1 6043 0.94 2268 0.65 9993 0.94 35830 0.88 660 21. School 0.95 0.98 0.97 6397 1 2116 1 1221 0.55 769 0.88 16 22. Scenic spot 0.83 0.95 0.89 15836 0.96 0.91 192 1 2951 1 10418 0.87 2271 1 4 23. Website 0.92 0.94 0.93 22456 0.62 0.66 16 12792 0.84 4743 0.45 4898 0.39 7 24. Restaurant 0.91 0.94 0.93 13521 0.97 0.96 3047 1 7409 0.97 3065 0.89 25. Other 0.83 0.69 0.75 79195 0.69 0.96 26. Weapon 0.9 0.96 0.93 8435 0.85 0.76 56 2334 0.9 2920 0.61 3113 0.82 12 27. Automobile 0.92 0.94 0.93 5949 0.79 0.69 1294 0.94 2772 0.71 1878 0.5 5 28. Other 0.82 0.86 0.84 94750 0.85 0.85 0.8 0.90 2275 30. celestial body 0.99 0.98 0.98 6799 2826 77129 0.97 1855 0.97 9821 0.68 8768 0.52 1 0.98 0.99 3322 1 1048 0.94 775 1 31. Administrative region 0.97 0.92 0.95 13447 0.69 0.96 8975 1 3131 1 0.71 538 1 1 0.45 211 94700 0.85 6733 632 94760 0.94 0.92 1654 0.5 138 94653 0.92 78 1 0.86 0.96 0.91 18658 0.95 0.89 341 1 10685 0.94 5146 0.97 2479 0.5 7 34. Botany 0.88 0.89 0.88 22962 0.82 0.75 204 1 10939 0.9 7987 0.65 3818 0.5 14 35. Other 0.91 0.8 0.85 6723 0.94 29 2 36. Food 0.91 0.89 0.9 12063 0.83 0.80 1515 1 6908 0.9 1975 0.65 1662 0.4 3 37. Drug 0.92 0.87 0.89 23576 0.7 0.60 585 1 11459 0.84 8150 0.29 3377 0.5 5 38. Chemical substance 0.8 0.9 0.84 21296 0.97 0.97 39. Human disease 0.93 0.9 0.92 10844 0.61 0.51 20 4544 0.74 3984 40. Plant disease 0.97 0.99 0.98 659 0.81 0.79 1 519 1 41. Warfare 0.97 0.96 0.96 2198 0.47 0.49 930 0.71 430 0.26 838 0.36 42. Awards 0.98 0.98 0.98 2654 0.73 0.82 1728 0.97 714 0.55 208 0.48 43. Last name 0.96 0.92 0.94 2281 0.83 0.78 585 0.87 678 0.81 1018 0.71 44. Financial term 0.88 0.96 0.92 8157 0.99 0.96 857 1 0.97 1909 0.94 45. Other 0.74 0.64 0.69 328667 0.59 0.65 Term 46. Vocabulary 0.83 0.86 0.85 99821 0.9 0.92 7813 47. Chinese character 0.94 0.95 0.94 4386 48. Other 0.62 0.58 0.60 1 0.99 40 5379 0.97 15306 0.97 7 0.39 2292 4 0.26 99 4 12 121277 0.91 187041 0.49 20092 0.64 257 1 59575 0.99 23002 0.81 9396 4336 1 5 0.36 33 33. Animal 5983 0.84 10 1 6721 0.6 50 32. Other 0.94 0.94 0.4 1 0.86 0.95 0.9 289215 0.76 0.94 215230 1 0.84 0.85 0.84 25332 0.72 0.70 Organism 6378 0.82 0.93 2302 29. Brand Area 1 8806 12. Computer software 19. Person Organizations 1 level 4 #num P 6823 0.73 0.80 11. Animation works 15. Game Goods 1 1 level 3 #num P 0.71 0.38 35 45 Table 1: The statistical quantities and evaluation results of each class. From left to right, this table shows 1) the pre-defined concept taxonomy; 2) the P, R, and F measure of the first classifier on the validation set; 3) the number of entities predicted by the second classifier, as well the two estimated precision; and 4) the numbers and precision information of each group. The red shadow is a visualization of some important evaluation measures, while the green shadow indicates the percentage of the predicted entities in each confidence level. 5.2 Named entity recognition and classification NERC was first introduced at the Sixth Message Understanding Conference (MUC-6) Grishman and Sundheim (1996). Early tasks focused most on three kinds of entity types: person, location, and organization. The classes were further fine-grained in subsequent works. For example, Fleischman and Hovy (2002) classified the person into sub-classes like politics and artist. In the field of biomedical informatics, researchers would focus more on the identification of specific terms, like proteins and DNAs (Leaman, Gonzalez, and Others, 2008). Nadeau (2007) presented a hierarchical structure for named entities, and the number of entity types is approximately 200. Ling and Weld (2012) defined 112 fine-grained tags and labeled the training data with the help of anchor links from Wikipedia text, then utilizing the perceptron as the classifier to determine the type of entities. The dominant supervised methods for NERC extract features from tokens themselves and their contexts, and no exterior knowledge source is involved. 6 Conclusion Kingma, D., and Ba, J. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980. Kozareva, Z., and Hovy, E. 2010. A semi-supervised method to learn and construct taxonomies using the web. In Proceedings of the 2010 conference on empirical methods in natural language processing, 1110–1118. Association for Computational Linguistics. Leaman, R.; Gonzalez, G.; and Others. 2008. BANNER: an executable survey of advances in biomedical named entity recognition. In Pacific symposium on biocomputing, volume 13, 652–663. Big Island, Hawaii. Ling, X., and Weld, D. S. 2012. Fine-Grained Entity Recognition. In AAAI. Mikolov, T.; Chen, K.; Corrado, G.; and Dean, J. 2013. Efficient estimation of word representations in vector space. Computer Science. Nadeau, D. 2007. Semi-supervised named entity recognition: learning to recognize 100 entity types with little supervision. Ph.D. Dissertation, University of Ottawa. This work offers a classification-based method for entity categorization. Based on the name and description information of an entity, we can classify it to one of the types via a CNN classifier. A clustering module is designed for noise filtering, training set sampling, and confidence evaluation for predicted results. We applied this method to 2.1 million opendomain entities, and 1.1 million are successfully classified with a precision of 99.36%, demonstrating the efficiency of our method. In the future, we hope to develop a discriminator to find the entity descriptions in broader knowledge sources, and to identify the type of an entity from multiple descriptions. Paulheim, H., and Fümkranz, J. 2012. Unsupervised generation of data mining features from linked open data. In Proceedings of the 2nd international conference on web intelligence, mining and semantics, 31. ACM. References Seitner, J.; Bizer, C.; Eckert, K.; Faralli, S.; Meusel, R.; Paulheim, H.; and Ponzetto, S. P. 2016. A large database of hypernymy relations extracted from the web. In LREC. Chen, D., and Manning, C. 2014. A fast and accurate dependency parser using neural networks. In Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP), 740–750. Fleischman, M., and Hovy, E. 2002. Fine grained classification of named entities. In Proceedings of the 19th international conference on Computational linguistics-Volume 1, 1–7. Association for Computational Linguistics. Grishman, R., and Sundheim, B. 1996. Message Understanding Conference-6: A Brief History. In COLING, volume 96, 466–471. Hearst, M. a., and Hearst, M. a. 1992. Automatic Acquisition of Hyponyms ftom Large Text Corpora. Proceedings of the 14th conference on Computational Linguistics 2:23–28. Kazama, J., and Torisawa, K. 2007. Exploiting Wikipedia as External Knowledge for Named Entity Recognition. Proceedings of the 2007 Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning (March):698–707. Kim, Y. 2014. Convolutional neural networks for sentence classification. arXiv preprint arXiv:1408.5882. Ritter, A.; Soderland, S.; and Etzioni, O. 2009. What is this, anyway: Automatic hypernym discovery. In AAAI Spring Symposium: Learning by Reading and Learning to Read, 88–93. Sang, E. T. K., and Hofmann, K. 2009. Lexical patterns or dependency patterns: which is better for hypernym extraction? International Conference On Computational Linguistics 8. Snow, R.; Jurafsky, D.; and Ng, A. Y. 2004. Learning syntactic patterns for automatic hypernym discovery. Advances in Neural Information Processing Systems 17 17:1297– 1304. Wang, W., and Chang, B. 2016. Graph-based dependency parsing with bidirectional lstm. In ACL (1). Zhu, X., and Wu, X. 2004. Class noise vs. attribute noise: A quantitative study. Artificial Intelligence Review 22(3):177–210.
2cs.AI
Beating CountSketch for Heavy Hitters in Insertion Streams arXiv:1511.00661v1 [cs.DS] 2 Nov 2015 Vladimir Braverman∗ Stephen R. Chestnut David P. Woodruff † Nikita Ivkin ‡ November 3, 2015 Abstract Given a stream p1 , . . . , pm of items from a universe U, which, without loss of generality we identify with the set of integers {1, 2, . . . , n}, we consider the problem of √ returning all ℓ2 -heavy hitters, i.e., those items j for which f ≥ ε F , where fj is the j 2 P number of occurrences of item j in the stream, and F2 = i∈[n] fi2 . Such a guarantee is considerably stronger than the ℓ1 -guarantee, which finds those j for which fj ≥ εm. In 2002, Charikar, Chen, and Farach-Colton suggested the CountSketch data structure, which finds all such j using Θ(log2 n) bits of space (for constant ε > 0). The only known lower bound is Ω(log n) bits of space, which comes from the need to specify the identities of the items found. In this paper we show it is possible to achieve O(log n log log n) bits of space for this problem. Our techniques, based on Gaussian processes, lead to a number of other new results for data streams, including 1. The first algorithm for estimating F2 simultaneously at all points in a stream using only O(log n log log n) bits of space, improving a natural union bound and the algorithm of Huang, Tai, and Yi (2014). √ 2. A way to estimate the ℓ∞ norm of a stream up to additive error ε F2 with O(log nloglogn) bits of space, resolving Open Question 3 from the IITK 2006 list for insertion only streams. ∗ This material is based upon work supported in part by the National Science Foundation under Grant No. 1447639, by the Google Faculty Award and by DARPA grant N660001-1-2-4014. Its contents are solely the responsibility of the authors and do not represent the official view of DARPA or the Department of Defense. † This material is based upon work supported in part by the National Science Foundation under Grant No. 1447639 ‡ This material is based upon work supported in part by the National Science Foundation under Grant No. 1447639 and by DARPA grant N660001-1-2-4014. Its contents are solely the responsibility of the authors and do not represent the official view of DARPA or the Department of Defense. 1 Introduction There are numerous applications of data streams, for which the elements pi may be numbers, points, edges in a graph, and so on. Examples include internet search logs, network traffic, sensor networks, and scientific data streams (such as in astronomy, genomics, physical simulations, etc.). The sheer size of the dataset often imposes very stringent requirements on an algorithm’s resources. In many cases only a single pass over the data is feasible, such as in network applications, since if the data on a network is not physically stored somewhere, it may be impossible to make a second pass over it. There are multiple surveys and tutorials in the algorithms, database, and networking communities on the recent activity in this area; we refer the reader to [39, 6] for more details and motivations underlying this area. Finding heavy hitters, also known as the top-k, most popular items, elephants, or iceberg queries, is arguably one of the most fundamental problems in data streams. It has applications in flow identification at IP routers [18], iceberg queries [19], iceberg datacubes [8, 21], association rules, and frequent itemsets [2, 43, 47, 23, 22]. Formally, we are given a stream p1 , . . . , pm of items from a universe U , which, without loss of generality we identify with the set {1, 2, . . . , n}. We make the common assumption that log m = O(log n), though our results generalize naturally to any m and n. Let fi denote the frequency, that is, the number of occurrences, of item i. We would like to find those items i for which fi is large, i.e., the “heavy hitters”. In this paper we will consider algorithms that are allowed one pass over the stream and must use as little space (memory) in bits as possible, to maintain a succinct summary (“sketch”) so that after processing the stream, we can output the identities of all of the heavy hitters from the summary with large probability. There are various notions of what it means for fi to be large. One such notion is that we should return all indices i ∈ [n] for which fi ≥ ǫm for a parameter ǫ ∈ (0, 1), and no index i for which fi ≤ (ǫ − φ)m, for a parameter φ. It is typically assumed that φ ≥ cǫ for an absolute constant c > 0, and we will do so in this paper. This notion has been extensively studied, so much so, that the same streaming algorithm for it was re-invented multiple times. The first algorithm was given by Misra and Gries [37], who achieved O((log n)/ǫ) bits of space. The algorithm was rediscovered by Demaine et al. [17], and then later rediscovered by Karp et al. [30]. Cormode and Muthukrishan [15] state that “papers on frequent items are a frequent item!”. While these algorithms are deterministic, there are also several randomized algorithms, including the Count-Min sketch [16], sticky sampling [33], lossy counting [33], sample and hold [18], multi-stage bloom filters [11], sketch-guided sampling [31], and CountSketch [13]. A useful (slightly suboptimal) intuition is that one can sample O((log 1/ǫ)/ǫ) random stream positions, remember the identities of these positions, and then maintain the counts of these items. By coupon collector arguments, all heavy hitters will be found this way, and one can filter out the spurious ones (those with fi ≤ (ǫ − φ)m). 1 One of these techniques, CountSketch [13], refined in [46], gives a way of finding the ℓ2 -heavy hitters of a stream. Those are the items for which fi2 ≥ ε2 F2 . Notice that this guarantee is significantly stronger than the aforementioned guarantee that fi ≥ ǫm, which we will call the ℓ1 -guarantee. Indeed, if fi ≥ ǫm, then fi2 ≥ ǫ2 m2 ≥ ǫ2 F2 . So, an algorithm for finding the ℓ2 -heavy hitters will find all items satisfying the ℓ1 -guarantee. On the other √ hand, given a stream of n distinct items in which fi = n for an i ∈ [n], yet fj = 1 for all j 6= i, an algorithm satisfying the ℓ2 -heavy hitters guarantee will identify item i with √ constant ǫ, but an algorithm which only has the ℓ1 -guarantee would need to set ǫ = 1/ n, √ using Ω( n log n) bits of space. In fact, ℓ2 -heavy hitters are in some sense the best one can hope for with a small amount of space in a data stream, as it is known for p > 2 that finding those i for which fip ≥ εp Fp requires n1−2/p bits of space [7, 12]. The CountSketch has broad applications in compressed sensing [20, 42, 36] and numerical linear algebra [14, 35, 40, 10], and are often used as a subroutine in other data stream algorithms, such as ℓp -sampling [38, 4, 28], cascaded aggregates [27], and frequency moments [26, 9]. Given the strong guarantees and many applications of ℓ2 -heavy hitter algorithms, it is natural to ask what the best space complexity for them is. Both the original algorithm of [13] and the followup of [46] achieve Θ(log2 n) bits of space for constant values of ǫ. On the other hand, the only known lower bound is Ω(log n) bits, which is needed just to identify the heavy hitter. Despite the success we have had in obtaining space-optimal streaming algorithms for estimating moments and p-norms, this has remained a glaringly open problem. It is known that if one allows deletions in the stream, in addition to insertions, then Θ(log2 n) bits of space is optimal [5, 28]. However, in many cases we just have a stream of insertions, such as in the model studied in the seminal paper of Alon, Matias, and Szegedy [3]. 1.1 Our Contributions The main result of this paper is the near resolution of the open question above. We show: Theorem 1 (ℓ2 -Heavy Hitters). For any ǫ > 0, there is a 1-pass algorithm in the insertiononly model that, with probability at least 2/3, finds all those √ indices i ∈ [n] for which √ fi ≥ ǫ F2 , and reports no indices i ∈ [n] for which fi ≤ 2ǫ F2 . The space complexity is O( ǫ12 log 1ǫ log n log log n) bits. The intuition of the proof is as follows. Suppose there is a single ℓ2 -heavy hitter H, ε > 0 is a constant, and we are trying to find the identity of H. Suppose further we could identify a substream S ′ where H is very heavy, specifically we want that the frequencies in 2 P fH 2 the substream satisfy poly(log j∈S ′ ,j6=H fj . Suppose also that we could find certain n) ≥ R = O(log n) “breakpoints” in the stream corresponding to jumps in the value of fH , that is, we knew a sequence pq1 < pq2 < · · · < pqR which corresponds  to positions in the stream  for which fH increases by a multiplicative factor of 1 + 2 1 Θ(R) . Given all of these assumptions, in between breakpoints we could partition the universe randomly into two pieces and run an F2 -estimate [3] (AMS sketch) on each piece. Since P 2 fH is more than a poly(log n) factor times j∈S ′ ,j6=H fj2 , while in between each breakpoint  2  f the squared frequency of H is Ω logHn , it follows that H contributes a constant fraction of the F2 -value in between consecutive breakpoints, and so, upon choosing the constants appropriately, the larger of the magnitudes of the two AMS sketches will identify a bit of information about H, with probability say 90%. This is our algorithm Sieve. Since we have Θ(log n) breakpoints, in total we will learn all log n bits of information needed to identify H. One persepective on this algorithm is that it is a sequential implementation of the multiple repetitions of CountSketch, namely, we split the stream at the breakpoints and perform one “repetition” on each piece while discarding all but the single bit of information we learn about H in between breakpoints. However, it is not at all clear how to (1) identify S ′ and (2) find the breakpoints. For this, we resort to the theory of Gaussian and Bernoulli processes. Throughout the stream Pn (t) we can maintain a sum of the form Xt = i=1 fi Zi , where the Zi are independent Normal(0, 1) or Rademacher random variables. Either distribution is workable. One might think as one walks through √ a stream of length poly(n), there will be times for which this sum is much larger than F2 ; indeed, the latter is the standard deviation and a naı̈ve √ union bound, if tight, would imply positions in the stream for which |Xt | is as large as F2 log n. It turns out that this cannot happen! Using a generic chaining bound developed by Fernique and Talagrand [44], we can prove that there exists a universal constant C ′ such that p E sup |Xt | ≤ C ′ F2 . t We call this the Chaining Inequality. We now randomly partition the universe into O( ǫ12 ) “parts”, and run our algorithm independently on each part. This ensures that, for a large constant C, H is C-heavy, 2 ≥ C(F − f 2 ), where here we abuse notation and use F to denote the meaning, fH 2 2 H moment of the part containing H. We run the following two stage algorithm independently on each part. The first stage, called Amplifier, conists of L = O(log log n) independent and concurrent repetitions of the following: randomly split the set of items into two buckets and maintain a two Bernoulli processes, one for the updates in each bucket. By the Chaining Inequality, a Markov bound, and a union bound, the total F2 contribution, excluding that q 2 ). of H, in each piece in each repetition at all times in the stream will be O( F2 − fH Since H is sufficiently heavy, this means after some time t∗ , its piece will be larger in magnitude in most, say 90%, of the L repetitions. Furthermore, H will be among only n/2Ω(L) = n/poly log n items with this property. At this point we can restrict our attention to a substream containing only those items. The substream has the property that its F2 value, not counting H, will be a factor 1 times the F2 value of the original stream, making H Ω(log2 n)-heavy. Finally, to log2 n 3 find the breakpoints, our algorithm Timer maintains a Bernoulli  process on the substream, 1 and every time the Bernoulli sum increases by a multiplicative 1 + θ(R) factor, creates a new breakpoint. By the Chaining Inequality applied in each consecutive interval of breakpoints, the F2 of all items other than H in the interval is at most O(log n) larger than f2 its expectation; while the squared frequency of H on the interval is at least logHn . Since H 2 to be the dominant fraction of F on the interval. is Ω(log2 n)-heavy, this makes fH 2 One issue with the techniques above is they assume a large number of random bits can be stored. A standard way of derandomizing this, due to Indyk [25] and based on Nisan’s pseudorandom generator PRG [41], would increase the space complexity by a log n factor, which is exactly what we are trying to avoid. Besides, it is not clear we can even apply Indyk’s method since our algorithm decides at certain points in the stream to create new F2 -sketches based on the past, whereas Indyk’s derandomization relies on maintaining a certain type of linear sum in the stream, so that reordering of the stream does not change the output distribution. A first observation is that the only places we need more than limited independence are in maintaining a collection of O(log n) hash functions and the stochastic P process ni=1 fi Zi throughout the stream. The former can, in fact, be derandomized along the lines of Indyk’s method [25]. In order to reduce the randomness needed for the stochastic process we use a JohnsonLindenstrauss transformation to reduce the number of Rademacher (or Gaussian) random variables needed. The idea is to reduce the frequency vector to O(log n) dimensions with JL and run the Bernoulli process in this smaller dimensional space. The Bernoulli proPO(log n) cess becomes i=1 Zi (T f )i , where T is the JL matrix. The same technique is used by Meka for approximating the supremum of a Gaussian process [34]. It works because the Euclidean length of the frequency vector describes the variance and covariances of the process, hence the transformed process has roughly the same covariance structure as the original process. An alternative perspective on this approach is that we use the JL transformation in reverse, as a pseudorandom generator that expands O(log n) random bits into O(n) random variables which fool our algorithm using the Bernoulli process. In Section 5 we also use our techniques to prove the following. Theorem 2 (F2 at all points). For any ǫ > 0, there is a 1-pass algorithm in the insertiononly model that, with probability at least 2/3, outputs a (1 ± ǫ)-approximation of F2 at all points in the stream. The algorithm uses O( ǫ12 log n(log 1ǫ + log log n)) bits of space. Outline In Section 1.2, we give preliminaries and define our notation. In Section 2 we prove Theorem 1. The proof of the Chaining Inequality for Gaussian and Bernoulli processes, the central tool used in Section 2, appears in Section 3. In Section 4 we give details about how to implement the algorithm with a reduced number of random bits. In Section 5 we prove Theorem 2. 4 L δ H T m n k d amplifier size small constant heavy hitter id JL transformation stream length domain size JL dimension dim. of Bern. proc. O(log log n) Ω(1) ∈ [n] ∈ Rk×n poly(n) O(log n) O(log δ−1 ) τ S t1 :t2 ej (k) fH f (k1 :k2) R C′ C round expansion interval of the stream jth unit vector frequency on S 0:k frequency on S k1 :k2 # of Sieve rounds Chaining Ineq. const. large const. 100(R + 1) (pt1 +1 , . . . , pt2 ) f (k2 ) − f (k1 ) O(log n) O(1) 3 ≥ d 2 C ′ /δ Table 1: Notation and parameters used throughout the paper. 1.2 Preliminaries Given a stream S = (p1 , p2 , . . . , pm ), with pi ∈ [n] for all i, we define the frequency vector (t) at time 0 ≤ t ≤ m to be the vector f (t) with coordinates fj := #{t′ ≤ t | pt′ = j}. When t = m we simply write f := f (m) . Given two times t1 ≤ t2 we use f (t1 :t2 ) for the vector f (t2 ) − f (t1 ) . Notice that all of these vectors are nonnegative because S has P no deletions. 2 ≥ α 2 An item H ∈ [n] is said to be an α-heavy hitter, for α > 0, if fH j6=H fj . The goal of our main algorithm, CountSieve, is to identify a single α-heavy hitter for α a large constant. We will assume log m = O(log n), although our methods apply even when this is not true. It will be occasionally helpful to assume that n is sufficiently large. This is without loss of generality since in the case n = O(1) the problem can be solved exactly in O(log m) bits. A streaming algorithm is allowed to read one item at a time from the stream in the order given. The algorithm is also given access to a stream of random bits, it must pay to store any bits that it accesses more than once, and it is only required to be correct with constant probability strictly greater than 1/2. Note that by repeating such an algorithm k times and taking a majority vote, one can improve the success probability to 1 − 2−Ω(k) . We measure the storage used by the algorithm on the worst case stream, i.e. worst case item frequencies and order, with the worst case outcome of its random bits. The AMS sketch [3] is a linear for estimating F2 . The sketch contains O(ǫ−2 log δ−1 ) Psketch n independent sums of the form j=1 Sj fj , where S1 , S2 , . . . , Sn are four-wise independent Rademacher random variables. By averaging and taking medians it achieves a (1 ± ǫ)approximation to F2 with probability at least (1 − δ). A Gaussian process is a stochastic process (Xt )t∈T such that every finite subcollection (Xt )t∈T ′ , for T ′ ⊆ T , has a multivariate Gaussian distribution. When T is finite (as in this paper), every Gaussian process can be expressed as a linear transformation of a multivariate Gaussian vector with mean 0 and covariance I. Similarly, a Bernoulli process (Xt )t∈T , T finite, is a stochastic process defined as a linear tranformation of a vector of i.i.d. Rademacher (i.e. uniform ±1) random variables. Underpinning our results is an analysis of 5 P iid (t) the Gaussian process Xt = j∈[n] Zj fj , for t = 0, . . . , m, where Z1 , . . . , Zn ∼ N (0, 1) are independent standard Normal random variables. The Bernoulli analogue to our Gaussian iid process replaces the distribution of the random vector Z as Z1 , . . . , Zn ∼ Rademacher. Properties of the Normal distribution make it easier for us to analyze the Gaussian process rather than its Bernoulli cousin. On the other hand, we find Bernoulli processes more desirable for computational tasks. Existing tools, which we discuss further in Section 3 and Section 4, allow us to transfer the needed properties of a Gaussian process to its Bernoulli analogue. A k × n matrix T is a (1 ± γ)-embedding of a set of vectors X ⊆ Rn if (1 − γ)kx − yk2 ≤ kT x − T yk2 ≤ (1 + γ)kx − yk2 , for all x, y ∈ X ∪ {0}. We also call such a linear transformation a JL Transformation. It is well-known that taking the entries of the matrix T to be i.i.d. Normal random variables with mean 0 and variance 1/k produces a JL transformation with high probability. Many other randomized and deterministic constructions exist, we will use the recent construction of Kane, Meka, and Nelson [29]. The development and analysis of our algorithm relies on several parameters, some of which have already been introduced. Table 1 lists those along with the rest of the parameters and some other notation for reference. In particular, the values C, d, δ, and γ are constants that we will choose in order to satisfy several inequalities. We will choose δ and γ to be small, say 1/200, and d = O(log 1/δ). C and C ′ are sufficiently large constants, in particular C ≥ dC ′ /δ. 2 ℓ2 heavy hitters algorithm This section describes the algorithm CountSieve, which solves the heavy-hitter problem for the case of a single heavy hitter, i.e. top-1, in O(log n log log n) bits of space and proves Theorem 1. By definition, the number of ǫ-heavy hitters is at most 1 + 1/ǫ, so, upon hashing the universe into O(1/ǫ2 ) parts, the problem of finding all ǫ-heavy hitters reduces to finding a single heavy hitter in each part. When ǫ = Ω(1), using this reduction incurs only a constant factor increase in space over the single heavy hitter problem. Suppose the stream has only a single heavy hitter H ∈ [n]. Sequentially, over the course of reading the stream, CountSieve will hash the stream into two separate substreams for O(log n) repetitions, and in each repetition it will try to determine which of the two substreams has the heavy hitter using the AMS Sketch. With high probability, H has a unique sequence of hashes, so if we correctly identify the stream containing H every time then we can correctly identify H. This holds even if we only correctly identify the stream containing H a large constant fraction of the repetitions. CountSketch accomplishes this by performing the O(log n) rounds of hashing in parallel, with Ω(log2 n) bits of storage. One of our innovations is to implement this scheme sequentially by specifying intervals of 6 updates, which we call rounds, during each of which we run the two AMS Sketches. In total there could be as many as Θ(log2 n) of these rounds, but we will discard all except the last R = O(log n) of them. Algorithm 1 is a simplified version of the Bernoulli process used by CountSieve. It has all of the properties we need for correctness of the algorithm, but it requires too many random bits. Chief among these properties is the control on the supremum of the process. The Chaining Inequality gives us a uniform bound on the maximum value of the BP process Algorithm 1 One Bernoulli process. procedure BP(Stream S) iid Sample Z1 , . . . , Zn ∼ Rademacher return hZ, f (t) i at each time t end procedure in terms of the standard deviation of the last value. This property is formalized by the definition of a tame process. Definition 3. Let f (t) ∈ Rn , for t ∈ [m], and let T : Rn → Rk be a matrix. Let Z be a d × k matrix of i.i.d. Rademacher random variables. A d-dimensional Bernoulli process 1 yt = d− 2 ZT f (t) , for t ∈ [m], is tame if, with probability at least 1 − δ, v uX u n 2 fj , for all t ∈ [m]. (1) kyt k2 ≤ C t j=1 The definition anticipates our need for dimension reduction in order to reduce the number of random bits needed for the algorithm. Our first use for it is for BP, which is very simple with d = 1 and T the identity matrix. BP requires n random bits, which is too many for a practical streaming algorithm. JLBP, Algorithm 2, exists to fix this problem. Still, if one is willing to disregard the storage needed for the random bits, BP can be substituted everywhere for JLBP without affecting the correctness of our algorithms because our proofs only require that the processes are tame, and BP produces a tame process, as we will now show. We have a similar lemma for JLBP. Lemma 4 (BP Correctness). Let f (t) , for t ∈ [m], be the frequency vectors of an insertiononly stream. The sequence Zf (t) returned by the algorithm BP is a tame Bernoulli process. Proof. By the Chaining Theorem 15 below, there exists a constant C ′ such that P 2 Inequality, ′ 1/2 E supt |Xt | ≤ C ( j fj ) . Let F be the event that the condition (1) holds. Then for C ≥ C ′ /δ we have, by Markov’s Inequality,   sX fj2  ≥ (1 − δ). Pr(F ) = Pr sup |Xt | ≤ C t j 7 In order to reduce the number of random bits needed for the algorithms we first apply JL transformation T to the frequency vector. The intuition for this comes from the covariance structure of the Bernoulli process, which is what governs the behavior of the process and is fundamental for the Chaining Inequality. The variance of an increment of the Bernoulli process between times s and t > s is kf (s:t) k22 . The JL-property of the matrix T guarantees that this value is well approximated by kT f (s:t) k22 , which is the increment variance of the reduced-dimension process. Slepian’s Lemma (Lemma 16) is a fundamental tool in the theory of Gaussian processes that allows us to draw a comparison between the suprema of the processes by comparing the increment variances instead. Thus, P iid (t) for Z1 , . . . , Zn ∼ Rademacher, the expected supremum of the process Xt = ni=1 Zi fi is P closely approximated by that of Xt′ = ki=1 Zi (T f (t) )i , and the latter uses only k = O(log n) random bits. The following lemma formalizes this discussion, its proof is given in Section 4. Lemma 5 (JLBP Correctness). Suppose the matrix T used by JLBP is an (1±γ)-embedding of (f (t) )t∈[m] . For any d ≥ 1, the sequence √1d ZT f (t) returned by JLBP is a tame ddimensional Bernoulli process. Furthermore, there exists d′ = O(log δ−1 ) such that for any 1 d ≥ d′ and H ∈ [n] it holds that Pr( 21 ≤ kd− 2 ZT eH k ≤ 32 ) ≥ 1 − δ. Algorithm 2 A Bernoulli process with fewer random bits. procedure JLBP(Stream S) Let T be a JL Transformation ⊲ The same T will suffice for every instance iid Sample Z ∈ {−1, 1}d×k with coordinates Zi,j ∼ Rademacher return √1 ZT f (t) at each time t d end procedure Now that we have established the tameness of our Bernoulli processes, let us explain how we can exploit it. We typically exploit tameness in two ways, one works by splitting the stream according to the items and the second splits the stream temporally. Given a stream and a tame Bernoulli process on that stream, every substream defines another Bernoulli process, and the substream processes are tame as well. One way to use this is for heavy hitters. If there is a heavy-hitter H, then the substream consisting of all updates except those to the heavy-hitter produces a tame process whose maximum is bounded by 2 )1/2 , so the value of the process in BP is Z f ± C(F − f 2 )1/2 . When H is C(F2 − fH H H 2 H sufficiently heavy, this means that the absolute value of the output of BP tracks the value of fH , for example if H is a 4C 2 -heavy hitter then the absolute value of BP’s output is always a (1 ± 21 )-approximation to fH . Another way we exploit tameness is for approximating F2 at all points. We select a sequnece of times t1 < t2 < · · · < tj ∈ [m] and consider the prefixes of the stream that end at times t1 , t2 , . . . , etc. For each ti , the prefix stream 8 4-w Aℓ,1 , . . . , Aℓ,n ∼ Bernoulli 4-w Br,1 , . . . , Br,n ∼ Bernoulli iid Z1 , . . . , Zk ∼ Rademacher 4-w Rr,1 , . . . , Rr,n ∼ Rademacher Table 2: Random vectors for CountSieve. Each vector is independent of the others, and Z = (Zi )i∈[k] is sampled independently for every instance of JLBP. ending at time ti is tame with the upper bound depending on the stream’s F2 value at time ti . If the times ti are chosen in close enough succession this observation allows us to transform the uniform additive approximation guarantee into a uniform multiplicative approximation. 2.1 Description of CountSieve CountSieve primarily works in two stages that operate concurrently. Each stage uses independent pairs of Bernoulli processes to determine bits of the identity of the heavy hitter. The first stage is the Amplifier, which maintains L = O(log log n) independent pairs of Bernoulli processes. The second stage is the Timer and Sieve. It consists of a series of rounds where one pair of AMS sketches is maintained during each round. CountSieve and its subroutines are described formally in Algorithm 4. The random variables they use are listed in Table 2. Even though we reduce the number of random bits needed for each Bernoulli process to a managable O(log n) bits, the storage space for the random values is still an issue because the algorithm maintains O(log n) independent hash functions until the end of the stream. We explain how to overcome this barrier in Section 4 as well as show that the JL generator of [29] suffices. We can now state an algorithm that maintains a pair of Bernoulli processes and prove that the bits that it outputs favor the process in the pair with the heavy hitter. Algorithm 3 Split the vector f into two parts depending on A and run a Bernoulli process on each part. Return the identity of the larger estimate at each time. procedure Pair(Stream S, A1 , . . . An ∈ {0, 1}) For b ∈ {0, 1} let Sb be the restriction of S to {j ∈ [n] | Aj = b|} (t) (t) X0 =JLBP(S0 ) at each time t (t) (t) X1 =JLBP(S1 ) at each time t (t) bt = argmaxb∈{0,1} kXb k2 return b1 , b2 , . . . end procedure (t ) Lemma 6 (Pair Correctness). Let t0 ∈ [m] be an index such that (fH 0 )2 > 4C 2 9 P j6=H fj2 . p.w. Let A1 , . . . , An ∼ Bernoulli and b1 , b2 , . . . , bm be the sequence returned by Pair(f, A1 , . . . , An ). Then Pr(bt = AH for all t ≥ t0 ) ≥ 1 − 3δ and, for every j ∈ [n] \ {H} and t ≥ t0 , Pr(bt = Aj ) ≤ 1 + 3δ. 2 Furthermore, if each JLBP is replaced by an AMS sketch with size O(log n log δ−1 ) then, for all t ≥ t0 and j 6= H, P (bt = AH ) ≥ 1 − 2δ and P (bt = Aj ) ≤ 12 + 3δ. (t) (t) 1 1 Proof. Let X0 = d− 2 ZT f (t) and X1 = d− 2 W T f (t) be the two independent Bernoulli processes output by JLBP. Without loss of generality, suppose that AH = 1, let v = 1 (t) (t) d− 2 W T eH , and let Y (t) = X1 − fH v. By Lemma 5, with probability at least 1 − 2δ all three of the following hold P (t) 1. kX0 k22 ≤ C 2 j:Aj =0 fj2 , for all t, 2. kY (t) k22 ≤ C 2 3. kvk2 ≥ 1/2. P 2 j6=H fj , Aj =1 for all t, and If the three events above hold then, for all t ≥ t0 , 1 (t) (t) (t) (t) (t) kX1 k2 − kX0 k2 ≥ kvfH k2 − kY (t) k2 − kX0 k2 ≥ fH − C 2 sX fj2 > 0, j6=H which establishes the first claim. The second claim follows from the first using 1 Pr(bt = Aj ) = Pr(bt = Aj = AH )+Pr(bt = Aj 6= AH ) ≤ Pr(Aj = AH )+Pr(bt 6= AH ) = +3δ. 2 The third and fourth inequalities follow from the correctness of the AMS sketch [3]. 2.2 Amplifier correctness The L = O(log log n) instances of Pair maintained by Amplifier in the first stage of CountSieve serve to identify a substream containing roughly n2−L = n/polylogn elements in which H appears as a polylog(n)-heavy hitter. Correctness of Amplifier means that, after some “burn-in” period which we allow to include the first fH /2 updates to H, all of the subsequent updates to H appear in the amplified substream while the majority of other items do not. This is Lemma 7. 10 Algorithm 4 Algorithm for a single F2 heavy hitters. procedure CountSieve(Stream S = (p1 , p2 , . . . , pm )) Maintain at = (a1,t , a2,t , . . . , aL,t ) ←Amplifier(S) Let t1 < t2 < · · · = {t ∈ [n] | Aℓ,pt = aℓ,t for at least 0.9L values of ℓ} Let S0 = (pt1 , pt2 , . . . , ) q0 , q1 , . . . , qR ←Timer(S0 ) b1 , b2 , . . . , bR ←Sieve(S0 , q0 , . . . , qR ) return Selector(b1 , b2 , . . . , bR ) based on S0 end procedure procedure Amplifier(Stream S) ⊲ Find a substream where H is polylog(n)-heavy for ℓ = 1, 2, . . . , L do aℓ,1 , aℓ,2 , . . . , aℓ,m ←Pair(S, Aℓ,1 , . . . , Aℓ,n ) end for return a1,t , . . . , aL,t at each time t end procedure procedure Timer(Stream S)⊲ Break the substream into rounds so H is heavy in each q0′ = 0 Yt ←JLBP(S), for t = 1, 2, . . . , over S For each r ≥ 1, find qr′ = min{t | kYt k2 > (1 + τ1 )r } Let q0 , q1 , . . . , qR be the last R + 1 of q0′ , q1′ , . . . return q0 , q1 , . . . , qR end procedure procedure Sieve(Stream S, q0 , . . . , qR ) ⊲ Identify one bit of information from each round for r = 0, 1, . . . , R − 1 do bqr +1 , . . . , bqr+1 ←Pair(S (qr :qr+1) , Br,1 , . . . , Br,n ) ⊲ Replace JLBP here with AMS end for return bq1 , bq2 , . . . , bqR end procedure procedure Selector(b1, . . . , bR ) ⊲ Determine H from the round winners return Any j ∗ ∈ argmaxj #{r ∈ [R] : Br,j = br }. end procedure 11 P (t ) Lemma 7 (Amplifier Correctness). Let t0 ∈ [m] be such that (fH 0 )2 ≥ 4C 2 j6=H fj2 , and let at = (a1,t , . . . , aL,t ) denote the length L bit-vector output by the Amplifier at step t. Let Mj,t = #{ℓ ∈ [L] | aℓ,t = Aℓ,j } and W = {j ∈ [n] \ {H} | ∃t ≥ t0 , Mj,t ≥ 0.9L}. Then, with probability at least (1 − 2δ), both of the following hold: 1. for all t ≥ t0 simultaneously, MH,t ≥ 0.9L and P L P 2 2 2. j6=H fj . j∈W fj ≤ exp(− 25 ) Proof. Let N = #{ℓ | for all t ≥ t0 , aℓ,t = Aℓ,H }. If N ≥ 0.9L then 1 holds. Lemma 6 implies EN ≥ (1 − 3δ)L ≥ 0.97L, so Chernoff’s Bound easily implies P (N < 0.9L) = O(2−L ) ≤ δ, where δ is a constant. Now, let j 6= H be a member of W and suppose that MH,t ≥ 0.9L. Let t ≥ t0 be such that Mj,t ≥ 0.9L. Then it must be that Mj′ := #{ℓ ∈ [L] | Aℓ,j = Aℓ,H } ≥ 0.8L. However, EMj′ = 12 L by pairwise independence. Let Ej be the event {j ∈ W and MH,t ≥ 0.9L}. Since the L instances of Pair are independent, an application of Chernoff’s Inequal2L ity proves that Pr(Ej ) ≤ Pr(Mj′ ≥ 0.8L) ≤ exp{ −0.6 } ≤ e−L/20 . 6 We have X X X E( fj2 ) = E( 1Ej fj2 ) ≤ e−L/20 fj2 . j∈W j6=H j6=H Therefore Markov’s Inequality yields   X X Pr  fj2 ≥ e−L/25 fj2  ≤ e−L/100 ≤ δ. j∈W j6=H The lemma follows by a union bound. 2.3 Timer and Sieve correctness The timing of the rounds in the second stage of CountSieve is determined by Timer. Timer outputs a set of times q0 , q1 , . . . , qR that break the stream into intervals so that each interval has roughly a 1/ log n fraction of the occurrences of H and not too many other items. Precisely, we want that H is everywhere heavy for q, as stated in the following definition. When this holds, in every round the Pair is likely to identify one bit of H, and Sieve and Selector will be likely to correctly identify H from these bits. Definition 8. Given an item H ∈ [n] and a sequence of times q0 < q1 < · · · < qR in a stream with frequency vectors (f (t) )t∈[m] we say that H is everywhere heavy for q if, for all 1 ≤ r ≤ R, X (q :q ) (q :q ) (fH r−1 r )2 ≥ C 2 (fj r−1 r )2 . j6=H 12 Correctness for Timer means that enough rounds are completed and H is sufficiently heavy within each round, i.e., H is everywhere heavy for q. Lemma 9 (Timer Correctness). Let S be a stream with an item H ∈ [n] such that the following hold: 1. fH ≥ τ 4 , 2 ≥ 400C 2 2. fH (t∗ :m) 2 ) 3. (fH P j6=H fj2 , and 2 ≥ 25C 2 τ 2 = 14 fH (t) P (t∗ :m) 2 ) , j6=H (fj where t∗ = min{t ∈ [m] | fH ≥ 0.5fH } and C is the constant from Definition 3. If q0 , q1 , . . . , qR is the sequence output by Timer(S) then, with probability at least 1 − 4δ, H is everywhere heavy for q. Proof. We begin by proving that at least R rounds occur after t∗ , which shows that q0 , . . . , qR is well defined, and then we show that H is everywhere heavy. Let Yt be the se1 (t) quence output by JLBP and let Xt = Yt − d− 2 ZT eH fH . Yt and Xt are tame by Lemma 5 1 and Pr(0.5 ≤ α ≤ 1.5) ≥ 1 − δ where α = kd− 2 ZT eH k2 . Hereafter, we suppose that α ≥ 1/2 and the tameness property holds for Yt and Xt . With probability at least 1 − δ, simultaneously for all t ∈ [m], we have kXt k22 ≤ C 2 X j6=H fj2 ≤ 1 2 f . 400 H (t∗ ) (2) (m) 1 Therefore, kYt∗ k2 ≤ kXt∗ k2 + αfH ≤ ( α2 + 20 )fH and kYm k2 ≥ αfH − kXm k2 ≥ 1 (α − 20 )fH . This implies that the number of rounds completed after t∗ , which is log1+1/τ kYm k2 α − 1/20 ≥ log1+1/τ ≥ log1+1/τ (3/2), kYt∗ k2 α/2 + 1/20 (t∗ ) is at least R + 1 by our choice of τ = 100(R + 1). Similarly kYt∗ k2 ≥ αfH − kXt∗ k2 ≥ 1 ( α2 − 20 )fH . Therefore we also get qi > qi−1 because (1+ τ −1 )kYt∗ k2 ≥ 1 by our assumption that fH ≥ τ 4 . Hence q0 , . . . , qR are distinct times. Now we show that H is everywhere heavy for q. Let Wt = Xt − Xt∗ , for t ≥ t∗ . By design, Wt − Ws = Xt − Xs , for s, t ≥ t∗ . By Lemma 5, Wt is also a tame process on the suffix of the original stream that has its first item at time t∗ + 1. Specifically with probability at least 1 − δ, for all t ≥ t∗ , kWt k22 ≤ C 2 X (t∗ :m) 2 (fj j6=H 13 ) ≤ 1 f2 . 400τ 2 H This inequality, with two applications of the triangle inequality, implies (q αfH i−1 :qi ) ≥ kYqi − Yqi−1 k2 − kWqi − Wqi−1 k2 ≥ kYqi − Yqi−1 k2 − 2 fH . 20τ (3) To complete the proof we must bound kYqi − Yqi−1 k2 from below and then apply the heaviness, i.e., assumption 3. Equation (2) and the triangle inequality imply that, for every t ≥ t∗ , it holds that (t) 1 )fH . Recalling the definition of q0′ , q1′ , · · · from Timer kYt k2 ≥ αfH − kXt k2 ≥ ( α2 − 20 ∗ Procedure, since t ≤ q0 < q1 < · · · < qR and the rounds expand at a rate (1 + 1/τ ),   1 α 1 kYqi+1 − Yqi k2 ≥ − fH . (4) τ 2 20 Using what we have already shown in (3) we have   1 2 1 α (qi :qi+1 ) − − fH ≥ αfH τ 2 20 20 so dividing and using α ≥ 1/2 and C sufficiently large we get (q :qi+1 ) 2 (fH i ) ≥ X (q :q ) X (t∗ :m) 1 2 2 2 2 (fj i i+1 )2 . (f ) ≥ C f ≥ C H j 25τ 2 j6=H j6=H Since this holds for all i, H is everywhere heavy for q. We have used the tameness of the three processes (X, Y , and W ) and the bounds on α. Each of these fails with probability at most δ, so the total probability that Timer fails to achieve the condition that H is everywhere heavy for q is at most 4δ. During each round, the algorithm Sieve uses a hash function A to split the stream into two parts and then determines which part contains H via Pair. For these instances of Pair, we replace the two instances of JLBP with two instances of AMS. This replacement helps us to hold down the storage when we later use Nisan’s PRG, because computing the JL transformation T from [29] requires O(log n log log n) bits. Applying Nisan’s PRG to an algorithm that computes entries in T would leave us with a bound of O(log n(log log n)2 ). More details can be found in Section 4. A total of O(log n) rounds is enough to identify the heavy hitter and the only information that we need to save from each round is the hash function A and the last bit output by Pair. Selector does the work of finally identifying H from the sequence of bits output by Sieve and the sequence of hash functions used during the rounds. We prove the correctness of Sieve and Selector together in the following lemma. Lemma 10 (Sieve/Selector). Let q0 , q1 , . . . , qR = Timer(S) and let b1 , . . . , bR = Sieve(S, q0 , . . . , qR ). If H is everywhere heavy for q on the stream S then, with probability at least 1 − δ, Selector(b1 , . . . , bR ) returns H. 14 Proof. Lemma 6 in the AMS case implies that the outcome of round r satisfies Pr(br = Br,H ) ≥ 1 − 3δ and Pr(br = Br,j ) ≤ 12 + 3δ. The random bits used in each iteration of the for loop within Sieve are independent of the other iterations. Upon choosing the number of rounds R = O(log n) to be sufficiently large, Chernoff’s Inequality implies that, with high probability, H is the unique item in argmaxj #{r ∈ [R] | Br,j = br }. Therefore, Selector returns H. Algorithm 5 ℓ2 heavy hitters algorithm. procedure ℓ2 HeavyHitters(Stream S = (p1 , p2 , . . . , pm )) Q ← O(log ǫ−1 ), B ← O(ǫ−2 ) Select indep. 2-universal hash functions h1 , . . . , hQ , h′1 , . . . , h′Q : [n] → [B] and σ1 , . . . , σQ : [n] → {−1, 1}. ǫ )F2 using AMS [3] F̂2 ← (1 ± 10 Ĥ ← ∅ for (q, b) ∈ Q × B do Let Sq,bPbe the stream of items i with hq (i) = b cq,b ← j:h′q (j)=b σq (j)fj ⊲ The CountSketch [13] H ← CountSieve(Sq,b ) end for Remove from Ĥ any item such that i such that medianq {|cq,hq (i) |} ≤ 3ǫ 4 F̂2 . return Ĥ end procedure 2.4 CountSieve correctness We now have all of the pieces in place to prove that CountSieve correctly identifies a sufficiently heavy heavy hitter H. As for the storage bound and Theorem 1, the entire algorithm fits within O(log n log log n) bits except the R = O(log n) hash functions required by Sieve. We defer their replacement to Theorem 21 in Section 4. Theorem 11 (CountSieve Correctness). If H is a 400C 2 -heavy hitter then, with probability at least 0.95 CountSieve returns H. The algorithm uses O(log n log log n) bits of storage and can be implemented with O(log n log log n) stored random bits. Proof. We use Theorem 18 to generate the JL transformation T . Each of our lemmas requires that T embeds a (possible different) polynomially sized set of vectors, so, for δ = Ω(1), Theorem 18 implies that, with probability at least 1 − δ, T embeds all of the necessary vectors with seed length O(log n), and the entries in T can be computed in space O(log n log log n) bits of space. Because of the heaviness assumption, the conclusion of Lemma 7 fails to hold for t0 = t∗ (defined in Lemma 9) with probability at most 15 2δ. When that failure does not occur, the second and third hypotheses in Lemma 9 hold. The first hypothesis is that fH ≥ τ 4 , suppose it holds. Then the probability that H fails to be everywhere heavy for the sequence q that is output by Timer is at most 4δ. In this case, according to Lemma 10, Sieve and Selector correctly identify H except with probability at most δ. Therefore, the algorithm is correct with probability at least 1−P 8δ ≥ 0.95, by choosing δ ≤ 1/200. If fH < τ 4 , then because H is a heavy hitter, we get j6=H fj2 ≤ τ 8 = O(log8 n). Then we choose the constant factor in L large enough P so that, the second conclusion of Lemma 7 implies j∈W fj2 ≤ e−L/25 < 1. This means that H is the only item that passes the amplifier for all t ≥ t∗ , and, no matter what is the sequence output by Timer, H is everywhere heavy because it is the only item in the substream. Thus, in this case the algorithm also outputs H. Now we analyze the storage and randomness. Computing entries in the Kane-MekaNelson JL matrix requires O(log n log log n) bits of storage, by Theorem 18, and there is only one of these matrices. Amplifier stores L = O(log log n) counters. Sieve, Timer, and Selector each require O(log n) bits at a time (since we discard any value as soon as it is no longer needed). Thus the total working memory of the algorithm is O(log n log log n) bits. The random seed for the JL matrix has O(log n) bits. Each of the O(log log n) Bernoulli processes requires O(log n) random bits. By Theorem 21 below, the remaining random bits can be generated with Nisan’s generator using a seed of O(log n log log n) bits. Using Nisan’s generator does not increase the storage of the algorithm. Accounting for all of these, the total number of random bits used by CountSieve, which also must be stored, is O(log n log log n). Therefore, the total storage used by the algorithm is O(log n log log n) bits. Theorem 1 (ℓ2 -Heavy Hitters). For any ǫ > 0, there is a 1-pass algorithm in the insertiononly model that, with probability at least 2/3, finds all those √ √ indices i ∈ [n] for which fi ≥ ǫ F2 , and reports no indices i ∈ [n] for which fi ≤ 2ǫ F2 . The space complexity is O( ǫ12 log 1ǫ log n log log n) bits. Proof. The algorithm is Algorithm 5. It has the form of a CountSketch [13] with Q = O(log 1/ǫ) “rows” and B = 8(10C)2 /ǫ2 “buckets” per row, wherein we run one instance of CountSieve in each bucket to identify potential heavy hitters and also the usual CountSketch counter in each bucket. Finally, the algorithm discriminates against non-heavy hitters by testing their frequency estimates from the CountSketch. We will assume that the AMS estimate F̂2 is correct with √ probability at least 8/9. ǫ Let Hk = {i | fi ≥ k F2 } and let Ĥ be set of distinct elements returned by Algorithm 5. To prove the theorem, it is sufficient to prove that, with probability at least 2/3, H1 ⊆ Ĥ ⊆ H2 . 16 Let H ∈ H1 and consider the stream Sq,hq (H) at position (q, hq (H)). We have E( X fj2 ) ≤ X fj2 ≤ j6=H hq (j)=hq (H) Let Eq,H be the event that j6=H hq (j)=hq (H) ǫ2 F2 . 8(10C)2 ǫ2 F2 , (10C)2 so by Markov’s Inequality Pr(Eq,H ) ≥ 7/8. When Eq,H occurs H is sufficiently heavy in 1 Sq,hq (H) for CountSieve. By Theorem 11, with probability at least 87 − 20 ≥ 0.8, CountSieve identifies H. Therefore, with the correct choice of the constant factor for Q, a Chernoff bound and a union bound imply that, with probability at least 1 − 1/9, every item in H1 is returned at least once by a CountSieve. Let Ĥ′ denote the set Ĥ before any elements are removed in the final step. Since CountSieve identifies at most one item in each bucket, |Ĥ′ | = O(ǫ−2 log ǫ−1 ). By the correctness of CountSketch [13] and the fact that it is independent of Ĥ ′ , we get that, with probability at least 1 − 1/9, for all i ∈ Ĥ ′ fi − medianq {|cq,hq (i) |} ≤ ǫ p F2 . 10C When this happens and the AMS estimate is correct, the final step of the algorithm correctly removes any items i ∈ / H2 and all items i ∈ H1 remain. This completes the proof of correctness. The storage needed by the CountSketch is O(BQ log n), storage needed for the CountSieves is O(BQ log n log log n), and the storage needed for AMS is O(ǫ−2 log n). Therefore the total storage is O(BQ log n log log n) = O( ǫ12 log 1ǫ log n log log n) bits. Corollary √ 12. There exists an insertion-only streaming algorithm that returns an additive ±ǫ F2 approximation to ℓ∞ , with probability at least 2/3. The algorithm requires O( ǫ12 log 1ǫ log n log log n) bits of space. Proof. Use Algorithm 5. If no heavy-hitter is returned then the ℓ∞ estimate is 0, otherwise return the largest of the CountSketch medians among the discovered heavy hitters. The correctness follows from Theorem 1 and the correctness of CountSketch. 3 Chaining Inequality We call these inequalities Chaining Inequalities after the Generic Chaining, which is the technique that we use to prove it. The book [45] by Talagrand contains an excellent 17 exposition of the subject. Let (Xt )t∈T be a Gaussian process. The Generic Chaining technique concerns the study of the supremum of Xt in a particular metric space related to the variances and covariances of the process. The metric space is (T, d) where d(s, t) = 1 (E(Xs − Xt )2 ) 2 . The method takes any finite chain of finite subsets T0 ⊆ T1 ⊆ · · · ⊆ Tn ⊆ T and uses (Xt )t∈Ti as a sequence of successive approximations to (Xt )t∈T wherein Xt , for t ∈ / Ti , is approximated by the value of the process at some minimizer of d(t, Ti ) = min{d(t, s) | s ∈ Ti }. To apply the Generic Chaining one must judiciously choose the chain in order to get a good bound, and the best choice necessarily depends on the structure of the process. We will exploit the following lemma. Lemma 13 ([45]). Let {Xt }t∈T be a Gaussian process and let T0 ⊆ T1 · · · ⊆ Tn ⊆ T be a i chain of sets such that |T0 | = 1 and |Ti | ≤ 22 for i ≥ 1. Then X 2i/2 d(t, Ti ). (5) E sup Xt ≤ O(1) sup t∈T t∈T i≥0 The Generic Chaining also applies to Bernoulli processes, but, for our purposes, it is enough that we can compare related Gaussian and Bernoulli processes. Lemma 14 ([45]). Let A ∈ Rm×n be any matrix and let G and B be n-dimensional vectors with independent coordinates distributed as N (0, 1) and Rademacher, respectively. Then the Gaussian process X = AG and Bernoulli process Y = AB satisfy r π E sup Xt . E sup Yt ≤ 2 t∈T t∈T iid Theorem 15 (Chaining Inequality). Let Z1 , . . . , Zn . . . ∼ N (0, 1) and let (f (t) )t∈[m] be the sequence of frequency vectors of an insertion-only stream. There exists a universal constant P (t) C ′ > 0 such that if Xt = nj=1 Zj fj , for t ∈ [m], then E sup |Xi | ≤ C ′ i iid p If Z̄1 , . . . , Z̄n . . . ∼ Rademacher and Yt = E sup |Yi | ≤ C ′ i Var(Xm ) = C ′ kf (m) k2 . Pn p (t) j=1 Z̄j fj , (6) for t ∈ [m], then Var(Ym ) = C ′ kf (m) k2 . (7) Proof. Let T = [m]. Define T0 = {t0 }, where t0 is the index such that Var(Xt0 ) < 0.5 Var(Xm ) ≤ Var(Xt0 +1 ) and Ti = {1, ti,1 , ti,2 , . . . } where for each index ti,j ∈ Ti Var(Xti,j ) < j2i Var(Xm ) ≤ Var(Xti,j+1 ). This is well-defined because Var(Xt ) = kf (t) k22 2 is the second moment of an insertion-only stream, which must be monotonically increasi ing. By construction |Ti | ≤ 22 and, for each t ∈ T , there exist ti,j ∈ Tj such that 18 1 d(t, Ti ) = min(d(t, ti,j ), d(t, ti,j+1 )) ≤ d(ti,j , ti,j+1 ) = (E(Xti,j+1 − Xti,j )2 ) 2 , where the last inequality holds because E(Xt2 ) monotonically increasing with t. Notice that every pair of increments has nonnegative covariance because the stream is insertion-only. Thus, the following is true: d(t, ti,j+1 )2 ≤ E(Xti,j+1 − Xti,j )2 ≤ E(Xti,j+1 − Xti,j )2 + 2EXti,j (Xti,j+1 − Xti,j ) = EXt2i,j+1 − EXt2i,j j−1 2 j+1 2 2 2 − 2i EXm = 2i EXm . ≤ 2i EXm 2 2 2 Then we can conclude that X X p 2 p 2 = O(1) Var(X ). 2i/2 d(t, Ti ) ≤ 2i/2 2i EXm m 2 i≥0 i≥0 p Applying ineqality (5) we obtain E supt∈T Xt ≤ O(1) Var(Xm ). In order to bound the absolute value, observe sup |Xt | ≤ |X1 | + sup |Xt − X1 | ≤ |X1 | + sup(Xt − Xs ) = |X1 | + sup Xt + sup(−Xs ). (8) t s,t t s p ), because −Xt is also GausTherefore, E supt |Xt | ≤ E|X1 | + 2E sup Xt ≤ O(1) Var(Xmp sian process with the same distribution as Xt and E|X1 | = O( Var(Xm )) because f (1) = 1. This establishes (6) and (7) follows immediately by an application of Lemma 14. Theorem 15 would obviously not be true for a stream with deletions, since we may have Var(Xm ) = 0. One may wonder if the theorem would be true for streams with deletions upon replacing Var(Xm ) by maxt Var(Xt ). This is not true, and a counter example is the√stream (e1 , −e1 , e2 , . . . , en , −en ) which yields maxt Var(Xt ) = 1, but E supt |Xt | = Θ( log n). Theorem 15 does not apply to the process ouput by JLBP, but the covariance structures of the two processes are very similar because T is an embedding. We can achieve basically the same inequality for the JLBP process by applying Slepian’s Lemma, mimicking the stategy in [34]. Lemma 16 (Slepian’s Lemma [32]). Let Xt and Yt , for t ∈ T , be Gaussian processes such that E(Xs − Xt )2 ≤ E(Ys − Yt )2 , for all s, t ∈ T . Then, E supt∈T Xt ≤ E supt∈T Yt . Corollary 17 (Chaining Inequality for the transformed stream). Let T be a (1 ± γ)iid embedding of (f (t) )t∈[m] and let Z1 , . . . , Zk . . . ∼ N (0, 1). There exists a universal constant C ′ > 0 such that if Xt = hZ, T f (t) i, for t ∈ [m], then E supi |Xi | ≤ C ′ kf (m) k2 . If iid Z̄1 , . . . , Z̄k ∼ Rademacher and Yt = hZ̄, T f (t) i, for t ∈ [m], then E supi |Yi | ≤ C ′ kf (m) k2 . 19 Proof. Let Wt be the Gaussian process from Theorem 15. Since T is a JL transformation E(Xt − Xs )2 = kT f (s:t) k22 ≤ (1 + γ)2 kf (s:t) k22 = (1 + γ)2 E(Wt − Ws )2 . The first claim of the corollary follows from Slepian’s Lemma, Equation (8), and Theorem 15. The second inequality follows from the first and Lemma 14. 4 Reduced randomness This section describes how CountSieve can be implemented with only O(log n log log n) random bits. There are two main barriers to reducing the number of random bits. We have already partially overcome the first barrier, which is to reduce the number of bits needed by a Bernoulli process from n, as in the algorithm BP, to O(log n) by introducing JLBP. JLBP runs d = O(1) independent Bernoulli processes in dimension k = O(log n) for a total of dk = O(log n) random bits. This section proves the correctness of that algorithm. The second barrier is to find a surrogate for the R = O(log n) independent vectors of pairwise independent Bernoulli random variables that are used during the rounds of Sieve. We must store their values so that Selector can retroactively identify a heavy hitter, but, naı̈vely, they require Ω(log2 n) random bits. We will show that one can use Nisan’s pseudorandom generator (PRG) with a seed length of O(log n log log n) bits to generate these vectors. A priori, it is not obvious that this is possible. The main sticking point is that the streaming algorithm that we want to derandomize must store the random bits it uses, which means that these count against the seed length for Nisan’s PRG. Specifically, Nisan’s PRG reduces the number of random bits needed by a space S algorithm using R random bits to O(S log R). Because CountSieve must pay to store the R random bits, the storage used is S ≥ R = Ω(log2 n), so Nisan’s PRG appears even to increase the storage used by the algorithm! We can overcome this by introducing an auxiliary (non-streaming) algorithm that has the same output as Sieve and Selector, but manages without storing all of the random bits. This method is similar in spirit to Indyk’s derandomization of linear sketches using Nisan’s PRG [25]. It is not a black-box reduction to the auxiliary algorithm and it is only possible because we can exploit the structure of Sieve and Selector. We remark here that we are not aware of any black-box derandomization of the Bernoulli processes that suits our needs. This is for two reasons. First, we cannot reorder the stream for the purpose of the proof because the order of the computation is important. Reordering the stream is needed for Indyk’s argument [25] for applying Nisan’s PRG. Second, the seed length of available generators is too large, typically in our setting we would require a seed of length at least log1+δ n, for some δ > 0. 4.1 The Bernoulli process with O(log n) random bits The main observation that leads to reducing the number of random bits needed by the algorithm is that the distribution of the corresponding Gaussian process depends only 20 on the second moments of the increments. These moments are just the square of the Euclidean norm of the change in the frequency vector, so applying a Johnson-Lindenstrauss transformation to the frequency vector nearly preserves the distribution of the process and allows us to get away with O(log n) random bits. One trouble with this approach is that the heavy hitter H could be “lost”, whereby we mean that although kT eH k ≈ 1 it may be that hZ, T eH i ≈ 0, for the Rademacher random vector Z, whereupon H’s contribution to the sum hZ, T f (t) i is lost among the noise. To avoid this possibility we keep d = O(1) independent Bernoulli processes in parallel. First, we state the correctness of the Johnson-Lindenstrauss transformation that we use and the storage needed for it. Theorem 18 (Kane, Meka, & Nelson [29]). Let V = {v1 , . . . , vn } ⊆ Rn . For any constant δ > 0 there exists a k = O(γ −2 log(n/δ) and generator G : {0, 1}O(log n) × [k] × [n] → R such that, with probability at least 1 − δ, the k × n matrix T with entries Tij = G(R, i, j) is a (1 ± γ)-embedding of V , where R ∈ {0, 1}O(log n) is a uniformly random string. The value of G(R, i, j) can be computed with O(log n log log n) bits of storage. Lemma 5 (JLBP Correctness). Suppose the matrix T used by JLBP is an (1±γ)-embedding of (f (t) )t∈[m] . For any d ≥ 1, the sequence √1 ZT f (t) returned by JLBP is a tame dd dimensional Bernoulli process. Furthermore, there exists d′ = O(log δ−1 ) such that for any 1 d ≥ d′ and H ∈ [n] it holds that Pr( 21 ≤ kd− 2 ZT eH k ≤ 32 ) ≥ 1 − δ. P Proof. Let Xi,t = kj=1 Zij (T f (t) )j and d 1X 2 1 Xi,t , Xt = k √ ZT f (t) k22 = d d i=1 for t = 1, . . . , m. Each process Xi,t is a Bernoulli process with Var(Xi,t ) = kT f (t) k22 ≤ (1 + γ)2 kf (t) k22 and, for s < t, E(Xi,t − Xi,s )2 = kT f (s:t) k22 ≤ (1 + γ)2 kf (s:t) k22 . Notice that for all i Gaussian processes (Xi,t )t∈[m] are from same distribution. Let Xt′ be a Gaussian process that is identical to Xi,t , except that the Rademacher random ′ variables are replaced by standard Gaussians. p π Xt and X′i,t have the same means, variances, and covariances. Therefore E supt |Xi,t | ≤ 2 E supt |Xt |, by Lemma 14. iid Let N1 , . . . , Nn ∼ N (0, 1). We will compare Xt′ against the Gaussian process Xt′′ = (1 + γ) √1 hN, f (t) i. By the Chaining Inequality, there exists C ′ such that E sup |Xt′′ | ≤ d p ′ ′′ ) = C (1+γ) √ kf (m) k2 . We have E(Xt′′ −Xs′′ )2 = 1d (1+γ)2 kf (s:t) k22 , so by Slepian’s C ′ Var(Xm d Lemma applied to Xt′ and Xt′′ and by (8) we have r r r π π√ π ′ ′′ dE sup |Xt | ≤ E sup |Xt | ≤ (1 + γ)C ′ kf (m) k2 . E sup |Xi,t | ≤ 2 2 2 t t 21 Now we apply Markov’s Inequality to get Pr(supt |Xi,t | ≥ √C kf (m) k2 ) ≤ dδ , by taking d p C ≥ π2 (1 + γ)C ′ d3/2 /δ. From a union bound we find Pr(supi,t |Xi,t | ≥ √Cd kf (m) k2 ) ≤ δ, and that event implies supt |Xt | ≤ Ckf (m) k2 , which is (1) and proves that the process is tame. For the second claim, we note that the matrix √1d Z is itself a type of Johnson-Lindenstrauss transformation (see [1]), hence 21 ≤ kd−1/2 ZT eH k ≤ 32 , with probability at least 1 − 2−d ≥ (1 − δ). The last inequality follows by our choice of d. 4.2 Sieve and Selector In the description of the algorithm, the Sieve and Selector use O(log n) many pairwise independent hash functions that are themselves independent. Nominally, this needs O(log2 n) bits. However, as we show in this section, it is sufficient to use Nisan’s pseudorandom generator [41] to generate the hash functions. This reduces the random seed length from O(log2 n) to O(log n log log n). Recall the definition of a pseudorandom generator. Definition 19. A function G : {0, 1}m → {0, 1}n is called a pseudorandom generator (PRG) for space(S) with parameter ǫ if for every randomized space(S) algorithm A and every input to it we have that kDy (A(y)) − Dx (A(G(x))k1 < ǫ, where y is chosen uniformly at random in {0, 1}n , x uniformly in {0, 1}m , and D(·) is the distribution of · as a vector of probabilities. Nisan’s PRG [41] is a pseudorandom generator for space S with parameter 2−S that takes a seed of length O(S log R) bits to R bits. The total space used by Sieve and Selector is O(log n) bits for the algorithm workspace and O(log2 n) bits to store the hash functions. We will be able to apply Nisan’s PRG because Sieve only accesses the randomness in O(log n) bit chunks, where the rth chunk generates the 4-wise independent random variables needed for the rth round, namely Br1 , . . . , Brn and the bits for two instances of the AMS sketch. We can discard the AMS sketches at the end of each round, but in order to compute its output after reading the entire stream, Selector needs access to the bit sequence b1 , b2 , . . . , bR as well as Bri , for r ∈ [R] and i ∈ [n]. Storing the B random variables, by their seeds, requires O(log2 n) bits. This poses a problem for derandomization with Nisan’s PRG because it means that Sieve and Selector are effectively a O(log2 n) space algorithm, even though most of the space is only used to store random bits. We will overcome this difficulty by derandomizing an auxiliary algorithm. The auxiliary algorithm computes a piece of the information necessary for the outcome, specifically for a given item j ∈ [n] in the stream the auxiliary item will compute Nj := #{r | br = Brj } the number of times j is on the “winning side” and compare that value to 3R/4. Recall that the Selector outputs as the heavy hitter a j that maximizes Nj . By Lemma 6 for the 22 AMS case, ENj is no larger than ( 21 + 3δ)R, if j is not the heavy element, and ENH is at least (1 − 3δ)R if H is the heavy element. When the Sieve is implemented with fully independent rounds, Chernoff’s Inequality implies that NH > 3R/4 or Nj ≤ 3R/4 with high probability. When we replace the random bits for the independent rounds with bits generated by Nisan’s PRG we find that for each j with high probability Nj remains on the same side of 3R/4. Here is a formal description of the auxiliary algorithm. The auxiliary algorithm takes as input the sequence q0 , q1 , . . . , qR (which is independent of the bits we want to replace with Nisan’s PRG), the stream S, and an item label j, and it outputs whether Nj > 3R/4. It initializes Ni = 0, and then for each round r = 1, . . . , R it draws O(log n) random bits and computes the output br of the round. If br = Brj then Ni is incremented, and otherwise it remains unchanged during the round. The random bits used by each round are discarded at its end. At the end of the stream the algorithm outputs 1 if Nj > 3R/4. e ∈ {0, 1} Lemma 20. Let X ∈ {0, 1} be the bit output by the auxiliary algorithm, and let X be the bit output by the auxiliary algorithm when the random bits it uses are generated by Nisan’s PRG with seed length O(log n log log n). Then e = 1)| ≤ 1 . | Pr(X = 1) − Pr(X n2 Proof. The algorithm uses O(log n) bits of storage and O(log2 n) bits of randomness. The claim follows by applying Nisan’s PRG [41] with ǫ = 1/n2 and seed length O(log n log log n). Theorem 21. Sieve and Selector can be implemented with O(log(n) log log n) random bits. Proof. Let Nj be the number of rounds r for which br = Brj when the algorithm is ej be that number of rounds when the implemented with independent rounds, and let N algorithm is implemented with Nisan’s PRG. Applying Lemma 20 we have for every item ej > 3R/4) − P (Nj > 3R/4)| ≤ 1/n2 . Thus, by a union bound, the probability j that | Pr(N that the heavy hitter H is correctly identified changes by no more than n/n2 = 1/n. The random seed requires O(log n log log n) bits of storage, and aside from the random seeds the algorithms use O(log n) bits of storage. Hence the total storage is O(log n log log n) bits. 5 F2 at all points One approach to tracking F2 at all times is to use the median of O(log n) independent copies of an F2 estimator like the AMS algorithm [3]. A Chernoff bound drives the error probability to 1/poly(n), which is small enough for a union bound over all times, but it requires O(log2 n) bits of storage to maintain all of the estimators. The Chaining Inequality 23 allows us to get a handle on the error during an interval of times. Our approach to tracking F2 at all times is to take the median of O(log 1ǫ + log log n) Bernoulli processes. In any short enough interval—where F2 changes by only a (1 + Ω(ǫ2 )) factor—each of the processes will maintain an accurate estimate of F2 for the entire interval, with constant probability. Since there are only O(ǫ−2 log2 (n)) intervals we can apply Chernoff’s Inequality to guarantee the tracking on every interval, which gives us the tracking at all times. This is a direct improvement over the F2 tracking algorithm of [24] which for constant ε requires O(log n(log n + log log m)) bits. The algorithm has the same structure as the AMS algorithm, except we replace their sketches with instances of JLBP. Algorithm 6 An algorithm for approximating F2 at all points in the stream. procedure F2Always(Stream S) N ← O( ǫ12 ), R ← O(log( ǫ12 log n)) (t) Xi,r ← JLBP(S) for i ∈ [N ] and r ∈ [R]. ⊲ Use a (1 ± 3ǫ )-embedding T in this step. P (t) (t) 2 Yr = N1 N i=1 kXi,r k2 (t) (t) return F̂2 = medianr∈R {Yr } at each time t end procedure (t) Lemma 22. Let N = O( δǫ12 ) and let Xi , for i = 1, . . . , N , be independent copies of the output of JLBP(S) using a fixed (1 ± 8ǫ )-embedding T on an insertion only stream S. Let P (t) 2 Yt = N1 N i=1 kXi k2 . Suppose that for two given times 1 ≤ u < v ≤ m the stream satisfies P (u:v) (u) (u:v) (u:v) 2 ) is the second moment of the change 256C 2 F2 ≤ ǫ2 F2 , where F2 = ni=1 (fi in the stream. Then   (t) (t) Pr |Yt − F2 | ≤ ǫF2 , for all u ≤ t ≤ v ≥ 1 − 2δ. (t) (u) (t) (u) Proof. We first write |Yt − F2 | ≤ |Yt − Yu | + |Yu − F2 | + |F2 − F2 |. It follows from the arguments of AMS and the fact that T is a (1 ± ǫ/8)-embedding that, with an appropriate choice for N = O( δǫ12 ), we arrive at ǫ (u) (u) Pr(|Yu − F2 | ≤ F2 ) ≥ 1 − δ. 4 (t) (u) For the third term we have F2 ≥ F2 We can bound the difference with (t) F2 (9) because t ≥ u and the stream is insertion only. = kf (u) + f (u:t) k22 ≤ kf (u) k22 24 kf (u:t) k2 1+ kf u k2 !2 ǫ (u) ≤ F2 (1 + ), 4 where the last inequality follows because C ≥ 2 and ǫ ≤ 1/2. (t) For the first term, since Xi , i ∈ [n], are independent d-dimensional Bernoulli processs, it follows that 1 (t) (t) (t) X (t) = √ ((X1 )T , (X2 )T , . . . , (XN )T )T N is an N d-dimensional Bernoulli process. By Lemma 5 and due to the fact that X (t) can be represented as an output of JLBP procedure, the process X (u:t) = X (t) − X (u) , is a tame process, so with probability at least 1 − δ, for all u ≤ t ≤ v we have kX (u:t) k22 ≤ C 2 n X (u:v) 2 (fj ) . j=1 Therefore, assuming the inequality inside (9), Yt = kX (u) + X (u:t) k22 !2 !2 √ kX (u:t) k2 1 + ε kF (u:t) k2 ≤ Yu 1 + ≤ Yu 1 + √ kX (u) k2 1 − ε kF (u) k2   2ǫ 2 (u) ≤ Yu 1 + ≤ F2 (1 + ǫ/4), 16C where the last inequality follows because C ≥ 2 and ǫ ≤ 1/2. The reverse bound Yt ≥ (u) F2 (1 − ǫ/4) follows similarly upon applying the reverse triangle inequality in place of the triangle inequality. With probability at least 1 − 2δ, (t) (u) (t) (u) (u) |Yt − F2 | ≤ |Yt − Yu | + |Yu − F2 | + |F2 − F2 | ≤ ǫF2 (t) ≤ ǫF2 . (t) Theorem 23. Let S be an insertion only stream and, for t = 1, 2, . . . , m, let F2 Pn (t) 2 (t) i=1 (fi ) and let F̂2 be the value that is output by Algorithm 6. Then (t) (t) = (t) P (|F̂2 − F2 | ≤ ǫF2 , for all t ∈ [m]) ≥ 2/3.  The algorithm uses O ǫ12 log n log log n + log 1ε bits of space. Proof. By Lemma 18, the (single) matrix used by all instances of JLBP is a (1 ± ǫ/3)embedding with probability at least 0.99, henceforth assume it is so. Let q0 = 0 and   ε2 i (t) ) , qi = max t |F2 ≤ (1 + t 256C 2 until qK = m for some K. Notice that K = O( ǫ12 log n). Here, C is the constant from Definition 3. 25 By definition of qi and using the fact that (a − b)2 ≤ a2 − b2 for real numbers 0 ≤ b ≤ a (q :q ) (q ) (q ) (qi ) ε2 we have F2 i i+1 ≤ (F2 i+1 − F2 i ) ≤ 256C . 2 F2 Applying Lemma 22 with δ = 1/10, we have, for every r ∈ [R] and i ≥ 0 that (t) (t) P (|Yr(t) − F2 | ≤ ǫF2 , for all qi ≤ t ≤ qi+1 ) ≥ 0.8. Thus, by Chernoff bound, the median satisfies (t) (t) (t) P (|F̂2 − F2 | ≤ ǫF2 , for all qi ≤ t ≤ qi+1 ) ≥ 1 − e−R/12 ≥ 1 − 1 , 4K by our choice of R = 12 log 4K = O(log(ǫ−2 log n)). Thus, by a union bound over all of the intervals and the embedding T we get 2 (t) (t) (t) P (|F̂2 − F2 | ≤ ǫF2 , for all t ∈ [m]) ≥ , 3 which completes the proof of correctness. The algorithm requires, for the matrix T , the JL transform of Kane, Meka, and Nelson [29] with a seed length of O(log(n) log( 1ǫ log n)) bits, and it takes only O(log(n/ǫ)) bits of space to compute any entry of T . The algorithm maintains N R = O(ǫ−2 log( 1ǫ log n)) instances of JLBP which each requires O(log n) bits of storage for the sketch and random bits. Therefore, the total storage used by the algorithm is O(ǫ−2 log(n) log( 1ǫ log n)). This immediately implies Theorem 2. Acknowledgements The authors would like to thank Raghu Meka for suggesting the JL strategy to reduce the number of random bits needed for the Bernoulli processes. We would also like to thank several anonymous reviewers for their careful reading of an earlier version of this paper and the valuable suggestions that they made. References [1] Dimitris Achlioptas. Database-friendly random projections: Johnson-Lindenstrauss with binary coins. Journal of Computer and System Sciences, 66(4):671–687, 2003. [2] Rakesh Agrawal and Ramakrishnan Srikant. Fast algorithms for mining association rules in large databases. In VLDB’94, Proceedings of 20th International Conference on Very Large Data Bases, September 12-15, 1994, Santiago de Chile, Chile, pages 487–499, 1994. 26 [3] Noga Alon, Yossi Matias, and Mario Szegedy. The space complexity of approximating the frequency moments. J. Comput. Syst. Sci., 58(1):137–147, 1999. [4] Alexandr Andoni, Robert Krauthgamer, and Krzysztof Onak. Streaming algorithms via precision sampling. In IEEE 52nd Annual Symposium on Foundations of Computer Science, FOCS 2011, Palm Springs, CA, USA, October 22-25, 2011, pages 363–372, 2011. [5] Khanh Do Ba, Piotr Indyk, Eric Price, and David P. Woodruff. Lower bounds for sparse recovery. CoRR, abs/1106.0365, 2011. [6] Brian Babcock, Shivnath Babu, Mayur Datar, Rajeev Motwani, and Jennifer Widom. Models and issues in data stream systems. In Proceedings of the Twenty-first ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, June 35, Madison, Wisconsin, USA, pages 1–16, 2002. [7] Ziv Bar-Yossef, T. S. Jayram, Ravi Kumar, and D. Sivakumar. An information statistics approach to data stream and communication complexity. J. Comput. Syst. Sci., 68(4):702–732, 2004. [8] Kevin S. Beyer and Raghu Ramakrishnan. Bottom-up computation of sparse and iceberg cubes. In SIGMOD 1999, Proceedings ACM SIGMOD International Conference on Management of Data, June 1-3, 1999, Philadelphia, Pennsylvania, USA., pages 359–370, 1999. [9] Lakshminath Bhuvanagiri, Sumit Ganguly, Deepanjan Kesh, and Chandan Saha. Simpler algorithm for estimating frequency moments of data streams. In Proceedings of the Seventeenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2006, Miami, Florida, USA, January 22-26, 2006, pages 708–713, 2006. [10] Jean Bourgain and Jelani Nelson. Toward a unified theory of sparse dimensionality reduction in Euclidean space. CoRR, abs/1311.2542, 2013. [11] Yousra Chabchoub, Christine Fricker, and Hanene Mohamed. Analysis of a bloom filter algorithm via the supermarket model. In 21st International Teletraffic Congress, ITC 2009, Paris, France, September 15-17, 2009, pages 1–8, 2009. [12] Amit Chakrabarti, Subhash Khot, and Xiaodong Sun. Near-optimal lower bounds on the multi-party communication complexity of set disjointness. In 18th Annual IEEE Conference on Computational Complexity (Complexity 2003), 7-10 July 2003, Aarhus, Denmark, pages 107–117, 2003. [13] Moses Charikar, Kevin Chen, and Martin Farach-Colton. Finding frequent items in data streams. Theor. Comput. Sci., 312(1):3–15, 2004. 27 [14] Kenneth L. Clarkson and David P. Woodruff. Low rank approximation and regression in input sparsity time. In Symposium on Theory of Computing Conference, STOC’13, Palo Alto, CA, USA, June 1-4, 2013, pages 81–90, 2013. [15] Graham Cormode and S. Muthukrishnan. Data stream methods. http://www.cs.rutgers.edu/~muthu/198-3.pdf/, 2003. Lecture 3 of Rutgers Seminar on Processing Massive Data Sets. [16] Graham Cormode and S. Muthukrishnan. An improved data stream summary: the Count-Min sketch and its applications. J. Algorithms, 55(1):58–75, 2005. [17] Erik D. Demaine, Alejandro López-Ortiz, and J. Ian Munro. Frequency estimation of internet packet streams with limited space. In Algorithms - ESA 2002, 10th Annual European Symposium, Rome, Italy, September 17-21, 2002, Proceedings, pages 348– 360, 2002. [18] Cristian Estan and George Varghese. New directions in traffic measurement and accounting: Focusing on the elephants, ignoring the mice. ACM Trans. Comput. Syst., 21(3):270–313, 2003. [19] Min Fang, Narayanan Shivakumar, Hector Garcia-Molina, Rajeev Motwani, and Jeffrey D. Ullman. Computing iceberg queries efficiently. In VLDB’98, Proceedings of 24rd International Conference on Very Large Data Bases, August 24-27, 1998, New York City, New York, USA, pages 299–310, 1998. [20] Anna C. Gilbert, Yi Li, Ely Porat, and Martin J. Strauss. Approximate sparse recovery: optimizing time and measurements. In Proceedings of the 42nd ACM Symposium on Theory of Computing, STOC 2010, Cambridge, Massachusetts, USA, 5-8 June 2010, pages 475–484, 2010. [21] Jiawei Han, Jian Pei, Guozhu Dong, and Ke Wang. Efficient computation of iceberg cubes with complex measures. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, Santa Barbara, CA, USA, May 21-24, 2001, pages 1–12, 2001. [22] Jiawei Han, Jian Pei, and Yiwen Yin. Mining frequent patterns without candidate generation. In Proceedings of the 2000 ACM SIGMOD International Conference on Management of Data, May 16-18, 2000, Dallas, Texas, USA., pages 1–12, 2000. [23] Christian Hidber. Online association rule mining. In SIGMOD 1999, Proceedings ACM SIGMOD International Conference on Management of Data, June 1-3, 1999, Philadelphia, Pennsylvania, USA., pages 145–156, 1999. [24] Zengfeng Huang, Wai Ming Tai, and Ke Yi. Tracking the frequency moments at all times. arXiv preprint arXiv:1412.1763, 2014. 28 [25] Piotr Indyk. Stable distributions, pseudorandom generators, embeddings, and data stream computation. J. ACM, 53(3):307–323, 2006. [26] Piotr Indyk and David P. Woodruff. Optimal approximations of the frequency moments of data streams. In Proceedings of the 37th Annual ACM Symposium on Theory of Computing, Baltimore, MD, USA, May 22-24, 2005, pages 202–208, 2005. [27] T. S. Jayram and David P. Woodruff. The data stream space complexity of cascaded norms. In 50th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2009, October 25-27, 2009, Atlanta, Georgia, USA, pages 765–774, 2009. [28] Hossein Jowhari, Mert Saglam, and Gábor Tardos. Tight bounds for lp samplers, finding duplicates in streams, and related problems. In Proceedings of the 30th ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, PODS 2011, June 12-16, 2011, Athens, Greece, pages 49–58, 2011. [29] Daniel Kane, Raghu Meka, and Jelani Nelson. Almost optimal explicit JohnsonLindenstrauss families. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, pages 628–639. Springer, 2011. [30] Richard M. Karp, Scott Shenker, and Christos H. Papadimitriou. A simple algorithm for finding frequent elements in streams and bags. ACM Trans. Database Syst., 28:51– 55, 2003. [31] Abhishek Kumar and Jun (Jim) Xu. Sketch guided sampling - using on-line estimates of flow size for adaptive data collection. In INFOCOM 2006. 25th IEEE International Conference on Computer Communications, Joint Conference of the IEEE Computer and Communications Societies, 23-29 April 2006, Barcelona, Catalunya, Spain, 2006. [32] Michel Ledoux and Michel Talagrand. Probability in Banach Spaces, volume 23. Springer-Verlag, 1991. [33] Gurmeet Singh Manku and Rajeev Motwani. Approximate frequency counts over data streams. PVLDB, 5(12):1699, 2012. [34] Raghu Meka. A PTAS for computing the supremum of Gaussian processes. In Foundations of Computer Science (FOCS), 2012 IEEE 53rd Annual Symposium on, pages 217–222. IEEE, 2012. [35] Xiangrui Meng and Michael W. Mahoney. Low-distortion subspace embeddings in input-sparsity time and applications to robust linear regression. In Symposium on Theory of Computing Conference, STOC’13, Palo Alto, CA, USA, June 1-4, 2013, pages 91–100, 2013. 29 [36] Gregory T. Minton and Eric Price. Improved concentration bounds for Count-Sketch. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2014, Portland, Oregon, USA, January 5-7, 2014, pages 669–686, 2014. [37] Jayadev Misra and David Gries. Finding repeated elements. Sci. Comput. Program., 2(2):143–152, 1982. [38] Morteza Monemizadeh and David P. Woodruff. 1-pass relative-error lp -sampling with applications. In Proceedings of the Twenty-First Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2010, Austin, Texas, USA, January 17-19, 2010, pages 1143–1160, 2010. [39] S. Muthukrishnan. Data streams: Algorithms and applications. Foundations and Trends in Theoretical Computer Science, 1(2), 2005. [40] Jelani Nelson and Huy L. Nguyen. OSNAP: faster numerical linear algebra algorithms via sparser subspace embeddings. In 54th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2013, 26-29 October, 2013, Berkeley, CA, USA, pages 117–126, 2013. [41] Noam Nisan. Pseudorandom generators for space-bounded computation. Combinatorica, 12(4):449–461, 1992. [42] Eric Price. Efficient sketches for the set query problem. In Proceedings of the TwentySecond Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2011, San Francisco, California, USA, January 23-25, 2011, pages 41–56, 2011. [43] Ashok Savasere, Edward Omiecinski, and Shamkant B. Navathe. An efficient algorithm for mining association rules in large databases. In VLDB’95, Proceedings of 21th International Conference on Very Large Data Bases, September 11-15, 1995, Zurich, Switzerland., pages 432–444, 1995. [44] Michel Talagrand. Majorizing measures: The generic chaining. The Annals of Probability, 24(3), 1996. [45] Michel Talagrand. Upper and Lower Bounds for Stochastic Processes: Modern Methods and Classical Problems, volume 60. Springer Science & Business Media, 2014. [46] Mikkel Thorup and Yin Zhang. Tabulation-based 5-independent hashing with applications to linear probing and second moment estimation. SIAM J. Comput., 41(2):293– 331, 2012. [47] Hannu Toivonen. Sampling large databases for association rules. In VLDB’96, Proceedings of 22th International Conference on Very Large Data Bases, September 3-6, 1996, Mumbai (Bombay), India, pages 134–145, 1996. 30
8cs.DS
21, rue d’Artois, F-75008 PARIS http : //www.cigre.org CIGRE US National Committee 2016 Grid of the Future Symposium Capturing the Variabilities of Distribution Network Net-Load via Available Flexibility of Microgrids A. MAJZOOBI, A. KHODAEI University of Denver USA S. BAHRAMIRAD ComEd USA M. BOLLEN Luleå Univ of Technology Sweden SUMMARY Renewable energy has attracted significant attention over the last decade, conceivably due to its environmental benefits and the recent drops in the development and deployment cost of the technology. The increase in renewable generation, however, has resulted in new challenges in supply-load balancing, owing to its intermittent, non-predictable and volatile generation features. Several methods have been introduced to cope with negative impacts of the renewable generation deployment. In this paper, a novel method, i.e., the application of microgrids in capturing the variabilities of distributed renewable generation in distribution networks is proposed and investigated. Utilizing available flexibility of microgrids represents a local and viable solution which leads to lower investments from electric utilities for increasing their flexibility and providing more reserved power. It is investigated that how the system flexibility requirements can be integrated into the microgrid optimal scheduling model to enable microgrids in supporting the grid operators by offering flexibility services. Using the proposed flexibility constraints, intra-hour and inter-hour variabilities at the distribution feeder will be efficiently captured. Numerical simulations on a test distribution feeder, with one microgrid and several renewable-equipped consumers, show the effectiveness of the proposed model. KEYWORDS Distributed generation, distribution network variabilities, microgrid, flexibility, renewable energy, utility grid. [email protected] 1. INTRODUCTION Renewable energy resource deployment has experienced a significant global growth in recent years, however, the renewable generation’s inherent intermittency and volatility have caused new challenges in balancing electricity supply and demand, thus calling for new methods to diminish their negative impacts on power system stability and reliability [1]. There have been interesting discussions on how to address variability in voltage, beyond flicker, in distribution network [2]-[4]. The other significant challenge is how to maintain supply-demand balance. To address this challenge, grid operators traditionally rely on bulk power generation resources, such as fast ramping hydro and thermal units, that can be quickly dispatched and ramped up, or on distributed resources, such as demand response and electric vehicles, that in aggregate can provide considerable flexibility services. The large-scale solution, however, is constrained with the limited number and capacity of available resources, and is capital-intensive and timeconsuming to be constructed. The small-scale solutions, on the other, are constrained with the requirement of a strong infrastructure, in terms of monitoring, and customers’ willingness to participate in the flexibility offering, in terms of control. Energy storage, is another solution which is still rather expensive and cannot be extensively utilized in the power system. Available flexibility in existing microgrids can potentially offer a solution for addressing renewable generation challenges and ensuring supply-load balance [5], [6]. A microgrid is defined as a group of interconnected loads and distributed energy resources (DERs) within clearly defined electrical boundaries that acts as a single controllable entity with respect to the grid and can connect and disconnect from the grid to enable it to operate in both grid-connected or island-mode [7]. The microgrid, as a novel distribution network architecture, consists of local and distributed generation resources, energy storage, and loads. These resources are controlled and operated by a microgrid master controller, based on economy and reliability considerations, thus the microgrid can be seen as a relatively large and controllable demand from a grid operator’s perspective. The microgrid has the capability to disconnect from the utility grid and operate in the islanded mode, in order to isolate the microgrid from any disturbances in the upstream network and minimizing the amount of local load curtailment [8]. During the gridconnected mode, however, microgrid freely exchanges power with the utility grid which can be in the form of power import or export. If this power exchange is efficiently controlled, by adding proper constraints to the microgrid optimal scheduling framework, the microgrid can be used to capture the generation variability of distributed renewable energy resources in the distribution grid. These flexibility constraints, that enable the microgrid to support the utility grid in terms of flexibility services, are investigated and developed in the following sections of this paper. The proposed solution in this paper can be of significant value particularly in future power grids where the penetration of microgrids is high. A global trend can be seen in microgrid deployments, where the microgrids revenue is anticipated to reach $19.9 billion by 2020 [9]. More than 1,500 microgrid projects, with the capacity of 15,600 MW, have been reported until April 2016 and 1,565 MW new microgrid projects have been introduced in 39 countries as new projects [10]. These figures clearly show the growing interest in microgrids and further signify microgrids as core components of future power grids. The rest part of the paper is organized as follows: The outline of the proposed constraints along with mathematical modelling are presented in Section 2, numerical simulations on a test feeder to show the effectiveness of proposed model are provided in Section 3, and the paper is concluded in Section 4. 1 2. MODEL OUTLINE AND FORMULATION Figure 1 depicts the impact of the microgrid on a distribution feeder consisting of a microgrid and distributed prosumers/consumers. Prosumers are consumers that are equipped with distributed generation resources, primarily renewable energy. This figure compares the impact of the microgrid on the distribution feeder net load, from the utility grid’s perspective, with and without consideration of flexibility constraints in the microgrid scheduling. In the top figure, the microgrid is scheduled to obtain the least-cost operation, i.e., local resources are scheduled in a way that the microgrid operation cost (consisting of local generation cost and cost of energy exchange with the utility grid) is minimized. In the bottom figure, however, the flexibility constraints are considered in the microgrid optimal scheduling framework, i.e., local resources are scheduled in a way that the flexibility requirement by the utility grid are met with the support of the microgrid. In the former case, the microgrid not only does not mitigate the net load variabilities in the distribution feeder, but also exacerbates the variabilities. In the latter case, however, the microgrid captures the existing variabilities where the distribution feeder net load profile, seen by the utility grid, is considerably smoother and variabilities are confined to desired amount. Figure 1. Impact of microgrid scheduling on a distribution feeder; top: price-based scheduling, bottom: Flexibility-oriented scheduiling. The amount of the power that is to be provided by the utility grid, which is also the distribution feeder net load, can be calculated based on the microgrid net load and prosumers/consumers net load as in (1): u M Ptks  Ptks  c  Pjtks j N ∀ t ,∀ k ,∀ s , (1) where, Pu represents the utility grid power, PM represents the microgrid exchanged power with the utility grid (microgrid net load), and Pc shows the distributed prosumers/consumers net load. t and k denote indices for inter-hour and intra-hour time periods, respectively, and s is the index for various scenarios of microgrid islanding which is considered for considering microgrid operation in the islanded mode. Different values can be considered for k as the intra-hour time period to enable modelling different time resolutions, such as 1-minute based, 5-minute based, 10-minute based, etc. The grid operator is required to limit the intra-hour and inter-hour 2 variabilities in distribution feeders, to minimize the necessary flexibility resource investments, as proposed in (2) and (3): Ptksu  Pt u( k 1) s  1 ∀ t ,∀ s, k  1, (2) Pt1us  P(ut 1) Ks   2 ∀ t ,∀ s, (3) where Δ1 and Δ2, respectively the utility grid’s intra-hour and inter-hour desired ramping, are selected by the grid operator based on the day-ahead net load forecasts and desired grid flexibility during each time interval. If the required grid flexibility is larger than the available flexibility, which is calculated using various methods [11] and [12], the grid operator can utilize the available flexibility of distributed resources, such as microgrids, to compensate for the flexibility. Thus, Δ1 and Δ2 are defined by comparing the required and available grid flexibility. Moreover, the grid operator can obtain these limits through cost-benefit analysis. To this end, the expense for increasing the utility grid flexibility will be compared with the payments to the participating microgrids. These two constraints can be converted into constraints on the microgrid net load by substituting the value of Pu from (1). Consequently, (4) and (5) will be obtained: c M c c  1  ( Pjtk   Pjtc ( k 1) ) ≤ Ptks  Pt M ( k 1) s ≤ 1  ( Pjtk   Pjt ( k 1) ) j j j c c   2  ( Pjtc1   Pjc(t 1) K ) ≤ Pt1Ms  P(M t 1) Ks ≤  2  ( Pjt1   Pj (t 1) K ) j j j t , s, k  1, (4) t , s. (5) j j These two constraints can be added to the microgrid optimal scheduling problem to model the flexibility constraints and therefore utilize the microgrid for grid support. It should also be noted that the utility grid flexibility constraints, which are obtained by utility grid (Δ1 and Δ2), are fixed while as the boundaries of constraints (4) and (5) show, the limits on microgrid net load are variable. This is due to aggregated net load of all consumers/prosumers in distribution feeder which is highly variable. In addition, changing intra-hour period from 1 to 60 enables having different resulotions in the model from one minute to one hour. Therefore, the grid operator can reach to a desired profile of net load in distribution network with managing both intra-hour and inter-hour flexibility limits. The complete formulation of the microgrid optimal scheduling, along with prevailing technical constraints, can be found in the literature [13]. 3. SIMULATION RESULTS A microgrid with four dispatchable units, two nondispatchable units (solar and wind), one energy storage, and five adjustable loads is considered for simulations. The characteristics of microgrid’s components and the hourly market price are available in [13]. This microgrid is connected to a distribution feeder with several prosumers and consumers. The aggregated net load of these prosumers/consumers is shown in Figure 2. 3 Figure 2. Aggregated prosumers/consumers generation, consumption, and net load. The microgrid optimal scheduling problem is solved using price-based scheduling (no flexibility constraints are considered) and flexibility-oriented scheduling (the proposed flexibility constraints are considered). Figure 3 shows the distribution feeder net load, seen by the utility grid, in these two studied cases. From this figure it can be easily deduced that under the price-based scheduling, the microgrid exacerbates the variabilities of distribution feeder net load due to the fact that in this condition the microgrid controller schedules its local generation and loads to achieve the least operation cost without consideration of required flexibility of utility grid. However, under flexibility-oriented scheduling, as Figure 3 shows, a smoother net load profile is seen by the utility grid and the variabilities of distribution feeder net load are restricted to the desired flexibility limits. A 0 MW/10-min is considered as the intra-hour variability limit (Δ1), therefore all intra-hour variabilities of distribution feeder net load are captured by the microgrid. The microgrid net load is depicted in Figure 4 to show how microgrid revises its scheduling, and accordingly its utility grid power exchange, to capture distribution feeder variabilities. As this figure shows, there are considerable variabilities in the microgrid net load under flexibility-oriented scheduling as a result of capturing intra-hour variabilities of distribution feeder net load. In price-based scheduling, however, the microgrid imports the maximum possible power from the utility grid when electricity prices are low, whilst reduces the amount of import and even exports excess power to the utility grid in high electricity price to achieve its primary objective, i.e. the minimum operation cost. Figure 3. Distribution feeder net load in two conditions: price-based scheduling and Flexibilityoriented scheduling. 4 Figure 4. Microgrid net load in two conditions: price-based scheduling and Flexibility-oriented scheduling. The results of the two cases demonstrate the effectiveness of the proposed model. However, it should be mentioned that the microgrid operation cost will be increased owing to adding flexibility constraints to the problem. The microgrid operation cost considering the flexibility constraints is calculated as $13,329 which is significantly increased, around 13.5%, compared to that of the price-based scheduling. This increase in the microgrid operation cost, which is imposed to the microgrid due to considering flexibility constraints, should be paid to the microgrid as an incentive for contribution in grid support and reducing distribution feeder net load variabilities. This cost increase may introduce a good argument to solve the problem centrally, by the grid operator, and further determine the incurred system costs. This analysis, however, requires further development of appropriate grid operation and planning schemes which will be considered as follow up works. 4. CONCLUSIONS Microgrids, as local and highly flexible resources, can be used to capture the distribution grid net load variabilities caused primarily by distributed renewable energy resources. This paper investigated this capability and proposed novel constraints that can be added to the microgrid optimal scheduling problem and enable grid support. The proposed constraints, which were developed based on inter-hour and intra-hour time indices, could potentially capture high resolution (minute-based) load variabilities, thus would be of significant value in managing variable renewable generation using microgrids. Simulation results on a test feeder with one microgrid revealed the effectiveness of the proposed model while showing that this benefit comes at the expense of an increase in the microgrid operation cost. 5 BIBLIOGRAPHY [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] M. Bollen, and F. Hassan, Integration of distributed generation in the power system, (Wiley IEEE Press, July 2011). O. Lennerhag, M. Bollen, S. Ackeby, and S. Rönnberg, “Very short variations in voltage (timescale less than 10 minutes) due to variations in wind and solar power” (Int. Conf. Electricity Distribution (CIRED), Lyon, France, June 2015). M. Bollen, M. Häger, and C. Schwaegerl, “Quantifying voltage variations on a time scale between 3 seconds and 10 minutes” (Int. Conf. on Electric Distribution Systems (CIRED), Turin, Italy, June 2005). M. Bollen, and I.Y.H. Gu, “Characterization of voltage variations in the very-short time scale” (IEEE Transactions on Power Delivery, Vol.20, No.2, pp.1198-1199, Apr. 2015). A. Majzoobi and A. Khodaei, “Application of Microgrids in Addressing Distribution Network Net-Load Ramping” (IEEE PES Innovative Smart Grid Technologies, 6-9 Sep. 2016). A. Majzoobi and A. Khodaei, “Leveraging Microgrids for Capturing Uncertain Distribution Network Net Load Ramping” (North American Power Symposium, 18-20 Sep. 2016). Department of Energy Office of Electricity Delivery and Energy Reliability, “Summary Report: 2012 DOE Microgrid Workshop” (2012. [Online]. Available: http://energy.gov/sites/prod/files/2012 Microgrid Workshop Report 09102012.pdf). A. Khodaei, “Resiliency-oriented microgrid optimal scheduling” (IEEE Transactions on Smart Grid, vol. 5, no. 4, pages 1584–1591, July 2014). Navigant Research, “Microgrid Deployment Tracker 4Q13; Commercial/Industrial, Community/Utility, Institutional/Campus, Military, and Remote Microgrids: Operating, Planned, and Proposed Projects by World Region,” 2013. Navigant Research, “Microgrid Deployment Tracker 2Q16” ([Online]. Available: https://www.navigantresearch.com/research/microgrid-deployment-tracker-2q16) E. Lannoye, D. Flynn, and M. O’Malley, “Evaluation of power system flexibility” (IEEE Transaction on Power Systems, vol. 27, no. 2, pages 922–931, May 2012). Y. Dvorkin, M. A. Ortega-Vazquez, and D. S. Kirschen, “Assessing flexibility requirements in power systems” (IET Generation, Transmission & Distribution, vol. 8, no. 11, pages 1820-1830, Nov. 2014). A. Khodaei, “Microgrid optimal scheduling with multi-period islanding constraints” (IEEE Transactions on Power Systems, vol. 29, no. 3, pages 1383–1392, May 2014). 6
3cs.SY
1 Optimal load-side control for frequency regulation in smart grids arXiv:1410.2931v3 [math.OC] 17 Nov 2015 Enrique Mallada, Changhong Zhao, and Steven Low Abstract Frequency control rebalances supply and demand while maintaining the network state within operational margins. It is implemented using fast ramping reserves that are expensive and wasteful, and which are expected to grow with the increasing penetration of renewables. The most promising solution to this problem is the use of demand response, i.e. load participation in frequency control. Yet it is still unclear how to efficiently integrate load participation without introducing instabilities and violating operational constraints. In this paper we present a comprehensive load-side frequency control mechanism that can maintain the grid within operational constraints. In particular, our controllers can rebalance supply and demand after disturbances, restore the frequency to its nominal value and preserve inter-area power flows. Furthermore, our controllers are distributed (unlike the currently implemented frequency control), can allocate load updates optimally, and can maintain line flows within thermal limits. We prove that such a distributed load-side control is globally asymptotically stable and robust to unknown load parameters. We illustrate its effectiveness through simulations. I. I NTRODUCTION Frequency control maintains the frequency of a power network at its nominal value when demand or supply fluctuates. It is traditionally implemented on the generation side and consists of three mechanisms that work in concert [1]–[3]. The primary frequency control, called the droop control and completely decentralized, operates on a timescale up to low tens of seconds and uses a governor to adjust, around a setpoint, the mechanical power input to a generator based on the local frequency deviation. The primary control can rebalance power and stabilize the frequency but does not restore the nominal frequency. The secondary frequency control (called automatic generation control or AGC) operates on a timescale up to a minute or so and adjusts the setpoints of governors in a control area in a centralized fashion to drive the frequency back to its nominal value and the inter-area power flows to their scheduled values. Finally, economic dispatch operates on a timescale of several minutes or up and schedules the output levels of generators that are online and the inter-area power flows. See [4], [5] for a recent hierarchical model of power systems and their stability analysis. This work was supported by NSF NetSE grant CNS 0911041, ARPA-E grant de-ar0000226, Southern California Edison, National Science Council of Taiwan R.O.C. grant NSC 103-3113-P-008-001, and Caltech Resnick Institute. The authors are with the Department of Computing + Mathematical Sciences, California Institute of Technology, Pasadena, CA 91125 USA (e-mail: {mallada,czhao,slow}@caltech.edu). 2 Load-side participation in frequency control offers many advantages, including faster response, lower fuel consumption and emission, and better localization of disturbances. The idea of using frequency adaptive loads dates back to [6] that advocates their large scale deployment to “assist or even replace turbine-governed systems and spinning reserve.” They also proposed to use spot prices to incentivize the users to adapt their consumption to the true cost of generation at the time of consumption. Remarkably it was emphasized back then that such frequency adaptive loads will “allow the system to accept more readily a stochastically fluctuating energy source, such as wind or solar generation” [6]. This is echoed recently in, e.g., [7]–[13] that argue for “grid-friendly” appliances, such as refrigerators, water or space heaters, ventilation systems, and air conditioners, as well as plug-in electric vehicles to help manage energy imbalance. Simulations in all these studies have consistently shown significant improvement in performance and reduction in the need for spinning reserves. A small scale project by the Pacific Northwest National Lab in 2006– 2007 demonstrated the use of 200 residential appliances in primary frequency control that automatically reduce their consumption when the frequency of the household dropped below a threshold (59.95Hz) [14]. Although these simulation studies and field trials are insightful, they fall short in predicting the (potential) behavior of a large-scale deployment of frequency control. This has motivated the recent development of new analytic studies assessing the effect of distributed frequency control in power systems [15]–[22], and microgrids [23]–[27], which can be grouped into three main approaches. The first approach builds on consensus algorithms to provide efficiency guarantees to classical PI controllers [15], [16], [24]–[27]. It achieves efficiency but does not manage congestion, i.e., it does not enforce constraints such as thermal limits. The second approach reverse engineers the network dynamics as a primal-dual algorithm of an underlying optimization problem, and then add constraints and modifies the objective function while preserving the primal-dual interpretation of the network dynamics [19]–[22], [28]. It successfully achieves efficiency but it limits the type of operational constraints that can be satisfied. The third approach directly formulates an optimization problem that encodes all operational constraints and then designs a hybrid algorithm that combines the network dynamics with a subset of the primal-dual algorithm [17], [18]. It is able to satisfy operational constraints, but the stability depends on the network parameters. Contributions of this work: In this paper we develop a method to achieve secondary frequency regulation and congestion management (bringing line flows to within their limits), in a distributed manner using controllable loads. To contrast with the generation-side AGC frequency control, we refer to our solution as load-side control. To our knowledge, this method produces the first distributed controllers for demand response that are scalable and enforce required operational constraints for frequency regulation, such as restoring nominal frequency and preserving inter-area flows, while respecting line limits. Our work builds on previous optimization-based approaches [17]–[22], [28]. The crux of our solution is the introduction of virtual (line) flows that can be used to implicitly constrain real flows without altering the primaldual interpretation of the network dynamics. A virtual flow is a cyber quantity on each line that a controller computes based on information from its neighbors. In steady state, its value equals the actual line flows incident 3 on that controller. This device allows us to impose arbitrary constraints on the (actual) line flows for congestion management and restoring inter-area flows, while retaining the ability to exploit network dynamics to help carry out the primal-dual algorithm. Our contribution with respect to the existing literature is manifold. Unlike [16]–[18], our global asymptotic stability result (Theorem 10 in Section IV) is independent of the controller gains, which is highly desirable for fully distributed deployments. Our results hold for arbitrary topologies, in contrast with [17], [25], and can impose inter-area constraints, thermal limits or any linear equality or inequality constraint in the line flows. Moreover, we provide a convergence analysis in the presence of unknown parameters (Section V) that is novel in the primal-dual literature and provides the necessary robustness for large scale distributed deployments. Finally, our framework can further extend to include intermediate buses without generators or loads – quite common in transmission networks – which are not considered by the existing literature, and to fully distribute non-local constraints like those imposed on inter-area flows (Section VI). A preliminary version of this work has been presented in [29]. This paper extends [29] in several ways. First, the robustness study of our controllers with respect to uncertain load parameter (Section V) as well as the framework extensions (Section VI) are new. Second, we include detailed proofs that were omitted in [29] due to space constraints. Finally, we extend our simulations in Section VII to further illustrate the conservativeness of the uncertainty bounds of Theorem 14. II. P RELIMINARIES Let R be the set of real numbers and N the set of natural numbers. Given a finite set S ⊂ N we use |S| to denote its cardinality. For a set of scalar numbers ai ∈ R, i ∈ S, we denote aS to its column vector, i.e. aS := (ai )i∈S ∈ R|S| ; we usually drop the subscript S when the set is known from the context. For two vectors a ∈ R|S| and b ∈ R|S 0 | 0 we define the column vector x = (a, b) ∈ R|S|+|S | . Given a matrix A, we denote its transpose as AT and use Ai to denote the ith row of A. We will also use AS to denote the sub matrix of A composed only of the rows Ai with i ∈ S. The diagonal matrix of a sequence {ai , i ∈ S} is represented by diag(ai )i∈S . Similarly, for a sequence of matrices {Ah , h ∈ S} we let blockdiag(Ah )h∈S denote the block diagonal matrix. Finally, we use either 1n and 1n×m (0n and 0n×m ) to denote the vector and matrix of all ones (zeros), or 1 (0) when its dimension is understood from the context. For a function f : Rn → Rn we use f 0 (x) := When n = 1, f 00 (x) denotes the second derivative ∂ ∂x f (x) to denote the Jacobian and f −1 to denote its inverse. 2 ∂ ∂x2 f (x). For given vectors u ∈ Rn and a ∈ Rn , and set S ⊆ {1, . . . , n}, the operator [a]+ uS is defined element-wise by   [ai ]+ if i ∈ S, ui , ([a]+ ) = (1) uS i  ai , if i 6∈ S, ∗ where [ai ]+ ui is equal to ai if either ai > 0 or ui > 0, and 0 otherwise. Whenever uS ≥ 0, the following relation holds: ∗ T (uS − u∗S )T [aS ]+ uS ≤ (uS − uS ) aS (2) 4 since for any pair (ui , ai ), with i ∈ S, that makes the projection active ([ai ]+ ui = 0) we must have ui ≤ 0 and ai ≤ 0, and therefore (ui − u∗i )ai ≥ 0 = (ui − u∗i )T [ai ]+ uS . A. Network Model We consider a power network described by a directed graph G(N , E) where N = {1, ..., |N |} is the set of buses, denoted by either i or j, and E ⊂ N × N is the set of transmission lines denoted by either e or ij such that if ij ∈ E, then ji 6∈ E. We partition the buses N = G ∪ L and use G and L to denote the set of generator and load buses respectively. We assume that a generator bus may also have loads attached to it, but not otherwise. We assume the graph G(N , E) is connected, and make the following assumptions which are standard and well-justified for transmission networks [30]: (i) Bus voltage magnitudes |Vi | = |Vj | = 1pu for i, j ∈ N . (ii) Lines ij ∈ E are lossless and characterized by their susceptances Bij > 0. (iii) Reactive power flows do not affect bus voltage phase angles and frequencies. The evolution of the transmission network is described by i∈N (3a) j∈Ni Bij (θi −θj ) i∈G (3b) P 0 = Piin−(di +Di ωi )− j∈Ni Bij (θi −θj ) i∈L (3c) θ̇i = ωi Mi ω̇i = Piin−(di +Di ωi )− P where di denotes an aggregate controllable load, Di ωi denotes the aggregate frequency sensitive consumption due to uncontrollable but frequency-sensitive loads and/or generators’ damping loss. Mi denotes the generator’s inertia, and Piin is the difference between mechanical power injected by a generator and the constant aggregate power consumed by loads. Notice that for load buses (i ∈ L) Piin < 0. Equation (3) represents the standard swing equations when the bus frequency ωi and phase θi are close to nominal values ω 0 and θi0 .1 Given (3), however, our results hold for arbitrary ωi and θi . By letting Pe = Pij := Bij (θi −θj ) for e = ij ∈ E, we can equivalently rewrite (3) as Mi ω̇i = Piin − (di + Di ωi ) − P Ci,e Pe i∈G (4a) 0 = Piin − (di + Di ωi ) − P Ci,e Pe i∈L (4b) ij ∈ E (4c) Ṗij = Bij (ωi − ωj ) e∈E e∈E where Ci,e are the elements of the incidence matrix C ∈ R|N |×|E| of the graph G(N , E) such that Ci,e = −1 if e = ji ∈ E, Ci,e = 1 if e = ij ∈ E and Ci,e = 0 otherwise, and the line flows initial condition must satisfy Pij (0) = Bij (θi0 − θj0 ). Remark 1. Our model assumes that every bus has both Di > 0 and controllable load di . While this is reasonable for load and generator buses (for i ∈ G the generator can implement −di ), it is unreasonable for intermediate 1 Without loss of generality, we take here ω0 = 0. 5 buses that have neither generators nor loads. This is addressed in Section VI. Our framework can also handle the case where di is present only for i ∈ S ⊂ N . This case is omitted due to space constraints. B. Operational Constraints We denote each control area using k and let K := {1, . . . , |K|} be the set of all areas in the network. Let Nk ⊆ N be set of buses in area k and Bk ⊆ E the set of boundary edges of area k, i.e. ij ∈ Bk iff either i ∈ Nk or j ∈ Nk , but not both. Within each area, the AGC scheme seeks to restore the frequency to its nominal value and preserve a constant power transfer outside the area, i.e. P ij∈Bk Ĉk,ij Pij = P̂k (5) where Ĉk,ij is equal to 1, if i ∈ Nk , −1, if j ∈ Nk , and P̂k is the net scheduled power injection of area k. By defining Ĉk,ij to be 0 whenever ij 6∈ Bk we can also relate Ĉ ∈ R|K|×|E| with C ∈ R|N |×|E| using Ĉ = EK C (6) where EK := [e1 . . . e|K| ]T and ek ∈ R|N | , k ∈ K, is a vector with elements (ek )i = 1 if i ∈ Nk and (ek )i = 0 otherwise. Finally, the thermal limit constraints are usually given by P ≤P ≤P (7) where P := (Pe )e∈E , P := (P e )e∈E and P := (P e )e∈E represent the line flow limits; i.e. P = −P so that |P | ≤ P . III. O PTIMAL LOAD - SIDE CONTROL Suppose the system (4) is in equilibrium, i.e. ω̇i = 0 for all i and Ṗij = 0 for all ij, and at time 0, there is a disturbance, represented by a step change in the vector P in := (Piin )i∈N , that produces a power imbalance. Then, we are interested in designing a distributed control mechanism that rebalances the system, restores the frequency to its nominal value while maintaining the operational constraints of Section II-B. Furthermore, we would like this mechanism to produce an efficient allocation among all the users (or loads) that are willing to adapt. We use ci (di ) to denote the cost or disutility of changing the load consumption by di . This allows us to formally describe our notion of efficiency in terms of the loads’ power share. More precisely, we shall say that a load control is efficient if in equilibrium solves the Optimal Load Control (OLC) problem: Problem 1 (OLC). minimize d,ω,θ X ci (di ) (8a) i∈N subject to P in − (d + Dω) = LB θ (8b) 6 ω=0 (8c) ĈBC T θ = P̂ (8d) P ≤ BC T θ ≤ P (8e) where d = (di )i∈N , ω = (ωi )i∈N , θ = (θi )i∈N , D = diag(Di )i∈N , B = diag(Bij )ij∈E , (BC T θ)ij = Bij (θi − θj ) and LB := CBC T is the Bij -weighted Laplacian matrix. Throughout this paper we make the following assumptions: Assumption 1 (Cost function). The cost function ci (di ) is α-strongly convex and second order continuously differentiable (ci ∈ C 2 with c00i (di ) ≥ α > 0) in the interior of its domain Di := [di , di ] ⊆ R, such that ci (di ) → +∞ whenever di → ∂Di . Assumption 2 (Strict feasibility in D). The OLC problem (9) is feasible and there is at least one feasible (d, ω, θ) |N | such that d ∈ Int D := Πi=1 Int Di . Assumption 2 guarantees that, even in the presence of Assumption 1, the optimal solution of OLC is finite, and therefore allows us to use the KKT conditions [31, Ch. 5.2.3] to characterize it. Problem 1 is convex and therefore can be efficiently solved using several optimization algorithms. However, unlike standard optimization problems, we can only modify the loads di while θi and ωi react to these changes according to (3). We overcome these restrictions by formulating an equivalent optimization problem whose primaldual optimization algorithm embeds the line flow version of the swing equations (4). A. Virtual Flows Reformulation We now proceed to describe the optimization problem that will be used to derive the distributed controllers that achieve our goals. The crux of our solution comes from implicitly imposing the constraints (8c)-(8e) by using virtual flows instead of explicitly using ωi and θi . This, together with an additional quadratic objective on ωi and substituting Bij (θi − θj ) with Pe in (8b), allows us to embed the network dynamics as part of the primal-dual algorithm while preserving all the desired constraints. Problem 2 (VF-OLC). minimize d,ω,φ,P Di ωi 2 2 (9a) P in − (d + Dω) = CP (9b) X i∈N ci (di )+ subject to P in − d = LB φ (9c) ĈBC T φ = P̂ (9d) 7 P ≤ BC T φ ≤ P (9e) where φ = (φi )i∈N represents the virtual phases and (BC T φ)ij = Bij (φi − φj ) is the corresponding virtual flow through line ij ∈ E. Although not clear at first sight, the constraint (9c) implicitly enforces that any optimal solution of VF-OLC (d∗ , ω ∗ , φ∗ , P ∗ ) will restore the frequency to its nominal value, i.e. ωi∗ = 0. Thus the additional term on the objective function does not influence the optimal solution. Similarly, we will use constraint (9d) to impose (8d) and (9e) to impose (8e). − We use νi , λi and πk to denote the Lagrange multipliers of constraints (9b), (9c) and (9d), and ρ+ ij and ρij as multipliers of the right and left constraints of (9e), respectively. In order to make the presentation more compact sometimes we will use x = (φ, P ) ∈ R|N |+|E| and σ = (λ, ν, π, ρ+ , ρ− ) ∈ R2|N |+|K|+2|E| , as well as ρ := (ρ+ , ρ− ). Using this notation we can write the Lagrangian of VF-OLC as ã XÅ Di ωi 2 + ν T (P in − (d + Dω) ci (di ) + L(d, ω, x, σ) = 2 i∈N − CP ) + λT (P in − d − LB φ) + π T (ĈBC T φ − P̂ ) + ρ+T (BC T φ − P ) + ρ−T (P − BC T φ) X = ci (di )−(λi + νi )di +Di ωi (ωi /2 − νi )+(νi + λi )Piin i∈N − P T C T ν − φT (LB λ − CB Ĉ T π − CB(ρ+ − ρ− )) − π T P̂ − ρ+T P + ρ−T P (10) The next lemmas characterize the optimality conditions of VF-OLC and its equivalence with OLC. Their proofs can be found in the Appendix. Lemma 2 (Optimality). Let G(N , E) be a connected graph. Then (d∗ , ω ∗ , φ∗ , P ∗ , σ ∗ ) is a primal-dual optimal solution to VF-OLC if and only if (d∗ , ω ∗ , φ∗ , P ∗ ) is primal feasible, ρ+∗ , ρ−∗ ≥ 0, ∗ ∗ ∗ ωi∗ = νi∗ , d∗i = c0−1 i (νi + λi ), νi = ν̂, i ∈ N , (11) where c0−1 is the inverse of the derivative of ci , ν̂ is some scalar, i P j∈Ni Bij (λ∗j − λ∗i ) + Ci B(Ĉ T π ∗ + ρ+∗ − ρ−∗ ) = 0 (12) with Ci being the ith row of C, and ∗ ∗ ρ+∗ ij (Bij (φi − φj ) − P ij ) = 0, ij ∈ E, (13a) ∗ ∗ ρ−∗ ij (P ij − Bij (φi − φj )) = 0, ij ∈ E. (13b) Moreover, d∗ , ω ∗ , ν ∗ and λ∗ are unique with ωi∗ = νi∗ = ν̂ = 0. 8 Lemma 3 (OLC and VF-OLC Equivalence). Given any set of vectors (d∗ , ω ∗ , θ∗ , φ∗ , P ∗ ) satisfying C T θ∗ = C T φ∗ and LB θ∗ = CP ∗ . Then (d∗ , ω ∗ , θ∗ ) is an optimal solution of OLC if and only (d∗ , ω ∗ , φ∗ , P ∗ ) is an optimal solution to VF-OLC. B. Distributed Optimal Load-side Control We now show how to leverage the power network dynamics to solve the OLC problem in a distributed way. Our solution is based on the classical primal dual optimization algorithm that has been of great use to design congestion control mechanisms in communication networks [32]–[35]. Since by Lemma 3, VF-OLC provides the same optimal load schedule as OLC, we can solve VF-OLC instead. This will allow us to incorporate the network dynamics as part of an optimization algorithm that indirectly solves OLC. To achieve this goal we first minimize (10) over d and ω which is achieved by setting ωi = νi and di = 0 ci−1 (νi + λi ) in (10). Thus we get L(x, σ) = minimize L(d, ω, x, σ) d,ω = ΦN (λ, ν) − P T C T ν − π T P̂ − ρ+T P + ρ−T P − φT (LB λ − CDB Ĉ T π − CDB (ρ+ − ρ− )) where ΦS (λS , νS ) := P i∈S (14) Φi (λi , νi ) and Φi (λi , νi ) :=ci (di (λi + νi )) − (λi + νi )di (λi + νi ) − Di νi2 + (λi + νi )Piin . 2 (15) The strict convexity of L(d, ω, x, σ) on (d, ω) and the fact that d and ω only appear in (9b) and (9c) gives rise to the following lemma whose proof is also in the Appendix. Lemma 4 (Strict concavity of L(x, σ) in (λ, ν)). The function Φi (λi , νi ) in (15) is strictly concave. As a result, L(x, σ) is strictly concave in (λ, ν). Next we reduce the Lagrangian L(x, σ) by maximizing it for any νi with i ∈ L. We let y = (λ, νG , π, ρ+ , ρ− ) and consider the Lagrangian L(x, y) = maximize L(x, σ). νi :i∈L (16) Since L(x, σ) is strictly concave in ν by Lemma 4, the minimizer of (16) is unique. Moreover, this also implies that L(x, y) is strictly concave in (λ, νG ). Finally, the optimal load controllers can be then obtained by considering the primal-dual gradient law of L(x, y) which is given by ï ẏ = Y ∂ L(x, y)T ∂y ò+ and ẋ = −X ρ ∂ L(x, y)T ∂x (17) 9 − + φ where Y = diag((ζiν )i∈G , (ζiλ )i∈N , (ζkπ )k∈K , (ζeρ )e∈E , (ζeρ )e∈E ) and X = diag((χP e )e∈E , (χi )i∈N ), and the projection [·]+ ρ is defined as in (1) for u = y and uS = ρ. This projection ensures that the vector ρ(t) remains within the positive orthant, that is ρ+ (t) ≥ 0 and ρ− (t) ≥ 0 ∀t. The following theorem shows that this procedure indeed embeds the network dynamics as part of the primal-dual law (17) while providing a distributed scheme to solve OLC. Theorem 5 (Optimal Load-side Control). By setting ζiν = Mi−1 , χP ij = Bij and νi = ωi , the primal-dual gradient law (17) is equivalent to the power network dynamics (4) together with   P λ̇i = ζiλ Piin − di − j∈Ni Bij (φi − φj ) P  π̇k = ζkπ Ĉ B (φ − φ ) − P̂ k,ij ij i j k ij∈Bk (18a) (18b) + ρ+  ρ̇+ ij = ζij Bij (φi − φj ) − P ij ρ+ (18c)  + ρ− ij P ρ̇− ij − Bij (φi − φj ) ρ− ij = ζ ij  P φ P φ̇i = χi j∈Ni Bij (λi −λj )− k∈K,e∈Bk Ci,e Be Ĉk,e πk  P − ) − ρ − e∈E Ci,e Be (ρ+ e e (18d) ij di = c0i −1 (18e) (λi + ωi ) (18f) where (18a), (18e) and (18f) are for i ∈ N , (18b) is for k ∈ K, and (18c) and (18d) are for ij ∈ E. Proof: By Lemma 4 and (14), L(x, σ) is strictly concave in (λ, ν). Therefore, it follows that there exists a unique νL∗ (x, y) = arg max L(x, σ). (19) νL Moreover, by stationarity, νL∗ (x, y) must satisfy ∂ΦL ∂L (x, y, νL∗ (x, y))T = (λL , νL∗ (x, y))T − CL P ∂νL ∂νL (20a) = PLin −DL νL∗ (x, y)−dL (λL +νL∗ (x, y))−CL P = 0 (20b) which is equivalent to (4b), i.e. νL∗ (x, y) implicitly satisfies (4b). ∂ ∂x L(x, y) We now iteratively apply the envelope theorem [36] on L(x, y) (16) to compute example, to compute ∂ ∂x L(x, y) and ∂ ∂y L(x, y). For we use ∂ ∂ L(x, y) = L(x, σ) ∂x ∂x ∗ (x,y) νL =νL Ç å ∂ = L(d, ω, x, σ) ∂x (d,ω)=(c0−1 (λ+ν),ν) (21a) , (21b) ∗ (x,y) νL =νL where c0−1 (λ + ν) := (c0−1 i (λi + νi ))i∈N , which leads to ∂ L(x, y)T = −(CGT νG + CLT νL∗ (x, y)) ∂P (22a) 10 Power Network Dynamics d (ω, P ) ω .. . 0 + di (λi +ωi ) .. . 0 + λ Distributed Load Control d (λ, π, ρ+ , ρ− , φ) Fig. 1: Control architecture derived from OLC ∂ L(x, y)T = −(LB λ − CB(Ĉ T π + ρ+ − ρ− )) ∂φ An analogous computation for ∂ ∂y L(x, y) (22b) gives ∂ L(x, y)T ∂νG ∂ L(x, y)T ∂λ ∂ L(x, y)T ∂π ∂ L(x, y)T ∂ρ+ ∂ L(x, y)T ∂ρ− = P in − (dG (λG + νG ) + DνG ) − CP (23a) = P in − d(λ + ν)|νL =ν ∗ (x,y) − LB φ (23b) = ĈBC T φ − P̂ (23c) = BC T φ − P (23d) = P − DB C T φ (23e) L where, for a set S, we dS (λS + νS ) := (di (λi + νi ))i∈S and d(λ + ν) = dN (λN + νN ). Using (22)-(23) and identifying ωi in (4) and (18) with νi in (17), it is easy to see that (17) only differs from (4a),(4c) and (18) on the locations where ωL must be substituted with νL∗ (x, y). However, since there is a unique ωL that satisfies (4b) given the remaining state variables, and we showed that νL∗ (x, y) also satisfies (4b), then it follows that (17) and (4) with (18) are equivalent representations of the same system. Equations (4) and (18) show how the network dynamics can be complemented with dynamic load control such that the whole system amounts to a distributed primal-dual algorithm that tries to find a saddle point on L(x, y). We will show in the next section that this system does achieve optimality as intended. Figure 1 shows the unusual control architecture derived from our OLC problem. Unlike traditional observer-based controller design architecture [37], our dynamic load control block does not try to estimate the state of the network. Instead, it drives the network towards the desired state using a shared static feedback loop, i.e. di (λi + ωi ). Finally, Figure 2 shows the communication requirements to implement our distributed load control (18). The 11 Area 1 Area 2 Fig. 2: Power network example (left) and the corresponding communication requirement to implement the distributed load control (18) only state that cannot be computed distributedly is πk as it requires information from all boundary buses of area k and their adjacent buses outside k. This limitation is overcome in Section VI-B by modifying (8d) in Problem 1. Remark 6. One of the limitations of (18) is that in order to generate the Lagrange multipliers λi one needs to estimate Piin − di which is not easy to obtain from the measurements of Piin − Di ωi − di without knowing Di . This problem will be addressed in Section V where we propose a modified control scheme that can achieve the same equilibrium without needing to know Di exactly. Remark 7. The procedure described in this section is independent of the constraints (8d)-(8e). Therefore, such constraints can be generalized to arbitrary equality and inequality constraints on the line flows BC T θ. This property will be exploited in Section VI to further extend our framework. IV. O PTIMALITY AND C ONVERGENCE In this section we will show that the system (4) and (18) can efficiently rebalance supply and demand, restore the nominal frequency, and preserve inter-area flow schedules and thermal limits. We will achieve this objective in two steps. Firstly, we will show that every equilibrium point of (4) and (18) is an optimal solution of (9), or equialently (8). This guarantees that a stationary point of the system efficiently balances supply and demand and achieves zero frequency deviation. 12 Secondly, we will show that every trajectory (d(t), ω(t), φ(t), P (t), λ(t), π(t), ρ+ (t), ρ− (t)) converges to an equilibrium point of (4) and (18). Moreover, we will show that since P (0) = BC T θ0 (as shown in Section II-A), the line flows will converge to a point that satisfies (5) and (7). Theorem 8 (Optimality). A point p∗ := (d∗ , ω ∗ , φ∗ , P ∗ , λ∗ , π ∗ , ρ+∗ , ρ−∗ ) is an equilibrium point of (4) and (18) if and only if (d∗ , ω ∗ , θ∗ ) is an optimal solution of OLC and (d∗ , ω ∗ , φ∗ , P ∗ , λ∗ , ν ∗ , π ∗ , ρ+∗ , ρ−∗ ) is a primal-dual optimal solution to the VF-OLC problem, with ω ∗ = ν ∗ , CP ∗ = LB θ∗ and C T θ∗ = C T φ∗ . (24) Proof: The proof of this theorem is a direct application of lemmas 2 and 3. Let p∗ be an equilibrium of (4) +∗ and (18). Then, by definition of the projection [·]+ ≥ 0 and ρ−∗ ≥ 0 and thus dual feasible. ρ and (18c)-(18d), ρ − Similarly, since ω̇i = 0, λ̇i = 0, π̇k = 0, ρ̇+ ij = 0 and ρ̇ij = 0, then (4a)-(4b) and (18a)-(18d) are equivalent to primal feasibility, i.e. (d∗ , ω ∗ , φ∗ , P ∗ ) is a feasible point of (9). Finally, by definition of (4) and (18), conditions (11), (12) and (13) are always satisfied by any equilibrium point. Thus we are under the conditions of Lemma 2 and therefore (d∗ , ω ∗ , φ∗ , P ∗ , λ∗ , ν ∗ , π ∗ , ρ+∗ , ρ−∗ ) is primal-dual optimal of VF-OLC satisfying (24). Lemma 3 shows the remaining statement of the theorem. The rest of this section is devoted to showing that in fact for every initial condition (ω(0), φ(0), P (0), λ(0), π(0), ρ+ (0), ρ− (0)), the system (4) and (18) converges to one such optimal solution. Furthermore, we will show that P (t) converges to a P ∗ that satisfies (5) and (7). Since we showed in Theorem 5 that (4) and (18) is equivalent to (17), we will provide our convergence result for (17). Our global convergence proof builds on recent results of [38] on global convergence of primal-dual algorithms for network flow control. Our proof extends [38] in the following aspects. Firstly, the Lagrangian L(x, y) is not strictly concave in all of its variables. Secondly, the projection (1) introduces discontinuities in the vector field that prevents the use of the standard LaSalle’s Invariance Principle [39]. We solve the latter issue using an invariance principle for Caratheodory systems [40]. We refer the reader to [41] for a detailed treatment that formalizes its application for primal-dual systems. The former issue is solved in Theorem 10 which makes use of the following additional lemma whose proof can be found in the Appendix. Lemma 9 (Differentiability of νL∗ (x, y)). Given any (x, y), the maximizer of (16), νL∗ (x, y), is continuously differentiable provided ci (·) is strongly convex. Furthermore, the derivative is given by φ ∂ ∗ î ν (x, y) = 0 ∂x L P −(DL + d0L )−1 CL λ L ∂ ∗ î νL (x, y) = −(DL +d0L )−1 d0L ∂y λG 0 ó (25) νL νG π ρ 0 0 0 ó νL (26) 13 where DS := diag(Di )i∈S and d0S =   diag(d0 (λi + ν ∗ (x, y)))i∈S if S ⊆ L  diag(d0 (λi + νi ))i∈S if S ⊆ G i i i We now present our main convergence result. Let E be the set of equilibrium points of (17) ´ ® ï ò+ ∂L ∂L E := (x, y) : (x, y) = 0, (x, y) = 0 , ∂x ∂y ρ which by theorems 5 and 8 characterizes the set of optimal solutions of the OLC problem. Theorem 10 (Global Convergence). The set E of equilibrium points of the primal-dual algorithm (17) is globally asymptotically stable. Furthermore, each individual trajectory converges to a unique point within E that is optimal with respect to the OLC problem. Proof: Following [38] we consider the candidate Lyapunov function 1 1 U (x, y) = (x−x∗ )T X −1 (x−x∗ )+ (y − y ∗ )T Y −1 (y−y ∗ ) 2 2 (27) where (x∗ , y ∗ ) is any equilibrium point of (17). We divide the proof of this theorem in four steps: Step 1: We first use the invariance principle for Caratheodory systems [40] to show that (x(t), y(t)) converges to the largest invariance set that satisfies U̇ (x, y) ≡ 0 between transitions of the projection [·]+ ρ , i.e. (x(t), y(t)) → M ⊆ {(x, y) : U̇ (x(t), y(t)) ≡ 0, t ∈ R+ \{tk }} (28) where {tk , k ∈ N} are the time instants when the projection changes between on and off. Step 2: We show that any invariant trajectory (x(t), y(t)) ∈ M must have λ(t) ≡ λ̂ and ν(t) ≡ ν̂ for some constant vectors λ̂ and ν̂. Step 3: We show that whenever λ(t) ≡ λ̂ and ν(t) ≡ ν̂, then whole trajectory (x(t), y(t)) must an equilibrium point, i.e. M ⊆ E. Step 4: Finally, we show that even though the invariance principle guarantees only convergence to the set E. The convergence is always to some point within E, i.e. (x(t), y(t)) → (x∗ , y ∗ ) ∈ E. Proof of step 1: Differentiating U over time gives ï ò+ ∂ ∂ ∗ U̇ (x, y) = − L(x, y)(x−x )+ L(x, y) (y−y ∗ ) ∂x ∂y ρ (29) ∂L ∂L (x, y)(x∗ − x) + (x, y)(y − y ∗ ) ∂x ∂y (30) ≤ L(x∗ , y) − L(x, y) + L(x, y) − L(x, y ∗ ) (31) ≤ = L(x∗ , y) − L(x, y ∗ ) = L(x∗ , y) − L(x∗ , y ∗ ) + L(x∗ , y ∗ ) − L(x, y ∗ ) | {z } | {z } ≤0 ≤0 (32) 14 where (29) follows from (17) and (30) from (2). Step (31) follows from convexity (resp. concavity) of L(x, y) in x (resp. y). Finally, equation (32) follows from the saddle property of the equilibrium point (x∗ , y ∗ ). Therefore, since U (x, y) is radially unbounded, the trajectories are bounded, and it follows from the invariance principle for Caratheodory systems [40] that (x(t), y(t)) → M , i.e. (28) holds. The steps 2 and 3 below basically characterize M . Proof of step 2: Notice that in order to have U̇ ≡ 0, both terms in (32) must be zero. In particular, we must have L(x(t), y ∗ ) ≡ L(x∗ , y ∗ ). Now, differentiating with respect to time gives ∂ ∂ ˙ 0 ≡ L(x(t), y ∗ ) ≡ L(x(t), y ∗ )ẋ ≡ −|| L(x(t), y ∗ )||2 , ∂x ∂x which implies that ∂ ∗ ∂x L(x(t), y ) Therefore, the fact that νG∗ = 0, ≡ 0. ∂ ∂P L(x(t), y ∗ ) ≡ 0, and (22a) holds, implies that x(t) must satisfy CLT νL∗ (x(t), y ∗ ) ≡ 0, which implies that either νL∗ (x(t), y ∗ ) ≡ 0 (when CL is full row rank) or νL∗ (x(t), y ∗ ) ≡ 1α(t) (when L = N ) where α(t) is a time-varying scalar. We now show that when L = N we get νL∗ (x(t), y ∗ ) ≡ ν̂L for some constant vector ν̂L . Differentiating νL∗ (x(t), y ∗ ) ≡ 1α(t) with respect to time and using (25) we obtain (DL + d0L )−1 CL Ṗ ((t) ≡ 1α̇(t) which after left multiplying by 1T (DL + d0L ) gives 1T (DL + d0L )1α̇(t) ≡ 0 =⇒ α̇(t) ≡ 0. Thus, in either case we obtain νL∗ (x(t), y ∗ ) = νL∗ (CL P (t), λ∗L ) ≡ ν̂L (33) for some constant vector ν̂L , which implies that CL P (t) ≡ CL P̂ for some constant vector P̂ . Therefore, it follows that νL∗ (x(t), y(t)) must satisfy νL∗ (x(t), y(t)) ≡ νL∗ (x̂, y(t)) (34) for some constant vector x̂. Now, using (20) with (34) we get PLm − DL νL∗ (x̂, y(t)) − dL (λL (t) + νL∗ (x̂, y(t))) − CL P̂ ≡ 0. A similar argument using the fact that L(x∗ , y) ≡ L(x∗ , y ∗ ) gives ï ò+ ∂ ∂ ≡ 0. L(x∗ , y) L(x∗ , y)T ∂y ∂y ρ (35) (36) 15 Since the projection [·]+ ρ only acts on the ρ positions, (36) implies ∂ ∗ ∂π L(x , y) Now ∂ ∗ ∂νG L(x , y) ≡ 0, ∂ ∗ ∂λ L(x , y) ≡ 0. ∂ ∗ ∂νG L(x , y) ≡ 0 together with equation (23a) implies that PGm − DG νG (t) − dG (λG (t) + νG (t)) − CG P ∗ ≡ 0, and ≡ 0 and ∂ ∗ ∂λ L(x , y) (37) ≡ 0 with (23b) implies PGm − dG (λG (t) + νG (t)) − CG P ∗ ≡ 0 (38) PLm − dL (λL (t) + νL∗ (x∗ , y(t))) − CL P ∗ ≡ 0 (39) Using (37) and (38) together with the fact that di (·) is strictly increasing, we get νG (t) ≡ ν̂G and λG (t) ≡ λ̂G , for constant vectors ν̂G and λ̂G . Moreover, since P ∗ is primal optimal, Lemma 5 and Theorem 8 imply that νG (t) ≡ 0 and λG (t) ≡ λ∗G . Finally, now using (35) together with (39), the same argumentation gives νL∗ (x(t), y(t)) ≡ ν̂L and λL (t) ≡ λ̂L for constant vectors ν̂L and λ̂L . This finishes step 2, i.e. λ(t) ≡ λ̂ and ν(t) ≡ ν̂. Proof of step 3: Now, since λ̇ ≡ 0, it follows from (18a) that C T φ(t) ≡ C T φ̂ for some constant vector φ̂ or P equivalently φ(t) ≡ φ̂ + β(t)1. Differentiating in time 1T (χφ )−1 φ(t) gives 0 ≡ 1T (χφ )−1 φ̇ ≡ ( i∈N 1/χφi )β̇ which implies that β(t) ≡ β̂ for constant scalar β̂. Suppose now that either Ṗ 6= 0 or π̇ 6= 0. Since C T φ(t) ≡ C T φ̂ and ν(t) ≡ ν̂, Ṗ and π̇ are constant. Thus, since the trajectories are bounded, we must have Ṗ ≡ 0 and π̇ ≡ 0; otherwise U (x, y) will grow unbounded (contradiction). It remains to show that ρ̇ ≡ 0, i.e. ρ̇+ ≡ ρ̇− ≡ 0. Since φ(t) ≡ φ̂, then the argument inside (18c) and (18d) is constant. Now consider any ρ+ e , e = ij ∈ E. Then we have three cases: (i) Be (φ̂i − φ̂j )− P̄e > 0, (ii) Be (φ̂i − φ̂j )− P̄e < 0 and (iii) Be (φ̂i − φ̂j ) − P̄e = 0. Case (i) implies ρ+ e (t) → +∞ which cannot happen since the trajectories are + + bounded. Case (ii) implies that ρ+ e (t) ≡ 0 which implies that ρ̇e ≡ 0, and case (iii) also implies ρ̇e ≡ 0. An analogous argument gives ρ̇− ≡ 0. Thus, we have shown that M ⊆ E. Proof of step 4: We now use structure of U (x, y) to achieve convergence to a single equilibrium. Since (x(t), y(t)) → M and (x(t), y(t)) are bounded, then there exists an infinite sequence of time values {tk } such that (x(tk ), y(tk )) → (x̂∗ , ŷ ∗ ) ∈ M . Thus, using this specific equilibrium (x̂∗ , ŷ ∗ ) in the definition of U (x, y), it follows that U (x(tk ), y(tk )) → 0, which by continuity of U (x, y) implies that (x(t), y(t)) → (x̂∗ , ŷ ∗ ). Thus, it follows that (x(t), y(t)) converges to only one optimal solution within M ⊆ E. Finally, the following theorem shows that the system is able to restore the inter-area flows (5) and maintain the line flows within the thermal limits (7). Theorem 11 (Inter-area Constraints and Thermal Limits). Given any primal-dual optimal solution (x∗ , σ ∗ ) ∈ E, the optimal line flow vector P ∗ satisfies (5). Furthermore, if P (0) = BC T θ0 for some θ0 ∈ R|N | , then Pij∗ = Bij (φ∗i − φ∗j ) and therefore (7) holds. 16 Proof: By optimality, P ∗ and φ∗ must satisfy P m − d∗ = CP ∗ = LB φ∗ = CBC T φ∗ (40) Therefore using primal feasibility, (6) and (40) we have P̂ = ĈBC T φ∗ = EK CBC T φ∗ = EK CP ∗ = ĈP ∗ which is exactly (5). Finally, to show that Pij∗ = Bij (φ∗i − φ∗j ) we will use (4c). Integrating (4c) over time gives Z t BC T ν(s)ds. P (t) − P (0) = 0 Therefore, since P (t) → P ∗ , we have P ∗ = P (0) + BC T θ∗ where θ∗ is any finite vector satisfying C T θ∗ = R∞ T C ν(s)ds. 0 Again by primal feasibility CBC T φ∗ = LB φ∗ = CP ∗ = C(P (0) + BC T θ∗ ) = CBC T (θ0 + θ∗ ). Thus, we must have φ∗ = (θ0 + θ∗ ) + α1 and it follows then that P ∗ = BC T (θ0 + θ∗ ) = BC T (φ∗ − α1) = BC T φ∗ . Therefore, since by primal feasibility P ≤ BC T φ∗ ≤ P̄ , then P ≤ P ∗ ≤ P̄ . V. C ONVERGENCE UNDER UNCERTAINTY In this section we discuss an important aspect of the implementation of the control law (18). We provide a modified control law that solves the problem raised in Remark 6, i.e. that does not require knowledge of Di . We show that the new control law still converges to the same equilibrium provided the estimation error of Di is small enough (c.f. (48)). We propose an alternative mechanism to compute λi . Instead of (18a), we consider the following control law:   X X λ̇i = ζiλ Mi ω̇i +ai ωi + Ci,e Pe − Bij (φi −φj ) (41a) e∈E j∈Ni where Mi := 0 for i ∈ L and ai ∈ R is a positive controller parameter that can be arbitrarily chosen. Notice that, while before Di was an unknown quantity, Mi is usually known and ai is a design parameter. Furthermore, while equation (41a) requires the knowledge of ω̇i , this is only needed on generator buses and can therefore be measured from the generator’s shaft angular acceleration using one of several existing mechanisms, see e.g. [42]. The parameter ai plays the role of Di . In fact, whenever ai = Di then one can use (4a)-(4b) to show that (41a) is the same as (18a). More precisely, if we let ai = Di + δai , then using (4a)-(4b), (41a) becomes   X λ̇ = ζiλ Piin −di +δai ωi − Bij (φi −φj ) , (42) j∈Ni which is equal to (18a) when δai = 0. A simple equilibrium analysis shows that ai does not affect the steady state behavior provided that ai 6= 0 for some i ∈ N . Thus, we focus in this section on studying the stability of our modified control law. Using (42), we can express the new system using ẋ = −X ∂ L(x, y)T ∂x (43a) 17 ï ẏ = Y where g(x, y) := î ò+ ∂ L(x, y)T + g(x, y) ∂y ρ λL λG (43b) (νG , π, ρ) (δAL νL∗ )T (δAG νG )T ó 0 (44) T with νL∗ := νL∗ (x, y) and δAS := diag(δai )i∈S . The system (43) is no longer a primal-dual algorithm. The main result of this section shows, that under provided that ai does not depart significantly from Di (see (48)), convergence to the optimal solution is preserved. To show this result, we provide a novel convergence proof that makes use of the following lemmas whose proofs can be found in the Appendix. Lemma 12 (Second order derivatives of L(x, y)). Whenever Lemma 9 holds, then we have 2 ∂ L(x, y) = ∂x2 " φ P 0 0 0 CLT (DL + λL  2  ∂   L(x, y) = −  ∂y 2   # d0L )−1 CL ∂2 ∂x2 L(x, y)  0 and ∂2 ∂y 2 L(x, y) (45) and P λG νG (π, ρ) DL (DL + d0L )−1 d0L 0 0 0  λL  0  d0G d0G λG  0 0 dG (DG + dG ) 0  νG 0 0 0 with φ 0 0 0 (46) (π, ρ)  0. Lemma 13 (Partial derivatives of g(x, y)). Whenever Lemma 9 holds, then ∂ g(x, y) = ∂x " φ P 0 −δAL (DL + d0L )−1 CL 0 0 λL  ∂ g(x, y) =   ∂y  −δAL (DL + d0L )−1 d0L # λL (νG , λG , π, ρ) λG νG (π, ρ) 0 0 0  0 0 δAG  0   0 0 0 0 λL λG (νG , π, ρ) Unfortunately, the conditions of Theorem 10 will not suffice to guarantee convergence of the perturbed system. The main difficulty is that d0i (λi + νi ) > 0 can become arbitrarily close to zero. Therefore the sub-matrix of (46) corresponding to the states λ and νG can become arbitrarily close to singular which makes the system not robust to perturbations of the form of (44). Thus, we require the following additional assumption. 18 Assumption 3 (Lipschitz continuity of c0i ). The functions c0i (·) are Lipschitz continuous with Lipschitz constant L > 0. Assumption 3 implies that the domain of Di = R in Assumption 1. However, if the systems is designed with enough capacity so that d∗i ∈ [di + ε, di − ε] ∀i, then one can always modify a cost function ci (·) that satisfies Assumptions 1 and 2 for finite domains Di = [di , di ] and define a new cost function c̃i (·) that satisfies Assumption 3 without modifying the optimal allocation d∗i . More precisely, given ci (·), define c̃i (·) to be equal to ci (·), inside [di + ε, di − ε] and modify c̃i (·) outside the subset so that Assumption 3 holds. It is easy to show then that the optimal solution will still be d∗i and therefore we still get di ≤ d∗i ≤ di . Using now Assumptions 1 and 3 we can show that α ≤ c00i ≤ L which implies d0 := 1/L ≤ d0i = 1/c00i ≤ d¯0 := 1/α. (47) Theorem 14 (Global convergence of perturbed system). Whenever assumptions 1, 2 and 3 hold. The system (43) converges to a point in the optimal set E for every initial condition whenever » » 2 2 δai ∈ 2( d0 − d0 + d0 Dmin , d0 + d0 + d0 Dmin ). (48) where Dmin := mini∈N Di . Proof: We prove this theorem in three steps: Step 1: We first show that under the dynamics (43), the time derivative of (27) is upper-bounded by Z 1 U̇ (z) ≤ (z−z ∗ )T [H(z(s))](z−z ∗ )ds (49) 0 where z = (x, y), z ∗ = (x∗ , y ∗ ), z(s) = z ∗ +s(z−z ∗ ), and H(z) is given by (57). Step 2: We then show that under the assumption (48) H(z)  0, and that for any z̃ = (φ̃, P̃ , λ̃, ν̃G , π̃, ρ̃) ∈ R2|N |+3|E|+|G|+|K| , we have z̃ T H(z)z̃ = 0, ∀z ⇐⇒ z̃ ∈ {z̃ ∈ RZ : λ̃ = 0, ν̃G = 0, CL P̃ = 0} (50) where Z = 2|N | + 3|E| + |G| + |K|. Step 3: We finally use (50) and the invariance principle for Caratheodory systems [40] to show that ν(t) ≡ 0 and λ(t) ≡ λ∗ . The rest of the proof follows from steps 3 and 4 of Theorem 10. We use z = (x, y) and compactly express (43) using ż = Z[f (z)]+ ρ (51) where Z = blockdiag(X, Y ) and  f (z) :=  ∂ L(x, y)T − ∂x ∂ T ∂y L(x, y) Similarly, (27) becomes U (z) = 12 (z − z ∗ )T Z −1 (z − z ∗ ). + g(x, y)  . 19 Proof of step 1: We now recompute U̇ (z) differenlty, i.e. 1 +T ∗ U̇ (z) = ((z−z ∗ )T [f (z)]+ ρ +[f (z)]ρ (z−z )) 2 1 ≤ ((z−z ∗ )T f (z)+f (z)T (z−z ∗ )) = (z−z ∗ )T f (z) 2 Z 1 ï ò ∂ = (z−z ∗ )T f (z(s)) (z−z ∗ )ds+(z−z ∗ )T f (z ∗ ) ∂z 0 Z 1 ï ò 1 ∂ ∗ T ∂ T ≤ (z−z ) f (z(s)) + f (z(s)) (z−z ∗ )ds 2 0 ∂z ∂z Z 1 = (z−z ∗ )T [H(z(s))](z−z ∗ )ds (52) (53) (54) (55) (56) 0 where (52) follows from (51), (53) from (2), and (54) form the fact that f (z) − f (z ∗ ) = R1 ∂ f (z(s))(z 0 ∂z − z ∗ )ds, where  ∂ f (z) =  ∂z  + 2 2 ∂ − ∂x 2 L(x, y) ∂ − ∂x∂y L(x, y) ∂2 T ∂x∂y L(x, y) ∂2 ∂y 2 L(x, y)    0 0 ∂ ∂x g(x, y) ∂ ∂y g(x, y) . Finally, (55) follows from the fact that either fi (z ∗ ) = 0, or (zi − zi∗ ) = zi ≥ 0 and fi (z ∗ ) < 0, which implies (z − z ∗ )T f (z ∗ ) ≤ 0. Therefore, H(z) in (49) can be expressed as ï ò 1 ∂ ∂ T H(z) = f (z) + f (z) 2 ∂z ∂z   ∂2 − ∂x L(x, y) 0 2  = ∂2 0 L(x, y) 2 ∂y   1 ∂ T g(x, y) 0 2 ∂x + Ä ä  1 ∂ 1 ∂ ∂ T g(x, y) g(x, y) + g(x, y) 2 ∂x 2 ∂y ∂y which using lemmas 12 and 13 becomes  φ (P, λL ) (λG , νG ) (π, ρ) 0 0 0 0  0         0 HP,λ (z) 0 L H(z) =    0 0 HλG ,νG (z)  0 0 0 0 0 φ (P, λL ) (57) (λG , νG ) (π, ρ) where HP,λL (z) = " −CLT (DL + d0L )−1 CL − 21 CLT (DL + d0L )−1 δAL − 12 δAL (DL + d0L )−1 CL −(DL + δAL )(DL + d0L )−1 d0L # 20 " HλG ,νG (z) = and −d0G 1 2 δAG − d0G 1 2 δAG # − d0G −(d0G + DG ) . It will prove useful in the next step to rewrite HP,λL (z) using 1 1 HP,λL (z) = C̃ T D̃ 2 (z)H̃(z)D̃ 2 (z)C̃ (58) where C̃ = blockdiag(CL , I), D̃(z) = blockdiag(DL + d0L , DL + d0L )−1  and H̃(z) =  −I − 12 δAL − 12 δAL −(DL + δAL )d0L  . 1 Notice that since D̃(z)  0, D̃ 2 (z) in (58) always exists. Proof of step 2: To show that H(z)  0 and (50) holds, it is enough to show that H̃(z) ≺ 0 and HλG ,νG (z) ≺ 0, ∀z. (59) To see this, assume for now that (59) holds. Then, using (58) it follows that HP,λL (z)  0, which implies by (57) and HλG ,νG (z) ≺ 0 that H(z)  0. Moreover, z̃ T H(z)z̃ = 0 ∀z if and only if [ P̃ T λ̃TL ]HP,λL (z)[ P̃ T λ̃TL ]T = 0 (60) [ λ̃TG ν̃GT ]HλG ,νG (z)[ λ̃TG ν̃GT ]T = 0. (61) and Therefore using (58) it follows that (60) and H̃(z) ≺ 0 ∀z implies that CL P̃ = 0 and λ̃L = 0. Similarly, HλG ,νG (z) ≺ 0 ∀z and (61) implies λ̃G = ν̃G = 0. This finishes the proof of (50). It remains to show that (59) holds whenever (48) holds. Proof of H̃(z) ≺ 0: By definition of negative definite matrices, H̃(z) ≺ 0 if and only if all the roots of the characteristic polynomials pi (µi ) = (µi + 1)(µi + (Di + δai )d0i ) − δa2i /4 = µ2i + (1 + (Di + δai )d0i )µi + (Di + δai )d0i − δa2i /4 are negative for every i ∈ L and ∀z (recall d0i depends on z). Thus, applying Ruth-Hurwitz stability criterion we get the following necessary and sufficient condition: for every i ∈ L. δa2i − 4(Di + δai )d0i < 0 (62a) 1 + (Di + δai )d0i > 0 (62b) 21 Now, equation (62a) can be equivalently rewritten as: 2(d0i − » d0i (d0i + Di )) < δai < 2(d0i + Since d0i ∈ [d0 , d¯0 ], Di ≥ Dmin and the function x − 2(d0i − Similarly, since x + » » d0i (d0i + Di )). (63) p x(x + y) is decreasing in both x and y for x, y ≥ 0, then d0i (d0i + Di )) ≤ 2(d0 − » d0 (d0 + Dmin )). p x(x + y) is increasing for x, y ≥ 0, 2(d0i + » d0i (d0i + Di )) ≥ 2(d0 + » d0 (d0 + Dmin )). Therefore, (62a) holds whenever δai satisifes (48). Finally, (62b) holds whenever δai > − d10 − Di which in particular holds if δai > −Dmin . The following i » calculation shows that 2(d0 − d0 (d0 + Dmin )) > −Dmin which implies that (62b) holds under condition (48): » d0 (d0 + Dmin )) > −Dmin » Dmin d0 (d0 + Dmin ) < d0 + 2 2 0 0 0 2 Dmin 0 d (d + Dmin ) < d + + d Dmin 4 2(d0 − ⇐⇒ ⇐⇒ ⇐⇒ 0< 2 Dmin . 4 Therefore (62) holds whenever (48) holds. Proof of HνG ,λG (z) ≺ 0: Similarly, we can show that all the eigenvalues of HνG ,λG (z) are the roots of the polynomials δai − d0i )2 2 δa2 = µ2i + (Di + 2d0i )µi + (Di + δai )d0i − i 4 pi (µi ) = (µi + Di + d0i )(µi + d0i ) − ( which, since Di + 2d0i > 0, are negative if and only if (62a) is satisfied ∀i ∈ G. Therefore, (48) also guarantees that HνG ,λG ≺ 0. Proof of step 3: Since by Step 2 H(z)  0 ∀z, (49) implies that U̇ ≤ 0 whenever (48) holds. Thus, we are left to apply again the invariance principle for Caratheodory systems [40] and characterize its invariant set M (28). Let δz = (z(t) − z ∗ ) and similarly define δP = (P (t) − P ∗ ), δλL = λL (t) − λ∗L , δλG = λG (t) − λ∗G and δνG = νG (t) − νG∗ . Then since U̇ ≡ 0 iff δz T H(z)δz ≡ 0, then it follows from (50) that z(t) ∈ M if and only if CL δP ≡ 0, δλ ≡ 0 and δνG ≡ 0. This implies that CL P (t) ≡ CL P ∗ , λ(t) ≡ λ∗ and νG (t) ≡ νG∗ = 0, which in particular also implies that νL∗ (x(t), y(t)) = νL∗ (CL P (t), λ(t)) ≡ νL∗ (CL P ∗ , λ∗ ) = 0. Therefore we have shown that z(t) ∈ M if and only if λ(t) ≡ λ∗ and ν(t) ≡ 0 which finalizes Step 3. As mentioned before, the rest of the proof follows from steps 2 and 3 of Theorem 10. 22 VI. F RAMEWORK E XTENSIONS In this section we extend the proposed framework to derive controllers that enhance the solution described before. More precisely, we will show how we can modify our controllers in order to account for buses that have zero power injection (Section VI-A) and how to fully distribute the implementation of the inter-area flow contraints (Section VI-B). A. Zero Power Injection Buses We now show how our design framework can be extended to include buses with zero power injection. Let Z be the set of buses that have neither generators nor loads. Thus, we consider a power network whose dynamics are described by θ̇G∪L = ωG∪L (64a) MG ω̇G = PGin−(dG +DG ωG )−LB,(G,N ) θ (64b) 0 = PLin−(dL +DL ωL )−LB,(L,N ) θ (64c) 0 = −LB,(Z,N ) θ (64d) where LB,(S,S 0 ) is the sub-matrix of LB consisting of the rows in S and columns in S 0 . We will use Kron reduction to eliminate (64d). Equation (64d) implies that the (θi , i ∈ Z) is uniquely determined by the buses adjacent to Z, i.e. θZ = L−1 B,(Z,Z) LB,(Z,G∪L) θG∪L . Thus we can rewrite (64) using only θG∪L which gives θ̇G∪L = ωG∪L (65a) MG ω̇G = PGin−(dG +DG ωG )−L]B,(G,G∪L) θG∪L (65b) 0 = PLin−(dL +DL ωL )−L]B,(L,G∪L) θG∪L (65c) where L]B = LB,(G∪L,G∪L) − LB,(G∪L,Z) L−1 B,(Z,Z) LB,(Z,G∪L) is the Schur complement of LB after removing the rows and columns corresponding to Z. The matrix L]B is also a Laplacian of a reduced graph G(G ∪ L, E ] ) and therefore it can be expressed as L]B = C ]T B ] C ]T where C ] is the incidence matrix of G(G ∪ L, E ] ) and ] B ] = diag(Bij )ij∈E ] are the line susceptances of the reduced network. This reduction allows to use (65) (which is equivalent to (3)) to also model networks that contain buses with zero power injection. The only caveat is that some of line flows of the vector BC T θ are no longer present in B ] C ]T θG∪L – when a bus is eliminated using Kron reduction, its adjacent lines Be , e ∈ E, are substituted by an equivalent clique with new line impedances Be]0 , e0 ∈ E ] . As a result, some of the constraints (8d)-(8e) would no longer have a physical meaning if we directly substitute BC T θ with B ] C ]T θG∪L in (3). We overcome this issue by showing that each original Bij (θi − θj ) in G(N , E) can be replaced by a linear combination of line flows Bi]0 j 0 (θi0 − θj 0 ) of the reduced network G(G ∪ L, E ] ). 23 For any θ satisfying (64d) we have  qG∪L LB θ =  0|Z|   = L]B θG∪L 0|Z|  . Thus it follows that  BC T θ = BC T L†B  qG∪L 0|Z|   = BC T L† B,(N ,G∪L) qG∪L = BC T L†B,(N ,G∪L) C ] B ] C ]T θG∪L := A] B ] C ]T θG∪L (66) where L†B is the pseudo-inverse of LB . Therefore, by substituting BC T θ with A] B ] C ]T θG∪L in (8) and repeating the procedure of Section III we obtained a modified version of (18) in which (18a)-(18e) becomes   X ] λ̇i = ζiλ Pim − di − Bij (φi − φj ) (67a) j∈Ni] π̇k = ζkπ X ] Ĉk,e A]e,ij Bij (φi − φj ) − P̂k  (67b) e∈Bk ,ij∈E ] + ρ ρ̇+ e = ζe h X ] A]e,ij Bij (φi − φj ) − Pe i+ ij∈E ] − ρ ρ̇− e = ζe h Pe − X i+ ] A]e,ij Bij (φi − φj ) − X ] Bij (λi −λj )− X e∈E X e∈E j∈Ni] − ] Ci,e Be] (67d) ρe ij∈E ] φ̇i = χφi (67c) ρ+ e X ] Ci,e Be] X A]e,e0 Ĉk,e0 πk e0 ∈E, k∈K  − A]e,e0 (ρ+ − ρ ) 0 0 e e (67e) e0 ∈E where (67a) and (67e) are for i ∈ G ∪ L, (67b) is for k ∈ K, and (67c) and (67d) are for the original lines e ∈ E. It can be shown that the analysis described in Sections IV and V still holds under this extension. Remark 15. The only additional overhead incurred by the proposed extension is the need for communication between buses that are adjacent on the graph G(G ∪ L, E ] ) and were not adjacent in G(N , E) (see Figure 3 for an illustration). B. Distributed Inter-area Flow Constraints We now show how we can fully distribute the implementation of the inter-area flow constraints. The procedure is analogous to Section VI-A and therefore we will only limit to describe what are the modifications that need to be done to (8) in order to obtain controllers that are fully distributed. We define for each area k an additional graph G(Bk , E k ) where we associate each boundary edge e ∈ Bk with a node and define undirected edges {e, e0 } ∈ E k that describe the communication links between e and e0 . Using 24 Fig. 3: Communication requirements for the power network in Fig. 2 when bus 3 has no injection as described in Section VI-A (left), and for the distributed inter-area flow constraint formulation of Section VI-B (right). this formulation, we decompose equation (5) for each k into |Bk | equations Ĉk,e Pe − X P̂k = |Bk | 0 0 (γe − γe0 ), e ∈ Bk , k ∈ K (68) e :{e,e }∈Bk where γe is a new primal variable that aims to guarantee indirectly (5). In fact, it is easy to see by summing (68) over e ∈ Bk that Ç X e∈Bk P̂k Ĉk,e Pe − |Bk | å = X X (γek − γek0 ) = 0. e∈Bk e0 :{e,e0 }∈Bk which is equal to (5). Therefore, since whenever (5) holds, one can find a set of γe satisfying (68), then we can substitute (8d) with k (68). If we let πij be the Lagrange multiplier associated with (68), then by replacing (18b) and (18e) with   P̂k X k k π π̇ij = ζk,ij Ĉk,ij Bij (φi −φj )− − γij −γek |Bk | e:{ij,e}∈Bk  X γ k k γ̇ij = χk,ij πij −πek (69a) (69b) e:{ij,e}∈Bk φ̇i = χφi X Bij (λi −λj )− j∈Ni − X e∈E X Ci,e Be Ĉk,e πek k∈K, e∈Bk  − Ci,e Be (ρ+ e − ρe ) (69c) 25 9 Area 1 37 10 26 30 25 29 28 2 38 27 18 1 8 24 17 16 3 15 1 6 35 39 14 4 5 21 22 12 6 19 7 31 2 11 20 10 36 34 8 9 23 13 Area 2 32 33 5 7 4 3 Fig. 4: IEEE 39 bus system: New England we can distribute the implementation of the inter-area flow constraint. Figure 3 shows how the communication requirements are modified by this change. If each boundary bus has only one incident boundary edge, i.e. if P k k∈K, e∈BkCi,e Be Ĉk,e πe has at most one term, the convergence results of sections IV and V extend to this case. VII. N UMERICAL I LLUSTRATIONS We now illustrate the behavior of our control scheme. We consider the widely used IEEE 39 bus system, shown in Figure 4, to test our scheme. We assume that the system has two independent control areas that are connected through lines (1, 2), (2, 3) and (26, 27). The network parameters as well as the initial stationary point (pre fault state) were obtained from the Power System Toolbox [43] data set. Each bus is assumed to have a controllable load with Di = [−dmax , dmax ], with dmax = 1p.u. on a 100MVA base with ci (·) and di (·) as shown in Figure 5. Throughout the simulations we assume that the aggregate generator damping and load frequency sensitivity parameter Di = 0.2 ∀i ∈ N and χφi = ζiλ = ζkπ = ζeρ + − = ζeρ = 1, for all i ∈ N , k ∈ K and e ∈ E. These parameter values do not affect convergence, but in general they will affect the convergence rate. The values of P in 26 25 1 d i (ω i + λ i ) c i (d i ) 20 15 10 5 0.5 0 −0.5 0 −1 −0.5 0 0.5 −1 −10 1 −5 0 5 10 ωi + λi di Fig. 5: Disutility ci (di ) and load function di (ωi + λi ) are corrected so that they initially add up to zero by evenly distributing the mismatch among the load buses. P̂ is obtained from the starting stationary condition. We initially set P and P so that they are not binding. (a) Swing dynamics (b) OLC unconstr ω i rad/s 0.05 (c) OLC area−constr 0.05 0.05 0 0 0 −0.05 −0.05 −0.05 −0.1 −0.1 −0.1 −0.15 −0.15 −0.15 −0.2 −0.2 −0.2 −0.25 −0.25 −0.25 −0.3 −0.3 −0.3 −0.35 −0.35 −0.35 −0.4 −0.4 −0.4 −0.45 −0.45 −0.45 −0.5 −0.5 0 5 10 15 20 25 30 −0.5 0 5 10 15 20 25 30 t t 0 5 10 15 20 25 30 t Fig. 6: Frequency evolution: Area 1 We simulate the OLC-system as well as the swing dynamics (4) without load control (di = 0), after introducing in a perturbation at bus 29 of P29 = −2p.u.. In some scenarios we disable a few of the OLC constraints. This is achieved by fixing the corresponding Lagrange multiplier to be zero. Figures 6 and 7 show the evolution of the bus frequencies for the uncontrolled swing dynamics (a), the OLC system without inter-area constraints (b), and the OLC with area constraints (c). It can be seen that while the swing dynamics alone fail to recover the nominal frequency, the OLC controllers can jointly rebalance the power as well as recovering the nominal frequency. The convergence of OLC seems to be similar or even better than the swing dynamics, as shown in Figures 6 and 7. 27 ω i rad/s (a) Swing dynamics (b) OLC unconstr (c) OLC area−constr 0.1 0.1 0.1 0 0 0 −0.1 −0.1 −0.1 −0.2 −0.2 −0.2 −0.3 −0.3 −0.3 −0.4 −0.4 −0.4 −0.5 −0.5 0 5 10 15 20 25 30 −0.5 0 5 10 15 20 25 30 0 5 10 15 t t 20 25 30 t Fig. 7: Frequency evolution: Area 2 LMPs Inter area line flows 0.5 3.5 0.4 3 0.3 0.2 2.5 P ij λi 0.1 0 2 1.5 −0.1 −0.2 1 −0.3 0.5 −0.4 −0.5 0 0 10 20 30 40 50 60 0 10 20 t 30 40 50 60 t Fig. 8: LMPs and inter area line flows: no thermal limits Now, we illustrate the action of the thermal constraints by adding a constraint of P e = 2.6p.u. and P e = −2.6p.u. to the tie lines between areas. Figure 8 shows the values of the multipliers λi , that correspond to the Locational Marginal Prices (LMPs), and the line flows of the tie lines for the same scenario displayed in Figures 6c and 7c, i.e. without thermal limits. It can be seen that neither the initial condition, nor the new steady state satisfy the thermal limit (shown by a dashed line). However, once we add thermal limits to our OLC scheme, we can see in Figure 9 that the system converges to a new operating point that satisfies our constraints. Finally, we show the conservativeness of the bound obtained in Theorem 14. We simulate the perturbed system (4), (41a) and (18b)-(18f) with under the same conditions as in Figure 8. We set the scalars ai s such that the corresponding δai s are homogeneous for every bus i. We also do not impose the bounds (47) on di (·) and use instead di as described in Figure 5. This last assumption actually implies that the interval in (48) is empty (because 28 LMPs Inter area line flows 1.5 3.5 3 1 2.5 0.5 λi P ij 2 1.5 0 1 −0.5 0.5 −1 0 0 10 20 30 40 50 60 0 10 20 30 40 50 60 t t Fig. 9: LMPs and inter area line flows: with thermal limits d0 = 0). δb i = −0.40 1 0.2 δb i = −0.21 0.2 δb i = −0.20 0.2 δb i = −0.19 δb i = 0.00 0.2 0.1 0.1 0.1 0.1 −1 0 0 0 0 −2 −0.1 −0.1 −0.1 −0.1 −3 −0.2 −0.2 −0.2 −0.2 −4 −0.3 −0.3 −0.3 −0.3 −5 −0.4 −0.4 −0.4 −0.4 ωi 0 −6 0 50 100 t 150 −0.5 200 0 50 100 150 −0.5 200 0 t 50 100 t 150 −0.5 200 0 50 100 t 150 −0.5 200 0 50 100 150 200 t Fig. 10: Bus frequency evolution for homogeneous perturbation δai ∈ {−0.4, −0.21, −0.2, −0.19, 0.0} Figures 10 and 11 show the evolution of the frequency ωi and LMPs λi for different values of δai belonging to {−0.4, −0.21, −0.2, −0.19, 0.0}. Since Di = 0.2 at all the buses, then δai = −0.2 is the threshold that makes ai go from positive to negative as δai decreases. Even though condition (48) is not satisfied for any δai , our simulations show that the system converges whenever ai ≥ 0 (δai ≥ −0.2). The case when δai = −0.2 is of special interest. Here, the system converges, yet the nominal frequency is not restored. This is because the terms δai ωi (42) are equal to the terms Di ωi in (4a)-(4b). Thus ω̇i and λ̇i can be made simultaneously zero with nonzero ωi∗ . Fortunately, this can only happen when ai = 0 ∀i which can be avoided since ai is a designed parameter. 29 δb i = −0.40 350 0.4 δb i = −0.21 0.2 δb i = −0.20 0.2 δb i = −0.19 δb i = 0.00 0.2 0.3 300 0.1 0.1 0.1 0 0 0 0 −0.1 −0.1 −0.1 −0.1 −0.2 −0.2 −0.2 −0.3 −0.3 −0.3 −0.4 −0.4 −0.4 0.2 250 0.1 λi 200 150 100 −0.2 50 −0.3 0 −0.4 −50 0 50 100 150 −0.5 200 0 50 100 t t 150 −0.5 200 0 50 100 150 −0.5 200 0 t 50 100 150 t −0.5 200 0 50 100 150 200 t Fig. 11: Location Marginal Prices evolution for homogeneous perturbation δai ∈ {−0.4, −0.21, −0.2, −0.19, 0.0} VIII. C ONCLUDING REMARKS This paper studies the problem of restoring the power balance and operational constraints of a power network after a disturbance by dynamically adapting the loads. We show that provided communication is allowed among neighboring buses, it is possible to rebalance the power mismatch, restore the nominal frequency, and maintain interarea flows and thermal limits. Our distributed solution converges for every initial condition and is robust to parameter uncertainty. Several numerical simulations verify our findings and provide new insight on the conservativeness of the theoretical sufficient condition. A PPENDIX A. Proof of Lemma 2 Proof: Assumptions 1 and 2 guarantee that the solution to the primal (OLC) is finite. Moreover, since by Assumption 2 there is a feasible d ∈ Int D, then the Slater condition is satisfied [31] and there is zero duality gap. Thus, since OLC only has linear equality constraints, we can use Karush-Kuhn-Tucker (KKT) conditions [31] to characterize the primal dual optimal solution. Thus (d∗ , ω ∗ , P ∗ , φ∗ , σ ∗ ) is primal dual optimal if and only if we have: (i) Primal and dual feasibility: (9b)-(9e) and ρ+∗ , ρ−∗ ≥ 0. (ii) Stationarity: ∂ ∂ L(d∗ , ω ∗ , x∗ , σ ∗ ) = 0, L(d∗ , ω ∗ , x∗ , σ ∗ ) = 0 ∂d ∂ω ∂ and L(d∗ , ω ∗ , x∗ , σ ∗ ) = 0. ∂x (iii) Complementary slackness: ∗ ∗ ρ+∗ ij (Bij (vi − vj ) − P̄ij ) = 0, ij ∈ E; ∗ ∗ ρ−∗ ij (P ij − Bij (vi − vj )) = 0, ij ∈ E. 30 KKT conditions (i) and (iii) are already implicit by assumptions of the lemma. The stationarity condition (ii) is given by ∂L ∗ ∗ ∗ ∗ ∗ (d , ω , P , φ , σ ) = c0i (d∗i ) − (νi∗ + λ∗i ) = 0 ∂di ∂L ∗ ∗ ∗ ∗ ∗ (d , ω , P , φ , σ ) = Di (ωi∗ − νi∗ ) = 0 ∂ωi ∂L ∗ ∗ ∗ ∗ ∗ (d , ω , P , φ , σ ) = νj∗ − νi∗ = 0 ∂Pij X ∂L ∗ ∗ ∗ ∗ ∗ (d , ω , P , φ , σ ) = Bij (λ∗j − λ∗i ) ∂φi (70a) (70b) (70c) j∈Ni + Since Di > 0 equation (70b) implies X Ci,e Be ( e∈E νi∗ = X −∗ Ĉk,e πk∗ + ρ+∗ e − ρe ) = 0 (70d) k∈K ωi∗ . Thus, (70b) and (70a) amount to the first and second conditions of (11). Furthermore, since the graph G is connected then (70c) is equivalent to νi∗ = ν̂ ∀i ∈ N . which is the third condition of (11). Since ci (di ) and Di ωi2 2 are strictly convex functions, it is easy to show that νi∗ and λ∗i are unique. To show ν̂ = 0 we use (i). Adding (9b) over i ∈ N gives ! 0= X Pim − (d∗i + Di ωi∗ ) X (Pim − (d∗i + Di ωi∗ )) − i∈N = X Cie Pe e∈E i∈N = − X X (Cie Pe + Cje Pe ) e=ij∈E (Pim − (d∗i + Di ωi∗ )) (71) i∈N and similarly (9c) gives 0= X Pim − d∗i (72) i∈N Thus, subtracting (71) from (72) gives 0= X Di ωi∗ = i∈N X i∈N Di νi∗ = ν̂ X Di i∈N and since Di > 0 ∀i ∈ N , it follows that ν̂ = 0. B. Proof of Lemma 3 Proof: Let (d∗ ω ∗ = 0, θ∗ ) be an optimal solution of OLC. Then, by letting φ∗ = θ∗ and P ∗ = BC T θ∗ , it follows that (d∗ , ω ∗ = 0, φ∗ , P ∗ ) is a feasible solution of VF-OLC. Suppose that (d∗ , ω ∗ , φ∗ , P ∗ ) is not optimal with P D ω̂ ∗2 respect to VF-OLC, then the solution (dˆ∗ , ω̂ ∗ , φ̂∗ , P̂ ∗ ) of VF-OLC has strictly lower cost i∈N ci (dˆ∗i ) + i2 i < P ∗ ∗ ∗ ∗ ˆ∗ ∗ ∗ i∈N ci (di ). By Lemma 2 we have that ω̂ = 0. Then, it follows that by setting θ̂ = φ̂ , (d , ω̂ , θ̂ ) is a feasible solution of OLC with strictly lower cost than the supposedly optimal (d∗ , ω ∗ , θ∗ ). Contradiction. Therefore (dˆ∗ , ω̂ ∗ , φ̂∗ , P̂ ∗ ) is an optimal solution of VF-OLC. The converse is shown analogously. 31 C. Proof of Lemma 4 Proof: A straightforward differentiation shows that the Hessian of Φi (νi , λi ) is given by 2 ∂ Φi (νi , λi ) = ∂(νi , λi )2 " νi λi −(d0i + Di ) −d0i −d0i −d0i # νi (73) λi 0 where d0i is short for d0i (λi + νi ) and denotes de derivative of di (·) = ci−1 (·) with respect to its argument. Since ci is strictly convex d0i > 0. Thus, since Di > 0, (73) is negative definite which implies that Φi (νi , λi ) is strictly concave. Finally, it follows from (14) that L(x, σ) is strictly concave in (ν, λ). D. Proof of Lemma 9 Proof: We first notice that νi∗ (x, y), i ∈ L, depends only on λi and Ci P := ∂ ∗ ∂v νL (x, y) = 0, ∂ ∗ ∂νG νL (x, y) = 0, ∂ ∗ ∂π νL (x, y) = 0, ∂ ∗ ∂ρ νL (x, y) = 0 and P e∈E ∂ ∗ ∂λL νL (x, y) Ci,e Pe . Which means that is diagonal. Now, by definition of νL∗ (x, y), for any i ∈ L we have 0= ∂ L(x, y, νL∗ (x, y)) = ∂νi = Pim −(Di νi∗ (x, y)+di (λi + νi∗ (x, y)))− X Ci,e Pe (74) e∈E ∂ L(x, y, νL∗ (x, y)) with respect to λi we obtain Therefore, if we fix P and take the total derivative of ∂ν i Å ã ∂ d ∗ L(x, y, νL (x, y)) 0= dλi ∂νi ∂ ∗ = −(Di + d0i (λi + νi∗ )) ν − d0i (λi + νi∗ ) ∂λi i (75) (76) where here we used νi∗ for short of νi∗ (x, y). Now since by assumption ci (·) is strongly convex, i.e. c00i (·) ≥ α, d0i (·) = 1 c00 (·) i ≤ finite and strictly positive, which implies that ∂ ∗ d0i (λi + νi∗ (x, y)) νi (x, y) = − , ∂λi ( Di + d0i (λi + νi∗ (x, y)) ) i ∈ L. Similarly, we obtain ∂ ∗ 1 νi (x, y) = − Ci , 0 ∂P ( Di + di (λi + νi∗ (x, y)) ) i ∈ L. where Ci is the ith row of C. Finally, notice that whenever d0i (λi + νi∗ ) exists, then ∂ ∗ ∂x νi and ∂ ∗ ∂y νi E. Proof of Lemma 12 Proof: Using the Envelope Theorem [36] in (16) we have ∂L ∂L (x, y) = (x, y, νL∗ (x, y)) ∂x ∂x also exists. 1 α < ∞. Thus, (Di + d0i ) is 32 which implies that ï ò ∂2L ∂ ∂L ∗ (x, y) = (x, y, νL (x, y)) ∂x2 ∂x ∂x ∂2L ∂2L ∂ ∗ (x, y, ν (x, y)) + = (x, y, νL∗ (x, y)) νL∗ (x, y) L 2 ∂x ∂x∂νL ∂x ∂2L ∂ = (x, y, νL∗ (x, y)) νL∗ (x, y). ∂x∂νL ∂x (77) where the last step follows from L(x, σ) being linear in x. Now, by definition of νL∗ (x, y) it follows that ∂L (x, y, νL∗ (x, y)) = 0. ∂νL (78) Differentiating (78) with respect to x gives 0= ∂2L ∂ ∂2L (x, y, νL∗ (x, y)) + (x, y, νL∗ (x, y)) νL∗ (x, y) 2 ∂νL ∂x ∂νL ∂x and therefore òT ï 2 ∂2L ∂ L (x, y, νL∗ (x, y)) (x, y, νL∗ (x, y)) = ∂x∂νL ∂νL ∂x 2 ∂ L ∂ = − νL∗ (x, y)T 2 (x, y, νL∗ (x, y)). ∂x ∂νL (79) Substituting (79) into (77) gives ∂2L ∂ ∂2L ∂ (x, y) = − νL∗ (x, y)T 2 (x, y, νL∗ (x, y)) νL∗ (x, y). 2 ∂x ∂x ∂νL ∂x (80) It follows from (20) and (15) that ∂ 2 ΦL ∗ ∂2L ∗ (x, y, ν (x, y)) = (ν (x, y), λL ) L ∂νL2 ∂νL2 L = −(DL + d0L ). (81) Therefore, substituting (25) and (81) into (80) gives (45). A similar calculation using (26) gives (46). F. Proof of Lemma 13 Proof: By definition of g(x, y) we have ∂ g(x, y) = ∂y Thus, using Lemma 9 we obtain ï ∂ ∂ 0 δAG νGT δAL νL∗ (x, y)T 0 0 ∂y ∂y ∂ ∂x g(x, y). A similar computation gives òT ∂ ∂y g(x, y). 33 R EFERENCES [1] A. J. Wood, B. F. Wollenberg, and G. B. Sheble, “Power generation, operation and control,” John Wiley&Sons, 1996. [2] A. R. Bergen and V. Vittal, Power Systems Analysis, 2nd ed. Prentice Hall, 2000. [3] J. Machowski, J. Bialek, and J. R. Bumby, Power System Dynamics and Stability. John Wiley & Sons, Oct. 1997. [4] M. D. Ilic, “From Hierarchical to Open Access Electric Power Systems,” Proceedings of the IEEE, vol. 95, no. 5, pp. 1060–1084, 2007. [5] A. K. Bejestani, A. Annaswamy, and T. Samad, “A Hierarchical Transactive Control Architecture for Renewables Integration in Smart Grids: Analytical Modeling and Stability,” IEEE Transactions on Smart Grid, vol. 5, no. 4, pp. 2054–2065, Jul. 2014. [6] F. C. Schweppe, R. D. Tabors, J. L. J. Kirtley, H. R. Outhred, F. H. Pickel, and A. J. Cox, “Homeostatic Utility Control,” Power Apparatus and Systems, IEEE Transactions on, vol. PAS-99, no. 3, pp. 1151–1163, May 1980. [7] D. Trudnowski, M. Donnelly, and E. Lightner, “Power-system frequency and stability control using decentralized intelligent loads,” in Transmission and Distribution Conference and Exhibition, 2005/2006 IEEE PES, May 2006, pp. 1453–1459. [8] N. Lu and D. Hammerstrom, “Design considerations for frequency responsive grid friendlytm appliances,” in Transmission and Distribution Conference and Exhibition, 2005/2006 IEEE PES, May 2006, pp. 647–652. [9] J. A. Short, D. G. Infield, and L. L. Freris, “Stabilization of Grid Frequency Through Dynamic Demand Control,” Power Systems, IEEE Transactions on, vol. 22, no. 3, pp. 1284–1293, 2007. [10] M. Donnelly, D. Harvey, R. Munson, and D. Trudnowski, “Frequency and stability control using decentralized intelligent loads: Benefits and pitfalls,” in Power and Energy Society General Meeting, 2010 IEEE, July 2010, pp. 1–6. [11] A. Brooks, E. Lu, D. Reicher, C. Spirakis, and B. Weihl, “Demand Dispatch,” IEEE Power and Energy Magazine, vol. 8, no. 3, pp. 20–29, 2010. [12] D. Callaway and I. Hiskens, “Achieving controllability of electric loads,” in Proceedings of the IEEE. IEEE, 2011, pp. 184–199. [13] A. Molina-Garcia, F. Bouffard, and D. S. Kirschen, “Decentralized Demand-Side Contribution to Primary Frequency Control,” Power Systems, IEEE Transactions on, vol. 26, no. 1, pp. 411–419, 2011. [14] D. Hammerstrom, J. Brous, D. Chassin, G. Horst, R. Kajfasz, P. Michie, T. Oliver, T. Carlon, C. Eustis, O. Jarvegren, W. Marek, R. Munson, and R. Pratt, “Pacific Northwest GridWise Testbed Demonstration Projects, Part II: Grid Friendly Appliance Project,” Pacific Northwest National Lab, Tech. Rep., Oct. 2007. [15] M. Andreasson, D. V. Dimarogonas, H. Sandberg, and K. H. Johansson, “Distributed Control of Networked Dynamical Systems: Static Feedback, Integral Action and Consensus,” Automatic Control, IEEE Transactions on, vol. 59, no. 7, pp. 1750–1764, 2014. [16] M. Andreasson, D. V. Dimarogonas, K. H. Johansson, and H. Sandberg, “Distributed vs. centralized power systems frequency control,” in Control Conference (ECC), 2013 European. IEEE, 2013, pp. 3524–3529. [17] X. Zhang and A. Papachristodoulou, “A real-time control framework for smart power networks with star topology,” American Control Conference (ACC), pp. 5062–5067, 2013. [18] ——, “A real-time control framework for smart power networks: Design methodology and stability,” Automatica, vol. 58, pp. 43–50, Aug. 2015. [19] C. Zhao, U. Topcu, N. Li, and S. Low, “Design and Stability of Load-Side Primary Frequency Control in Power Systems,” Automatic Control, IEEE Transactions on, vol. 59, no. 5, pp. 1177–1189, 2014. [20] N. Li, L. Chen, C. Zhao, and S. H. Low, “Connecting automatic generation control and economic dispatch from an optimization view,” American Control Conference ( . . . , pp. 735–740, 2014. [21] E. Mallada and S. H. Low, “Distributed frequency-preserving optimal load control,” in IFAC World Congress, 2014, pp. 5411–5418. [22] S. You and L. Chen, “Reverse and Forward Engineering of Frequency Control in Power Networks,” in Conference on Decision and Control, 2014. [23] W. Liu, W. Gu, W. Sheng, X. Meng, Z. Wu, and W. Chen, “Decentralized Multi-Agent System-Based Cooperative Frequency Control for Autonomous Microgrids With Communication Constraints,” Sustainable Energy, IEEE Transactions on, vol. 5, no. 2, pp. 446–456, Apr. 2014. [24] Q. Shafiee, J. M. Guerrero, and J. C. Vasquez, “Distributed Secondary Control for Islanded Microgrids - A Novel Approach,” Power Electronics, IEEE Transactions on, vol. 29, no. 2, pp. 1018–1031, 2014. [25] F. Dörfler, J. Simpson-Porco, and F. Bullo, “Breaking the Hierarchy: Distributed Control & Economic Optimality in Microgrids,” arXiv.org, Jan. 2014. 34 [26] J. W. Simpson-Porco, F. Dörfler, F. Bullo, Q. Shafiee, and J. M. Guerrero, “Stability, power sharing, & distributed secondary control in droop-controlled microgrids distributed secondary control in droop-controlled microgrids,” 2013 IEEE International Conference on Smart Grid Communications (SmartGridComm), pp. 672–677, 2013. [27] F. Dörfler, J. W. Simpson-Porco, and F. Bullo, “Plug-and-Play Control and Optimization in Microgrids,” in Conference on Decision and Control, 2014. [28] C. Zhao, U. Topcu, and S. H. Low, “Optimal Load Control via Frequency Measurement and Neighborhood Area Communication,” Power Systems, IEEE Transactions on, vol. 28, no. 4, pp. 3576–3587, 2013. [29] E. Mallada, C. Zhao, and S. Low, “Optimal load-side control for frequency regulation in smart grids,” in Communication, Control, and Computing Allerton, 2014 52nd Annual Allerton Conference on. [30] P. Kundur, Power System Stability And Control. IEEE, 2014, pp. 731–738. McGraw-Hill, 1994. [31] S. Boyd and L. Vandenberghe, Convex Optimization. Cambridge University Press, Mar. 2004. [32] F. P. Kelly, A. K. Maulloo, and D. K. H. Tan, “Rate Control for Communication Networks: Shadow Prices, Proportional Fairness and Stability,” The Journal of the Operational Research Society, vol. 49, no. 3, pp. 237–252, Mar. 1998. [33] S. H. Low and D. E. Lapsley, “Optimization flow control. I. Basic algorithm and convergence,” IEEE/ACM Transactions on Networking, vol. 7, no. 6, pp. 861–874, 1999. [34] R. Srikant, The Mathematics of Internet Congestion Control, ser. Systems & Control: Foundations & Applications. Boston, MA: Springer Science & Business Media, Dec. 2012. [35] D. P. Palomar and M. Chiang, “A tutorial on decomposition methods for network utility maximization,” Ieee Journal on Selected Areas in Communications, vol. 24, no. 8, pp. 1439–1451, Aug. 2006. [36] A. Mas-Colell, M. D. Whinston, and J. R. Green, Microeconomic Theory. Oxford University Press, USA, 1995. [37] K. Zhou, J. C. Doyle, K. Glover, and others, Robust and optimal control. Prentice Hall New Jersey, 1996, vol. 40. [38] D. Feijer and F. Paganini, “Stability of primal-dual gradient dynamics and applications to network optimization,” Automatica, vol. 46, no. 12, pp. 1974–1981, Dec. 2010. [39] H. K. Khalil, Nonlinear systems, 3rd ed. Prentice Hall, 2002. [40] A. Bacciotti and F. Ceragioli, “Nonpathological Lyapunov functions and discontinuous Carathéodory systems,” Automatica, 2006. [41] A. Cherukuri, E. Mallada, and J. Cortés, “Convergence of caratheodory solutions for primal-dual dynamics in constrained concave optimization,” in SIAM conference on control and its applications, July 2015. [42] A. Tilli and M. Montanari, “A Low-Noise Estimator of Angular Speed and Acceleration from Shaft Encoder Measurements,” AUTOMATIKA: Journal for Control, Measurement, Electronics, Computing and Communications, vol. 42., no. 3-4, pp. 169–176, Dec. 2001. [43] J. H. Chow and K. W. Cheung, “A toolbox for power system dynamics and control engineering education and research,” Power Systems, IEEE Transactions on, vol. 7, no. 4, pp. 1559–1564, 1992.
3cs.SY
arXiv:1605.03643v1 [cs.DS] 12 May 2016 Parallel Equivalence Class Sorting: Algorithms, Lower Bounds, and Distribution-Based Analysis William E. Devanny 1 Michael T. Goodrich Dept. of Computer Science Univ. of California, Irvine Irvine, CA 92697 USA [email protected] Dept. of Computer Science Univ. of California, Irvine Irvine, CA 92697 USA [email protected] Kristopher Jetviroj Dept. of Computer Science Univ. of California, Irvine Irvine, CA 92697 USA [email protected] Abstract We study parallel comparison-based algorithms for finding all equivalence classes of a set of n elements, where sorting according to some total order is not possible. Such scenarios arise, for example, in applications, such as in distributed computer security, where each of n agents are working to identify the private group to which they belong, with the only operation available to them being a zero-knowledge pairwisecomparison (which is sometimes called a “secret handshake”) that reveals only whether two agents are in the same group or in different groups. We provide new parallel algorithms for this problem, as well as new lower bounds and distribution-based analysis. 1 Introduction In the Equivalence Class Sorting problem, we are given a set, S, of n elements and an equivalence relation, and we are asked to group the elements of the set into their equivalence classes by only making pairwise equivalence tests (e.g., see [12]). For example, imagine a convention of n political interns where each person at the convention belongs to one of k political parties, such as Republican, Democrat, Green, Labor, Libertarian, etc., but no intern wants to openly 1 William E. Devanny was supported by an NSF Graduate Research Fellowship under grant DGE-1321846. 1 express his or her party affiliation unless they know they are talking with someone of their same party. Suppose further that each party has a secret handshake that two people can perform that allows them to determine whether they are in the same political party (or they belong to different unidentified parties). We are interested in this paper in the computational complexity of the equivalence class sorting problem in distributed and parallel settings, where we would like to minimize the total number of parallel comparison rounds and/or the total number of comparisons needed in order to classify every element in S. An important property of the equivalence class sorting problem is that it is not possible to order the elements in S according to some total ordering that is consistent with the equivalence classes. Such a restriction could come from a general lack of such an ordering or from security or privacy concerns. For example, consider the following applications: • Generalized fault diagnosis. Suppose that each of n different computers are in one of k distinct malware states, depending on whether they have been infected with various computer worms. Each worm does not wish to reveal its presence, but it nevertheless has an ability to detect when another computer is already infected with it (or risk autodetection by an exponential cascade, as occurred with the Morris worm [15]). But a worm on one computer is unlikely to be able to detect a different kind of worm on another computer. Thus, two computers can only compare each other to determine if they have exactly the same kinds of infections or not. The generalized fault diagnosis problem, therefore, is to have the n computers classify themselves into k malware groups depending on their infections, where the only testing method available is for two computers to perform a pairwise comparison that tells them that they are either in the same malware state or they are in different states. This is a generalization of the classic fault diagnosis problem, where there are only two states, “faulty” or “good,” which is studied in a number of interesting papers, including one from the very first SPAA conference (e.g., see [4–6, 10, 17, 18]). • Group classification via secret handshakes. This is a cryptographic analogue to the motivating example given above of interns at a political convention. In this case, n agents are each assigned to one of k groups, such that any two agents can perform a cryptographic “secret handshake” protocol that results in them learning only whether they belong to the same group or not (e.g., see [7,11,20,22]). The problem is to perform an efficient number of pairwise secret-handshake tests in a few parallel rounds so that each agent identifies itself with the others of its group. • Graph mining. Graph mining is the study of structure in collections of graphs [8]. One of the algorithmic problems in this area is to classify which of a collection of n graphs are isomorphic to one another (e.g., see [16]). That is, testing if two graphs are in the same group involves performing a graph isomorphism comparison of the two graphs, which is a computation 2 that tends to be nontrivial but is nevertheless computationally feasible in some contexts (e.g., see [3]). Note that each of these applications contains two important features that form the essence of the equivalence class sorting problem: 1. In each application, it is not possible to sort elements according to a known total order, either because no such total order exists or because it would break a security/privacy condition to provide such a total order. 2. The equivalence or nonequivalence between two elements can be determined only through pairwise comparisons. There are nevertheless some interesting differences between these applications, as well, which motivate our study of two different versions of the equivalence class sorting problem. Namely, in the first two applications, the comparisons done in any given round in an algorithm must be disjoint, since the elements themselves are performing the comparisons. In the latter two applications, however, the elements are the objects of the comparisons, and we could, in principle, allow for comparisons involving multiple copies of the same element in each round. For this reason, we allow for two versions of the equivalence class sorting problem: • Exclusive-Read (ER) version. In this version, each element in S can be involved in at most a single comparison of itself and another element in S in any given comparison round. • Concurrent-Read (CR) version. In this version, each element in S can be involved in multiple comparisons of itself and other elements in S in any comparison round. In either version, we are interested in minimizing the number of parallel comparison rounds and/or the total number of comparisons needed to classify every element of S into its group. Because we expect the number parallel comparison rounds and the total number of comparisons to be the main performance bottlenecks, we are interested here in studying the equivalence class sorting problem in Valiant’s parallel comparison model [21], which only counts steps in which comparisons are made. This is a synchronous computation model that does not count any steps done between comparison steps, for example, to aggregate groups of equivalent elements based on comparisons done in previous steps. 1.1 Related Prior Work In addition to the references cited above that motivate the equivalence class sorting problem or study the special case when the number of groups, k, is two, Jayapaul et al. [12] study the general equivalence class sorting problem, albeit strictly from a sequential perspective. For example, they show that one can 3 solve the equivalence class sorting problem using O(n2 /`) comparisons, where ` is the size of the smallest equivalence class. They also show that this problem has a lower bound of Ω(n2 /`2 ) even if the value of ` is known in advance. The equivalence class sorting problem is, of course, related to comparisonbased algorithms for computing the majority or mode of a set of elements, for which there is an extensive set of prior research (e.g., see [1, 2, 9, 19]). None of these algorithms for majority or mode result in efficient parallel algorithms for the equivalence class sorting problem, however. 1.2 Our Results In this paper, we study the equivalence class sorting (ECS) problem from a parallel perspective, providing a number of new results, including the following: 1. The CR version of the ECS problem can be solved in O(k + log log n) parallel rounds using n processors, were k is the number of equivalence classes. 2. The ER version of the ECS problem can be solved in O(k log n) parallel rounds using n processors, were k is the number of equivalence classes. 3. The ER version of the ECS problem can be solved in O(1) parallel rounds using n processors, for the case when ` is at least λn, for a fixed constant 0 < λ ≤ 0.4, where ` is the size of the smallest equivalence class. 4. If every equivalence class is of size f , then solving the ECS problem requires Ω(n2 /f ) total comparisons. This improves a lower bound of Ω(n2 /f 2 ) by Jayapaul et al. [12]. 5. Solving the ECS problem requires Ω(n2 /`) total comparisons, where ` is the size of the smallest equivalence class. This improves a lower bound of Ω(n2 /`2 ) by Jayapaul et al. [12]. 6. In Section 4, we study how to efficiently solve the ECS problem when the input is drawn from a known distribution on equivalence classes. In this setting, we assume n elements have been sampled and fed as input to the algorithm. We establish a relationship between the mean of the distribution and the algorithm’s total number of comparisons, obtaining upper bounds with high probability for a variety of interesting distributions. 7. We provide the results of several experiments to validate the results from Section 4 and study how total comparison counts change as parameters of the distributions change. Our methods are based on several novel techniques, including a two-phased compounding-comparison technique for the parallel upper bounds and the use of a new coloring argument for the lower bounds. 4 2 Parallel Algorithms In this section, we provide efficient parallel algorithms for solving the equivalence class sorting (ECS) problem in Valiant’s parallel model of computation [21]. We focus on both the exclusive-read (ER) and concurrent-read (CR) versions of the problem, and we assume we have n processors, each of which can be assigned to one equivalence comparison test to perform in a given parallel round. Note, therefore, that any lower bound, T (n), on the total number of comparisons needed to solve the ECS problem (e.g., as given by Jayapaul et al. [12] and as we discuss in Section 3), immediately implies a lower bound of Ω(T (n)/n) for the number of parallel rounds of computation using n processors per round. For instance, these lower bounds imply that the number of parallel rounds for solving the ECS problem with n processors must be Ω(n/`) and Ω(k), respectively, where k is the number of equivalence classes and ` is the size of the smallest equivalence class. With respect to upper bounds, recall that Jayapaul et al. [12] studied the ECS problem from a sequential perspective. Unfortunately, their algorithm cannot be easily parallelized, because the comparisons performed in a “round” of their algorithm depend on the results from other comparisons in that same round. Thus, new parallel ECS algorithms are needed. 2.1 Algorithms Based on the Number of Groups In this subsection, we describe CR and ER algorithms based on knowledge of the number of groups, k. If two sets of elements are sorted into their equivalence classes, merging the two answers into the answer for the union requires at most k 2 equivalence tests by simply performing a comparison between every pair of equivalence class one from the first answer and one from the second. This idea leads to the following algorithm, which uses a two-phased compounding-comparison technique to solve the ECS problem: 1. Initialize a list of n answers containing the individual input elements. 2. While the number of processors per answer is less than 4k 2 , merge pairs of answers by performing k 2 tests. 3. While there is more than one answer, let ck 2 be the number of processors available per answer and merge c answers together by performing at most  c 2 k tests between each of the answers. 2 We analyze this algorithm in the following two lemmas and we illustrate it in Figure 1. Lemma 1. The first while loop takes O(k) rounds to complete. Proof. In each round the number of equivalence classes in an answer at most doubles until it reaches the upper bound of k. In loop iteration i ≤ dlog ke, the 5 Number of answers 1 .. . .. . i ≤ n/22 k 2 .. . ≤ n/28 k 2 .. . .. . Answer Processors Answer size Rounds reduction per answer needed factor n k ≤ n/24 k 2 2 2 ≤ n/2 k ∼ n/2k 2 ∼ n/k 2 i ≥ 22 k 2 .. . ≥ 28 k 2 ≥ 24 k 2 2 2 ≥2 k ∼ 2k 2 .. . .. . .. . ≤k 1 .. . ≤k .. . ∼ 22 1 ≤k 1 .. . ∼2 24 ≤k 1 22 ≤k 1 2 ≤k 1 2 ≤k .. . ≤k 2 .. . k/2 ∼ 2n/k 2 .. . ∼ n/2k ∼ n/k ∼k ≤k k ∼ 2n/k ∼ k/2 ≤ k/2 k/2 2 .. . .. . .. . .. . .. . ... n/4 4 2 n/2 2 ≤4 4 ... 2 2 ... n 1 1 1 2 .. . .. . ≤2 2 .. . 2 2 First while loop phase Figure 1: A visualization of the parallel algorithm with a table on the right keeping track of relevant numbers for each loop iteration. 6 Second while loop phase 8 ∼ k2 ∼ k 2 /2 .. . ∼ 2k ... i answers are size at most 2i and there are 2i processors per answer. Therefore it takes at most 2i rounds to merge two answers. The number of rounds to reach the dlog ke loop iteration is O(k). For loop iterations dlog ke < i < dlog ke2 , the answers are size at most k, but there are still at most 2i processors per answer. The number of rounds needed for these iterations is also O(k), as it forms a geometric sum that adds up to be O(k). This part of the algorithm is illustrated in the bottom half of Figure 1. Lemma 2. The second while loop takes O(log log n) rounds to complete. Proof. When entering the second while, there are more processors per answer than needed to merge just two answers at a time. If an answer has access to ck 2 processors, then a group of 2c answers can merge into one answer in a single round. This means that if there are n/(ck 2 ) answers at the start of a round, then we merge groups of c2 /2 answers into one answer and there are n/(c3 k/2) answers remaining. Because c ≥ 4 by the condition of the first while loop, in the i iteration i of the second while loop, there are at most n/(22 k) answers. And so the second while loop will terminate after O(log log n) rounds with the single answer for the entire input. This is illustrated in the top half of Figure 1. Combining these two lemmas, we get the following. Theorem 1. The CR version of the equivalence class sorting problem on n elements and k equivalence classes can be solved in O(k + log log n) parallel rounds of equivalence tests, using n processors in Valiant’s parallel comparison model. Proof. Lemmas 1 and 2. We also have the following. Theorem 2. The ER version of the equivalence class sorting problem on n elements and k equivalence classes can be solved in O(k log n) parallel rounds of equivalence tests, using n processors in Valiant’s parallel comparison model. Proof. Merging two answers for the ER version of the ECS problem model will always take at most k rounds. Repeatedly merging answers will arrive at one answer in log n iterations. So equivalence class sorting can be done in O(k log n) parallel rounds of equivalence tests. 2.2 Algorithms Based on the Smallest Group Size In this subsection, we describe ER algorithms based on knowledge of `, the size of the smallest equivalence class. We assume in this section that ` ≥ λn, for some constant λ > 0, and we show how to solve the ECS problem in this scenario using O(1) parallel comparison rounds. Our methods are generalizations of previous methods for the parallel fault diagnosis problem when there are only two classes, “good” and “faulty” [4–6, 10]. Let us assume, therefore, that there are at least 3 equivalence classes. We begin with a theorem from Goodrich [10]. 7 Theorem 3 (Goodrich [10]). Let V be a set of n vertices, and let 0 < γ, λ < 1. Let Hd = (V, E) be a directed graph defined by the union of d independent randomly-chosen1 Hamiltonian cycles on V (with all such cycles equally likely). Then, for all subsets W of V of λn vertices, Hd induces at least one strongly connected component on W of size greater than γλn, with probability at least 1 − en[(1+λ) ln 2+d(α ln α+β ln β−(1−λ) ln(1−λ))]+O(1) , where α = 1 − 1−γ 2 λ and β = 1 − 1+γ 2 λ. In the context of the present paper, let us take γ = 1/4, so α = 1 − (3/8)λ and β = 1 − (5/8)λ. Let us also assume that λ ≤ 0.4, since we are considering the case when the number of equivalence classes is at least 3; hence, the smallest equivalence class is of size at most n/3. Unfortunately, using standard approximations for the natural logarithm is not sufficient for us to employ the above probability bound for small values of λ. So instead we use the following inequalities, which hold for x in the range [0, 0.4] (e.g., see [13]), and are based on the Taylor series for the natural logarithm: x2 x3 x2 x3 − ≤ ln(1 − x) ≤ −x − − . 2 2 2 4 These bounds allow us to bound the main term, t, in the above probability of Theorem 3 (for γ = 1/4) as follows: −x − = α ln α + β ln β − (1 − λ) ln(1 − λ) 3 5 5 3 = (1 − λ) ln(1 − λ) + (1 − λ) ln(1 − λ) 8 8 8 8 − (1 − λ) ln(1 − λ)  2  3 ! 3 1 3 1 3 3 λ − λ ≤ (1 − λ) − λ − 8 8 2 8 4 8  2  3 ! 5 5 1 5 1 5 + (1 − λ) − λ − λ − λ 8 8 2 8 4 8   λ2 λ3 − (1 − λ) −λ − − 2 2 19 3 15 2 3743 4 λ + λ − λ , ≤ − 8192 256 64 which, in turn, is at most λ2 − , 8 for 0 < λ ≤ 0.4. Thus, since this bound is negative for any constant 0 < λ ≤ 0.4, we can set d to be a constant (depending on λ) so that Theorem 3 holds with high probability. Our ECS algorithm, then, is as follows: t 1 That is, H is defined by the union of cycles determined by d random permutations of d the n vertices in V , so Hd is, by definition, a simple directed graph. 8 1. Construct a graph, Hd , as in Theorem 3, as described above, with d set to a constant so that the theorem holds for the fixed λ in the range (0, 0.4] that is given. Note that this step does not require any comparisons; hence, we do not count the time for this step in our analysis (and the theorem holds with high probability in any case). 2. Note that Hd is a union of d Hamiltonian cycles. Thus, let us perform all the comparisons in Hd in 2d rounds. Furthermore, we can do this set of comparisons even for the ER version of the problem. Moreover, since d is O(1), this step involves a constant number of parallel rounds (of O(n) comparisons per round). 3. For each strongly connected component, C, in Hd consisting of elements of the same equivalence class, compare the elements in C with the other elements in S, taking |C| at a time. By Theorem 3, |C| ≥ λn/8. Thus, this step can be performed in O(1/λ) = O(1) rounds for each connected component; hence it requires O(1) parallel rounds in total. Moreover, after this step completes, we will necessarily have identified all the members of each equivalence class. We summarize as follows. Theorem 4. Suppose S is a set of n elements, such that the smallest equivalence class in S is of size at least λn, for a fixed constant, λ, in the range (0, 0.4]. Then the ER version of the equivalence class sorting problem on S can be solved in O(1) parallel rounds using n processors in Valiant’s parallel comparison model. This theorem is true regardless of whether or not λ is known. If the value of λ is not known, it is possible to repeatedly run the ECS algorithm starting with an arbitrary constant of 0.4 for λ and halving the constant whenever the algorithm fails. Once the value is less than the unknown λ, the algorithm will succeed and the number of rounds will be independent of n and a function of only the constant λ. As we show in the next section, this performance is optimal when ` ≥ λn, for a fixed constant λ ∈ (0, 0.4]. 3 Lower Bounds The following lower bound questions were left open by Jayapaul et al. [12]: • If every equivalence class has size f , the total number of comparisons needed to solve the equivalence class sorting problem Θ(n2 /f ) or Θ(n2 /f 2 )? • Is the total number of comparisons for finding an element in the smallest equivalence class Θ(n2 /`) or Θ(n2 /`2 )? Speaking loosely these lower bounds can be thought of as a question of how difficult it is for an element to locate its equivalence class. The Θ(n2 /f ) and 9 x True x x ≡ y? y y x False y Figure 2: We test if x and y are in the same equivalence class. If they are, their vertices are contracted together. If they are not, an edge is added. Θ(n2 /`) bounds can be interpreted as saying the average element needs to compare to at least one element in most of the other equivalence classes before it  finds an equivalent element. Because there must be x2 comparisons between x equivalence classes, the Θ(n2 /f 2 ) and Θ(n2 /`2 ) bounds say we do not need too many more comparisons then the very minimal number needed just to differentiate the equivalence classes. It seems unlikely that so few comparisons are required and we prove that this intuition is correct by proving lower bounds of Ω(n2 /f ) and Ω(n2 /`) comparisons. Note that these lower bounds are on the total number of comparisons needed to accomplish a task, that is they bound the work a parallel algorithm would need to perform. By dividing by n, they also give simple bounds on the number of rounds needed in either the ER or CR models. With respect to such lower bound questions as these, let us maintain the state of an algorithm’s knowledge about element relationships in a simple graph. At each step, the vertex set of this graph is a partition of the elements where each set is a partially discovered equivalence class for S. Thus, each element in S is associated with exactly one vertex in this graph at each step of the algorithm, and a vertex can have multiple elements from S associated with it. If a pair of elements was compared and found to not be equal, then there should be an edge in between the two vertices containing those elements. So initially the graph has a vertex for each element and no edges. When an algorithm tests equivalence for a pair of elements, then, if the elements are not equivalent, the appropriate edge is added (if it is absent) and, if the elements are equivalent, the two corresponding vertices are contracted into a new vertex whose set is the union of the two. A depiction of this is shown in Figure 2. An algorithm has finished sorting once this graph is a clique and the vertex sets are the corresponding equivalence classes. An equitable k-coloring of a graph is a proper coloring of a graph such that the size of each color class is either bn/kc or dn/ke. A weighted equitable kcoloring of a vertex weighted graph is a proper coloring of a graph such that 10 1 3 1 1 2 Figure 3: On the left we have a graph with an equitable 3-coloring and on the right we have a graph with a weighted equitable 3-coloring. the sum of the weight in each color class is either bn/kc or dn/ke. Examples of these can be seen in Figure 3. An adversary for the problem of equivalence class sorting when every equivalence class has the same size f (so f divides n) must maintain that the graph has a weighted equitable n/f -coloring where the weights are the size of the vertex sets. The adversary we describe here will maintain such a coloring and additionally mark the elements and the color classes in a special way. It proceeds as follows. First, initialize an arbitrary equitable coloring on the starting graph that consists of n vertices and no edges. For each comparison of two elements done by the adversary algorithm, let us characterize how we react based on the following case analysis: • If either of the elements is unmarked and this comparison would increase its degree to higher than n/4f , then mark it as having “high” element degree. • If either element is still unmarked, they currently have the same color, and there is another unmarked vertex such that it is not adjacent to a vertex with the color involved in the comparison and no vertex with its color is adjacent to the unmarked vertex in the comparison (i.e. we can have it swap colors with one of the vertices in the comparison), then swap the color of that element and the unmarked element in the comparison. • If either element is still unmarked, they currently have the same color, and there is no other unmarked vertex with a different unmarked color not adjacent to the color of the two elements being compared, then mark all elements with the color involved in the comparison as having “high” color degree and mark the color as having “high” degree. • At this point, either both elements are marked and we answer based on their color, or one of the elements is unmarked and they have different colors, so we answer “not equal” to the adversary algorithm. At all times, the vertices that contain unmarked elements all have weight one, because the adversary only answers equivalent for comparisons once both vertices are marked. When a color class is marked, all elements in that color class are marked as having “high” color degree. A few of the cases the adversary goes through are depicted in Figure 4. 11 Marking an element with high element degree: ≡? ≡? Swapping two colors: ≡? ≡? Marking blue with high color degree: ≡? ≡? Figure 4: Three cases of how the adversary works to mark vertices and swap colors. The dashed line indicates the two elements being compared. Marked vertices are denoted with stars. Lemma 3. If n/8 elements are marked during the execution of an algorithm, then Ω(n2 /f ) comparisons were performed. Proof. There are three types of marked vertices: those with “high” element degree marks, those with “high” color degree marks, and those with both marks. The color classes must have been marked as having “high” degree when a comparison was being performed between two elements of that color class and there were no unmarked color candidates to swap colors with. Because one of the elements in the comparison had degree less than n/4f , only a quarter of the elements have a color class it cannot be swapped with. So if there were at least n − n/4 unmarked elements in total, then the elements in the newly marked color class must have been in a comparison n/2 times. The “high” element degree elements were involved in at least n/4f comparisons each. So if i color classes were marked and j elements were only marked with “high” element degree, then the marked elements must have been a part 12 of a test at least ni/2 + nj/4f ≥ (i + j/f )n/4 times. Once if + j ≥ n/8, then at least n2 /64f equivalence tests were performed. Theorem 5. If every equivalence class has the same size f , then sorting requires at least Ω(n2 /f ) equivalence comparisons. Proof. When an algorithm finishes sorting, each vertex will have weight f and so the elements must all be marked. Thus, by Lemma 3, at least Ω(n2 /f ) comparisons must have been performed. We also have the following lower bound as well. Theorem 6. Finding an element in the smallest equivalence class, whose size is `, requires at least Ω(n2 /`) equivalence comparisons. Proof. We use an adversary argument similar to the previous one, but we start with ` vertices colored a special smallest class color (scc) and seperate the n remaining n − ` vertices into b(n − `)/(` + 1)c color classes of size b(n−`)/(`+1)c n or b(n−`)/(`+1)c + 1. There are two changes to the previous adversary responses. First, the degree requirement for having “high” degree is now n/4`. Second, if an scc element is about to be marked as having “high” degree, we attempt to swap its color with any valid unmarked vertex. Otherwise, we proceed exactly as before. If an algorithm attempts to identify an element as belonging to the smallest equivalence class, no scc elements are marked, and there have been fewer than n/8 elements marked, then the identified element must be able to be swapped with a different color and the algorithm made a mistake. Therefore, to derive a lower bound for the total number of comparisons, it suffices to derive a lower bound for the number of equivalence tests until an scc element is marked. The scc color class cannot be marked as having “high” color degree until at least one scc element has high element degree. However, as long as fewer than n/8 elements are marked, we will never mark an scc element with “high” degree. So at least n/8 elements need to be marked as having “high” element degree or “high” color degree and, by the same type of counting as in Lemma 3, Ω(n2 /`) equivalence tests are needed. 4 Sorting Distributions In this subsection, we study a version of the equivalence class sorting problem where we are given a distribution, D, on a countable set, S, and we wish to enumerate the set in order of most likely to least likely, s0 , s1 , s2 , . . . . For example, consider the following distributions: • Uniform: In this case, D is a distribution on k equivalence classes, with each equivalence class being equally likely for every element of S. 13 • Geometric: Here, D is a distribution such that the ith most probable equivalence class has probability pi (1 − p). Each element “flips” a biased coin where “heads” occurs with probability p until it comes up “tails.” Then that element is in equivalence class i if it flipped i heads. • Poisson: In this case, D is model of the number of times an event occurs in an interval of time, with an expected number of events determined by a parameter λ. Equivalence class i is defined to be all the samples that have the same number of events occurring, where the probability of i events occurring is λi e−λ . i! • Zeta: This distribution, D, is related to Zipf’s law, and models when the sizes of the equivalence classes follows a power law, based on a parameter, s > 1, which is common in many real-world scenarios, such as the frequency of words in natural language documents. With respect to equivalence classes, the ith equivalence class has probability i−s , ζ(s) where ζ(s) is Riemann zeta function (which normalizes the probabilities to sum to 1). So as to number equivalence classes from most likely to least likely, as i = 0, 1, . . ., define DN to be a distribution on the natural numbers such that Pr [x = i] = Pr [y = si ] . x∼DN y∼D Furthermore, so as to “cut off” this distribution at n, define DN (n) to be a distribution on the natural numbers less than or equal to n such that, for 0 ≤ i < n, Pr [x = i] = Pr [y = i] y∼DN x∼DN (n) and Pr x∼DN (n) [x = n] = Pr [y ≥ n] . y∼DN That is, we are “piling up” the tail of the DN distribution on n. The following theorem shows that we can use DN (n) to bound the number of comparisons in an ECS algorithm when the equivalence classes are drawn from D. In particular, we focus here on an algorithm by Jayapaul et al. [12] for equivalence class sorting, which involves a round-robin testing regiment, such that each element, x, initiates a comparison with the next element, y, with an unknown relationship to x, until all equivalence classes are known. Theorem 7. Given a distribution, D, on a set of equivalence classes, then n elements who have corresponding equivalence class independently drawn from D can be equivalence class sorted using a total number of comparisons stochastically dominated by twice the sum of n draws from the distribution DN (n). 14 Proof. Let Vi denote the random variable that is equal to the natural number corresponding to the equivalence class of element i in DN (n). We denote the number of elements in equivalence class i as Yi . Let us denote the number of equivalence tests performed by the algorithm by Jayapaul et al. [12] using the random variable, R. By a lemma from [12], for any pair of equivalence classes, i and j, the roundrobin ECS algorithm performs at most 2 min(Yi , Yj ) equivalence tests in total. Thus, the total number of equivalence tests in our distribution-based analysis is upper bounded by R ≤ = ∞ X i−1 X 2 min(Yi , Yj ) i=0 j=0 2 i−1 n X X i=0 j=0 ≤ 2 ≤ 2 n X i−1 X i=0 min(Yi , Yj ) i=n+1 j=0 Yi + 2 i=0 j=0 n X ∞ X i−1 X min(Yi , Yj ) + 2 iYi + ∞ X nYi i=n+1 ∞ X ! nYi i=n+1 =2 n X Vi i=1 The second line in the above simplification is a simple Pi−1 separation of the double summation and the third line follows because j=0 min(Yi , Yj ) is zero if Yi is zero and at most n, otherwise. So the total number of comparisons in the algorithm is bounded by twice the sum of n draws from DN (n). Given this theorem, we can apply it to a number of distributions to show that the total number of comparisons performed is linear with high probability. Theorem 8. If D is a discrete uniform, a geometric, or a Poisson distribution on a set equivalence classes, then it is possible to equivalence class sort using linear total number of comparisons with exponentially high probability. Proof. The sum of n draws from DN (n) is stochastically dominated by the sum of n draws from DN . Let us consider each distribution in turn. • Uniform: The sum of n draws from a discrete uniform distribution is bounded by n times the maximum value. • Geometric: Pn−1 Let p be the parameter of a geometric distribution and let X = i=0 Xi where the Xi are drawn from Geom(p), which is, of course, related to the Binomial distribution, Bin(n, p), where one flips n coins with probability p and records the number of “heads.” Then, by a Chernoff 15 bound for the geometric distribution (e.g., see [14]), Pr[X − (1/p)n > k] = Pr[Bin(k + (1/p)n, p) < n] ≤ e−2 (pk+n−n)2 k+(1/p)n Pr[X > (2/p)n] ≤ e−np • Poisson: Let λ be the parameter of a Poisson distribution and let Y = Pn−1 Y where the Yi are drawn from P oisson(λ). Then, by a Chernoff i i=0 bound for the Poisson distribution (e.g., see [14]), Pr[Y > (λ(e − 1) + 1)n] = ≤ = Pr[eY > e(λ(e−1)+1)n ] (E[eYi ])n e(λ(e−1)+1)n eλ(e−1)n = e−n (λ(e−1)+1)n e So, in each case with exponentially high probability, the sum of n draws from the distribution is O(n) and the round-robin algorithm does O(n) total equivalence tests. We next address the zeta distribution. Theorem 9. Given a zeta distribution with parameter s > 2, n elements who have corresponding equivalence class independently drawn from the zeta distribution can be equivalence class sorted in O(n) work in expectation. Proof. When s > 2, the mean of the zeta distribution is ζ(s − 1) , ζ(s) which is a constant. So the sum of n draws from the distribution is expected to be linear. Therefore, the expected total number of comparisons in the roundrobin algorithm is linear. Unfortunately, for zeta distributions it is not immediately clear if it is possible to improve the above theorem so that total number of comparisons is shown to be linear when 2 ≥ s > 1 or obtain high probability bounds on these bounds. This uncertainty motivates us to look experimentally at how different values of s cause the runtime to behave. Likewise, our high-probability bounds on the total number of comparisons in the round-robin algorithm for the other distibutions invites experimental analysis as well. 5 Experiments In this section, we report on experimental validatations of the theorems from the previous section and investigations of the behavior of running the round-robin 16 algorithm on the zeta distribution. For the uniform, geometric, and Poisson distributions, we ran ten tests on sizes of 10, 000 to 200, 000 elements incrementing in steps of 10, 000. For the zeta distribution, because setting s < 2 seems to lead to a super linear number of comparisons, we reduced the test sizes by a factor of 10 and ran ten tests each on sizes from 1, 000 to 20, 000 in increments of 1, 000. For each distribution we used the following parameter settings for various experiments: Uniform: Geometric: Poisson: Zeta: k = 10, 25, 100 1 1 , 50 p = 12 , 10 λ = 1, 5, 25 s = 1.1, 1.5, 2, 2.5 The results of these tests are plotted in Figure 5. Best fit lines were fitted whenever we have theorems stating that there will be a linear number of comparisons with high probability or in expectation (i.e., everything except for zeta with s < 2). We include extra plots of the zeta distribution tests with the s = 1.1 data and the s = 1.1, 1.5 data removed to better see the other data sets. We can see from the data that the number of comparisons for the uniform, geometric, and Poisson distributions are so tightly concentrated around the best fit line that only one data point is visible. Contrariwise, the data points for the zeta distributions do not cluster nearly as nicely. Even when we have linear expected comparisons with s = 2, the data points vary by as much as 10%. 6 Conclusion In this paper we have studied the equivalence class sorting problem, from a parallel perspective, giving several new algorithms, as well as new lower bounds and distribution-based analysis. We leave as open problems the following interesting questions: • Is it possible to find all equivalance classes in the ER version of the ECS problem in O(k) parallel rounds, for k ≥ 3, where k is the number of equivalence classes? Note that the answer is “yes” for k = 2, as it follows from previous results for the parallel fault diagnosis problem [4–6]. • Is it possible to bound the number of comparisons away from O(n2 ) for the zeta distribution when s < 2 even just in expectation? • Is it possible to prove a high-probability concentration bound for the zeta distribution, similar to the concentration bounds we proved for other distributions? Acknowledgments This research was supported in part by the National Science Foundation under grant 1228639 and a gift from the 3M Corporation. We would like to thank 17 David Eppstein and Ian Munro for several helpful discussions concerning the topics of this paper. References [1] L. Alonso and E. M. Reingold. Analysis of Boyer and Moore’s MJRTY algorithm. Information Processing Letters, 113(13):495–497, 2013. [2] L. Alonso, E. M. Reingold, and R. Schott. Determining the majority. Information Processing Letters, 47(5):253 – 255, 1993. [3] L. Babai, P. Erdös, and S. M. Selkow. Random graph isomorphism. SIAM Journal on Computing, 9(3):628–635, 1980. [4] R. Beigel, W. Hurwood, and N. Kahale. Fault diagnosis in a flash. In 36th IEEE Symp. on Foundations of Computer Science (FOCS), pages 571–580, 1995. [5] R. Beigel, S. R. Kosaraju, and G. F. Sullivan. Locating faults in a constant number of parallel testing rounds. In 1st ACM Symp. on Parallel Algorithms and Architectures (SPAA), pages 189–198, 1989. [6] R. Beigel, G. Margulis, and D. A. Spielman. Fault diagnosis in a small constant number of parallel testing rounds. In 5th ACM Symp. on Parallel Algorithms and Architectures (SPAA), pages 21–29, 1993. [7] C. Castelluccia, S. Jarecki, and G. Tsudik. Secret handshakes from CA-oblivious encryption. In P. J. Lee, editor, Advances in Cryptology ASIACRYPT, pages 293–307. Springer, 2004. [8] D. J. Cook and L. B. Holder. Mining Graph Data. John Wiley & Sons, 2006. [9] D. Dobkin and J. I. Munro. Determining the mode. Theoretical Computer Science, 12(3):255–263, 1980. [10] M. T. Goodrich. Pipelined algorithms to detect cheating in long-term grid computations. Theoretical Computer Science, 408(2–3):199–207, 2008. [11] S. Jarecki and X. Liu. Unlinkable secret handshakes and key-private group key management schemes. In J. Katz and M. Yung, editors, 5th Int. Conf. on Applied Cryptography and Network Security (ACNS), pages 270–287. Springer, 2007. [12] V. Jayapaul, J. I. Munro, V. Raman, and S. R. Satti. Sorting and selection with equality comparisons. In F. Dehne, J.-R. Sack, and U. Stege, editors, 14th Int. Symp. on Algorithms and Data Structures (WADS), pages 434–445. Springer, 2015. 18 [13] L. Kozma. Useful inequalities cheat sheet, 2016. http://www.lkozma.net/inequalities_cheat_sheet/. [14] M. Mitzenmacher and E. Upfal. Probability and Computing: Randomized Algorithms and Probabilistic Analysis. Cambridge University Press, 2005. [15] H. Orman. The Morris worm: A fifteen-year perspective. IEEE Security & Privacy, 1(5):35–43, 2003. [16] S. Parthasarathy, S. Tatikonda, and D. Ucar. A survey of graph mining techniques for biological datasets. In C. C. Aggarwal and H. Wang, editors, Managing and Mining Graph Data, pages 547–580. Springer, 2010. [17] A. Pelc and E. Upfal. Reliable fault diagnosis with few tests. Combinatorics, Probability and Computing, 7:323–333, 1998. [18] F. P. Preparata, G. Metze, and R. T. Chien. On the connection assignment problem of diagnosable systems. IEEE Trans. on Electronic Computers, EC-16(6):848–854, 1967. [19] M. E. Saks and M. Werman. On computing majority by comparisons. Combinatorica, 11(4):383–387, 1991. [20] A. Sorniotti and R. Molva. A provably secure secret handshake with dynamic controlled matching. Computers & Security, 29(5):619–627, 2010. [21] L. G. Valiant. Parallelism in comparison problems. SIAM Journal on Computing, 4(3):348–355, 1975. [22] S. Xu and M. Yung. K-anonymous secret handshakes with reusable credentials. In 11th ACM Conf. on Computer and Communications Security (CCS), pages 158–167, 2004. 19 Figure 5: The results of the experiments are plotted and best fit lines are placed when we have a linear number of comparisons with high probability or in expectation. 20
8cs.DS
Optimal Decentralized Economical-sharing Scheme in Islanded AC Microgrids with Cascaded Inverters Lang Li1 , Huawen Ye1 , Yao Sun1* , Zhangjie Liu1 , Hua Han1 , Mei Su1 , Josep M. Guerrero2 1 School of Information Science and Engineering, Central South University, Changsha 410083, China Department of Energy Technology, Aalborg University, DK-9220 Aalborg East, Denmark * Correspondence: [email protected] (Y.S.) 2 Abstract: To address the economical dispatch problem without communications in islanded AC microgrids consisting of cascaded inverters, this paper proposes an optimal decentralized economicalsharing scheme. In proposed scheme, optimal sharing function of the current is applied to generate the reference voltages. And the frequency is used to drive all distributed generators (DGs) synchronize operation in microgrids. When the microgrid is in steady state, DGs share a single common frequency and current in terms of the proposed scheme. Thus the potential advantages of simplicity and decentralized manner are retained. The AC microgrid model has been developed through simulations and experiments to verify the effectiveness and performance of the proposed scheme. Keywords: Distributed generation; decentralized scheme; economical operation; microgrids; 1. Introduction Recently, interests have been concentrated on integrating distributed generators due to many economical challenges, technological advancements and environmental impacts [1-4]. The microgrid technology that integrates DGs, energy storage elements and loads has become a most effective way to solve the permeation of large-scale DGs to power grid [5-6]. Usually, there are different types of DGs in a microgrid, and their generation costs are various [7-8]. From the perspective of economics, less costly DGs should be controlled to provide more power and all DGs should be coordinated in economica l operation modes. Economical operation schemes for microgrid could be classified into the centralized, distributed and decentralized approaches. The centralized schemes hold the advantages of economy, better voltage quality and frequency regulations in microgrids [9-11]. However, the control decisions depend on complicated central controllers and communications, which increase costs and complexity, and reduce reliability [10]. The distributed schemes are performed with neighbouring information [12-17]. Zhang et al. [18] introduced a distributed gradient algorithm to realize optimal economical generation control. Further, Zhang et al. [19] selected the incremental costs of each DGs unit as a consensus variable to minimize the total operation cost in a distributed manner. And Yang et al. [20] presented another consensus algorithm for performing the equal incremental costs of each DG with strongly connected communication topology 1 to solve the economical dispatch problem. However, [18-20] are highly dependent on communications for information exchange, and the central controller is unnecessary compared to the centralized schemes. In contrast, some scholars proposed the decentralized approaches to deal with the power dispatch problem, where require no communications [21-23]. Droop control method as decentralized approach has been widely used in microgrids [24-25]. By emulating the behaviour of a synchronous generator, this wellknown control technique aims to proportionally share active and reactive power with adjusting frequency and output voltage amplitudes of each inverter locally [26-27]. However, the power sharing cannot guarantee the economy of microgrid in most cases. In order to reduce the total active generation costs (TAGC) of microgrids via decentralized approach, Nutkani et al. [7] presented the linear droop schemes by introducing maximum or mean generation costs to the droop coefficient, where the lower-cost DG holds higher priority of output power. Actually, the generation cost of DGs is a nonlinear function of active output power, thus the TAGC of microgrids might not be optimized efficiently. Further, applying the nonlinear cost functions of DGs to typical droop scheme, Nutkani et al. [28] proposed a nonlinear costbased droop control scheme. But the optimal economical operation of system is not obtained yet. Cingoz et al. [29] proposed a nonlinear droop control strategy based on polynomial fitting method to realize economical operation of microgrids. Although the economical operation could be achieved with the methods mentioned above, they are not the optimal economical operation approaches in most cases. Moreover, these works are focus on the microgrid with paralleled inverters. Nowadays, the microgrid with cascaded inverters has been recognized as an important alternative in the medium voltage market for microgrid applications [30]. The cascaded inverters fed by DGs in microgrids are capable of achieving high-quality output voltages and input currents with low harmonic content [31-32]. However, there are few studies about the economic dispatch problem for this structure especially via decentralized approach. To address these concerns, this paper proposes an optimal decentralized economical-sharing scheme for the microgrid with cascaded inverters. It applies the frequency and current as carriers to implement the economical dispatch among DGs without communications. The proposed scheme is carried off- line according to the optimal power sharing function of the total loads, and is the incapability of plug-and-play. The proposed scheme is fully decentralized and requires no communication network among DGs, therefore, it offers increased reliability. Finally, the effectiveness of proposed scheme has been verified through simulations and experiments. The rest of the paper is organized as follows. Section 2 shows the problem formulation based on the total active generation costs and the power demand of the mricrogrid. The power transmission 2 characteristics of the microgrid with cascaded inverters are discussed in Section 3. And the proposed optimal economical-sharing scheme is introduced in Section 4. A stability analysis of the proposed scheme is presented in Section 5. Then, the simulation validations in Section 6 and the experimental results in Section 7 are provided to verify the effectiveness and performance of the proposed scheme. Finally the paper is concluded in Section 8. 2. Problem formulation Assume that there are n diapatchable DGs in an islanded microgrid. With the aim of minimizing the total active generation cost, the economical dispatch problem is formulated as: min   Ci  Pi   s.t.  Pi  PL (1) where Pi , PL , Ci  Pi  are the output active power, load requirements, cost function of ith DG, respectively, and i {1,2, , n} . The feasible ranges of (1) are on a closed interval [ Pi ,min , Pi ,max ]. For different load PL ,   there is the corresponding optimal solution P1* , P2* , , Pn* for the economical operation of microgrids. Note that the optimal dispatch Pi* could be regarded as a map of PL : Pi*  i  PL  (2) where i  PL  is a function of PL . Without lose generality, i  PL  is continuously on [ PL,min , PL,max ]. The function i  PL  could be achieved off-line:  If the function Ci  Pi  is simple, such as the positive definite quadratic functions [28], i  PL  can be calculated by analytical method.  If the function Ci  Pi  is complicated, i  PL  could be obtained by fitting method, intelligent algorithm, and so on. 3. Power transmission characteristics of microgrids with cascaded inverters The considered microgrid comprises a series of cascaded inverters [30-32] shown in Fig. 1 (a), and its equivalent circuit is shown in Fig. 1 (b). The obtained load voltage is presented as: n Vx e j x  z z x Vi e ji (3) i 1 3 Local Controller d1 u01 iL1 PCC iL1 Lf Vdc VPCC Rf u01 Line 1 Cf Rd AC LOADS DG1 Local Controller dn iLn Line n Rf Vdc u0n Vx e j x V1e j1 u0n iLn Lf z1 zx zn Cf Rd Vn e j n DGn (a) (b) Fig. 1. (a) Considered microgrids with cascaded inverters (b) equivalent circuit . z  1 n z x   zi (4) i 1 where z x , zi , and z  are load impedance, line impedance, and equivalent impedance, respectively. And z  could be rewritten as: z  Z e j  (5) where   is the phase of z  . After obtaining the load voltage, it is easy to get the expressions of output active power Pi and reactive power Qi of ith DG: Pi  Vi Z  V j cos  i   j     (6) Qi  Vi Z  V j sin  i   j     (7) n j 1 n j 1 Accordingly, it is concluded that the power transmission characteristics of this structure could be summarized as follows:  Pi and Qi of each DG could be regulated by changing the phase difference between  i and  j .  Each DG shares a common current in the microgrid. 4. Proposed decentralized economical-sharing scheme Assume Pi  0 , Qi  0 , the proposed optimal decentralized economical-sharing scheme for AC microgrids with cascaded inverters is: 4 h   fi  f min  Pi   i V   V i PCC  i i  (8) gi  I  (9) n  gi  I  i 1 where h , I , VPCC are positive constant, current, voltage at PCC, respectively, and gi  I  is a function of I for ith DG. When all DGs get into steady state, f1  f 2  P1 : P2 :  fn (10) : Pn  g1  I  : g2  I  : : gn  I  (11) By the characteristics of cascaded inverters, there yields: P1 : P2 : : Pn  V1 : V2 : Q1 : Q2 : : Qn  V1 : V2 : : Vn : Vn (12) (13) Because the voltage of the PCC is regarded as a constant, for different load PL , there is a corresponding current I of microgrid. And PL can be deemed to a map of I , (2) could be written as follows: Pi*  gi  I  (14) Neglecting the voltage loss of line, then V1  V2   Vn  VPCC (15) Combining (12), (14)-(15), yields: Vi  gi  I  n  gi  I  VPCC (16) i 1 The proposed scheme can realize the optimal economical operation for the microgrid with cascaded inverters under the communications unnecessary, control the frequency within the allowable ranges, and maintain the voltage at PCC in rated conditions. The global variables, frequency f and current I , are applied to achieve the optimal economical operation only with the local information. 5 5. Stability analysis To investigate the stability of the microgrid under the proposed scheme, the small- signal analysis method [33-35] is applied. Without loss of generality, the microgrid shown in Fig. 1 is studied. Neglecting the dynamics of fast-time scale, the dynamic equations of ith DG are written as following: h   i  min  Pif i  V   V i PCC  i (17) where min  2 fmin . The Filtered active power Pif and reactive power Qif could be written as: Pif  Pi wc  Pif   Pi  Pif  wc s  wc (18) Qif  Qi wc  Qif   Qi  Qif  wc s  wc (19) where wc is the filter angular frequency. Assume that s is the synchronous frequency in steady state. Let  s   s dt , and denote  i   i   s , then the frequency in (17) is rewritten as:  i  min  s  h i (20) Pif The small-signal model of (18-20) around the operating point is given as follows: Pi  j  Pif wc j 1  j (21) Qi  j  Qif wc  j 1  j (22) n Pif  wc  n Qif  wc   i  h i Pif (23) Express (21-23) in the form of matrix: X  AX X   P1 f Pnf Q1 f   wc 1nn A   0nn  Tδ (24) Qnf 0nn  wc 1nn 0nn 1 TPδ  TQδ  0nn   n  T (25) (26) 6 where TPδ  P1    1    Pn  1 P1   Q1     n   1  ; TQδ     Pn   Qn   1  n  Q1   n    ; I  diag[1  Qn   n  1]nn ; Tφ  diag[ 1 1 1 n ]nn ; To test the stability of the proposed scheme, the root- locus method is applied. The studied microgrid comprises three DGs, and the parameters are same as simulation validations in Section 6. The root locus is depicted by changing the loads and the filter angular frequency wc . There is a simple eigenvalue at zero corresponding to rotational symmetry in Fig. 2 and Fig. 3, which has been proven in [36]. Fig. 2 shows the root locus as the load resistance decreases from 18Ω to 6Ω, in which all eigenvalues are in the left halfplane. Thus the considered microgrid is stable under the load increasing. With wc changing from 80 to 120 rad/s, the poles are in the left half-plane in Fig.3. Therefore, the stable operation of the microgrid could be achieved in terms of the proposed scheme. 600 400 Imaginary 200 0 -200 -400 -600 -120 -100 -80 -60 Real -40 -20 0 20 Fig. 2. Stable root with slower dynamics as the load increases ( wc = 100 rad/s). 400 300 Imaginary 200 100 0 -100 -200 -300 -400 -140 -120 -100 -80 -60 Real -40 -20 0 20 Fig. 3. Root locus by increasing wc (the load resistance is 12 Ω). 7 iL i Lf Micro source Rf Vdc Line i u0i Cf DGi Rd di Local sample iLi Pi Low-pass filter iLi RMS Sinusiodal Voltage Reference gi  I  I  vref iLi u0i u0i Inner control loops (voltage & current) SPWM Modulation Data regulation Vi n  gi  I  fi i 1 Vi VPCC Power Calculation Proposed controller based on cascaded inverters Pi -90 u0i Low-pass filter Qi 1 i h fi  f min Fig. 4. Configuration of the single-phase DG unit. Table 1 Parameters for simulations (see Fig. 1) Parameters Values Parameters Values f (Hz) [49, 51] LLine1 (H) 1.5e-3 VPCC (V) 110 LLine 2 (H) 1.6e-3 L f (H) 1.5e-3 1.2e-3 R f   LLine3 (H) 0.4 Pmax (W) 1000 C f (  F) 20 Qmax (Var) 1000 Rd    3.3 h 0.1 6. Simulation validations The proposed economical-sharing scheme is verified through MATLAB/Simulink. The considered microgrid with three DGs is employed (see Fig. 1). And the associated parameters are listed in Table 1. And the generation cost of ith DG is obtained from [28]: C1  P1   0.25P12 , C2  P2   0.15P22 , C3  P3   0.1P32  0.01P3 . From (2), the optimal solution Pi* is calculated as the map of PL , P1*  1  PL   6PL 31  3 310 , P2*  2  PL   10PL 31  1 62 , P3*  3  PL   15PL 31  4 155 . From (14), PL is the map of I , then the optimal solution could be rewritten as: P1*  g1  I   660I 31  3 310 , 8 P2*  g2  I   1100I 31  1 62 , P3*  g3  I   1650I 31  4 155 . According to the proposed economical sharing scheme: V1  660 31  3 310I  , V2  1 1 0 0 3 1 I 1, 6 V23  1650 31  4 155I  , and I  0 . The detailed configuration of the single-phase DG unite is depicted in Fig. 4. 6.1. Case1: Performance of the proposed scheme as load changes In this case, the DGs are regulated in terms of the proposed scheme, and the fluctuations of the total active power loads are shown in Fig. 5(a). The load demands are scheduled as 0.683p.u, 1.35p.u, 2p.u in the interval [0s, 1s], [1s, 2s], [2s, 3s], respectively. From Fig. 5(b), the frequency of all DGs reaches a common value quickly regardless of load demands variations. It is illustrated that the proposed scheme could adjust all DGs synchronous operation, and controls the frequency within the allowable ranges. When the microgrid gets into steady state, the frequency would converge to a certain value, and yields h i Pi equal as load changes shown in Fig. 5 (c). And the corresponding active power sharing among DGs is shown in Fig. 5 (d). Accordingly, the proposed scheme could regulate all DGs in microgrid synchronous operation, and realize the optimal economical active power sharing among DGs in the presence of load changes. 51 2 2 Frequency (Hz) Loads (p.u) 2.5 1.35 1.5 1 0.683 Load change 0.5 0.5 1 1.5 Time(sec) (a) 2 2.5 50 3 2 Load change f1 0 0.5 1 h 1 1 h 3 P1 h 0.5 2 0 0.5 Active Power (p.u) 1 1.5 Values f2 49.5 49 0 f3 50.5 P3 Load change P2 1 1.5 Time(sec) (c) 2 2.5 3 1.5 Time(sec) (b) 2 2.5 3 Load change P3 0.8 0.6 P2 0.4 P1 0.2 0 0.5 Fig. 5. Variations of (a) the total active power demands (b) frequency over time (c) 1 1.5 Time(sec) (d) h i Pi 2 2.5 3 (d) optimal active power sharing as load changes. The reactive power load demands shown in Fig. 6 (a) are 0.185p.u, 0.366p.u, 0.541p.u in the interval [0s, 1s], [1s, 2s], [2s, 3s], respectively. And the reactive power sharing among DGs wit h load increasing is shown in Fig. 6 (b). The corresponding ratio of the reactive power relative to Q1 is shown in Fig. 6 (c). Similarly, the sharing ratio of the active power with the proposed scheme is shown in Fig. 6 (d). 9 The voltage variations at PCC are shown in Fig. 6, in which it is around 110V as the load changes. Therefore, the allocation ratio of the active and reactive power among DGs is equal over time. The Reactive Power (p.u) Loads (p.u) frequency and voltage at PCC could be controlled within the allowable ranges. 0.541 0.6 0.5 0.4 0.3 0.2 0.1 0.366 0.185 Load change 0 0.5 1 3 1.5 Time(sec) (a) 2 2.5 Q1 0.5 1.5 Time(sec) (b) 2 2.5 3 2 2.5 3 Load change 2.5 P2 P1 2 1.5 0.5 1 P3 P1 Values Values Q2 3 Q2 Q1 0 Q3 3.5 2.5 2 Load change 0 3 Load change Q3 Q1 0.3 0.25 0.2 0.15 0.1 0.05 1 1.5 Time(sec) (c) 2 2.5 3 0 0.5 1 1.5 Time(sec) (d) Fig. 6. Variations of (a) the reactive power demands (b) the reactive power sharing (c) the ratio of reactive power (d) the ratio of active power over time. 150 Load change Voltage (V) 100 50 0 -50 -100 -150 0 0.5 1 1.5 Time(sec) 0.96 1 Time(sec) 2 2.5 3 Voltage (V) 100 50 0 -50 -100 0.92 1.04 1.08 Fig. 7. Simulation waveforms of the voltage at PCC with load stepping. 6.2. Case2: Economy comparisons for the proposed scheme and proportional dispatch scheme In this case, the simulations are implemented with compariso n the TAGC for the proportional sharing scheme and the proposed scheme with the same load changes shown in Fig. 5. The variations of the TAGC are calculated in terms of the proportional-sharing scheme shown in Fig. 8 (a). Under the same setting, the proposed scheme is carried out, and the corresponding TAGC is calculated in Fig. 8 (b). Based on the simulation results, the proposed scheme always obtains the lowest TAGC as the load changes. Therefore, it is concluded that the proposed scheme is a low-cost solution. 10 0.25 0.225 0.2 Load change Cost TAGC Cost TAGC 0.25 0.15 0.106 0.1 0.05 0 0.5 0.15 Proportional Sharing 1 1.5 Time(sec) (a) 2 2.5 0.095 0.1 0.05 0.028 0.204 Load change 0.2 0 3 0.026 0.5 1 1.5 Time(sec) (b) 2 Proposed 2.5 3 Fig.8. Variations of TAGC with (a) proportional sharing scheme (b) proposed scheme. 7. Experimental results A microgrid prototype shown in Fig. 9 is built in lab to verify the effectiveness and performance of the proposed method. It comprises two DGs based on the single phase voltage source inverters which are controlled by digital signal processors (TMS320f28335) and the sampling rate is 12.8 kHz. DG2 and DG3 are considered and the corresponding generation characteristics are same as the simulation validations in Section 6. The experimental parameters are shown in Table 2. Fig.9. Prototype setup of the microgrid with cascaded inverters. Table 2 Parameters for experiments (see Fig. 1) Parameters Values Parameters Values f (Hz) [49, 51] Hz Rd    5 VPCC (V) 100V LLine 2 (H) 0.3e-3 L f (H) 0.6e-3 0.6e-3 R f   LLine3 (H) 0.5 Pmax (W) 200 C f (  F) 20 Qmax (Var) 100 7.1. Case1: Synchronous operation with load changes Due to the limitations of experimental conditions, the microgrid comprises only two DGs. In this case, synchronous operation of DGs in microgrid with cascaded inverters has been verified as the proposed scheme implemented. And the experimental waveform is shown in Fig. 10. From the 11 experimental result, the voltage of DG2 and DG3 and the current of the microgrid are sa me frequency and phase over time. This characteristics are retained even load changes. Therefore, the proposed scheme could satisfy the requirement of DGs’ synchronous operation and maintain the microgrid stable operation. I:[10A/div] V3:[100V/div] V2:[100V/div] Time:[40ms/div] Fig.10. Experimental waveforms with load changes. I:[4A/div] VPCC:[100V/div] Time:[10s/div] I:[4A/div] VPCC:[100V/div] Time:[20ms/div] Fig.11. Experimental voltage and current waveforms with proposed scheme. 7.2. Case2: Performance of the proposed scheme as load changes In this case, the experiment is implemented in terms of the proposed scheme. The experimental voltage and current waveforms at PCC under load variations are shown in Fig. 11. The active power loads over time are shown in Fig.12 (a). When the microgrid is in steady state, the frequency converges to a certain point shown in Fig. 12 (b). And the proposed scheme could drive DGs synchronous operation and maintain the microgrid stability. The active power allocations of DG2 and DG3 with the proposed scheme 12 are illustrated in Fig. 12 (c). The reactive power sharing among DGs with the same ratio of active power allocations are shown in Fig. 12 (d). Based on the experimental result, the proposed scheme could drive DGs synchronization and realize the microgrid stable operation, the frequency and voltage could be controlled within the feasible ranges. Loads (p.u) 1.55 1.08 Frequency (Hz) 49.15 1.5 1.08 1 0.54 0.54 0.5 0 10 20 30 40 50 60 Time (sec) 70 80 90 100 f2 49.1 f3 49.05 49 0 10 20 30 40 20 30 40 (a) Reactive Power (p.u) Active Power (p.u) 1 P3 0.8 0.6 0.4 P2 0.2 0 10 20 30 40 50 60 Time (sec) 70 80 90 100 50 60 Time (sec) (b) 70 80 90 100 70 80 90 100 0.5 0.4 0.3 Q3 0.2 0.1 Q2 0 10 50 60 Time (sec) (d) (c) Fig.12. Variations of (a) active power load demands (b) frequency (c) active power sharing (d) reactive power sharing. I:[10A/div] V3:[100V/div] V2:[100V/div] Time:[10s/div] I:[10A/div] V3:[100V/div] V2:[100V/div] Time:[20ms/div] Fig.13. Experimental waveforms with load changes. 7.3. Case3: Economy comparisons for the proposed scheme and proportional dispatch scheme In this case, the economy is compared with the proposed scheme and proportional dispatch scheme under the same setup. The experimental voltage and current waveforms are shown in Fig. 13. And the 13 active power demands of the microgrid are shown in Fig. 12 (a). Under the implementation of proportiona l dispatch scheme, the frequency variations over time are shown in Fig. 14 (a). And the corresponding active power sharing among DGs is shown in Fig. 14 (b). The TAGC is calculated with the proportiona l dispatch scheme shown in Fig. 14 (c). Similarly, the TAGC with the proposed scheme is shown in Fig. 14 (d), which is always lower than Fig. 14 (c). Accordingly, the proposed scheme could realize the optimal economical sharing while maintaining the smooth and stable operation even in presence of load stepping. f3 49.05 49 0 0.15 TAGC Active Power (p.u) f2 49.1 10 20 0 40 Proportional 0.1 0.05 30 50 60 Time (sec) (a) 70 80 100 30 40 50 60 Time (sec) P2 0.4 0.2 10 70 80 90 100 20 0 30 40 50 60 Time (sec) (b) 70 80 90 100 Proposed 0.1532 0.1 0.05 0.0209 20 P3 0.6 0.15 0.0783 0.0209 0.8 0 0.1579 0.0783 10 90 TAGC Frequency (Hz) 49.15 0.0762 0.0762 0.0205 10 0.0205 20 30 (c) 40 50 60 Time (sec) (d) 70 80 90 100 Fig.14. Variations of (a) frequency (b) active power sharing (c) TAGC with proportional dispatch scheme (d) TAGC with proposed scheme. 8. Conclusion In this paper, an optimal decentralized economical-sharing scheme is proposed to reduce the total active generation costs to a minimum for microgrids with cascaded inverters. The optimal power delivery is implemented through the global variables frequency and current. Because the implementation of the proposed method only needs the local information of each DG, communications are not needed. Therefore, it is a reliable and low-cost solution. Moreover, the frequency and voltage at PCC could be controlled within the allowable ranges. The construction of the proposed scheme is carried off- line, and the simplicity is preserved and hence more likely to meet industry requirement. The simulations and experiments have been verified the effectiveness and performance of the proposed method. The aim of this work is to show the validity of the proposed optimal decentralized economicalsharing scheme. And the more work would be covered in future, such as integrating DGs power ratings, realizing four-quadrant operation. 14 9. References [1] Z. Zhang, X. Huang, and J. Jiang, “A load-sharing control scheme for a microgrid with a fixed frequency inverter,” Electric Power Systems Research, vol. 80, pp. 311–317, doi:10.1016/j.epsr.2009.09.014, May. 2011. [2] R. J. Hamidi, H. Livani, and S.H. Hosseinian, “Distributed cooperative control system for smart microgrids,” Electric Power Systems Research, vol. 130, pp. 241–250, doi:10.1016/j.epsr.2015.09.012, Sep. 2015. [3] W. Fei, J. Duarte, Hendrix, M.A.M, “Grid-interfacing converter systems with enhanced voltage quality for microgrid application concept and implementation,” IEEE Trans. Power Electron., vol. 26, no. 12, pp. 3501– 3513, Apr. 2011. [4] R. Moslemi, J. Mohammadpour, “Accurate reactive power control of autonomous microgridsusing an adaptive virtual inductance loop,” Electric Power Systems Research, vol. 129, pp. 142–149, doi:10.1016/j.epsr. 2015.08.001, Aug. 2015. [5] P. Arboleya, D. Diaz, and J.M. Guerrero, “An improved control scheme based in droop characteristic for microgrid converters,” Electric Power Systems Research, vol. 80, pp. 1215–122, doi:10.1016/j.epsr.2010.04.003, Jun. 2010. [6] H. Han, Y. Liu, and Y. Sun, “An improved droop control strategy for reactive power sharing in islanded microgrid,” IEEE Trans. Power Electron., vol. 30, no. 6, pp. 3133–3141, Jun. 2015. [7] I. U. Nutkani, P. C. Loh, and P. Wang, “Linear decentralized power sharing schemes for economic operation of AC microgrids,” IEEE Trans. Industrial Electronics, vol. 63, no. 1, pp. 225-234, Jan. 2016. [8] N. Nikmehr, S. N. Ravadanegh, “Optimal Power Dispatch of Multi-Microgrids at Future Smart Distribution Grids,” IEEE Trans. Smart Grid, vol. 6, no. 4, pp.1648–1657, Jul.2015. [9] E. Barklund, N. Pogaku, M. Prodanovic, C. Hernandez-Aramburo, and T. C. Green, “Energy management in autonomous microgrid using stability-constrained droop control of inverters,” IEEE Trans. Power Electron., vol. 23, no. 5, pp. 2346–2352, Sep. 2008. [10] A. G. Tsikalakis and N. D. Hatziargyriou, “Centralized control for optimizing microgrids operation,” IEEE Trans. Energy Convers., vol. 23, no. 1, pp. 241–248, Mar. 2008. [11] F. Katiraei, R. Iravani, N. Hatziargyriou, and A. Dimeas, “Microgrids management,” IEEE Power Energy Mag, Vol. 6, no. 3, pp. 54–65, May. 2008. [12] Yao, S., Chaolu, Z., Xiaochao, H., et al.: ‘Distributed cooperative synchronization strategy for multi-bus microgrids’, International Journal of Electrical Power and Energy Systems, vol. 86, pp. 18-28, Mar. 2017. [13] M. Yazdanian , and A. Mehrizi-Sani, “Distributed control techniques in microgrids,”IEEE Trans. Smart Grid, vol. 5, no. 6, pp. 2901–2909, 2014. [14] Q. Shafiee, J. M. Guerrero, and J. C. Vasquez, “Distributed secondary control for islanded microgrids —A novel approach,” IEEE Trans. Power Electron., vol. 29, no. 2, pp. 1018–1031, 2014. [15] J. W. Simpson-Porco, Q. Shafiee, F. D¨orfler, J. C. Vasquez, J. M.Guerrero, and F. Bullo, “Secondary frequency and voltage control of islanded microgrids via distributed averaging,” IEEE Trans. Ind.Electron., vol. 62, no. 11, pp. 7025–7038, 2015. [16] H. Xin, Z. Lu, Y. Liu, and D. Gan, “A center-free control strategy for the coordination of multiple photovoltaic generators,” IEEE Trans. Smart Grid, vol. 5, no. 3, pp. 1262–1269, 2014. [17] V. Nasirian, Q. Shafiee, J. M. Guerrero, F. L. Lewis, and A. Davoudi,“Droop-free distributed control for AC microgrids,” IEEE Trans. Power Electron., vol. 31, no. 2, pp. 1600–1617, 2016. [18] W. Zhang, W. Liu, X. Wang, L. Liu, and F. Ferrese, “Online optimalgeneration control based on constrained distributed gradient algorithm,”IEEE Trans. Power Syst., vol. 30, no. 1, pp. 35–45, 2015. [19] Z. Zhang and M.-Y. Chow, “Convergence analysis of the incremental cost consensus algorithm under different communication network topologies in a smart grid,” IEEE Trans. Power Syst., vol. 27, no. 4, pp. 1761– 1768, 2012. [20] S. Yang, S. Tan, and J.-X. Xu, “Consensus based approach for economic dispatch problem in a smart grid,” IEEE Trans. Power Syst., vol. 28,no. 4, pp. 4416–4426, 2013. 15 J. M. Guerrero, H. Lijun, and J. Uceda, “Control of distributed uninterruptible power supply systems,” IEEE Trans. Ind. Electron., vol. 55, no. 8, pp. 2845–2859, Jul. 2008. [22] J. M. Guerrero, M. Chandorkar, T.-L. Lee, and P. C. Loch, “Advanced control architectures for intelligent microgrids—Part I: Decentralized and hierarchical control,” IEEE Trans. Ind. Electron., vol. 60, no. 4, pp.1254– 1262, 2013. [23] D. E. Olivares, A. Mehrizi-Sani, A.H. Etemadi, “Trends in microgrid control,” IEEE Trans. Smart Grid,vol. 5, no. 4, pp. 1905–1919, 2014. [24] N. Jaleeli, L. S. VanSlyck, D. N. Ewart , L. H. Fink, and A. G. Hoffmann,“Understanding automatic generation control,” IEEE Trans. Power Syst.,vol. 7, no. 3, pp. 1106–1122, Aug. 1992. [25] Yajuan Guan, Josep M. Guerrero, and Xin Zhao,“A New Way of Controlling Parallel-Connected Inverters by Using Synchronous-Reference-Frame Virtual Impedance Loop—Part I: Control Principle,” IEEE Trans. Power Electron., VOL. 31, NO. 6, pp. 4576-4593, Jun. 2016. [26] P. Piagi and R. H. Lasseter, “Autonomous control of microgrids,” IEEE Power Engineering Society General Meet., Montreal, Canada, 2006. DOI: 10.1109/PES.2006.1708993. [27] C. T. Lee, “A new droop control method for the autonomous operation of distributed energy resource interface converters,” IEEE Trans. Power Electron., vol. 28, no. 4, pp. 1980–1993, Apr. 2013. [28] I. U. Nutkani, P. C. Loh, and F. Blaabjerg, “Droop scheme with consideration of operating costs,” IEEE Trans. Power Electron., vol. 29, no. 3, pp. 1047-1052, May. 2014. [29] F. Cingoz, A. Elrayyah, Y. Sozer, “P lug and play nonlinear droop construction scheme to optimize microgrid operations,” Energy Conversion Congress and Exposition (ECCE), Pittsburgh, PA, Sept. 2014, pp. 76 – 83. [30] A. Mortezaei, M. G. Simões, and A. S. Bubshait, “Multifunctional Control Strategy for Asymmetrical Cascaded H-Bridge Inverter in Microgrid Applications,” IEEE Trans. Industry Applications, early access, DOI: 10.1109/TIA.2016.2627521. [31] M. Malinowski, K. Gopakumar, J. Rodriguez, and M. A. Perez, “A survey on cascaded multilevel inverters,” IEEE Trans. Ind. Electron., vol. 57, no. 7, pp. 2197–2206, Jul. 2010. [32] R. R. Karasani, V. B. Borghate, and P. M. Meshram, “A Three-Phase Hybrid Cascaded Modular Multilevel Inverter for Renewable Energy Environment,” IEEE Trans. Power Electronics, vol. 32, no. 2, pp. 1070–1087, Feb. 2017. [33] N. Pogaku, M. Prodanovic and T. Green, “Modeling, analysis and testing of autonomous operation of an inverter-based microgrid,” IEEE Trans. Power Electron, vol. 22, no. 2, pp. 613–625, Mar. 2007. [34] Y. A.-R. I. Mohamed and E. F. El-Saadany, “Adaptive decentralized droop controller to preserve power sharing stability of paralleled inverters in distributed generation microgrids,” IEEE Trans. Power Electron, vol. 23, no. 6, pp.2806–2816, Dec. 2008. [35] X. Q. Guo, Z. G. Lu, and B. C. Wang, “Dynamic Phasors-Based Modeling and Stability Analysis of DroopControlled Inverters for Microgrid Applications,” IEEE Trans. Smart Grid, vol. 5, no. 6, pp. 2980-2987, Nov. 2014. [36] J. W. Simpson-Porco, F. Dörfler, and F. Bullo, “Synchronization and power sharing for droop-controlled inverters in islanded microgrids,” Automatica, vol. 49, no. 9, pp. 2603–2611, Sep. 2013. [21] 16
3cs.SY
Generalizations of local bijectivity of Keller maps and a proof of 2-dimensional Jacobian conjecture 1 Yucai Su arXiv:1603.01867v23 [math.AG] 11 Apr 2018 School of Mathematical Sciences, Tongji University, Shanghai 200092, China Email: [email protected] Abstract. Let (F, G) ∈ C[x, y]2 be a Jacobian pair and σ : (a, b) 7→ (F (a, b), G(a, b)) for (a, b) ∈ C2 the corresponding Keller map. The local bijectivity of Keller maps tells that for p ∈ C2 , there exist neighborhoods Op of p and Oσ(p) of σ(p) such that σp = σ|Op : Op → Oσ(p) is a bijection. Thus if there σp0 : Op0 → Op1 is exist p0 , p1 ∈ C2 with p0 6= p1 , σ(p0 ) = σ(p1 ), then the local bijectivity implies that σp−1 1 a bijection between some neighborhoods of p0 and p1 . We generalize this result in various aspects, which lead us to give a proof of injectivity of Keller maps and thus the 2-dimensional Jacobian conjecture. Among  those generalizations, one is the following (cf. Theorem 1.5): For any (p0 , p1 ) = (x0 , y0 ), (x1 , y1 ) ∈ C2 × C2 1 satisfying p0 6= p1 , σ(p0 ) = σ(p1 ), 1 ≤ |x1 | ≤ |x0 | ≤ 2|x1 |κ1 , ℓp0 ,p1 := |y1 | 2 − κ2 |x0 | ≥ −κ3 for some preassigned κi ∈ R>0 , there exists (q0 , q1 ) ∈ C2 × C2 satisfying the same conditions, and furthermore ℓq0 ,q1 > ℓp0 ,p1 . 1 Main theorem  Let us start with an arbitrary Jacobian pair (F, G) ∈ C[x, y]2 i.e., a pair of polynomials on two ∂F ∂F  ∂x ∂y ∈ C6=0 , such variables x, y with a nonzero constant Jacobian determinant J(F, G) := ∂G ∂G ∂x C2 that the corresponding Keller map σ : p = (a, b) ∈ C2 is not injective. Namely, → C2 ∂y sending p 7→ (F (p), G(p)) := (F (a, b), G(a, b)) for σ(p0 ) = σ(p1 ) for some p0 = (x0 , y0 ), p1 = (x1 , y1 ) ∈ C2 with p0 6= p1 . (1.1) The local bijectivity of Keller maps says that for p ∈ C2 , there exist neighborhoods Op of p and Oσ(p) of σ(p) such that σp = σ|Op is a bijection between these two neighborhoods. This implies that σp−1 σp0 : Op0 → Op1 is a bijection between some neighborhoods Op0 of p0 and Op1 of p1 (we may 1 assume Op0 and Op1 are disjoint), i.e., any q0 ∈ Op0 is in 1–1 correspondence with q1 ∈ Op1 such that σ(q0 ) = σ(q1 ) and q0 6= q1 . In this paper we generalize this result in various aspects, which lead us to present a proof of injectivity of Keller maps, which implies the well-known Jacobian conjecture (see, e.g., the References). Theorem 1.1 (Main Theorem) Let (F, G) ∈ C[x, y]2 be a Jacobian pair. Then the Keller map σ is injective. In particular, the 2-dimensional Jacobian conjecture holds, i.e., F, G are generators of C[x, y]. First we give some formulations. Fix a sufficiently large ℓ ∈ R>0 . Applying the variable change,  (x, y) 7→ x + (x + y)ℓ , x + y , (1.2) and rescaling F, G, we can assume Supp F ⊂ ∆0,ξ,η , FL = (x + y)m , J(F, G) = 1, where 1 Supported by NSF grant 11431010 of China Mathematics Subject Classification (2000): 14R15, 14E20, 13B10, 13B25, 17B63 1 (1.3) • Supp F := {(i, j) ∈ Z2≥0 | Coeff (F, xi y j ) 6= 0} is the support of F [cf. Convention 2.1 (2) (iv) for notation Coeff (F, xi y j ) ], • ∆0,ξ,η is the triangular with vertices 0 = (0, 0), ξ = (m, 0), η = (0, m) for some m ∈ Z>0 , • L is the edge of Supp F linking vertices ξ, η, • FL , which we refer to as the leading part of F , is the part of F corresponding to the edge L (which means that Supp FL = L ∩ Supp F ). The reason we take the variable change (1.2) is to use the leading part FL of F to control F in some sense [cf. (3.10)], which guides us to obtain Theorem 1.3. Throughout the paper, we use the following notations,  (p0 , p1 ) = (x0 , y0 ), (x1 , y1 ) ∈ C2 × C2 ∼ = C4 ,   V = (p0 , p1 ) = (x0 , y0 ), (x1 , y1 ) ∈ C4 σ(p0 ) = σ(p1 ), p0 6= p1 ,  Vξ0 ,ξ1 = {(p0 , p1 ) = (x0 , y0 ), (x1 , y1 ) ∈ V | x0 = ξ0 , x1 = ξ1 } for any ξ0 , ξ1 ∈ C. (1.4) (1.5) (1.6) Then V 6= ∅ by assumption (1.1). The main result used in the proof of Theorem 1.1 is the following. Theorem 1.2 (i) There exist ξ0 , ξ1 ∈ C such that Vξ0 ,ξ1 = ∅. (ii) Fix any ξ0 , ξ1 ∈ C satisfying (i). Denote  dp0 ,p1 = |x0 − ξ0 |2 + |x1 − ξ1 |2 for (p0 , p1 ) = (x0 , y0 ), (x1 , y1 ) ∈ V. (1.7) dq0 ,q1 < dp0 ,p1 . (1.8)  Then for any (p0 , p1 ) ∈ V , there exists (q0 , q1 ) = (ẋ0 , ẏ0 ), (ẋ1 , ẏ1 ) ∈ V such that After a proof of this result, it is then not surprising that it can be used to give a proof of Theorem 1.1 by taking some kind of “limit” [cf. (5.2)], which can guide us to derive a contradiction. We would like to mention that at a first sight, Theorem 1.2 (i) seems to be obvious, however its proof is highly nontrivial to us, it needs several results, which we state below. Here is the first one. Theorem 1.3 Denote   hp0 ,p1 = max |x1 |, |y1 |, |x0 |, |y0 | for (p0 , p1 ) = (x0 , y0 ), (x1 , y1 ) ∈ V, (1.9) hp0 ,p1 ≥ s0 , (1.10) and call hp0 ,p1 the height of (p0 , p1 ). There exists s0 ∈ R>0 (depending on m = deg F, deg G and  coefficients of F and G ) satisfying the following: For any (p0 , p1 ) = (x0 , y0 ), (x1 , y1 ) ∈ V with we must have m m+1 In particular if hp0 ,p1 m+1 m+2 |a − b| < nt m m+1 |x0 + y0 | < hp0 ,p1 , |x1 + y1 | < hp0 ,p1 .  = max |xt |, |yt | (for some t ∈ {0, 1} ), then   for any a, b ∈ |xt |, |yt |, hp0 ,p1 , where nt = min |xt |, |yt | . 2 (1.11) (1.12) To prove Theorem 1.2 (i), we assume conversely that Vξ0 ,ξ1 6= ∅ for all ξ0 , ξ1 ∈ C. (1.13) Then we are able to obtain the following. Theorem 1.4 Under the assumption (1.13), we have the following. (i) The following subset of V is a nonempty closed bounded subset of C4 for any k0 , k1 ∈ R≥0 ,   Ak0 ,k1 = (p0 , p1 ) = (x0 , y0 ), (x1 , y1 ) ∈ V |x0 | = k0 , |x1 | = k1 . (1.14) (ii) The following is a well-defined function on k0 , k1 ∈ R≥0 , γ k0 ,k1 = max  |y1 |  (p0 , p1 ) = (x0 , y0 ), (x1 , y1 ) ∈ Ak0 ,k1 . (1.15) (iii) The γ k0 ,k1 is an “almost strictly” increasing function on both variables k0 , k1 ∈ R≥0 in the following sense, (a) γ k0′ ,k1 > γ k0,k1 if k0′ > k0 ≥ 0, k1 ≥ 0, (b) γ k0,k1′ > γ k0,k1 if k0 > 0, k1′ > k1 ≥ 0. (1.16) This result is then used to prove the following. Theorem 1.5 hold. (1) There exist κ, k ∈ R>0 with k being sufficiently large such that the following  (i) The subset V0 of V containing the elements (p0 , p1 ) = (x0 , y0 ), (x1 , y1 ) satisfying is a nonempty set: −1 (a) 1 ≤ |x1 | ≤ |x0 | ≤ 2|x1 |1−k , 1 (b) ℓp0 ,p1 := |y1 | 2 − kk |x0 | ≥ κ − kk . (ii) For any (p0 , p1 ) ∈ V0 , at most only one equality can hold in (1.17) (a).  (2) For any (p0 , p1 ) ∈ V0 , there exists (q0 , q1 ) = (ẋ0 , ẏ0 ), (ẋ1 , ẏ1 ) ∈ V0 such that ℓq0 ,q1 > ℓp0 ,p1 . (1.17) (1.18) Remark 1.6 (1) Throughout the paper we will frequently use the local bijectivity of Keller maps. Theorem 1.5 (2) says that (a) 1 ≤ |ẋ1 | ≤ |ẋ0 | ≤ 2|ẋ1 |1−k (c) σ(q0 ) = σ(q1 ), −1 , 1 1 (b) |ẏ1 | 2 − k k |ẋ0 | + k k |x0 | − |y1 | 2 > 0, (1.19) (d) q0 6= q1 . (1.20) If we regard ẋ0 , ẏ0 , ẋ1 , ẏ1 as 4 free variables, then the local bijectivity always allows us to obtain (1.19) (c), which imposes two restrictions on 4 variables. We can impose at most two more “nontrivial” restrictions on them [we regard (1.19) (d) as a trivial restriction, see below]. The main difficulty for us is how to impose two more “solvable” restrictions on variables [see (3) below] to control ẋ0 , ẏ0 , ẋ1 , ẏ1 in order to achieve our goal of “deriving a contradiction”. However, it seems to us that two more restrictions are always insufficient to 3 achieve the goal. Here, condition (1.19) (b) imposes one more restriction, and we have one free variable left. However there are 3 restrictions in (1.19) (a), thus in general there will be no solutions. Thanks to Theorem 1.5 (1) (ii) [see (2) below], we only need to take care of one restriction in (1.19) (a) each time [cf. (4.42)] since we are always under a “local” situation (i.e., we are only concerned with a small neighborhood of some points each time), and thus the inequation in (1.19) (a) is solvable [we do not need to consider condition (1.19) (d) under the “local” situation, we only need to take care of it when we take some kind of “limit”, cf. (5.2)]. (2) Condition (1.19) (b) is not only used to control |ẋ1 | and |ẏ1 |, but also used to take the “limit”; while (1.19) (a) is used to control |ẋ0 | and |ẋ1 |. We remark that (1.17) (a) will guarantee [cf. (4.43)] that k k |x0 | − |y1 | > 0, which is very crucial in order to ensure that (1.19) (b) is solvable [see (3) below and Remark 4.5]. We would also like to mention that to find conditions like the ones in (1.17) satisfying Theorem 1.5 (1) (ii) has been extremely difficult for us, we achieve this by using Theorem 1.4 to prove two technical lemmas (Lemmas 4.3 and 4.4). (3) One may expect to have some statements such as one of the following: (i) For any (p0 , p1 ) ∈ V with |x0 |θ0 + |x1 |θ1 ≤ s (for some θi , s ∈ R>0 ), there exists (q0 , q1 ) ∈ V such that (a) |ẋ0 |θ0 + |ẋ1 |θ1 ≤ s, (b) |ẏ1 |θ2 > |y1 |θ2 . (1.21) (ii) For any (p0 , p1 ) ∈ V with |x1 |θ1 ≤ |y1 |θ2 + s, there exists (q0 , q1 ) ∈ V such that (a) |ẋ1 |θ1 ≤ |ẏ1 |θ2 + s, (b) |ẏ0 |θ3 − |ẋ0 |θ4 > |y0 |θ3 − |x0 |θ4 . (1.22) If a statement such as one of the above could be obtained, then a proof of Theorem 1.1 would be easier. At a first sight, the condition (1.21) (a) [or (1.8)] only imposes one restriction on variables, however it in fact contains 2 hidden restrictions [see arguments after (5.7)] simply because the left-hand side of “ < ” has 2 positive terms with absolute values containing variables. The second condition in (1.22) is unsolvable as will be explained in Remark 4.5. We would also like to point out that to obtain Theorem 1.1, we always need to take some kind of “limit” [cf. (5.2)] to derive a contradiction. Thus some condition such as (1.8), (1.19) (b), (1.21) (b) or (1.22) (b) is necessary in order to take the “limit”. 2 Some preparations We need some conventions and notations, which, for easy reference, are listed as follows. Convention 2.1 (1) A complex number is written as a = are + aim i for some are , aim ∈ R, √ where i = −1. If ab appears in an expression, then we assume b ∈ R, and in case a 6= 0, we interpret ab as the unique complex number r b ebθi by writing a = reθi for some r ∈ R>0 , −π < θ ≤ π and e is the natural number. P (2) Let P = i∈Z≥0 pi y α+i ∈ C(x)((y)) with α ∈ Z, pi ∈ C(x). (i) Assume p0 = 1. For any β ∈ Q with αβ ∈ Z, we always interpret P β as   j   ∞ P P β β αβ ∈ C(x)((y)), pi y i 1+ P =y j=1 j i∈Z>0 4 (2.1) where in general, Then  k λ1 ,λ2 ,...,λi ′ is the multi-nomial coefficient k(k−1)···(k−(λ1 +λ2 +···+λi )+1) . λ1 !λ2 !···λi ! ′ (P β )β = P ββ for any β, β ′ ∈ Q with αβ, αββ ′ ∈ Z. (2.2) If p0 6= 1, then pβ0 is in general a multi-valued function, and if we fix a choice of pβ0 , then (2.2) only holds when β ′ ∈ Z [fortunately we will only encounter this situation, cf. (3.22) and statements after it]. (ii) For Q1 , Q2 ∈ C(x)((y)), we use the following notation [as long as it is algebraically a well-defined element in C(x)((y)) ] P (Q1 , Q2 ) = P |(x,y)=(Q1 ,Q2 ) = P i pi (Q1 )Qα+i 2 . (2.3) (iii) If Q1 , Q2 ∈ C with Q2 6= 0, we also use (2.3) to denote a well-defined complex number as long as pi (Q1 ) exists for all posible i and the series (2.3) converges absolutely. P (iv) For Q = i∈Z≥0 qi y β+i ∈ C(x)((y)), by comparing coefficients of y β+i for i ≥ 0, there exists uniquely bi ∈ C(x) such that Q= ∞ P bi P β+i α (2.4) . i=0 We call bi the coefficient of P β+i α in Q, and denote by Coeff (Q, P β+i α ). If Q = with qij ∈ C, we also denote Coeff (Q, xi y j ) = qij . P i,j qij x i yj (3) Throughout the paper, we need two independent parameters k ≫ 1 (i.e., k → ∞) and E → 0. We use the following convention: Symbols s, s j for j ≥ 0 always denote some (sufficiently large) numbers independent of E , k . We use O(E i ) for i ∈ Q≥0 to denote any element P in C(x)((y)) (or especially in C) such that P (ẋ, ẏ) converges absolutely and |E −i P (ẋ, ẏ)| < s for some fixed s, where (ẋ, ẏ) is in some required region which will be specified in the context. pj y j ∈ C(x)((y)), pj ∈ C(x), and (x0 , y0 ) ∈ C2 with y0 6= 0. If pj (x0 ) exists for all P possible j, and z0 = j |pj (x0 )y0j | converges, then z0 is called the absolute converging value of P at (x0 , y0 ), denoted by A(x0 ,y0 ) (P ) (or by A(y0 ) (P ) if P does not depend on x). Let P = P j Definition 2.2 exists and (1) Let P be as above and Q = P i qi y i ∈ C((y)), qi ∈ R≥0 , x0 ∈ C. If pi (x0 ) |pi (x0 )| ≤ qi for all possible i, (2.5) then we say Q is a controlling function for P on y at point x0 , and denote P Exy 0 Q or Q Dxy 0 P (or P Ey Q or Q Dy P when there is no confusion). (2.6) In particular if P, Q do not depend on y then we write P Ex0 Q or Q Dx0 P (thus a E b for a, b ∈ C simply means |a| ≤ b). (2) An element in C((y)) with non-negative coefficients (such as Q above) is called a controlling function on y. 5 P (3) If Q = q0 y α + j>0 qj y α+j ∈ C((y)) is a controlling function on y with qi ∈ R≥0 and q0 > 0, then we always use the same symbol with subscripts “ igo ” and “ neg ” to denote the elements   P P (2.7) qj y j = q0 y α (1 − Qigo ). qj y j , Qneg = q0 y α 1 − q0−1 Qigo = q0−1 j>0 j>0 We call Qigo the ignored part of Q, and Qneg the negative correspondence of Q [in sense of (2.9) and (2.10), where a, −k are nonpositive]. Lemma 2.3 (1) If P = p0 y α + P j>0 pj y α+j ∈ C(x)((y)), Q = q0 y α + j>0 with P Exy 0 Q, x0 ∈ C and |p0 (x0 )| = q0 ∈ R>0 , then (a) ∂P dQ Eyx0 ± , ∂y dy P qj y α+j ∈ C((y)), (b) P a Exy 0 Qaneg Ey (q0 y α )−b Qa+b neg for a, b ∈ Q− , Qk Ey (q0 y α )2k Q−k neg Ey          (q0 y α )k if k ∈ Z≥1 , 1 − kQigo  kQigo  (q0 y α )k 1 + if k ∈ Q≥0 with k < 1. 1 − Qigo (2.8) (2.9) (2.10) where (2.9) (a) holds under the condition: either both P and Q are power series of y (in this case the sign is “ + ”), or else both are polynomials on y −1 (in this case the sign is “ − ”). (2) If x0 , y0 ∈ C with y0 6= 0, and P1 Exy 0 Q1 , P2 Exy 0 Q2 , then A(x0 ,y0 ) (P1 P2 ) ≤ A(y0 ) (Q1 )A(y0 ) (Q2 ) = Q1 (|y0 |)Q2 (|y0 |). (2.11) Proof. (2) and (2.9) (a) are obvious, (2.9) (b) and (2.10) are obtained by noting that for a, b ∈ Q− and i ∈ Z>0 , one has (             ki if k ∈ Z≥1 , a a a + b a + b k −k (−1)i = ≤ = (−1)i , and ≤ ≤ i i i i i i k if 0 < k ∈ Q<1 .  Take ∞ P F̃ = f˜1 y + f˜i y i ∈ C(x)[[y]] with f˜i ∈ C(x) and f˜1 = 6 0. (2.12) i=2 Regarding F̃ as a function on y (with fixed x), we have the formal inverse function denoted by yF̃ ∈ C(x)[[F̃ ]] such that [cf. (2.4)] y = yF̃ (F̃ ) = b 1 F̃ + ∞ P b i F̃ i , (2.13) i=2 with b i = Coeff (y, F̃ i ) ∈ C(x) being determined by b 1 = f˜1−1 ∈ C(x) and     j i−1 P ˜j−i P P j ℓ λn b i = − b j f1 f˜1−λ1 −λ2 −···−λn f˜2λ1 f˜3λ2 · · · f˜n+1 , (2.14) ℓ λ , λ , ..., λ 1 2 n j=1 ℓ=0 n∈Z≥0 , λ1 ,λ2 ,...,λn ≥0 λ1 +2λ2 +···+nλn = i−j for i ≥ 2, which is obtained by comparing the coefficients of y i in (2.13). 6 Lemma 2.4 Let F̂ = â1 y + ∞ P i=2 âi y i ∈ C[[y]] and F̂ neg = â1 y − ∞ P i=2 âi y i with âi ∈ R≥0 , â1 > 0, (2.15) be a controlling function on y and its negative correspendence [cf. (2.7)], and let y = ŷneg (F̂ neg ) = b̂1 F̂ neg + ∞ P i=2 i (2.16) b̂i F̂ neg , i be the formal inverse function of F̂ neg , where b̂1 = â−1 1 and b̂i = Coeff (y, F̂ neg ) ∈ C. Then (1) ŷneg (F̂ neg ) is a controlling function on F̂ neg , i.e., i b̂i = Coeff (y, F̂ neg ) ≥ 0 for i ≥ 1. (2.17) (2) If F̃ Exy 0 F̂ with F̃ as in (2.12) and f˜i (x0 ) exists for all possible i and |f˜1 (x0 )| = â1 , then y = yF̃ (F̃ ) ExF̃0 ŷneg (F̃ ), i.e., bi Ex0 b̂i , (2.18) where bi = Coeff (y, F̃ i ) is as in (2.13), and bi Ex0 b̂i means that |bi (x0 )| ≤ b̂i . In particular y Ey ŷneg (F̂ ), (2.19) where the right side of “ Ey ” is regarded as a function of y by substituting F̂ by (2.15). Proof. Note that (1) follows from (2) by simply taking F̃ = â1 y. Thus we prove (2). We want to prove ∂ i y x0 di y for i ≥ 1, (2.20) Ey ∂ F̃ i dF̂ ineg where the left-hand side is understood as that we first use (2.13) to regard y as a function on F̃ (with parameter x) and apply ∂i ∂ F̃ i to it, then regard the result as a function on y (and the like for the right-hand side, which does not contain the parameter x). By (2.9), we have thus !−1 !−1 !−1  dF̂  d F̂ ∂ F̃ neg Exy 0 = , ∂y dy neg dy i.e., ∂y ∂ F̃ Exy 0 dy dF̂ neg ∂ F̃ ∂y Exy 0 dF̂ dy , and and (2.20) holds for i = 1. Inductively, by Lemma 2.3, ∂iy ∂ F̃ i = ∂  ∂ i−1 y  ∂ F̃ −1 ∂  ∂ i−1 y  = ∂y ∂ F̃ i−1 ∂y ∂ F̃ ∂ F̃ i−1 Exy 0 d  di−1 y  dF̂ neg −1 di y = . dy dF̂ i−1 dy dF̂ ineg neg 7 (2.21) This proves (2.20). Using (2.20) and noting from (2.13) and (2.16), we have bi = E 1 ∂iy i! ∂ F̃ i x0 F̃ =0 1 ∂iy i! ∂ F̃ i = di y 1 i! dF̂ ineg y=0 y=0 1 di y = i! dF̂ ineg . F̂ neg =0 = b̂ i This proves (2.18). Since F̃ Exy 0 F̂ and ŷneg is a controlling function, we have ŷneg (F̃ ) Exy 0 ŷneg (F̂ ). This together with (2.18) proves (2.19).  3 Proof of Theorem 1.3 First we use (1.11) to prove (1.12): By exchanging x and y if necessary, we may assume hp0 ,p1 = |yt |, nt = |xt |. Then the only nontrivial case in (1.12) is the case when a = |yt |, b = |xt |. In this case, we have m m+1 m m+1 m+1 m+2 |a − b| = |yt | − |xt | ≤ |yt + xt | < hp0 ,p1 = |yt | m+1 < |xt | m+2 = nt , where the last inequality follows from the fact that by (1.11), we have (when |yt | = hp0 ,p1 ≥ s 0 is sufficiently large) m m+1 m m(m+2) |xt | > |yt | − hp0 ,p1 = |yt | − |yt | m+1 > |yt | (m+1)2 . (3.1)  To prove (1.11), assume conversely that there exists (p0i , p1i ) = (x0i , y0i ), (x1i , y1i ) ∈ V for any i ∈ Z>0 satisfying hp0i ,p1i ≥ i, (3.2) such that at least one of the following does not hold: m m+1 m m+1 (ii) |x1i + y1i | < hp0i ,p1i . (i) |x0i + y0i | < hp0i ,p1i , (3.3) Thus we obtain a sequence (p0i , p1i ), i = 1, 2, ... Since at least one of the conditions in (3.3) cannot hold for infinite many i’s. If necessary by replacing the sequence by a subsequence [if the sequence (p0i , p1i ) is replaced by the subsequence (p0,ij , p1,ij ), then we always have ij ≥ j; thus (3.2) still holds after the replacement], we may assume one of the conditions in (3.3) does not hold for all i. If necessary by switching p0i and p1i , we can assume (3.3) (i) cannot hold for all i, i.e., m m+1 |x0i + y0i | ≥ hp0i ,p1i → ∞ for all i ≫ 1. (3.4) We need to use the following notations: ai ∼ bi , ai ≺ bi , ai  bi means respectively s 1 < ai ai ai = 0, < s 2 , lim ≤ s 1, i→∞ bi bi bi (3.5) for some fixed s 1 , s 2 ∈ R>0 . By (1.3), we can write F = FL + F1 with F1 = m−1 P y m−1−j j=0 j P k=0 Since |x0i |, |y0i | ≤ hp0i ,p1i , by (3.4) and (3.6), we have m−1 fjk xk for some fjk ∈ C. F1 (p0i )  hp0i ,p1i ≺ (x0i + y0i )m = FL (p0i ), 8 (3.6) (3.7) m and thus [we remark that although it is possible that (x0i + y0i )m ≺ hp0i ,p1i , it is very crucial that we have (3.8)] F (p0i ) ∼ FL (p0i ) = (x0i + y0i )m . (3.8) m−1 Similarly, F1 (p1i )  hp0i ,p1i ≺ (x0i + y0i )m = FL (p0i ). We obtain the following important fact: F (p1i ) F (p1i ) 1= = lim = lim F (p0i ) i→∞ F (p0i ) i→∞ F1 (p1i ) FL (p1i ) FL (p0i ) + FL (p0i ) F1 (p0i ) FL (p0i ) + 1 FL (p1i ) (x1i + y1i )m = lim . i→∞ FL (p0i ) i→∞ (x0i + y0i )m = lim (3.9) Therefore, by replacing the sequence by a subsequence, we have lim i→∞ x1i + y1i = ω, where ω is some m-th root of unity. x0i + y0i (3.10) Furthermore, when i ≫ 1, by (3.4) we have [cf. Convention 2.1 (3)] m−1 E := hp0i ,p1i β0m → 0, where β0 := x0i + y0i . (3.11) Set β1 := x1i + y1i − 1 → ω − 1. x0i + y0i (3.12) Remark 3.1 Before continuing, we would like to remark that our idea is to take some variable change [cf. (3.16)] to send the leading part FL of F to a “leading term” [cf. (3.19)], which has the highest absolute value when (x, y) is set to p0i or p1i [cf. (3.21)] so that when we expand it as a power series of y, it converges absolutely [cf. (3.24)], and further, the inverse function converges absolutely (cf. Lemma 3.3). Then we can derive a contradiction [cf. (3.43)]. Proof of Theorem 1.3. Now we begin our proof of (1.11) in Theorem 1.3 as follows. Since either x0i 6= x1i or y0i 6= y1i for all i, replacing the sequence by a subsequence and/or exchanging x and y √ if necessary, we may assume y0i 6= y1i for all i. Set [where i = −1, cf. the statement after (3.20) to see why we need to choose such a β2 ] u1 = 1 + β1 x + β2 x(1 − x) ∈ C[x], where β2 = ( 0 if ω 6= −1, i else. (3.13) We have Lemma 3.2 There exists some δ > 0 independent of E such that |u1 (a)| > δ for 0 ≤ a ≤ 1 (when i ≫ 1). (3.14) Proof. Fix δ1 ∈ R>0 to be sufficiently small. • First assume ω = 1 (then β2 = 0). By (3.12), we can then assume |β1 | < δ1 . Then for 0 ≤ a ≤ 1, we have |u1 (a)| ≥ 1 − |β1 |a ≥ 1 − δ1 . 9 • Next assume ω = −1 (then β2 = i ). We can then assume |β1 im | < δ12 [cf. Convention 2.1 (1)] and 2 − δ12 ≤ |β1 re | ≤ 2 + δ12 by (3.12). For δ1 ≤ a ≤ 1 − δ1 , we have |u1 (a)| ≥ |u1 (a)im | = |β1 im a + β2 im a(1 − a)| ≥ a(1 − a) − |β1 im |a ≥ δ1 (1 − δ1 ) − δ12 . (3.15) If 0 ≤ a ≤ δ1 , we have |u1 (a)| ≥ |u1 (a)re | = |1 + β1 re x| ≥ 1 − (2 + δ12 )δ1 . If 1 − δ1 ≤ a ≤ 1, then |u1 (a)| ≥ |u1 (a)re | = |1 + β1 re x| ≥ (2 − δ1 )(1 − δ1 ) − 1. • Now assume ω 6= ±1 (then β2 = 0). We can then assume |β1 im | ≥ δ1 and |β1 | ≤ 2 + δ1 . If 0 ≤ a ≤ δ1 , we have |u1 (a)| ≥ 1 − |β1 |δ1 ≥ 1 − (2 + δ1 )δ1 . If δ1 ≤ a ≤ 1, then |u1 (a)| ≥ |u1 (a)im | = |β1 im |δ1 ≥ δ12 . In any case we can choose δ > 0 such that (3.14) holds.  We set [cf. Remark 3.1, our purpose is to use the variable change (3.17) to send the leading part FL of F to the element (3.19) which is a term (the “leading term”) with the lowest degree of y in F̂ , cf. (3.20)] u = β0 u1 y −1 − v, v = yi0 + β3 x, F̂ = β0−m F (u, v), −1 ±1 Ĝ = β0m−1 β3−1 G(u, v) ∈ C[x, u−1 1 , y ] ⊂ C(x)[y ]. Then one can verify that J(u, v) = − ∂u ∂y J(F̂ , Ĝ) = u1 y −2 , dv dx β3 = y1i − y0i , (3.16) (3.17) = β0 β3 u1 y −2 and   F̂ (q0 ), Ĝ(q0 ) = F̂ (q1 ), Ĝ(q1 ) , (3.18) where q0 = (0, 1), q1 = (1, 1). Note that the leading part FL of F contributes to F̂ the following element (which is the only term in F̂ with the lowest y-degree −m, referred to as the leading term of F̂ ): −m . β0−m (u + v)m = um (3.19) 1 y Since all coefficients of x and y −1 in u or v have absolute values being  the height hp0i ,p1i [cf. (3.16)], due to the factor β0−m in F̂ [cf. (3.17)], we see from (3.6) and (3.11) that other terms of F (i.e., terms in F1 ) can only contribute O(E 1 ) elements to F̂ [cf. Convention 2.1 (3) for notation O(E j )]. Thus we can write   m P −m 1+ F̂ = um fj y j for some fj = O(E 1 ) ∈ C[x, u−1 1 y 1 ] ⊂ C(x). (3.20) j=1 By (3.14), we see that fj (a) for 0 ≤ a ≤ 1 is well-defined for any j and fj (a) = O(E 1 ) [this is why we need to choose some β2 to satisfy (3.14)]. Set  s 1 = max |fj (a)| 1 ≤ j ≤ m, 0 ≤ a ≤ 1 = O(E 1 ). (3.21) Let 0 ≤ a ≤ 1. Take [here we choose an m-th root of um 1 to be u1 , this choice will not cause any problem since we will only encounter integral powers of u1 below, cf. (2.2)] 1 2 P := F̂ − m ∈ u−1 1 y + y C(x)[[y]], F̂ = |u1 (a)|m y −m (1 + F̂− ), where F̂− = s 1 10 (3.22) m P y j = O(E 1 ). j=1 (3.23) We have (cf. Definition 2.2) 1 P Eay P̂ := |u1 (a)|−1 y(1 − F̂− )− m . F̂ Eay F̂ , (3.24) Thus F̂ , P converges absolutely [by Lemma 2.3 (3)] when setting x = a and y = 1. Let P0 := P |(x,y)=(0,1) = 1 + O(E 1 ), (3.25) where the last equality can be easily seen from (3.20) and (3.22) by noting that u1 (0) = 1. Write [cf. (2.4) and (2.13)] ∞ P y = u1 P + b i P i for some b i ∈ C(x), (3.26) i=2 Ĝ = ∞ P i=−mG ci P i for some ci ∈ C(x) (say Ĝ has the lowest y-degree −mG ). (3.27) To continue the proof of Theorem 1.3, we need the following lemma. First, let 0 ≤ a ≤ 1. Lemma 3.3 (1) The series in (3.26) converges absolutely when setting (x, P ) to (a, P0 ), and Y0 (a) := y|(x,P )=(a,P0 ) = u1 (a) + O(E 1 ). (2) Regarding ∂∂yF̂ Furthermore, −1 (3.28) as a series of P , it converges absolutely when setting (x, P ) to (a, P0 ).  ∂ F̂ −1 ∂y (x,P )=(a,P0 ) = −m−1 u1 (a) + O(E 1 ). (3.29) (3) The series in (3.27) converges absolutely when setting (x, P ) to (a, P0 ). Proof. (1) (cf. Remark 3.4) Note that the negative correspondence of P̂ is [cf. (2.7)] 1 P̂ neg := 2|u1 (a)|−1 y − P̂ = 2|u1 (a)|−1 y − |u1 (a)|−1 y(1 − F− )− m . (3.30) Let yneg = yneg (P̂ neg ) be the inverse function of P̂ neg [cf. (2.16)]. Then Lemma 2.4 shows that y(P ) EaP yneg (P ). (3.31) Thus to see whether the series in (3.26) [which is the left-hand side of (3.31)] converges absolutely when setting (x, P ) to (a, P0 ), it suffices to see if the series yneg (P ) [which is the right-hand side of (3.31)] converges when setting P to |P0 |. The latter is equivalent to whether (3.30) has the solution for y when P̂ neg is set to |P0 | (note that the solution, if exists, must be unique by noting that a controlling function which is a nontrivial power series of y must be a strictly increasing function). Note from (3.25) that |P0 | = 1 + w for some w ∈ R such that −s 2 E ≤ w ≤ s 3 E for some s 2 , s 3 . (3.32) Consider the right-hand side of (3.30): • if we set y to |u1 (a)| − s 4 E for some sufficiently large s 4 , then it obviously has some value 1 + w1 with w1 < −s 2 E ≤ w; 11 • if we set y to |u1 (a)| + s 5 E for some sufficiently large s 5 , then it has some value 1 + w2 with w2 > s 3 E ≥ w. Since the right-hand side of (3.30) is a continuous function on y, this shows that there exists (unique) y0 ∈ R>0 such that P̂ neg |y=y0 = |P0 |, and obviously, y0 = |u1 (a)| + O(E 1 ), (3.33) i.e., (3.30) has the solution y = y0 when P̂ neg is set to |P0 |, and thus the first part of (1) follows. As for (3.28), note that Y0 (a) is the solution of y in the equation P0 = P |x=a . Using (3.28) in this equation, we see it holds up to O(E 1 ). (2) By Lemmas 2.3 and 2.4, using (3.22)–(3.24), we have  ∂ F̂ −1 ∂y Eay y m+1 y m+1 E P m|u1 (a)|m (1 − Q− ) m|u1 (a)|m (1 − Q− ) y=yneg (P ) , (3.34) P m−j j 1 where Q− = s 1 m j=1 m y = O(E ) [cf. (3.23)]. The right-hand side of (3.34) (a controlling function) converges obviously when setting P to |P0 | since by (3.33), we have yneg (|P0 |) = y0 = |u1 (a)| + O(E 1 ) and so 0 ≤ Q− y=yneg (|P0 |) = O(E 1 ) < 1. (3.35) This proves the first statement of (2) [cf. (2.11)]. As for the second statement, note that setting  (x, P ) to (a, P0 ) is equivalent to setting (x, y) to a, Y0 (a) . Then (3.29) follows from (3.20) and (3.28). (3) follows from (1) since Ĝ|x=a is a polynomial on y ±1 . This proves Lemma 3.3.  Remark 3.4 By (3.20), F̂ = the leading term + O(E 1 ), (3.36) where O(E 1 ) is a finite combination of powers of y ±1 . In this case, we can in fact easily choose a simpler controlling function P̂ for P [cf. (3.24)]: P̂ = |u1 (a)|−1 y ∞ P E δ1 i y i = i=0 |u1 (a)|−1 y , 1 − E δ1 y (3.37) where δ1 ∈ R>0 is some fixed sufficiently small number. Then −1 P̂ neg = |u(a)|  y 1− E δ1 y 1 − E δ1 y  = |u(a)|−1 y(1 − 2E δ1 y) , 1 − E δ1 y (3.38) and we can explicitly write down the inverse function of P̂ neg by solving y from (3.38) to obtain yneg (P̂ neg ) [which, by Lemma 2.4 (1), must be a controlling function on P̂ neg (although it is not obvious to see)] yneg (P̂ neg ) = 1 + E δ1 |u(a)|P̂ neg − A , where 4E δ1 1  2 δ1 2δ1 2 2 A = 1 − 6E |u(a)|P̂ neg + E |u(a)| P̂ neg . 12 (3.39) From this, one easily sees that the right-hand side of (3.31) converges when P is set to |P0 |, i.e., (3.39) converges when P̂ neg is set to |P0 | [if we expand A as a power series of P̂ neg , it converges absolutely when P̂ neg is set to |P0 | simply because there appear the factors E δ1 and E 2δ1 ]. Thus the proof of Lemma 3.3 (1) is easier (we have used the above proof as it can be adapted in some more general situation). Now we return to our proof of Theorem 1.3. By Lemma 3.3 (3), we are now safe to set (x, y) to (0, 1) and (1, 1) [which is equivalent to setting (x, P ) to (0, P0 ) and (1, P0 ) respectively] in (3.27) to obtain 0 = Ĝ(1, 1) − Ĝ(0, 1) = ∞ P i=−mG  ci (1) − ci (0) P0i . (3.40) Denote  ∂ F̂ −1  ∂ F̂ −1 Q := −J(F̂ , Ĝ) = −u1 y −2 , ∂y ∂y (3.41) where the last equality follows from (3.18). Take the Jacobian of F̂ with (3.27), by (3.18) and (3.41), we obtain [by regarding Q as in C(x)((y))] Q= ∞ dc P i i P . dx i=−mG (3.42) By (3.41) and the proof of Lemma 3.3, we see that when P is set to P0 , the series in (3.42) converges absolutely and in fact uniformly for x ∈ [0, 1] := {x ∈ R | 0 ≤ x ≤ 1}. This together with (3.40) and (3.42) implies ∞ P 0= i=−mG = Z 1 0 =m (ci (1) − ci (0))P0i ∞ dc P i i P0 dx = dx i=−mG −1 Z 1 Z ∞ P = i=−mG 1 Q 0 Z 1 0 dci i P dx dx 0 dx = P =P0 Z 1 Q 0 y=Y0 (x) dx dx + O(E 1 ) = m−1 + O(E 1 ), (3.43) 0 which is a contradiction, where the sixth equality of (3.43) follows from (3.41), (3.28) and (3.29), and the fifth follows by noting that Q P =P0 means that we need to express Q as an element in C(x)[[P ]] [i.e., use (3.26) to substitute y, that is exactly the equation (3.42)] then set P to P0 , which is equivalent to directly setting y to Y0 (x) in Q [cf. (3.28)]. The contradiction means that if (3.2) holds, then we must have (3.3). The proof of Theorem 1.3 is now completed.  4 Proofs of Theorems 1.4 and 1.5 Proof of Theorem 1.4. To prove the boundness of Ak0 ,k1 defined in (1.14), assume  (p0i , p1i ) = (x0i , y0i ), (x1i , y1i ) ∈ Ak0 ,k1 , i = 1, 2, ..., 13 (4.1) is a sequence such that the height hp0i ,p1i → ∞. By definition, we have |x0i | = k0 , |x1i | = k1 . Thus |y0i | = hp0i ,p1i or |y1i | = hp0i ,p1i , in any case, at least one inequation of (1.11) is violated. Hence Ak0 ,k1 is bounded. To prove the closeness of Ak0 ,k1 , let (4.1) be a sequence converging to some  (p0 , p1 ) = (x0 , y0 ), (x1 , y1 ) ∈ C4 . Then σ(p0 ) = σ(p1 ) and |x0 | = k0 , |x1 | = k1 . We must have p0 6= p1 [otherwise, the local bijectivity of σ does not hold at the point p0 , cf. arguments after (5.3)], i.e., (p0 , p1 ) ∈ Ak0 ,k1 , and so Ak0 ,k1 is a closed set in C4 , namely, we have Theorem 1.4 (i). From this, we see that γ k0 ,k1 in (1.15) is well-defined. Now we prove Theorem 1.4 (iii). We will prove (1.16) (b) [the proof for (1.16) (a) is similar, but simpler, cf. Remark 4.2]. First we claim that γ 0,0 > 0. (4.2)  To see this, by definition, there exists (0, ỹ0 ), (0, ỹ1 ) ∈ A0,0 for some ỹ0 , ỹ1 ∈ C with ỹ0 6= ỹ1 ,  thus also (0, ỹ1 ), (0, ỹ0 ) ∈ A0,0 . By definition, γ 0,0 ≥ max{|ỹ0 |, |ỹ1 |} > 0, i.e., we have (4.2). Fix k0 > 0. For any given k1′ > 0, let β = max{γ k0 ,k1 | k1 ≤ k1′ }   = max |y1 | (p0 , p1 ) = (x0 , y0 ), (x1 , y1 ) ∈ V, |x0 | = k0 , |x1 | ≤ k1′ . (4.3) Assume conversely that there exists k1 < k1′ with γ k0 ,k1 = β. We want to use the local bijectivity of Keller maps to obtain a contradiction. Let E > 0 be a parameter such that E → 0 [cf. Convention 2.1 (3)]. Let  (p̃0 , p̃1 ) = (x̃0 , ỹ0 ), (x̃1 , ỹ1 ) ∈ V with |x̃0 | = k0 , |x̃1 | = k1 , |ỹ1 | = β. (4.4) Set (and define G0 , G1 similarly) F0 = F (x̃0 + x, ỹ0 + y), F1 = F (x̃1 + x, ỹ1 + y). (4.5) Denote a0 = Coeff (F0 , x1 y 0 ), b0 = Coeff (F0 , x0 y 1 ), a = Coeff (F1 , x1 y 0 ), b = Coeff (F1 , x0 y 1 ). (4.6) We use c0 , d0 , c, d to denote the corresponding elements for G0 , G1 . Then A0 = (ab00 cd00 ), A = (ab cd ) are invertible 2 × 2 matrices such that det A0 = det A = J(F, G) = 1. For the purpose of proving Theorem 1.4 (iii), we can replace (F, G) by (F, G)A−1 0 , then A0 becomes A0 = I2 (the 2 × 2 identity −1 matrix), and AA0 becomes the new A, which is in fact the following matrix, A= a c b d ! = Fx (p̃1 )Gy (p̃0 ) − Gx (p̃1 )Fy (p̃0 ) Gx (p̃1 )Fx (p̃0 ) − Fx (p̃1 )Gx (p̃0 ) Fy (p̃1 )Gy (p̃0 ) − Gy (p̃1 )Fy (p̃0 ) Gy (p̃1 )Fx (p̃0 ) − Fy (p̃1 )Gx (p̃0 ) where the subscript “ x ” (resp., “ y ”) stands for the partial derivative ∂ ∂x (resp., ! ∂ ∂y ), , (4.7) and F, G (F, G)A−1 0 are original F, G [i.e., before replaced by ]. From this, for later use, we obtain the following: There exist s 1 , M ∈ R>0 (depending on degrees and coefficients of F, G) such that for any (p̃1 , p̃2 ) ∈ V , we have M (i) |a|, |b|, |c|, |d| ≤ s 1 hp̃ 0 ,p̃1 , −M (ii) either |a| ≥ s −1 1 hp̃ 14 0 ,p̃1 −M or |b| ≥ s −1 1 hp̃ 0 ,p̃1 , (4.8) where (ii) follows from (i) and the fact that ac − bd = 1. We can write (here “ ≡ ” means equal modulo terms with degrees ≥ 3 by defining deg x = deg y = 1) F0 ≡ αF + x + a1 x2 + a2 xy + a3 y 2 , F1 ≡ αF + ax + by + a4 x2 + a5 xy + a6 y 2 , G0 ≡ αG + y + a7 x2 + a8 xy + a9 y 2 , G1 ≡ αG + cx + dy + a10 x2 + a11 xy + a12 y 2 , (4.9) (4.10) for some ai ∈ C, where αF = F (x̃0 , ỹ0 ), αG = G(x̃0 , ỹ0 ). For any s, t, u, v ∈ C, denote q0 := (ẋ0 , ẏ0 ) = (x̃0 + sE , ỹ0 + tE ), q1 := (ẋ1 , ẏ1 ) = (x̃1 + uE , ỹ1 + v E ). (4.11) The local bijectivity of Keller maps says that for any u, v ∈ C (cf. Remark 4.1), there exist s, t ∈ C such that (q0 , q1 ) ∈ V . Remark 4.1 When we consider the local bijectivity of Keller maps, we always assume u, v ∈ C are bounded by some fixed s ∈ R>0 (which is independent of E , and we can assume E < s −s ). In fact we can use (4.9) and (4.10) to solve s, t up to E 2 ; for instance, s = s0 + O(E 2 ), s0 = au + bv + (α1 u2 + α2 uv + α3 v 2 )E for some αi ∈ C. (4.12) We want to choose suitable u, v such that (I) |ẋ0 | = |x̃0 + sE | = |x̃0 | ( = k0 ) , (II) |ẏ1 | = |ỹ1 + v E | > |ỹ1 | ( = β ) . (4.13) If a 6= 0 in (4.12), then we can easily first choose v to satisfy (II), then choose u to satisfy (I) [cf. (4.12)]. Since |x1 | = k1 < k1′ , we also have |ẋ1 | < k1′ [since E → 0, cf. (4.11)]. This means that we can choose (q0 , q1 ) ∈ V with |ẋ0 | = k0 , |ẋ1 | < k1′ , but |ẏ1 | > β, which is a contradiction with the definition of β in (4.3). Now assume a = 0 (and so b 6= 0, c 6= 0). In this case the situation is more complicated. Remark 4.2 Before continuing, we remark that the proof of (1.16) (a) is easier: in that case condition (4.13) (I) should be replaced by the condition |x̃1 + uE | = |x̃1 |, which can be easily satisfied even in case k1 = 0 (i.e., x̃1 = 0). Thus (1.16) (a) holds. Now we continue our proof. Since |x̃0 | = k0 > 0, and |ỹ1 | = β ≥ γ k0 ,0 > γ 0,0 > 0 [where the first inequality follows from the definition of β in (4.3), the second from (1.16) (a), and the last from (4.2)], we can rewrite (4.13) as [cf. (4.12)] (I)′ |1 + s̃E | = 1, (II)′ |1 + ṽ E | > 1, where ṽ = ỹ1−1 v, s̃ = x̃−1 0 s, (4.14) and regard ṽ as a new variable. Set [see also arguments after (4.29)], −1 −1 −1 F̃0 = x̃0 F0 (x̃−1 0 x, y), G̃0 = G0 (x̃0 x, y), F̃1 = x̃0 F1 (x, ỹ1 y), G̃1 = G1 (x, ỹ1 y), (4.15) and rewrite [cf. (4.9) and (4.10); by subtracting Fi , Gi by some constants we may assume αF = αG = 0; by abusing notations, we still use b, c, d, which are now different from that in (4.9) and (4.10), to denote the coefficients of linear parts of F̃1 , G̃1 ]     P P P P bi z i + by 1 + b̄i z i + · · · , (4.16) āi y i + · · · , F̃1 = ai y i + x 1 + F̃0 = i≥2 i≥2 G̃0 = y + P i≥2 ci y i + · · · , i≥2 i≥2 G̃1 = z + P i≥2 15 di z i + · · · , where z = cx + dy, (4.17) for some ai , āi , bi , b̄i , ci , di ∈ C, and where we regard F̃1 , G̃1 as polynomials on y, z and we omit terms with x-degree ≥ 2 in F̃0 (or ≥ 1 in G̃0 , and the likes for F̃1 , G̃1 ), which will be irrelevant to our computations below. In this case, by (4.16), we have s̃ = bṽ + O(E 1 ). (4.18) If bim 6= 0 [cf. Convention 2.1 (1)], we can always choose suitable ṽ ∈ C with ṽre > 0 such that both (I)′ and (II)′ in (4.14) hold. Thus assume b ∈ R6=0 . We claim (ai , ci ) 6= (bi , di ) for at least one i ≥ 2, (4.19) otherwise we would in particular obtain (and the like for G) F (x̃0 , ỹ0 + k ) = x̃−1 0 F̃0 = x̃−1 0 F̃1 = F (x̃1 + k c−1 , ỹ1 ), i.e., (4.20) σ(p̄0 ) = σ(p̄1 ) with p̄0 = (x̄0 , ȳ0 ) = (x̃0 , ỹ0 + k ), p̄1 = (x̄1 , ȳ1 ) = (x̃1 + k c−1 , ỹ1 ), (4.21) (x,y)=(0,k ) (x,y)=(k c−1 ,0) for all k ≫ 1 [cf. Convention 2.1 (3)]. Then hp̄0 ,p̄1 ∼ k [when k ≫ 1, cf. (3.5)], and |x0 + y0 | ∼ m m+1 k ≻ hp̄ 0 ,p̄1 , a contradiction with (1.11). Thus (4.19) holds. Then, if necessary by replacing G̃i by G̃i + F̃i2 for i = 0, 1 (which does not change the linear parts of F̃0 , F̃1 , G̃0 , G̃1 ), we may assume ci0 6= di0 for some minimal i0 ≥ 2. By replacing F̃j by F̃j + can then suppose P2i0 i i=2 βi G̃j (4.22) for some βi ∈ C and j = 0, 1, thanks to the term y in G̃0 , we ai = 0 for 2 ≤ i ≤ 2i0 . (4.23) Now we need to consider two cases. Case 1: Assume bk 6= 0 for some k ≤ 2i0 . Take minimal such k ≥ 2. Setting [the second equation amounts to setting z = wE in (4.17)], ṽ = v̂ E k−1 , u = c−1 w − c−1 d v̂ E k−1 , (4.24) and regarding v̂, w as new variables, we can then solve from (4.16) and (4.17) [cf. (4.12), (4.14) and (4.18); observe that all omitted terms and all coefficients āi ’s, b̄i ’s do not contribute to our solution of s̃ up to E k ] to obtain s̃ = (bv̂ + b′ wk )E k−1 + O(E k ) for some nonzero b′ ∈ C. (4.25) Using this and the first equation of (4.24) in (4.14), one can then easily see that (4.13) have solutions [by taking, for example, v̂ > 0 so that (II)′ holds and then choosing w to satisfy (I)′ ]. Case 2: Assume bi = 0 for 0 ≤ i ≤ 2i0 . By computing the coefficients Coeff (J(F0 , G0 ), x0 y i ) = 0 = Coeff (J(F1 , G1 ), x0 z i ), i ≥ 1, (4.26) and induction on i for 1 ≤ i < i0 , one can easily obtain that āi = b̄i for i < i0 and āi0 6= b̄i0 by (4.22) and (4.23). In this case, by setting [the first equation below means that ṽ E contributes a positive O(E 2i0 ) element to the left-hand side of (4.14) (II)′ since it does not have a real part, in particular (II)′ holds], ṽ = v1 i E i0 −1 for v1 ∈ R6=0 , 16 u = c−1 w − c−1 dv1 i E i0 −1 , (4.27) we can then solve from (4.16) and (4.17) to obtain (all omitted terms do not contribute to our solution of s̃ up to E 2i0 ) s̃E = bv1 i E i0 + b′′ v1 i wi0 E 2i0 + O(E 2i0 +1 ) for some nonzero b′′ ∈ C. (4.28) Since b ∈ R6=0 , we see that (4.28) can only contribute an O(E 2i0 ) element to (4.14) (I)′ . Using (4.28) and the first equation of (4.27) in (4.14), one can again see that (4.13) have solutions by choosing suitable w. This proves Theorem 1.4.  Now we take  (p̄0 , p̄1 ) = (x̄0 , ȳ0 ), (x̄1 , ȳ1 ) ∈ A1,1 with |x̄0 | = |x̄1 | = 1, |ȳ1 | =γ 1,1 >γ 1,0 >γ 0,0 > 0, (4.29) where the inequalities follow from Theorem 1.4 (iii) and (4.2). Similar to (4.5) (but not exactly), we define   F0 = F x̄0 (1 + x), ȳ0 + y , F1 = F x̄1 (1 + x), ȳ1 (1 + y) , (4.30) and define G0 , G1 similarly [thus the matrices A0 , A defined after (4.6) now have determinant det A0 = x̄0 J(F, G) 6= 0, det A = x̄1 ȳ1 J(F, G) 6= 0, and again by replacing (Fi , Gi ) by (Fi , Gi )A−1 0 for i = 0, 1, we can assume A0 = I2 ]. Define q0 , q1 accordingly [similar to, but a slightly different from, (4.11), simply due to the different definitions in (4.30) and (4.5)],   q0 := (ẋ0 , ẏ0 ) = x̄0 (1 + sE ), ȳ0 + tE , q1 := (ẋ1 , ẏ1 ) = x̄1 (1 + uE ), ȳ1 (1 + v E ) . (4.31) In particular, we have (4.9), (4.10), and as in (4.12), s = −a′ u + bv + O(E 1 ), (4.32) where we have written the coefficients of u, v as −a′ , b to emphasis that they are in fact positive as shown in the next lemma. Lemma 4.3 We have a′ > 0, b > 0. Proof. First assume a′im 6= 0 or a′re < 0 or bim 6= 0 or bre < 0 [cf. Convention 2.1 (1)]. Then from (4.32) one can easily choose u, v [with uim 6= 0, ure < 0, vim 6= 0, vre > 0 such that either (a′ u)re > 0 or (bv)re < 0, and so sre < 0] satisfying [cf. (4.31) and (4.32)] 0 < k0 := |ẋ0 | = |1+sE | < 1, 0 < k1 := |ẋ1 | = |1+uE | < 1, |ẏ1 | =γ 1,1 |1+v E | >γ 1,1 , (4.33) i.e., 0 < k0 < 1, 0 < k1 < 1 with γ k0 ,k1 ≥ |ẏ1 | > γ 1,1 , a contradiction with Theorem 1.4 (iii). Thus a′ ≥ 0, b′ ≥ 0. If a′ = 0, similar to arguments after (4.14) [see also arguments after (5.7)], we have two possible cases [cf. (4.24), (4.25) and (4.27), (4.28)]: v = v̂ E k−1 , u = c−1 w − c−1 d v̂ E k−1 , s = (bv̂ + b′ wk )E k−1 + O(E k ), (4.34) v = v1 i E i0 −1 , u = c−1 w − c−1 dv1 i E i0 −1 , sE = bv1 i E i0 + b′′ v1 i wi0 E 2i0 + O(E 2i0 +1 ), (4.35) where v̂, w ∈ C, v1 ∈ R6=0 , b′ , b′′ ∈ C6=0 , k, i0 ∈ Z≥2 . Assume we have the case (4.34) [the case (4.35) is similar], we can first choose v̂ with v̂re > 0 so that the last inequation of (4.33) holds, then choose w with (c−1 w)re < −1 (sufficiently smaller than −1) and (b′ wk )re < 0 (sufficiently smaller than −1, such w can be always chosen since k ≥ 2) such that the first two inequations of (4.33) hold. Thus (4.33) holds, and as before we obtain a contradiction. Therefore a′ > 0. Similarly b > 0. The lemma is proven.  17 Lemma 4.4 Theorem 1.5 (1) holds. Proof. Let k ≫ 1, we define V0 as in (1.17): (i) 1 ≤ |x1 | ≤ |x0 | ≤ 2|x1 |1−k −1 , 1 1 2 (ii) |y1 | 2 − k k |x0 | ≥ γ 1,1 + E2 − k k . (4.36) For any (p0 , p1 ) ∈ V0 , if the first two equalities hold in (4.36) (i), then |x1 | = |x0 | = 1, but by (4.36) (ii), |y1 | > γ 1,1 , a contradiction with the definition of γ 1,1 . If the first and last equalities, or the last two equalities, hold in (4.36) (i), then we can obtain |x1 | ≤ 2k , 2 ≤ |x0 | ≤ 2k , but by (4.36) (ii), |y1 | > k 2k ≻ |x1 | [when k ≫ 1, cf. (3.5)]. By (1.12), we must have either hp0 ,p1 ∼ |x0 | ∼ |y0 | or hp0 ,p1 ∼ |x1 | ∼ |y1 |. The later case is impossible since |x1 | ≺ |y1 |, but the first case is impossible either as otherwise we would obtain hp0 ,p1 ∼ |x0 | ≺ |y1 |  hp0 ,p1 [where the part  is obtained by definition (1.9)], a contradiction. Hence Theorem 1.5 (1) (ii) holds. Next, we want choose suitable u, v such that (4.36) holds for (q0 , q1 ) [defined in (4.31)], i.e. k (note that if necessary we may assume E < k −k , cf. Remark 4.1), (i) 1 ≤ |1 + uE | ≤ |1 + sE | ≤ 2|1 + uE |1−k 1 −1 , 1 1 2 2 (ii) γ 1,1 |1 + v E | 2 − k k |1 + sE | ≥ γ 1,1 + E2 − k k . (4.37) The last strict inequality holds in (4.37) (i) automatically. If we take u = 1, v= 1 + a′ + k −1 , and so s = 1 + k −1 + O(E 1 ) by (4.32), b (4.38) by comparing the coefficients of E 1 , we see that all strict inequalities hold in (4.37) (i). Further, 1 2 v − k k , which is obviously positive the coefficient of E 1 in the left hand-side of (4.37) (ii) is 21γ 1,1 (since γ 1,1 > 0 and k ≫ 1). We see that (q0 , q1 ) ∈ V0 , i.e., V0 6= ∅. we have the lemma.   Proof of Theorem 1.5 (2). Now we prove Theorem 1.5 (2). Let (p0 , p1 ) = (x0 , y0 ), (x1 , y1 ) ∈ V0 , i.e., (1.17) holds. Note that (1.17) implies that x0 , x1 6= 0. Similar to (4.5) (but not exactly), we define   F0 = F x0 (1 + x), y0 + y , F1 = F x1 (1 + x), y1 + κ0 y , (4.39) where κ0 = 1 if y1 = 0 or κ0 = y1 else, and define G0 , G1 similarly [thus the matrices A0 , A defined after (4.6) now have determinant det A0 = x0 J(F, G) 6= 0, det A = x1 κ0 J(F, G) 6= 0, and again by replacing (Fi , Gi ) by (Fi , Gi )A−1 0 for i = 0, 1, we can assume A0 = I2 ]. Define q0 , q1 accordingly [similar to, but a slightly different from, (4.11), simply due to the different definitions in (4.30) and (4.5)],   q0 := (ẋ0 , ẏ0 ) = x0 (1 + sE ), y0 + tE , q1 := (ẋ1 , ẏ1 ) = x1 (1 + uE ), y1 + κ0 v E . (4.40) As in (4.12), we have s = s0 + O(E 2 ), s0 = au + bv + (α1 u2 + α2 uv + α3 v 2 )E for some αi ∈ C. (4.41) We remark that E here shall be regarded to be different from that in the previous results, here E may be much smaller than that before (cf. Remark 4.1). 18 If no equality (resp., the first equality) holds in (1.17) (a), we only need to consider (1.19) (b) [resp., (1.19) (b) and the first inequality of (1.19) (a)], which can be easily done. Thus by Theorem 1.5 (1) (ii), we may assume that the last equality of (1.17) (a) holds [the proof for the case with the second equality of (1.17) (a) is exactly similar], then we need to choose u, v so that (q0 , q1 ) satisfies (1.19) (b) and the last inequality of (1.19) (a), namely [here we assume y1 6= 0 (thus κ0 = y1 ); if 1 1 y1 = 0 then the term |1 + v E | 2 in C2 defined below should be replaced by |v E | 2 (which contributes 1 a positive O(E 2 ) element to C2 as long as v 6= 0), thus (4.42) holds for any nonzero v and the proof becomes easier], (i) C1 := |1 + sE | · |1 + uE |−κ2 ≤ 1, 1 (ii) C2 := |1 + v E | 2 − κ3 |1 + sE | + κ4 ≥ 0, where κ2 = 1 − k −1 , κ3 = k k |x0 | 1 |y1 | 2 (4.42) 1 , κ4 = k k |x0 |−|y1 | 2 1 |y1 | 2 (thus 1 + κ4 − κ3 = 0). We claim that κ4 > 0 (thus κ3 > 1), (4.43) otherwise we would have |y1 | ≥ (k k |x0 |)2 ≥ k 2k by condition (1.17) [cf. (4.36)], and as in the proof of Lemma 4.4, we would obtain a contradiction. First assume b 6= 0. Using (4.41), if we set a + κ2 u + κ′1 u2 E + wE for any fixed w ∈ C with wre > 0, where b κ2 (κ2 + 1) α1 (a + κ2 )α2 (a + κ2 )2 α3 κ′1 = − + − , 2b b b2 b3 v=− (4.44) (4.45) then one can easily see that C1 = |1 + wE 2 | + O(E 3 ) > 0, i.e., (4.42) (i) holds. By using (4.44) in (4.41), we obtain s = ū + (α̃1 ū2 + α̃2 w)E + O(E 2 ), where ū = −κ2 u, which is regarded as a new variable, (4.46) for some α̃i ∈ C. Using (4.44) and (4.46) in (4.42) (ii), we can then rewrite C2 as [by writing 1 (1 + v E ) 2 = 1 + 12 v E − 18 v 2 E 2 + O(E 3 ) ] C2 = 1 + α̃3 ūE + (α̃4 ū2 + α̃5 w)E 2 − κ3 1 + ūE + (α̃1 ū2 + α̃2 w)E 2 + O(E 3 ) > 0, (4.47) for some α̃i ∈ C. By comparing the coefficients of E 1 in (4.47), we immediately obtain that if α̃3 6= κ3 , then we can choose u to satisfy (4.47). Assume α̃3 = κ3 . Then we see that C2 in (4.47) is an O(E 2 ) element. In this case, since we do not know what are values of α̃1 , α̃4 , our strategy is to compute the following coefficient [cf. Convention 2.1 (1) (2) for notations “ re ’, “ im ” and Coeff ], β̃ = β̃1 + β̃2 with β̃1 = Coeff (C1 , ū2re E 2 ) and β̃2 = Coeff (C1 , ū2im E 2 ). (4.48) Observe that α̃1 (similarly α̃4 ) does not contribute to β̃ by noting the following  (α̃1 ū2 E 2 )re = α̃1 re (ū2re − ū2im ) + 2α̃1 im ūre ūim E 2 , 19 (4.49) and that the imaginary part of α̃1 ū2 E 2 can only contribute an O(E 4 ) element to C2 in (4.47). Thus for the purpose of computing β̃, we may assume α̃i = 0 for i 6= 3 (then the computation becomes much easier). Since α̃3 = κ3 is real, it is straightforward to compute that 1 1 β̃ = (α̃23 − κ3 ) = κ3 (κ3 − 1) > 0, 2 2 (4.50) by (4.47) and (4.43) [remark: the fact that β̃ is positive is very crucial for the inequation (4.47) being solvable for any unknown α̃i ∈ C in (4.47), cf. Remark 4.5]. By (4.48) and (4.50), either β̃1 > 0 or β̃2 > 0, and we can then choose ū with ūre 6= 0 = ūim or ūre = 0 6= ūim to guarantee that (4.42) (ii) [i.e., (4.47)] holds (when w is fixed). This completes the proof of Theorem 1.5 (2) for the case b 6= 0. Now assume b = 0. If a 6= κ2 then we can always first choose u to satisfy (4.42) (i), then choose v to satisfy (4.42) (ii) (the choice of v does not affect the coefficient of E 1 in C2′ ). Thus assume b = 0, a = κ2 . Take u = 0 in (4.42). If s does not depend on v [i.e., s = 0, cf. (4.9)–(4.11) and (4.41)], then (4.42) (i) holds trivially and we can easily choose v to satisfy (4.42) (ii); otherwise, s = b′ v k E k−1 + O(E k ) for some b′ ∈ C6=0 , k ∈ Z≥2 , and we can choose v to satisfy both (4.42) (i) and (4.42) (ii) (such v always exists simply because k ≥ 2). This proves Theorem 1.5.  Remark 4.5 (cf. Remark 1.6) Assume that we have the following inequation on variable u, where α1 , α2 , β1 , β2 ∈ R>0 , and a1 , a2 , a3 ∈ C are some unknown complex numbers: α1 |1 + a1 uE + a2 u2 E 2 + a3 E 2 |β1 < α2 |1 + uE |β2 + α1 − α2 . (4.51) Then from the proof of (4.42), one can see that this inequation is solvable for any unknown a1 , a2 , a3 ∈ C if and only if α1 > α2 . 5 Proofs of Theorems 1.1 and 1.2 Proof of Theorem 1.2. To prove Theorem 1.2 (i), we use Theorem 1.5. Denote [cf. (1.17)] L = {ℓp0 ,p1 | (p0 , p1 ) ∈ V0 }, ℓ = sup L ∈ R>0 ∪ {+∞} (the supremum of L). (5.1)  By definition, there exists a sequence (p0i , p1i ) := (x0i , y0i ), (x1i , y1i ) ∈ V0 , i = 1, 2, ..., i.e., p0i 6= p1i and σ(p0i ) = σ(p1i ), 1 ≤ |x1i | ≤ |x0i | ≤ 2|x1i |1−k −1 1 , ℓi := |y1i | 2 − k k |x0i | ≥ κ − k k , (5.2) such that limi→∞ ℓi = ℓ (cf. Remark 1.6). Noting from (5.2) that |x0i |, |x1i | are bounded. By (1.11), we see that |y0i |, |y1i | are also bounded [as in the proof of Theorem 1.4 (i)]. Thus by replacing the sequence by a subsequence, we may assume  lim (p0i , p1i ) = (p0 , p1 ) = (x0 , y0 ), (x1 , y1 ) ∈ C4 . (5.3) i→∞ First suppose p0 = p1 . Then by (5.3), for any neighborhood Op0 of p0 , there exists N0 such that p0i , p1i ∈ Op0 when i > N0 , but p0i 6= p1i , σ(p0i ) = σ(p1i ), which is a contradiction with the local bijectivity of Keller maps. Thus p0 6= p1 . By taking the limit i → ∞, we see that x0 , x1 6= 0 and all conditions in (1.17) hold for (p0 , p1 ). Thus (p0 , p1 ) ∈ V0 . Therefore by Theorem 1.5 (2), there 20  exists (q0 , q1 ) = (ẋ0 , ẏ0 ), (ẋ1 , ẏ1 ) ∈ V0 such that ℓq0 ,q1 > ℓp0 ,p1 = ℓ, a contradiction with (5.1). This proves that (1.13) is not true, i.e., we have Theorem 1.2 (i).  To prove Theorem 1.2 (ii), as in (4.4) and (4.30), take (p0 , p1 ) = (x0 , y0 ), (x1 , y1 ) ∈ V and set (and define G0 , G1 similarly) F0 = F (x0 + α0 x, y0 + y), ( 1 if x0 = ξ0 , α0 = x0 − ξ0 else, F1 = F (x1 + α1 x, y1 + y), where ( 1 if x1 = ξ1 , α1 = x1 − ξ1 else. (5.4) (5.5) Define q0 , q1 accordingly [cf. (4.11) and (4.31)]. Then we have as in (4.12) and (4.41), s = au + bv + O(E 1 ). (5.6) Note from Theorem 1.2 (i) that (x0 , x1 ) 6= (ξ0 , ξ1 ). First suppose x0 6= ξ0 , x1 6= ξ1 (then α0 = x0 − ξ0 , α1 = x1 − ξ1 ). In this case, we need to choose u, v such that C0 := β0 |1 + sE |2 + β1 |1 + uE |2 − (β0 + β1 ) < 0, where β0 = |x0 − ξ0 |2 , β1 = |x1 − ξ1 |2 . (5.7) Using (5.6) in (5.7), we immediately see (by comparing the coefficients of E 1 ) that if b 6= 0 or a 6= −β0 β1−1 , then we have a solution for (5.7). Thus assume b = 0, a = −β1 β0−1 [then d 6= 0 in (4.10) and a is real]. In this case, using arguments after (4.13), we have the similar versions of either (4.24) and (4.25), or else (4.27) and (4.28), i.e., u = ûE k−1 , v = d−1 w − d−1 cûE k−1 , s = (aû + b′ wk )E k−1 + O(E k ), u = u1 i E i0 −1 , v = d−1 w − d−1 cu1 i E i0 −1 , sE = au1 i E i0 + b′′ u1 i wi0 E 2i0 + O(E 2i0 +1 ), or else (5.8) (5.9) for some b′ , b′′ , u, w ∈ C6=0 , u1 ∈ R6=0 , k, i0 ∈ Z>0 , one can again find a solution for the inequation (5.7). Now if x0 = ξ0 (thus x1 6= ξ1 ), then the first term of C0 becomes |sE |2 = O(E 2 ) and we can easily choose any u with ure < 0 to satisfy that C0 < 0. Similarly, if x1 = ξ1 (thus x0 6= ξ0 ), then the second term of C0 becomes |uE |2 = O(E 2 ) and we can easily choose u with (au)re < 0 (in case a 6= 0) or v with (bv)re < 0 (in case b 6= 0) to satisfy that C0 < 0. This proves Theorem 1.2.  Proof of Theorem 1.1. Finally we are able to prove Theorem 1.1. The second assertion of Theorem 1.1 follows from [8, 23]. To prove the first statement, assume conversely that there exists a Jacobian pair (F, G) ∈ C[x, y]2 satisfying (1.3) such that (1.1) holds. Then we have Theorem 1.2. Similar to the proof of Theorem 1.2, denote D = {d p0 ,p1 | (p0 , p1 ) ∈ V } [cf. (1.7)], and set d = inf D ∈ R≥0  (the infimum of D). By definition, there exists a sequence (p0i , p1i ) := (x0i , y0i ), (x1i , y1i ) ∈ V , i = 1, 2, ..., such that limi→∞ d p0i ,p1i = d . Then {x0i , x1i | i = 1, 2, ...} is bounded by (1.7). Thus {y0i , y1i | i = 1, 2, ...} is also bounded by (1.11). By replacing the sequence by a subsequence, we can then assume (5.3). Now arguments after (5.3) show that (p0 , p1 ) ∈ V , but (x0 , x1 ) 6= (ξ0 , ξ1 ) by Theorem 1.2 (i), i.e., d > 0. Then by Theorem 1.2 (ii), we can then obtain a contradiction with the definition of d . This proves Theorem 1.1.  References [1] A. Abdesselam, The Jacobian conjecture as a problem of perturbative quantum field theory, Ann. Henri Poincaré 4 (2003), 199–215. 21 [2] S. Abhyankar, Some thoughts on the Jacobian conjecture. I., J. Algebra 319 (2008), 493–548. [3] H. Appelgate, H. Onishi, The Jacobian conjecture in two variables, J. Pure Appl. Algebra 37 (1985), 215–227. [4] P.K. Adjamagbo, A. van den Essen, A proof of the equivalence of the Dixmier, Jacobian and Poisson conjectures, Acta Math. Vietnam. 32 (2007), 205–214. [5] H. Bass, The Jacobian conjecture, Algebra and its Applications (New Delhi, 1981), 1–8, Lecture Notes in Pure and Appl. Math. 91, Dekker, New York, 1984. [6] H. Bass, E.H. Connell, D. Wright, The Jacobian conjecture: reduction of degree and formal expansion of the inverse, Bull. Amer. Math. Soc. 7 (1982), 287–330. [7] A. Belov-Kanel, M. Kontsevich, The Jacobian Conjecture is stably equivalent to the Dixmier Conjecture, Mosc. Math. J. 7 (2007), 209–218. [8] A. Bialynicki-Birula, M. Rosenlicht, Injective morphisms of real algebraic varieties, Proc. Amer. Math. Soc. 13 (1962), 200–203. [9] Z. Charzyński, J. Chadzyński, P. Skibiński, A contribution to Keller’s Jacobian conjecture. IV. Bull. Soc. Sci. Lett. Lódź 39 (1989), no. 11, 6 pp. [10] M. Chamberland, G. Meisters, A mountain pass to the Jacobian conjecture, Canad. Math. Bull. 41 (1998), 442–451. [11] J. Dixmier, Sur les algebres de Weyl, Bull. Soc. Math. France 96 (1968), 209–242. [12] L.M. Drużkowski, The Jacobian conjecture: survey of some results, Topics in Complex Analysis (Warsaw, 1992), 163–171, Banach Center Publ., 31, Polish Acad. Sci., Warsaw, 1995. [13] M. de Bondt, A. van den Essen, A reduction of the Jacobian conjecture to the symmetric case, Proc. Amer. Math. Soc. 133 (2005), 2201–2205. [14] G.P. Egorychev, V.A. Stepanenko, The combinatorial identity on the Jacobian conjecture, Acta Appl. Math. 85 (2005), 111–120. [15] E. Hamann, Algebraic observations on the Jacobian conjecture, J. Algebra 265 (2003), 539–561. [16] Z. Jelonek, The Jacobian conjecture and the extensions of polynomial embeddings, Math. Ann. 294 (1992), 289–293. [17] S. Kaliman, On the Jacobian conjecture, Proc. Amer. Math. Soc. 117 (1993), 45–51. [18] T. Kambayashi, M. Miyanishi, On two recent views of the Jacobian conjecture, Affine Algebraic Geometry, 113–138, Contemp. Math. 369, Amer. Math. Soc., Providence, RI, 2005. [19] M. Kirezci, The Jacobian conjecture. I, II. İstanbul Tek. Üniv. Bül. 43 (1990), 421–436, 451–457. [20] L. Makar-Limanov, U. Turusbekova, U. Umirbaev, Automorphisms and derivations of free Poisson algebras in two variables, J. Algebra 322 (2009), 3318–3330. [21] T.T. Moh, On the Jacobian conjecture and the configurations of roots, J. Reine Angew. Math. 340 (1983), 140–212. [22] M. Nagata, Some remarks on the two-dimensional Jacobian conjecture, Chinese J. Math. 17 (1989), 1–7. [23] D.J. Newman, One-one polynomial maps, Proc. Amer. Math. Soc. 11 (1960), 867–870. [24] A. Nowicki, On the Jacobian conjecture in two variables. J. Pure Appl. Algebra 50 (1988), 195–207. [25] K. Rusek, A geometric approach to Keller’s Jacobian conjecture, Math. Ann. 264 (1983), 315–320. [26] S. Smale, Mathematical problems for the next century, Math. Intelligencer 20 (1998), 7-15. [27] M.H. Shih, J.W. Wu, On a discrete version of the Jacobian conjecture of dynamical systems, Nonlinear Anal. 34 (1998), 779–789. [28] V. Shpilrain, J.T. Yu, Polynomial retracts and the Jacobian conjecture, Trans. Amer. Math. Soc. 352 (2000), 477–484. [29] Y. Su, Poisson algebras, Weyl algebras and Jacobi pairs, arXiv:1107.1115v9. [30] Y. Su, X. Xu, Central simple Poisson algebras, Science in China A 47 (2004), 245–263. [31] A. van den Essen, Polynomial automorphisms and the Jacobian conjecture, Progress in Mathematics 190, Birkhäuser Verlag, Basel, 2000. [32] A. van den Essen, The sixtieth anniversary of the Jacobian conjecture: a new approach, Polynomial automorphisms and related topics, Ann. Polon. Math. 76 (2001), 77–87. [33] D. Wright, The Jacobian conjecture: ideal membership questions and recent advances, Affine Algebraic Geometry, 261–276, Contemp. Math. 369, Amer. Math. Soc., Providence, RI, 2005. [34] J.T. Yu, Remarks on the Jacobian conjecture, J. Algebra 188 (1997), 90–96. 22
0math.AC
Improving Efficiency in Convolutional Neural Network with Multilinear Filters Dat Thanh Tran∗ , Alexandros Iosifidis† and Moncef Gabbouj∗ ∗ Laboratory arXiv:1709.09902v3 [cs.CV] 23 Oct 2017 † Department of Signal Processing, Tampere University of Technology, Tampere, Finland of Engineering, Electrical & Computer Engineering, Aarhus University, Aarhus, Denmark Email:{dat.tranthanh,moncef.gabbouj}@tut.fi, [email protected] Abstract—The excellent performance of deep neural networks has enabled us to solve several automatization problems, opening an era of autonomous devices. However, current deep net architectures are heavy with millions of parameters and require billions of floating point operations. Several works have been developed to compress a pre-trained deep network to reduce memory footprint and, possibly, computation. Instead of compressing a pre-trained network, in this work, we propose a generic neural network layer structure employing multilinear projection as the primary feature extractor. The proposed architecture requires several times less memory as compared to the traditional Convolutional Neural Networks (CNN), while inherits the similar design principles of a CNN. In addition, the proposed architecture is equipped with two computation schemes that enable computation reduction or scalability. Experimental results show the effectiveness of our compact projection that outperforms traditional CNN, while requiring far fewer parameters. I. I NTRODUCTION In recent years, deep neural network architectures have excelled in several application domains, ranging from machine vision [1], [2], [3], natural language processing [4], [5] to biomedical [6], [7] and financial data analysis [8], [9]. Of those important developments, Convolutional Neural Network (CNN) has evolved as a main workhorse in solving computer vision tasks nowadays. The architecture was originally developed in the 1990s for handwritten character recognition using only two convolutional layers [10]. Over the years, with the development of Graphical Processing Units (GPUs) and efficient implementation of convolution operation, the depth of CNNs has been increased to tackle more complicated problems. Nowadays, prominent architectures such as Residual Network (ResNet) [11] or Google Inception [12] with hundreds of layers have become saturated. Researchers started to wonder whether millions of parameters are essential to achieve such performance. In order to extend the benefit of such deep nets to embedded devices with limited computation power and memory, recent works have focused on reducing the memory footprint and computation of a pre-trained network, i.e. they apply network compression in the post-training stage. In fact, recent works have shown that traditional network architectures such as Alexnet, VGG or Inception are highly redundant structures [13], [14], [15], [16], [17], [18], [19], [20], [21], [22]. For example, in [13] a simple heuristic based on magnitude of the weights was employed to eliminate the connections in a pre-trained network, which achieved considerable amount of compression without hurting the performance much. Additionally, representing network parameters with low bitwidth numbers, like in [23], [24], [25], has shown that the performance of a 32-bit network can be closely retained with only 4-bit representations. It should be noted that the two approaches are complementary to each other. In fact, a compression pipeline called “Deep Compression” [13] which consists of three compression procedures, i.e. weight pruning, weight quantization and Huffman-based weight encoding, achieved excellent compression performance on AlexNet and VGG-16 architectures. Along pruning and quantization, low-rank approximation of both convolutional layers and fully connected layers was also employed to achieve computational speed up [26], [27], [28]. Viewed as high-order tensors, convolutional layers were decomposed using traditional tensor decomposition methods, such as CP decomposition [21], [20], [29] or Tucker decomposition [30], and the convolution operation is approximated by applying consecutive 1D convolutions. Overall, efforts to remove redundancy in already trained neural networks have shown promising results by determining networks with a much simpler structure. The results naturally pose the following question: why should we compress an already trained network and not seek for a compact network representation that can be trained from scratch?. Subsequently, one could of course exploit the above mentioned compression techniques to further decrease the cost. Under this perspective, the works in [19], [22] utilizing a low-rank approximation approach were among the first to report simplified network structures. The success of Convolutional Neural Networks can be attributed to four important design principles: sparse connectivity, parameter sharing, pooling and multilayer structure. Sparse connectivity (in convolutional layers) only allows local interaction between input neurons and output neurons. This design principle comes from the fact that in many natural data modalities such as images and videos local/neighboring values are often highly correlated. These groups of local values usually contain certain distinctive patterns, e.g. edges and color blobs, in images. Parameter sharing mechanism in CNNs enables the underlying model to learn location invariant cues. In other words, by sliding the filters over the input, the patterns can be detected regardless of the location. Pooling and multilayer structure design of deep neural networks in general and CNN in particular, captures the compositional hierarchies embedded within many natural signals. For example, in facial images, lower level cues such as edges, color and texture patterns form discriminative higher level cues of facial parts, like nose, eyes or lips. Similar compositional structure can be seen in speech or text, which are composed of phonemes, syllables, words and sentences. Although the particular structure of a deep network has evolved over time, the above important design principles remain unchanged. At the core of any convolution layer, each filter with d×d×C elements operates as a micro feature extractor that performs linear projection of each data patch/volume from a feature space of d2 C dimensions to a real value. In order to enhance the discrimination power of this micro feature extractor, the authors of [31] proposed to replace the GLM model by a general nonlinear function approximator, particularly the multilayer perceptron (MLP). The resulting architecture was dubbed Network in Network (NiN) since it consists of micro networks that perform the feature extractor functionality instead of simple linear projection. In this paper, instead of seeking a more complex feature extractor, we propose to replace the linear projection of the traditional CNN by multilinear projection in the pursuit of simplicity. There has been a great effort to extend traditional linear methods to multilinear ones in an attempt to directly learn from the natural representation of the data as high order tensors [32], [33], [34], [35], [36], [37]. The beauty of multilinear techniques lies in the property that the input tensor is projected simultaneously in each tensor mode, allowing only certain connections between the input dimensions and output dimensions, hence greatly reducing the number of parameters. Previous works on multilinear discriminant learning and multilinear regression [38], [32], [33], [34], [35], [36] have shown competitive results of multilinear-based techniques. The proposed architecture still inherits the four fundamental design properties of a traditional deep network while utilizing multilinear projection as a generic feature extractor. The complexity of each feature extractor can be easily controlled through the “rank” hyper-parameter. Besides a fast computation scheme when the network is compact, we also propose an alternative computation method that allows efficient computation when complexity increases. The contribution of our paper can be summarized as follows: • We propose a generic feature extractor that performs multilinear mapping to replace the conventional linear filters in CNNs. The complexity of each individual feature extractor can be easily controlled via its rank, which is a hyperparameter of the method. By having the ability to adjust individual filter’s complexity, the complexity of the entire network can be adjusted without the need of increasing the number of filters in a layer, i.e. the width of the layer. Since the proposed mapping is differentiable, the entire network can be easily trained end-to-end by using any gradient descent-based training process. We provide the analysis of computation and memory requirements of the proposed structure. In addition, based on the properties of the proposed mapping, we propose two efficient computation strategies leading to two different complexity settings. • The theoretical analysis of the proposed approach is supported by experimental results in real-world classification problems, in comparison with CNN and the low-rank scheme in [19]. The remainder of the paper is organized as follows: In section 2, we provide an overview of the related works focusing on designing compact network structures. Section 3 gives the necessary notations and definitions before presenting the proposed structure and its analysis. In section 4, we provide details of our experiment procedures, results and quantitative analysis. Section 5 concludes our work and discusses possible future extensions. • II. R ELATED W ORK Research focusing on the design of a less redundant network architecture has gained much more attention recently. One of the prominent design pattern is the bottleneck unit which was first introduced in the ResNet architecture [11]. The bottleneck pattern is formed by two 1 × 1 convolution layers with some 3 × 3 convolution layers in between. The first 1 × 1 convolution layer is used to reduce the number of input feature maps while the latter is used to restore the number of output feature maps. Several works such as [39], [40], [41] have incorporated the bottleneck units into their network structure to reduce computation and memory consumed. Recently MobileNet architecture [42] was proposed which replaced normal convolution operation by depthwise separable convolution layers. Constituted by depthwise convolution and pointwise convolution, the depthwise separable convolution layer performs the filtering and combining steps independently. The resulting structure is many times more efficient in terms of memory and computation. It should be noted that bottleneck design or depthwise separable convolution layer is a design on a macro level of the network structure in which the arrangements of layers are investigated to reduce computation. On a micro level, the works in [19] and [22] assumed a low rank structure of convolutional kernels in order to derive a compact network structure. In fact, low rank assumption has been incorporated into several designs prior to deep neural networks, such as dictionary learning, wavelet transform of high dimensional data. The first incorporation of low rank assumption in neural network compression was proposed in [21], [29], [20]. In [29], CP decomposition was proposed to decompose the entire 4D convolutional layer into four 1D convolutions. Although the effective depth of the network remains the same, replacing one convolution operation by four can potentially lead to difficulty in training the network from scratch. With a carefully designed initialization scheme, the work of [22] was able to train a mixture of low-rank filters from scratch with competitive performances. Improving on the idea of [29], a different low-rank structure that allows both approximating an already trained network and training from scratch was proposed in [19]. Specifically, let us denote a convolution layer of N kernels by W ∈ Rd×d×C×N , where C and d are the number of input feature maps and spatial size of the kernel, respectively. [19] proposed to approximate W using a vertical kernel V ∈ Rd×1×C×K and a horizontal kernel H ∈ R1×d×K×N . The approximation is in the following form: W̃nc ≃ K X Vkc (Hnk )T , (1) k=1 where the superscript and subscript denote the index of the channel and the kernel respectively. K is a hyper-parameter controlling the rank of the matrix approximation. Here Wnc is just the 2D kernel weight of the n-th filter applied to the c-th channel of the input feature map; Vkc and Hnk are just d-dimensional vectors. As can be seen from (1), the authors simplify a convolutional layer by two types of parameter sharing. The first is the sharing of right singular vectors (Hnk ) across all C input channels within the n-th filter while the second enforces the sharing of left singular vectors (Vkc ) across all N filters. The work in [19] is closely related to ours since we avoid designing a particular initialization scheme by including a Batch Normalization step [43]. The resulting structure was easily trained from scratch with different network configurations. One of the nice properties of mode-k product is that the result of the projection does not depend on the order of projection, i.e.   (2) X ×k1 A ×k2 B = X ×k2 B ×k1 A. The above property allows efficient computation of the projection by selecting the order of computation. B. Multilinear filter as generic feature extractor Let Xi,j ∈ Rd×d×C and W ∈ Rd×d×C denote the input patch centered at spatial location (i, j) and the convolution kernel respectively. At the core of a classic CNN, each convolution kernel operates as a feature extractor sliding through the input tensor to generate a higher level representation. Specifically, the kernel performs the following linear mapping:  Yi,j = f Xi,j ; W; b = hXi,j , Wi + b, (3) where Yi,j and b denotes the response at (i, j) and the intercept term respectively. h·, ·i denotes the dot-product between two tensors. After the above linear projection, a nonlinearity is applied to Yi,j using the layer’s activation function. We propose to replace the above linear projection by the following multilinear mapping: R 3 Y  X Yi,j = f˜ Xi,j ; W̃ ; b = Xi,j ×k wk (r)T + b, r=1 III. P ROPOSED M ETHOD We start this section by introducing some notations and definitions related to our work. We denote scalar values by either low-case or upper-case characters (x, y, X, Y . . . ), vectors by low-case bold-face characters (x, y, . . . ), matrices by upper-case bold-face characters (A, B, . . . ) and tensors by calligraphic capital characters (X , Y, . . . ). A tensor is a multilinear matrix with K modes, and is defined as X ∈ RI1 ×I2 ×···×IK , where Ik denotes the dimension in mode-k. The entry in the ik th index in mode-k for k = 1, . . . , N is denoted as Xi1 ,i2 ,...,iK . A. Multilinear Algebra Concepts Definition 1 (Mode-k Fiber and Mode-k Unfolding): The mode-k fiber of a tensor X ∈ RI1 ×I2 ×···×IK is a vector of Ik -dimensional, given by fixing every index but ik . The mode-k unfolding of X , also known as mode-k matricization, transforms the tensor X to matrix X(k) , which is formed by arranging the mode-k fibers as columns. The shape of X(k) is QK RIk ×Ik̄ with Ik̄ = i=1,i6=k Ii . Definition 2 (Mode-k Product): The mode-k product between a tensor X = [xi1 , . . . , xiK ] ∈ RI1 ×...IK and a matrix W ∈ RJk ×Ik is another tensor of size I1 × · · · × Jk × · · · × IK and denoted by X ×k W. The element of X ×k W is defined as [X ×k W]i1 ,...,ik−1 ,jk ,ik+1 ,...,iK = PIK ik =1 [X ]i1 ,...,ik−1 ,ik ,...,iK [W]jk ,ik . For Q convenience, we denote X ×1 W1 × · · · ×K WK by X K k=1 ×k Wk . (4) k=1 where R is the rank hyper-parameter of the projection and wk (r) denotes the projection along mode-k. In our case, w1 (r) ∈ Rd , w2 (r) ∈ Rd , w3 (r) ∈ RC , ∀r = 1, . . . , R. Since the mapping in Eq. (4) operates on similar input patch and yields a scalar response as a linear mapping does in CNNs, the proposed multilinear mapping acts as a generic feature extractor and can be incorporated into any design of the CNN topology, such as AlexNet [44], VGG [45], Inception [41] or ResNet [11]. In addition, since the mapping in Eq. (4) is differentiable with respect to each individual weight vector wk (r), the resulting network architecture can be trained in an end-to-end fashion by back propagation algorithm. We hereby denote the layer employing our proposed multilinear mapping as MLconv. Recently, mode-k multiplication has been introduced as a tensor contraction layer in [46] to project the entire input layer as a high-order tensor to another tensor. This is fundamentally different from our approach since the tensor contraction layer is a global mapping which does not incorporate sparse connectivity and parameter sharing principles. In general, modek multiplication can be applied to an input patch/volume to output another tensor instead of a scalar as in our proposal. We restrict the multilinear projection in the form of Eq. (4) to avoid the increase in the output dimension which leads to computation overhead in the next layer. Moreover, tensor unfolding operation required to perform the multilinear projection that transforms a tensor to another tensor will potentially increase the computation. On the contrary, our proposed mapping is a special case of the general multilinear mapping using mode-k Fig. 1. Illustration of the proposed multilinear mapping according to equation (6) in sequence: mode-3, mode-1 and mode-2 product in which the output tensor degenerates to a scalar. This special case allows efficient computation of the projection, as shown in the next section. C. Memory and Computation Complexity One the most obvious advantages of the mapping in Eq. (4) is that it requires far fewer parameters to estimate the model, compared to the linear mapping in a CNN. In a CNN utilizing the mapping in Eq. (3), a layer with N kernels requires the storage of d2 CN parameters. On the other hand, a similar layer configuration with N mappings utilizing the projection in Eq. (4) requires only R(2d + C)N parameters. The gain ratio is: d2 C . (5) R(2d + C) As compared to a similar CNN topology, the memory reduction utilizing the mapping in Eq. (4) varies for different layers. The case where C >> d (which is the usual case) leads to a gain ratio approximately equal to d2 /R. In our experiments, we have seen that with d = 3 and R = 2 in all layers, memory reduction is approximately 4×, while having competitive performance compared to a CNN with similar network topology. Let us denote by Xl ∈ RX×Y ×C and Wl ∈ Rd×d×C×N the input and N kernels of the l-th convolutional layer having C input feature maps and N output feature maps. In addition, we assume zero-padding and sliding window with stride of 1. By using linear projection as in case of CNN, the computational complexity of this layer is O(d2 XY CN ). Before evaluating the computational cost of a layer using the proposed method, it should be noted that the projection in Eq. (4) can be efficiently computed by applying three consecutive convolution operations. Details of the convolution operations depend on the order of three modes. Therefore, although the result of the mapping in Eq. (4) is independent of the order of mode-k projection, the computational cost actually depends on the order of projections. For C >> d, it is computationally more efficient to first perform the projection in mode-3 in order to reduce the number of input feature maps for subsequent mode-1 and mode-2 projection: Yi,j = R X Xi,j ×3 w3 (r)T ×1 w1 (r)T ×2 w2 (r)T + b. (6) r=1 The response Yi,j in Eq. (6) is the summation of R independent projections with each projection corresponding to the following three consecutive steps, as illustrated in Figure III-B: • Projection of Xi,j along the third mode which is the linear combination of C input feature maps. The result is a (3) tensor Xi,j of size d × d × 1. (3) • Projection of Xi,j along the first mode which is the linear (1) combination of d rows. The result is a tensor Xi,j of size 1 × d × 1. (1) • Projection of Xi,j along the second mode which is the linear combination of d elements. With the aforementioned configuration of the l-th layer, the computational complexity of the l-th MLconv layer utilizing our multilinear mapping is as follows: • Mode-3 projection that corresponds to applying N R convolutions to the input Xl with kernels of size 1 × 1 × C elements, having computational complexity of O(XY CN R). The output of the projection along the third mode is a tensor of size X × Y × N R. • Mode-1 projection is equivalent to applying convolution with one d×1×N R separable convolution kernel, having complexity of O(dXY N R). This results in a tensor of size X × Y × N R. • Mode-2, similar to mode-1 projection, can be computed by applying convolution with one 1 × d × N R separable convolution kernel, requiring O(dXY N R) computation. This results in a tensor of size X ×Y ×N R. By summing over R ranks, we arrive at the output of layer l of size X × Y × N. The total complexity of layer l using our proposed mapping is thus O(XY N R(C +2d)). Compared to linear mapping, our method achieves computational gain of: the scalability of our proposed mapping when R is large while previous subsection proposes an efficient computation scheme that allows computation savings when R is small. Overall, we can conclude that the computation of the proposed layer structure is efficient while, as will be shown in the experimental evaluation, changing the rank of the adopted tensor definitions can increase performance. d2 C . R(C + 2d) IV. E XPERIMENTS (7) From Eqs. (5) and (7), we can conclude that the proposed feature extractor achieves approximately d2 /R savings in both computation and memory when C >> d. In this section, we provide experimental results to support the theoretical analysis in section III. The experimental protocol and datasets are described first, followed by the discussion of the experimental results. D. Initialization with pre-trained CNN A. Network Topology The proposed mapping in Eq. (4) can be viewed as a constrained form of convolution kernel as follows: Traditional CNN topology consists of two modules: feature extractor module and classifier module. Several convolution and pooling layers stacked on top of each other act as feature extractor while one or two fully-connected layers act as the classifier. In order to evaluate the effectiveness of the proposed multilinear filter, we constructed the network architecture with only feature extractor layers, i.e. convolution layer or MLconv layer together with pooling layer while skipping fully-connected layer. As the name suggests, fully-connected layer has dense connections, accounting for large number of parameters in the network while being prone to overfitting. Moreover, a powerful and effective feature extractor module is expected to produce a highly discriminative latent space in which the classification task is made simple. Such fullyconvolutional networks have attracted much attention lately due to their compactness and excellent performance in imagerelated problems like semantic segmentation, object localization and classification [31], [2], [48] The configuration of the baseline network adopted in our experiment benchmark is shown in Table I where 3 × 3 × N denotes N kernels with 3 × 3 spatial dimension, BN denotes Batch Normalization [43] and LReLU denotes Leaky Rectified Linear Unit [49] with α = 0.2. Our baseline architecture is similar to the one proposed in [50] with four key differences. Firstly, we choose to retain a proper pooling layer instead of performing convolution with a stride of 2 as proposed in [50]. Secondly, Batch Normalization was applied after every convolution layer except the last one where the output goes through softmax to produce the class probability. In addition, LReLU activation unit was applied to the output of batch normalization. It has been shown that the adoption of BN and LReLU speeds up the learning process of the network by being more tolerant to the learning rate with the possibility of arriving at better minimas [43], [51]. Based on the configuration of the network topology, we compare the performance between standard linear convolution kernel (CNN), our proposed multilinear kernel (MLconv) and the low-rank (LR) structure proposed in [19]. The last two 1×1 convolution layers were not replaced by LR or MLconv layer. It should be noted that BN and LReLU are applied to all three competing structures in our experiments while in [19], BN was Yi,j = hXi,j , W̃i + b, (8) PR where W̃ is expressed in Kruskal form W̃ = r=1 w1 (r) ◦ w2 (r) ◦ w3 (r) as the outer-product of the corresponding projection in three modes. By calculating Yi,j using modek product definition as in Eq. (4) and using dot-product as in Eq. (8), the equivalance of Eq. (4) and Eq. (8) can be found [47]. Consequently, a convolution layer can be converted to an MLconv layer by decomposing each 3D convolution filter into Kruskal form using any CP decomposition method [47]. It should be noted here that, since there is no closed-form solution of the CP decomposition, such a conversion corresponds to an approximation step. Under this perspective, a pre-trained CNN can be used to initialize our network structure to speed up the training process. However, as we will show in the experimental section, random initialization of multilinear filters can lead to better performance. In addition to an initialization scheme, Eq. (8) also complements our proposed mapping with an efficient computation strategy when R is large. The computation cost discussed in the previous subsection depends linearly with parameter R. When R is large, it is more efficient to compute the mapping according to Eq. (8) by first calculating W̃ and then convolving the input with W̃. The computational complexity of the first step is O(d2 CRN ) while for the convolution step is O(d2 XY CN ), resulting to an overall complexity of O(d2 CRN + d2 XY CN ) for the entire layer. The ratio between normal convolution layer and MLconv layer using this computation strategy is: XY . (9) R + XY It is clear that XY is usually much larger than R, therefore, the increase in computation as compared to normal convolution is marginal. Following this calculation strategy, a rank 6 network is marginally slower than a rank 1 network or a CNN. This will be demonstrated in our experiment section. In conclusion, the computation method discussed in this subsection allows C. Experimental settings TABLE I BASELINE N ETWORK A RCHITECTURE Input layer 3 × 3 × 96 - BN - LReLU 3 × 3 × 96 - BN - LReLU 3 × 3 × 96 - BN - LReLU 2 × 2 MaxPooling 3 × 3 × 192 - BN - LReLU 3 × 3 × 192 - BN - LReLU 3 × 3 × 192 - BN - LReLU 2 × 2 MaxPooling 3 × 3 × 192 - BN - LReLU 1 × 1 × 192 - BN - LReLU 1 × 1 × #class LReLU Global Average over spatial dimension softmax activation not applied to the baseline CNN which could potentially lead to biased result. B. Datasets 1) CIFAR-10 and CIFAR-100: CIFAR dataset [52] is an object classification dataset which consists of 50000 color images for training and 10000 for testing with the resolution 32 × 32 pixels. CIFAR-10 refers to the 10-class classification problem of the dataset in which each class has 5000 images for training and 1000 images for testing while CIFAR-100 refers to a more fine-grained classification of the images into 100 classes. 2) SVHN: SVHN [53] is a well-known dataset for handwritten digit recognition problem which consists of more than 600k images of house numbers extracted from natural scenes with varying number of samples from each class. This dataset poses a much harder character recognition problem as compared to the MNIST dataset [10]. We used 32×32 cropped images provided by the database from which each individual image might contain some distracting digits on the sides. All networks were trained using both SGD optimizer [54] as well as Adam [55]. While the proposed structure tends to arrive at better minimas with Adam, this is not the case for the other two methods. For SGD optimizer, the momentum was fixed to 0.9. We adopted two sets of learning rate schedule SC1 = {0.01, 0.005, 0.001, 0.0005, 0.0001} and SC2 = {0.01, 0.001, 0.0001}. Each schedule has initial learning rate γ = 0.01 and decreases to the next value after E epochs where E was cross-validated from the set {40, 50, 60, 100, 120}. We trained each network with maximum of 300 and 100 epochs for CIFAR and SVHN respectively. The batch size was fixed to 200 samples for all competing networks. Regarding data augmentation, for CIFAR dataset, random horizontally flipped samples were added as well as random translation of the images by maximum 5 pixels were performed during the training process; for SVHN dataset, only random translation of maximum 5 pixels was performed. For both dataset, no further preprocessing step was applied. Regarding regularization, both weight decay and max-norm [56] are individually and together exploited in our experiments. Max-norm regularizer was introduced in [56] where it was used together with Dropout. During the training process, the l2 norm of each individual filter is constrained to lie inside the ball of a given radius r which was cross-validated from the set {1.0, 2.0, 4.0, 6.0, 8.0}. The weight decay hyper-parameter λ was searched from the set {0.001, 0.0005}. In addition, Dropout with pi = 0.2 was applied to the input and Dropout with p = po was applied to the output of all pooling layers with the optimal po obtained from the set {0.1, 0.2, 0.3, 0.4, 0.5}. Due to the differences between the three competing structures, we observed that while the baseline CNN and LR networks work well with weight decay, applying weight decay to the proposed network structure tends to drive all the weight values close to zeros when λ is large, or the regularization effect is marginal when using a small value for λ, leading to the TABLE II CIFAR-10 C LASSIFICATION ERROR (%) Scratch Pretrained # Parameters CNN 7.47 − ≈ 1.38M MLconv1 8.54 8.17 ≈ 0.20M LR26 9.14 8.64 ≈ 0.20M MLconv2 7.68 7.76 ≈ 0.35M LR53 8.31 7.49 ≈ 0.35M MLconv4 7.34 7.38 ≈ 0.65M LR106 8.00 7.10 ≈ 0.64M MLconv6 7.30 7.06 ≈ 0.97M MLconv4 28.27 28.45 ≈ 0.67M LR106 30.11 28.40 ≈ 0.67M MLconv6 28.08 28.51 ≈ 0.98M TABLE III CIFAR-100 C LASSIFICATION ERROR (%) Scratch Pretrained # Parameters CNN 29.60 − ≈ 1.39M MLconv1 31.32 31.88 ≈ 0.21M LR26 35.79 33.98 ≈ 0.21M MLconv2 29.10 29.86 ≈ 0.37M LR53 31.45 30.00 ≈ 0.37M CNN MLconv LR MLconv-i LR-i Classification Error (%) on CIFAR-10 9.0 LR26i MLconv1 LR53 8.5 MLconv1i 8.0 LR106 MLconv2i MLconv2 7.5 LR53i MLconv4 LR106i 7.0 0.2 0.4 CNN MLconv4i MLconv6 MLconv6i 0.6 0.8 1.0 Number of parameters (10e6) 1.2 36 Classification Error (%) on CIFAR-100 LR26 CNN MLconv LR MLconv-i LR-i LR26 35 LR26i 34 33 32 31 MLconv1i LR53 MLconv1 MLconv2i LR53i MLconv2 30 29 28 1.4 Fig. 2. Model size versus Classification Error on CIFAR-10 for different structures. MLconv and LR network initialized with CNN marked with ”i” at last 0.2 0.4 LR106 MLconv4i LR106i MLconv4 CNN MLconv6i MLconv6 0.6 0.8 1.0 Number of parameters (10e6) 1.2 1.4 Fig. 3. Model size versus Classification Error on CIFAR-100 for different structures. MLconv and LR network initialized with CNN marked with ”i” at last D. Experimental results exhaustive search of suitable hyper-parameter λ. On the other hand, max-norm regularization works well with our method without being too sensitive to the performance. For MLconv and LR structures, we experimented with several values for the rank parameter, namely R for the proposed mapping and K in Eq. (1) from [19]. In all of our experiments, we made no attempt to optimize R and K for each individual filter and layer in order to get the maximal compact structure, since such an approach is impractical in real cases. We instead used the same rank value throughout all layers. The experiments are, hence, different from [19] where the authors reported performance for different values of K at each layer without discussing the rank selection method. The experiments were conducted with R = 1, 2, 4, 6 and the corresponding structures are denoted as MLconv1, MLconv2, MLconv4, MLconv6. The values of K are selected so that the number of parameters in an LR network is similar to the number of parameters of its MLconv counterpart with given R. The corresponding LR structures are denoted as LR26, LR53 and LR106, where the number denotes the value of K. We did not perform experiments with K = 159, which corresponds to R = 6, since training the network is computationally much slower and falls out of the objective of this paper. All of three competing structures training from scratch were initialized with random initialization scheme proposed in [57]. We additionally trained MLconv and LR structure with weights initialized from an optimal pre-trained CNN on CIFAR dataset. The aforementioned protocols were also applied for this configuration. The weights of MLconv were initialized with CP decomposition using canonical alternating least square method [47], while for the LR structure we followed the calculation proposed in [19]. After obtaining the optimal hyper-parameter values, each network was trained for five times and the median value is reported. The second row of Tables II and III shows the classification errors of all competing methods trained from scratch on CIFAR-10 and CIFAR-100, respectively, while the third row shows the performance when initialized with a pre-trained CNN. The last row reports the model size of each network. As can be seen from both Tables II and III, using the proposed multi-linear filters leads to a 2× reduction in memory, while outperforming the standard convolution filters in both coarse and fine-grained classification in CIFAR datasets. More interestingly, in CIFAR-100, a rank 4 multilinear filter network attains an improvement over 1%. As we increase the number of projections in each mode to 6, i.e. when using R = 6, the performance of the network increases by a small margin. In both CIFAR-10 and CIFAR100, constraining R = 2 gains 4× memory reduction while keeping the performance relatively closed to the baseline CNN with less than 0.5% increment in classification error. Further limiting R to 1 maximizes the parameter reduction to nearly 7× with the cost of 1.07% and 1.72% increase in error rate for CIFAR-10 and CIFAR-100, respectively. A graphical illustration of the compromise between number of network’s parameters and classification error on CIFAR-10 and CIFAR100 is illustrated in Figures 2 and 3, respectively. The classification error of each competing network trained from scratch on SVHN dataset is shown in Table IV. Using our proposed MLconv layers, we achieved 4× reduction in model size while slightly outperforming CNN. At the most compact configuration of MLconv structure, i.e. MLconv1, we only observed a small increment of 0.12% in classification error as compared to CNN baseline. As we increased the complexity of MLconv layers, little improvement was seen with MLconv4 TABLE IV SVHN C LASSIFICATION ERROR CNN MLconv1 LR26 MLconv2 LR53 MLconv4 LR106 MLconv6 Error (%) 1.80 1.92 1.96 1.76 1.85 1.75 1.78 1.80 #Parameters ≈ 1.38M ≈ 0.20M ≈ 0.20M ≈ 0.35M ≈ 0.35M ≈ 0.65M ≈ 0.64M ≈ 0.97M while MLconv6 layers became slightly overfitted. Comparing the proposed multi-linear filter with the low rank structure LR, all configurations of MLconv network significantly outperform their LR counterparts. Specifically, in the most compact configuration, MLconv1 is better than LR26 by 0.6% and 4.47% on CIFAR-10 and CIFAR-100, respectively. The margin shrinks as the complexity increases but the proposed structure consistently outperforms LR when training the network from scratch. Similar comparison results can be observed on SVHN dataset: using MLconv layers obtained lower classification errors as compared to LR layers at all complexity configurations. As opposed to the experimental results reported in [19], we observed inferior results of the LR structure compared to standard CNN when training from scratch. The difference might be attributed to two main reasons: we incorporated batch normalization into the baseline CNN which could potentially improve the performance of the baseline CNN; our baseline configuration has no fullyconnected layer to solely benchmark the efficiency of different filter structures as a feature extractor. One interesting phenomenon was observed when we initialized MLconv and LR with a pre-trained CNN. For the LR structure, most configurations enjoy substantial improvement by initializing the network with weights decomposed from a pre-trained CNN on CIFAR dataset. The contrary happens for our proposed MLconv structure, since most configurations observe a degradation in performance. This can be explained by the fact that LR structure was designed to approximate each individual 2D convolution filter at every input feature map and the resulting structure comes with a closed-form solution for the approximation. With good initialization from a CNN, the network easily arrived at a good minimum while training a low-rank setting from scratch might have difficulty at achieving a good local minimum. Although the proposed mapping can be viewed as a form of convolution filter, the mapping in Eq. (4) embeds a multi-linear structure, hence possessing certain degree of difference. Initializing the proposed mapping by applying CP decomposition, which has no closed-form solution, may lead the network to a suboptimal state. Table V reports the average forward propagation time of a single sample measured on CPU for all three network structures on CIFAR-10. The second and third columns report the theoretical and actual speed-ups, respectively, measured by the number of multiply-accumulate operations normalized with respect to their convolution counterparts. For the proposed MLconv structure, we report the computation cost of both calculation strategies discussed in Section III. We refer to the first calculation strategy using the separable convolution as Scheme1, while the latter one using normal convolution as Scheme2. Results from Scheme2 are denoted with the asterisk. All the networks are implemented using Keras library [58] with Tensorflow [59] backend. It is clear that there is a gap between theoretical speed-up and actual speed-up, especially for the proposed structure implemented by an unoptimized separable convolution operation. In fact, at the time of writing, implementation of separable convolution operation is still missing in most libraries, not to mention efficient implementation. On the contrary, results from Scheme2 using normal convolution show a near perfect match between theory and implementation. This is due to the fact that normal convolution operation has been efficiently implemented and optimized in most popular libraries. This also explains why the computation gain of LR structure is inferior to MLconv structure (Scheme1) in theory but similar to ours in practice since LR structure is realized by normal convolution operation. The last four columns of Table V additionally prove the scalability of Scheme2 with respect to the hyper-parameter rank R as discussed in Section III-D. V. C ONCLUSIONS In this paper, we proposed a multilinear mapping to replace the conventional convolution filter in Convolutional Neural Networks. The resulting structure’s complexity can be flexibly controlled by adjusting the number of projections in each mode through a hyper-parameter R. The proposed mapping comes with two computation schemes which either allow memory and computation reduction when R is small, or the scalability when R is large. Numerical results showed that with far fewer parameters, architectures employing our mapping TABLE V F ORWARD C OMPUTATION T IME ON CIFAR10 ( NORMALIZED WITH RESPECT TO C ONV ) Theory Implementation MLconv1 8.14× 1.77× LR26 6.48× 1.79× MLconv2 4.11× 1.33× LR53 3.20× 1.54× MLconv4 2.06× 1.03× LR106 1.60× 1.23× MLconv6 1.38× 0.74× MLconv1* 0.997× 0.990× MLconv2* 0.993× 0.980× MLconv4* 0.987× 0.960× MLconv6* 0.980× 0.930× could outperform standard CNNs. This are promising results and opens future research directions focusing on optimizing parameter R on individual convolution layers to achieve the most compact structure and performance. R EFERENCES [1] R. Girshick, J. Donahue, T. Darrell, and J. Malik, “Rich feature hierarchies for accurate object detection and semantic segmentation,” in Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 580–587, 2014. [2] J. Redmon, S. Divvala, R. Girshick, and A. Farhadi, “You only look once: Unified, real-time object detection,” in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 779–788, 2016. [3] M. A. Waris, A. Iosifidis, and M. Gabbouj, “Cnn-based edge filtering for object proposals,” Neurocomputing, 2017. [4] G. Hinton, L. Deng, D. Yu, G. E. Dahl, A.-r. Mohamed, N. Jaitly, A. Senior, V. Vanhoucke, P. Nguyen, T. N. Sainath, et al., “Deep neural networks for acoustic modeling in speech recognition: The shared views of four research groups,” IEEE Signal Processing Magazine, vol. 29, no. 6, pp. 82–97, 2012. [5] A. Graves, A.-r. Mohamed, and G. Hinton, “Speech recognition with deep recurrent neural networks,” in Acoustics, speech and signal processing (icassp), 2013 ieee international conference on, pp. 6645–6649, IEEE, 2013. [6] M. Zabihi, A. B. Rad, S. Kiranyaz, M. Gabbouj, and A. K. Katsaggelos, “Heart sound anomaly and quality detection using ensemble of neural networks without segmentation,” in Computing in Cardiology Conference (CinC), 2016, pp. 613–616, IEEE, 2016. [7] X. An, D. Kuang, X. Guo, Y. Zhao, and L. He, “A deep learning method for classification of eeg data based on motor imagery,” in International Conference on Intelligent Computing, pp. 203–210, Springer, 2014. [8] A. Tsantekidis, N. Passalis, A. Tefas, J. Kanniainen, M. Gabbouj, and A. Iosifidis, “Using deep learning to detect price change indications in financial markets,” in European Signal Processing Conference (EUSIPCO), Kos, Greece, 2017. [9] A. Tsantekidis, N. Passalis, A. Tefas, J. Kanniainen, M. Gabbouj, and A. Iosifidis, “Forecasting stock prices from the limit order book using convolutional neural networks,” in Business Informatics (CBI), 2017 IEEE 19th Conference on, vol. 1, pp. 7–12, IEEE, 2017. [10] Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner, “Gradient-based learning applied to document recognition,” Proceedings of the IEEE, vol. 86, no. 11, pp. 2278–2324, 1998. [11] K. He, X. Zhang, S. Ren, and J. Sun, “Deep residual learning for image recognition,” in Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016. [12] C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich, “Going deeper with convolutions,” in Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1–9, 2015. [13] S. Han, H. Mao, and W. J. Dally, “Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding,” arXiv preprint arXiv:1510.00149, 2015. [14] Y. Guo, A. Yao, and Y. Chen, “Dynamic network surgery for efficient dnns,” in Advances In Neural Information Processing Systems, pp. 1379– 1387, 2016. [15] W. Chen, J. T. Wilson, S. Tyree, K. Q. Weinberger, and Y. Chen, “Compressing convolutional neural networks,” arXiv preprint arXiv:1506.04449, 2015. [16] W. Wen, C. Wu, Y. Wang, Y. Chen, and H. Li, “Learning structured sparsity in deep neural networks,” in Advances in Neural Information Processing Systems, pp. 2074–2082, 2016. [17] Y. Gong, L. Liu, M. Yang, and L. Bourdev, “Compressing deep convolutional networks using vector quantization,” arXiv preprint arXiv:1412.6115, 2014. [18] D. Lin, S. Talathi, and S. Annapureddy, “Fixed point quantization of deep convolutional networks,” in International Conference on Machine Learning, pp. 2849–2858, 2016. [19] C. Tai, T. Xiao, Y. Zhang, X. Wang, and E. Weinan, “Convolutional neural networks with low-rank regularization,” arXiv preprint arXiv:1511.06067, 2015. [20] E. L. Denton, W. Zaremba, J. Bruna, Y. LeCun, and R. Fergus, “Exploiting linear structure within convolutional networks for efficient evaluation,” in Advances in Neural Information Processing Systems, pp. 1269–1277, 2014. [21] M. Jaderberg, A. Vedaldi, and A. Zisserman, “Speeding up convolutional neural networks with low rank expansions,” arXiv preprint arXiv:1405.3866, 2014. [22] Y. Ioannou, D. Robertson, J. Shotton, R. Cipolla, and A. Criminisi, “Training cnns with low-rank filters for efficient image classification,” arXiv preprint arXiv:1511.06744, 2015. [23] I. Hubara, M. Courbariaux, D. Soudry, R. El-Yaniv, and Y. Bengio, “Quantized neural networks: Training neural networks with low precision weights and activations,” arXiv preprint arXiv:1609.07061, 2016. [24] P. Gysel, M. Motamedi, and S. Ghiasi, “Hardware-oriented approximation of convolutional neural networks,” arXiv preprint arXiv:1604.03168, 2016. [25] S.-C. Zhou, Y.-Z. Wang, H. Wen, Q.-Y. He, and Y.-H. Zou, “Balanced quantization: An effective and efficient approach to quantized neural networks,” Journal of Computer Science and Technology, vol. 32, no. 4, pp. 667–682, 2017. [26] M. Denil, B. Shakibi, L. Dinh, N. de Freitas, et al., “Predicting parameters in deep learning,” in Advances in Neural Information Processing Systems, pp. 2148–2156, 2013. [27] A. Novikov, D. Podoprikhin, A. Osokin, and D. P. Vetrov, “Tensorizing neural networks,” in Advances in Neural Information Processing Systems, pp. 442–450, 2015. [28] S. Lin, R. Ji, X. Guo, X. Li, et al., “Towards convolutional neural networks compression via global error reconstruction.,” in IJCAI, pp. 1753– 1759, 2016. [29] V. Lebedev, Y. Ganin, M. Rakhuba, I. Oseledets, and V. Lempitsky, “Speeding-up convolutional neural networks using fine-tuned cpdecomposition,” arXiv preprint arXiv:1412.6553, 2014. [30] Y.-D. Kim, E. Park, S. Yoo, T. Choi, L. Yang, and D. Shin, “Compression of deep convolutional neural networks for fast and low power mobile applications,” arXiv preprint arXiv:1511.06530, 2015. [31] M. Lin, Q. Chen, and S. Yan, “Network in network,” arXiv preprint arXiv:1312.4400, 2013. [32] Q. Li and D. Schonfeld, “Multilinear discriminant analysis for higherorder tensor data classification,” IEEE transactions on pattern analysis and machine intelligence, vol. 36, no. 12, pp. 2524–2537, 2014. [33] S. Yan, D. Xu, Q. Yang, L. Zhang, X. Tang, and H.-J. Zhang, “Discriminant analysis with tensor representation,” in Computer Vision and Pattern Recognition, 2005. CVPR 2005. IEEE Computer Society Conference on, vol. 1, pp. 526–532, IEEE, 2005. [34] H. Zhou, L. Li, and H. Zhu, “Tensor regression with applications in neuroimaging data analysis,” Journal of the American Statistical Association, vol. 108, no. 502, pp. 540–552, 2013. [35] D. T. Thanh, J. Kanniainen, M. Gabbouj, and A. Iosifidis, “Tensor representation in high-frequency financial data for price change prediction,” arXiv preprint arXiv:1709.01268, 2017. [36] D. Tao, X. Li, X. Wu, and S. J. Maybank, “General tensor discriminant analysis and gabor features for gait recognition,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 29, no. 10, 2007. [37] H. Lu, K. N. Plataniotis, and A. N. Venetsanopoulos, “Mpca: Multilinear principal component analysis of tensor objects,” IEEE Transactions on Neural Networks, vol. 19, no. 1, pp. 18–39, 2008. [38] W. Guo, I. Kotsia, and I. Patras, “Tensor learning for regression,” IEEE Transactions on Image Processing, vol. 21, no. 2, pp. 816–827, 2012. [39] X. Zhang, X. Zhou, M. Lin, and J. Sun, “Shufflenet: An extremely efficient convolutional neural network for mobile devices,” arXiv preprint arXiv:1707.01083, 2017. [40] M. Wang, B. Liu, and H. Foroosh, “Design of efficient convolutional layers using single intra-channel convolution, topological subdivisioning and spatial bottleneck structure,” [41] C. Szegedy, S. Ioffe, V. Vanhoucke, and A. A. Alemi, “Inception-v4, inception-resnet and the impact of residual connections on learning.,” in AAAI, pp. 4278–4284, 2017. [42] A. G. Howard, M. Zhu, B. Chen, D. Kalenichenko, W. Wang, T. Weyand, M. Andreetto, and H. Adam, “Mobilenets: Efficient convolutional neural networks for mobile vision applications,” arXiv preprint arXiv:1704.04861, 2017. [43] S. Ioffe and C. Szegedy, “Batch normalization: Accelerating deep network training by reducing internal covariate shift,” in International Conference on Machine Learning, pp. 448–456, 2015. [44] A. Krizhevsky, I. Sutskever, and G. E. Hinton, “Imagenet classification with deep convolutional neural networks,” in Advances in neural information processing systems, pp. 1097–1105, 2012. [45] K. Simonyan and A. Zisserman, “Very deep convolutional networks for large-scale image recognition,” arXiv preprint arXiv:1409.1556, 2014. [46] J. Kossaifi, A. Khanna, Z. C. Lipton, T. Furlanello, and A. Anandkumar, “Tensor contraction layers for parsimonious deep nets,” arXiv preprint arXiv:1706.00439, 2017. [47] T. G. Kolda and B. W. Bader, “Tensor decompositions and applications,” SIAM review, vol. 51, no. 3, pp. 455–500, 2009. [48] O. Ronneberger, P. Fischer, and T. Brox, “U-net: Convolutional networks for biomedical image segmentation,” in International Conference on Medical Image Computing and Computer-Assisted Intervention, pp. 234–241, Springer, 2015. [49] A. L. Maas, A. Y. Hannun, and A. Y. Ng, “Rectifier nonlinearities improve neural network acoustic models,” in Proc. ICML, vol. 30, 2013. [50] J. T. Springenberg, A. Dosovitskiy, T. Brox, and M. Riedmiller, “Striving for simplicity: The all convolutional net,” arXiv preprint arXiv:1412.6806, 2014. [51] B. Xu, N. Wang, T. Chen, and M. Li, “Empirical evaluation of rectified activations in convolutional network,” arXiv preprint arXiv:1505.00853, 2015. [52] A. Krizhevsky and G. Hinton, “Learning multiple layers of features from tiny images,” 2009. [53] Y. Netzer, T. Wang, A. Coates, A. Bissacco, B. Wu, and A. Y. Ng, “Reading digits in natural images with unsupervised feature learning,” in NIPS workshop on deep learning and unsupervised feature learning, vol. 2011, p. 5, 2011. [54] D. E. Rumelhart, G. E. Hinton, R. J. Williams, et al., “Learning representations by back-propagating errors,” Cognitive modeling, vol. 5, no. 3, p. 1, 1988. [55] D. Kingma and J. Ba, “Adam: A method for stochastic optimization,” arXiv preprint arXiv:1412.6980, 2014. [56] N. Srivastava, G. E. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov, “Dropout: a simple way to prevent neural networks from overfitting.,” Journal of machine learning research, vol. 15, no. 1, pp. 1929–1958, 2014. [57] K. He, X. Zhang, S. Ren, and J. Sun, “Delving deep into rectifiers: Surpassing human-level performance on imagenet classification,” in Proceedings of the IEEE international conference on computer vision, pp. 1026–1034, 2015. [58] F. Chollet, “keras.” https://github.com/fchollet/keras, 2015. [59] M. Abadi, A. Agarwal, P. Barham, E. Brevdo, Z. Chen, C. Citro, G. S. Corrado, A. Davis, J. Dean, M. Devin, S. Ghemawat, I. Goodfellow, A. Harp, G. Irving, M. Isard, Y. Jia, R. Jozefowicz, L. Kaiser, M. Kudlur, J. Levenberg, D. Mané, R. Monga, S. Moore, D. Murray, C. Olah, M. Schuster, J. Shlens, B. Steiner, I. Sutskever, K. Talwar, P. Tucker, V. Vanhoucke, V. Vasudevan, F. Viégas, O. Vinyals, P. Warden, M. Wattenberg, M. Wicke, Y. Yu, and X. Zheng, “TensorFlow: Large-scale machine learning on heterogeneous systems,” 2015. Software available from tensorflow.org.
9cs.NE
For referencing please quote: IEEE Trans. on Fuzzy Systems 23(4): 1127-1141, 2015. 1 Dynamical Models of Stock Prices Based on Technical Trading Rules Part I: The Models Li-Xin Wang  Abstract—In this paper we use fuzzy systems theory to convert the technical trading rules commonly used by stock practitioners into excess demand functions which are then used to drive the price dynamics. The technical trading rules are recorded in natural languages where fuzzy words and vague expressions abound. In Part I of this paper, we will show the details of how to transform the technical trading heuristics into nonlinear dynamic equations. First, we define fuzzy sets to represent the fuzzy terms in the technical trading rules; second, we translate each technical trading heuristic into a group of fuzzy IF-THEN rules; third, we combine the fuzzy IF-THEN rules in a group into a fuzzy system; and finally, the linear combination of these fuzzy systems is used as the excess demand function in the price dynamic equation. We transform a wide variety of technical trading rules into fuzzy systems, including moving average rules, support and resistance rules, trend line rules, big buyer, big seller and manipulator rules, band and stop rules, and volume and relative strength rules. Simulation results show that the price dynamics driven by these technical trading rules are complex and chaotic, and some common phenomena in real stock prices such as jumps, trending and self-fulfilling appear naturally. Index Terms—Fuzzy systems; stock markets; technical analysis; chaos; agent-based models. I. INTRODUCTION Understanding the dynamics of stock prices is one of the hardest challenges to human intelligence 1. There are mainly three approaches to studying the dynamic changes of stock prices 2 : the random walk model (Bachelier, 1900), the Manuscript received January 11, 2014; revised March 4, 2014; accepted April 21, 2014. Li-Xin Wang is with the Department of Automation Science and Technology, Xian Jiaotong University, Xian, P.R. China (e-mail: [email protected]). Quoting Newton’s famous saying: “I can predict the motions of the heavenly bodies, but not the madness of people.” (Wikiquote: Isaac Newton.) 2 Fundamental analysis (Graham and Dodd, 1940) studies the static or equilibrium values of stock prices and therefore will not be discussed here. 1 agent-based models (Tesfatsion and Judd, 2006), and technical analysis (Kirkpatrick and Dahlquist, 2011). The random walk model is the benchmark and starting point of the mainstream academic research on stock dynamics in finance and economy. At least two Nobel Prizes were awarded to the researches that used the random walk model as the starting point: the 1997 Nobel Prize of Economics to the option pricing model of Black and Scholes (Black and Scholes, 1973), and the 2003 Nobel Prize of Economics to the ARCH model of Engle (Engle, 1982). The basic assumption of the random walk model is that price changes (returns) are random and independent, so that past prices are useless in predicting the future price changes. The advantage of the random walk model is that it is a good first-approximation to real stock markets and provides a simple model based on which other important problems in finance and economy, such as option pricing (Hull, 2009) and volatility modeling (Engle, 1982; Bollerslev, Chou and Kroner, 1992; Fouque, Papanicolaou and Sircar, 2000; Andersen, Bollerslev and Diebold, 2010), can be studied in a mathematically rigorous fashion. A problem of the random walk model is that it does not provide a framework to study the microstructures of the price formation mechanism. The agent-based models overcome this problem by following a bottom-up approach to model directly the operations of different types of traders such as fundamentalists and chartists (Hommes, 2006). There is a large literature of agent-based models for stock prices (Tesfatsion and Judd, 2006), ranging from simple heuristic models (e.g., Kyle, 1985) to sophisticated switching among different types of traders (e.g., Lux, 1998). The advantage of the agent-based computational approach is that different types of traders and various trading details can be incorporated into the models and extensive simulations can be performed to study the resulting price dynamics. The main problem of the existing agent-based models is that there are too many parameters and too many degrees of freedom such that it is difficult to determine the causes for the price features observed. This complexity also makes it very hard to calibrate the models to real stock prices. As concluded in Hommes 2006: “Simple and parsimonious For referencing please quote: IEEE Trans. on Fuzzy Systems 23(4): 1127-1141, 2015. heterogeneous agent models can thus help to discipline the wilderness of agent-based modeling.” The third approach to studying the dynamic changes of stock prices is technical analysis that summarizes the trading heuristics from stock practitioners over hundreds of years of real stock trading experiences in human civilization (Lo and Hasanhodzic, 2010). The foundation of technical analysis is the belief that prices follow trends so that past price information is useful in predicting the future price values. The mainstream academics do not view technical analysis as a serious scientific discipline and claim that “chart-reading must share a pedestal with alchemy” (Malkiel, 2012). While the academics stand firm on the Efficient Markets Hypothesis (Fama, 1970) and believe that stock prices are unpredictable, the practitioners are using technical trading rules to “ride the trends” to make a lot of money (Lo and Hasanhodzic, 2009). Some open-minded academics studied the performance of some technical trading rules and gave positive conclusions (e.g., Brock, Lakonishok and LeBaron, 1992; Gencay, 1998; Sullivan, Timmermann and White, 1999; Lo, Mamaysky and Wang, 2000). A main criticism of technical analysis is that most technical rules require subjective judgment because the rules are expressed in terms of natural languages where fuzzy words and vague descriptions are everywhere. For example, one such trading rule might be: “If the momentum of the uptrend is too strong, over-bought may have occurred so that a trailing stop should be placed somewhere below the current price to secure some profits.” How strong is “too strong”? Where is “somewhere”? What amount should be placed at the trailing stop? This is where the academics leave the practitioners (Gigerenzer, 1996; Gigerenzer and Gaissmaier, 2011), and this is where fuzzy systems theory (Zadeh, 1971) comes to play, as we will do in this paper. The basic idea of this paper is to use fuzzy systems theory to convert the technical trading rules into excess demand (demand minus supply) functions which are then used to drive the price dynamics. Specifically, consider a stock whose price at time point t is , where t=0,1,2,…. Suppose there are M groups of traders who are trading this stock from t to t+1, and the traders in a group are using the same technical trading rules. By converting the technical trading rules for a group, say group , into a single excess demand function , we obtain the price dynamical model as follows: where the coefficient accounts for the strength of the traders in group for the relative change of price from t to t+1, and the denotes variables computed from the past prices and other information available at time t (the ’s will be precisely 2 defined in the following sections of this paper). The ’s are time-varying coefficients (representing the evolving market reality (Lo, 2004)), and means the i’th excess demand is not present at time t. The ’s can be determined based on stock price data , and we will show the details in Part III of this paper. To convert the technical trading rules into excess demand functions, we first define fuzzy sets to characterize the words used in the technical trading rules so that these technical rules become fuzzy IF-THEN rules in the framework of fuzzy systems theory. Then, standard fuzzy logic principles are employed to combine these fuzzy IF-THEN rules into fuzzy systems which are the excess demands in the price dynamic equation (1). Part I of this paper is organized as follows. In Sections II, III, IV, VI and VII, we will convert a number of popular technical trading rules into excess demand functions, including moving average rules, support and resistance rules, trend line rules, band and stop rules, and volume and relative strength rules. To make the picture more complete, in Section V we will formulate the typical actions of the big buyers and big sellers (the institutional traders who manage large sums of money) and the manipulators in terms of fuzzy IF-THEN rules. Simulations will be performed in these sections to illustrate the typical price trajectories of these models. Some concluding remarks will be drawn in Section VIII. In Part II of this paper, we will analyze the price dynamic model (1) with moving-average rules in details to show the stability, volatility, short-term predictability, return independency, fat-tailed return distribution and other properties of the model. In Part III of this paper, we will show how to detect big buyers and big sellers in Hong Kong stock market based on the price dynamic model (1) and develop two trading strategies (called follow-the-big-buyer and ride-the-mood) to beat the benchmark buy-and-hold strategy. II. MOVING AVERAGE RULES The most commonly-used trading rules by technical traders are based on price moving averages of different lengths. The basic philosophy behind these rules is that the price may be on a trend if a shorter moving average is crossing a longer moving average. More specifically, one such trading heuristic is as follows. Heuristic 1: A buy (sell) signal is generated if a shorter moving average of the price is crossing a longer moving average of the price from below (above). Usually, the larger the difference between the two moving averages, the stronger the buy (sell) signal. But, if the difference between the two moving averages is too large, the stock may be over-bought (over-sold), so a small sell (buy) order should be placed to safeguard the investment. For referencing please quote: IEEE Trans. on Fuzzy Systems 23(4): 1127-1141, 2015. We now translate this heuristic into an excess demand function using fuzzy systems theory. The moving average of the stock price with length n is defined as and is the log-ratio (relative change) of the price moving average of length-m to the price moving average of length-n where m<n. The common choices of (m,n) are (1,5), (1,10), (5,20), (5,50), etc. (when m=1, is the current price ). A positive implies a rising mode of the stock, whereas a negative signals the weakness of the stock price. To translate Heuristic 1 into the language of fuzzy systems theory, we first define fuzzy sets to clarify the meaning of the 3 demand (demand minus supply) and it can be positive (demand > supply) or negative (demand < supply). Define seven fuzzy sets “Buy Small (BS)”, “Buy Medium (BM)”, “Buy Big (BB)”, “Sell Small (SS)”, “Sell Medium (SM)”, “Sell Big (SB)” and “Neutral (N)” for ed with membership functions shown in Fig. 2. For example, the membership function of BM (Buy Medium) is The numbers 0.1, 0.2 and 0.4 in Fig. 2 indicate, respectively, 10%, 20% and 40% of the buying or selling power of the traders who use Heuristic 1 as their trading strategy. So “Buy Small”, “Buy Medium” and “Buy Big” means using around 10%, 20% and 40% of the buying power, respectively. The sell-side is just the mirror of the buy-side. You can of course choose other numbers to reflect the preference of different traders. linguistic descriptions for the price percentage change such as “ is positive and large”, “ small”, etc. Specifically, on the universe of  is negative and NL (all values NM NS AZ PS PM PL can possibly take, which we assume to be ), define seven fuzzy sets: “Positive Small (PS)”, “Positive Medium (PM)”, “Positive Large (PL)”, “Negative Small (NS)”, “Negative Medium (NM)”, “Negative Large (NL)”, and “Around Zero (AZ)”, whose membership functions are given in Fig. 1. For example, the membership function of fuzzy set PS (Positive Small) is x -3w -2w -w 0 w 2w 3w Fig. 1: Membership functions of fuzzy sets Positive Small (PS), Positive Medium (PM), Positive Large (PL), Negative Small (NS), Negative Medium and for PL (Positive Large), the membership function is (NM), Negative Large (NL) and Around Zero (AZ).  SB where w is a positive constant. The value of w determines how small is small, how medium is medium, and how large is large when we use these words to describe the price changes. For example, w =0.01 means that a change somewhere around 1% from to (n>m) means “small” in the trader’s mind, and, “medium” means around 2%, “large” means around and above 3%. We will see later that w is an important parameter to shape the dynamics of the price changes. Next, we define fuzzy sets to specify the meaning of the linguistic descriptions about the buy (sell) signals. Let ed be the strength of the buy or sell signal, where ed stands for excess SM SS N BS BM BB ed -0.4 -0.2 -0.1 0 0.1 0.2 0.4 Fig. 2: Membership functions of fuzzy sets Buy Small (BS), Buy Medium (BM), Buy Big (BB), Sell Small (SS), Sell Medium (SM), Sell Big (SB) and Neutral (N) for excess demand ed. For referencing please quote: IEEE Trans. on Fuzzy Systems 23(4): 1127-1141, 2015. With the fuzzy sets defined in Figs. 1 and 2, we can now convert Heuristic 1 into the following seven fuzzy IF-THEN rules which we call Rule 1 Group: Rule 11: IF is Positive Small (PS), THEN is Buy Small (BS) Rule 12: IF is Positive Medium (PM), THEN Rule 13: IF is Positive Large (PL), THEN is Sell Medium (SM) Rule 14: IF is Negative Small (NS), THEN is Sell Small (SS) Rule 15: IF is Negative Medium (NM), THEN Rule 16: IF is Negative Large (NL), THEN Rule 17: IF is Around Zero (AZ), THEN is Buy Big (BB) (t=101 to t=500) were generated by the price dynamical model (9). We see from Fig. 3 that although there is only one group of traders who were using the same trading rules (7), the resulting price dynamics were complex and chaotic. Comparing the random walk prices to with the fuzzy-rule-driven prices to , we see that the big pictures look quite similar for these two fundamentally different models: one is random and the other is deterministic. (7) is Sell Big (SB) is Buy Medium (BM) is Neutral (N) The meaning of these rules is explained as follows: Rule 11 and Rule 12 (Rule 14 and Rule 15 ) follow the uptrend (downtrend), Rule 13 (Rule 15) exits (enters) the stock when it is over-bought (over-sold), and Rule 17 takes no action if the price is oscillating horizontally. Clearly, these rules do what Heuristic 1 suggests. With Heuristic 1 being transformed into the fuzzy IF-THEN rules in Rule 1 Group, our final task is to convert these rules into the excess demand function. Using fuzzy logic principles (Zadeh, 1973) and fuzzy systems theory (Zadeh , 1971; Wang, 1997), we combine the seven fuzzy IF-THEN rules in Rule 1 Group (7) into the following standard fuzzy system: (m,n)=(1,5), w=0.01, a1=0.2 20 , , , , , are the fuzzy sets shown in Fig. 1, and , , , , , , are the centers of the fuzzy sets BS, BB, SM, SS, SB, BM and N shown in Fig. 2, respectively. Substituting (8) into (1), we obtain the price dynamic equation: that shows how the price evolves if considering only the traders who use Heuristic 1 (Rule 1 Group) as their trading strategy. We now simulate the price dynamic equation (9) with (m,n)=(1,5), w=0.01 (1%) and ; three simulation runs were performed and the resulting price series are shown in Fig. 3, where the first 100 (t=1 to t=100) were generated by the random walk model: with being independent Gaussian random variables of mean 0 and variance 1, and ; the remaining random walk Rule 1 group 15 10 5 0 50 100 150 200 250 300 350 400 450 500 200 250 300 350 400 450 500 200 250 300 350 400 450 500 20 random walk Rule 1 group 15 10 5 0 50 100 150 20 random walk Rule 1 group 15 10 5 where , 4 0 50 100 150 Fig. 3: Three simulation runs of price generated by the random walk model (10) (t=1 to t=100) and the Rule-1-Group-driven price dynamic model (9) (t=101 to t=500) with (m,n)=(1,5), w=0.01 (1%), , and . We now make a few remarks about what to look for from the simulated price curves (Figs. 3 to 12). Why is technical analysis so popular among traders? One explanation is that we humans have a very good vision system, and price curves provide a very convenient framework for our vision system. “A picture is worth a thousand words.” The trading-heuristic-driven price dynamic models proposed in this paper produce very complex and chaotic price trajectories. In fact, whenever we made a new simulation of the price dynamic model with randomly chosen initial condition, we got a totally different price series (the three price trajectories in each Figs. 3 to 12 were chosen randomly from the simulations). This is consistent with the evolving market reality (Lo, 2004). Therefore, revealing specific characters of the models is not the main purpose of illustrating these simulated price trajectories; rather, we would like to give the reader the “big picture” or some “feeling” about what price series the models would produce. This is quite different from our usual simulations for engineering systems where some fixed phenomenon occurs whenever and wherever we do the For referencing please quote: IEEE Trans. on Fuzzy Systems 23(4): 1127-1141, 2015. 5 experiment. The detailed properties of the model will be analyzed in Part II of this paper, where we will make some concrete conclusions. III. SUPPORT AND RESISTANCE RULES and Support and resistance are important reference points of past prices that the technical traders are looking at when they make buy or sell decisions. We first define support and resistance points. A peak is the price such that and , that is, a peak is a price point that is larger than its two neighbors. A resistance point , defined as: respectively. Since we are only interested in breakup ( ) and breakdown ( ) in Heuristic 2, we define fuzzy sets Positive Small (PS), Positive Medium (PM) and Positive Large (PL) as shown in Fig. 1 for is the highest peak in the time interval a trough is the price such that and a support point . Similarly, and , , defined as: is the lowest trough in the time interval . When the n in (11) and (12) are set equal to the current time t, the resistance (support) point is the highest peak (lowest trough) in the entire history of the price. The basic philosophy of the technical trading rules based on support and resistance points is that the support (resistance) point is the lowest (highest) price in recent history where the buyers (sellers) were becoming stronger than the sellers (buyers), so that if this support (resistance) price is broken, then a downtrend (uptrend) might be establishing. So we have the following heuristic: Heuristic 2: shown in Fig. 1, for . With these fuzzy sets and those defined in Fig. 2 for the buy (sell) actions, we translate Heuristics 2 into the following six fuzzy IF-THEN rules which we call Rule 2 Group: Rule 21: IF is Positive Small (PS), THEN is Buy Small (BS) Rule 22: IF is Positive Medium (PM), THEN Rule 23: IF is Positive Large (PL), THEN is Sell Medium (SM) Rule 24: IF is Negative Small (NS), THEN is Sell Small (SS) Rule 25: IF is Negative Medium (NM), THEN Rule 26: IF is Negative Large (NL), THEN is Buy Big (BB) (15) is Sell Big (SB) is Buy Medium (BM) Combining these rules into a standard fuzzy system we get A buy (sell) signal is generated if the current price breaks the resistance (support) point from below (above). The buy (sell) signal is weak if the breakup (breakdown) is small because a small breakup (breakdown) often ends up with a throwback (pullback). When the breakup (breakdown) becomes reasonably large, the trend is more or less confirmed so that a strong buy (sell) is recommended. If the breakup (breakdown) is too large, the stock may be over-bought (over-sold), so a small sell (buy) order should be placed to prepare for a possible reversal. We now convert this trading heuristic into excess demand function using fuzzy systems theory, similar to what we did in the last section. Define the log-ratios of the current price to the resistance point as , and fuzzy sets Negative Small (NS), Negative Medium (NM) and Negative Large (NL), also and the support point where , , , , , , are the fuzzy sets shown in Fig. 1, and , , , , , are the centers of the fuzzy sets BS, BB, SM, SS, SB, BM shown in Fig. 2, respectively. This is the excess demand function from all traders who use Heuristic 2 (Rule 2 Group) as their trading strategy. Substituting of (8) and of (16) into the general model (1), we obtain the price dynamic equation For referencing please quote: IEEE Trans. on Fuzzy Systems 23(4): 1127-1141, 2015. which shows how the price changes when two groups of traders are trading in the time interval (t,t+1), where one group of traders use Rule 1 Group (7) and the other use Rule 2 Group (15). Fig. 4 shows the price for three simulation runs with parameters (m,n)=(1,5), n*=100, w=0.01, and , where the first 100 (t=1 to t=100) were generated by the random walk model (10) with and , and the remaining (t=101 to t=500) were generated by the price dynamic model (17). Comparing the price trajectories in Figs. 3 and 4 we see that there were some big jumps when Rule 2 Group was added. These jumps occurred when the prices crossed the support or resistance lines. 6 points and traders were jumped in to catch up the trends, which caused the jumps in price. Fig. 5 shows three simulation runs of the price dynamic equation: with parameters n*=100, w=0.01, , and , where the first 100 prices come from the pure random walk model (10) and the remaining prices are generated by (18). From Fig. 5 we see that there are indeed many jumps in the prices and these jumps are caused by the in (18). n*=100, w=0.01, a2=0.5 30 25 (m,n)=(1,5), n*=100, w=0.01, a1=0.2, a2=1 30 20 25 15 10 random walk Rule 1+2 groups 20 random walk random walk + Rule 2 group 5 15 0 10 50 100 150 200 250 300 350 400 450 500 300 350 400 450 500 300 350 400 450 500 5 0 50 100 150 200 250 300 350 400 450 500 30 25 30 20 25 15 random walk Rule 1+2 groups 20 random walk random walk + Rule 2 group 10 15 5 0 10 50 100 150 200 250 5 0 50 100 150 200 250 300 350 400 450 500 30 25 30 20 25 15 random walk Rule 1+2 groups 20 random walk random walk + Rule 2 group 10 15 5 10 0 50 100 150 200 250 5 0 50 100 150 200 250 300 350 400 450 500 Fig. 4: Three simulation runs of price generated by the random walk model (10) (t=1 to t=100) and the Rule-1-plus-Rule-2-Group-driven price dynamic model (17) (t=101 to t=500) with (m,n)=(1,5), n*=100, w=0.01, , , and . We know that the real stock prices exhibit jumps that the random walk model cannot capture. The mathematical finance literature dealt with this problem by adding a jump random process to the random walk model (10) (e.g. Merton, 1976) or by modeling the volatility as a random variable (e.g. Bollerslev, Chou and Kroner, 1992; Bouchaud and Potters, 2003; Fouque, Papanicolaou and Sircar, 2000). The problem of these random approaches is that they cannot explain why the jumps occurred at those particular locations. So it will be interesting if we can show that jumps occur when we add the excess demand of Rule 2 Group to the random walk model (10), because in so doing we can explain why the jumps occurred at those particular locations: the reason is that the previous support or resistance lines were broken at these time Fig. 5: Three simulation runs of price generated by the random walk model (10) (t=1 to t=100) and the random walk plus Rule-2-Group model (18) (t=101 to t=500) with n*=100, w=0.01, , and . Another trading heuristic related to support and resistance points concerns the traders who missed the buying (selling) opportunity at the last low (high) price. These traders have a strong tendency to buy (sell) when the price is getting around the support (resistance) point once again; this gives us the following heuristic: Heuristic 3: For those traders who felt regret to miss the buying (sell) opportunity at the last low (high) price, the chance comes again when the price is getting around the support (resistance) point one more time, so buy (sell) medium (not big because the price may break across the support (resistance) line this time, and not small because you don’t want to miss this opportunity too much). For referencing please quote: IEEE Trans. on Fuzzy Systems 23(4): 1127-1141, 2015. This heuristic is transformed into the following Rule 3 Group: Rule 31: IF is Around Zero (AZ), THEN is Sell Medium (SM) Rule 32: IF is Around Zero (AZ), THEN is Buy Medium (BM) (19) and the excess demand function from the Rule-3-Group traders is the following fuzzy system: where ( , are defined in (13), (14)), and AZ, SM and BM are shown in Figs. 1 and 2 (0.2 and -0.2 in (20) are the centers of BM and SM, respectively). Adding all three excess demand functions (8), (16) and (20) to the general model (1) and simulating the resulting price dynamic equation, we got Fig. 6 where the parameters were chosen as: (m,n)=(1,5) in , the n’s in and equal n*=100, w=0.01, and , and here again the first 100 were generated by the random walk model (10) with and , and the remaining (t=101-500) were generated by the price dynamic equation (1) with M=3. 7 IV. TREND LINE RULES Trend lines are lines that connect peaks or troughs and extend into the future. There are two types of trend lines: uptrend line and downtrend line. An uptrend (downtrend) line is established if the line connecting the troughs (peaks) is pointing upwards (downwards). More specifically, let and ( and ) be the two lowest (highest) troughs (peaks) in the time interval [t-n, t-1] with t1<t2, i.e., where min2 (max2) means “take the two smallest (largest)”, and t1, t2 (t1<t2) are the time points at which these two lowest (highest) prices are located. If , then the line connecting and ( and ) is pointing upwards (downwards), so an uptrend line is constructed as (m,n)=(1,5), n*=100, w=0.01, a1=0.2, a2=a3=1 30 25 random walk Rule 1+2+3 groups 20 15 10 5 0 50 100 150 200 250 300 350 400 450 500 where 30 , and a downtrend line is 25 random walk Rule 1+2+3 groups 20 15 10 5 0 50 100 150 200 250 300 350 400 450 500 30 25 random walk Rule 1+2+3 groups 20 15 10 5 0 50 100 150 200 250 300 350 400 450 500 Fig. 6: Three simulation runs of price generated by the random walk model (10) (t=1 to t=100) and the price dynamic model (1) (t=101 to t=500) with the three excess demand functions , and from Rule 1, Rule 2 and Rule 3 Groups. where , time t is the horizontal-axis and price is the vertical-axis. The basic logic behind the trading heuristics related to trend lines is that it is usually difficult to break through a trend line because the existence of a trend line means that a trend has already been in place, so a breakdown (breakup) across the uptrend (downtrend) line will most likely end up with a pullback (throwback). This gives the following heuristic: Heuristic 4: If the current price uptrend (downtrend) line is getting closer to an from above For referencing please quote: IEEE Trans. on Fuzzy Systems 23(4): 1127-1141, 2015. (below), a buy (sell) order should be placed to bet on the continuation of the uptrend (downtrend). 8 (m,n)=(1,5), n*=100, w=0.01, a1=0.2, a4=1 30 25 random walk Rule 1+4 groups 20 Define 15 10 5 0 50 100 150 200 250 300 350 400 450 500 200 250 300 350 400 450 500 200 250 300 350 400 450 500 30 25 random walk Rule 1+4 groups 20 15 10 5 0 50 100 150 30 25 random walk Rule 1+4 groups 20 and Heuristic 4 becomes the following Rule 4 Group: 15 10 Rule 41: IF is Positive Small (PS), THEN is Buy Medium (BM) Rule 42: IF is Negative Small (NS), THEN 5 0 50 100 150 is Sell Medium (SM) (27) The excess demand function from the Rule-4-Group traders is the following fuzzy system: Fig. 7: Three simulation runs of price generated by the random walk model (10) (t=1 to t=100) and the price dynamic model (1) (t=101 to t=500) with the two excess demand functions and from Rule 1 and Rule 4 Groups. amount, then a trend reversal may have been happening so that a small to large sell (buy) order is recommended. where , and are the membership functions of the fuzzy sets PS and NS shown in Fig. 1, and 0.2 and -0.2 are the centers of the fuzzy sets BM and SM shown in Fig. 2. Fig. 7 shows three simulation runs of the Rule-1+4-Groups case with parameters (m,n)=(1,5), n*=100, w=0.01, , and , where the first 100 prices came from the pure random walk model (10) and the remaining prices were generated by (1) with all other ’s except and equal to zero. Comparing Fig. 7 with Fig. 3, we see that more trending happened when the Rule-4-Group traders were added. Originally the Rule-4-Group traders just anticipate that a trend may be coming and act according to their guess, but their actions cause the trend to really happen; this is self-fulfilling, a typical phenomenon in real markets. Another trading heuristic related to trend lines is about trend reversal. Experience has shown that if an established trend line was broken by a relatively large amount, then the trend might have been reversed. This gives the following trading heuristic: Heuristic 5: If the current price (downtrend) line is under (above) the uptrend for a medium to large This heuristic is transformed into the following Rule 5 Group: Rule 51: IF is Negative Medium (NM), THEN Rule 52: IF is Negative Large (NL), THEN Rule 53: IF is Positive Medium (PM), THEN Rule 54: IF is Positive Large (PL), THEN is Sell Small (SS) is Sell Big (SB) (29) is Buy Small (BS) is Buy Big (BB) and the excess demand function from the Rule-5-Group traders is the following fuzzy system: where or ( and are defined in (25) and (26)), PM, PL, NM and NL are fuzzy sets shown in Fig. 1, and 0.1, 0.4, -0.1 and -0.4 are the centers of fuzzy sets BS, BB, SS and SB shown in Fig. 2, respectively. Fig. 8 shows three simulation runs of the Rule-1+5-Groups case with parameters (m,n)=(1,5), n*=100, w=0.01, , and , where the first 100 For referencing please quote: IEEE Trans. on Fuzzy Systems 23(4): 1127-1141, 2015. prices came from the pure random walk model (10) and the remaining prices were generated by (1) with all other ’s except and equal to zero. Again we see self-fulfilling phenomenon in Fig. 8: the big jumps in prices were generated by the Rule-5-group traders who took actions to anticipate the end of the old trends and these actions ended the old trends. (m,n)=(1,5), n*=100, w=0.01, a1=0.2, a5=1 30 9 Rule 61: IF is Positive Small (PS), THEN is Sell Small (SS) Rule 62: IF is Positive Medium (PM), THEN Rule 63: IF is Positive Large (PL), THEN is Sell Big (SB) Rule 64: IF is Around Zero (AZ), THEN is Neutral (N) is Sell Medium (SM) (31) and Heuristic 7 into the following Rule 7 Group: Rule 71: IF is Negative Small (NS), THEN is Buy Small (BS) Rule 72: IF is Negative Medium (NM), THEN Rule 73: IF is Negative Large (NL), HEN is Buy Big (BB) Rule 74: IF is Around Zero (AZ), THEN is Neutral (N) 25 random walk Rule 1+5 groups 20 15 is Buy Medium (BM) (32) 10 5 0 50 100 150 200 250 300 350 400 450 500 The excess demands 7 Group are 30 25 and from Rule 6 Group and Rule random walk Rule 1+5 groups 20 15 10 5 0 50 100 150 200 250 300 350 400 450 500 01 30 25 PS 02 PS PM 0 PM PL PL AZ random walk Rule 1+5 groups 20 15 where 10 and 5 0 50 100 150 200 250 300 350 400 450 500 Fig. 8: Three simulation runs for the case of Rule-1-Group plus Rule-5-Group. V. BIG BUYER, BIG SELLER AND MANIPULATOR RULES Big buyers and big sellers are institutional traders who manage large sums of money and usually want to buy or sell a large amount of stocks. Since the amount of stocks offered or asked around the trading price is usually very small, the large buy or sell order has to be cut into small pieces and implemented incrementally over a long period of time (Bouchaud, Farmer and Lillo, 2008; Aldridge, 2013). A reasonable strategy for a big buyer (seller) is to buy (sell) if the price is decreasing (increasing); this gives us the following heuristics: Heuristic 6 for big sellers, and Heuristic 7 for big buyers: Heuristic 6: For a big seller, sell if the price of the stock is increasing: the stronger the increase, the larger the sell order. Keep neutral if the price is decreasing or moving horizontally. Heuristic 7: For a big buyer, buy if the price of the stock is decreasing: the larger the decrease, the larger the buy order. Keep neutral if the price is increasing or moving horizontally. With defined in (3) and the fuzzy sets in Figs. 1 and 2, we translate Heuristic 6 into the following Rule 6 Group: where , respectively. Figs. 9 and 10 show three simulation runs of the Rule-1+6-Groups and Rule-1+7-Groups cases, respectively, with parameters (m,n)=(1,5), w=0.01, , and , where the first 100 prices came from the pure random walk model (10) and the remaining prices were generated by (1). From Fig. 9 (Fig. 10) we see that the prices are in a general declining (rising) mode when the big sellers (buyers) are presented, although the big sellers (buyers) sell (buy) only when the price is increasing (decreasing). The study of trading behavior cannot be complete without considering a very important market force: the manipulators. Manipulators are big capitalized traders who use pump-and-dump (Bradshaw, Richardson and Sloan, 2003), spoofing3, layering3 (Kirilenko and Lo, 2013) or other “Spoofing” involves intentionally manipulating prices by placing an order and then canceling it shortly thereafter, at which point the spoofer consummates a trade in the opposite direction of the canceled order. “Layering” involves placing a successive sequence of limit orders to give the appearance of a change in demand or supply; after a trade is consummated at the manipulated price, the layered limit orders are canceled. 3 For referencing please quote: IEEE Trans. on Fuzzy Systems 23(4): 1127-1141, 2015. (m,n)=(1,5), w=0.01, a1=0.2, a6=0.02 30 25 random walk Rule 1+6 groups 20 15 10 5 0 50 100 150 200 250 300 350 400 450 500 10 the order book) to attract the attention of trend-followers; and in Phase 3 the manipulator trades like a big seller using Heuristic 6, i.e., selling the stocks collected in Phase 1 around the new higher prices. Although manipulation is illegal in all stock markets (Kyle and Viswanathan, 2008), it is common practice in almost all markets around the world for hundreds of years (Leinweber and Madhavan, 2001). 30 25 15 random walk Rule 1+6 groups 20 Phase 3: manipulator = big seller 15 14 10 5 0 50 100 150 200 250 300 350 400 450 500 13 30 25 random walk Rule 1+6 groups 20 12 Phase 2: manipulator = clear the ask-side of order book 15 10 11 5 0 50 100 150 200 250 300 350 400 450 500 Phase 1: manipulator = big buyer 10 Fig. 9: Three simulation runs for the case of Rule-1-Group plus Rule-6-Group (big sellers). 9 0 50 100 150 200 250 300 350 400 450 500 (m,n)=(1,5), w=0.01, a1=0.2, a7=0.02 30 Fig. 11: A typical operation cycle of manipulators: the pump-and-dump process. 25 random walk Rule 1+7 groups 20 15 10 5 0 50 100 150 200 250 300 350 400 450 500 30 25 Since the manipulator trades like a big buyer (seller) in Phase 1 (Phase 3), the excess demand function equals ( ) in these phases. For Phase 2 (the pushing-up phase), the strategy is the following treading heuristic: random walk Rule 1+7 groups 20 Heuristic 8: Buy the stock with big money within very short time to clear the ask (sell) side of the order book quickly. 15 10 5 0 50 100 150 200 250 300 350 400 450 500 which, when expressed in terms of fuzzy IF-THEN rules, is the following Rule 8 Group: 30 25 random walk Rule 1+7 groups 20 Rule 8: Whatever the 15 ’s are, the is Buy Big (BB) (35) 10 5 0 50 100 150 200 250 300 350 400 450 500 Putting these three phases together, we obtain the following excess demand function for the manipulator: Fig. 10: Three simulation runs for the case of Rule-1-Group plus Rule-7-Group (big buyers). strategies (Leinweber and Madhavan, 2001; Fan, 2010; Jiang, 2013) to move the price up or down very quickly to create a mood of optimistic or fear as a trap for other traders. Fig. 11 illustrates a typical working cycle of the pump-and-dump process: in Phase 1 the manipulator trades like a big buyer using Heuristic 7, i.e., collecting a large sum of stocks at relatively low prices; in Phase 2 the manipulator uses strong capital to push the stock price up very quickly (by clearing the ask-side of 01 NS PM NL NL 02 PS 0 NM NM 01 PS 02 NS AZ 0 PM PL PL AZ (36) For referencing please quote: IEEE Trans. on Fuzzy Systems 23(4): 1127-1141, 2015. where in Phase 1 and is in fact a simulation run of (1) with 2 is from t=200 to t=220. in Phase 3. Fig. 11 and , where Phase 11 which, when combined into a fuzzy system, give the following excess demand function: VI. BAND AND STOP RULES 01 Bands are envelopes around a moving average with variable size. The basic idea of using bands is that since most prices are contained within the band, a breakout across the boundaries of the band is an indication of the start of a new trend. The most widely used band is the Bollinger Band (Bollinger, 2002) that adds and subtracts the moving estimate of two standard deviations of returns to a moving average. Specifically, let be the return and assume the returns are zero-mean; the moving estimate of the standard deviation of the returns is The upper and lower boundaries of the Bollinger Band are and , respectively, where is the price moving average defined in (2). The trading heuristic based on the Bollinger Band is the following: where or . Fig. 12 shows three simulation runs of the random walk plus Rule-9-Group model: with n=5, w=0.01, , and , where the first 100 prices came from the random walk model (10) and the remaining prices were generated by (43). We see again the self-fulfilling phenomenon: more trending occurred in the model (43) part than in the pure random walk part in Fig. 12, due to the actions for the anticipation of the new trends after the price broke out the band and these actions themselves caused the trends. n=5, w=0.01, a9=0.2 30 25 random walk random walk + Rule 9 group 20 15 Heuristic 9: When the price is moving out of the Bollinger 10 5 Band , it is a sign of the start of a new trend, so a buy (if the price is above the Band) or sell (if the price is below the Band) order should be in place. 0 100 150 200 250 300 350 400 450 500 300 350 400 450 500 300 350 400 450 500 30 25 random walk random walk + Rule 9 group 20 Define 50 15 10 5 0 50 100 150 200 250 ln 30 25 random walk random walk + Rule 9 group 20 15 10 5 ln 0 50 100 150 200 250 Fig. 12: Three simulation runs of random walk plus Rule-9-Group model (43). then Heuristic 9 becomes the following Rule 9 Group: Rule 91: IF is Positive Small (PS), THEN Rule 92: IF is Positive Medium (PM), THEN Rule 93: IF is Negative Small (NS), THEN Rule 94: IF is Negative Medium (NM), THEN is Buy Small (BS) is Buy Big (BB) is Sell Small (SS) is Sell Big (SB) (41) If you asked an investment expert what is the most important element in an investment system, the answer would very likely be: stops. Indeed, making profits is not harmful, whether it is big or small, but you must protect your portfolio from large losses. There are usually two types of stops people use to protect their capital: protective stops that set hard limits to the For referencing please quote: IEEE Trans. on Fuzzy Systems 23(4): 1127-1141, 2015. maximum losses allowed and clear the position when the hard limits are reached, and trailing stops that protect profits from deteriorating back into a loss. There are many types of protective and trailing stops, such as Hard Money Stops, Breakeven Stops, Technical Point Stops, Volatility Stops, Trend Line Stops, Adaptive Stops, Time Stops, Signal Stops, etc. (Kirkpatrick and Dahlquist, 2011). The following heuristic summarizes a typical protective stop and a typical trailing stop: Heuristic 10: Protective Stop: If a position has a loss approaching 20% and more, it means something was seriously wrong in our previous analysis when we purchased the stock, so the position should be quit as soon as possible. Trailing Stop: If a position has accumulated good profits and the price has dropped around 10% or more from the recent high, then the position should be quit gradually to cash out the profits. To translate Heuristic 10 into fuzzy IF-THEN rules, let be the amount of a stock in the portfolio purchased at price ( ) and max be the maximum of the last n prices of the stock. Then Heuristic 10 becomes the following Rule 10 Group: Rule 101: IF is Not Around Zero ( (NL), THEN Rule 102: IF and Rule 103: IF and is Negative Large is Sell Big (SB) is Not Around Zero ( and , THEN where meaning that the amount of this stock in the portfolio is non-zero. VII. VOLUME AND STRENGTH RULES The rules in the last five sections used only the past price information of the same stock. In this section we consider the trading rules that use not only its own past prices but also other information such as volume and the prices of other stocks in the market. Since the key of technical trading is “follow the trend”, the indicators considered in this section are used to confirm a trend or to give early warning for a possible trend reversal. We start with volume. A useful volume indicator is the on-balance volume defined as follows: is Sell Big (SB) is Neutral (N) (44) where P is the union of PS, PM and PL, is the complement of , and the parameter w in the NL’s (see Fig. 1) of Rule 101 and Rule 102 are set to 10% and 5%, respectively. Combining the three rules of (44), we obtain the following excess demand function for the stocks purchased at price If the denominator of (45) equals zero, then . The final excess demand function from Rule-10-Group is the weighted average of the ’s with weights : is Positive (P) is Negative Large (NL), THEN is Around Zero ( 12 : where is the traded volume of the stock from t-1 to t and is the sign function that equals 1 if , equals -1 if and equals 0 if . The on-balance volume is a measure of the accumulated money inflow into the stock. Therefore it is an early warning of trend reversal if the trend of price and the trend of are in opposite directions; this gives the following trading heuristic: Heuristic 11: If the price is in an uptrend (downtrend) but the on-balance volume is in a downtrend (uptrend), then as soon as the price shows a small sign of decreasing (increasing), a sell (buy) is recommended to bet on the reversal of the price trend. Similar to the variables defined in constructing the price trend lines in (21)-(24), we define min2 For referencing please quote: IEEE Trans. on Fuzzy Systems 23(4): 1127-1141, 2015. to be the two lowest (highest) troughs (peaks) of the in the time interval [t-n, t-1], where t1, t2 (t1<t2) are the time points at which these two lowest (highest) are located. Let be the slopes of the lines connecting to and to , respectively, we can now transform Heuristic 11 into the following Rule 11 Group: Rule 111: IF is NS and Rule 112: IF is PS and is Negative (N), THEN is Positive (P), THEN is SM is BM Lastly, we consider the trading heuristics concerning how a stock performs comparing to the whole market. Let be some index that measures the overall performance of the market, e.g., it could be the S&P500 for the US stock market or the Shanghai&Shenzhen 300 for China stock market. The relative strength of a stock with price is defined as If is rising (declining), it means the stock outperforms (underperforms) the market average. Since the market has the tendency of stronger getting stronger and weaker getting weaker (Jegadeesh and Titman, 1993), a breakup (breakdown) of the downtrend (uptrend) line, if accompanied by a rising (declining) , is a strong sign of trend reversal. This gives us the following trading heuristic: Heuristic 12: If the price is in an uptrend (downtrend) but its relative strength is in a downtrend (uptrend), then as soon as the price shows a small sign of decreasing (increasing), a sell (buy) is recommended to leave (enter) this weak (strong) stock. (52) Define the log-ratio of where the fuzzy set Negative (Positive) is the union of the fuzzy sets NS, NM and NL (PS, PM and PL) with membership function ( ). Recalling the definition of see that “ and ln is PS” means “the price has Heuristic 12 gives the following Rule 12 Group: just broken the downtrend line from below”. Furthermore, Rule 121: IF is NS and “ Rule 122: IF is PS and is N” (“ to its n-leg moving average as in (25) and (26), we is NS” means “the price has just broken the uptrend line from above” and “ 13 is P”) confirms the breakdown (breakup) so that Sell Medium (Buy Medium) is executed. The excess demand function from the Rule-11-Group traders is the following fuzzy system: is Negative (N), THEN is Positive (P), THEN is SM is BM (56) and its excess demand function is = 02 PS P PS P 02 NS NS N N If the denominator of (53) equals zero, then . Since volume data are not available for our price models (it is our current research topic to build dynamical models for volumes based on technical trading rules), we will not perform simulations for Rule 11 Group. For real stocks where volume data are available, the Rule-11-Group rules can be incorporated into the price dynamic model (1) in the same manner as the rules in other groups. where if the denominator of (57) equals zero. The price dynamics driven by can be simulated if we consider a multi-stock simulation model; however, we will leave it to another paper concentrating on this very important topic: interactions among multiple stocks. VIII. CONCLUDING REMARKS Stock prices are generated by the actions of stock traders, and according to a survey of 692 fund managers in five countries For referencing please quote: IEEE Trans. on Fuzzy Systems 23(4): 1127-1141, 2015. (Menkhoff, 2010), the vast majority of the fund managers rely on technical analysis4. The main contribution of this paper is to build a bridge between the fuzzy, linguistic world of technical analysis and the rigorous, mathematical world of nonlinear dynamic equations, as illustrated in Fig. 13. In Part I of this paper, we developed the details of transforming twelve common trading heuristics into nonlinear dynamical equations and simulated these models to illustrate how simple technical trading rules can produce complex price patterns. There have been a huge number of technical trading rules accumulated during the long history of technical analysis (Lo and Hasanhodzic, 2010) and more rules are being proposed constantly to adapt to the evolving market conditions5; by using the methods of this paper we can transform these linguistic descriptions of trading wisdoms into dynamical equations and observe exactly what price trajectories and patterns these heuristic rules can produce. Furthermore, these dynamical equations allowed us to study the price dynamics generated by the technical trading rules in a mathematically rigorous fashion (as we will do in Part II of this paper) and push technical analysis forward in the direction from an art to a science. Practically, these models provide us a framework to detect the hidden operations in the market so that trading strategies can be developed to beat the benchmark Buy-and-Hold strategy (as we will do in Part III of this paper). Technical analysis (fuzzy, linguistic world) Trend following; Contrarian; Fuzzy systems Dynamical systems theory (precise, mathematical world) Equilibrium; Stability; Stop-loss; Lyapunov exponent; Band rules; Strange attractors; Oscillators; Pattern rules; Fractal dimensions; Emergence; The price dynamical models proposed in this paper are totally deterministic, so a natural question is how these models compare with the mainstream stochastic models that provide measures of unpredictable uncertainties 6 ? To answer this question, let’s see how the mainstream stochastic models handle the unpredictable uncertainties: these models usually have a simple deterministic part (linear or simple ad-hoc nonlinear functions of state variables), and leave the real important part of the (unknown) dynamics to the noise term (representing unpredictable uncertainties); then, they assume that the noise term is zero-mean and i.i.d. (or make other comparable assumptions in order for the mathematics to march forward beautifully). We know a key characteristic of financial systems is evolving (time-varying, non-stationary7; Lo, 2004). How can one faithfully assume a key part of an evolving, non-stationary dynamics (the unpredictable uncertainties) to be zero-mean (a time-invariant constant)? Furthermore, the i.i.d. assumption implies that the traders are drunkards (Malkiel, 2012) --- the move in one step has no relation to the moves of the previous steps. Real traders are betting in real money, they are serious, they are watching the evolving markets closely and making decisions accordingly, they are socially connected and influence each other, and they are not some random noise from the background as in an electronic circuit model. So, we will ultimately have to roll up our sleeves to dig deep into the origin of the price formation machine 8 to build a deterministic, cause-effect model for the key dynamics; the models proposed in this paper are a trial in this direction. The main difference between Natural Sciences and Social Sciences is that we know the basic laws governing the motions of the objects in Natural Sciences such as the Newton’s Laws, whereas the basic objects in Social Sciences are human beings and we do not have the “Newton’s Laws for human subjects.” That is, we lack a deep underpinning for understanding the mechanisms at the origin of the dynamical behavior of financial markets (Mirowski, 1989; Kirman, 1989; Malevergne and Sornette, 2006). Our current stage of understanding social systems is quite similar to “the blind monks touching the elephant”. In our pursuit for the basic laws of stock markets, we “The human brain is wonderful at spotting patterns. It's an ability that is one of the foundation stones of science. When we notice a pattern, we try to pin it down mathematically, and then use the maths to help us understand the world around us. And if we can't spot a pattern, we don't put its absence down to ignorance. Instead we fall back on our favourite alternative. We call it randomness.” --- Ian Stewart (Stewart, 2004). 7 Traders come and go (Foucault, Pagano and Roell, 2013), and different traders use different trading strategies, which results in different price patterns at different time points, meaning that the returns are non-stationary. 8 By which we mean both the mechanical setup of the limit order book dynamics (Gould, Porter, Williams, McDonald, Fenn and Howison, 2013; Bouchaud, Farmer and Lillo, 2008; Cont, Kukannov and Stoikov, 2014) and the investors’ mindset (Keynes, 1935; Graham, 1973; Lynch, 1989; Soros, 2003; etc.) including their “obstinate passion” for technical analysis (Menkhoff and Taylor, 2007). 6 Fig. 13: The “main story” this paper is trying to tell: A bridge is being built across the gulf between the fuzzy, linguistic world of technical analysis which is rich in trading wisdom on one side and the precise, mathematical world of dynamical systems theory which is rich in rigorous tools on the other side. 4 More specifically, for the forecasting horizon of weeks, the relative importance is 29.4 for Technical Analysis, 28.4 for Order Flow, and 1.4 for Fundamental Analysis for US fund managers; for German fund managers, these numbers are 60 for Technical Analysis, 22.6 for Order Flow, and 6.7 for Fundamental Analysis; see Fig. 2 in Menkhoff 2010 for more data. 5 According to Schmidt 2011, a search on Amazon.com using the key words technical analysis for new books that were printed between January 2001 and September 2010 yielded 468 entries --- roughly one new book every week. 14 For referencing please quote: IEEE Trans. on Fuzzy Systems 23(4): 1127-1141, 2015. should listen carefully to what the real traders say about their crafts (e.g. Livermore, 1940; Lynch, 1989; Soros, 2003; Lindsey and Schachter, 2007; Lo and Hasanhodzic, 2009), because human traders are the “atoms of stock markets.” As one of the most successful speculators in modern finance, George Soros has a Theory of Reflexivity which, in his own words (page 2 of Soros, 2003), is described as follows: The concept of reflexivity is very simple. In situations that have thinking participants, there is a two-way interaction between the participant’s thinking and the situation in which they participate. On the one hand, participants seek to understand reality; on the other hand, they seek to bring about a desired outcome. The two functions work in opposite directions: in the cognitive function reality is the given; in the participating function, the participants’ understanding is the constant. The two functions can interfere with each other by rendering what is supposed to be given, contingent. I call the interference between the two functions “reflexivity.” To represent our price dynamical model (1) in the framework of Soros’s Reflexivity Theory, we plot the block diagram of model (1) in Fig. 14, where we view the excess demand of each trader group as the cognitive function in Soros’s reflexivity theory and the time-varying relative strength as the participating function. According to the concept of reflexivity cited above, the input to the cognitive function is the reality --- the price history and other information, and the output is which can be viewed as the dollar amount to trade the stock: a positive means to buy the stock with dollars, and a negative means to sell the stock to cash out | | dollars. The impact of the dollar amount on the price dynamics is through the participating function whose exact value cannot be specified by the Rule-i-Group traders alone, because the impact depends on the actions of other traders that are beyond the control of the Rule-i-Group traders. In this framework, reflexivity means the interference between and the internal mechanism of --- the fuzzy trading rules and their parameters m, n and w; this gives us some hints for possible directions of future research. Indeed, in Part III of this paper we will develop two trading strategies --- Follow-the-Big-Buyer and Ride-the-Mood --based on the estimation of the ’s and test the strategies over the top 20 blue-chip stocks in the Hong Kong Stock Exchange to show the superior performance of these trading strategies over the benchmark Buy-and-Hold strategy (Part III can be found at arXiv:1401.1892). But before we do this, we would better first analyze the price dynamical model (1) in detail to get a basic understanding for the key properties of the 15 price dynamics, which is what we are going to do in Part II of this paper (Part II can be found at arXiv:1401.1891), next. Participating function a M (t ) ln( pt )  Delay a1(t) Reflexivity Other information ed1 Rule-1-Group traders Other information ed M Rule-M-Group traders Cognitive function Fig. 14: The block diagram representation of the price dynamical model (1) with interpretation of the function blocks in terms of George Soros’s Theory of Reflexivity. ACKNOWLEDGMENT The author would like thank the anonymous reviewers for their very insightful and inspiring comments that helped to improve the paper. REFERENCES [1] Aldridge, I., High-Frequency Trading: A Practical Guide to Algorithmic Strategies and Trading Systems (2nd Edition), John Wiley & Sons, Inc., New Jersey, 2013. [2] Andersen, T.G., T. Bollerslev and F.X. Diebold, “Parametric and Nonparametric Volatility Measurement,” in Y. Ait-Sahalia and L.P. Hansen (ed.), Handbook of Financial Econometrics: Tools and Techniques, Vol. 1, pp. 67-138, Elsevier: North-Holland, 2010. [3] Atsalakis, G. and K. Valavanis, “Surveying Stock Market Forecasting Techniques - Part II: Soft Computing Methods,” Expert Systems with Applications 36: 5932-5941, 2008. [ ] Bachelier, L., “Theorie de la speculation.” Thesis. Annales Scientifiques de l’Ecole Normale Superieure, 1990. III-17, 21-86. Translated by Cootner (ed.) as “Random character of Stock Market Prices.” (Massachusetts Institute of Technology, 1964: 17-78). [5] Black, F. and M. Scholes, “The Pricing of Options and Corporate Liabilities,” Journal of Political Economy 81: 637-659, 1973. For referencing please quote: IEEE Trans. on Fuzzy Systems 23(4): 1127-1141, 2015. [6] Bollerslev, T., R.Y. Chou and K.F. Kroner, “ARCH Modeling in Finance: A Review of the Theory and Empirical Evidence,” Journal of Econometrics 52: 5-59, 1992. [7] Bollinger, J., Bollinger on Bollinger Bands, McGraw-Hill, New York, 2002. [8] Bouchaud, J.P., D. Farmer and F. Lillo, “How Markets Slowly Digest Changes in Supply and Demand,” in T. Hens, K. Schenk-Hoppe, eds., Handbook of Financial Market: Dynamics and Evolution, Elsevier: Academic Press: 57-160, 2008. [9] Bouchaud, J.P. and M. Potters, Theory of Financial Risks: From Statistical Physics to Risk Management (2nd Edition), Cambridge University Press, Cambridge, 2003. [10] Bradshaw, M.T., S.A. Richardson and R.G. Sloan, “Pump and Dump: An Empirical Analysis of the Relation Between Corporate Financing Activities and Sell-side Analyst Research,” SSNR 410521, 2003. [11] Brock, W.A. J. Lakonishok and B. LeBaron, “Simple Technical Trading Rules and the Stochastic Properties of Stock Returns,” Journal of Finance 47: 1731-1764, 1992. [12] Cont, R., A. Kukannov and S. Stoikov, “The Price Impact of Order Book Events,” J. Financial Econometrics 12: 47-88, 2014. [13] Elton, E.J., M.J. Gruber, S.J. Brown and W.N. Goetzmann, Modern Portfolio Theory and Investment Analysis (7th Edition), John Wiley & Sons, Inc., 2007. [14] Engle, R.F., “Autoregressive Conditional Heteroskedasticity with Estimates of the Variance of U.K. Inflation,” Econometrica 50: 987-1008, 1982. [15] Fama, E., “Efficient Capital Markets: A Review of Theory and Empirical Work,” Journal of Finance 25: 383-417, 1970. [16] Fan, J.J., Follow the Banker (in Chinese), China Machine Press, Beijing, 2010. [17] Foucault, T., M. Pagano and A. Roell, Market Liquidity: Theory, Evidence, and Policy, Oxford University Press, 2013. [18] Fouque, J.P., G. Papanicolaou and K.R. Sircar, Derivatives in Financial Markets with Stochastic Volatility, Cambridge University Press, 2000. [19] Gencay, R., “The Predictability of Security Returns with Simple Technical Trading Rules,” Journal of Empirical Finances 5: 347-359, 1998. [20] Gigerenzer, G., “On Narrow Norms and Vague Heuristics: A Reply to Kahneman and Tversky (1996),” Psychological Review 103: 592-596, 1996. [21] Gigerenzer, G. and W. Gaissmaier, “Heuristic Decision Making,” Annual Review of Psychology 62: 451-482, 2011. [22] Gould, M.D., M.A. Porter, S. Williams, M. McDonald, D.J. Fenn and S.D. Howison, “Limit Order Books,” Quantitative Finance 13: 1709-1742, 2013. [23] Graham, B., The Intelligent Investor (Revised Edition), Harper Business, 1973. [24] Graham, B. and D. Dodd, Security Analysis (6th Edition), (McGraw-Hill, New York, 2009), 1940. [25] Hommes, C.H., “Heterogeneous Agent Models in Economics and Finance,” in L. Tesfatsion and K.L. Judd, eds., Handbook of Computational Economics Vol. 2: Agent-Based Computational Economics, Elsevier B.V.: 1109-1186, 2006. [26] Hull, J.C., Options, Futures, and Other Derivatives (7th Edition), Pearson Education, Inc., 2009. [27] Jegadeesh, N and S. Titman, “Returns to Buying Winners and Selling Losers: Implications for Stock Market Efficiency,” Journal of Finance 48: 65-91, 1993. [28] Jiang, X.S., Reveal the Secrets of Main Force Manipulation (in Chinese), Tsinghua University Press, 2013. [29] Keynes, J.M., The General Theory of Employment, Interest and Money, (BN Publishing, 2009), 1935. [30] Kirman, A., “The Intrinsic Limits of Modern Economic Theory: The Emperor Has No Clothes,” Economic Journal 99:126-139, 1989. 16 [31] Kirilenko, A.A. and A.W. Lo, “Moore’s Law versus Murphy’s Law: Algorithmic Trading and Its Discontents,” Journal of Economic Perspectives, 27: 51-72, 2013. [32] Kirkpatrick, C.D. and J. Dahlquist, Technical Analysis: The Complete Resource for Financial market Technicians (Second Edition), Pearson Education, New Jersey, 2011. [33] Kirkpatrick, C.D. and J. Dahlquist, Study Guide for the Second Edition of Technical Analysis: The Complete Resource for Financial market Technicians, Pearson Education, New Jersey, 2013. [34] Kyle, A.S., “Continuous Auction and Insider Trading,” Econometrica53: 1315-1335, 1985. [35] Kyle, A.S. and S. Viswanathan, “Price Manipulation in Financial Markets: How to Define Illegal Price Manipulation,” American Economic Review 98:2, 274-279, 2008. [36] LeBaron, B., S.H. Chen and S. Sunder, “The Future of Agent-Based Research in Economics: A Panel Discussion,” Eastern Economic Journal 34: 550-565, 2008. [37] Leinweber, D.J. and A.N. Madhavan, “Three Hundred Years of Stock Market Manipulations,” The Journal of Investing 10: 7-16, 2001. [38] Lindsey, R.R. and B. Schachter, How I Became a Quant: Insights From 25 of Wall Street’s Elite, John Wiley & Sons, New Jersey, 2007. [39] Livermore, J., How to Trade in Stocks, (McGraw-Hill, 2001), 1940. [40] Lo, A.W., “The Adaptive Market Hypothesis: Market Efficiency from an Evolutionary Perspective,” The Journal of Portfolio Management 30: 15-29, 2004. [41] Lo, A.W. and J. Hasanhodzic, The Heretics of Finance: Conversations with Leading Practitioners of Technical Analysis, Bloomberg Press, New York, 2009. [42] Lo, A.W. and J. Hasanhodzic, The Evolution of Technical Analysis: Financial Prediction from Babylonian Tablets to Bloomberg Terminals, John Wiley & Sons, Inc., New Jersey, 2010. [43] Lo, A.W., H. Mamaysky and J. Wang, “Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation,” Journal of Finance 55: 1705-1765, 2000. [44] Lux, T., “The Socio-Economic Dynamics of Speculative Markets: Interacting Agents, chaos, and the Fat Tails of Return Distribution,” Journal of Economic Behavior & Organizations 33: 143-165, 1998. [45] Lux, T. and M. Marchesi, “Scaling and Criticality in A Stochastic Multi-Agent Model of A Financial Market,” Nature 397: 498-500, 1999. [46] Lynch, P., One Up on Wall Street: How to Use What You Already Know to Make Money in the Market, Simon & Schuster Paperbacks, New York, 1989. [47] Malevergne, Y. and D. Sornette, Extreme Financial Risks: From Dependence to Risk Management, Springer-Verlag Berlin Heidelberg, 2006. [48] Malkiel, B.G., A Random Walk Down Wall Street (10 th Edition), W.W. Norton & Co., New York, 2012. [49] Menkhoff, L., “The Use of Technical Analysis by Fund Managers: International Evidence,” Journal of Banking & Finance 34: 2573-2586, 2010. [50] Menkhoff, L. and M.P. Taylor, “The Obstinate Passion of Foreign Exchange Professionals: Technical Analysis,” Journal of Economic Literature XLV: 936-972, 2007. [51] Merton, R.C., “Option Pricing When Underlying Stock Returns Are Discontinuous,” Journal of Financial Economics 3: 125-144, 1976. [52] Mirowski, P., More Heat Than Light: Economics as Social Physics, Physics as Nature’s Economics, Cambridge University Press, 1989. [53] Schmidt, A.B., Financial Markets and Trading: An Introduction to Market Microstructure and Trading Strategies, John Wiley & Sons, New Jersey, 2011. [54] Soros, G., The Alchemy of Finance, John Wiley & Sons, New Jersey, 2003. [55] Stewart, I., “In the Lap of the Gods,” NewScientist, 25 Sept. 2004. For referencing please quote: IEEE Trans. on Fuzzy Systems 23(4): 1127-1141, 2015. [56] Sullivan, R., A. Timmermann and H. White, “Data-Snooping, Technical Trading Rule Performance, and the Bootstrap,” The Journal of Finance 54: 1647-1691, 1999. [57] Tesfatsion, T. and K.L. Judd, eds., Handbook of Computational Economics Vol. 2: Agent-Based Computational Economics, Elsevier B.V., 2006. [58] Wang, L.X., A Course in Fuzzy Systems and Control, Prentice-Hall, New Jersey, 1997. [59] Zadeh, L.A., “Toward a Theory of Fuzzy Systems,” in Aspects of Network and System Theory, eds. R.E. Kalman and N. DeClaris, Rinehart and Winston, New York, 1971. [60] Zadeh, L.A., “Outline of a New Approach to the Analysis of Complex Systems and Decision Processes,” IEEE Trans. on Systems, Man, and Cybern. 3: 28-44, 1973. Li-Xin Wang received the Ph.D. degree in 1992 from the Department of Electrical Engineering – Systems, University of Southern California (won USC’s Phi Kappa Phi’s highest Student Recognition Award). From 1992 to 1993 he was a Postdoc Fellow with the Department of Electrical Engineering and Computer Science, University of California at Berkeley. From 1993 to 2007 he was on the faculty of the Department of Electronic and Computer Engineering, The Hong Kong University of Science and Technology. In 2007 he resigned from his tenured position at HKUST to become an independent researcher and investor in the stock and real estate markets in Hong Kong and China. He returned to academia in Fall 2013 by joining the faculty of the Department of Automation Science and Technology, Xian Jiaotong University, after a fruitful hunting journey across the wild land of investment to achieve financial freedom. His research interests are dynamical models of asset prices, market microstructure, trading strategies, fuzzy systems, and opinion networks. 17
5cs.CE
arXiv:1701.04112v2 [math.ST] 29 Nov 2017 Regularization, sparse recovery, and median-of-means tournaments ∗ Gábor Lugosi†‡§ Shahar Mendelson ¶ November 30, 2017 Abstract We introduce a regularized risk minimization procedure for regression function estimation. The procedure is based on median-of-means tournaments, introduced by the authors in [10] and achieves near optimal accuracy and confidence under general conditions, including heavy-tailed predictor and response variables. It outperforms standard regularized empirical risk minimization procedures such as lasso or slope in heavy-tailed problems. 2010 Mathematics Subject Classification: 62J02, 62G08, 60G25. 1 1.1 Introduction Empirical risk minimization, regularization Regression function estimation is a fundamental problem in statistics and machine learning. In the most standard formulation of the problem, (X, Y ) is a pair of random variables in which X, taking values in some general measurable space X , represents the observation (or feature vector) and one would like to approximate the unknown real value Y by a function of X. In other words, one is interested in finding a function f : X → R such that f (X) is “close” to Y . As the vast majority of the literature, we measure the quality of f by the risk R(f ) = E(f (X) − Y )2 , which is well defined whenever f (X) and Y are square integrable, assumed throughout the paper. Clearly, the best possible function is the regression function m(X) = E(Y |X). However, in statistical problems, the joint distribution of (X, Y ) is unknown and the regression function is impossible to compute. Instead, a sample DN = ((X1 , Y1 ), . . . , (XN , YN )) of independent copies of the pair (X, Y ) is available (such that DN and the pair (X, Y ) are independent). ∗ Gábor Lugosi was supported by the Spanish Ministry of Economy and Competitiveness, Grant MTM201567304-P and FEDER, EU. Shahar Mendelson was supported in part by the Israel Science Foundation. † Department of Economics and Business, Pompeu Fabra University, Barcelona, Spain, [email protected] ‡ ICREA, Pg. Llus Companys 23, 08010 Barcelona, Spain § Barcelona Graduate School of Economics ¶ Department of Mathematics, Technion, I.I.T, and Mathematical Sciences Institute, The Australian National University, [email protected] 1 A popular and thoroughly studied approach is to select a function fbN from a fixed class F of functions. Formally, a learning procedure is a map Φ : (X × R)N → F that assigns to b each sample DN = (Xi , Yi )N i=1 a (random) function Φ(DN ) = fN . If the class F is sufficiently “large,” then it is reasonable to expect that the best function in the class f ∗ = argmin E(f (X) − Y )2 f ∈F has an acceptable performance, and the standard assumption is that the minimum is attained and f ∗ ∈ F is unique. We assume that F is a closed and convex subset of L2 (µ)—where µ denotes the distribution of X—, guaranteeing the existence and uniqueness of f ∗ . The quality of a learning procedure is typically measured by the mean squared error, which is the conditional expectation  kfbN − f ∗ k2L2 = E (fbN (X) − f ∗ (X))2 |DN , where, for q ≥ 1, we use the notation kf − gkLq = (E |f (X) − g(X)|q )1/q and also kf − Y kLq = (E |f (X) − Y |q )1/q . A closely related, though not equivalent, measure of performance is the excess risk, defined by the conditional expectation  R(fbN ) − R(f ∗ ) = E (fbN (X) − Y )2 |DN − E(f ∗ (X) − Y )2 . The goal of a statistical learning problem is to find a learning procedure that achieves a good accuracy with a high confidence. In particular, for r > 0 and δ ∈ (0, 1), we say that a procedure performs with accuracy parameter r with confidence 1 − δ in the class F (e.g., for the mean squared error) if   P R(fbN ) − R(f ∗ ) ≤ r 2 ≥ 1 − δ   (sometimes one only considers P kfbN − f ∗ kL2 ≤ r ≥ 1 − δ). High accuracy and high confidence (i.e., small r and small δ) in the given class are obviously conflicting requirements. The achievable tradeoff has been thoroughly studied and it is fairly well understood. We refer the reader to Lecué and Mendelson [7], Lugosi and Mendelson [10] for recent accounts. The most standard approach for a learning procedure is empirical risk minimization (erm), also known as least squares regression in which fbN ∈ argmin f ∈F N X (f (Xi ) − Yi )2 i=1 (where we assume that the minimum is achieved). One may show (see, e.g., Lecué and Mendelson [7]) that unless the function class and target are sub-Gaussian1 , then empirical risk minimization is far from achieving the optimal accuracy/confidence tradeoff. The reason for 1 Here, Sub-Gaussian means that the ψ2 and the L2 norms are equivalent in F ∪ {0}; that is, there is a √ constant L such that for any f, h ∈ F ∪ {0} and any p ≥ 2, kf − hkLp ≤ L pkf − hkL2 , and that the same holds for any Y − f (X) for any f ∈ F. 2 the suboptimal behaviour of empirical risk minimization is that outliers distort the empirical means unless the problem is very close to being Gaussian. Thankfully, learning procedures that can tackle heavy-tailed problems exist, as it was recently pointed out by Lugosi and Mendelson [10] with the introduction of the median-of-means tournament. A common problem that all learning procedures encounter is that of overfitting, which occurs when the underlying class is too big relative to the (random) information at the learner’s disposal. A standard way of dealing with learning problems involving classes that are too large is giving priority to functions in the class according to some prior belief of “simplicity”. For example, in regularized risk minimization, one selects a norm Ψ defined on a vector space E containing F. A small value of Ψ(f ) is interpreted as simplicity and simple functions are given priority by way of adding a penalty term to the empirical risk that is proportional to Ψ(f ). In particular, for some regularization parameter λ > 0, a regularized risk minimizer selects ! N X 1 (f (Xi ) − Yi )2 + λΨ(f ) , fbN ∈ argmin N f ∈F i=1 and the term Ψ(f ) is sometimes called the penalty. Just as the tournament procedure from [10] outperforms empirical risk minimization (in fact, the tournament procedure attains the optimal tradeoff between accuracy and confidence under minimal assumptions), the regularized tournament which we present here, outperforms regularized risk minimization. Since regularized procedures require the minimization of a functional that has the empirical mean as a component, they suffer from the same disadvantages as empirical risk minimization. Therefore, the accuracy/confidence tradeoff exhibited by regularized risk minimization is suboptimal once one leaves the sub-Gaussian realm, and deteriorates further if the problem is more heavy-tailed. In contrast, we show that the regularized tournament attains the optimal accuracy/confidence tradeoff under rather minimal conditions and, in particular, in heavy-tailed problems. The paper is organized as follows. In Section 2 we introduce a new regularized “tournament” procedure in a quite general framework and illustrate how it works on an important specific case, the tournament lasso (see Section 2.1). In Section 3 the main general performance bound is presented for the regularized tournament procedure under certain specific choice of the parameters of the procedure. The proof of the main result is detailed in Section 4. Finally, in Section 5 two examples are worked out. The first is a “tournament” version of lasso (introduced in Section 2.1) and the second is the tournament slope, a generalized version of tournament lasso. 2 The procedure Let us now describe the regularized tournament procedure. Recall that the learner is given a closed and convex class of functions F ⊂ L2 (µ) and a regularization function Ψ which is assumed to be a norm on span(F). An underlying assumption is that F can be naturally decomposed to a hierarchy of subclasses, that is, there is a finite decreasing collection of subsets of F, denoted by (Fℓ )K ℓ=1 , such that F = F1 ⊃ · · · ⊃ FK . 3 The idea is that the sets Fℓ capture some notion of ‘complexity’: the larger ℓ is, the simpler the functions in Fℓ are. An important example of a hierarchy, discussed below in detail, is based on the notion of sparsity in Rd relative to a fixed orthonormal basis (ei )di=1 : the vector t ∈ Rd is s-sparse if its P representation in the basis (ei )di=1 , di=1 ti ei , has at most s nonzero coefficients. For the class of linear functionals F = {ht, ·i : t ∈ Rd } one may set Fℓ = {ht, ·i : t is d/2ℓ−1 sparse}. Given a hierarchy (Fℓ )K ℓ=1 , the first, second and third phases of the procedure are performed on each one of the subclasses Fℓ separately and the procedure returns subclasses Hℓ ⊂ Fℓ consisting of functions whose statistical performance is good enough to be considered as candidates for selection. The fourth and final phase compares the candidates selected from each class Fℓ and selects one of them, as we describe below. The first three stages of the procedure use independent data. In order to accommodate this, one needs to split the available data into three independent parts. For simplicity of the presentation, we assume that these parts have equal size, each containing N samples. (Thus, the total sample size is 3N rather than N but this change of convention only affects the constants in the bounds that we do not make explicit in any case.) The first phase: constructing the ‘referee’ in Fℓ The goal of the first phase is to get a data-dependent estimate of L2 (µ) distances between elements in Fℓ . Its output is a (data-dependent) function DOℓ : Fℓ × Fℓ → {0, 1}, which takes the value 1 when two functions in Fℓ are far-enough, in the following sense. This first step uses unlabeled samples only. Definition 2.1. Suppose we are given a sample (Xi )N i=1 . Fix an appropriately chosen positive integer n1 . For each ℓ = 1, . . . , K, (1) fix well-chosen parameters ρℓ and rℓ,1 ; (2) split (Xi )N i=1 to n1 disjoint blocks (Ij ) of equal size, denoted by m1 = N/n1 ; (3) for every f, h ∈ Fℓ let vj = 1 X |f (Xi ) − h(Xi )| , m1 i∈Ij and set dℓ (f, h) to be the median of {vj : 1 ≤ j ≤ n1 }; (4) set DOℓ (f, h) = 1 if either Ψ(f − h) ≥ ρℓ or if Ψ(f − h) < ρℓ and dℓ (f, h) ≥ rℓ,1 . The second phase: ℓ-elimination This first phase is used as input to the second phase. The latter is a comparison of the statistical performance of any two functions f and h in Fℓ using a sample (Xi , Yi )2N i=N +1 . The idea is to define ‘statistical matches’ between any two functions f, h ∈ Fℓ , with each match designed to determine which function out of the two is more suited for our needs. Because the ‘matches’ are based on a random sample, a reliable comparison is impossible when the 4 two functions are ‘too close’. This is where the output of the first phase comes into the frame. The random binary function DOℓ tells the learner when f and h are too close (when DOℓ (f, h) = 0) and in such cases, the outcome of the statistical match between f and h is useless. More accurately, the second phase is defined as follows: Definition 2.2. Suppose we are given a sample (Xi , Yi )2N i=N +1 and, for each ℓ = 1, . . . , K, the output DOℓ of the first phase, Then (1) let λℓ and nℓ,2 be well-chosen parameters, and set ρℓ as in the first phase; (2) split {N + 1, . . . , 2N } to nℓ,2 coordinate blocks (Ij ) of equal size, denoted by mℓ,2 ; (3) for any f, h ∈ Fℓ set f ≻ h if  1 X (h(Xi ) − Yi )2 − (f (Xi ) − Yi )2 + λℓ (Ψ(h) − Ψ(f )) > 0 mℓ,2 i∈Ij for the majority of the blocks Ij ; (4) denote by Hℓ′ = {f ∈ Fℓ : f ≻ h for every h ∈ Fℓ such that DOℓ (f, h) = 1}. The output of the second phase is the sequence of classes Hℓ′ ⊂ Fℓ . Each Hℓ′ consists of the set of functions that were superior to all the other ‘competitors’ in the ℓ-tournament, at least in ‘matches’ that were considered reliable by DOℓ . We will show that if f ∗ ∈ Fℓ then functions in Hℓ′ are ‘close’ in L2 (µ) to f ∗ . The third phase: ℓ-champions league The third phase in the procedure is a further selection process, this time conducted among the set of ‘winners’ of the ℓ-elimination tournament. ′ Definition 2.3. Suppose we are given (Xi , Yi )3N i=2N +1 . For each ℓ = 1, . . . , K, let Hℓ be the outcome of the second phase. Then (1) let nℓ,2 be as above, and set rℓ,3 to be a well-chosen parameter; (2) split {2N + 1, . . . , 3N } to nℓ,2 disjoint blocks (Ij ) of size mℓ,2 = N/nℓ,2 ; (3) for any f, h ∈ Hℓ′ set f ≫ h if 2 X 2 (h(Xi ) − f (Xi )) · (f (Xi ) − Yi ) ≥ −rℓ,3 mℓ,2 i∈Ij (observe that it is possible that f ≫ h and h ≫ f at the same time); 5 (4) let Hℓ = {f ∈ Hℓ′ : f ≫ h for every h ∈ Hℓ′ } . This further selection process improves the outcome of the ℓ-elimination phase: instead of just ensuring that the functions are close to f ∗ , the ℓ-champions league selects functions whose risk is close to the risk of f ∗ . The fourth phase: naming a winner The outcome of the first three phases results in data-dependent choices Hℓ ⊂ Fℓ (and obviously at this point there is no way of knowing that the sets Hℓ are nonempty). All the functions in each one of the Hℓ ’s are in some sense the best estimators one can find within Fℓ , taking into account its size and the data at the learner’s disposal. Naturally, the larger Fℓ is, the larger the error one will incur by selecting an estimator in it. Therefore, in the final stage the aim is to find the smallest class in the hierarchy in which a good estimator still exists. , let ℓ1 be the largest integer ℓ such that Definition 2.4. Given the classes (Hℓ )K ℓ=1T T b j≤ℓ1 Hj . j≤ℓ Hj 6= ∅. Select f to be any function in The first three phases are the key components of the procedure. Out of the three, the first one is an adaptation of the distance oracle used in [10] and which had been introduced in [14]; the third component is essentially the same as the champions league stage in the tournament procedure from [10]. The truly new component is the second phase. Its analysis combines ideas from [8] (which focused on regularized risk minimization in ‘sparse’ problems) and from [10]. As it is the main novelty in this article we present it in detail and only sketch the arguments needed in the analysis of the other components. Naturally, at this point there are no guarantees that this procedure performs well, let alone that it is close to optimal. That requires some assumptions on the class F, the hierarchy (Fℓ )K ℓ=1 and the regularization function Ψ. Moreover, the parameters that each phase requires as inputs have to be specified for the procedure to make any sense. All these issues are explored in what follows. Before we dive into technicalities, and to give the reader a feeling of how the regularized tournament looks like in a familiar situation, let us describe the tournament version of the lasso. 2.1 The tournament lasso Consider the following standard setup: Let X be an isotropic random vector in Rd (that is, for every t ∈ Rd , E ht, Xi2 = ktk22 , where k · k2 denotes the Euclidean norm in Rd ). Let Y be the unknown target random variable and set t0 to be the minimizer in Rd of the risk functional t → E(hX, ti − Y )2 . For the sake of simplicity we assume that Y = ht0 , Xi + W for W that is mean-zero, square integrable and independent of X. 6 In sparse recovery problems one believes that t0 is supported on at most s coordinates with respect to the standard basis in Rd —or at least it is well approximated by an s-sparse vector—, but one does not know that for certain. The lasso procedure (introduced in [18]) selects b t ∈ Rd that minimizes the regularized empirical squared-loss functional t→ N 1 X (ht, Xi i − Yi )2 + λktk1 N i=1 P for a well chosen regularization parameter λ, and ktk1 = di=1 |ti | is the ℓ1 -norm of t. The problem with the lasso is that when either the class members ht, Xi or the target Y are heavy-tailed, the tradeoff between the accuracy with which the lasso performs and the confidence with which that accuracy is attained is far from optimal. That suboptimal tradeoff is what the tournament lasso aims to remedy. For the time being we assume that for every t ∈ Rd and for every p ≤ c log d, k hX, ti kLp ≤ √ √ L pk hX, ti kL2 = L pktk2 (where the last inequality holds because X is isotropic). The random variable W is assumed to be square-integrable. The natural class of functions in this context is F = {ht, ·i : t ∈ Rd } and the hierarchy is given in terms of the sparsity of t: we set, for ℓ = 1, . . . , K = ⌈log2 d⌉ + 1, Fℓ = {ht, ·i : t is d/2ℓ−1 sparse} . Let us go through the four phases of the tournament lasso. The first phase For the definition of the ‘referee’ DOℓ one requires to specify three parameters: ρℓ , rℓ,1 and n1 . First, let n1 ∼L N , meaning that the cardinality of each block is a constant, depending only on L and which we denote by m1 . Thus, n1 = N/m1 . In what follows, C(L), C0 (L), . . . , C4 (L) denote appropriately chosen constants whose value depends only on L. (The precise form may be extracted from the analysis but it is of secondary importance for our purpose.) Next, set s = d/2ℓ−1 . If s ≥ C(L)N/ log(ed/N ) then the class Fℓ for the corresponding ℓ is too large and no useful statistical information can be derived from the sample. In that case, we set rℓ,1 , ρℓ = ∞, and in particular, DOℓ ≡ 0. Otherwise, when s < C0 (L)N/ log(ed/N ), set s r   s dℓ ed log , (2.1) = C2 (L)kW kL2 rℓ = C1 (L)kW kL2 d s 2ℓ N and s ρℓ = C3 (L)kW kL2 √ N s log  ed s  √ d ℓ = C4 (L)kW kL2 √ . 2ℓ N (2.2) Consider rbℓ ≥ rℓ and set rℓ,1 = rbℓ . The first phase is performed as follows: given (Xi )N i=1 , then for any t1 , t2 supported on at most d/2ℓ−1 coordinates, let P • For 1 ≤ j ≤ n1 (which is proportional to N ), set vj = m11 i∈Ij | ht1 − t2 , Xi i | and define dℓ (t1 , t2 ) to be a median of {vj : 1 ≤ j ≤ n1 }. 7 • Set DOℓ (t1 , t2 ) = 1 if either kt1 − t2 k1 ≥ ρℓ or kt1 − t2 k1 < ρℓ and dℓ (t1 , t2 ) ≥ rℓ,1 . Remark 2.5. Since X is isotropic, the L2 (µ) distance coincides with the ℓ2 distance. Thus, DOℓ can be chosen as a deterministic function: DOℓ (t1 , t2 ) = 1 if kt1 − t2 k1 ≥ ρℓ or if kt1 − t2 k1 < ρℓ and kt1 − t2 k2 ≥ rℓ,1 . However, when X is not isotropic, the first phase of the procedure is truly required, which is why we ignored the simpler option that is available in the isotropic case. The ℓ-elimination phase The elimination phase in the tournament lasso requires two parameters, λℓ and nℓ,2 as inputs, as well as the outcomes of DOℓ obtained in the first phase. Recalling the choices of rℓ,1 from (2.1) and ρℓ from (2.2), we set ( ) r2 r2 ,1 , (2.3) r = c1 (L)rℓ,1 λℓ = c2 (L) 2 , and nℓ,2 = c3 (L)N min ρℓ kW k2L2 where c1 , c2 and c3 are constants that depend only on L. Let (Ij ) be the natural partition on {1, . . . , N } to nℓ,2 disjoint blocks of equal cardinality, denoted by mℓ,2 . It follows that given the sample (Xi , Yi )2N i=N +1 and t1 , t2 ∈ Fℓ , we set t1 ≻ t2 if  1 X hXi , t2 i − Yi )2 − (hXi , t1 i − Yi )2 + λℓ (kt2 k − kt1 k) > 0 mℓ,2 i∈Ij for a majority of the blocks Ij . Therefore, Hℓ′ consists of all t1 ∈ Rd that satisfy t1 ≻ t2 for any t2 ∈ Fℓ such that DOℓ (t1 , t2 ) = 1. The ℓ-champions league phase The ℓ-champions league phase receives as input the set Hℓ′ produced in the second phase. ′ Let nℓ,2 and r be as in (2.3) and set rℓ,3 = c(L)r. Given (Xi , Yi )3N i=2N +1 and t1 , t2 ∈ Hℓ then t1 ≫ t2 if 2 X 2 hXi , t2 − t1 i · (hXi , t1 i − Yi ) ≥ −rℓ,3 , mℓ,2 i∈Ij and Hℓ = {t1 ∈ Hℓ′ : t1 ≫ t2 for every t2 ∈ Hℓ′ }. The fourth phase K Given the classes (H T ℓ )ℓ=1 , ℓ1 is the largest integer ℓ such that be any element of j≤ℓ1 Hj . T j≤ℓ Hj 6= ∅. We select b t to The following theorem, proved in Section 5.1, summarizes the performance of the tournament lasso. 8 Theorem 2.6. For L ≥ 1 there are constants c0 , . . . , c5 that depend only on L such that the following holds. Let X be an isotropic random vector in Rd . Let Y = ht0 , Xi + W where t0 ∈ Rd and W is mean-zero, square-integrable, and independent of X. Assume that for every √ t ∈ Rd and any 1 ≤ p ≤ c log d, k ht, Xi kLp ≤ L pk ht, Xi kL2 . Assume further that there is v ∈ Rd that is s-sparse such that r log(ed/s) . kt0 − vk1 ≤ c1 (L)kW kL2 · s N If N ≥ c2 (L)s log(ed/s), and then with probability at least rb ≥ c3 (L)kW kL2 s s log N (  1 − 2 exp −c4 (L)N min 1, we have kb t − t0 k2 ≤ c5 (L)b r,  ed s  rb kW kL2 2 )! kb t − t0 k1 ≤ c5 (L)kW kL2 s t, X − Y )2 ≤ E(ht0 , Xi − Y )2 + c5 (L)b r2. and E( b r , (2.4) log(ed/s) , N (2.5) Theorem 2.6 shows that the tournament lasso attains the optimal accuracy/confidence tradeoff even though f ∗ (X) − Y can be heavy-tailed. In fact, the estimate is what one would expect in the most friendly of scenarios: if X were a sub-Gaussian random vector (i.e., linear forms exhibiting a ψ2 − L2 norm equivalence with constant L rather than an Lp − L2 moment equivalence going only up to p ∼ log d), and f ∗ (X) − Y were a Gaussian random variable, independent of X. The lasso does not come close to such an accuracy/confidence tradeoff under the weak moment assumption of Theorem 2.6. q  ed s Note that r = c3 kW kL2 N log s is the best accuracy parameter one can hope for even if the learner knows that t0 is s-sparse and X and W are Gaussian. The difference between the performance of the tournament lasso and the standard lasso can be seen in the confidence with which this accuracy is attained. In the situation described in Theorem 2.6, the standard lasso performs with that accuracy parameter only with constant confidence, because all that we assume on W is that it is square-integrable. In contrast, the tournament lasso attains the accuracy (2.5) with the optimal exponential probability estimate (2.4). The tournament lasso does not require prior information on the degree of sparsity of t0 to be carried out, but its success does depend on having a large-enough sample and on that rb is in the right range. The former is a constraint that any recovery procedure faces while the latter is easily achieved by running the procedure for rbj = r0 /2j for a large initial value of r0 , followed by a standard validation argument at each step. The one item that does require extra attention is that an upper estimate on kW ||L2 is used in the choice of parameters of the tournament lasso. At times one is simply given that information; this is often the case in signal processing problems, where the nature of the ‘noise’ is known to the learner. If not, one may use the data-dependent procedure from 9 [16] which holds for more general noise models: it leads to upper and lower estimates on kf ∗ (X) − Y kL2 that are sharp up to absolute multiplicative constants and under minimal assumptions. Of course, proving Theorem 2.6 requires some work, and the choice of parameters used in the first three phases has to be clarified. We explain the choice in the general case in the next two sections and return to the example of the tournament lasso in Section 5. 3 The main result In the general setup we study, we merely assume a rather weak fourth-moment assumption. More precisely, we work under the following conditions. Assumption 3.1. Let F ⊂ L2 (µ) be a locally compact, convex class of functions. Let Y ∈ L2 and assume that, for some constant L > 0, • for every f, h ∈ F, kf − hkL4 ≤ Lkf − hkL2 ; • kf ∗ − Y kL4 ≤ σ4 for a known value σ4 . Remark 3.1. The condition that kf ∗ − Y kL4 ≤ σ4 may easily be replaced by a combination of two assumptions: that for every f ∈ F, kf − Y kL4 ≤ Lkf − Y kL2 ; and that kf ∗ − Y kL2 ≤ σ for some known constant σ > 0. Also, in the case of independent additive noise, that is, when Y = f0 (X) + W where f0 ∈ F and W that is mean-zero, square-integrable and independent of X, the assumption that kf ∗ − Y kL4 ≤ σ4 may be replaced by the weaker one, that kW kL2 ≤ σ for a known constant σ. The necessary modifications to the proofs are straightforward and we do not explore this observation further. Also, as noted previously, we refer the reader to [16] for a data-dependent procedure of estimating kf ∗ −Y kL2 which may be easily modified to an estimate on kf ∗ −Y kL4 . Since that is not the main focus of this paper we do not pursue it further and instead assume that the learner has access to σ4 or to σ. 3.1 Complexity parameters of a class The choice of parameters rℓ,1 , rℓ,3 and ρℓ depends on a certain notion of “complexity” of the underlying class. More accurately, there are geometric parameters that measure the metric entropy of “localizations” of the class as well as the oscillation of various natural random processes indexed by those localizations. The complexity is measured in terms of four parameters, depending both on the class F and the distribution of (X, Y ). The four play an essential role in describing the optimal performance of learning procedures and for detailed discussion on the meaning we refer to Mendelson [12, 13] and Lugosi and Mendelson [10]. Before we define the four parameters we need some notation. Denote the unit ball in L2 (µ) by D = {f : kf kL2 ≤ 1} and let S = {f : kf kL2 = 1} be the unit sphere. For h ∈ L2 (µ) and r > 0, we write Dh (r) = {f : kf − hkL2 ≤ r}. In a similar fashion for the norm Ψ used as a regularization function, let B = {f : Ψ(f ) ≤ 1}, set ρB = {f : Ψ(f ) ≤ ρ} and Bh (ρ) = {f : Ψ(f − h) ≤ ρ}. In what follows we make two important modifications to the definitions of the complexity parameters used in [12, 13, 10]. First, just like in the above-mentioned articles, we are 10 interested in “localized” classes. However, because regularized procedures are affected by two norms, Ψ and L2 (µ), the localization has to be with respect to both of them. Therefore, the “localization” of F, centred in h and of radii ρ, r > 0 is defined by Fh,ρ,r = (F − h) ∩ (ρB ∩ rD) = {f − h : f ∈ F, Ψ(f − h) ≤ ρ, kf − hkL2 ≤ r} . The second minor modification is that each complexity parameter is associated with the ‘worse case’ centre h ∈ F ′ for some fixed F ′ ⊂ F, and not necessarily with the whole of F. Two of the four parameters are defined using the notion of packing numbers. Definition 3.2. Given a set H ⊂ L2 (µ) and ε > 0, denote the ε-packing number of H by M(H, εD). In other words, M(H, εD) is the maximal cardinality of a subset {h1 , . . . , hm } ⊂ H, for which khi − hj kL2 ≥ ε for every i 6= j. The first relevant parameter λQ is defined as follows with appropriate numerical constants κ and η: Definition 3.3. Fix ρ > 0 and h ∈ F. For κ, η > 0, set λQ (κ, η, h, ρ) = inf{r : log M(Fh,ρ,r , ηrD) ≤ κ2 N } . For F ′ ⊂ F let (3.1) λQ (κ, η, ρ) = sup λQ (κ, η, h, ρ) . h∈F ′ While κ and η are adjustable parameters, we are mainly interested in the behaviour of λQ as a function of ρ. The way one selects ρ is clarified later. The reason behind the choice of λQ comes from high-dimensional geometry: if the class Fh,ρ,r ⊂ L2 (µ) is ‘less complex’ than an N -dimensional Euclidean ball of radius ∼ r, then it can be covered by exp(cN ) balls of radius ∼ r. Thus, λQ captures the smallest radius for which there is still a chance that Fh,ρ,r resembles in some sense a subset of a ball of radius ∼ r in RN . The hope is that for such a choice of radius r, at least part of the metric structure of Fh,ρ,r is reflected in a typical random set {(u(Xi ))N i=1 : u ∈ Fh,ρ,r }. In more statistical terms, the hope is that a sample of cardinality N provides the learner with enough information to “separate” class members that are far enough, and the distance at which a sample of cardinality N no longer suffices is λQ . The next parameter, denoted by λM , is also defined in terms of the packing numbers of the localization Fh,ρ,r , though at a different scaling than λQ . Definition 3.4. Fix h ∈ F and ρ > 0. Let κ > 0, 0 < η < 1, and define λM (κ, η, h, ρ) = inf{r : log M(Fh,ρ,r , ηrD) ≤ κ2 N r 2 } . Also, for F ′ ⊂ F let (3.2) λM (κ, η, ρ) = sup λM (κ, η, h, ρ) . h∈F ′ For the remaining two complexity parameters, let (εi )N i=1 be independent, symmetric {−1, 1}-valued random variables that are independent of (Xi , Yi )N i=1 . 11 Definition 3.5. Fix h ∈ F and ρ > 0. For κ > 0 let ( ) N √ 1 X εi u(Xi ) ≤ κ N r , rE (κ, h, ρ) = inf r : E sup √ N i=1 u∈Fh,ρ,r (3.3) and for F ′ ⊂ F set rE (κ, ρ) = suph∈F ′ rE (κ, h, ρ). The idea behind rE is similar to the one behind λQ . rE P(κ, h, ρ) is the smallest radius for which the expected supremum of the process u → √1N N i=1 εi u(Xi ) indexed by Fh,ρ,r PN exceeds the expectation of the supremum of the Bernoulli process in RN , v → i=1 εi vi , indexed by a Euclidean ball of radius r. Thus, the point is to identify when a typical random N set {N −1/2 (u(Xi ))N i=1 : u ∈ Fh,ρ,r } is richer than Euclidean ball of radius ∼ r in R , where ‘richer’ is measured in terms of the Bernoulli mean-width of a set rather than by its metric entropy. Definition 3.6. Fix h ∈ F and ρ > 0. For κ > 0, set r M (κ, h, ρ) to be ) ( N √ 2 1 X rM (κ, h, ρ) = inf r : E sup √ εi u(Xi ) · (h(Xi ) − Yi ) ≤ κ N r . N i=1 u∈Fh,ρ,r (σ) For σ > 0 put FY (3.4) = {f ∈ F ′ : kf (X)−Y kL2 ≤ σ} and let reM (κ, σ, ρ) = suph∈F (σ) r M (κ, h, ρ). Y f ∗ (X)kL4 Finally, suppose that the distribution of (X, Y ) is such that kY − ≤ σ4 for a ′ known constant σ > 0. The “complexity” of F relative to centres in F and radius ρ is r ∗ (F, F ′ , ρ) = max{λQ (c1 , c2 , ρ), λM (c1 /σ4 , c2 , ρ), rE (c1 , ρ), reM (c1 , σ4 , ρ)} . (3.5) Here c1 , c2 are appropriate positive numerical constants. (“Appropriate” means that r ∗ (F, F ′ , ρ) satisfies Propositions 4.1, 4.4 and 4.7 below). The existence of such constants is proved in [10] when F ′ = F, i.e., when any function in F is a ‘legal choice’ of a centre, and under Assumption 3.1. In that case, the constants depend only on the value of L. When F and F ′ are clear from the context, we simply write r ∗ (ρ) for r ∗ (F, F ′ , ρ). 3.2 Properties of the hierarchy After the complexity parameters are set in place, let us identify the conditions on the hierarchy (Fℓ )K ℓ=1 that are needed in the analysis of the regularized tournament. Recall that F is a (convex) subset of a normed space (E, Ψ); E is also a subspace of L2 (µ), though the norms Ψ and k · kL2 (µ) may have nothing to do with each other. Let BΨ∗ and SΨ∗ denote the unit ball and unit sphere in the dual space to (E, Ψ), respectively. Therefore, BΨ∗ consists of all the linear functionals z ∈ E ∗ for which sup{x∈E:Ψ(x)=1} |z(x)| ≤ 1. A linear functional z ∗ ∈ SΨ∗ is a norming functional for f ∈ E if z ∗ (f ) = Ψ(f ). Definition 3.7. Let Γf (ρ) ⊂ SΨ∗ be the collection of functionals that are norming for some v ∈ Bf (ρ/20). Set ∆ℓ (ρ, r) = inf inf sup z(h − f ) , f ∈Fℓ h z∈Γf (ρ) where the inner infimum is taken in the set {h ∈ F : Ψ(h − f ) = ρ and kh − f kL2 ≤ r} . 12 (3.6) Let us examine ∆ℓ (ρℓ , rℓ ) and explain its meaning for some fixed values ρ, r > 0. Note that ∆ℓ (ρ, r) ≤ ρ. Indeed, Γf (ρ) ⊂ SΨ∗ and if z ∈ SΨ∗ and Ψ(h − f ) ≤ ρ then |z(h − f )| ≤ Ψ∗ (z) · Ψ(h − f ) ≤ ρ . The interesting situation is when one can ensure a reverse inequality, that is, that ∆ℓ (ρ, r) is proportional to ρ, say ∆ℓ (ρ, r) ≥ (4/5)ρ. Such a lower estimate on ∆ℓ implies the following. Let f ∈ Fℓ and h ∈ F for which Ψ(h − f ) = ρ and kf − hkL2 ≤ r. It follows that there is some z ∈ SΨ∗ and v ∈ Bf (ρ/20) such that z is norming for v and z(h) − z(f ) ≥ ∆ℓ (ρ, r). Therefore, Ψ(h) − Ψ(f ) = Ψ(h) − Ψ(v + (f − v)) ≥ Ψ(h) − Ψ(v) − Ψ(f − v) ≥ z(h) − z(v) − Ψ(f − v) ≥ z(h) − z(f ) − 2Ψ(f − v) ≥ ∆ℓ (ρ, r) − ρ/10 ≥ 3ρ/5 . A lower bound on the term Ψ(h) − Ψ(f ) plays an essential role in the study of the elimination phase of the regularized tournament, when one has to compare 1 X 1 X (f (Xi ) − Yi )2 + λℓ Ψ(f ) and (h(Xi ) − Yi )2 + λℓ Ψ(h). mℓ,2 mℓ,2 i∈Ij i∈Ij Obviously, ensuring that ∆ℓ (ρ, r) ≥ (4/5)ρ becomes simpler when the set Γf (ρ) is large. In the extreme case, when ρ > 30Ψ(f ), then Bf (ρ/20) contains a nontrivial Ψ-ball around 0; thus, Γf (ρ) = SΨ∗ and ∆ℓ (ρ, r) = ρ. The other extreme is if ρ is very small and one is left only with the functionals that are norming for f itself. Intuitively, the right choice of ρℓ is the smallest one for which, for rℓ = r ∗ (F, Fℓ , ρℓ ), one has ∆ℓ (ρℓ , rℓ ) ≥ 4ρℓ /5. Definition 3.8. The sequence (Fℓ , ρℓ )K ℓ=1 is compatible if (1) F = F1 ⊃ F2 ⊃ · · · ⊃ FK is a finite hierarchy; ∗ (2) (ρℓ )K ℓ=1 is decreasing and rℓ = r (F, Fℓ , ρℓ ); (3) for every 1 ≤ ℓ ≤ K, ∆ℓ (ρℓ , rℓ ) ≥ 4ρℓ /5. We allow the choice of ρℓ = rℓ = ∞ for ℓ = 1, . . . , ℓ0 . In such cases the compatibility condition is to be verified from ℓ0 + 1 onward. We are now ready to specify the parameters used in the definition of a regularized tournament. • Let α, β, m1 , θ1 and θ2 be well chosen constants that depend only on the norm equivalence constant L from Assumption 3.1, and assume that one has access to the value σ4 from that assumption. 13 • Assume further that (Fℓ , ρℓ )K ℓ=1 is a compatible sequence, let rℓ be as in Definition 3.8 and set rbℓ > rℓ . We set the following choice of parameters: First phase: Let ρℓ as above, and set n1 = N m1 and rℓ,1 = βb rℓ . ℓ-elimination phase: Set   rb2 rb2 and λℓ = θ2 ℓ . nℓ,2 = θ1 N min 1, ℓ2 ρℓ σ4 √ ℓ-champions league: Set rℓ,3 = c(β/α)b rℓ for a suitable absolute constant c (c = 1/ 5 would do). With these choices set in place, let us formulate the main result of this article. Theorem 3.9. For L ≥ 1 there exist constants c0 , . . . , c2 that depend only on L and for which the following holds. Let (F, X, Y ) satisfy Assumption 3.1 and set (Fℓ )K ℓ=1 be a compatible sequence of the class F. If ℓ∗ is the largest index ℓ such that f ∗ ∈ Fℓ , then with probability at least    ℓ∗ X rbℓ2 1−2 exp −c0 (L)N min 1, 2 , σ4 ℓ=1 we have 3.3 h) − R(f ∗ ) ≤ c2 (L)b rℓ2∗ . h − f ∗ kL2 ≤ c1 (L)b rℓ∗ , and R(b Ψ(b h − f ∗ ) ≤ ρℓ∗ , kb Discussion The main message of Theorem 3.9 is that the regularized tournament procedure achieves essentially the best performance that can be expected even under strong assumptions of sub-Gaussian distributions. The regularized procedure yields (almost) the optimal accuracyconfidence tradeoff for any accuracy parameter r ≥ rℓ∗ : it behaves as if it “knew” the location of f ∗ in the hierarchy without actually knowing it. Indeed, the accuracy/confidence tradeoff established in Theorem 3.9 is essentially the best possible for any learning procedure taking values only in Fℓ∗ . We emphasize that Theorem 3.9 is quite general though finding the adequate parameters of the procedure requires additional work. For the “tournament” version of lasso and slope we work out the details in Section 5 under certain assumptions (such as isotropic design vector X and approximately sparse linear regression function) for illustration. Some of these assumption may be weakened but we prefer to keep the presentation as simple as possible. Related work. The sensitivity of empirical risk minimization (or least squares regression) to heavy-tailed distributions has been pointed out and several proposals of robust regression 14 function estimates have been made that avoid this sensitivity. We refer to Audibert and Catoni [1], Hsu and Sabato [4], Lerasle and Oliveira [9], Minsker [17], Brownlees, Joly, and Lugosi [3], Lugosi and Mendelson [10] for a sample of the literature. This paper mostly builds upon the methodology of median-of-means tournaments, developed in [10], (see also Lugosi and Mendelson [11]). Here we extend this methodology to the analysis of regularized robust risk minimization similarly to how the paper of Lecué and Mendelson [7] analyzes standard regularized risk minimization. The analysis of the lasso and slope procedures of [7] was extended and generalized by Bellec, Lecué, and Tsybakov [2]. In an independent parallel work to ours, and building on the arguments developed in [10], Lecué and Lerasle [5] point out a connection of median-of-means tournaments to Le Cam’s estimators, develop a version of lasso–the so-called mom-lasso–and prove a performance bound quite similar to Theorem 2.6. 4 Analyzing the four phases The first phase - the ℓ-distance oracle At each stage ℓ = 1, . . . , K of the procedure, one initially uses a modification of the distance oracle from [10]. The ℓ-distance oracle is a data-dependent procedure that provides information on the distances between functions. It is used for any pair f, h ∈ F, and aims at determining if Ψ(f − h) ≥ ρℓ , or, if Ψ(f − h) ≤ ρℓ , whether kf − hkL2 ≥ rℓ,1 . Note that Ψ is a known norm and therefore, Ψ(f − h) is known for any pair f, h ∈ F but kf − hkL2 needs to be (crudely) estimated. Recall that we work under Assumption 3.1, and that DOℓ is defined as follows: we split {1, . . . , N } to n = n1 disjoint blocks (Ij )nj=1 , each one of cardinality m = N/n. For a sample N C1 = (Xi )N i=1 and functions f and h, let w = (|f (Xi ) − h(Xi )|)i=1 and set ΦC1 (f, h) = Medm (w) , 1 P where Medm (w) is a median of the n values m i∈Ij |(f − h)(Xi )|. The behaviour of Φ described below has been established in Mendelson [14] (see also Lugosi and Mendelson [10]): Proposition 4.1. Let F satisfy Assumption 3.1. There exist constants m, 0 < α < 1 < β, and κ, η and c, all of them depending only on L, for which the following holds. • For 1 ≤ ℓ ≤ K and ρ > 0, let r > r ∗ (F, Fℓ , ρ), where r ∗ is defined relative to the constants κ and η). • Let n = N/m and fix f ∈ Fℓ . Then, with probability at least 1 − 2 exp(−cN ), for any h ∈ F that satisfies Ψ(f, h) ≤ ρ, (1) if ΦC1 (f, h) ≥ βr then β −1 ΦC1 (f, h) ≤ kf − hkL2 ≤ α−1 ΦC1 (f, h); (2) if ΦC1 (f, h) < βr then kf − hkL2 ≤ (β/α)r. 15 The proof of Proposition 4.1 is a direct outcome of Proposition 3.2 from [10], applied to the set F ∩ Bf (ρ) for a fixed centre f ∈ Fℓ and we shall not present it here. Based on Proposition 4.1, our choice of parameters in the first phase is clear. Recall that for rbℓ > rℓ = r ∗ (F, Fℓ , ρℓ ) and f1 , f2 ∈ F we set DOℓ (f1 , f2 ) = 1 if either Ψ(f1 − f2 ) > ρℓ or if Ψ(f1 − f2 ) ≤ ρℓ and ΦC1 (f1 , f2 ) ≥ βb rℓ . Thanks to Proposition 4.1, it follows that for a fixed centre f ∈ Fℓ (which is selected as f ∗ in what follows), with probability at least 1 − 2 exp(−cN ) if h ∈ F, and DOℓ (f, h) = 0 then Ψ(h − f ) ≤ ρℓ and kf − hkL2 ≤ rbℓ . Remark 4.2. Although Proposition 4.1 is formulated for a designated single centre f , it is straightforward to extend it to any centre in F and obtain a uniform distance oracle that holds for any pair f, h ∈ F. The second phase—ℓ-elimination Fix 1 ≤ ℓ ≤ K and let f, h ∈ F. Recall the definition of a regularized match between f and h: first, the ℓ-distance oracle defined above uses the first part of the sample C1 = (Xi , Yi )N i=1 to determine the value of DOℓ (f, h). If DOℓ (f, h) = 0, the match is abandoned. Each match that is allowed to take place by the ℓ-distance oracle is played using the second part of the sample, C2 = (Xi , Yi )2N i=N +1 . The sub-sample is partitioned to n = nℓ,2 blocks (Ij )nj=1 of cardinality m = N/n where recall that n is chosen as   rbℓ2 θ1 (L)N min 1, 2 . σ4 (4.1) for a well-chosen constant θ1 that depends only on the equivalence constant L from Assumption 3.1. We also set rb2 λℓ = θ2 (L) ℓ , ρℓ with the choices of both constants θ1 and θ2 specified below. The key definition in the elimination stage is the choice of a winner in a ‘statistical match’ between two functions in Fℓ . Definition 4.3. The function f defeats h (denoted by f ≻ h) if  1 X (h(Xi ) − Yi )2 − (f (Xi ) − Yi )2 + λℓ (Ψ(h) − Ψ(f )) > 0 m i∈Ij on a majority of the blocks Ij . The set of winners Hℓ′ of the ℓ-th elimination round consists of all the functions in Fℓ that have not lost a single match against a function in Fℓ . The idea behind the elimination round is to ‘exclude’ functions that are far from f ∗ (without knowing the identity of f ∗ , of course). To that end, it suffices to show that, if f ∗ ∈ Fℓ , then with high probability, f ∗ wins all the matches it takes part in. Indeed, that 16 implies that Hℓ′ is nonempty, and that all the matches between f ∗ and any h ∈ Hℓ′ must have been abandoned; therefore, DOℓ (f ∗ , h) = 0, that is, Ψ(f ∗ − h) ≤ ρℓ and kf ∗ − hkL2 ≤ (β/α)b rℓ . (4.2) The next theorem describes the outcome of the ℓ-elimination phase. Its proof may be found in Section 4.1. Proposition 4.4. Using the notation above, if f ∗ ∈ Fℓ then, with probability at least    rbℓ2 1 − 2 exp −c0 N min 1, 2 , σ4 f ∗ wins all the matches is participates in. In particular, on that event, if h ∈ Hℓ′ , then (4.2) holds. 4.1 Proof of Proposition 4.4—highlights To explain why this elimination phase preforms well even when F is very large, define, for each block Ij (j = 1, . . . , n), λ (j) = Bh,f  1 X (h(Xi ) − Yi )2 − (f (Xi ) − Yi )2 + λ(Ψ(h) − Ψ(f )) . m (4.3) i∈Ij λ (j). Note that the regularized empirical excess risk of h on block Ij is Bh,f ∗ Consider the ℓ-th stage of the regularized tournament. The assertion of Proposition 4.4 is that, if f ∗ ∈ Fℓ , then it is a winner of all the elimination phase matches it participates in. Hence, Proposition 4.4 is proved once we ensure that for the right choice of λ = λℓ , with high λ (j) is positive for most of the blocks I . probability, if h ∈ F and DOℓ (f ∗ , h) = 1 then Bh,f ∗ j To that end, observe that  1 X (h(Xi ) − Yi )2 − (f ∗ (Xi ) − Yi )2 m i∈Ij = 2 X 1 X (h − f ∗ )2 (Xi ) + (h − f ∗ )(Xi ) · (f ∗ (Xi ) − Yi ) , m m i∈Ij i∈Ij which is the natural decomposition of the empirical excess risk functional into its quadratic and multiplier components. Setting Qh,f (j) = 2 X 1 X (h − f )2 (Xi ) and Mh,f (j) = (h − f )(Xi ) · (f (Xi ) − Yi ) , m m i∈Ij i∈Ij we have λ = Bh,f ∗ (j)  1 X (h(Xi ) − Yi )2 − (f ∗ (Xi ) − Yi )2 + λ(Ψ(h) − Ψ(f ∗ )) m i∈Ij = Qh,f ∗ (j) + Mh,f ∗ (j) + λ(Ψ(h) − Ψ(f ∗ )) . The first observation we require is a version of a deterministic result from [8, Theorem 3.2] (see the appendix for the proof). 17 Lemma 4.5. Let f ∗ ∈ Fℓ and h ∈ F for which either Ψ(h − f ∗ ) = ρ, or Ψ(h − f ∗ ) < ρ and kh − f ∗ kL2 ≥ r. Assume that ∆ℓ (ρ, r) ≥ 4ρ/5, that λ satisfies C r2 3C r 2 · ≤λ≤ · 2 ρ 4 ρ (4.4) for some C > 0. Assume further that  Mh,f ∗ (j) ≥ −(C/4) max kh − f ∗ k2L2 , r 2 , (4.5) and if also kh − f ∗ kL2 ≥ r then Qh,f ∗ (j) ≥ Ckh − f ∗ k2L2 . (4.6) Then Qh,f ∗ (j) + Mh,f ∗ (j) + λ(Ψ(h) − Ψ(f ∗ )) > 0 . Moreover, if f ∈ F such that f = f ∗ + α(h − f ∗ ) for α > 1 then also Qf,f ∗ (j) + Mf,f ∗ (j) + λ(Ψ(f ) − Ψ(f ∗ )) > 0 . Thanks to Lemma 4.5 (which is proved in the appendix), all that is required to prove Proposition 4.4 is to verify that with the requested probability, (4.5) and (4.6) hold uniformly in h and on a majority of the blocks Ij , provided that f ∗ ∈ Fℓ ; thus f ∗ defeats any function in h ∈ F that satisfies either Ψ(h − f ∗ ) ≥ ρ or Ψ(h − f ∗ ) ≤ ρ and kf ∗ − hkL2 ≤ r. The fact that we have the required control over coordinate blocks is formulated in the following lemma. Its proof may be found in the appendix. Lemma 4.6. There exists an absolute constant c and a constant C1 = C1 (L, τ ) for which the following holds. Let f ∗ ∈ Fℓ . For 0 < τ < 1, with probability at least 1 − 2 exp(−cτ 2 n), for every h ∈ Bf ∗ (ρ) that satisfies kf − f ∗ kL2 ≥ rbℓ , we have  j : Qf,f ∗ (j) ≥ C1 kf − f ∗ k2L2 ≥ (1 − τ ) n and   C1 ∗ 2 j : Mf,f ∗ (j) ≤ − kf − f kL2 ≤ τ n . 4 Moreover, for every h ∈ Bf ∗ (ρ) that satisfies kf − f ∗ kL2 ≤ rbℓ , we have   C1 2 j : Mf,f ∗ (j) ≤ − r ≤ τn . 4 It follows from Lemma 4.6 that if τ < 1/4 then with probability at least 1 − 2 exp(−cτ 2 n), for every h as in Lemma 4.5, conditions (4.5) and (4.6) hold for C = C1 and r = rbℓ on the majority of the blocks Ij . Hence, setting τ = 1/10, on an event with probability at least 1 − 2 exp(−cn), f ∗ wins all the matches it participates in and that are allowed to take place by the ℓ-distance oracle, as we require. 18 The third phase—ℓ-champions league Once Proposition 4.4 is established, we turn to the third phase, aimed at selecting a set of “winners”. In order to do that, we run the champions league tournament defined in Definition 2.3, performed in each one of the sets Hℓ′ . (This is the same procedure used in [10].) The crucial point is that if f ∗ ∈ Fℓ then Hℓ′ satisfies the necessary conditions for a champions league tournament: that f ∗ ∈ Hℓ′ and all the functions h ∈ Hℓ′ have a mean-squared error at most ∼ rbℓ . Recall that the ℓ-champions league consists of matches that use the third part of the n sample C3 = (Xi , Yi )3N i=2N +1 . Let (Ij )j=1 be the partition of {2N + 1, . . . , 3N } to n blocks, for the same value of n = nℓ,2 as in the ℓ-elimination phase, given in (4.1). Also, for α and β as in Proposition 4.1, set c = β/α and for f, h ∈ Hℓ′ , let Ψh,f = (h(X) − f (X))(f (X) − Y ). Recall that the function f wins its home match against h (denoted by f ≫ h) if 2 X Ψh,f (Xi , Yi ) ≥ −(2cb rℓ )2 /10 m i∈Ij on more than n/2 of the blocks Ij , and the set of winners Hℓ consists of all the “champions” in Hℓ′ that win all of their home matches. The outcome of the ℓ-champions league phase is as follows: Proposition 4.7. Let Hℓ′ as above. With probability at least    rb2 1 − 2 exp −c0 N min 1, ℓ2 σ4 ∗ with respect to (Xi , Yi )3N i=2N +1 , the set of winners Hℓ contains f , and if h ∈ Hℓ then R(h) − R(f ∗ ) ≤ 16c2 rbℓ2 . Proposition 4.7 is an immediate outcome of Proposition 3.8 from [10] for H = Hℓ′ and using the fact that f ∗ ∈ Hℓ′ and that if h ∈ Hℓ′ then kh − f ∗ kL2 ≤ (β/α)b rℓ . Combining all these observations, Corollary 4.8 describes the outcome of the first three phases in the regularized tournament procedure, for each member of the hierarchy. Corollary 4.8. For L ≥ 1 there exists a constant c that depends only on L for which the following holds. Using the above notation, if f ∗ ∈ Fℓ , then with probability at least    rbℓ2 1 − 2 exp −c1 (L)N min 1, 2 σ4 with respect to (Xi , Yi )3N i=1 , the set of winners Hℓ satisfies: • f ∗ ∈ Hℓ , and • for any h ∈ Hℓ , Ψ(h − f ∗ ) ≤ ρℓ , kh − f ∗ kL2 ≤ (β/α)b rℓ , and R(h) − R(f ∗ ) ≤ 16(β/α)2 rbℓ2 . 19 Selection of a final winner Once the first three phases are completed, their outcome is K sets Hℓ consisting of stage winners. Of course, some of these sets may be empty. However, for those indices ℓ for which f ∗ ∈ Fℓ , with high probability the set Hℓ contains at least f ∗ . TIn order to select the final “winner”, let ℓ1 be the largest integer 1 ≤ ℓ ≤ K for which j≤ℓ Hj 6= ∅ and that the T procedure returns any b h∈ Hj . j≤ℓ1 Clearly, on a high-probability event, ℓ1 ≥ ℓ∗ . On this event, the selected function b h is decreasing, rℓ )K belongs to Hℓ∗ . Moreover, recalling that (b ℓ=1 h) − R(f ∗ ) ≤ c(β/α)2 rbℓ2∗ , h − f ∗ kL2 ≤ (β/α)b rℓ∗ and R(b Ψ(b h − f ∗ ) ≤ rbℓ∗ , kb which completes the proof of Theorem 3.9. 5 Examples In what follows we present two examples: a tournament version of lasso, and also, a tournament version of another popular sparse recovery procedure—slope. Here we use a stronger moment assumption than Assumption 3.1 because that allows us to give explicit estimates on the parameters ρℓ and rℓ . Assumption 5.1. Let X be is an isotropic random vector in Rd . Assume that there are constant c1 and C such that for every t ∈ Rd and every 1 ≤ p ≤ c1 log d, √ √ k ht, Xi kLp ≤ C pk ht, Xi kL2 = C pktk2 ; (5.1) the value of the constant c1 is given in Theorem 5.2. Assume further that kf ∗ (X) − Y kL4 ≤ σ4 for a known constant σ4 . In other words, Assumption 5.1 means that linear forms satisfy a sub-Gaussian moment growth, but only up to a rather low exponent—logarithmic in the dimension of the underlying space. This moment assumption is a sufficient and almost necessary condition for the celebrated basis pursuit procedure to have a unique minimizer (see [6]), and as such, it is a natural assumption when studying such sparsity-driven bounds. Note that even with Assumption 5.1 replacing Assumption 3.1, the fact that the ‘noise’ ξ = f ∗ (X) − Y may only be in L4 means that there is not hope that N 1 X √ ξi ht, Xi i − Eξ ht, Xi , sup N i=1 t∈T exhibits a fast tail decay, even in the extreme case when |T | = 1. This indicates why regularized risk minimization can only perform with a rather weak accuracy/confidence tradeoff in such situations. On the other hand, (5.1) suffices to obtain bounds on the expectation of empirical and multiplier processes, as long as the indexing set has enough symmetries, and a suitable bound on the expectation suffices for the analysis of regularized tournaments. 20 Definition 5.1. Given a vector x = (xi )ni=1 , let (x∗i )ni=1 be the non-increasing rearrangement of (|xi |)ni=1 . The normed space (Rd , k k) is K-unconditional with respect to the basis {e1 , . . . , ed } if for every x ∈ Rd and every permutation of {1, . . . , n}, d X i=1 xi ei ≤ K d X xπ(i) ei , i=1 and if y ∈ Rd and x∗i ≤ yi∗ for 1 ≤ i ≤ d then d X i=1 xi ei ≤ K d X yi ei . i=1 There are many natural examples of K-unconditional spaces, most notably, all the ℓp spaces. Moreover, ifP(vi∗ )di=1 denotes the nonincreasing rearrangement of (|vi |)di=1 , then the norm kzk = supv∈V ni=1 vi∗ zi∗ is 1-unconditional. In fact, if V ⊂ Rd is closed under coordinate permutations and reflections (sign-changes), then k · k = supv∈V | h·, vi | is 1-unconditional in the sense of Definition 5.1. The following fact has been established in [15]: Theorem 5.2. There exists an absolute constant c1 and for K ≥ 1, L ≥ 1 and q0 > 2 there exists a constant c2 that depends only on K, L and q0 for which the following holds. Consider • V ⊂ Rd for which the norm k · k = supv∈V | hv, ·i | is K-unconditional with respect to the basis {e1 , . . . , ed }, • ξ ∈ Lq0 for some q0 > 2, • an isotropic random vector X ∈ Rd that satisfies k hX, ej i kLp ≤L. √ 1≤j≤d 1≤p≤c1 log d p max sup If (Xi , ξi )N i=1 are independent copies of (X, ξ) then N 1 X E sup √ (ξi hXi , vi − Eξ hX, vi) ≤ c2 kξkLq0 ℓ∗ (V ) , N i=1 v∈V where ℓ∗ (V ) = E supv∈V Pd i=1 gi vi and G = (gi )di=1 is a standard Gaussian vector in Rd . Therefore, as long as V is sufficiently symmetric and linear forms exhibit a sub-Gaussian moment growth up to p ∼ log d, the expectations of empirical and multiplier processes indexed by V behave as if X were the standard Gaussian vector and ξ were independent of X. In the cases we are interested in the indexing sets have enough symmetries, and since ξ ∈ L4 , the conditions of Theorem 5.2 hold for q0 = 4. 21 5.1 The tournament lasso In this section we prove Theorem 2.6, the performance bound of the “tournament lasso” procedure. The proof of Theorem 2.6 follows from Theorem 3.9, combined with explicit estimates on the parameters ρℓ , rℓ,1 and rℓ,2 , as we now show. Note that for any h = ht0 , ·i and every ρ, r > 0, Fh,ρ,r = {ht, ·i ∈ Rd : t ∈ ρB1d ∩ rB2d } , where Bpd is the unit ball of the normed space (Rd , k kp ). Hence, for a fixed radius ρ the parameters rE and r M are defined using the fixed-point conditions N √ 1 X √ εi ht, Xi i ≤ κ N r (5.2) E sup N i=1 t∈ρB1d ∩rB2d and E sup t∈ρB1d ∩rB2d N √ 1 X √ εi ξi ht, Xi i ≤ κ N r 2 N i=1 (5.3) respectively. The indexing set Vρ,r = ρB1d ∩ rB2d is invariant under coordinate permutations and sign reflections, and therefore satisfies the conditions of Theorem 5.2. Hence, an upper bound on rE follows if N X √ (5.4) E sup gi ti ≤ κ Nr , t∈ρB1d ∩rB2d i=1 while for an upper estimate on rM it suffices to ensure that kξkL4 E sup N X t∈ρB1d ∩rB2d i=1 √ gi ti ≤ κ N r 2 . (5.5) Equations (5.4) and (5.5) cannot be improved; they are tight bounds on (5.2) and (5.3) when, for example, X = (g1 , . . . , gd ) and ξ is a Gaussian variable that is independent of X. The added value in (5.4) and (5.5) is that if r satisfies these inequalities then, necessarily, max{λQ , λM } ≤ r (for a well chosen constant κ). This is an immediate consequence of Sudakov’s inequality, which implies that for some absolute constant c > 0, for any T ⊂ Rd and any ε > 0, d q X d ε log M(T, εB2 ) ≤ cE sup gi ti ≡ ℓ∗ (T ) . t∈T i=1 Thus, when applied to the definition on λQ one obtains log M(ρB1d ∩ rB2d , ηrB2d ) ≤ that is, it suffices that ℓ2∗ (ρB1d ∩ rB2d ) ≤ κ2 N , (ηr)2 √ ℓ∗ (ρB1d ∩ rB2d ) ≤ ηκ N r , which is precisely the type of condition in (5.4). 22 With those estimates in hand, we are now able to explain the choice of parameters ρℓ , rℓ,1 , rℓ,2 and λℓ for the tournament lasso. This requires several observations that have been established in [8]. First, the requirement that ∆(ρ, r) ≥ 4ρ/5 forces some constraint on the choice of ρ and r. To simplify things, assume that t0 = argmint∈Rd E(hX, ti − Y )2 is supported on I ⊂ {1, . . . , d} and that |I| ≤ s. Recall that by the definition of ∆(ρ, r), the fact that Ψ(t) = ktk1 and since X is isotropic, it suffices to consider vectors t ∈ Rd for which kt − t0 k1 = ρ and kt − t0 k2 ≤ r. For such t, X X X X ktk1 − kt0 k1 = |ti | + (|ti | − |(t0 )i |) ≥ |ti | − |ti − (t0 )i | , i∈I c and since |I| ≤ s, X i∈I Therefore, X i∈I c |ti | = X i∈I c i∈I c i∈I |ti − (t0 )i | ≤ |ti − (t0 )i | = n X i=1 p |I|kt − t0 k2 ≤ |ti − (t0 )i | − X i∈I i∈I √ sr . |ti − (t0 )i | ≥ ρ − √ sr . P On the other hand, there is a functional z that is norming for both t0 and PI c t = i∈I c ti ei ; hence, X X X |ti − (t0 )i | = z(t − t0 ) ≥ z(PI c (t − t0 )) − |ti − (t0 )i | − |ti − (t0 )i | i∈I c i∈I i∈I √ 4ρ ≥ ρ − 2 sr ≥ 5 as long as s . (ρ/r)2 . This shows that, as long as the ratio ρ/r is larger than the square-root of the degree of sparsity of vectors we are interested in, ∆(ρ, r) ≥ (4/5)ρ as our procedure requires. A similar observation is true if t0 is not sparse, but rather well approximated by an s-sparse vector (see [8] for a detailed argument). Set k = (ρ/r)2 and assume without loss of generality that k is an integer. We also restrict ourselves to values 1 ≤ k ≤ d, intuitively because the above implies that (ρ/r)2 should capture the degree of sparsity. Recall that p √ p ℓ∗ (ρB1d ∩ rB2d ) = rℓ∗ ( kB1d ∩ B2d ) ≤ Cr k log(ed/k) = Cρ log(edr 2 /ρ2 ) (see, e.g. [8] for the standard proof). Hence, (5.4) becomes p √ Cρ log(edr 2 /ρ2 ) ≤ κ N r , while (5.5) implies p √ kξkL4 · Cρ log(edr 2 /ρ2 ) ≤ κ N r 2 . (5.6) (5.7) We consider only the case N ≤ Cd, which is the more interesting range in sparse recovery— when the number of given linear measurements is significantly smaller than the dimension of the underlying space. An argument following the same path may be used when N ≥ Cd and we omit it. 23 It follows from a rather tedious computation that (5.6) holds provided that s   cd ρ r≥c √ , log κN κ N (5.8) and it follows from (5.7) that kξkL r 2 ≥ cρ √ 4 N s  kξkL d log c √ 4 Nρ  (5.9) √ as long as kξkL4 d/ N ρ ≥ c′ . √ Using the constraint that ρ/r ≥ c s, it is evident from (5.8) that s ≤ c(L)N/ log (ed/N ), and that s   1 r2 1 kξkL4 kξkL d log e √ 4 . ≥ c1 (L) 2 & · √ s ρ ρ N Nρ Therefore, to have a ‘legal’ choice of ρ and r, we must have   ed N ≥ c2 (L)s log , s and s ρ ≥ c3 (L) √ kξkL4 · N s log  ed s  . This naturally leads to the choices made in Section 2.1: set Fℓ = {t : ∃v, |supp(v)| ≤ d/2ℓ−1 , kt − vk1 ≤ ρℓ } to be the set of vectors that are ‘well-approximated’ by d/2ℓ−1 sparse vectors. For every ℓ let  ed ℓ−1 s = d/2 ; if s ≥ c(L)N/ log N , set ρℓ = rℓ = ∞. If the reverse inequality holds, set d ρℓ = c(L) √ kξkL4 ℓ 2 N q log (e2ℓ ) √ d ℓ ∼L √ kξkL4 , 2ℓ N and for that choice ρℓ , the required value of rℓ is s r   ed s dℓ log . ∼L kξkL4 rℓ ≥ c(L)kξkL4 N s 2ℓ N Finally, let rbℓ ≥ rℓ and recall that λℓ ∼L rbℓ2 /ρℓ . Applying Theorem 3.9, these choices complete the proof of Theorem 2.6. 24 5.2 The tournament slope As a second example, we present and analyze a “tournament” version of the regularized risk minimization procedure slope. slope is defined using a set of non-increasing weights (βi )di=1 . The corresponding norm is d X βi zi∗ , Ψ(z) = i=1 where as always, (zi∗ )di=1 denotes the non-increasing rearrangement of (|zi |)di=1 . Clearly, slope is a generalized version of lasso, as the latter is given by the choice βi = 1 for 1 ≤ i ≤ d. Just like the lasso, most of the known results on the performance of slope hold only when both the random vector X and the target Y have well behaved tails. P The tournament slope we present below is defined for the penalty Ψ(z) = di=1 βi zi∗ , p where βi ≤ C log(ed/i). We obtain the following performance bound: Theorem 5.3. For L ≥ 1 there exist constants c0 , . . . , c5 that depend only on L and for which the following holds. Let X satisfy Assumption 5.1, set t0 = argmint∈Rd E(Y − ht, Xi)2 and assume that kY − ht0 , Xi kL4 ≤ σ. Assume further that there is v that is s-sparse such that kt0 − vk1 ≤ c1 (L)σ · If N ≥ c2 (L)s log(ed/s) and rb ≥ c3 (L)σ then with probability at least s s log(ed/s) √ . N s log N  ed s  , (   )! rb 2 1 − 2 exp −c4 (L)N min 1, , σ the tournament slope produces b t that satisfies kb t − t0 k2 ≤ c5 (L)σ and Ψ(b t − t0 ) = E  s s log N   ed , s   d X p ed s (b t − t0 )∗i log(ed/i) ≤ c5 (L)σ √ log , s N i=1 b t, X − Y 2  2 r2 . |(Xi , Yi )N i=1 ≤ E (ht0 , Xi − Y ) + c5 (L)b The estimate corresponds to the optimal accuracy/confidence tradeoff any procedure can attain even if the learner knows that t0 is s-sparse. Moreover, in the heavy-tailed situations we study here, the performance of slope is significantly weaker than in Theorem 5.3. The argument we use here is similar to the one used for the tournament lasso, and so we skip most of the details. 25 In tournament slope one selects βi ≤ c0 indexing set is contained in ( Vρ,r = ρB ∩ rB2d = p log(ed/i) and therefore the corresponding d v ∈ R : kvk2 ≤ r and d X vi∗ i=1 p log(ed/i) ≤ ρ/c0 ) . Because Vρ,r has enough symmetries, one may apply Theorem 5.2, leading to an upper bound on rE when d X √ gi vi ≤ κ N r . E sup (5.10) v∈Vρ,r i=1 Also, to estimate rM it suffices to ensure that kξkL4 E sup d X v∈Vρ,r i=1 √ gi vi ≤ κ N r 2 . (5.11) √ P Next, one may verify (see Lemma 4.3 in [8]) that if we set Bs = i≤s βi / i and if Bs . r/ρ, then ∆(ρ, r) ≥ (4/5)ρ forp centres that are ‘well approximated’ by s-sparse vectors. Also, for our choice of βi , Bs . C s log(ed/s). Hence, for a fixed degree of sparsity 1 ≤ s ≤ d, one has the constraint that p r (5.12) ≥ C1 s log(ed/s) ρ for a constant C1 that depends only on c0 . Following the same path used for the tournament lasso let Fℓ = {t : ∃v, |supp(v)| ≤ d/2ℓ−1 , Ψ(t − v) ≤ ρℓ }. For every 1 ≤ ℓ ≤ log2 K let s = d/2ℓ−1 . There is a nontrivial choice of ρ and r only when s .L N/ log(ed/N ); otherwise, ρ = r = ∞ as one would expect. When s .L N/ log(ed/N ), we follow the computation in [8] and set   dℓ ed s ∼L kξkL4 √ , ρℓ ∼L kξkL4 √ log ℓ s N 2 N and rℓ ∼L kξkL4 s s log N  ed s  . Finally, fix rbℓ ≥ rℓ and set rℓ,1 , rℓ,2 ∼L rbℓ , λℓ ∼L rbℓ2 /ρ. Applying Theorem 3.9 for these choices completes the proof of Theorem 5.3. A Additional proofs The proofs of Lemma 4.5 and Lemma 4.6 are, in fact, the same as in [8] and [10], respectively. The minor modifications to the original proofs are presented in this appendix solely for the sake of completeness and not in full detail. 26 Proof of Lemma 4.5 The proof of Lemma 4.5 follows the same path as that of Theorem 3.2 in [8]. Let us begin by examining (∗) = Qf,f ∗ (j) + Mf,f ∗ (j) + λ(Ψ(f ) − Ψ(f ∗ )) in the set {f ∈ F : Ψ(f − f ∗ ) = ρ}. If Ψ(f − f ∗ ) = ρ one should consider two cases. First, if kf − f ∗ kL2 ≥ r then by the triangle inequality for Ψ, and since Qf,f ∗ (j) ≥ Ckf − f ∗ k2L2 and Mf,f ∗ (j) ≥ −(C/4)kf − f ∗ k2L2 , we have C kf − f ∗ k2L2 − λΨ(f − f ∗ ) 4 3C 2 r − λρ > 0 , − λρ ≥ 4 (∗) ≥ Ckf − f ∗ k2L2 − ≥ 3C kf − f ∗ k2L2 4 provided that λ≤ 3C r 2 · . 4 ρ (A.1) (A.2) If, on the other hand, kf −f ∗ kL2 ≤ r, then Qf,f ∗ (j) ≥ 0 and Mf,f ∗ (j) ≥ −(C/4)r 2 . Therefore, (∗) ≥ − C 2 r + λ(Ψ(f ) − Ψ(f ∗ )) . 4 Fix v ∈ Bf ∗ (ρ/20) and write f ∗ = u + v; thus Ψ(u) ≤ ρ/20. Set z to be a linear functional that is norming for v and observe that for any f ∈ E, Ψ(f ) − Ψ(f ∗ ) ≥ Ψ(f ) − Ψ(v) − Ψ(u) ≥ z(f − v) − Ψ(u) ≥ z(f − f ∗ ) − 2Ψ(u) ρ . (A.3) ≥ z(f − f ∗ ) − 10 Hence, if f ∗ ∈ Fℓ and f ∈ F ∩ Bf ∗ (ρ) ∩ Df ∗ (r) then optimizing the choices of v and of z, z(f − f ∗ ) ≥ ∆ℓ (ρ, r); thus Ψ(f ) − Ψ(f ∗ ) ≥ ∆ℓ (ρ, r) − And, if λ≥ ρ 7 ≥ ρ. 10 10 C r2 · , 2 ρ we have that (A.4) (A.5) C 2 7 r +λ· ρ>0 . 4 10 In other words, if λ is chosen to satisfy both (A.2) and (A.5), f ∈ F and Ψ(f − f ∗ ) = ρ, it follows that Qf,f ∗ (j) + Mf,f ∗ (j) + λ(Ψ(f ) − Ψ(f ∗ )) > 0 . (∗) ≥ − Next, if Ψ(f − f ∗ ) > ρ, there are θ ∈ (0, 1) and h ∈ F that satisfy Ψ(h − f ∗ ) = ρ and θ(f − f ∗ ) = h − f ∗ . 27 If kh − f ∗ kL2 ≥ r, then by the triangle inequality for Ψ followed by (A.1), (∗) ≥ ≥ 1 1 Qh,f ∗ (j) + (Mh,f ∗ (j) − λΨ(h − f ∗ )) θ2 θ 1 (Qh,f ∗ (j) + Mh,f ∗ (j) − λΨ(h − f ∗ )) > 0 . θ If, on the other hand, kh − f ∗ kL2 ≤ r, then (∗) ≥ ≥ ≥ 1 Mh,f ∗ (j) + λ(z(f − f ∗ ) − 2Ψ(u)) θ 1 (Mh,f ∗ (j) + λ (z(h − f ∗ ) − 2θΨ(u))) θ 1 (Mh,f ∗ (j) + λ (z(h − f ∗ ) − 2Ψ(u))) > 0 , θ because 0 ≤ θ < 1 and using (A.3). Now, all that remains is to control f ∈ F ∩ Bf ∗ (ρ) and show that if kf − f ∗ kL2 ≥ r, then Qf,f ∗ (j) + Mf,f ∗ (j) + λ(Ψ(f ) − Ψ(f ∗ )) > 0 . This follows from (A.1). Proof of Lemma 4.6 The first part of Lemma 4.6 is identical to Lemma 5.1 from [10], with the trivial modification that the constant −C/4 replaces −3C/4 used in [10]. The second part of Lemma 4.6 was not needed in [10], but its proof follows the same path as Lemma 5.1 from [10]. ∗ Set √ fix f ∈ F that satisfies kf − f kL2 ≤ r. Recall that m = N/n and p r = rbℓ and that n/N ≤ θr/σ4 for a well-chosen constant θ that depends only on L and τ . Set U = (f − f ∗ )(X) · (f ∗ (X) − Y ) and observe that m Mf,f ∗ = 1 X Ui . m i=1 It follows from the convexity of F that EU = E(f − f ∗ )(X) · (f ∗ (X) − Y ) ≥ 0; therefore, Mf,f ∗ ≥ Mf,f ∗ − EMf,f ∗ . Also, P r (|Mf,f ∗ − EMf,f ∗ | > t) ≤ t−1 E|Mf,f ∗ − EMf,f ∗ |, and by a straightforward symmetrization argument, m E|Mf,f ∗ − EMf,f ∗ | ≤ 2E 2 1 X εi Ui ≤ √ (E|U |2 )1/2 . m m i=1 Applying Assumption 3.1, it is evident that (E|U |2 )1/2 ≤ kf ∗ (X) − Y kL4 · kf − f ∗ kL4 ≤ Lrσ4 , and thus P r (|Mf,f ∗ √ 2Lσ4 r n 2Lrσ4 τ √ = − EMf,f ∗ | > t) ≤ √ ≤ , t m 3 t N 28 where we use the fact that p n/N ≤ √ θr/σ4 and select t = Cr 2 /8 and θ = θ(τ, L). Therefore,  τ P r Mf,f ∗ ≤ −(C/8)r 2 ≤ , 3 and with probability at least 1 − 2 exp(−cτ 2 n),  j : Mf,f ∗ (j) ≥ −(C/8)r 2 ≥ (1 − τ /2)n. (A.6) The rest of the argument is identical to the proof of Lemma 5.1 from [10]: let H be a maximal separated subset of F ∩ Bf ∗ (ρ) ∩ Df ∗ (r) with respect to the L2 norm, of cardinality exp(cτ 2 n/2), and with the following property: for any f ∈ F ∩ Bf ∗ (ρ) ∩ Df ∗ (r) there is h ∈ H for which kf − hkL2 ≤ ε and E(f ∗ (X) − Y )(f (X) − h(X)) ≥ 0; (A.7) here ε denotes the mesh of the net. The existence of such a separated set is established in [10] (see Lemma 5.3), and one may show that the mesh ε is a small proportion of r. By (A.6), we have that with probability at least 1 − 2 exp(−cτ 2 n/2), for every h ∈ H  j : Mh,f ∗ (j) ≥ −(C/8)r 2 ≥ (1 − τ /2)n. (A.8) For every f ∈ F ∩ Bf ∗ (ρ) ∩ Df ∗ (r) let πf ∈ H be as in (A.7), and at the heart of the proof of Lemma 5.4 in [10] is that with probability at least 1 − 2 exp(−c1 τ 2 n), sup f ∈F ∩Bf ∗ (ρ)∩Df ∗ (r)  j : Mf,f ∗ (j) − Mπf,f ∗ (j) ≤ −(C/8)r 2 ≤ τn . 2 (A.9) Combining (A.8) and (A.9), there is an event of probability at least 1 − 2 exp(−c2 τ 2 n) on which for any f ∈ F ∩Bf ∗ (ρ)∩Df ∗ (r) there is a set of coordinate blocks (Ij )j∈J , of cardinality |J| ≥ (1 − τ )n and for j ∈ J, Mf,f ∗ (j) ≥ Mπf,f ∗ (j) + (Mf,f ∗ (j) − Mπf,f ∗ (j)) ≥ − C 2 r . 4 Acknowledgements We thank the referees for valuable suggestions that significantly helped us improve the presentation. References [1] J.-Y. Audibert and O. Catoni. Robust linear least squares regression. The Annals of Statistics, 39:2766–2794, 2011. [2] P. Bellec, G. Lecué, and A. Tsybakov. Slope meets lasso: improved oracle bounds and optimality. arXiv preprint arXiv:1605.08651, 2016. [3] C. Brownlees, E. Joly, and G. Lugosi. Empirical risk minimization for heavy-tailed losses. Annals of Statistics, 43:2507–2536, 2015. 29 [4] D. Hsu and S. Sabato. Approximate loss minimization with heavy tails. Computing Research Repository, abs/1307.1827, 2013. [5] G. Lecué and M. Lerasle. arXiv:1701.01961, 2017. Learning from MOM’s principles. arXiv preprint [6] G. Lecué and S. Mendelson. Sparse recovery under weak moment assumptions. Journal of the European Mathematical Society, 19(3):881–904, 2017. [7] G. Lecué and S. Mendelson. Learning subgaussian classes: Upper and minimax bounds. In S. Boucheron and N. Vayatis, editors, Topics in Learning Theory. Societe Mathematique de France, 2018, to appear. [8] G. Lecué and S. Mendelson. Regularization and the small-ball method I: sparse recovery. Annals of Statistics, to appear. [9] M. Lerasle and R.I. Oliveira. Robust empirical mean estimators. manuscript, 2012. [10] G. Lugosi and S. Mendelson. Risk minimization by median-of-means tournaments. Journal of the European Mathematical Society, 2018, to appear. [11] G. Lugosi and S. Mendelson. Sub-gaussian estimators of the mean of a random vector. Annals of Statistics, 2018, to appear. [12] S. Mendelson. Learning without concentration. Journal of the ACM, 62:21, 2015. [13] S. Mendelson. Local vs. global parameters—breaking the Gaussian complexity barrier. Annals of Statistics, 45(5):1835–1862, 2017. [14] S. Mendelson. On aggregation for heavy-tailed classes. Probability Theory and Related Fields, 168(3):641–674, 2017. [15] S. Mendelson. On multiplier processes under weak moment assumptions. Geometric Aspects of Functional Analysis, Lecture notes in Mathematics, 2169:301–318, 2017. [16] S. Mendelson. An optimal unrestricted learning procedure. preprint, 2017. [17] S. Minsker. Geometric median and robust estimation in Banach spaces. Bernoulli, 21:23082335, 2015. [18] R. Tibshirani. Regression shrinkage and selection via the lasso. Journal of the Royal Statistical Society, Series B., 58:267–288, 1996. 30
10math.ST
Regularity of line configurations arXiv:1608.02134v3 [math.AG] 2 Oct 2017 Bruno Benedetti 1 Michela Di Marca 2 Matteo Varbaro 3 Dept. of Mathematics Dip. di Matematica Dip. di Matematica University of Miami Università di Genova Università di Genova [email protected] [email protected] [email protected] October 2, 2017 Dedicated to the memory of Tony Geramita Abstract We show that in arithmetically-Gorenstein line arrangements with only planar singularities, each line intersects the same number of other lines. This number has an algebraic interpretation: it is the Castelnuovo–Mumford regularity of the coordinate ring of the arrangement. We also prove that every (d − 1)-dimensional simplicial complex whose 0-th and 1-st homologies are trivial is the nerve complex of a suitable d-dimensional standard graded algebra of depth ≥ 3. This provides the converse of a recent result by Katzman, Lyubeznik and Zhang. Introduction The study of lines on smooth surfaces of P3 has a fascinating history. Lines on smooth cubics were investigated in the Nineteenth century by Cayley [Ca1849], Salmon [Sa1849], and Clebsch [Cl1861], among others. Every smooth cubic contains exactly 27 lines, whose pattern of intersection is independent of the chosen cubic. In 1910 Schoute showed that the 27 lines can be put into a one-to-one correspondence with the vertices of a 6-dimensional polytope, so that all incidence relations between the lines are mirrored in the combinatorial structure of the polytope [Sch1910] [DuV1933]. The situation changes drastically for surfaces of larger degree. In fact, the generic surface of degree d ≥ 4 contains no line at all. However, special smooth surfaces do contain lines (they are forced to be in a finite number whenever d ≥ 3 though). An example of a smooth quartic containing 64 lines was found in 1882 by Schur [Sc1882]: x40 − x0 x31 = x42 − x2 x33 . 1 Supported by NSF Grant 1600741, ‘Geometric Combinatorics and Discrete Morse Theory’ Supported by PRIN 2010S47ARA 003, ‘Geometria delle Varietà Algebriche.’ 3 Supported by PRIN 2010S47ARA 003, ‘Geometria delle Varietà Algebriche.’ 2 1 In 1943 B. Segre [Se1943] claimed that a smooth quartic may contain at most 64 lines, which is precisely the number achieved by Schur’s quartic. Segre’s proof, however, was based on the erroneous assumption that a line on a smooth quartic can meet at most 18 other lines on it. In 2015 the work of Rams and Schütt [RS2015] exhibited smooth quartics in which some line actually meets 20 other lines. Using a deeper argument, however, Rams and Schütt were able to salvage Segre’s conclusion that indeed no smooth quartic contains more lines than Schur’s. We are naturally intrigued by the symmetry that many of these line configurations on smooth surfaces seem to enjoy. For example: (i) each line on a smooth cubic meets exactly 10 of the others; (ii) each line on the Schur quartic meets exactly 18 of the others; (iii) each line on the degree-d Fermat surface meets exactly 4d − 2 of the others. Where does this regularity come from? Schoute’s “polytopal bijection” offers an explanation only for (i). The main result of the present paper provides a general, two-line answer to this question. Theorem I (Theorem 1.3). In any arithmetically-Gorenstein line arrangement X ⊆ Pn where all singularities are planar, each line intersects exactly reg X − 1 of the other lines. The planarity of all singularities is necessary: Without it, we can only claim that each line intersects at least reg X − 1 of the other lines, cf. [BV2015, Theorem 3.8]. But curves on a smooth surface have by definition only planar singularities. In particular, if a line arrangement X ⊆ P3 is the complete intersection of a smooth surface of degree d and another surface (not necessarily smoooth) of degree e, Theorem I reveals that each line of the arrangement must intersect exactly d + e − 2 of the other lines. This, as we will see in the subsection on line arrangements in P3 , explains cases (i), (ii) and (iii) above. From Theorem I one can easily infer the following: Corollary II (Corollary 1.4). Let X be a smooth surface, H a very ample divisor, X ⊆ Pn the embedding given by the complete linear system |H|. Let D1 , . . . , Ds be lines on X ⊆ Pn such that D1 + . . . + Ds ∼ dH for some d ∈ Z>0 . (i) If n = 3, then |{j 6= i : Dj ∩ Di 6= ∅}| = deg H + d − 2 for each i = 1, . . . , s. (ii) If X is a K3 surface, then |{j 6= i : Dj ∩ Di 6= ∅}| = d + 2 for each i = 1, . . . , s. Theorem I can also be viewed as a step forward in the problem of computing the Castelnuovo-Mumford regularity of a subspace arrangement, studied among others by Derksen–Sidman [DS2002]. The second section of the present paper is devoted to the related problem of understanding the geometry of a simplicial complex that is attached to any standard graded C-algebra R, called the Lyubeznik complex or the nerve complex of R, and here denoted by L(R). A recent result by Katzman, Lyubeznik and Zhang [KLZ2015] states that when e 0 (L(R); C) = H e 1 (L(R); C) = 0. We show the converse: depth R ≥ 3 one has H Theorem III (Theorem 2.4). For any (d − 1)-dimensional simplicial complex ∆ with e 0 (∆; C) = H e 1 (∆; C) = 0, there exists a d-dimensional standard graded C-algebra R such H that depth R ≥ 3 and L(R) = ∆. Our construction has the advantage of being compatible with the dual graph notion, in the sense that the dual graph of R is simply the 1-skeleton of ∆. 2 Notation Let K be a field, and X a projective scheme over K. Fix a closed embedding X ⊆ Pn , and let IX ⊆ K[x0 , . . . , xn ] =: S the corresponding saturated ideal. Let RX := S/IX be the corresponding coordinate ring. We say that X ⊆ Pn is arithmetically-Gorenstein if RX is Gorenstein. Furthermore, the Castelnuovo-Mumford regularity of X ⊆ Pn is reg X := max{j − i : TorSi (IX , K)j 6= 0}. T We say that X ⊆ Pn is a subspace arrangement if IX = si=1 pi where the pi ’s are generated by linear forms. We say that X ⊆ Pn is a line arrangement if it is a subspace arrangement and dim S/pi = 2 for all i = 1, . . . , s. By the dual graph of X, denoted by GX , we mean the simple graph whose vertices are the s irreducible components X1 , . . . , Xs and whose edges are {{i, j} : dim Xi ∩ Xj = dim X − 1} The valency of a vertex is the number of vertices adjacent to it. (This is usually called “degree” in graph theory, but we refrain from this notation to avoid confusion.) We denote by δ(GX ) the minimum valency of a vertex. By ∆(GX ) we denote the maximum valency. If all vertices have the same valency (say, k), we say that the graph GX is regular (or has regularity k). The graph GX is k-connected if it has at least k + 1 vertices and the deletion of less than k vertices from GX , however chosen, yields a connected graph. It is easy to see that if GX is k-connected, then δ(GX ) ≥ k. The distance of two vertices is the smallest number of edges of a path connecting them. The maximum distance in a graph is called (graph) diameter. It is well known that any k-connected graph with n vertices has diameter at most ⌊ n+k−2 ⌋. k 1 The two notions of regularity coincide Let us start by showing that the dual graph of an arithmetically-Gorenstein line arrangement need not be regular. Recall that by [BV2015, Theorem 3.8] we have the inequality reg X − 1 ≤ δ(GX ) ≤ ∆(GX ). Example A. Let I ⊂ Q[x, y, z, t, w] be the following ideal: I = (x2 − y 2 + z 2 − t2 , xz − yt, xw). With the help of the software Macaulay2 [Mac2], one can immediately verify that I is the intersection of the following 8 prime ideals. p1 = (t, y − z, x) p2 = (t, y + z, x) p3 = (z − t, y, x) p4 = (z + t, y, x) p5 = (w, z − t, x − y) p6 = (w, z + t, x + y) p7 = (w, y + z, x + t) p8 = (w, y − z, x − t) Hence, I defines an arrangement X ⊂ P4 of 8 lines. One can check that the dual graph is GX = 12, 13, 14, 18, 23, 24, 27, 34, 35, 46, 57, 58, 67, 68. While the first four vertices have valency 4, the remaining four vertices have valency 3. Being a complete intersection of three quadrics, X has regularity 4. In conclusion, δ(GX ) = 3 and ∆(GX ) = reg X = 4. 3 The graph of Example A is “very close” to being 3-regular. In fact, it has minimum valency equal to reg X − 1 and maximum valency equal to reg X. This triggers two questions: (1) Is perhaps δ(GX ) always equal to reg X − 1? (2) Is there an upper bound on how large the gap ∆(GX ) − reg X can be? Our next step is to provide a negative answer to both questions. It turns out that even when the dual graph of X is regular, the graph-theoretic regularity of GX may be arbitrarily larger then the Castelnuovo–Mumford regularity of X. Proposition 1.1. For any integers n, d ≥ 2, there is a complete intersection X ⊆ Pn+1 of Castelnuovo–Mumford regularity nd − n + 1 whose dual graph is (dn − 1)-regular and (dn − 1)-connected. Proof. Let f1 , . . . , fn be generic homogeneous polynomials of degree d in K[x0 , . . . , xn ]. Let Y ⊆ Pn be the projective scheme defined by the ideal J = (f1 , . . . , fn ). Since the fi ’s are generic, the ideal J is a radical complete intersection, so Y ⊆ Pn consists of dn distinct points. Consider the cone X ⊆ Pn+1 of Y . This is an arrangement of dn lines in Pn+1 . Being a complete intersection, X is arithmetically-Gorenstein and reg X = nd − n + 1. Since all lines in X pass through [0, . . . , 0, 1] ∈ Pn+1 , the dual graph of X is the complete graph on dn vertices. We are now ready for our main result. Definition 1.2 (Planar singularities). A curve (X, OX ) over K has only planar singularities if ∼ [ O X,P = K[[x, y]]/IP for all P ∈ X and for some IP ⊆ K[[x, y]]. For line arrangements in Pn , this boils down to the following condition: whenever three or more lines come together at a single point, all those lines must belong to the same plane. Of course, every line arrangement where no three lines meet at a common point, yields an example of a curve with only planar singularities. By definition, any curve lying on a smooth surface has only planar singularities. Theorem 1.3. Let X ⊆ Pn be an arithmetically-Gorenstein line arrangement with only planar singularities. The dual graph GX is (reg X − 1)-regular and (reg X − 1)-connected. Proof. Choose an arbitrary ordering L1 , . . . , Ls of the lines of X. Let d be the number of lines intersecting the last line Ls . We are going to show that d = reg X − 1, whence the conclusion follows by reshuffling the order. Ts−1 Ts pi . Let I = i=1 pi ⊆ S = K[x0 , . . . , xn ] be the defining ideal of X ⊆ Pn . Set J = i=1 The ideal J + ps defines the scheme Ls ∩ (L1 ∪ L2 ∪ . . . ∪ Ls−1 ), which is possibly not reduced, and whose underlying topological space consists of k ≤ d points of Ls . Hence we can find a polynomial g ∈ S of degree h, where k ≤ h ≤ d, such that J + ps = ps + (g). Q Note that h = d: in fact, g = ki=1 qiai , where qi is the equation of Pi in Ls ; since Pi is a planar singularity of X, the number ai counts the lines of X that are different from Ls and pass through Pi . In particular, TorSn (S/(J + ps ), K)n−1+d 6= 0. 4 But Proj(S/J) is geometrically linked to Ls by X; it follows that S/J is a 2-dimensional Cohen–Macaulay ring, and in particular TorSn (S/J, K) = TorSn (S/ps , K) = 0. (1) Now, consider the short exact sequence 0 → S/I → S/J ⊕ S/ps → S/(J + ps ) → 0. Applying Tor and using equation (1), we see that there is an injection TorSn (S/(J + ps ), K)n−1+d ֒→ TorSn−1 (S/I, K)n−1+d . So also TorSn−1 (S/I, K)n−1+d 6= 0. By definition of Castelnuovo–Mumford regularity, we obtain reg(S/I) ≥ d. On the other hand, the graph G(X) is reg(S/I)-connected by [BV2015, Theorem 3.8]. In any k-connected graph, no vertex can have less than k neighbors. This means that reg(S/I) ≤ d. Hence d = reg(S/I) = reg X − 1. Corollary 1.4. Let X be a smooth surface, H a very ample divisor, X ⊆ Pn the embedding given by the complete linear system |H|, and D1 , . . . , Ds lines on X ⊆ Pn such that D1 + . . . + Ds ∼ dH for some d ∈ Z>0 : (i) If n = 3, then |{j 6= i : Dj ∩ Di 6= ∅}| = deg H + d − 2 for each i = 1, . . . , s. (ii) If X is a K3 surface, then |{j 6= i : Dj ∩ Di 6= ∅}| = d + 2 for each i = 1, . . . , s. S Proof. Consider the line arrangement Y := si=1 Di ⊆ Pn . Being contained in a smooth surface, it has only planar singularities. If n = 3, then Y ⊆ P3 is the scheme-theoretic intersection of X and some surface of degree d. In particular, it is arithmetically-Gorenstein of Castelnuovo–Mumford regularity deg H + d − 2. This settles part (i). For (ii): By definition the embedding X ⊆ Pn is linearly normal. So it is projectively normal by results of Saint-Donat [Sa1974]. We claim that H 1 (X, OX (k)) = 0 for all k ∈ Z. Since KX ∼ 0 and H 1 (X, OX ) = 0, in characteristic 0 this claim would immediately follow by the Kodaira vanishing and Serre’s duality. However one can easily argue in any characteristic, by considering the following short exact sequence: 0 → OX (k − 1) → OX (k) → OH (k) → 0. Because H 0 (X, OX (k)) ∼ = H 0 (H, OH (k)) for all k ≤ 0 and H 0 (X, OX (k)) = 0 for all k < 0, the map H 1 (X, OX (k − 1)) → H 1 (X, OX (k)) is injective for all k ≤ 0. Since H 1 (X, OX ) = 0 we therefore infer by induction that H 1 (X, OX (k)) = 0 for all k ≤ 0. Since KX ∼ 0, by Serre’s duality we obtain that H 1 (X, OX (k)) = 0 for all k ∈ Z, and the claim is proven. Hence, the embedding X ⊆ Pn is arithmetically Cohen-Macaulay. Yet KX ∼ 0, so the embedding is also arithmeticallyGorenstein of (Castelnuovo–Mumford) regularity 4. Since Y ⊆ Pn is scheme-theoretically the intersection of X with a hypersurface of degree d in Pn , it is arithmetically-Gorenstein of regularity d + 3. 5 Applications to line arrangements in P3 Having codimension 2, for curves in P3 the properties of being a complete intersection and that of being arithmetically-Gorenstein are the same. Before digging into examples, we would like to clarify in what sense it is restrictive for a line arrangement to live in a three-dimensional ambient space. Lemma 1.5. Let X ⊆ P3 be a line arrangement. If X is the complete intersection of two surfaces of degree d and e respectively, then the diameter of GX is at most min{d, e}. Proof. By [BV2015, Theorem 3.8], GX is a (d + e − 2)-connected graph on de vertices. Hence the diameter is at most ⌊ de+(d+e−2)−2 ⌋, a quantity never larger than min{d, e}. d+e−2 Proposition 1.6. A graph G is the dual graph of a line arrangement in Pn , for some n ≥ 3, if and only if it is the dual graph of some line arrangement in P3 . However, some graphs are dual to complete intersection line arrangements Y ⊆ Pn for some n ≥ 4, but cannot be realized as dual graph of any complete intersection line arrangement X ⊆ P3 . Proof. Let Y ⊆ Pn be a line arrangement such that G = GY . The secant variety Z of Y ⊆ Pn has dimension at most 3, so if n ≥ 4 there is a point P ∈ Pn \ Z. Denoting by π the projection from P to some P3 ( Pn not containing P , then X := π(Y ) ⊆ P3 is a line arrangement isomorphic to Y . This settles the first part of the claim. However, the complete intersection property is not preserved under projections. In fact, consider \ I = (a1 b1 , a2 b2 , a3 b3 ) = (ai , bj : i ∈ σ, j ∈ / σ) ⊆ S = K[x0 , . . . , x4 ], σ⊆{1,2,3} where ai and bi are linear forms of S such that dimK hai , bj : i ∈ σ, j ∈ / σi = 3 for all 4 σ ⊆ {1, 2, 3}. Clearly, I defines an arrangement of 8 lines in P which is a complete intersection. Note that its dual graph has diameter 3. Now, suppose by contradiction that some complete intersection line arrangement X ⊆ P3 had the same dual graph. Then X would consist of 8 lines. Let f, g be the two homogeneous polynomials such that (f, g) = IX . From the fact that deg f · deg g = 8 we infer that min{deg(f ), deg(g)} is either 1 or 2. Yet the diameter of GX is 3, which contradicts Lemma 1.5. We are now ready to discuss a few famous examples of line arrangements in P3 . For some of them, the property of being a complete intersection is not at all obvious. For this reason and for didactical purposes, we examine each example in detail. Example B. (Lines From Two Rulings) The complete bipartite graph Km,n is the dual graph of a line arrangement. This can be realized in any smooth quadric in P3 , by picking m lines from one of the two rulings of the quadric, and then by picking n further lines from the other ruling. The resulting arrangement A ⊆ P3 was studied by Geramita–Weibel [GW1985] and later by Teitler–Torrance [TT2015], who computed the Castelnuovo-Mumford regularity and classified the arithmetical Cohen–Macaulayness of A in terms of m and n. Assuming m, n ≥ 3, A is arithmetically Cohen–Macaulay if and only if the integers m and n differ by 0 or 1 [TT2015, Theorem 1.2]. We claim that A is a complete intersection if and only if m = n. The “only if” part follows from Theorem 1.3 (or from a direct argument). For the “if” part: when m = n, 6 the arrangement A is the complete intersection of the quadric with a union of n planes. Since any edge in the dual graph corresponds to a pair of coplanar lines, the choice of the n planes correspond to the choice of a complete matching of the graph. Example C (Twenty-Seven Lines). Any smooth cubic surface Y in P3 contains exactly 27 lines. Any such cubic Y is isomorphic to the blow-up of the projective plane P2 along 6 points P1 , . . . , P6 . The 27 lines can be described as follows: (a) the exceptional divisor Ei corresponding to Pi , with i ∈ {1, . . . , 6} (for a total of 6 lines of this type); (b) the strict transform Lij of the line in P2 that passes through Pi and Pj , with i, j ∈ {1, . . . , 6} and i < j (which yields a total of 15 further lines); (c) the strict transform Ci of the unique conic in P2 that passes through all points except Pi , with i ∈ {1, . . . , 6} (6 further lines). Let B be the line arrangement given by the 6 + 15 + 6 = 27 lines and let GB be the dual graph of B. Consistently with the above notation, we denote by Ei , Lij and Ci the vertices of GB . Then, by construction, GB consists of the following edges: • {Ei , Lhk } if and only if i = h or i = k; • {Lij , Ck } if and only if i = k or j = k; • {Ei , Cj } if and only if i 6= j. • {Lij , Lhk } if and only if {i, j} ∩ {h, k} = ∅. It is straightforward to check that GB is a 10-connected 10-regular graph. Theorem 1.3 confirms this fact. Indeed, B has only planar singularities and is the complete intersection of the cubic with the union of 9 planes. (Each triangle in GB corresponds to a plane, the one containing the three lines, and GB can be partitioned into 9 triangles.) Example D (Steiner set). A Steiner set is a line arrangement given by 3 sets of 3 lines each, where each line is incident with 2 from each of the other two sets. In the notation of Example C, let GB be the dual graph of an arrangement B of 27 lines on some smooth cubic Y . Let GC be the subgraph of GB induced on the following vertices: {E1 , E2 , E3 } ∪ {Lij | 1 ≤ i < j ≤ 3} ∪ {C1 , C2 , C3 }. This GC is 4-regular, it has 9 vertices and 18 edges. The subarrangement C of B dual to GC is a Steiner set. We can partition GC in 3 triangles given by the triples of lines: {E1 , L12 , C2 }, {E2 , L23 , C3 }, {E3 , L13 , C1 }. Each triple of lines lies on a plane, so the line arrangement C lies on the union Z of the three planes. So we have C ⊆ Y ∩ Z, and for degree reasons the inclusion must be an equality. Thus C ⊆ P3 is a complete intersection of the smooth cubic Y and a union Z of three planes. Theorem 1.3 claims in fact that GC is (3 + 3 − 2)-regular. Example E (Schläfli’s double-six). Let GD be the bipartite graph on {a1 , . . . , a6 } ∪ {b1 , . . . , b6 } such that {ai , bj } is an edge if and only if i 6= j. Clearly GD is a 5-regular graph. Schläfli’s double-six is a line arrangement D ⊆ P3 having GD as dual graph; it consists of 12 of the 27 lines on a smooth cubic Y , and precisely E1 , . . . , E6 , C1 , . . . , C6 , with the notation of Example C. 7 Since GD is 5-regular and triangle-free, by picking the intersection points of D we get a set S of 30 distinct points such that any line of D passes through exactly 5 points of S. Next, choose 4 non-coplanar points x, y, v, w outside the cubic, and consider the set S ′ = S ∪ {x, y, v, w}. Since the linear system of quartics of P3 has dimension 34, we can find a quartic Z passing through all points of S ′ . Since Z contains 5 points for each line of D, then it must contain D. In addition, Z cannot contain the cubic Y (otherwise Z would be Y union a plane, against the choice of x, y, v, w). Then Y ∩Z is a complete intersection of degree 12 containing D; and the equality D = Y ∩ Z follows because deg D = 12. This is in accordance with Theorem 1.3, which states that GD is (4 + 3 − 2)-regular. Contrarily to the previous examples, the graph GD has diameter 3 > 2. This is somehow unexpected to us, so we would like to pose the following: Question 1.7. Given a positive integer d, is there always some complete intersection line arrangement X ⊆ P3 such that GX has diameter d? Notice that a line arrangement as above should be the complete intersection of two surfaces of degree ≥ d, by Lemma 1.5. Higher-degree surfaces. As mentioned in the introduction, the generic smooth surface of degree d ≥ 4 contains no line. Furthermore, by a result of B. Segre [Se1943], any smooth surface of degree d ≥ 4 cannot contain more than (d − 2)(11d − 6) lines. Examples of smooth surfaces in P3 with many lines are those of equation F (x0 , x1 , x2 , x3 ) = φ(x0 , x1 ) − ψ(x2 , x3 ), where φ and ψ are two arbitrary homogenous polynomials of degree d. As shown in [BS2007], in this case the maximal number of lines Nd is given, for d ≥ 3, by the formula  64 if d = 4,     180 if d = 6,    256 if d = 8, Nd = 864 if d = 12,     1600 if d = 20,    2 3d otherwise. The maximum is almost always achieved by the degree-d Fermat surfaces, which contains exactly 3d2 lines; for d = 4 the maximum is achieved by the Schur’s quartic. Below we examine these two examples more closely. Example F (Schur’s quartic). Schur’s quartic S [Sc1882] is the complex surface defined by the polynomial F (x0 , x1 , x2 , x3 ) = x40 − x0 x31 − x42 + x2 x33 . This is a particular example of polynomial of the type φ(x0 , x1 ) − ψ(x2 , x3 ), with ψ = φ. Schur’s quartic contains an arrangement E of 64 lines. We claim that E is a complete intersection. To see this, we first compute explicitly the lines of E, by looking at the 8 automorphisms of P1 that fix the four roots of φ (cf. the proof of [BS2007, Thm. 3.1]); such a group looks like A4 . Choose the 4 even permutations       1234 1234 1234 . , d= , c= a = id, b = 2143 4321 3412 To these 4 permutations correspond 4 quadrics that, up to reordering the roots of φ, are defined by Qa = x0 x3 − x1 x2 , Qb = x0 (2ζ 2x2 + x3 ) − x1 (−x2 + ζx3 ), Qc = x0 (2x2 + x3 ) − x1 (−x2 + x3 ), Qd = x0 (−2ζ 2 x2 − ζx3 ) − x1 (ζx2 − x3 ), where ζ is a primitive 3rd root of unity. Each quadric contains 8 lines of S. Moreover, no line of S belongs to two of the above four quadrics since |{a(i), b(i), c(i), d(i)}| = 4 for i = 1, . . . , 4. Hence, the union of the 4 quadrics contains exactly 32 of the lines of S. Let us call E1 the arrangement formed by these lines. Being F irreducible, the ideal I1 = (F, Qa Qb Qc Qd ) is a complete intersection; and since it contains 32 lines, for degree reasons it follows that I1 is itself the ideal of E1 . It remains to find the ideal I2 of the arrangement E2 formed by the remaining 32 lines. For this we have to consider the remaining 8 automorphisms of P1 that fix the roots of φ, corresponding to the 8 permutations in A4 different from a, b, c, d. Each automorphism yields a quadric having 8 lines in common with S: 4 in the first ruling (already contained in E1 ), and 4 in the second ruling. The latter, ranging over the 8 quadrics, are the remaining 32 lines. With the help of Macaulay2 [Mac2], we verified that I2 is generated by F and by the irreducible octic surface P = 80x30 x51 + x81 + 64x20 x21 x42 + 64x30 x1 x32 x3 + 8x41 x32 x3 + 64x62 x23 − 64x20 x21 x2 x33 + 8x30 x1 x43 + x41 x43 + 16x32 x53 + x83 Hence, I2 is also a complete intersection. It follows that the ideal I defining the whole arrangement E of the 64 lines is a complete intersection given by I = (F, P Qa Qb Qc Qd ). Accordingly with Theorem 1.3, the dual graph of E is 18-regular. Moreover, E can be partitioned into two subarrangements E1 and E2 that are themselves complete intersections; in particular, in E each line of E1 meets exactly 4 + 8 − 2 = 10 lines of E1 and 18 − 10 = 8 lines of E2 . Symmetrically, each line of E2 meets ten lines from E2 and eight from E1 . Very recently, Degtyarev, Itenberg and Sertoz proved that, up to projective equivalence, there is a unique smooth quartic with 64 lines over C [DIS2016]. As a consequence, 64 lines on a smooth quartic over C are always a complete intersection, and always satisfy the combinatorial properties outlined above. Example G (Lines on Fermat surfaces). Let Fd ⊆ P3 be the Fermat surface of degree d given by the equation xd0 + xd1 + xd2 + xd3 = 0. Let us denote by ζ1 , ζ2, . . . , ζd the d-th 9 roots of unity. Let us also fix a primitive 2d-th root of unity ω. Adapting the notations in [SSV2010], let us list the lines of Fd as follows (both i and j range from 1 to d): l1 (i, j) = {[λ, ωζi λ, µ, ωζj µ]}, l2 (i, j) = {[λ, µ, ωζiλ, ωζj µ]}, l3 (i, j) = {[λ, µ, ωζj µ, ωζiλ]}. This yields an arrangement F of 3 · d · d = 3d2 lines. The dual graph GF consists of the following edges: 1. {la (i, j), la (h, k)} iff i = h or j = k, a = 1, 2, 3; 2. {l1 (i, j), l2 (h, k)} iff i − j = h − k mod d; 3. {l1 (i, j), l3 (h, k)} iff i + j = h − k mod d; 4. {l2 (i, j), l3 (h, k)} iff i + j = h + k mod d. We can partition the vertex set of GF into 3d copies of the complete graph Kd . In fact, if we fix (a, i) ∈ {1, 2, 3} × {1, . . . , d}, the induced subgraph corresponding to the set of lines F(a,i) := {la (i, j), j = 1, . . . , d} is complete. So each set of lines F(a,i) spans a plane πa,i in P3 . Hence, F can be seen as the complete intersection of the surface Fd with the union of the 3d planes πa,i just described. In particular, one has reg X = d + 3d − 1 = 4d − 1. One can see from the description above that GF is a (4d − 2)-regular graph. This is consistent with Theorem 1.3: being Fd smooth, the arrangement F has only planar singularities. Note also that the Fermat surface of degree d = 3 is a smooth cubic. Since the dual graph does not depend on the chosen cubic, the dual graph of “27 lines on a smooth cubic” is thus a particular case of the dual graph of “3d2 lines on the Fermat surface”. Example H (A 12-line arrangement different than Schläfli’s). For d ≥ 3, let Fd be the degree-d Fermat surface and let πa,i be the 3d planes described in Example G. For some integer h ∈ {1, . . . , 3d}, choose h of these 3d planes and let Πh be their union. By the construction explained in Example G, the intersection Fh = Fd ∩ Πh is a subarrangement of F , consisting of exactly hd lines. Clearly Fh is a complete intersection and the dual graph GFh has regularity h + d − 2. If we choose the degree-3 Fermat surface as smooth cubic, the “Steiner set” can be viewed as the case h = 3, d = 3 of this construction. Let us focus instead on the case h = 4, d = 3. This yields a 12-line arrangements with 30 intersection points that is different than Schläfli’s double six. In fact, the graph GD of Example E has diameter 3 and it is bipartite, whereas GF4 has diameter 2 and contains triangles. However, because of Theorem 1.3, both graphs GD and GF4 are 5-regular. In many of the above examples, we considered the arrangement consisting of all the lines on some smooth surface in P3 , and noticed that the dual graph is regular. Unfortunately, this is not always the case, as shown by the examples in [Ra2004]. However we would like to pose the following question: Question 1.8. Let d ≥ 3 and X ⊆ P3 be a smooth surface of degree d containing the maximum possible number of lines (among the smooth surfaces of degree d). Is it true that there is a natural number N such that each of the lines meets exactly N of the others? As remarked in the above examples the answer is yes for d = 3 and, over the complex numbers, for d = 4. Furthermore by Theorem 1.3, the answer would be yes in general if the divisor of the lines was linearly equivalent to a multiple of the hyperplane section. 10 2 The nerve complex Let R be a standard graded ring with R0 = C. Let m be its homogenous maximal ideal. Let p1 , . . . , ps be the minimal primes of R. The nerve complex or Lyubeznik complex L(R) is the simplicial complex on the vertices 1, . . . , s described by p {i1 , . . . , ik } is a face ⇐⇒ pi1 + . . . + pik 6= m. Equivalently, if X = Proj R and X1 , . . . , Xs are its irreducible components, one could describe the nerve complex as follows: {i1 , . . . , ik } is a face ⇐⇒ Xi1 ∩ . . . ∩ Xik is nonempty. It is a straightforward consequence of Borsuk’s Nerve Lemma that any simplicial complex ∆ is homotopy equivalent to L(C[∆]), where C[∆] is the usual notation for the Stanley–Reisner ring of ∆. However, ∆ and L(C[∆]) are not homeomorphic in general: for example, when ∆ is a simplex, L(C[∆]) consists of a single point. In 1962, Hartshorne [Har1962, Prop. 2.1] showed that if R is a standard graded ring and depthR ≥ 2, then Proj R is connected; or equivalently, e 0 (L(R); C) = 0. H Recently, Katzman, Lyubeznik and Zhang proved the following beautiful extension: Theorem 2.1 ([KLZ2015]). If R is a standard graded ring and depthR ≥ 3, then e 0 (L(R); C) = H e 1 (L(R); C) = 0. H It is not clear whether the obvious generalization to higher depth is true: the proof given in [KLZ2015] relies on the fact that, because depthR ≥ 3, the cohomological dimension of the complement of Proj R in Pn (embedded by the linear system R1 ) is no more than n − 2, as proven by the third author [Va2013]. However, the latter fact is false for higher depths. The theorem of [KLZ2015] naturally suggests the question: what about the converse? Question 2.2. Given a simplicial complex ∆ with vanishing 0-th and 1-st homology, is it the Lyubeznik complex of a ring of depth ≥ 3? Without any “depth request”, the answer is known. Every simplicial complex ∆ is the nerve of some ring: in fact, even of some Stanley–Reisner ring. Here is a simple construction illustrating this fact that was suggested to us by Alessio D’Alı̀. Lemma 2.3. Let ∆ be a simplicial complex on n vertices and dimension d − 1. Let N be the number of facets of ∆. Let M be the maximum, taken over all vertices v of ∆, of the number of facets containing v. There is a simplicial complex Γ on s vertices, with N ≤ s ≤ n + N, and of dimension either M − 1 or M, such that L(C[Γ]) = ∆. (Or in the words of combinatorialists: The nerve of Γ coincides with ∆.) 11 Proof. Let 1, . . . , n be the vertices of ∆, and let F1 , . . . , FN be its facets. Let A1 , . . . , An be subsets of [N] defined as follows: Ai = {j ∈ [N] s.t. i ∈ Fj }. These Ai ’s might not be facets of some simplicial complex, because a priori it can happen that some Ai is contained in some other Ai′ . This can be fixed as follows: if Ai is contained in some Ai′ , with i 6= i′ , we update the set Ai by adding to it the integer N + i. Let now Γ be the simplicial complex generated by the A1 , . . . , An . By construction, the intersection of Ai1 , . . . , Aik is non-empty if and only if {i1 , . . . , ik } is contained in a facet of ∆. If we try to use the construction above to gather information on the depth of Γ, however, we are doomed. In fact, from Γ one cannot even recover the dual graph of ∆. Moreover, the dimension of Γ can be arbitrarily larger (or also smaller) than dim ∆. To bypass these difficulties and tackle Question 2.2, we need to introduce a more geometric construction. Theorem 2.4. Let ∆ be a (d − 1)-dimensional simplicial complex d ≥ 2. There exists a d-dimensional standard graded C-algebra R = R(∆) such that: (i) L(R) = ∆; (ii) the dual graph of R is the 1-skeleton of ∆. e 0 (∆; C) = 0, then one can choose R such that depth(R) ≥ 2; and if Furthermore, if H e e H0 (∆; C) = H1 (∆; C) = 0, then one can choose R so that depth(R) ≥ 3. Proof. Let us fix a total order σ1 , . . . , σr of the minimal non-faces of ∆, so that dim σi < dim σj ⇒ i > j, that is, higher-dimensional non-faces are listed first. Let us choose an arrangement of n hyperplanes in Pd (where n is the number of vertices of ∆) such that for each subset A ⊆ [n] = {1, . . . , n} \ dim Hi = max{−1, d − |A|}. i∈A This condition is obviously met if the hyperplanes are generic. Let now X(σ1 ) be the T d blow-up of P along j∈σ1 Hj . For each j ∈ [n], let Hj (σ1 ) be the strict transform of Hj in X(σ1 ). Recursively, for each i ∈ {2, . . . , r} T we denote • by X(σi ) the blow-up of X(σi−1 ) along j∈σi Hj (σi−1 ), and • by Hj (σi ) the S strict transform of Hj (σi−1 ) in X(σi ), for each j ∈ [n]. Consider Y := nj=1 Hj (σr ). Being a blow-up of a projective scheme, by the blow-up lemma there exists a d-dimensional standard graded C-algebra R such that Proj R = Y . By construction, L(R) = ∆. Furthermore, the dual graph of such an R is the 1-skeleton of ∆. This shows items (i) and (ii). Note also that the irreducible components of Y and their nonempty intersections are smooth rational varieties. We are now left with the last two claims. First of all we observe that L(R) = ∆ is the nerve complex of Y associated to the covering {Hj (σr )}j=1,...,n . A smooth rational variety 12 over C is simply connected (see [De2001, Corollary 4.18]), then by the extended version of the nerve lemma [Bj2003, Theorem 6], we have H i (Y ; C) ∼ = H i (∆; C) for i = 0, 1. (2) By the genericity of the hyperplanes Hj ⊆ Pd , Y has only simple normal crossing singularities. So the natural maps H i (Y ; C) −→ H i (Y ; OY ) are surjective for all i. Furthermore we have the Kodaira vanishing (e.g. [Ko1995, 9.12]): H i (Y ; OY (k)) = 0 ∀ k < 0, i < d − 1. Denoting with m the unique homogeneous maximal ideal of R, this translates into Hm1 (R)k = Hm2 (R)k = 0 ∀ k < 0. Obviously we can choose R such that Hm0 (R) = 0. Finally, by replacing R with a high enough Veronese, we will also have that Hm1 (R)k = Hm2 (R)k = 0 for all k > 0. Since dimC Hm1 (R)0 = dimC H 0 (Y ; C) − 1 and dimC Hm2 (R)0 = dimC H 1 (Y ; C), the conclusion follows by (2). Acknowledgments. We are indebted to Winfried Bruns, for a question to the third author that eventually inspired Theorem 1.3; to Bernd Sturmfels, for drawing our attention to the 27 lines; to Daniele Faenzi, for suggesting applications to K3 surfaces; to Alessio D’Alı̀, for Lemma 2.3. The second and third author wish also to thank the math department of the University of Miami for the warm hospitality in February 2016. References [BV2015] B. Benedetti, M. Varbaro, On the dual graph of Cohen-Macaulay algebras, Int. Math. Res. Not. 2015, no. 17, pp. 8085-8115. [Bj2003] A. Björner, Nerves, fibers and homotopy groups, J. Comb. Theory A 102 (2003) 88–93. [BS2007] S. Boissière, A. Sarti, Counting lines on surfaces, Ann. Sc. Norm. Super. Pisa Cl. Sci. (5) 6 (2007), no. 1, 39-52. [Ca1849] A. Cayley, On the triple tangent planes of surfaces of the third order, Cambridge and Dublin Math. J. 4 (1849) 118–138. [Cl1861] A. Clebsch, Zur Theorie der algebraischer Flächen, J. Reine Angew. Math. 58 (1861), 93–108. [De2001] O. Debarre, Higher-dimensional algebraic geometry, Universitext, Springer-Verlag, New York, 2001. [DIS2016] A. Degtyarev, I. Itenberg, A.S. Sertoz, Lines on quartic surfaces, Math. Ann. (2017) 368–753. [DS2002] H. Derksen, J. Sidman, A sharp bound for the Castelnuovo-Mumford regularity of subspace arrangements, Adv. Math. 172, pp. 151–157, 2002. [DuV1933] P. Du Val, On the directrices of a set of points in a plane. Proc. London Math. Soc. Ser. 2 35 (1933), 23–74. 13 [GW1985] A. V. Geramita and C. A. Weibel, On the Cohen-Macaulay and Buchsbaum property for unions of planes in affine space, J. Algebra 92 (1985), no. 2, 413–445 [Mac2] D.R. Grayson, R. Daniel, M.E. Stillman, Macaulay2, a software system for research in algebraic geometry, Available at http://www.math.uiuc.edu/Macaulay2/. [Har1962] R. Hartshorne, Complete intersection and connectedness, Amer. J. Math. 84, pp. 497-508, 1962. [KLZ2015] M. Katzman, G. Lyubeznik, and W. Zhang, An extension of a theorem by Hartshorne, Proc. Amer. Math. Soc. 144 (2016), no. 3, 955–962. [Ko1995] J. Kollar, Shafarevic Maps and Automorphic Forms, Princeton University Press, 1995. [Ra2004] S. Rams, Projective surfaces with many skew lines, Proc. Amer. Math. Soc.133 (2004), no. 1, 11–13. [RS2015] S. Rams, M. Schütt, 64 lines on smooth quartic surfaces, Math. Ann. 362 (2015), no. 1-2, 679–698. . [Sa1974] B. Saint-Donat, Projective models of K3 surfaces, Amer. J. Math. 96 (1974) 602–639. [Sa1849] G. Salmon, On the triple tangent planes to a surface of the third order, Cambridge and Dublin Math. J. 4 (1849) 252–260. [Sch1910] P. H. Schoute, On the relation between the vertices of a definite six-dimensional polytope and the lines of a cubic surface. Proc. Roy. Acad. Amsterdam 13 (1910), 375–383. [Sc1882] F. Schur, Über eine besondere Classe von Flächen vierter Ordnung, Math. Ann. 20 (1882) 254–296. [SSV2010] M. Schütt, T. Shioda, and R. Van Luijk, Lines on Fermat Surfaces, J. Number Theory 130 (2010), no. 9, 1939-1963. [Se1943] B. Segre, The maximum number of lines lying on a quartic surface, Quart. J. Math., Oxford Ser. 14 (1943), 86-96. [TT2015] Z. Teitler, D.A. Torrance, Castelnuovo-Mumford regularity and arithmetic CohenMacaulayness of complete bipartite subspace arrangements, J. Pure Appl. Algebra 219 (2015), no. 6, 2134–2138. [Va2013] M. Varbaro, Cohomological and projective dimensions, Compos. Math. 149 (2013), 1203–1210. 14
0math.AC
arXiv:1309.1780v1 [cs.CE] 6 Sep 2013 Software Abstractions and Methodologies for HPC Simulation Codes on Future Architectures A. Dubey, S. Brandt, R. Brower, M. Giles, P. Hovland, D.Q. Lamb, F. Löffler, B. Norris, B, O’Shea, C. Rebbi, M. Snir, R. Thakur September 10, 2013 Large, complex, multi-scale, multi-physics simulation codes, running on high performance computing (HPC) platforms, have become essential to advancing science and engineering. Progress in computational science, together with the adoption of high-level frameworks and modular approaches, have enabled large code development efforts such as FLASH [1, 7, 9], Cactus [5, 6], Enzo [10, 11] and the Lattice QCD code suite [2, 3, 4]. These codes simulate multi-scale, multi-physics phenomena with unprecedented fidelity on petascale platforms, and are used by large communities. Increasing the capabilities of these codes and maintaining their ability to run on future platforms are as crucial to these communities as continued improvements in instruments and facilities are to experimental scientists. However, the ability of code developers to do these things faces a serious challenge with the paradigm shift underway in platform architecture from coarse grained parallelism with few highly capable processors, to fine grained parallelism with many less capable and more heterogeneous processors. The complexity of the future platforms makes it essential to approach this challenge cooperatively as a community. We need to develop common abstractions, frameworks, programming models and software development methodologies that can be applied across a broad range of complex simulation codes, and common software infrastructure to support them. We believe that such an infrastructure is critical to the deployment of existing and new large, multi-scale, multi-physics codes on future HPC platforms. Furthermore, such an infrastructure should be assembled by a collaborative effort of the teams that develop and maintain such codes – that is, by the people that own the problem, not by people that own solutions looking for a problem. The needs of the expert programmers who are developing complex, high-performance simulation codes are quite different than the needs of the broader community. Furthermore, the number of such software developers is small; their needs are therefore often ignored. There is need to foster cooperation among the small number of teams that develop such codes, leading to a more viable ecosystem; and cooperation of these teams with computer science researchers and vendors, leading to a better understanding of the needs of this small community. Also, there is usually a gap between computer science research in areas such as code abstractions and transformations and high-level scientific application software. The gap exists for many reasons, including lack of communication between the communities involved, limits on extensibility and adaptability of scientific software, and differing real and perceived requirements by different application domains. It would be beneficial to the applications community with HPC to overcome these and other barriers to finding and implementing broad, reusable solutions and common software infrastructure 1 to support the deployment of existing and new multi-scale, multi-physics codes on future HPC platforms. This would also be a huge leap forward for the concerned science domains. A similar transformation took place in the 1990s when the groups developing large scientific codes recognized the need for adopting software engineering practices to sustain code reliability in face of rapid capability growth. Each group went its own way and customized some of the prevalent ideas for its own use, many times developing their own tools. However, a close examination of the adopted practices reveals a surprising number of commonalities; object-oriented design, version control, coding standards, unit testing, regression testing, verification frameworks, release policies, contribution policies etc. A shared infrastructure would not only have reduced development costs, but would have facilitated code sharing. To understand the kind of change software must undergo to adapt to new computing platforms, we first consider the current characteristics of the codes in our target community. They are typically implemented in one or more of C, C++, or Fortran. Parallel computations are implemented primarily using MPI, OpenMP, or a hybrid approach. Underlying the particular simulation implementations are a variety of mesh types, with or without adaptive refinement support, and a number of implicit and explicit solvers with one or more implementations of each method. Applicationspecific (I/O-intensive) checkpointing schemes are typically used for fault tolerance and to provide restart capabilities. Some simulation codes rely on externally developed numerical libraries, while others are mostly self-contained, with few external dependencies. The report of the 2011 Workshop on Exascale Programming Challenges [8] discusses in depth many of the challenges that scientific software is facing in the near future, ranging from programming models to runtime systems. Many of these challenges are not limited to extreme scales and are present even now in HPC codes as they are faced with ever increasing levels of parallelism and heterogeneity at any scale. We briefly overview these software challenges • Numerical methods and frameworks. Certain disruptive architecture changes may require rethinking of numerical approaches. Identifying the methods critical to our target communities will be critical in assessing the applied mathematics research and development required to effectively use future platforms. A number of numerical frameworks provide a means of integrating a number of solution methods and underlying data structures. Adapting the framework to new platforms is one way in which multiple applications can successfully migrate to new paradigms without significant reimplementation of application code. • Programming Models. The programming model (e.g., MPI) used in a particular application and its supporting infrastructure is a fundamental, pervasive aspect of the implementation. Switching between programming models is labor-intensive and may require significant redesign of key algorithms, as well as massive code rewrites. At the same time, it is difficult to estimate a priori the benefits of moving to a different programming model, for example, when switching from a pure distributed memory MPI-based implementation to a model that supports a global shared memory view. • Performance Portability. Effective utilization of HPC resources is historically a balancing act between portability and performance. On one hand, extensive performance optimizations of certain key computations are crucial for achieving good performance on a certain platform. On the other hand, making such changes permanent negatively impacts code readability and performance on other platforms. it is important to identify and eliminate barriers to enabling greater flexibility in choosing among different optimized implementations. Another critical aspect of future performance portability is the ability to support different levels and types of parallelism. • Resilience. Current codes’ reliance on checkpointing for error correction will be prohibitively expensive on large-scale systems; hence, new ways of ensuring resilience are required, which may involve changes in programming models, runtimes, and application design and implementation. • Productivity and Maintainability. Alternative technical approaches to managing increased levels of parallelism, heterogeneity and other architectural features have different impact on programmer effort and software maintainability. Furthermore, complex codes do not allow easy testing of new concepts and thus slow down advances in both the scientific and numerical approaches. We must understand the current and desired mode of development in our target communities to guide the approach to design decisions. It is a given that the changes will be disruptive, but the degree of disruption can be reduced by working together as a community. We are working on conceptualization of a Software Institute to address these concerns, and are conducting workshops under the project that bring together domain experts in several scientific fields and manufacturing sectors, software developers who are involved in implementing and optimizing many of the large codes for these fields and sectors, researchers in applied computer science, and hardware and software vendors in a series of workshops and focus groups to gather a variety of perspectives and broad expertise. The goal of the workshops has been, and will continue to be defining and developing possible approaches toward common abstractions and frameworks. This exercise can potentially produce a three-fold benefit to the S2I2 program and to the community: (1) several large scientific and engineering codes ready for and adaptable to generations of heterogeneous and many-core platforms; (2) a common software infrastructure that is applicable across a broad range of science and engineering application domains; and (3) a model for interaction between computer science research and application development that takes interesting and promising research ideas from simplified problems to real world applications. References [1] FLASH user’s guide. URL http://flash.uchicago.edu/site/flashcode/user_support/flash4_ug. [2] The chroma library for lattice http://usqcd.jlab.org/usqcd-docs/chroma. field theory, . URL [3] Quda: A library for qcd on gpus, . URL http://lattice.github.com/quda. [4] Usqcd sofware releases, . URL http://usqcd.jlab.org/usqcd-software. [5] G. Allen, W. Benger, T. Goodale, H.-C. Hege, G. Lanfermann, A. Merzky, T. Radke, E. Seidel, and J. Shalf. The cactus code: a problem solving environment for the grid. In The Ninth International Symposium on High-Performance Distributed Computing, 2000. Proceedings, pages 253–260, Pittsburgh, PA, August 2000. [6] Cactus Computational Toolkit URL http://www.cactuscode.org/. [7] A. Dubey, K. Antypas, M.K. Ganapathy, L.B. Reid, K. Riley, D. Sheeler, A. Siegel, and K. Weide. Extensible component-based architecture for FLASH, a massively parallel, multiphysics simulation code. Parallel Computing, 35(10-11):512–522, 2009. [8] Exascale Programming Challenges Report. Ascr programming challenges for exascale computing. http://science.energy.gov/~/media/ascr/pdf/program-documents/docs/ProgrammingChallengesW 2011. [9] B. Fryxell, K. Olson, P. Ricker, F. X. Timmes, M. Zingale, D. Q. Lamb, P. MacNeice, R. Rosner, J. W. Truran, and H. Tufo. FLASH: An adaptive mesh hydrodynamics code for modeling astrophysical thermonuclear flashes. Astrophysical Journal, Supplement, 131:273–334, November 2000. doi: 10.1086/317361. [10] M.L. Norman, G.L. Bryan, R. Harkness, J. Bordner, D. Reynolds, B. O’Shea, and R. Wagner. Petascale Computing: Algorithms and Applications, chapter Simulating Cosmological Evolution with Enzo, pages 83–102. Chapman & Hall/CRC, 2008. Arxiv preprint arXiv:0705.1556. [11] B. W. O’Shea, G. Bryan, J. Bordner, M. L. Norman, T. Abel, R. Harkness, and A. Kritsuk. Introducing Enzo, an AMR cosmology application. In T. Plewa, L. Timur, and V.G. Weirs, editors, Adaptive Mesh Refinement – Theory and Applications, volume 41 of Lecture Notes in Computational Science and Engineering. Springer, 2005.
5cs.CE
Using Cognitive Computing for Learning Parallel Programming: An IBM Watson Solution Adrián Calvo Chozas, Suejb Memeti, and Sabri Pllana arXiv:1704.01513v1 [cs.PL] 5 Apr 2017 Linnaeus University, Växjö 351 95, Sweden [email protected] [email protected] [email protected] Abstract While modern parallel computing systems provide high performance resources, utilizing them to the highest extent requires advanced programming expertise. Programming for parallel computing systems is much more difficult than programming for sequential systems. OpenMP is an extension of C++ programming language that enables to express parallelism using compiler directives. While OpenMP alleviates parallel programming by reducing the lines of code that the programmer needs to write, deciding how and when to use these compiler directives is up to the programmer. Novice programmers may make mistakes that may lead to performance degradation or unexpected program behavior. Cognitive computing has shown impressive results in various domains, such as health or marketing. In this paper, we describe the use of IBM Watson cognitive system for education of novice parallel programmers. Using the dialogue service of the IBM Watson we have developed a solution that assists the programmer in avoiding common OpenMP mistakes. To evaluate our approach we have conducted a survey with a number of novice parallel programmers at the Linnaeus University, and obtained encouraging results with respect to usefulness of our approach. 1 Introduction The modern parallel computing systems provide capabilities to solve complex computational and engineering problems [23] faster. Programming for parallel computing systems is much more complex than programming for sequential processors [22, 16], because it requires knowledge of the underlying parallel architecture and the programming models libraries (that are often device specific), and consideration of large amount of device specific configuration parameters (such as, numbers of cores, core speed, memory hierarchy level, cache, run-time system, etc) [21]. To alleviate the programmability challenges of parallel computing systems [12, 2, 25], various parallel programming models and languages [5] are proposed, including OpenMP, OpenACC, MPI, Pthreads, OpenCL, Cuda, and Intel TBB. While these approaches have helped to significantly reduce the programming effort, writing more complex code requires more effort, advanced knowledge of parallel algorithms and underlying architecture and is more prone to mistakes that may lead to incorrect program behavior or performance degradation [8]. To efficiently utilize the available resources on the modern parallel computing systems, programmers require adequate education [3]. OpenMP (Open Multi-Processing) is an Application Program Interface (API) that comprises a set of compiler directives, variables and library functions to program parallel computing systems. OpenMP is implemented as language extension of C, C++ and Fortran [4] for shared-memory parallel computing systems, and recent versions of OpenMP support also the heterogeneous computing systems. The main goal of OpenMP is to reduce the difficulty of writing parallel applications. It does that by using compiler directives, known as pragmas. 1 Using Cognitive Computing for Learning Parallel Programming A. C. Chazos, S.Memeti, and S. Pllana However, it is up to the programmer to decide how and when to use these directives. Even though, the available documentation suggests that using OpenMP is simple and easy, Gonçalves et al. [8] show that using OpenMP is not as easy as it appears, and such suggestions may lead to code that provides incorrect results or poor performance [17, 18]. Furthermore, Kolosov et al. [13] and Süß et al. [24] has identified a number of commonly made OpenMP mistakes, and they have categorized them in logical and performance related errors. Cognitive systems [15] are on the verge of becoming a milestone due to their ability to process natural language processing (NLP). This enables a whole new level of interaction between humans and computing systems, which may help people make better decisions. IBM Watson [6] is a cognitive system that uses the natural language to receive and answer questions. It is able to handle unstructured data, which composes 80% of the data available on the Web. IBM Watson learns a new subject by storing all the documents related to the topic on its own database, in which it later searches for the most suitable answer. Recently various solutions based on the IBM Watson have demonstrated impressive results [14]. For example, in 2011 the Watson Dialog service won at Jeopardy against two human former winners. Then, in 2012 Watson helped oncologists to extract valuable information to treat patients. Standard Bank is using Watson to solve customers’ queries. The American Cancer Society is using Watson to provide better answers to patients. In this paper, we describe the use of cognitive computing to aid novice programmers learn parallel programming. We have developed an application based on the IBM Watson services that enables a dialog-based interaction with programmers during program development. Our solution is focused on helping novice programmers to avoid commonly made mistakes when they use OpenMP. We have implemented our solution to support interaction with the programmer in English and Spanish. Furthermore, we have conducted a survey to evaluate the usability of our solution. The results of the survey indicate that the developed application offers valuable answers that would be helpful for novice parallel programmers. The key contributions of this paper are: • A multi-language IBM Watson application that aids novice programmers to learn parallel programming with OpenMP, • Evaluation of usability of our IBM Watson application. The rest of the paper is organized as follows. In Section 2 we discuss the related work. Section 3 describes the methodology and implementation details. In Section 4 we first describe the context of the conducted survey, thereafter we discuss the results of the survey. We conclude our paper and provide future research directions in Section 5. 2 Related Work Goel et al. [7] used different Watson services to develop six diverse applications that aim at understanding the functionality and capabilities of Watson and enhancing the human-computer co-creativity. By developing these diverse applications the authors argue that Watson has potential to be used in different domains, and has large range of opportunities to be used as an educational tool. Witte et al. [26] uses natural language processing to bring new levels of support to software developers. A plug-in that is integrated in the Eclipse IDE is developed, which provides quality analysis of the comment found in source code and version control commits. The aim of this project is to help software developers reduce the effort required to analyze their code 2 Using Cognitive Computing for Learning Parallel Programming A. C. Chazos, S.Memeti, and S. Pllana by extracting useful information that might be valuable to understand the functionality of the application that is not always obvious by looking at the source code only. An interactive tool for parallelization of OpenMP sequential programs is proposed by Ishihara et al. [11]. This tool provide four types of assistance to the developers, including analysis of the parallelism, identification of candidate parallel sections, enhancing the parallelism through code restructuring, and analysis of the execution time. Harms [9] proposes an approach that is able to monitor and understand the programming skill level of the developer and adaptively suggest code examples that may help to learn new programming concepts found within the suggested examples. The author argues that this approach avoid overwhelming the memory of novice programmers by considering the previous knowledge of the programmer and carefully suggesting examples that contain new information. Sah and Vaidya [20] review, discuss characteristics and classify existing parallelization tools based on: (1) the time the tools were developed (before or after the multicore era); (2) their contribution during the parallelization process, and (3) the ability to provide assistance for parallel programming. Furthermore, they propose their parallel programming tool that assist developers during the software development time. In contrast to the related work, we use cognitive computing to assist programmers in avoiding common logical and performance mistakes. Our solution is based on the IBM Watson dialogue service and focuses on OpenMP. 3 Our methodology In this section first we will describe the design of our approach thereafter we will provide some implementation details. 3.1 Design Our application is based on the IBM Watson Dialog service to provide communication means between the user and the system through natural language processing with the aim to avoid common OpenMP mistakes. The architecture overview of our application is depicted in Figure 1. The users interact with our application using an interface, which allows them to write questions in text form. The user that will presumably be a parallel programmer will use the interface to ask a question related to parallel programming. Please note that as is usual in natural language, the question can be formulated in several ways. For accessibility, the interface may be enhanced with voice recognition or connected to some kind of integrated development environment. The interface sends the user input to our application, which is connected to the Watson Dialog Service. The dialog service analyzes the questions and gathers information that it needs to provide the most suitable answer for the user. To extend the functionality of our application, one can connect the application to additional services such as speech-to-text services. The application is connected to a back-end system that is responsible to display the answer of the question to the user. At this point, the application has the answer for the user. There are two scenarios, (1) the question has been understood and application provides a proper answer to the user, and (2) the question has not been understood and a default message saying “I am sorry, I did not understand your question. Please try another question.”is provided to the user. The overview of the IBM Watson dialog service is illustrated in Figure 2. The dialog service provides means for communication between computers and the users in a question-and-answer fashion through natural language. To use this service, first the training data should be gathered 3 A. C. Chazos, S.Memeti, and S. Pllana Back-end System Using Cognitive Computing for Learning Parallel Programming Users Interface Dialog Service Application Other Services Figure 1: Architecture overview Prepare Data Design dialog flows Push live to users Iterate, optimize, add content Figure 2: An overview of the Watson Dialog Service and prepared by an expert. As our aim is to provide a tool that aids novice parallel programmers write parallel code using OpenMP, we considered to use as training data the common OpenMP mistakes identified by Kolosov et al. [13] and Süß et al. [24]. By the time of writing this paper, there are 32 commonly identified mistakes 1 , however due to space limitations we have listed only some of them in Table 1. The gathered data should be translated into dialog models that is part of the dialog flow design process. For instance, the common OpenMP mistake where programmers redefine the number of threads within a parallel loop, will be translated in a dialog fashion where the input would be like: Can I change a variable inside a pragma omp loop?. Figure 3 depicts the interaction with the programmer in English and Spanish. The push live to users enables the connection of the dialog service with the user interface, and monitoring the conversations. The last component enables dynamic learning from real interactions by adjusting the existing content and adding new one based on the user activity. 3.2 Implementation Details In order to build an application that uses IBM Watson Dialog service the developer needs to specify the mandatory settings for the service as shown in the Listing 1. For example, the AUTOLEARN (see line 4) setting allows the dialog to suggest another node when the input does not match. The LANGUAGE (see line 3) setting allows the user to determine the account (a) English (b) Spanish Figure 3: Example of interaction with the programmer in English and Spanish 1 The list of all 32 identified OpenMP mistakes can be found in: https://software.intel.com/en-us/articles/32openmp-traps-for-c-developers 4 Using Cognitive Computing for Learning Parallel Programming A. C. Chazos, S.Memeti, and S. Pllana Table 1: Common OpenMP mistakes identified by Kolosov et al. [13] and Süß et al. [24]. Performance errors Reason Unnecessary flush If flush directive is used without parameters, it can reduce the performance of the program. The atomic directive is faster than critical. When atomic cannot be used, the compiler will not allow the programmer to use it. Local thread variables should not be protected from concurrent writing It is known that critical regions reduce the performance of the program so using critical is generally not recommended. Using critical instead of atomic Unnecessary protection from concurrent memory write Overwork in a critical region Logical errors Reason Missing /openmp If OpenMP is not enabled in the compiler settings, the OpenMP directives will be ignored If the programmer forgets to put the parallel keyword, the code will run sequentially If omp keyword is forgotten the entire pragma will be ignored If the programmer want to divide a loop into n threads and for is forgotten, the program will not split up the work into those n threads If the programmer puts the parallel keyword inside a parallel section, the loop will be run n times If the ordered directive is not correctly indicated, the compiler will decide to order randomly Attempts to change the number of threads within a parallel region will result with run-time errors. According to the specification, to lock a variable it first needs to be initialized Locks set from one thread will cause unpredictable run-time behavior if unset from another thread If the result depends on previous iterations, order clause is compulsory in order for it not to have unexpected behaviour. When several threads are modifying a variable the result is unpredictable. Missing parallel Missing omp Missing for Unnecessary parallelization Incorrect usage of ordered Redefining the number of threads in a parallel section Lock a variable without initializing it Unsetting locks from another thread Parallel array without order Access to a share memory without protection language. Please note that we show only an excerpt of all possible settings, for the full list of available setting we refer the reader to the Watson Dialog Service documentation [10]. Listing 1: An example of settings configuration of the Dialog Service <s e t t i n g s > < s e t t i n g name=”DISPLAYNAME” t y p e=”USER”> t e s t </ s e t t i n g > < s e t t i n g name=”LANGUAGE” t y p e=”USER”>EN</ s e t t i n g > < s e t t i n g name=”AUTOLEARN” t y p e ”USER”> f a l s e </ s e t t i n g > ... </ s e t t i n g s > 1 2 3 4 5 6 The main characteristic of the Dialog service is the dialog tag, which has a mandatory child named flow that is responsible for the content of the dialog because it includes the main libraries (see Listing 2). The flow tag may have a child named folder that is used to allocate, organize and maintain the information in the dialog. There are four types of folders, Main, Library, Global, and Concepts. Listing 2: An example of the dialog tags <d i a l o g . . . x s i : noNamespaceSchemaLocation=”WatsonDialogDocument 1 . 0 . xsd”> <f l o w > < f o l d e r l a b e l =”Main”> 1 2 3 5 Using Cognitive Computing for Learning Parallel Programming A. C. Chazos, S.Memeti, and S. Pllana ... 4 The Main folder stores the welcome messages, whereas the Library folder stores the core of the dialog such as, the input (an example of the input node is shown in Listing 3), output, structures, and other valuable information. Each question is represented as an input node of the dialog service, where each node has a child grammar node, and the grammar node must have at least one child item node (see Listing 3). As the dialog service is based on natural language, each question may have multiple variations. We can configure these variations by adding multiple items inside the grammar. The first item represents the primary variation of the question. We can have multiple variations by using the wildcards $ (dollar sign) and ∗ (asterisk). When the dollar sign is used the question becomes more open as the user can type down the question in multiple ways, however the question must be followed by the first verb after the dollar sign (see Line 4 Listing 3). The questions could be: “Is it possible to change a variable inside a loop? ”, or “May I to change a variable inside a loop? ”. When the asterisk is in use it means that the place corresponding to the asterisk can be changed for another suitable word (see Line 5 Listing 3), for example: “Can I change the number of threads ...? ”, or “Is it possible to change all of the threads ...? ”. Listing 3: An example of the input node of the IBM Watson Dialog Service <i n p u t > <grammar> <item>Can I change a v a r i a b l e i n s i d e a pragma omp l o o p ?</item> <item >\$ Change a v a r i a b l e i n s i d e a l o o p ?</item> <item>change ∗ v a r i a b l e ∗ l o o p </item> </grammar> </i n p u t > 1 2 3 4 5 6 7 The output tag is a child of the input and is used to store the answers of the corresponding question.For example, the corresponding answer to the question variations represented in the input node in Listing 3 would be “It is explicitly forbidden to change the variable from inside the loop.”, and the corresponding xml node is shown in Listing 4 Listing 4: An example of the output tags <output> <prompt s e l e c t i o n T y p e=”RANDOM”> <item>I t i s e x p l i c i t l y f o r b i d d e n t o change t h e l o o p v a r i a b l e . . . < / item> </prompt> </output> 1 2 3 4 5 If the system does not understand the question or it does not have a proper answer, the system will display a default message that could be customized using the default node (see Listing 5). Listing 5: An example of the system’s default answer when no suitable response is found <default> <output> <prompt s e l e c t i o n T y p e=”RANDOM”> <item>I d i d not u n d e r s t a n d t h e q u e s t i o n . P l e a s e t r y a g a i n . </ item> </prompt> </output> </default> 1 2 3 4 5 6 7 Please note that from September 2016 IBM has retired the Dialog service, which disallows creation of new instances of this service. However, existing instances will continue to work until 6 Using Cognitive Computing for Learning Parallel Programming A. C. Chazos, S.Memeti, and S. Pllana Table 2: The questions of the conducted survey # Question 1 Do you think that such interactive assistance application can help you in parallel programming, more than search engines or paper-based resources? Do you think that the answers you have received from our tool were accurate? Do you find it useful that the application is multilingual? Would you find it useful if the application could retrieve papers as an answer? 2 3 4 August 2017. An equivalent service, so called Conversation service has been introduced, and developers are encouraged to migrate their Dialog service based applications to the Conversation service. 4 Evaluation To evaluate the usefulness of our approach we have conducted an anonymous survey within the Linnaeus University campus. The target group that we have surveyed includes bachelor students from the department of computer science that have little knowledge in parallel programming. In total, eight novice parallel programmers have accepted to take part on the survey. The process of selection of candidates, data collection and analysis, and reporting is adapted from the guidelines presented by Runeson and Höst [19]. The aim of this survey is to investigate whether such interactive tools would help novice programmers solve parallel programming problems as well as identify ways to improve our tool. To keep the survey simple, and to avoid survey fatigue of our respondents, which usually happens because surveys are too long and include non-relevant questions, we have defined a survey with only four questions. Table 2 lists the questions of our survey. To measure the performance quality of our tool we have used the Likert [1] scale system to allow respondents to rank the quality of our tool, where participants could choose answers between one and 5 stars, where One star stands for Strongly disagree, Two stars stands for Somewhat disagree, Three stars means Neither agree nor disagree, Four stars means Somewhat agree, and Five stars stands for Strongly agree. The results of the survey are depicted in Figure 4. The x-axis indicates the stars, whereas the y-axis indicates the collected points such that if question 4 received 3 points for 5 stars it means that 3 participants strongly agreed that it would be useful to enhance our tool with the ability to retrieve papers as an answer. We may observe that most of the questions received more than three stars. For instance, when asked whether our tool is more helpful than using search engines or paper-based resources, 3 participants neither agreed nor disagreed, three other participants agreed to some extent, and four of them strongly agreed. When asked whether the answers retrieved from our tool were accurate, one of the participants disagreed to some extent, two participant were neutral, two participants agreed to some extent, and three of them strongly agreed. Six of the participants strongly agreed, one agreed to some extent and another one disagreed to some extent that our tool is useful because it can respond to questions asked in different languages. Two participants disagreed to some extent and two others agreed to some extent, another one was neutral, and three others strongly agreed that enhancing our tool with the ability to retrieve paper as an answer would be useful. Table 3 shows a matrix based representation of the percentage of each question related to 7 Using Cognitive Computing for Learning Parallel Programming 7 6 A. C. Chazos, S.Memeti, and S. Pllana Question 1 Question 2 Question 3 Question 4 Points 5 4 3 2 1 0 1 2 3 Stars 4 5 Figure 4: The results of the survey. The x-axis indicates the stars, whereas the y-axis indicates the number of participants that rated a question with a specific number of stars. Table 3: matrix based representation of the survey results that shows the percentage of each question related to the answers of the participants Question Question Question Question 1 2 3 4 1-star 2-stars 3-stars 4-stars 5-stars 0% 0% 0% 0% 0% 12.5% 12.5% 25% 12.5% 25% 0% 12.5% 37.5% 25% 12.5% 25% 50% 37.5% 75% 37.5% the respondents’ answers. The results show that the application would be successful among students as they would like to have an application that can help them in parallel programming by using natural language. In the first question 87.5% of the total score corresponds to 4 stars or more, which means that the respondents highly agree with the usefulness of the application. In the second question 62.5% of the total score corresponds to 4 stars or more, which means that the respondents highly agree with the usefulness of the application. In the third question 87.5% of the total participants appreciated having multi-language support in this application. In the last question, 62.5% of the users think that enhancing our tool with the ability to retrieve papers as answers is useful. 5 Conclusion and Future Work Cognitive systems, like IBM Watson, are able to learn trough user’s input and be taught by experts. An application that uses this technology can become a milestone in the field in which it is being used due to the fact that a community can be created to improve applications, share new ideas and discover features that no one has thought of before. The usefulness of such systems has been demonstrated in various fields, such as in health care, where doctors can treat their patients better owing to previous experiences with common diseases. In this paper we have investigated the use of cognitive computing to help programmers learn 8 Using Cognitive Computing for Learning Parallel Programming A. C. Chazos, S.Memeti, and S. Pllana parallel programming. We have used the IBM Watson dialog service to enable the interaction between the user and the system in a dialog-fashion way using natural language. Our application is trained to respond to questions related to common mistakes that novice programmers do when using OpenMP, which helps them avoid such mistakes, write code that produces the correct result and runs faster. Furthermore, such systems may reduce the time investment required to learn parallel programming. Since Watson can learn from the users collected input, the application can be improved as it is used. The proposed tool can answer questions that a user may ask, but it will neither generate code nor find code errors. To evaluate the usefulness of our application, we conducted a survey with a number of novice parallel programmers. The results of the survey show that novice parallel programmers are willing to use such interactive application while writing their parallel programs and would find it useful to improve their knowledge of the subject. Furthermore, the results show that retrieving papers as answers will significantly attract users to use our application. We believe that our tool can be used as an educational resource in a beginners course in parallel programming. Future research will address the extension of our solution with additional IBM Watson services that enable automatic input of data from existing sources of parallel programming knowledge. References [1] I. E. Allen and C. A. Seaman. Likert scales and data analyses. Quality progress, 40(7):64, 2007. [2] S. Benkner, S. Pllana, J. L. Traff, P. Tsigas, U. Dolinsky, C. Augonnet, B. Bachmayer, C. Kessler, D. Moloney, and V. Osipov. PEPPHER: Efficient and Productive Usage of Hybrid Computing Systems. Micro, IEEE, 31(5):28–41, Sept 2011. [3] P. Czarnul. Teaching high performance computing using beesycluster and relevant usage statistics. Procedia Computer Science, 29:1458 – 1467, 2014. 2014 International Conference on Computational Science. [4] L. Dagum and R. Menon. Openmp: an industry standard api for shared-memory programming. IEEE computational science and engineering, 5(1):46–55, 1998. [5] J. Diaz, C. Munoz-Caro, and A. Nino. A survey of parallel programming models and tools in the multi and many-core era. IEEE Transactions on Parallel and Distributed Systems, 23(8):1369– 1386, Aug 2012. [6] D. A. Ferrucci. Introduction to “This is Watson”. IBM Journal of Research and Development, 56(3.4):1:1–1:15, May 2012. [7] A. Goel, B. Creeden, M. Kumble, S. Salunke, A. Shetty, and B. Wiltgen. Using watson for enhancing human-computer co-creativity. In 2015 AAAI Fall Symposium Series, 2015. [8] R. Gonçalves, M. Amaris, T. Okada, P. Bruel, and A. Goldman. Openmp is not as easy as it appears. 2016 49th Hawaii International Conference on System Sciences (HICSS), 00:5742–5751, 2016. [9] K. J. Harms. Towards a programming environment that adaptively suggests examples and corresponding puzzles based on programmer skill. In 2014 IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC), pages 185–186, July 2014. [10] IBM Inc. Watson Documentation. https://www.ibm.com/watson/developercloud/doc/dialog/ reference_elements.shtml#reference_setting, 2017. Online; accessed 9 February 2017. [11] M. Ishihara, H. Honda, T. Yuba, and M. Sato. Interactive parallelizing assistance tool for OpenMP: iPat/OMP. In Proc. Fifth European Workshop on OpenMP (EWOMP 03), pages 21–29, 2003. [12] C. W. Kessler, U. Dastgeer, S. Thibault, R. Namyst, A. Richards, U. Dolinsky, S. Benkner, J. L. Traff, and S. Pllana. Programmability and performance portability aspects of heterogeneous multi-/manycore systems. pages 1403–1408. IEEE, 2012. 9 Using Cognitive Computing for Learning Parallel Programming A. C. Chazos, S.Memeti, and S. Pllana [13] A. Kolosov, E. Ryzhkov, and A. Karpov. 32 OpenMP traps for C++ developers. Intel Developer Zone, 2008. [14] C. Mercer. 16 innovative businesses using IBM Watson: Which companies are using Watson’s big data and analytics to power their business? http://www.computerworlduk.com/galleries/ it-vendors/16-innovative-ways-companies-are-using-ibm-watson-3585847/, 2017. Online; accessed 9 February 2017. [15] D. S. Modha, R. Ananthanarayanan, S. K. Esser, A. Ndirango, A. J. Sherbondy, and R. Singh. Cognitive computing. Commun. ACM, 54(8):62–71, Aug. 2011. [16] S. Pllana, S. Benkner, E. Mehofer, L. Natvig, and F. Xhafa. Towards an Intelligent Environment for Programming Multi-core Computing Systems. In Euro-Par Workshops, volume 5415 of Lecture Notes in Computer Science, pages 141–151. Springer, 2008. [17] S. Pllana, S. Benkner, F. Xhafa, and L. Barolli. Hybrid performance modeling and prediction of large-scale computing systems. In 2008 International Conference on Complex, Intelligent and Software Intensive Systems, pages 132–138, March 2008. [18] S. Pllana and T. Fahringer. Performance prophet: a performance modeling and prediction tool for parallel and distributed programs. In 2005 International Conference on Parallel Processing Workshops (ICPPW’05), pages 509–516, June 2005. [19] P. Runeson and M. Höst. Guidelines for conducting and reporting case study research in software engineering. Empirical software engineering, 14(2):131, 2009. [20] S. Sah and V. G. Vaidya. A review of parallelization tools and introduction to easypar. International Journal of Computer Applications, 56(12), 2012. [21] M. Sandrieser, S. Benkner, and S. Pllana. Using Explicit Platform Descriptions to Support Programming of Heterogeneous Many-Core Systems. Parallel Computing, 38(1-2):52–56, 01 2012. [22] V. Sarkar. Programming Challenges for Petascale and Multicore Parallel Systems, pages 1–1. Springer Berlin Heidelberg, Berlin, Heidelberg, 2007. [23] A. B. Shiflet and G. W. Shiflet. Introduction to Computational Science: Modeling and Simulation for the Sciences. Princeton University Press, 2011. [24] M. Süß and C. Leopold. Common Mistakes in OpenMP and How to Avoid Them, pages 312–323. Springer Berlin Heidelberg, Berlin, Heidelberg, 2008. [25] A. Viebke, S. Memeti, S. Pllana, and A. Abraham. Chaos: a parallelization scheme for training convolutional neural networks on intel xeon phi. The Journal of Supercomputing, doi:10.1007/s11227017-1994-x, pages 1–31, 2017. [26] R. Witte, B. Sateli, N. Khamis, and J. Rilling. Intelligent Software Development Environments: Integrating Natural Language Processing with the Eclipse Platform, pages 408–419. Springer Berlin Heidelberg, Berlin, Heidelberg, 2011. 10
6cs.PL
arXiv:1407.2795v1 [cs.CE] 10 Jul 2014 A domain-specific analysis system for examining nuclear reactor simulation data for light-water and sodium-cooled fast reactors Jay Jay Billings1 ‡, Jordan H Deyton1 ,S. Forest Hull III1 §, Eric J Lingerfelt1 and Anna Wojtowicz 1 1 Oak Ridge National Laboratory PO Box 2008 MS6173 Oak Ridge, TN,37831, USA Abstract. Building a new generation of fission reactors in the United States presents many technical and regulatory challenges. One important challenge is the need to share and present results from new high-fidelity, high-performance simulations in an easily usable way. Since modern multiscale, multi-physics simulations can generate petabytes of data, they will require the development of new techniques and methods to reduce the data to familiar quantities of interest (e.g., pin powers, temperatures) with a more reasonable resolution and size. Furthermore, some of the results from these simulations may be new quantities for which visualization and analysis techniques are not immediately available in the community and need to be developed. This paper describes a new system for managing high-performance simulation results in a domain-specific way that naturally exposes quantities of interest for light water and sodium-cooled fast reactors. It describes requirements to build such a system and the technical challenges faced in its development at all levels (simulation, user interface, etc.). An example comparing results from two different simulation suites for a single assembly in a light-water reactor is presented, along with a detailed discussion of the system’s requirements and design. 1. Introduction Modeling and simulation has always played a vital role in nuclear engineering and its applications. It is becoming even more relevant as the community starts examining and constructing new types of reactors. Although existing computational models of the conventional fleet perform very well within the operational experience base of today’s power plants, they do not necessarily provide the predictive capability needed to enable the deployment of completely new designs or to enable the use of today’s designs for very different modes of operation. New simulation codes are under development in several efforts sponsored by the US Department of Energy’s Office of Nuclear Energy, including ‡ Corresponding author. Telephone: +1 865 241 6308, Email: [email protected], Twitter: @jayjaybillings § Present address: Florida Institute of Technology, 150 W. University Blvd. Melbourne, FL, 32901, USA Integrated Nuclear Simulation Data Analysis 2 those from the Nuclear Energy Advanced Modeling and Simulation (NEAMS) program [2] and the Consortium for Advanced Simulation of Light Water Reactors (CASL) [1]. These new codes are much different from the existing codes. Whereas tried-andtrue codes employ sophisticated engineering models calibrated based on experimental observation to describe system behavior, the new code suites leverage high-performance computing (HPC) platforms to provide truly predictive simulators. The new codes can examine the physics of nuclear reactors with an unprecedented resolution at spatial and temporal scales ranging from the microstructure of the fuel all the way to the plant itself, and they are commonly capable of coupling neutronics, fuel mechanics, structural mechanics, and thermohydraulics [8],[13],[16]. While they are very powerful, they inevitably generate many terabytes and even petabytes of data that greatly exceed what any single person can absorb and interpret alone. Even results that are refined through post-processing can still be gigabytes in size. Additional challenges arise when the user actually examines and reviews the results. Large tables of data, even if well-organized, are not easily consumed by humans because of their size and general lack of sufficient context to eliminate ambiguity. Furthermore, in this particular area, there are often very large numbers (fluxes, ≈ 1012 ) associated with very small numbers (displacements, ≈ 105 ) that make intuitive interpretation of the rsults difficult. More often than not, users are forced to implement their own codes on top of the post-processing routines to collect, assimilate, rescale, normalize, and plot the very small amount of data that they actually need, which is a very costly chore in terms of both time and resources. Comparing the results from new simulations to those from old simulations or experiments also requires custom code, thereby multiplying the cost of adoption. The authors assert that it is not sufficient to leave these challenges unaddressed and “pitch it over the fence” to users and analysts. Instead, just as new codes are under development to address the physics questions, new technologies need to be developed to address data analysis. The system presented in section 2 seeks to address this issue in three ways. First, it provides specialized data structures and input/output (I/O) libraries designed specifically for storing quantities of interest from nuclear simulations. Second, it provides a user interface that complements the I/O libraries to provide highly tailored views that put data in the proper context and reduce ambiguity. Finally, it provides an extension interface for adding custom analysis routines that can be easily coupled to routines for data mining and tailored analysis. An example of the utility of the system provided in section 3 demonstrates the ease with which interesting information between two codes, one new and one seasoned, can be extracted from the system. 2. Architecture A high-level overview of the system’s logical architecture is presented in Fig. 1. The system is split into three parts, one each for users who examine data, developers who store data, and those interested in implementing custom analysis routines to examine Integrated Nuclear Simulation Data Analysis 3 the data. In each case, care was taken to make sure that the workflow of the respective actor was easy and intuitive for that use case. Figure 1. A high-level Unified Modeling Language class diagram of the system’s logical architecture, highlighting its focus on interacting with different Parts, or IReactorComponents, of the reactor data. Five high-level functional and nonfunctional requirements were used to guide the detailed design of the system based on feedback from interviews and experiments with prototypes, all of which were derived from the assumption that the simulation results must be shared with one or more people. (i) The data should be organized according to the natural layout of a nuclear reactor and not on the discretized geometry of the simulation code. (ii) A data point has a position in three dimensions plus time with a value, uncertainty, and units. (iii) A reactor is composed of Parts, which are represented by custom data structures, and data can be stored for every Part (literally on every Part) available. (iv) The information is stored in a cross-platform, self-describing, binary compatible, open format. (v) The data must be easily and equally accessible from languages used for user interfaces and from languages used to author simulation codes. The need to compare data from two simulations led directly to requirement 1. Storing output data on the grid or mesh used by the simulation would allow only immediate and direct comparisons with other results from the same code unless gridpoint mapping or mesh-to-mesh transfers [14] were performed. However, storing data based on the layout of a reactor—on cores, assemblies, pins, etc.—allows for immediate comparison of results, albeit at the cost of pulling that information from the grid or Integrated Nuclear Simulation Data Analysis 4 mesh during the simulation. One drawback of this design is that some data could be lost when the grid or mesh is removed. However, this is not strictly the case, since data can be mapped to any Part in the reactor and given any position. It is extremely important that the data be stored in a binary compatible open format available on multiple platforms and readable in multiple languages (requirements 4 and 5) for three reasons. First, the subject matter experts will examine the data on workstations, not clusters or supercomputers. Second, in many situations, it must be stored in such a way that it can be reviewed if required, possibly at a much later date. Finally, someone may need to view the data who does not have the expertise to write the code to read the database but is otherwise qualified to evaluate it via a user interface. The definition of a reactor, requirement 3, loosely follows that of real light water reactors (LWRs) and sodium-cooled fast reactors (SFRs). Reactors are hierarchically composed of a set of Parts, where a Part describes both the large-scale structures of a reactor, such as assemblies, and smaller Parts like pellets or “material blocks.” Data is stored for these Parts according to the description in requirement 2, including time, space, uncertainty and dimensional information, in addition to the value of interest. Exact descriptions of the Parts of the nuclear reactors supported by this project are provided in section 3. The Parts are exactly the same in both supported languages, the user interface, and the I/O libraries. The design is general and based on publicly available information from Wikipedia, the Nuclear Regulatory Commission’s public website, and interviews with subject-matter experts. No proprietary designs are considered, and no proprietary information is used or provided, although it is certainly possible to add such Parts to the system with minimal effort. The Parts are organized in a class hierarchy of data structures that uses objectoriented design principles to take advantage of both the natural hierarchy of reactors and abstractions for similar Parts (inheritance). The two different types of reactors that are currently supported—pressurized water reactors (PWRs) and SFRs—are available in their own modules but are accessed in the same way. 2.1. Input-Output Libraries The system provides its own libraries for managing input and output to relieve software developers from the task of writing their own file parsers and emitters that conform to the shared specification. They remove the burden of writing to older data formats for developers of new codes and remove the complication of writing to newer formats, which may require significantly specialized skills, for maintainers of existing codes. Instead, developers instantiate and fill the Parts with data and then store those parts using the provided I/O routines. The workflow is shown, at a high level, in Fig. 2. In this figure, the “NiCE I/O API” represents the I/O library, and it acts as an intermediary between the simulation code and the user interface. The process is relatively simple: the developer loads the data structures needed and tells the library to write them. A user, on the other side, picks a file and the user interface loads that file. Integrated Nuclear Simulation Data Analysis 5 Figure 2. A Unified Modeling Language sequence diagram that shows the basic process by which the results computed by a simulation code are loaded in the user interface (“NiCE”) via the input-output interface, (“NiCE I/O API”). Developers may store whatever data they need on any Part. Data is stored associatively so that sets of data are stored against tags and any tag can be used. It is trivial to store data tagged with “Axial Power” right next to data tagged as “Cross sections” or “Velocity” on the same Part. Writing the data is then very simple: the developer calls a single write operation on the “highest” Part of the reactor,, which is normally the reactor core, that contains all of the other Parts the developer has. The simulation code may write multiple reactors to disk, (thus the loop in Fig. 2). Any client can read this file once it is written, such as the user interface or standalone analysis codes, using the inverse read operation with the desired data file passed as an input argument. The file layout, which is different from the format, of the I/O libraries matches the class hierarchy of the data structures with a few exceptions. For example, it is much more memory-efficient to store the units of values in individual tables and refer to the name of the units with an integer in the file because, in practice, the integer is much smaller than a fixed-length string for representing an arbitrary system of units. A much more important optimization is the reuse of large structures like assemblies and pins, where possible. The layout of a physical reactor will have only a small number of different pin types (or assemblies) relative to the total number of pins in the reactor. Integrated Nuclear Simulation Data Analysis 6 Exploiting this fact by reusing the geometry and material information both in the data structures and on disk greatly reduces the amount of memory required. This detailed analysis of the layout of the data has made it possible to read and write data for “full” cores with 50 axial levels, hundreds of assemblies, and 50,000 pins in seconds. 2.2. User Interface The ultimate goal of this system is to put simulation data into the hands of human users, and humans are much more efficient at examining visual images than raw data. The system includes a graphical user interface that presents information in multiple ways, including custom views, color maps, plots, and raw data. The user interface is designed so that users feel like they are manipulating a reactor instead of reading a paper. The most important design requirement for the user interface is that it enable users to perform comparative analysis. That is, users must be allowed to compare results among multiple reactors side-by-side, with at least one of the reactors accepted as a “gold-standard” reference. For that matter, users must be allowed to examine the same part of a reactor with multiple views of its own data—geometry, color maps, plots, and so on. Each Part has at least two associated graphical views, one each for geometric information, including assigned materials, and state point data, which is defined as the values of the quantities of interest at a given timestep. Views can be switched via a simple toolbar or by right-clicking on the canvas. It is possible to create plots for state point data for some Parts and, using specialized analysis routines, compute direct numerical comparisons (and create plots of those comparisons) between the state point data for two or more Parts. Each view can be saved as a PNG image file with a handy button on the toolbar. Three-dimensional core geometries are supported by the system, but the user interface breaks this into two xy and z views. The xy view shows a cross section of the current Part at the specified axial level. The z view is next to the xy view and shows the axial geometry. The user interface also exposes any external analysis routines that are available to users in a menu, as well as any options that can be configured for those routines. Results from the analyses are captured and presented to the user in a simple list. The file names on the local hard drive and their associate timestamps are also presented so that users can easily move the data to another system if needed. One external analysis routine is provided by default—to compute percentage differences among pins—and it is treated as a somewhat special case in that its results are automatically plotted, which is not the case for other analyses. It is possible to view the data stored in the system using other user interfaces and techniques, c.f. section 2.4. Integrated Nuclear Simulation Data Analysis 7 2.3. Integration with External Analysis Routines The system can be extended to use external analysis routines for teams or developers who want to manipulate the data in a specific way. This mechanism is provided because it is impossible for the core development team to guess all of the possible analyses, much less implement and support the capability in the long term. The routines are referred to as “external” simply because they are plug-and-play. External routines are exposed to users through the user interface. The external routines can be anything from simple math operations to large wrappers that ship the work off to other libraries. The development team has tested three such extensions to date: the differencing tool for pin powers mentioned previously, a k-means clustering routine to find clusters in the data, and a set of “routines” that wrap a very large visualization toolkit, VisIt [3], to create different plots from the default set. The differencing routine is the only external routine available by default, but more detailed information on findings with the k-means clustering routines can be found in [11]. Kmeans is a clustering algorithm used to find groups in data that can later be used for classification. Ideally, a set of external analysis routines would be available to perform classification and anomaly detection on pins and assemblies as a form of automatic data triage to locate troublesome, erroneous, or simply interesting areas of the core. Developers can add routines by implementing the “IAnalysisTool” interface shown in Fig. 1, as well as a few other interfaces associated with it, and declaring the analysis tool as a service to the framework. Analysis routines are written in Java and are dynamically consumed by the framework at runtime. Currently, only assemblies are passed to analysis tools, not reactor cores. This capability is not available in the C++ implementation, because that implementation is primarily focused on I/O for the simulation codes. Much more detailed descriptions for all of these interfaces are presented in the project documentation at the NiCE project page [4]. 2.4. Technologies The system is built with mostly off-the-shelf components and assembled as part of the NEAMS Integrated Computational Environment (NiCE), [4][6][7]. The code for developers is written in C++ so that it can be easily used with C/C++ and Fortran codes. Version five of the Hierarchical Data Format (HDF5) [15] is used to read and write the data structures to and from disk. This greatly reduces the amount of work required to satisfy the cross-platform, multi-language requirements, as HDF5 is natively available in many languages and is completely open. HDF5 also provides multiple ways to access the data in “hdf” files in Ascii, including a command line utility—h5dump— that will dump the contents to disk and a graphical utility—hdfview—for viewing the contents of any HDF5 file. The graphical user interface is implemented in the same system as NiCE, which uses the Eclipse Rich Client Platform (RCP) [10], and is written in Java. RCP is the platform on which the Eclipse Integrated Development Environment is built, is very Integrated Nuclear Simulation Data Analysis 8 flexible, and is cross-platform. It has many tools and utilities for working with graphics and connecting those graphics to data. The k-means algorithm discussed in 2.3 was implemented in-house for NiCE, based on open literature, and is available in the source code. It is not enabled by default because the development team is exploring the possibility of using third-party capabilities to replace the home-grown version, namely Apache’s Mahout [5], and enable more data mining capabilities. 3. Parts The system is composed of many Parts across the different levels of the reactor and is capable of storing data for PWRs and SFRs. The following discussion presents each Part in the system, the types of data that can be assigned to the Parts, and the visualizations available in the user interface. The data presented for PWRs is taken from real simulations performed with the Virtual Environment for Reactor Analysis (VERA) [16] and KENO [12] for problem 3a of the VERA Benchmarks [9]. This problem represents a single 17 by 17 PWR fuel assembly at the beginning of its life and at constant temperature. The assembly is refined with 49 axial levels. VERA was modified for our purposes to write the results directly to file using the data structures and I/O libraries from our system. We obtained the KENO results from the author of [9] and converted them into our system using a stand-alone program. Additional assemblies were added to the geometric configuration of problem 3a to show the system’s ability to work with assemblies other than fuel assemblies, such as in-core instruments. The results shown in the pictures for SFRs are generated and do not represent a physical system. The SFR pictures are presented solely to instruct readers about the capabilities of the data structures and the user interface. All of the graphical views below exploit object-oriented design principles to minimize the amount of custom code needed to draw the different shapes. In many places, the same code is reused to draw Parts from PWRs and SFRs. The simplicity of using this system is also noteworthy, as the estimated time for a new user to go from importing data to exporting a plot like those shown below is merely minutes and does not require any knowledge of file formats, data layouts, or scripting languages. 3.1. Part Properties Each Part has a set of properties assigned to it that represent the most common properties of the given piece, such as material, pitch, diameter, and so on. These properties can be manipulated programmatically and are viewable within the user interface in a “Properties View,” as shown in Fig. 3. Spatial data about a Part is stored by setting a data provider that includes data elements as described by requirement 2 in the Architecture section. Data providers are Integrated Nuclear Simulation Data Analysis 9 Figure 3. A view that shows the properties of the selected part, including its composition and geometry. simply containers and are capable of managing arrays of data at different times. Data providers can be stored on any Part (as required by the IReactorComponent interface). However, in practice, this can destroy performance, so some Parts manage the data providers for other Parts. 3.2. Cores Reactor cores are the highest Parts in the hierarchy at present. The PressurizedWaterReactor class represents PWRs. This class extends a generic LWR base class that defines some properties and operations common across different types of LWRs, including both PWRs and boiling water reactorsk. Assemblies of any type are stored in their own grids, so that one type of assembly can share the same position as another type, which allows for control rod (“spider”) assemblies to be added. Control banks, fuel assemblies, in-core k The latter is not yet fully supported and therefore is not discussed here. Integrated Nuclear Simulation Data Analysis 10 instruments, and “rod cluster” assemblies can be added to PWRs. Additionally, the fuel assembly pitch and the grid labels can be configured on the PressurizedWaterReactor class. Figure 4 shows the geometric view of a PWR core in the user interface for the 3a problem. The grid labels are read as configured on the PressurizedWaterReactor class and displayed along the top horizontal and left vertical axes. Each assembly is represented by a single square on the grid. The single green assembly in the middle is a 17 by 17 fuel assembly, and the yellow assemblies are control banks. The type of assembly shown can be configured using the “Assembly Type” dropdown button. Figure 4. A view of a pressurized water reactor core with one fuel assembly (green) and many control banks (yellow). The SFReactor class represents SFRs. Its interface is nearly identical to that of the PressurizedWaterReactor class, but the allowed assembly types and properties are different. Fuel, control, reflector, shield, and test assemblies can be added to SFRs. Integrated Nuclear Simulation Data Analysis 11 As for PWRs, size can be obtained for SFRs; but instead of only an assembly pitch, SFRs offer both a lattice pitch and a flat-to-flat distance. Flat-to-flat distance is stored on the core for convenience, and the system assumes that all assemblies have the same flat-to-flat distance. The graphical representation of an SFR with fuel assemblies is shown in Fig. 5. The view shows the hexagonal layout of the core and functions exactly like the view of the PWR core. Figure 5. A view of a small sodium-cooled fast reactor core with fuel assemblies in yellow and green (selected). 3.3. Assemblies Multiple assembly types can be configured for both PWRs and SFRs. Each assembly is composed of a collection of rods, and each rod is mapped to a location on a grid. “Rods” Integrated Nuclear Simulation Data Analysis 12 in this case are not necessarily fuel rods. They could be control rods, for example. The data providers that contain state point data for the rods, of any type, are stored on the assemblies at a specified grid location instead of directly on the rods. This is done to optimize data access times and storage (although they can still be stored on the rods themselves if needed). PWR assemblies can store their sizes and rod/pin pitches. SFR assemblies can store their size duct thicknesses in addition to their sizes. SFRs make a distinction between a “pin” and a “rod,” which is discussed in detail in section 3.4. PWRs make no such distinction and refer to both simply as “rods.” PWRs support • Fuel assemblies of burnable fuel that is used in the reactor. • Control banks used to regulate the power within the reactor. • Incore instruments that represent assemblies configured with detectors or sensors within a core. • Rod cluster assemblies of (typically neutron absorbing) rods placed in and moved between fuel assemblies during refueling outages. SFRs support • Fuel assemblies of burnable (inner fuel, outer fuel) and blanket (optional) assemblies. • Control assemblies that represent primary and secondary (shutdown) assemblies. • Reflector assemblies that are configured to reflect neutrons. • Shield assemblies for shielding against radiation. • Test assemblies that represent assemblies used for testing materials and fuels. The geometry of one quarter of the PWR fuel assembly from problem 3a is shown in Fig. 6. Rods are represented by circles, with control rods represented by blue circles and fuel rods represented by red circles. The blue spaces between rods represent the coolant. The rods are arranged according to the pitch and size configured on the assembly. The “main” view on the left represents the axial level (1 in the figure) selected using the slider, spinner, or clickable axial view on the right. Like the core view, the grid labels are taken on, configured on, and read from the assembly and displayed on the top horizontal and left vertical axes. The tool bar can be used to switch this view from the geometric configuration to a view of the simulation data, as depicted in Fig. 7. The axial pin powers for problem 3a for the entire fuel assembly are shown in this view. Each square represents a rod, and the color mapping is bluer for lower values and redder for higher values. (The circles from the geometric view have been replaced with squares to make it easier to show the data values.) The color mapping in this figure was normalized for the selected axial level (level 28), but it can also be set relative to the whole assembly or all assemblies. Figures 8 and 9 show the same views for SFRs. Both views have different grids from their PWR counterparts, but the same principles apply. Each circle in the geometric Integrated Nuclear Simulation Data Analysis 13 Figure 6. A geometric representation of one quarter of a pressurized water reactor fuel assembly with control rods in blue and fuel pins in red. view represents a fuel pin in the SFR assembly and each hexagon in the data view represents the same fuel pin. The type of data displayed in the data view, for either reactor type, can be switched with the “Data Feature” button. For the PWR example in problem 3a, both axial and total pin power data are available and can be selected. Any data stored on the assembly in a data provider will appear in the list and can be selected. 3.4. Pins and Rods PWR assemblies are filled with rods made of either fuel or poisons or, in some cases, simply empty. The structure of a rod is defined by a collection of “material blocks” that describe the materials in a rod between two points along its axis. Material blocks are axisymmetric and are composed of concentric rings of materials. For example, a Integrated Nuclear Simulation Data Analysis 14 Figure 7. Axial power mapped onto an assembly from a pressurized water reactor with areas of higher power in red and lower power in blue. material block in a PWR fuel rod has a fuel ring, a fill gas ring, and a cladding ring. The clad and fill gas are typically defined separately from the material blocks for the fuels. Each rod can also store a pressure. Each ring is defined by an inner and outer radius, a height, and a material type. Materials can be gases, liquids, or solids and can be labeled to match the materials in the simulation. The SFR capability makes a further distinction between “pins” and “rods.” In SFRs, the pin is the basic unit of fuel assemblies and control assemblies. Rods are used only in reflector assemblies. Pins are identical to rods in PWRs. Figure 10 shows the geometry of a fuel rod in problem 3a. The rings of material are represented by the concentric circles of red, yellow, and green areas for the fuel, fill gas, and clad, respectively. Similar to the view for assemblies, the axial level can be Integrated Nuclear Simulation Data Analysis 15 Figure 8. A geometric representation of a seven-pin sodium-cooled fast reactor assembly completely composed of fuel rods. adjusted using the slider, the spinner, or the clickable axial view. The data view for this rod showing the pin power at the 42nd axial level is shown in Fig. 11. The fuel is homogeneous in problem 3a, so only one material block and ring are shown. The views for SFR pins are not shown because they are, for the most part, identical to the views for PWRs. 3.5. Plots and Comparisons The user interface provides a limited plotting capability for information stored on assemblies and pins/rods. This allows users to make quantitative comparisons quickly and easily. Plots of the axial pin power for select fuel pins in problem 3a are shown in Figs. 12 and 13. The height from the bottom of the pin is shown on the horizontal axis, and the axial pin power on the vertical axis. Integrated Nuclear Simulation Data Analysis 16 Figure 9. A view of random data mapped to the seven-pin sodium-cooled fast reactor assembly to show the color mapping capability. A plot showing the normalized percentage differences between the axial powers from VERA and KENO for problem 3a is shown in Fig. 14. This plot was created using the external analysis routine described in 2.3 and shows very close agreement between the two codes. 4. Availability and Ongoing Work Source code and fully compiled binaries of this system are available as part of NiCE at http://niceproject.sourceforge.net. The system is referred to as the “Reactor Analyzer” in NiCE, and several detailed tutorials are available at the same website. Detailed source code documentation is also available. Future versions of the system will be available in NiCE, but in the near future that project will be “converted” into a new project at the Integrated Nuclear Simulation Data Analysis 17 Figure 10. A geometric representation of a single fuel pin in a pressurized water reactor with red, yellow, and green rings for the fuel, fill gas, and cladding, respectively. Eclipse Foundation called the “Eclipse Integrated Computational Environment.” The system will then be available at http://www.eclipse.org. The current version is available under a modified BSD license, and future releases will be available under the Eclipse Public License. Readers are encouraged to watch the recorded demonstrations published on YouTube.com at http://www.youtube.com/jayjaybillings. Detailed Unified Modeling Language models were developed as part of this work; they are also available for download, although the format is proprietary. The authors will gladly export the Unified Modeling Language models into a more friendly format upon request. The authors are open to feedback and contributions from readers. Those interested in contributing to the work through testing, design improvements, or source code Integrated Nuclear Simulation Data Analysis 18 Figure 11. A view of the axial power for this pin at the selected axial level. development should contact the corresponding author. 4.1. Limitations This system is relatively new and has several limitations. It remains highly useful considering these limitations and will only improve with time as they are addressed and other improvements added. Performance has not been tested with very large amounts of data and many time steps. Scaling to a full core based on the 3a problem has performed well, after work to optimize the code; but even at the size of a full core, problem 3a is not very big. It is only resolved at 49 axial levels with two sets of state point data and five distinct rod types. The system has not been tested with real data from SFR simulations. Although the authors do not expect that this will present any issues, that remains a possibility. Integrated Nuclear Simulation Data Analysis 19 Figure 12. A graph of the axial pin power across the B2, E4, and H7 pins in the assembly for the “input” simulation performed with VERA. The system needs to be modified to include more of the regular properties of Parts. For example, the heights of rods and pins are determined by the total heights of their material blocks, but it needs to be possible to retrieve this value more easily. Plenum gas has not been considered. 4.2. Planned Future Work There are many possible refinements to this system and a large amount of upcoming work. The most immediate refinement will be the addition of components to represent the pieces of a nuclear plant, such as generator, pipes, and other “plant-level elements.” As previously mentioned, it is also important to test the system for much larger amounts of data and with the parallel I/O capabilities natively available in the HDF5 library. Extensions to more languages are planned, including bindings for C, Fortran, and Integrated Nuclear Simulation Data Analysis 20 Figure 13. A graph of the axial pin power across the B2, E4, and H7 pins in the assembly for the “reference” simulation performed with KENO. Python. Each of these will be a wrapper around the C++ version, not a stand-alone implementation. The authors are currently working with members of the SHARP team [13] to test the system with real data from simulations of SFRs. The model for pins and rods will be improved in the near future after tests with Bison [17] later this year. Extending the properties available in Parts is straightforward, and the authors are working with collaborators to extend the set of properties for each Part. Integrated Nuclear Simulation Data Analysis 21 Figure 14. A graph showing the percentage difference in the axial pin powers for the B2, E4, and H7 pins in the assembly. 5. Conclusions Future simulations of new nuclear reactor designs will require new ways to examine the results because of the high fidelity and resolution inherent in state-of-the-art simulation codes. The system presented herein is capable of reducing the analysis burden on both users and developers by organizing the results in an intuitive, domain-specific way and providing easy-to-use I/O capabilities and a user interface. Its application to a realworld problem with a 17 by 17 17 by 17 PWR fuel assembly from a VERA benchmark problem was shown by generating plots of the percentage difference between axial powers from VERA and KENO. Work remains to cover all of the different parts of LWRs and SFRs in sufficient detail for widespread use, as well as to optimize the system for truly large amounts of data in time and space. Integrated Nuclear Simulation Data Analysis 22 Addressing the “data problem” will be critical to the success of the new modeling and simulation capabilities in development. Certainly, it is necessary to provide at least some streamlined capability to examine the large amounts of data coming from these simulations and, ideally, to make it possible to discover interesting new physics in the results through data mining and machine learning. 6. Acknowledgments The authors are grateful to members of the NEAMS and CASL communities, others whom we have interviewed, and our program managers. The authors are grateful for the assistance of Greg Davidson, Jess Gehin, Andrew Godfrey, Ugur Mertyurek, and John Turner from Oak Ridge National Laboratory (ORNL) and Justin Thomas from Argonne National Laboratory. The authors are also grateful for the financial support provided by the NEAMS, Advanced Reactor Concepts, and CASL programs. The authors are especially thankful to David Pointer of ORNL for his assistance, guidance, and continued support during the performance of this work and the development of the paper. This work has been supported by the US Department of Energy, Office of Nuclear Energy, and by the ORNL Postgraduate Research Participation Program, which is sponsored by ORNL and administered jointly by ORNL and the Oak Ridge Institute for Science and Education (ORISE). ORNL is managed by UT-Battelle, LLC, for the US Department of Energy under contract no. DE-AC05-00OR22725. ORISE is managed by Oak Ridge Associated Universities for the US Department of Energy under contract no. DE-AC05-00OR22750. 7. References [1] Consortium for the Advanced Simulation of Light-water reactors web page, September 2011. https://www.casl.gov. [2] Nuclear Energy Advanced Modeling and Simulation web page, September 2011. http://www.ne. doe.gov/AdvModelingSimulation/program.html. [3] VisIt Web Page, September 2011. https://wci.llnl.gov/codes/visit/home.html. [4] NiCE Project Page, April 2011-2014. https://niceproject.sourceforge.net. [5] Apache Software Foundation. Apache Mahout. https://mahout.apache.org, 2011-2014. [6] Jay Jay Billings, Andrew P. Belt, Mike Guidry, S. Forest Hull, Eric J. Lingerfelt, Greg M. Lyon, Alexander J. McCaskey, Neeti Pokhriyal, Andrew Godfrey, and Ugur Mertyurek. Simulate this! - the eclipse platform as an integrated computational environment. In EclipseCon 2013, 2013. [7] Jay Jay Billings, Jordan Deyton, S. Forest Hull, Alexander J. McCaskey, Taylor Patterson, and Anna Wojtowicz. Prevent three-eyed fish: Analyze your nuclear reactor with eclipse. In EclipseCon 2014, 2014. [8] Derek Gaston, Chris Newman, Glen Hansen, and Damien Lebrun-Grandie. Moose: A parallel computational framework for coupled systems of nonlinear equations. Nuclear Engineering and Design, 239, October 2009. [9] A. Godfrey. Vera core physics benchmark progression problem specifications. Technical Report CASL-U-2014-0006-002, Oak Ridge National Laboratory, Oak Ridge, TN, USA, March 2013. Integrated Nuclear Simulation Data Analysis 23 [10] Jeff McAffer, Jean-Michel Lemieux, and Chris Aniszczyk. Eclipse Rich Client Platform Second Edition. Addison-Wesley, Boston, 2010. [11] N. Pokhriyal, J. J. Billings, U. Mertyurek, and A. T. Godfrey. Anomaly detection for high fidelity core simulations. In Proc. 2013 American Nuclear Society Annual Meeting, 2013. [12] B. Rearden. SCALE: A Modular Code System for Performing Standardized Computer Analyses for Licensing Evaluation. ORNL/TM-2005/39, I-III, November 2006. [13] A. Siegal, T. Taugtes, A. Caceres, D. Kaushik, and P. Fischer. Software design of sharp. In Joint International Topical Meeting on Mathematics and Computation and Supercomputing in Nuclear Applications, 2007. [14] Timothy J. Tautges and Alvaro Caceres. Scalable parallel solution coupling for multiphysics reactor simulation. In Proc. SciDAC 2009 Journal of Physics: Conference Series, 2013. [15] The HDF Group. Hierarchical Data Format, version 5. http://www.hdfgroup.org/HDF5/, 19972014. [16] J. Turner, R. Summers, and S. Palmtag. Virtual environment for reactor applications (vera). Technical Report CASL-U-2014-0006-000, Oak Ridge National Laboratory, Oak Ridge, TN, USA, March 2013. [17] R. L. Williamson, J. D. Hales, S. R. Novascone, M. R. Tonks, D. R. Gaston, C. J. Permann, D. Andrs, and R. C. Martineau. Multidimensional multiphysics simulation of nuclear fuel behavior. Journal of Nuclear Materials, 423, April 2012.
5cs.CE
IRREDUCIBLE ULRICH BUNDLES ON ISOTROPIC GRASSMANNIANS ANTON FONAREV arXiv:1604.01612v2 [math.AG] 13 May 2016 Abstract. We classify irreducible equivariant Ulrich vector bundles on isotropic Grassmannians. 1. Introduction Ulrich bundles were introduced in [5] in order to study Chow forms. The notion of an Ulrich module appeared much earlier in commutative algebra. Ulrich himself gave a certain sharp upper bound on the minimal number of generators for a maximal Cohen–Macaulay module module over a Cohen–Macaulay homogeneous ring. Ulrich modules are precisely those for which the upper bound is attained (see [9]). There are several equivalent definitions of Ulrich bundles. Though we are going to use a less enlightning cohomological one, it might be motivating to formulate the most geometric and, to our taste, the easiest one. Given a d-dimensional projective variety X ⊂ PN , an Ulrich bundle on X is a vector bundle E such that π∗ E is a trivial bundle for a general linear projection π : X → Pd . Further details may be found in [5]. It was asked in [5] whether every projective variety admits an Ulrich bundle. So far the answer is known in few cases which include hypersurfaces and complete intersections [7], del Pezzo surfaces [5], and abelian surfaces [1]. While it is not clear whether the answer to the general question is positive, in the case of rational homogeneous varieties one has a large test class of vector bundles, namely equivariant ones. In [4] the authors fully classified irreducible equivariant Ulrich vector bundles on Grassmannians over an algebraically closed field of characteristic zero. These results were further improved in [3], where most of partial flag varieties were treated. In the current paper we move in an orthogonal (or symplectic) direction and classify irreducible equivariant Ulrich bundles on isotropic Grassmannians, that is varieties of the form G/P, where G is a classical group of type Bn , Cn , or Dn , and P is a maximal parabolic subgroup. The following meta theorem is the main result of the present paper. Theorem. The only isotropic Grassmannians admitting an equivariant irreducible Ulrich vector bundle are the symplectic Grassmannians of planes IGr(2, 2n) for n ≥ 2, odd and even-dimensional quadrics Qd , orthogonal Grassmannians of planes OGr(2, m) for m ≥ 4, even orthogonal Grassmannians of 3-spaces OGr(3, 4q + 6) for q ≥ 0, and OGr(4, 8). In each case the corresponding bundles are classified. The paper is organized as follows. In Section 2 we collect some preliminary definitions and provide a simple criterion for an equivariant irreducible vector bundle to be Ulrich. In Section 3 we treat all isotropic Grassmannians in type Cn but maximal (Lagrangian) ones. Similarly, in sections 4 and 5 we deal with all but maximal Grassmannians in types Bn and Dn respectively. Finally, Section 6 is devoted to maximal Grassmannians, both symplectic and orthogonal. The author is gratful to the anonymous reviewer for careful reading of the original manuscript. This work is supported by the RSF under a grant 14-50-00005. 1 2. Preliminaries Let G be a simple algebraic group of type Bn , Cn , or Dn over an algebraically closed field of characteristic zero. We fix a maximal torus T ⊂ G along with a Borel subgroup B ⊃ T. Let PG and W denote the weight lattice and the Weil group of G respectively. In the following all the roots and weights will be expressed in terms of the standard orthonormal basis he1 , e2 , . . . , en i in a fixed vector space Rn . Denote by Φ ⊃ Φ+ ⊃ ∆ the root system of G, the set of positive roots, and the set of simple roots respectively. We use the standard numbering of the simple roots ∆ = {ε1 , . . . , εn }. Our goal is to study vector bundles on varieties of the form X = G/P, where P = Pk is the maximal parabolic subgroup associated with the set ∆ \ {εk }. We call such varieties isotropic Grassmannians. In particular, maximal isotropic Grassmannians correspond to ∆ \ {εn }. It is well known that the category of G-equivariant vector bundles on X is equivalent to the category of representations of P: CohG (G/P) ≃ Rep − P, see [2]. Moreover, this is an equivalence of tensor abelian categories. The group P is not reductive, however, we are interested only in irreducible equivariant vector bundles on X. Those correspond to irreducible representations of P, which in turn are all induced from the reductive Levi quotient group L = P/U (here U denotes the unipotent radical of P). The weight lattice PL is canonically isomorphic to PG . Let PL+ ⊂ PL denote the cone of L-dominant weights. It is generated by ω1 , . . . , ωn and −ωk . For a given λ ∈ PL+ we denote by U λ the corresponding irreducible equivariant vector bundle on X. In particular, U ωk is the ample generator of Pic X ≃ Z. The Borel–Bott–Weil theorem is the tool we use to compute cohomology of irreducible vector bundles on Grassmannians (see, e.g., [10]). Let ρ denote the half-sum of positive roots of G, which also equals the sum of fundamental weights. Recall that a weight is called singular if it lies on a wall of a Weyl chamber, i.e. is fixed by a nontrivial element of WG . Equivalently, a weight is singular if and only if it is orthogonal to some (positive) root of G. Theorem 2.1 (Borel–Bott–Weil). Let λ ∈ PL+ . If λ + ρ is singular, then H • (X, U λ ) = 0. Otherwise, λ + ρ lies in the interior of some Weyl chamber, and there exists a unique element w ∈ W such that w(λ + ρ) ∈ PG+ . Let l denote the length of w. Then the only nontrivial cohomology H l (X, U λ ) = V w(λ+ρ)−ρ is an irreducible representation of G of highest weight w(λ + ρ) − ρ. Now that we have all necessary information about irreducible equivariant vector bundles on isotropic Grassmannians, we can turn to Ulrich bundles. The latter were introduced in [5] where the authors study Chow forms. We are going to use the original cohomological characterization. Definition 2.2. Let X ⊂ PN be a projective variety of dimension d. A vector bundle E on X is called Ulrich if H i (X, E(t)) = 0 for 0 < i < d and all t, while H 0 (X, E(t)) = 0 for t < 0, and H d (X, E(t)) = 0 for t ≥ −d. The goal of the present paper is to classify all irreducible equivariant Ulrich bundles on X = G/Pεk under the natural embedding given by U ωk . Let d = dim X. We are now going to reduce the problem to a representation-theoretic one. For a given L-dominant weight λ ∈ PL+ define Irr(λ) = {t ∈ Z | λ + ρ − tωk is singular} . Lemma 2.3. The set Irr(λ) contains at most d elements. 2 P Proof. The weight λ = xi ωi is L-dominant if and only if xi ≥ 0 for all i 6= k. Thus, for λ ∈ PL+ the P coefficients yi in the decomposition λ + ρ = yi ωi are positive for all i 6= k. We are interested in all t ∈ Z for which λ + ρ − tωk is orthogonal to a positive root of G. Put X Φ′ = {α ∈ Φ+ | α = pi εi }. i6=k P For any α ∈ Φ′ one has (α, ωk ) = 0, thus (α, λ + ρ − tωk ) = i6=k yi (α, ωi ) > 0 for any t. Meanwhile, for any α ∈ Φ+ \ Φ′ one has (α, ωk ) > 0. Thus, there exists a unique rational t such that (α, λ + ρ − tωk ) = 0. We conclude that Irr(λ) contains at most |Φ+ \ Φ′ | elements. It is well known that d = |Φ+ \ Φ′ |, which finishes the proof.  We can now formulate a simple criterion for an irreducible equivariant vector bundle on an isotropic Grassmannian to be Ulrich. Lemma 2.4. An irreducible equivariant vector bundle U λ on X is Ulrich if and only if Irr(λ) = {1, 2, . . . , d}. Proof. Given an irreducible equivariant vector bundle U λ , one has U λ (t) ≃ U λ+tωk . It follows from the Borel–Bott–Weil theorem that Irr(λ) = {1, 2, . . . , d} if and only if H • (X, U λ (t)) = 0 for −d ≤ t < 0. Thus, the only if part. In Lemma 2.3 we have shown that there can be at most d rational intersection points of the line λ + ρ + tωk with the walls of the Weyl chambers. We conclude that if Irr(λ) = {1, 2, . . . , d}, as the maximum number of intersections is reached, the ray {λ + ρ + tωk }t≥0 lies in the interior of a single Weyl chamber. It follows from the Borel–Bott–Weil theorem that an equivariant vector bundle can have at most one nontrivial cohomology group, and U µ and U ν have nontrivial cohomology in the same degree if µ + ρ and ν + ρ lie in the same Weyl chamber. As H 0 (X, U λ (t)) 6= 0 for t ≫ 0, we deduce that H 0 (X, U λ (t)) 6= 0 and H i (X, U λ (t)) = 0 for all t ≥ 0 and 0 < i ≤ d. A similar argument shows that H i (X, U λ (t)) = 0 for all t < −d and 0 ≤ i < d.  3. Symplectic Grassmannians Let 2 ≤ k ≤ n be integer numbers and let V be a 2n-dimensional vector space equipped with a nondegenerate symplectic form.1 Let G = Sp(V ) be the corresponding symplectic group. We identify PG with the set of integral vectors Zn ⊂ Rn . The root system Φ consists of the vectors ±2ei and ±(ei ± ej ) for i 6= j, the simple roots are εi = ei − ei+1 for i = 1, . . . , n − 1 and εn = 2en , and the fundamental weights are ωi = e1 + . . . + ei for i = 1, . . . , n. In particular, ρ = (n, n − 1, . . . , 1). Let X = G/P, where P = Pk is the maximal parabolic subgroup associated with ∆ \ {εk }. The variety X is nothing but the Grassmannian IGr(k, V ) of k-dimensional subspaces in V isotropic with respect to the form. The dimension of X equals d = k(2n − k) − k(k − 1)/2. The L-dominant cone PL+ is identified with λ ∈ Zn for which (1) λ1 ≥ λ2 ≥ . . . ≥ λk , λk+1 ≥ λk+2 ≥ . . . ≥ λn ≥ 0. For example, if one denotes by U the tautological rank k subbundle, and λ = (λ1 , . . . , λk , 0, . . . , 0) ∈ PL+ is such that λk ≥ 0, then U λ ≃ Σλ U ∗ , where Σλ is the Schur functor corresponding to λ. In particular, OX (1) = U ωk ≃ Λk U ∗ . 1The case k = 1 is trivial as X ≃ P(V ). 3 For a given λ ∈ PL+ define auxiliary sequences α ∈ Zk and β ∈ Zn−k by (2) (α1 , . . . , αk , β1 , . . . , βn−k ) = λ + ρ. Condition (1) now reads (3) α1 > α2 > . . . > αk , β1 > β2 > . . . > βn−k > 0. Proposition 3.1. Irr(λ) = {αi ± βj }1≤i≤k, 1≤j≤n−k Proof. The weight [ Z∩  αi + αj 2  1≤i≤j≤k λ + ρ − tωk = (α1 − t, α2 − t, . . . , αl − t, β1 , β2 , . . . , βn−k ) is singular if and only if it is orthogonal to one of the roots of G. The roots are ±2ei and ±(ei ± ej ) for i 6= j. In particular, a weight is singular if and only if (i) one of the terms equals zero, or (ii) two different terms coincide, or (iii) a couple of terms sum up to zero. It follows from (3) that the three options are equivalent to (i) t = αi , (ii) t = αi − βj , and (iii) t = (αi + αj )/2 or t = αi + βj .  Remark 3.2. From Lemma 2.3 we deduce that if U λ is Ulrich, then all the numbers αi ±βj and (αi +αj )/2 are distinct and integer. 3.1. General isotropic Grassmannians. The goal of this section is to prove the following statement. Proposition 3.3. There are no irreducible equivariant Ulrich bundles on LGr(k, V ) for 2 < k < n. Lemma 3.4. If there exists an irreducible equivariant Ulrich bundle on X, then dim X is odd. Proof. Assume that Irr(λ) = {1, 2, . . . , d}. From (3) and Proposition 3.1 we get min Irr(λ) = αk − β1 = 1 and max Irr(λ) = α1 + β1 = d. Now, according to Remark 3.2, Z ⊃ Irr(λ) ∋ α1 + αk (α1 + β1 ) + (αk − β1 ) d+1 = = . 2 2 2 Thus, d is necessarily odd.  Proof of Proposition 3.3. Let us introduce some temporary notation: for integers a and b we will write a ≺ b if b = a + 1, and similarly a ≻ b if a = b + 1. Put l = n − k. Assume that λ corresponds to an Ulrich bundle. Then Irr(λ) = {1, 2, . . . , d}. (4) Put D = (d − 1)/2 and α± ij = αi ± βj − (5) d+1 , 2 αij = αi + αj d+1 − . 2 2 One immediately observes that αii + αjj for 1 ≤ i < j ≤ k. 2 It follows from (4) that the values α± ij and αij are distinct and fill the integer range [D, . . . , −D]. Also, from (3) we get inequalities α± ij = αii ± βj , (6) αij = αij ≤ αpq (7) − − − + + α+ i1 > αi2 > . . . > αil > αii > αil > . . . > αi2 > αi1 α+ 1j > α+ 2j > ... > α+ kj , α− kj < ... < 4 α− 2j < α− 1j if i ≥ p and j ≥ q, for all 1 ≤ i ≤ k, for all 1 ≤ j ≤ l. From the proof of Lemma 3.4 and (5) we see that α+ 11 = D, (8) α− k1 = −D, α11 = −αkk , α1k = 0. Let us first assume that (β1 , β2 , . . . , βl ) 6= (l, l − 1, . . . , 1). The last condition is equivalent to the existence of such a t ∈ {1, . . . , l} that β1 ≻ β2 ≻ . . . ≻ βt > 1. It follows from (6) that + + D = α+ 11 ≻ α12 ≻ . . . ≻ α1t 6≻ α11 . + From inequalities 7 we deduce that the next position after α+ 1t must be taken by α21 . In particular, + α+ 21 = α22 + β1 = α11 − t. (9) A similar argument shows that − − − −D = α− k1 ≺ αk2 ≺ . . . ≺ αkt 6≺ αk−1,1 , which implies − α− k−1,1 = αk−1,k−1 − β1 = α11 + t. (10) Combining (9) and 10, we deduce α22 + αk−1,k−1 α11 + αkk = = α1k . 2 2 That contradicts the assumption that all the values αij are distinct. Finally, in case (β1 , β2 , . . . , βl ) = (l, l − 1, . . . , 1) one has α2,k−1 = − − + + + − + + D = α+ 11 ≻ α12 ≻ . . . ≻ α1k ≻ α11 ≻ α1k ≻ . . . ≻ α12 ≻ α11 > α12 > α21 ≻ α22 ≻ . . . ≻ α2k ≻ α22 . Inequalities (7) imply that α12 is the only possible immediate predecessor of α− 11 , thus α11 + α22 = α11 − (l + 1) 2 A similar argument shows that α12 = αk−1,k−1 + αkk = αkk + (l + 1) 2 Combining the last two equalities we deduce that αk−1,k = ⇒ α22 = α11 − 2(l + 1). ⇒ αk−1,k−1 = αkk + 2(l + 1). α22 + αk−1,k−1 α11 + αkk = = α11 , 2 2 which once again contradicts the assumption that all αij are distinct. α2,k−1 =  3.2. Isotropic Grassmannians of planes. We would like to classify all irreducible equivariant Ulrich bundles on isotropic Grassmannians of planes. Thus, throughout this section k = 2 and X = IGr(2, V ). Proposition 3.5. Let p be a positive divisor of n − 1 such that (n − 1)/p = 2q + 1 is odd. Then the bundle on IGr(2, V ) corresponding to the weight (11) λ = (n − 2 + p, n − 1 − p, 2pq, . . . , 2pq , 2p(q − 1), . . . , 2p(q − 1), . . . , 2p, . . . , 2p, 0, . . . , 0) | {z } | | {z } | {z } {z } 2p 2p 2p is Ulrich. Moreover, all irreducible equivariant Ulrich bundles on IGr(2, V ) are of this form. 5 p−1 Proof. We will freely use the notation introduced along the proof of Proposition 3.3. Remark that the only αij we are left with are α12 = 0 and α11 = −α22 . Let us also spell out d = 4n − 5, l = n − 2, and D = 2n − 3. Assume that the values α± ij and αij cover the range [D, . . . , −D], and put p = α11 . Let us show by induction on l that l = 2pq + (p − 1) for some integer q ≥ 0 and that (12) β1 = 2n − 3 − p β2p+1 = 2n − 3 − 5p ... β2p(q−1)+1 = 5p − 1 β2 = 2n − 4 − p β2p+2 = 2n − 4 − 5p ... β2p(q−1)+2 = 5p − 2 .. . .. . β2p = 2n − 2 − 3p .. . β4p = 2n − 2 − 7p ... β2pq+1 = p − 1 .. . βl = 1 β2p(q−1)+2p = 3p As l = n − 2, the equality l = 2pq + (p − 1) is equivalent to n − 1 = p(2q + 1), which is what we would like to show. Also, by (2) and (5) one has λ1 = α11 + d+1 − n, 2 λ2 = α22 + d+1 − (n − 1), 2 λi = βi−2 − (n + 1 − i) for 2 < i ≤ n. Simplifying these formulas, one comes to a conclusion that (12) corresponds exactly to (11). Thus, we are indeed about to prove an equivalent statement. In the base case l = 3 we need to find all possible integers p, β1 > 0 such that ±p ± β1 and ±p are distinct and take all the values {±1, ±2, ±3}. One immediately checks that the only possibility is p = 2 and β1 = 1. Let us prove the inductive step. Recall that the α+ 11 = D is necessarily the maximal element. From (7) we know that the only elements that can take the values {±1, ±2, . . . , ±(p − 1)} are α± ij . Thus, by the − pigeonhole principle l ≥ p − 1. Next, if l = p − 1, then by the same principle α21 < p. As a consequence, + + D = α+ 11 ≻ α12 ≻ . . . ≻ α1,p−1 ≻ α11 = p, which implies β1 ≻ β2 ≻ . . . ≻ βp−1 = 1. That is exactly what (12) gets reduced to. Finally, assume that l > p − 1. By the pigeonhole principle again and the order on α− 2,i we argue that + + α21 = α11 − 2p > α11 . Looking at (7), we deduce that + + + D = α+ 11 ≻ α12 ≻ . . . ≻ α1,2p ≻ α21 . In particular, β1 ≻ β2 ≻ . . . ≻ β2p 6≻ β2p+1 , which implies (13) + + + + + D = α+ 11 ≻ α12 ≻ . . . ≻ α1,2p ≻ α21 ≻ α22 ≻ . . . ≻ α2,2p , − − − − − α− 1,2p ≻ . . . ≻ α12 ≻ α11 ≻ α2,2p ≻ . . . ≻ α22 ≻ α21 = −D. We conclude that (14) (β1 , β2 , . . . , β2p ) = (D − p, D − p − 1, . . . , D − 3p + 1). In follows from (13) that the range [D − 4p, . . . , −D + 4p] is covered by the values n o . α11 = p, α12 = 0, α22 = −p, and α± ij 2p<j≤l 6 Applying the induction hypothesis for l′ = l − 2p we find that l − 2p = 2pq ′ + (p − 1). In particular, l = 2pq + (p − 1) for q = q ′ + 1. We also get the exact values of βj for j > 2p in terms of p and n′ = n − 2p. Rewriting these values back in terms of p and n together with (14) proves (12).  Remark that for any n one has an obvious choice p = n − 1. Then (n − 1)/p = 1 is odd and the corresponding weight is (2n − 3, 0, . . . , 0). Moreover, if n − 1 has no odd divisors apart from 1, this choice of p is the only possible. Summarising, we get the following statement. Corollary 3.6. For any n the bundle S 2n−3 U ∗ on IGr(2, 2n) is Ulrich. If n = 2r + 1, it is the only irreducible equivariant Ulrich bundle up to isomorphism. Example 3.7. The following are the smallest isotropic Grassmannians of planes that admit two and three nonisomorphic irreducible Ulrich bundles respectively. (1) There are exactly two nonisomorphic equivariant irreducible Ulrich bundles on IGr(2, 8): S5U ∗ and U ∗ (2) ⊗ Σ[2,2] (U ⊥/ U ). (2) There are exactly three nonisomorphic equivariant irreducible Ulrich bundles on IGr(2, 20): S 17 U ∗ , S 5 U ∗ (6) ⊗ Σ[6,6,6,6,6,6] (U ⊥/ U ), and U ∗ (8) ⊗ Σ[8,8,6,6,4,4,2,2](U ⊥/ U ). Here Σ[µ] denotes the symplectic Schur functor corresponding to µ. 4. Odd orthogonal Grassmannians We would like to deal now with type Bn . Namely, let G = SO(V ), where V is a (2n + 1)-dimensional vector space equipped with a non-degenerate symmetric form. We identify the root system of G with √ the set of all integer vectors of length 2 or 1. For the simple roots we choose εi = ei − ei+1 for i = 1, . . . , n − 1, and εn = en . The fundamental weights then are ωi = e1 + . . . + ei for i = 1, . . . , n − 1 and ωn = 21 (e1 + . . . + en ), while  ρ = n − 12 , n − 32 , . . . , 21 . We would like to classify equivariant irreducible vector bundles on X = G/Pk ≃ OGr(k, V ) for all k = 1, . . . , n − 1. The dimension of X is d = k(2n − k) − k(k + 1)/2. The weight lattice PG is identified with the set of vectors with all integer or halfinteger coordinates, PG = Zn ∪ ( 12 + Z)n , while the dominant cone PL+ consists of all λ ∈ PG such that λ1 ≥ λ2 ≥ . . . ≥ λk , λk+1 ≥ . . . ≥ λn ≥ 0. Let us again introduce the notation (α1 , α2 , . . . , αk , β1 , β2 , . . . , βn−k ) = λ + ρ For λ ∈ (15) PL+ we deduce inequalities α1 > α2 > . . . > αk , β1 > β2 > . . . > βn−k > 0. Remark that the only difference between (15) and (3) is that in type Bn the terms αi and βj are allowed to be halfinteger all at once. The root systems in type Bn and Cn are extremely similar. An argument analagous to the one used in Proposition 3.1 shows that   [ αi + αj Irr(λ) = {αi ± βj }1≤i≤k, 1≤j≤n−k Z∩ . 2 1≤i≤j≤k As the cardinality of Irr(λ) is at most d, we deduce that all the values (αi +αj )/2 are integer. In particular, all αi are integer, thus βj are forced to be as well. We come to the following conclusion. 7 Proposition 4.1. A weight λ = (λ1 , λ2 , . . . , λn ) corresponds to an Ulrich bundle on OGr(k, 2n + 1) if and only if (λ1 − 21 , λ2 − 12 , . . . , λn − 21 ) is a weight corresponding to an Ulrich bundle for IGr(k, 2n). Proof. The conditions on α and β under which the bundle U λ is Ulrich are exactly the same in types Cn and Bn . Thus, λ is Ulrich for OGr(k, 2n + 1) if and only if λ + ρBn − ρCn is Ulrich for IGr(k, 2n).  Using Proposition 3.5 we can now find all equivariant Ulrich bundles on OGr(2, 2n + 1). Corollary 4.2. Every irreducible equivariant Ulrich bundle U λ on OGr(2, 2n + 1) corresponds to λ of the form (16) λ = (n − 3 2 + p, n − 1 2 − p, 2pq + 21 , . . . , 2pq + 21 , . . . , 2p + 21 , . . . , 2p + 21 , 12 . . . , 21 ), | {z } | {z } | {z } 2p 2p p−1 where p is a positive divisor of n − 1 such that (n − 1)/p = 2q + 1 is odd. Let S denote the spinor bundle on X, namely, 1 1 1 S = U ( 2 , 2 , ..., 2 ) . Corollary 4.3. Up to isomorphism S is the only irreducible equivariant Ulrich bundle on an odddimensional quadric Q2n−1 . Proof. The only irreducible Ulrich bundle on P2n−1 is O, which corresponds to λ = (0, 0, . . . , 0).  Corollary 4.4. The only nonmaximal odd orthogonal Grassmannians that admit an irreducible equivariant Ulrich bundle are the odd-dimensional quadrics OGr(1, V ) ≃ Q2n−1 and the Grassmannians of isotropic planes OGr(2, V ). 5. Even orthogonal Grassmannians Let us now deal with groups of type Dn . Namely, let G = SO(V ), where V is a 2n-dimensional vector space equipped with a non-degenerate symmetric form. We identify the root of G system with the set of vectors ±(ei ± ej ), i 6= j. The simple roots are εi = ei − ei+1 for i = 1, . . . , n − 1 and εn = en−1 + en , while the fundamental weights are ωi = e1 + . . . + ei for i = 1, . . . , n − 2, and ωn−1 = 21 (e1 + . . . + en−1 − en ), ωn = 12 (e1 + . . . + en−1 + en ). Thus, ρ = (n − 1, n − 2, . . . , 0). Let X = G/Pk . The dimension of X is d = k(2n − k)− k(k + 1)/2. It is well known that X ≃ OGr(k, V ) for k = 1, . . . , n − 2, while G/Pn−1 and G/Pn are isomorphic to the two connected components of the Grassmannian of maximal isotropic subspaces OGr(n, V ). The latter two varieties will be treated in Section 6, here we assume 1 ≤ k ≤ n − 2. As in type Bn , the weight lattice PG is identified with the set of all (half)integer vectors Zn ∪ ( 12 + Z)n , while the dominant cone PL+ consists of all λ ∈ PG such that λ1 ≥ λ2 ≥ . . . ≥ λk , λk+1 ≥ . . . ≥ |λn |. We once again introduce the notation (α1 , α2 , . . . , αk , β1 , β2 , . . . , βn−k ) = λ + ρ For λ ∈ PL+ one has inequalities (17) α1 > α2 > . . . > αk , 8 β1 > β2 > . . . > |βn−k |. An argument similar to the one used Proposition 3.1 shows that   [ αi + αj (18) Irr(λ) = {αi ± βj }1≤i≤k, 1≤j≤n−k Z∩ . 2 1≤i<j≤k Remark 5.1. Equality (18) together with βn−k = λn imply that λ corresponds to an Ulrich bundle if and only if the weight λ′ = (λ1 , λ2 , . . . , λn−1 , −λn ) does. Moreover, U λ can not be Ulrich as long as λn = 0. Thus, it is sufficient to classify irreducible equivariant Ulrich bundles with λn > 0. 5.1. General orthogonal Grassmannians. We are first going to prove the following statement. Proposition 5.2. There are no irreducible equivariant Ulrich bundles on OGr(k, V ) for 3 < k ≤ n − 2. Proof. The proof is very similar to the proof of Proposition 3.3. Put l = n − k and write a ≺ b (a ≻ b) whenever a + 1 = b (a = b + 1 respectively). Let us assume that Irr(λ) = {1, . . . , d}. Then necessarily α1 + β1 = d, αk − β1 = 1, α1 + αk = d + 1. α +α i j − d+1 To keep notation consistent, we introduce α± ij = αi ± βj and αij = 2 2 . According to our ± assumption, the values αij together with αij for 1 ≤ i < j ≤ k are all integer, distinct and span the range [D, . . . , −D], where D = (d − 1)/2. According to Remark 5.1, we can also restrict ourselves to the case βl > 0, thus inequalities (7) remain valid. In case β = (l − 12 , . . . , 23 , 12 ) one has + + − − − α+ i1 ≻ αi2 ≻ · · · ≻ αil ≻ αil ≻ · · · ≻ αi2 ≻ αi1 + for all i = 1, . . . , k. In particular, α− 11 ≻ α12 and αk,1 ≺ αk−1,k , which implies that α2,k−1 = α1,k . In case β 6= (l − 12 , . . . , 23 , 12 ) we claim that + + + α+ 11 ≻ α12 ≻ · · · ≻ α1t ≻ α21 (19) for some 1 ≤ p ≤ k. Indeed, otherwise In particular, α1 + β1 = Similarly, we argue that α1 +α2 2 + + α+ 11 ≻ α12 ≻ · · · ≻ α1l ≻ α12 . + 1. As β1 ≥ 1 2 and α2 ≤ α1 − 1, we deduce that β = (l − 21 , . . . , 32 , 12 ). − − − α− k,1 ≺ αk,2 ≺ · · · ≺ αk,t ≺ αk−1,1 for the same p as in (19), which implies that α2 = α1 − p, and αk−1 = αk + p. Thus, α2,k−1 = α1,k , which contradicts the assumption that all the values are distinct.  5.2. Small even orthogonal Grassmannians. Let us classify irreducible equivariant Ulrich bundles on OGr(k, 2n) for k ≤ 3. We will freely use the notation introduced along the proof of Proposition 5.2. 5.2.1. Even-dimensional quadrics. Proposition 5.3. The only irreducible equivariant Ulrich bundles on an even-dimensional quadric Q2n−2 up to isomorphism are the spinor bundles S ± , which correspond to the weights λ± = ( 12 , 12 , . . . , 21 , ± 12 ). Proof. According to inequalities (7), the only possible complete ordering is 2n − 2 = α1 + β1 ≻ · · · ≻ α1 + |βn−1 | ≻ α1 − |βn−1 | ≻ · · · ≻ α1 − β1 = 1. Thus, (α, β1 , . . . , βn−2 , |βn−1 |) = (n − 12 , n − 32 , . . . , 23 , 12 ). It remains to subtract ρ = (n − 1, . . . , 1, 0). 9  5.2.2. Even orthogonal Grassmannians of planes. Proposition 5.4. Let p ∈ 12 + Z and q ∈ Z be nonnegative integers such that n − 2 = p(2q + 1) − 21 . Then the bundle on X = OGr(2, 2n) corresponding to the weight (20) λ = (n − 2 + p, n − 1 − p, 2pq + 21 , . . . , 2pq + 21 , 2p(q − 1) + 12 , . . . , 2p(q − 1) + 21 , . . . , | {z } | {z } 2p 2p 2p + 21 , . . . , 2p + 12 , 12 , . . . , 12 ) {z } | {z } | 2p 1 p− 2 is Ulrich. Moreover, all irreducible equivariant Ulrich bundles on X are of this form up to negating λn . Proof. The situation is very similar to that in type Cn . According to Remark 5.1, we may assume that λn > 0. The dimension of X equals d = 4n − 7, thus D = 2n − 4. Let α1,1 = −α2,2 = p. It is enough to show that if the values α± i,j and α1,2 = 0 cover the whole integer range [2n + 4, . . . , −2n + 4], then (21) β1 = 2n − 4 − p β2p+1 = 2n − 4 − 5p ... β2p(q−1)+1 = 5p − 1 β2 = 2n − 5 − p β2p+2 = 2n − 5 − 5p ... β2p(q−1)+2 = 5p − 2 .. . β2p = 2n − 3 − 3p .. . β2pq+1 = p − 1 .. . β4p = 2n − 3 − 7p ... .. . βn−2 = 1 2 β2p(q−1)+2p = 3p As in the proof of Proposition 3.5, we show the latter by induction on l. For the base case we take 3 1 α+ 2,1 = −p + β1 < p. Then, by pigeonhole principle 2l = 2p − 1 and β = (p − 1, . . . , 2 , 2 ). Otherwise, + + + α+ 1,1 ≻ α1,2 ≻ · · · ≻ α1,t ≻ α2,t for some 1 ≤ t ≤ l, from which we deduce that t = 2p and D − p = β1 ≻ β2 ≻ · · · ≻ β2p , and reduce the statement to l′ = l − 2p.  Example 5.5. For any even orthogonal Grassmannian of planes OGr(2, 2n) there are at least four nonisomorphic irreducible equivariant Ulrich vector bundles. In terms of Proposition 5.4 they correspond to the values p = n − 23 , q = 0, and p = 21 , q = n − 2 respectively. The former values produce the bundles S 2n−4 U ∗ ⊗ S ± , where S 2n−4 U ∗ is the (2n − 4)-th symmetric power of the dual tautological rank 2 bundle, and S ± are the spinor bundles. In the latter case λ = (n − 32 , n − 32 , n − 32 , n − 25 , . . . , 52 , ± 23 ). 5.2.3. Even orthogonal Grassmannians of 3-spaces. We finally turn to the case k = 3. Proposition 5.6. The Grassmannian OGr(3, 2n) carries an irreducible equivariant Ulrich bundle if and only if n − 3 = 2q. In the latter case the only equivariant irreducible Ulrich bundles are isomorphic to ± U λ for (22) λ± = (2n − 4, 2n − 5, 2n − 6, 2n − 6, 2n − 6, 2n − 10, 2n − 10, . . . , 4, ±4). Proof. According to Remark 5.1, we may assume that λn = βl > 0. Let U λ be Ulrich. Following the proof of Proposition 5.2 we see that α1,1 = −α3,3 and α1,2 = α2,3 , which implies α2,2 = 0. Denote p = α1,1 . Remark that p ∈ 2Z as α1,2 = p/2 ∈ Z. Let us show that β1 ≥ p. Indeed, otherwise from inequalities p > β1 > β2 > . . . > βl > 0 10 we deduce from (7) that none of the α± ij can be equal to p ∈ [D, . . . , −D]. Now, we argue by induction that l = 2q is even and β = (D − 2, D − 3, D − 6, D − 7, . . . , 5, 4), (23) p = 2. The base cases are l = 0 and l = 1. In the former p trivially equals 2, while in the latter one can show with brute force that λ does not exist. Now, for l > 1 we have α+ 2,1 ≥ p, and from (7) one has + + + α+ 1,1 ≻ α1,2 ≻ · · · ≻ α1,t ≻ α2,1 for some 1 ≤ t ≤ l. We immediately conclude that t = p and D − p = β1 ≻ β2 ≻ · · · ≻ βp . + In remains to observe that α+ 3,t = α3,1 − 2p, thus + + + + + α+ 1,1 ≻ · · · ≻ α1,p ≻ α2,1 ≻ · · · ≻ α2,p ≻ α3,1 ≻ · · · ≻ α3,p , from which we see that by dropping (β1 , . . . , βp ) the problem gets reduced to l′ = l − p, and that (23) is equivalent to (22), as D = 3n − 8.  6. Maximal isotropic Grassmannians 6.1. Lagrangian Grassmannians. Let V be a 2n-dimensional symplectic vector space and let X = LGr(n, V ) be the Lagrangian Grassmannian of maximal isotropic subspaces. Our goal is to prove the following. Proposition 6.1. The only Lagrangian Grassmannian possessing an irreducible equivariant Ulrich bundle is LGr(2, 4). The only irreducible equivariant Ulrich bundle on LGr(2, 4) up to isomorphism is U ∗ . In the Lagrangian case Proposition 3.1 simplifies to   αi + αj Irr(λ) = 2 1≤i≤j≤n. Recall that U λ is Ulrich if and only if Irr(λ) = {1, 2, . . . , d}. Informally speaking, what we need is to find all integer sequences of length n such that the half sums fill in all the blanks between the elements without any collisions. Consider a partially ordered set A = {aij }1≤i≤j with elements, indexed by unordered pairs of positive integers, subject to the partial order (24) aij ≤ apq if i ≤ p and j ≤ q. Denote by An the subset (25) An = {aij }1≤i≤j≤l ⊂ A. In particular, there is an increasing chain of inclusions ∅ = A0 ⊂ A1 ⊂ . . . ⊂ An ⊂ . . . ⊂ A. Lemma 6.2. The partially ordered set A \ An has a least element min(A \ An ) = a1,n+1 . Proof. Immediately follows from (24).  11 Proposition 6.3. There exists a unique order-preserving mapping T : A → Z+ from A to the set of positive integers Z+ such that (26) (27) T (min(A \ An )) = min(Z+ \ T (An )) T (aij ) = If we denote αij = T (aij ), then α11 T (aii ) + T (ajj ) 2 = 1, αii = 4i − 5 for all i > 1. for all n > 0, for all 1 ≤ i < j. Proof. We start with an observation that condition (27) is consistent with the partial order given by (24). Also, the equality α11 = 1 obviously follows from (26) and A0 = ∅. Let us prove by induction that for all n>1 (28) αnn = 4n − 5, {1, 2, . . . , 2n − 1} ⊆ T (An ), 2n ∈ / T (An ). The base case, n = 2, easily follows from (26). Condition (27) implies α11 = 1, α12 = 2, α22 = 3. Assume that (28) holds for all l = 2, . . . , n. As 2n ∈ / T (An ) and all the smaller positive integers are contained in T (An ) by inductive hypothesis, condition (26) dictates α1,n+1 = T (min(A \ An )) = 2n. From (27) we deduce that αn+1,n+1 = 2α1,n+1 − α11 = 4n − 1. Moreover, as α1,n+1 = 2n and α2,n+1 = (α22 + αn+1,n+1 )/2 = 2n + 1, we conclude that {1, 2, . . . , 2n + 1} ⊆ T (An+1 ). It remains to show that 2n + 2 ∈ / T (An+1 ). Remark that the only even elements in T (An+1 ) are α1i for i = 2, . . . , n + 1. Indeed, the first condition in (28) implies αii + αjj = 2(i + j) − 5 for all 1 < i ≤ j ≤ n + 1. αij = 2 On the other hand, α1j = (α11 + αjj )/2 = 2j − 2 for all j = 2, . . . , n + 1. In particular, 2n + 2 is not contained in T (An+1 ).  We fix the values αij from Proposition 6.3. The following statement is immediate. Lemma 6.4. If the bundle U λ is Ulrich, then αn+1−i = αii for i = 1, . . . , n. Proof of Proposition 6.1. As α1 is the largest element in Irr(λ + ρ), one of the necessary conditions for U λ to be Ulrich is α1 = dim X = n(n + 1)/2. On the other hand, Lemma 6.4 together with Proposition 6.3 impose α1 = αnn = 4n − 5. Having solved the quadratic equation, one is left with two possible cases: n = 2 or n = 5. The former corresponds to α1 = 3 and α2 = 1, which in turn is equivalent to λ = (1, 0). In the latter case α3 = (α2 + α4 )/2, thus Irr(λ) can not be of cardinality d.  6.1.1. Maximal orthogonal Grassmannians. We are left with the case X = G/Pn , where G is of type Bn or Dn . According to our convention, in both cases the lattice PG is identified with Zn ∪ ( 12 + Z)n , while the L-dominant weights precisely are those λ = a1 ω1 + . . . + an ωn for which ai ≥ 0 for i = 1, . . . , n − 1 and an is arbitrary. It is easy to see that λ ∈ P L if and only if λ1 ≥ λ2 ≥ · · · ≥ λn . Now, the difference with the nonmaximal case comes from the fact that  ωn = 21 , 21 , . . . , 12 . If one puts α = λ + ρ, then Irr(λ) = ( {αi + αj }1≤i≤j≤n , in type Bn , {αi + αj }1≤i<j≤n , in type Dn . Proposition 6.5. In type Bn the only maximal isotropic Grassmannian carrying an irreducible Ulrich bundle is OGr(2, 5). The corresponding bundle is trivial. 12 Proof. Assume that U λ is Ulrich. In particular, Irr(λ) = {1, . . . , d}. We claim that U µ is Ulrich on LGr(n, 2n) for µ = 2λ + 2ρBn − ρCn . Indeed, α′ = µ + ρCn = 2α and dim LGr(n, 2n) = dim OGr(n, 2n + 1), thus   ′ αi + α′j = {αi + αj }1≤i≤j≤n = IrrBn (λ) = {1, . . . , d}. IrrCn (µ) = 2 1≤i≤j≤n It follows from Proposition 6.1 that n = 2 and µ = 2λ + (1, 0) = (1, 0), from which λ = 0.  Proposition 6.6. Every irreducible equivariant Ulrich bundle on OGr(2, 4) and OGr(3, 6) is trivial. The dual tautological bundle U ∗ is the only irreducible equivariant Ulrich bundle on OGr(4, 8). There are no irreducible equivariant vector bundles on OGr(n, 2n) for n ≥ 4. Proof. We are basically interested in those α ∈ Zn ∪ ( 21 + Z)n for which α1 > α2 > · · · > αn , and n o {αi + αj }1≤i<j≤n = 1, . . . , n(n−1) . 2 An argument similar to the one used in type Cn shows that for such an α one necessarily has αn = 0, αn−1 = 1, αn−2 = 2, αn−3 = 4, αn−4 = 7, αn−5 = 10. Then αn−3 + αn−4 = αn−1 + αn−5 , so n ≤ 5. On the other hand, for n = 5 the set Irr = {1, . . . , 9, 11} does not contain d. It remains to check (say, by hand) that λ = 0 for n = 2, 3 and λ = (1, 0, 0, 0) for n = 4 indeed provide Ulrich bundles.  Remark 6.7. Of course, the negative results obtained in this paper do not contradict the original conjecture. In [3] the authors show that most of the flag varieties in type A do not carry an irreducible Ulrich bundle. On the other hand, according to our experience, it is very limiting to restrict oneself to the class of irreducible bundles. There seem to be equivariant bundles that are not irreducible, but still enjoy incredibly nice properties (see, e.g., [6]). It is also interesting to see if our results can help construct Ulrich bundles on other varieties, e.g. those Küchle varieties that come from sections of Lagrangian Grassmannians of planes (see [8]). References [1] Arnaud Beauville. Ulrich bundles on abelian surfaces. Version 2. Dec. 7, 2015. arXiv:1512.00992v2 [math.AG]. [2] Alexey Bondal and Mikhail Kapranov. “Homogeneous bundles”. In: Helices and vector bundles. Vol. 148. London Math. Soc. Lec. Note Series. Cambridge University Press, 1990, pp. 45–55. [3] Izzet Coskun et al. Ulrich Schur bundles on flag varieties. Version 1. Dec. 19, 2015. arXiv:1512.06193v1 [math.AG]. [4] L. Costa and R. M. Miró-Roig. “GL(V )-invariant Ulrich bundles on Grassmannians”. In: Mathematische Annalen 361.1-2 (Feb. 2015), pp. 443–457. doi: 10.1007/s00208-014-1076-9. [5] David Eisenbud, Frank-Olaf Schreyer, and Jerzy Weyman. “Resultants and Chow forms via exterior syzygies”. In: J. Amer. Math. Soc. 16.03 (July 2003), pp. 537–580. doi: 10.1090/s0894-0347-03-00423-5. [6] A. V. Fonarev. “On the Kuznetsov-Polishchuk conjecture”. In: Proceedings of the Steklov Institute of Mathematics 290.1 (Aug. 2015), pp. 11–25. doi: 10.1134/s0081543815060024. [7] J. Herzog, B. Ulrich, and J. Backelin. “Linear maximal Cohen-Macaulay modules over strict complete intersections”. In: Journal of Pure and Applied Algebra 71.2-3 (May 1991), pp. 187–202. doi: 10.1016/0022-4049(91)90147-t. [8] A. G. Kuznetsov. “On Küchle varieties with Picard number greater than1”. In: Izvestiya: Mathematics 79.4 (2015), pp. 698–709. doi: 10.1070/IM2015v079n04ABEH002758. [9] Bernd Ulrich. “Gorenstein rings and modules with high numbers of generators”. In: Mathematische Zeitschrift 188.1 (Mar. 1984), pp. 23–32. doi: 10.1007/bf01163869. [10] Jerzy Weyman. Cohomology of vector bundles and syzygies. Vol. 149. Cambridge University Press, 2003. 13 Algebraic Geometry Section, Steklov Mathematical Institute, 8 Gubkin str., Moscow 119991 Russia E-mail address: [email protected] 14
0math.AC
An EEG-based Image Annotation System Viral Parekh1 , Ramanathan Subramanian2 , Dipanjan Roy3 , and C. V. Jawahar1 1 IIIT Hyderabad, India, University of Glasgow, Singapore National Brain Research Centre, Manesar, India arXiv:1711.02383v1 [cs.CV] 7 Nov 2017 2 3 Abstract. The success of deep learning in computer vision has greatly increased the need for annotated image datasets. We propose an EEG (Electroencephalogram)-based image annotation system. While humans can recognize objects in 20-200 milliseconds, the need to manually label images results in a low annotation throughput. Our system employs brain signals captured via a consumer EEG device to achieve an annotation rate of up to 10 images per second. We exploit the P300 event-related potential (ERP) signature to identify target images during a rapid serial visual presentation (RSVP) task. We further perform unsupervised outlier removal to achieve an F1-score of 0.88 on the test set. The proposed system does not depend on category-specific EEG signatures enabling the annotation of any new image category without any model pre-training. Keywords: EEG, Image annotation, Active learning 1 Introduction Image annotation is a critical task in computer vision, intended to bridge the semantic gap between automated and human understanding via the use of tags and labels. Image annotation is useful for building large-scale retrieval systems, organizing and managing multimedia databases, and for training deep learning models for scene understanding. A trivial way to annotate images is to tag them manually with the relevant labels, but this approach is slow and tedious for huge databases. Therefore, many efforts have been undertaken to address/circumvent this problem. Some methods are completely automatic [1,2,3,4,5], while some others are interactive [6,7,8,9,10]– these approaches have considerably reduced the human effort required for annotation. Human vision is a very powerful system for object recognition and scene understanding. It is also robust to variations in illumination, scale or pose. We are habitually used to recognizing objects even in cluttered scenes. Humans can identify objects in tens of milliseconds [11,12], but the representation of the perceived information via hand movements or verbal responses for annotation is very slow compared to the processing speed of contemporary digital devices. In this regard, the emerging field of brain-Computer Interfaces (BCI) offers us an innovative way to exploit the power of human brain for data annotation with minimal effort. Brain-Computer Interfaces rely on various technologies for sensing brain activity such as Electroencephalography (EEG), MEG (Magnetoencephalography), PET (Positron Emission Tomography), SPECT (Single Photon Emission Computed Tomography), fMRI (functional Magnetic Resonance Imaging) and fNIRS (functional near infrared spectroscopy). Among these, EEG provides a high temporal resolution (sampling rate of up to 1 KHz) and adequate spatial resolution (1-2 cm). In this work, we specifically use the portable and easy-to-use consumer grade Emotiv EEG device, which enables a minimally intrusive user experience as users perform cognitive tasks, for sensing and recording brain activity. While having these advantages, consumer EEG devices nevertheless suffer from a high signal-to-noise ratio, which makes subsequent data analytics challenging. In this work, we focus on the annotation of a pre-selected object category over the entire image dataset instead of labeling all categories at once. If the images are presented serially in a sequence for annotation, then the task is equivalent to that of target detection. Now whenever an image containing a target class instance is observed by the human annotator, an event-related potential (ERP) signature known as P300 [13] is observed in the EEG data. By examining the EEG signals generated during image presentation, we can discover the images of interest and annotate them accordingly. In this paper, we provide the pipeline and architecture for image annotation via EEG signals. 2 Related work The use of EEG as an additional modality for computer vision and scene understanding tasks has been explored by a number of works. In [14], EEG signals are used to automate grab cut-based image segmentation. In [15], authors exploit ERP signatures such as P300 for image retrieval. In [16], authors use the N400 ERP to validate tags attached to video content. Emotions from movies and ads are inferred via EEG signals in [17] and [18]. Few studies directly use image category-based EEG signatures for recognizing aspects related to multimedia content as well as users. For example, the authors of [19] use EEG signals to classify images into three object categories– animals, faces and inanimate. In a recent work [20], the authors present how EEG features can be employed for multi-class image classification. Another recent work recognizes user gender from EEG responses to emotional faces [21]. Given the state-of-the-art, the key contributions of our work are we how how (i) the P300 ERP signature can be employed for image annotation; (ii) the model trained for one object category can be directly used for a novel category, and (iii) the image presentation time affects annotation system performance for complex images. 3 System architecture The proposed image annotation system consists of several components– RSVP generation, EEG data acquisition, EEG pre-processing, (binary) classification and outlier removal. Fig.1 presents an overview of the EEG-based annotation Fig. 1. EEG-based annotation pipeline: An exemplar illustration for the pizza object class is presented. Best viewed in color and under zoom. pipeline. The RSVP generation unit prepares the set of images for viewing, so that a few among those correspond to the target object category. The image sequence is created via random sampling from the whole dataset. A human annotator is then asked to identify the target category images as the sequence is presented rapidly, and the annotator’s brain activity is recorded via an EEG headset during the visual recognition task. The compiled EEG data is first preprocessed for artifact removal. Then, the classification unit categorizes the EEG responses into target and non-target annotations based on P300 patterns. Images classified as target are annotated with the target label class. However, this labeling is noisy due to the presence of false positives and imbalance towards the negative (non-target) class. An outlier removal unit finally performs unsupervised dimensionality reduction and clustering to improve the labeling precision. 3.1 Rapid Serial Visual Presentation and Oddball paradigm Rapid Serial Visual Presentation is popularly used in psychophysical studies, and involves a series of images or other stimuli types being presented to viewers with a speed of around 10 items per second. This paradigm is basically used to examine the characteristics pertaining to visual attention. In RSVP studies, the oddball phenomenon [22] is widely used. In the oddball paradigm, a deviant (target) stimulus is infrequently infused into a stream of audio/visual stimuli. For EEG-based annotation, we generated an RSVP sequence by combing a few target category images with many non-target images via random sampling from the original dataset. Each image in the sequence was then shown to the viewer for 100 ms, and a fixation cross was presented for 2 seconds at the beginning of the sequence to minimize memory effects and to record resting state brain activity (see Fig.4). 3.2 EEG data preprocessing and classification We used the Emotiv EPOC headset to record EEG data. This is a 14 channels (plus CMS/DRL references, P3/P4 locations) Au-plated dry electrode system. For ERP analysis, the Emotiv provides signals comparable to superior lab-grade EEG devices with 32, 64 or 128 channels. The headset uses sequential sampling at 2048 Hz internally which is down-sampled to 128 Hz. The incoming signal is automatically notch filtered at 50 and 60 Hz using a 5th order sinc notch filter. The resolution of the electrical potential is 1.95 µV. The locations for the 14 channels are as per International 10-20 locations as shown in Fig.2. Fig. 2. Sensor configuration: Emotiv electrode locations as per International 10-20 system. The recorded EEG data is contaminated by various noise undesirable signals that originate from outside the brain. For instance, while recording EEG, one often encounters 50/60Hz power-line noise and artifacts caused by muscle or eye movements. We extracted one second long epochs corresponding to each 100 ms long trial denoting the presentation of an image, with 128Hz sampling rate. Our EEG preprocessing includes (a) baseline power removal using the 0.5 second pre-stimulus samples, (b) band-pass filtering in 0.1-45Hz frequency range, (c) independent component analysis (ICA) to remove artifacts relating to eyeblinks, and eye and muscle movements. Muscle movement artifacts in EEG are mainly concentrated between 40-100 Hz. While most artifacts are removed upon EEG band-limiting, the remaining are removed manually via inspection of ICA components. The human brain’s response to a stimulus can be measured as a voltage fluctuation resulting from the ionic current within the neurons. The event-related potential is one such measure that is directly related to some motor, cognitive or sensory activation. Out of various ERP components, the P300 signature is Fig. 3. ERP plots: ERP curves for the Emotiv af3, af4, f3 and f4 channels for target (red) and not-target (blue) images. P300 signatures are evident for targets but not for non-targets. commonly elicited in the oddball paradigm where very few targets are mixed with a large number of non-targets. In our experimental setup, we employed a 1:12 ratio for target-to-non-target images. As shown in Fig.3, the P300 ERP signature is observed between 250 to 500 ms post target stimulus presentation. Also, the ERP response is significantly different for target and non-target images, and therefore can be exploited for EEG-based image annotation. We used the Convolutional Neural Network (CNN)-based EEGNet architecture [23] to classify our EEG data based on P300 detection in the RSVP task. The EEGnet architecture consists of only three convolutional layers. All layers use the Exponential Linear Unit (ELU) [24] as nonlinear activation function with parameter α = 1. We trained the model using the minibatch gradient descent algorithm with categorical cross-entropy criterion and Adam optimizer [25]. The models were trained on a NVIDIA GEFORCE GTX 1080 Ti GPU, with CUDA 8 and cuDNN v6 using the Pytorch [26] based Braindecode [27] library. 3.3 Outlier removal We select one category at a time for the annotation task, which results in class imbalance for the RSVP task. The selected object category forms the target class, while all other categories collectively form the non-target class. Due to this heavy class imbalance and the characteristics of P300 as discussed in Section 5, the false positive rate of the predicted labels is high. Therefore we performed unsupervised outlier removal on the predicted target images. Deep learning features have proven advantages over hand-crafted features like SIFT and HoG [28]. We used a pre-trained VGG-19 model [29] to obtain the feature descriptors for the targets. These feature descriptors provide compact representation of raw images while preserving the information required to distinguish between image classes. Each target image was fed forwarded within the VGG-19 model to obtain the 4096 dimensional feature vectors. Target images need not belong to the image classes on which the model is pre-trained. Then, we perform dimensionality reduction with t-SNE [30] to generate low-dimensional features. The t-SNE algorithm retains the local structure of the data while also revealing some important global structure, and hence it performs better than principal component analysis (PCA) alone. In our case, we assume that samples from the target class should be close in feature space as compared to non-target samples. By performing a grid search on hyper-parameters, we found that the algorithm works best with perplexity value 20, 50 PCA components and 3-5 output dimensions. Then, we performed k -means clustering for two classes assuming that target class samples will form a cluster distinct from the false positives. Also, since the false positive cluster would contain samples from many categories, the cluster would not be as dense as the target cluster. 4 4.1 Protocol design and Experiments Datasets To evaluate the performance of our image annotation system, we used the Caltech101 (CT) [31] and Pascal VOC2012 (PV) [32] datasets. The CT dataset consists of 101 object categories with 40 to 800 images per category. The PV dataset contains a total of 11,530 images from 20 categories, and multiple object categories can be present in one image. 4.2 Experimental setup We utilized 2500 images for training, and 2500 images for testing. Both these image sets comprised 200 images of a particular target category that we wanted to annotate. All images were resized 512×512 pixels, and images were displayed at 10 Hz frequency in blocks of 100 in order to minimize viewer distraction and fatigue. During the RSVP task, participants were shown a fixation display for 2 seconds at the beginning of each 100 image sequence. Train and test EEG data were captured using an identical experimental setup with the temporal gap of 5 minutes. Target image categories were decided a priori before every experiment. Our study was conducted with five graduate students (5 male, age 24.4 ± 2.1) with 10/20 corrected vision, seated at a distance of 60 cm from the display. A total of three sessions (each involving train and test set) were performed with each participant. To facilitate engagement, viewers were instructed to count the number of target images during the experiment. Target image classes were different for each session, and included categories like bike, pizza, panda, sofa, etc. Each participant performed two sessions on the CT dataset and one session on the PV dataset. Fig. 4. Experimental protocol: Participants completed two identical sessions (one used for training and the other for test) which were 5 minutes apart. Each session comprised 25 blocks of 100 images, and lasted about six minutes. 5 Results and Discussion Due to a heavy class imbalance between target and non-target category images, we use the F1-score to evaluate our annotation results. The F1-score is a popular performance metric used in retrieval studies, and denotes the harmonic mean of the precision and recall scores. All reported results denote the mean F1 achieved with five-fold cross validation. Table 1. Results synopsis: Annotation performance obtained for the CT and PV datasets across total 15 sessions (5 viewers). Dataset Caltech101 Pascal VOC 2012 Before outliers removal F1 score 0.71 0.68 Precision 0.66 0.63 Recall 0.81 0.72 F1 score 0.88 0.83 Precision 0.99 0.97 Recall 0.81 0.72 Target image percentage 8% 8% Image presentation speed 10 Hz 10 Hz Number of images in test set 2500 2500 After outliers removal In Table 1, we report the averaged F1 and precision-recall values for the CT and PV datasets across all participants. Note that the precision and F1 scores improve significantly upon outlier removal due to a stark reduction in the number of false positives via feature-based clustering. Overall F1 scores for the PV dataset are lower than for the CT dataset. This can be attributed to the fact that the PV dataset is more complex, as it contains multiple object classes in many images, as compared to CT which contains only one object class per image. As our annotation system is dependent on viewer ability, its performance is sensitive to human factors. One key factor is the image presentation rate. The image display latency (100 ms) is lower than the P300 response latency (≈ 300 ms) [33]. The rapid image display protocol results in (i) viewers confusing between similar object classes, (ii) viewers unable to fully comprehend visual information from complex images, and (iii) EEG data for consecutive images having significant overlap leading to misclassification. Therefore, we hypothesized that reducing the image display rate would (a) allow the viewer to better comprehend the visual content (especially for complex images), (b) better delineation of EEG responses, and (c) better manifestation of ERP signatures. These in turn, would improve our annotation performance while marginally reducing the annotation throughput. Fig.5 presents the observed results. Note that a 3% increase in F1-score is observed when the image presentation rate is reduced from 10 to 4 images/second, validating our hypothesis. Fig. 5. Presentation rate vs annotation performance: Variation in F1-score with image display rate. Conversely, since our annotation system is solely based on P300 signatures which are task specific but target class agnostic. Therefore, it is not mandatory to train the EEGNet with object class-specific EEG responses. To validate this aspect, we trained and tested the EEGNet with EEG responses corresponding to different object categories. Table 2 presents the F1 scores achieved for the five viewers with class-agnostic train and test EEG data. Note that only a marginal difference in annotation performance is noticeable with class-specific and classagnostic EEG data across viewers. Since we are using the pre-trained VGG-19 model exclusively to extract feature descriptors, it can be used without further fine tuning for any new target class categories. Table 2. Annotation performance with class-specific vs class-agnostic EEG data for five viewers. F1 Score Class-specific train and test Class-agnostic train and test 6 P1 P2 P3 P4 P5 0.88 0.85 0.86 0.85 0.89 0.84 0.87 0.86 0.88 0.86 Conclusion In order to facilitate large-scale image annotation efforts for computer vision and scene understanding applications, we propose an EEG-based fast image annotation system. Our annotation system exclusively relies on the P300 ERP signature, which is elicited upon the viewer detecting a pre-specified object class in the displayed image. A further outlier removal procedure based on binary feature-based clustering significantly improves annotation performance. Overall, our system achieves a peak F1-score of 0.88 with a 10 Hz annotation throughput. Another advantage of our method is that the P300 signature is specific to the target detection task, but not the underlying object class.Therefore, any novel image category can be annotated with existing models upon compiling the viewer EEG responses. Future work will focus on discovering and exploiting object-specific EEG signatures, and combining multiple human responses (e.g., EEG plus eye movements) for fine-grained object annotation and classification. References 1. S. Zhang, J. Huang, Y. Huang, Y. Yu, H. Li, and D. N. M., “Automatic image annotation using group sparsity,” in CVPR, 2010. 2. Y. Verma and C. Jawahar, “Image annotation using metric learning in semantic neighbourhoods,” in ECCV, 2012. 3. V. Yashaswi and C. Jawahar, “Exploring svm for image annotation in presence of confusing labels,” in BMVC,2013. 4. M. Everingham, L. Van Gool, C. K. I. Williams, J. Winn, and A. Zisserman, “The Pascal Visual Object Classes (VOC) challenge,” IJCV, vol. 88, no. 2, pp. 303–338, 2010. 5. H. Fu, Q. Zhang, and G. Qiu, “Random forest for image annotation,” in -ECCV 2012. 6. M. Wang and X.-S. Hua, “Active learning in multimedia annotation and retrieval: A survey,” TIST,2011. 7. G. Sychay, E. Chang, and K. Goh, “Effective image annotation via active learning,” in Proceedings. IEEE International Conference on Multimedia and Expo, vol. 1, 2002, pp. 209–212 vol.1. 8. P. Bakliwal and C. Jawahar, “Active learning based image annotation,” in NCVPRIPG. IEEE, 2015. 9. H. Katti, R. Subramanian, M. Kankanhalli, N. Sebe, T.-S. Chua, and K. R. Ramakrishnan, “Making computers look the way we look: Exploiting visual attention for image understanding,” in ACM International Conference on Multimedia, 2010, pp. 667–670. 10. R. Subramanian, D. Shankar, N. Sebe, and D. Melcher, “Emotion modulates eye movement patterns and subsequent memory for the gist and details of movie scenes.” Journal of Vision, vol. 14, no. 3, pp. 1–18, 2014. 11. A. Oliva, “Gist of the scene,” Neurobiology of attention, vol. 696, pp. 251–256, 2005. 12. C. Keysers, D. Xiao, P. Foldiak, and D. Perrett, “The speed of sight,” J. Cognitive Neurosci., pp. 90–101, 2001. 13. D. E. Linden, “The P300: where in the brain is it produced and what does it tell us?” The Neuroscientist, vol. 11, no. 6, pp. 563–576, 2005. 14. E. Mohedano, G. Healy, K. McGuinness, X. Giró-i Nieto, N. E. OConnor, and A. F. Smeaton, “Improving object segmentation by using eeg signals and rapid serial visual presentation,” Multimedia tools and applications, vol. 74, no. 22, pp. 10 137–10 159, 2015. 15. E. A. Pohlmeyer, J. Wang, D. C. Jangraw, B. Lou, S.-F. Chang, and P. Sajda, “Closing the loop in cortically-coupled computer vision: a brain–computer interface for searching image databases,” Journal of neural engineering, vol. 8, no. 3, p. 036025, 2011. 16. S. Koelstra, C. Mühl, and I. Patras, “Eeg analysis for implicit tagging of video data,” in Affective Computing and Intelligent Interaction and Workshops, 2009. ACII 2009. 3rd International Conference on. IEEE, 2009, pp. 1–6. 17. R. Subramanian, J. Wache, M. Abadi, R. Vieriu, S. Winkler, and N. Sebe, “ASCERTAIN: Emotion and personality recognition using commercial sensors,” IEEE Transactions on Affective Computing, 2016. 18. A. Shukla, S. S. Gullapuram, H. Katti, K. Yadati, M. Kankanhalli, and R. Subramanian, “Affect recognition in ads with application to computational advertising,” in ACM International Conference on Multimedia, 2017. 19. A. Kapoor, P. Shenoy, and D. Tan, “Combining brain computer interfaces with vision for object categorization,” in CVPR, 2008, 2008. 20. C. Spampinato, S. Palazzo, I. Kavasidis, D. Giordano, M. Shah, and N. Souly, “Deep learning human mind for automated visual classification,” 2017. 21. M. Bilalpur, S. M. Kia, M. Chawla, T. Chua, and R. Subramanian, “Gender and emotion recognition with implicit user signals,” in International Conference on Multimodal Interaction, 2017. 22. T. W. Picton et al., “The p300 wave of the human event-related potential,” Journal of clinical neurophysiology, vol. 9, pp. 456–456, 1992. 23. V. J. Lawhern, A. J. Solon, N. R. Waytowich, S. M. Gordon, C. P. Hung, and B. J. Lance, “Eegnet: A compact convolutional network for eeg-based brain-computer interfaces,” arXiv preprint arXiv:1611.08024, 2016. 24. D.-A. Clevert, T. Unterthiner, and S. Hochreiter, “Fast and accurate deep network learning by exponential linear units (elus),” arXiv preprint arXiv:1511.07289, 2015. 25. D. Kingma and J. Ba, “Adam: A method for stochastic optimization,” arXiv preprint arXiv:1412.6980, 2014. 26. A. Paszke, S. Chintala, R. Collobert, K. Kavukcuoglu, C. Farabet, S. Bengio, I. Melvin, J. Weston, and J. Mariethoz, “Pytorch: Tensors and dynamic neural 27. 28. 29. 30. 31. 32. 33. networks in python with strong gpu acceleration, may 2017,” https://github.com/ pytorch/pytorch. R. T. Schirrmeister, J. T. Springenberg, L. D. J. Fiederer, M. Glasstetter, K. Eggensperger, M. Tangermann, F. Hutter, W. Burgard, and T. Ball, “Deep learning with convolutional neural networks for eeg decoding and visualization,” Human Brain Mapping, aug 2017. [Online]. Available: http: //dx.doi.org/10.1002/hbm.23730 J. Yosinski, J. Clune, Y. Bengio, and H. Lipson, “How transferable are features in deep neural networks?” in Advances in neural information processing systems, 2014, pp. 3320–3328. K. Simonyan and A. Zisserman, “Very deep convolutional networks for large-scale image recognition,” CoRR, vol. abs/1409.1556, 2014. L. V. D. Maaten and G. Hinton, “Visualizing data using t-sne,” Journal of Machine Learning Research, vol. 9, no. Nov, pp. 2579–2605, 2008. L. Fei-Fei, R. Fergus, and P. Perona, “Learning generative visual models from few training examples: An incremental bayesian approach tested on 101 object categories,” Computer Vision and Image Understanding, vol. 106, no. 1, pp. 59– 70, 2007. M. Everingham, L. Van Gool, C. K. I. Williams, J. Winn, and A. Zisserman, “The PASCAL Visual Object Classes Challenge 2012 (VOC2012) Results.” J. Polich, “Updating P300: An integrative theory of p3a and p3b,” Clinical neurophysiology, vol. 118, no. 10, pp. 2128–2148, 2007.
1cs.CV
arXiv:1703.05630v2 [cs.CV] 17 Sep 2017 Anisotropic-Scale Junction Detection and Matching for Indoor Images Nan Xue1 , Gui-Song Xia1 , Xiang Bai2 , Liangpei Zhang1 , Weiming Shen1 , 1 State Key Lab. LIESMARS, Wuhan University, Wuhan, China. 2 Electronic Information School, Huazhong University of Science and Technology, China. September 19, 2017 Abstract Junctions play an important role in characterizing local geometrical structures of images, and the detection of which is a longstanding but challenging task. Existing junction detectors usually focus on identifying the location and orientations of junction branches while ignoring their scales which however contain rich geometries of images. This paper presents a novel approach for junction detection and characterization, which especially exploits the locally anisotropic geometries of a junction and estimates its scales by relying on an a-contrario model. The output junctions are with anisotropic scales, saying that a scale parameter is associated with each branch of a junction, and are thus named as anisotropicscale junctions (ASJs). We then apply the new detected ASJs for matching indoor images, where there are dramatic changes of viewpoints and the detected local visual features, e.g. key-points, are usually insufficient and lack distinctive ability. We propose to use the anisotropic geometries of our junctions to improve the matching precision of indoor images. The matching results on sets of indoor images demonstrate that our approach achieves the state-of-the-art performance on indoor image matching. 1 Introduction Image correspondence is a key problem for many computer vision tasks, such as structure-from-motion [1, 2, 3, 4], object recognition [5, 6] and many others [7, 8]. The past decades have witnessed the big successes on that problem achieved by detecting and matching local visual features [9, 10, 11, 12, 13]. Although most of existing image matching algorithms relying on such local visual features perform well for images containing rich photometric information, e.g. outdoor images, they usually lose their efficiency on images that are less photometric and dominated by geometrical structures such as indoor images displayed in Fig. 1. In the indoor scenario, images are often dominated by low-texture parts and are with severe viewpoint changes, in which case it is reported to be more effective to make the correspondence of geometrical structures [14, 15] such as line segments [16, 17] and junctions [18]. The line segment matching problem has been studied in recent years since it can represent more structural information than key-points. Many algorithms match line segments by using either photometric descriptors with individual line segments [19] or the initial geometric relation [14, 15] to assist line segment matching. The approaches using pre-estimated epipolar geometry usually perform better than those of using photometric descriptors [19], but the epipolar geometry estimation still needs key-point correspondences in many 1 Figure 1: A pair of indoor images. It can be seen that these images are dominated by geometrical structures. e.g. the edges of the door, and low-textured wall. situations. In the indoor scenes, due to the fact that descriptors for low-textured regions are not distinctive enough, it is very likely to produce unstable epipolar geometry for inferring the line segment matching. It is thus of great interest to develop elegant ways to make the correspondences of geometrical structures of images while get rid of the errors raised by the key-point correspondences, for finally achieving better matching of indoor images. Alternatively, as a kind of basic structural visual features, junctions, have been studied as the primary importance for perception and scene understanding in recent years [20,21,22]. Being a combination of points and ray segments, junctions contain richer information than line segments, i.e. including a location and at least two ray segments (known as branches). Ideally, the information contained by a pair of junctions enables us to recover the correspondences between images up to affine transformations. However, due to the difficulties in the estimation of the endpoints of junction branches, most of junction detection algorithms [23, 24, 25, 26, 27, 28] concentrate on identifying the locations and orientation of branches while ignoring their length. This actually simplifies junctions as key-points and does not fully exploit their capabilities for image correspondences. To characterize the structure of junctions better, the detector ACJ [28] estimates scale invariant junction and it can be represented isotropically as a circle region with two or more dominant orientations. Every orientation represents a branch of junction and the radius of circle is equal to the shortest length among these branches. Although the orientation of branches is invariant with respect to viewpoint, it is not enough for estimating the affine transformation. Fortunately, if we can estimate the length of every branch, the affine transformation will be determined by a pair of junction correspondence. Motivated by this, we are going to study for exploiting the invariance of junctions through estimating scale (length) of branches. For indoor images, the inherent scale for junctions usually are the length of some (straightforward) boundary for salient objects in images, which contains rich structure information and beyond local features. More precisely, we proposed an a-contrario approach that models the endpoints of a ray segment starting at given location with initial orientations, which check the proposed point if it should be a part of the ray segment according to number-of-false-alarms (NFA). When the points that belong to the ray segment occurs continuously until the continuity broken, the inherent scale for the ray segment is determined. In reality, the initial orientations are noised, we also optimize them with the junction-ness based on the acontrario theory. Once the anisotropic scale is estimated for each branch (ray segment), the local homography can be estimated from any pair of junctions extracting from two different images. Theoretically, the correct correspondence produce reasonable local affine homography while incorrect correspondences generate local homographies in their own way. Considering the certainty of junction locations, the regions around location can be mapped by correct or incorrect affine homography. Correct homographies will map one image to another with minimal patch distortion. Comparing the regions with induced affine homography for a pair of junctions can check if the pair are correspondence. When the corresponding junctions are identified in image pairs, the results will produce more structure information. Our contributions in this paper are 2 • We extent the junction detector in [28] to anisotropic-scale geometrical structures, which can better depict the geometric aspect of indoor images. • We developed an efficient scheme for making the correspondence of anisotropic-scale junctions. More precisely, as a detected anisotropic-scale junction provides at least three points, each pair of junctions in images can induce an affine homography. We finally present a strategy by induced homographies to generate accurate and reliable correspondences for the location and anisotropic branches of junctions simultaneously. • We evaluate our method on challenging indoor image pairs, e.g. some of images are from the indoor image datasets used in [29,30] and our results demonstrate that it can achieve state-of-the-art performance on matching indoor images. The rest of this paper is organized as follows. First, the existing research related to our work is given in Sec. 2. In Sec. 3, the problem of detecting and matching junctions for indoor scene is discussed. Next to this section, an a-contrario approach for detecting anisotropic-scale junction is described. As for the junction matching, we design a dissimilarity in Sec. 5 to find the correspondences. The experimental results and analysis for our approach are given in Sec .6. Finally, we conclude our paper in Sec. 7. 2 Related works In this section, we briefly review the existing approaches for junction detection and matching as well as geometrical structure matching for indoor images. 2.1 Junction detection Detecting junction structure in images has been studied for years [24, 26, 27, 31, 32, 33, 34]. In the early stage, junction was studied as corner points [31, 32]. For the sake of recognition, the scale of junctions or other key-points also have been studied [10, 28, 33]. These approaches estimate the scale around junction locations by using scale space theories [9,10,33,35] to handle the viewpoint changes across different images. Since these approaches determine the scale of interested points in very local area, their precision and discriminability will be lost quickly. Besides, these methods mainly focus on the localizations and scales of corner points while ignoring the differences between different type of junctions. To overcome these shortcomings, the ACJ detector [28] was proposed to detect and characterize junctions with non-linear scale space. In this work, an a-contrario approach is proposed for determining the location and branches of junctions with interpretable isotropic scales, which characterizes the ray segments as junction branches and locations explicitly. The scales for detected junctions correspond to the optimal size at which one can observe the junction in the image. Similar to junction detection, there is an elegant detector named edge based region (EBR) detector [12] for detecting affine invariant regions by estimating relative speed for two points that move away from a corner in both directions along the curve edges. This work can be regarded as a kind of junction detector in curve dominated images. The straight edges which are common in indoor scenario cannot be tackled in this way. Although above mentioned approaches can extract junctions, their geometric representation is not exploited sufficiently. The scales estimated by these methods are local and insufficient for characterizing indoor scenes. 2.2 Junction matching Junction matching has been attended since early years and shown promising matching accuracy [18, 36]. In [18], a model for estimating endpoints of junction branches is proposed which is very close to our work that estimating anisotropic scales for each branch. Differently, their approach [18] requires a roughly estimated 3 fundamental matrix while our proposed method estimating anisotropic scales for each branch directly without fundamental matrix. For known fundamental matrix, the local homography between a pair of junctions can be estimated to produce more accurate results and refining epipolar geometry meanwhile [36]. These results are very related to recent approach for the hierarchical line segment matching approach LJL [15]. In this work, detected line segments are used to generate junctions with virtual intersections in the first stage. After that, junctions are regarded as key-points for matching initially. Finally the epipolar geometry induced from initial matching is used to estimate line segment correspondences with local junctions. The matching accuracy in fact relies on the descriptors of virtual intersections. Although their matching results are promising, the problem of estimating epipolar geometry need to other ways. 2.3 Indoor image matching with geometric structure Most of indoor scenes can be described by using simple geometric elements such as points and line segments. As a combination of points and lines, junction is also a sort of useful geometrical structure for indoor scene. There has been many approaches such as Canny edge detector [37] and line segment detector (LSD) [16, 17] to extract line segments. LSD, which can produce more complete line segments than canny edge without any parameter tuning procedure, has been applied in many tasks such as line-segments matching [15] and 3D reconstruction [38]. Compared with key-points, line-segments can produce more complete result that contain the primary sketch for the scene. Most of algorithms for line-segments matching rely on key-point correspondences. More precisely, keypoints for an input image pair are firstly detected by using SIFT [10] or other detectors while estimating the epipolar geometry between the image pair by using RANSAC [39] and its variants. Based on the fundamental matrix F induced by key-points matching, many approaches such as line-point-invariant (LPI) [14] and linejunction-line (LJL) [15] can match line segments correctly. LPI has ability to handle the relation between linesegments and matched key-points with viewpoint changes. LJL [15] method matches image pairs in multiple stages. In the first, detected line-segments are intersected with appropriate threshold to produce junctions and matching these intersections in the same way with key-points matching. Then, local homography are estimated for these junctions with the estimated fundamental matrices from key-points matching results. Although these approaches produce good performance in many cases, the matching results are in favor of matching lines instead of line-segments. Their results show that lines are matched while the endpoints of line segments are not matched very well. Except for the reason that the estimated epipolar geometry is sometime erroneous, there is a important reason for failure of line-segments matching that line segment detectors can not guarantee that the line-segments are consistent across imaging condition varying. In many situations, a k 1 , . . . , lB line segment lA detected in image IA might be decomposed to two or more collinear line segments lB in another image IB . In this case, the results of line matching can be regarded as correct if the line in lA 1 k . However, in the aspect of line-segments matching, there exists no correct is corresponding with lB , . . . , lB corresponding line-segments for lA in image IB . On the other hand, the existing line segment matchers rely on the results of key-point matching. Once the key-points matching failed or inaccurate, the induced result of line segment matching will be affected in some extent. 3 3.1 Problem Statement Junction Model The early researches for junction detection usually focus on the orientations of branches and the locations while ignoring the length or scale of each branch. Even though the junction locations and orientation of branches are important to depict geometric structure for images, lacking scale of branches limits their performance for image matching. Motivated by this, we want to propose a new junction model for characterizing junction better. We define the our junction model by considering the endpoint of each branch. Since the 4 µ1 µ1 r1 p r3 r2 r p µ3 µ3 µ2 µ2 Figure 2: Template of isotropic-scale junction (left) defined in ACJ [28] and anisotropic-scale junction (ASJ) (right) proposed in our work. length of every branch is possible to be different, we call our model as anisotropic-scale junction. As a special case, junction model with isometric branches is called isotropic-scale junction. Definition 1 (Anisotropic-scale junction) An anisotrpic-scale junction with M branches starting at the same location p is denote as n o M  = p, {ri , θi }i=1 (1) where ri and θi are the scale and orientation for i-th branch, M is the number of branches. Fig. 2 provides an example for the difference between anisotropic-scale (left) and isotropic-scale (right) junctions is shown. The isotropic-scale junction is actually a special case for the anisotropic model when the length of all branches are identical. 3.2 Detecting Junction Locations and Isotropic Branches Since junction is formed by several intersected line segments, the problem of localizing the intersection and identifying the normal angle of these line segments is easier to be focused. Once the isotropic junction model is defined, this problem becomes a template matching problem. Based on this idea, Xia et al. exploited the junction-ness for branches with given scale r and orientations θi and then an a-contrario approach is derived to determine meaningful junctions for input images [28]. The junction-ness for given scale r and orientation θi actually contains the neighbor information of normalized gradient. Different from points, the neighborhood for a given scale r and θi is a sector. As shown in the left of Fig. 2, the dark area with θ1 represent the sector neighbor of the branch. The sector neighbor for given location p, scale r and orientation θ can be denoted mathematically as ~ ≤ r, Sp (r, θ) := {q ∈ Ω; q = 6 p, kpqk . ~ θ) ≤ ∆(r)} d2π (α(pq), (2) where the ∆(r) is defined as τr with some predefined parameter τ , Ω is the domain of input image, d2π is ~ is the angle the distance along the unit circle, defined as d2π (α, β) = min (|α − β|, 2π − |α − β|) and α(pq) ~ in [0, 2π]. of the vector pq 5 Since a junction is formed by edges and corner points, the normal angle for gradient should be consistent with the orientation of branches. Followed with this idea, if most of points q ∈ Sp (r, θ) have close normal angles with orientation θ, the corresponding scale r and orientation θ should be meaningful to be a branch of the junction. For a given sector Sp (r, θ), the junction-ness can be measured by X ωp (r, θ) = γp (q), (3) q∈Sp (r,θ) and γp (q) is the pairwise junction-ness with ˜ ~ · max(|cos(φ(q) − α(pq))| γp (q) = ∇I(q) , (4) ~ − |sin(φ(q) − α(pq))| , 0) ˜ is the norm of normalized gradient at point p, φ(q) for pixel q is defined as φ(q) = where the ∇I(q) I (q) (arctan Ixy (q) + π/2) modulo (2π), Ix , Iy are the partial derivative of input image in x and y direction. For the isotropic scale junction with two or more branches, the minimal junction-ness for one of the branches is used to describe the junction-ness for the entire junction with the equation (5) t() := min m=1,...,M ωp (r, θm ), (5) where the number M and m represent the total number of branches and branch index for the junction . 3.3 Analysis for Estimating Anisotropic-scale Branches Although the equation (5) measures junction-ness for a given junction, it does not contain any anisotropic scale for branches. Such definition of junction-ness only keeps the information that each branch’s scale ri is larger than r and it cannot be used for handling more sophisticated transformations such as affine transform and projective transform. To overcome this problem, we define the anisotropic-scale junctions with independent scales in Def. 1. The difference between isotropic-scale junction and the anisotropic-scale one can be observed in Fig. 2. It is easy to see that the junction-ness for entire junction defined in Eq. (5) cannot be used to exploit independent scales ri . Fortunately, the isotropic-scale junctions detected by ACJ [28] is meaningful and the problem of estimating scale ri and orientation θi can be simplified to estimating only scale ri with given location p and orientation θi . In other words, for the detected isotropic junctions, we need to exploit a robust method to estimate the length of corresponding ray segment with specific orientation θ. One plausible way to model the unknown scale with respect to given location p and orientation r is that simply modify the junction-ness defined in Eq (3) to ωp (r) with specific θ. Then, the a-contrario approach in [28] seems to be feasible to check whether the scale r is ε-meaningful. The corresponding cumulative distribution function (CDF) used to get ε-meaningful scale r can be formulate to  Z +∞  J(r,θ) F (t; J(r, θ)) = P{ωp ≥ t} = d ? p (6) t j=1 where the p represents the distribution of random variable ωp (r, θ) with p(z) = z2 1 2 z (δ0 (z) + √ e− 4 erfc( ))1z≥0 . 2 2 π (7) J(r,θ) J(r, θ) is the number of pixels in corresponding sector neighbor and the operator ?j=1 produces the convolutional probability density function (PDF) with J(r, θ) times, which actually represents the random variable of ωp (r, θ). The ε-meaningful scale for given orientation and location can be determined by the inequality NFA() := #J (1) · F (t; J(r, θ)) ≤ ε, 6 (8) 900 800 700 600 t 500 400 300 200 100 0 0 200 400 600 800 1000 1200 1400 1600 1800 2000 J(r,θ) Figure 3: The relationship between the convolution times J(r, θ) and corresponding minimal value with F (t; J(r, θ)) = 0 where #J (1) is the number of test for junctions with 1 branch. However, the NFA defined in Eq. (8) has to face the fact that there exist several junctions in indoor images which have extremely large scale branches. This fact would lead to the above inequality disabled. To illustrate this problem, we studied the relationship between convolution times J(r, θ) with the minimal junction-ness that can make the probability F (t; J(r, θ)) = 0. As shown in Fig. 3, if the value of ωp (r, θ) is greater than J(r,θ) 2 , the probability of F (t; J(r, θ)) will be equal to 0 constantly, which may cause the inequality degenerated to 0 ≤ ε. In fact, the pairwise junction-ness defined in Eq (4) can reach to 1 and then the ωp (r, θ) will be equal to J(r, θ). Therefore, the junction-ness in [28] is infeasible to model the unknown scale. 4 An a-contrario model for anisotropic-scale junction detection To solve the problems addressed in Sec. 3, we derive a differential junction-ness model for depicting scale with given location and orientation. Since the scale ri for each branch of junction  is irrelevant, we just model the endpoint of each branch independently. 4.1 Differential Junction-ness Model Suppose the isotropic junctions have been detected in a small scale r0 , the inherent scales of branches will be greater than r0 . If we increase the scale r0 to larger r1 , though the junction-ness is still larger, the error ωerr = ωp (r1 , θ) − ωp (r0 , θ) will not be increased significant. A reasonable way to recognize the un-significant variation is to study the variation of ωp (r, θ) with respect to r increased. Here, we first reformulate the junction-ness for a branch (3) in continuous form. The junction-ness for position p, scale R and orientation θ is Z Z r ωp (r, θ) = θ+δ(r) dr 0 γp (p + r (cos ψ, sin ψ)) dψ, (9) θ−δ(r) where the δ(r) is the angle width for given scale, here, we select δ(r) = ∂ωp (r,θ) is given by ∂r 7 τ r. The descrete partial derivative    ∂ωp (r, θ) X cos ψi = γp p + r sin ψi ∂r i    X cos(θ − δ(r)) 0 +δ (r) γp p + ri sin(θ − δ(r)) , i   X  cos(θ + δ(r)) +δ 0 (r) γp p + ri sin(θ + δ(r)) (10) i where ψi is the i-th sample angle in the range [θ − δ(r), θ + δ(r)] and ri is the i-th sample point in the range [0, r]. 4.2 Null Hypothesis and Distribution After the differential junction-ness model built, we need to find a robust way to check if the value of ∂ωp(r,θ) /∂r for specific r is significant enough. One way to achieve this goal is developing an a-contrario approach to control the threshold automatically. Since our work is an extension of ACJ [28], the null hypothesis here ˜ should be same, we say the variables ∇I(q) and φ(q) follow the null hypothesis H0 if ˜ 1. ∀q ∈ Ω, ∇I(q) follows a Rayleigh distribution with parameter 1; 2. ∀q ∈ Ω, φ(q) follows a uniform distribution over [0, 2π]; ˜ 3. All of the random variables ∇I(q) , φ(q)}q∈Ω are independent each other. According to the dicussion in [28], every γp (q) follows the distribution (7) independently. The random ∂ω follows the distribution of the random variable variable p(r,θ) ∂r Sr = m X Xi + δ 0 (r) k X (Yi + Zi ), (11) i=1 i=1 where the random variable Xi , Yi , Zi follow the distribution in equation (7) , m is the number of sampling points for ψi and k is the number of sampling points for ri . The function δ 0 (r) will be very small for reasonable τ ) since parameter τ should have small values. Hence, the r (for example, r ≥ 4 induced |δ 0 (r)| = rτ2 ≤ 16 Pthe m random variable could be approximated with Sr ≈ i=1 Xi for computational simplicity. In practice, k is Pk larger than 10 and therefore the PDF of i=1 (Yi + Zi ) can be apprixmated accurately by using the Central Limit Theorem as   1 (t − 2kµ)2 f (t) = √ exp − (12) 4kσ 2 4kσ 2 π P  k Y + Z is where µ and σ 2 are the expectation and variance of (7). The PDF of δ 0 (R) i i i=1 2τ t+ R R2 R2 1 2 kµ f˜(t) = f (− t) = q exp − τ2 2 τ τ τ 2 · 2kσ 2 R 4 2π · 2kσ 2 R 4 ! , (13) 2τ 2 2 4 which is P the Gaussian distribution with mean − R Meanwhile, the random 2 kµ and variance 2kσ τ /R . m 2 variable i=1 Xi follows N (mµ, mσ ). Therefore, the random variable S follows the distribution N (mµ − 2kµ Rτ2 , mσ 2 + 2kσ 2 τ 2 /R4 ) approximately. 8  The probability P Sr ≥ ∂ωp (r,θ) ∂r  for given r and θ follows the distribution f (t)   Z ∞ M  ∂ωp Pp (r, θ) := P Sr ≥ = d ? p , i=1 ∂r ∂ωp /∂r (14) describes the fact that scale cannot be increased with a sufficient small incremental at R along orientation θ under the hypothesis H0 . The smaller probability Pp (r, θ) is, the more confident that scale r is a reasonable scale. The small probability P(r, θ) means that the point p + r · [cos θ, sin θ] belongs to the branch with high possibility. Ideally, the existed branch should produce a series small probability in a interval [r0 , r1 ]. Then, the (maximum) scale of the branch should be defined as r1 . We use the probability Pp (r, θ) to check if the point pθr = p + r · [cos θ, sin θ]T belongs to the branch. 4.3 Number of Test and Number of False Alarms In last subsection, we conclude that sufficient small probability of Pp (r, θ) indicates that the point with certain direction θ and radius R belongs to the branch more probably. The definition of sufficient probability need to be cleared. According to the Helmholtz principle, we bound the sufficient probability with the expectation of the number of occurrences of this event is less than ε under the a-contrario random assumption [40] with NFA(r, p, θ) = Ns · Pp (r, θ) ≤ ε, where the Ns denotes the number of occurrences of the point occurs along the given location and orientation. Since √ the location and orientation of the branch are known, expected number of false alarms should be smaller than N M where N and M are the number of rows and columns of the corresponding image. When the point pθr ∀r ∈ (0, r1 ] rejects the hypothesis H0 , the scale of the branch should be r1 . The scale R is called as the maximum (meaningful) scale of the branch if the scale R is the maximum scale that satisfies inequality √ NFA(r, p, θ) = N M · Pp (r, θ) ≤ ε, ∀r ∈ (0, R]. Usually, the ε is defined as 1, which means the expected Number of False Alarm is not larger than 1. 4.4 Scale Ambiguity for Branches Junctions are located at the intersections of line segments. Suppose there exist two junctions 1 = {p1 , {r11 , θ11 }, {r12 , θ12 }}, 2 = {p2 , {r21 , θ21 }, {r22 , θ22 }} where the two-tuples {{rij , θij }} denotes the scale and orientation for the j-th branch of the i-th junction and  T pi is location of the i-th junction. In the case that the junction 2 is located at p2 = p1 + r11 cos θ11 , sin θ11 and θ11 = θ21 , the scale ambiguity occurs since the line segment p1 p2 and the branch {r21 , θ21 } are co-linear. The scale of the first branch of 1 can be regarded as either r11 or r11 +r21 . For example, there are two junctions 1 and 2 located at p1 and p2 respectively in the Fig. 4. The branch along the direction of p1 p2 for 1 and 2 are co-linear with the line segment marked as red. For the branch of 1 , its scales are kp2 − p1 k, kp3 − p1 k and kp4 − p1 k while the scales of the branch of 2 are kp3 − p2 k or kp4 − p2 k. To eliminate the ambiguity, we define the scale for a branch as follow Definition 2 (Scale of a branch) Suppose there exist a branch starting at point p in the direction θ, the possible salient scales are r1 , r2 , . . . , rm , we define the scale of this branch r∗ as r∗ = max ri . i 9 q4 o4 q3 o3 q2 o2 p0 p1 p2 p3 q0 o0 p4 Figure 4: Scale ambiguity for branches. The junction 1 and 2 located at p1 and p2 have more than one scales respectively. The branch with such scale is more stable and more global than other features. However, there exist some challenges to estimate such scales from images. Most existing approaches and the model proposed in Sec. 4.3 estimate the line segment or branches based on orientations of level-lines extracted from the gradient of image [16]. The line segment detected from the image in Fig. 4 could be either p1 p2 or p1 p3 since the level-line around the points p2 have probability to aligned with the orientation of vector o2 − p2 , which will lead to the line segment that are co-linear with the branch of 1 across the point p2 to p3 or p4 . When the viewpoint changed, illumination varied or noise increased, the orientations of level-lines around p2 , p3 and p4 will be changed with uncertainty. Then, the scale cannot be estimated robust for different imaging conditions. Fortunately, the inherent property for location of junctions is stable whatever the imaging condition is. Although the orientations of level-lines around the locations of junctions will change with uncertainty, most of them are still aligned to one of the lines that intersects the junction. Motivated by this, we use the very local isotropic-scale junctions in a small neighbor(e.g. 5 × 5 or 7 × 7 window size) instead of gradient field and level-lines. For a pixel in an image, we calculate the junction-ness for different orientations in a small neighbor according to ACJ [28] algorithm as   1  X γp (q) √  √ − nµ , ωp (θ) = (15) σ n q∈Sp (θ) where Sp (θ) is defined in (2) with fixed radius (eg. r = 3, 5, 7), n is the cardinal number of set Sp (θ). µ and σ 2 are the mean and variance defined in (13). Then, we leverage the non-maximal-suppression (NMS) [41] to obtain the very local junctions and filter out branches for these junctions with non-meaningful NFA values i according to (8). These very local junctions are denoted as p = {θpi , ωpi , NFAip }K i=1 , where the ωp and the i NFAp is the strength and corresponding NFA value for branch with θi orientation. In the case that pixel p is on (around) an edge, there will be two θi that align to the orientation of this edge up to ±π. If the pixel p is around another junction, there will be multiple orientations aligned with different branches of this junction. Meanwhile, we incorporate the strength ωpi instead of the norm of (normalized) gradient with into the a-contrario model proposed in Sec. 4.3 with modified probabilistic distribution. 10 4.5 Modified Probabilistic Distribution For the sake of estimating scale for a branch with definition 2, the functions γp and ωp (r, θ) measuring the junction-ness should be changed to ~ γ̃p (q) = ωqi · max( cos(θqi − α(pq)) − ~ sin(θqi − α(pq)) , 0) (16) and ω̃p (r, θ) = X γ̃p (q), (17) q∈Sp (r,θ) where the index i in Eq. (16) is the orientation θqi that is most close to θ. According to the Central Limit Theorem(CLT), the random variable ωpi follows the Gaussian distribution with mean 0 and variance 1, the distribution for γ̃p (q) is √ Z 1 z2 1 2 1 − 2y 1 e 2p dy, (18) p̃(z) = δ0 (z) + 1z6=0 √ 2 π3 0 y 2 − y2 Then, the null Hypothesis discussed in Sec. 4.2 is updated to   Z ∞ M  ∂ ω̃p Pp (r, θ) := P Sr ≥ = d ? p̃ . i=1 ∂r ∂ ω̃p /∂r 4.6 (19) Junction Detection So far, the a-contrario approach for anisotropic scale estimation is derived. For an input image, isotropic junctions and local junctions for each pixel are firstly detected by ACJ [28] for initialization. The results for junctions are denoted as {i }N i=1 and local junctions at fixed small scale (usually r = 3, 5, 7) for every pixels where p is the coordinate of a pixel. are p = {θpi , ωpi , NFAip }K i=1 j We estimate the scale ri for branch θij according to the Number of False Alarm √ NFA(rij , pi , θij ) = N M · Pp (rij , θij ) ≤ ε, where the probability Pp (r, θ) is the updated version in Eq. (19). The scale rij is searched starting at ri until the NFA is larger than ε. The accuracy for orientations of branches detected by ACJ [28] is depend on the scale ri which is bounded by a predefined parameter and hence noised. The scales for ASJ is more sensitive to the noise which should be refined. A branch with the most accurate orientation θ should have the maximum junction-ness with the scale rθ , we optimize the objective function X θ̂ = arg max γp (q), (20) θ q∈Sp (rθ ,θ) to refine the orientation for θ and check the branch with orientation θ̂ and scale rθ̂ is ε-meaningful branch. 5 ASJ Matching for Indoor Images Since the ASJs contain rich geometric structure informations represented by the anisotropic scales, we are going to study the matching method taken full advantage of ASJs. For a pair of junction P and Q detected from images I P and I Q , the homography can be estimated by the points set that contain their locations and 11 endpoints for branches, which can be used to compare junctions for correct correspondences. Since there exist L-junctions, Y -junctions and X-junctions in an image and the type of a junction might be different across images because of occlusion, the homography estimated from a pair of junctions might be invalid. Fortunately, whatever the type of junction is, the location can be intersected from any two of branches that are not parallel each other, which is saying that a junction with more than two branches can be decomposed two several L-junctions. Without saying, the L-junction with two branches that their orientation θ1 and θ2 are equal up to π should be filtered out. After decomposing and filtering, the detected in an image are all L-junctions. The perspective effects are typically small on a local patch [42], which can be approximated by affine homography. We use a pair of L-junctions to estimate such homographies. Suppose there are N P and Q NQ NP N Q decomposed L-junctions in image I P and I Q , denoted as {P i }i=1 and {i }i=1 respectively. If a pair of Q junctions (P n , m ) are matched, an affine homography would be induced once the orientations are determined. In order to derive a unique affine homography, we define the partial order for two branches (r1 , θ1 ) and (r2 , θ2 ) of a L-junction as ( 1 1 (r , θ ) < (r2 , θ2 ), if hθ1 , θ2 i < π . (21) (r1 , θ1 ) < (r2 , θ2 ), if hθ1 , θ2 i > π Every junction need to be sorted by the order defined above. The affine homography for a pair of junction Q P n and m are estimated by using DLT (Direct Linear Transform) with their locations and endpoints for the branches. More precisely, we solve the equations qi = Hpi , i = 0, 1, 2, (22) Q where pi and qi are the homogeneous representation of locations and two branches for P n and m respectively. The matrix H is   h1 h2 h3 H = h4 h5 h6  0 0 1 represents the affine transform induced by pi and qi for i = 0, 1, 2. From the image pair (I P , I Q ), there can be N P × N Q affine homographies, denoted by Hn,m , which maps the n-th junction in I P to m-th junction in I Q . For correct correspondence , the matrix Hn,m will map the image I P to I Q accurate around the location of junctions while the mismatch will map the image I P only correct at the endpoints and locations but erroneous at other positions. For the sake of saving computational P Q Q P P resource, we just map a patch P(P and map P(Q by using n ) around n to P(n ) in I m ) to P(m ) in I Q −1 are measured by and  . Then, the distance between two features P matrix Hn,m and its inverse Hn,m n m Q P Q Q P D(P n , m ) = D̃(P(n ), P(n )) + D̃(P(m ), P(m )) (23) where the distance D̃ are the distance between two patches calculated by raw patches, SIFT descriptor or other descriptors. Benefiting with the homographies induced by ASJ, the distance between original patches and mapped patches for correct correspondence is usually very small while larger for incorrect correspondence, we can use ratio test proposed in [10] to filter out the incorrect correspondence. 6 Experimental Analysis This section illustrates the results and analysis for ASJ detection and matching routines with comparison to existing approaches for junction detection, junction matching, key-points matching and line segment corresponding. In our experiments, we first detect anisotropic-scaled junctions by relying on the procedures presented in Section 4, and then make the correspondence of junctions with the affine homography induced by these semi-local geometrical structures. 12 6.1 Stability and Control of the Number of False Detection The a-contrario approaches detect meaningful events controlled by the threshold : it bounds the average number of false detections in an image following null hypothesis. In this subsection, we check the average number of false detections in Gaussian noise image and illustrate the results of detected ASJs with fixed threshold . Experimentally, we generate 1000 random images with 256 × 256 pixels which follow standard Gaussian distribution independently pixel-wised. For each pixel, we generate an orientation randomly from the uniform distribution in the interval [0, 2π) and estimate scale at this pixel with the orientation. Ideally, there is no meaningful line-segment structure appeared in random images but might be detected mistakenly, which are counted in number of false detection averagely. If the number of false detection can be controlled by the NFA proposed a-contrario approach, the approach would be identified as correct a-contrario approach. The (a) original images 1 1 1 ASJ ACJ 0.9 ASJ ACJ ASJ ACJ 0.8 0.7 0.6 0.5 0.8 Repeatability rate Repeatability rate Repeatability rate 0.8 0.6 0.4 0.2 0.6 0.4 0.2 0.4 0.3 0 1 0.8 0.6 0.4 0.2 0 1 0.8 Scale factor 0.6 0.4 0.2 1 0.8 Scale factor 0.6 0.4 0.2 Scale factor (b) repeatability rate with respect to scale changes Figure 5: Repeatability rate with respect to scale change. Original images to generate image sequences are shown in the first row. In the second row, the repeatability is shown as a function of scale factors. Table 1: Average number of false detections in 1000 images generated by Gaussian white noises  0.01 0.1 1 10 100 200 Avg. False 0.002 0.006 0.198 5.923 66.472 132.676 average number of false detections in 1000 Gaussian noise images are reported in the Tab. 1. The value of NFA are varied in our experiments from 10−2 to 102 and the corresponding average number of false detections are upper bounded by the NFA. 6.2 Comparison with ACJ It is necessary to compare the repeatability for our proposed ASJ with ACJ since we extend the a-contrario model for scale estimation to discuss their difference. Following with the baseline experiments proposed 13 in [28], these images are firstly zoomed with different factors to form the image sequences with scale change. Then, the ASJ and ACJ are performed on these image sequences to detect the junctions. The repeatability for ACJ is discussed in [28], however, their definition for corresponding junction just concentrates on the location and branch of junctions while ignoring the scale coherence. Therefore, we are going to define the corresponding ACJ and ASJ with scale information here. For the original image I0 and the scaled image Is = s(I0 ), the corresponding ACJ junctions should have close locations, branch orientations as well as scales. Meanwhile, two junctions with different number of branches cannot be identified as correspondence. More s M precisely, we define two ACJ junctions 1 = {p1 , r1 , {θi }M i=1 } and 2 = {p2 , r2 , {θi }i=1 } detected in I0 and Is if they follow ks · p1 − p2 k2 < 3, (24) |s · r1 − r2 | < 3, (25) π , min d2π (θ, θ0 ) < max M M 0 20 θ∈{θi }i=1 θ ∈{θi }i=1 (26) where the angular distance d2π (θ, θ0 ) = min(|θ − θ0 | , 2π − |θ − θ0 |). Similar to the above, the correspons M dence for two junctions 1 = {p1 , {ri , θi }M i=1 } and 2 = {p2 , {ri , θi }i=1 } detected by ASJ should satisfy the inequalities (24), (26) as well as max min |s · r − r0 | < 3. (27) s M 0 r∈{ri }M i=1 r ∈{ri }i=1 In this experiment, the set of scale factors is {1.0, 0.9, 0.8, . . . , 0.3} and the results are shown in Fig. 5. Observing the repeatability curve, our proposed ASJ performs better than ACJ. The repeatability rate reported in [28] is higher, however, it just demonstrate the accuracy of locations and orientation of branches. In our experiment, the scale difference are also considered here. As reported in [28], the scale of ACJ represents the length of shortest branch and it is roughly linear through the scale factors [28]. Theoretically, if a detected ACJ has scale r in original image, its correspondence in the scaled image s(I) should be close enough to s · r. However, the upper bound of scale is required for ACJ algorithm as input and it is recommend to be set as in the range of [12, 30] constantly [28] for the sake of computational speed. As a matter of fact, the junctions in indoor images usually have large scale branches and they cannot be bound with a relative small constant. To demonstrate this fact, we compare the detected junctions in Fig. 6. In this experiment, the junctions are detected by ACJ firstly in original image I and scaled image s(I) with the factor s firstly. Then we find the corresponding ACJ in the image pair by using the inequalities (26) and (24) while ignoring the inequality (25). For the sake of comparing the scale of junctions with respect to factor s, all the correspondences are shown with colored circle. In Fig. 6, a correspondence of 2 = p2 , r2 , {θis }M i=1 in image s(I) which has scale r1 is shown with a yellow circle with the radius r1 · s. The red circle and green line segments present the junction 2 . We can find out that there exist several correspondences which do not have consistent scales. If a junction is formed by several line segments of which lengths are more than 1/s time of maximal radius threshold of ACJ, the scale of junction will be equal to the threshold in the original image. When the image is zoomed with factor s, the scale will not be decreased since it is still larger than the threshold. This is the reason why the repeatability is lower when we use the inequality (25) to calculate it. In the final of this subsection, some example results of ASJ detector for indoor images are shown in Fig. 7. The anisotropic-scale junction are shown in the middle column and the results of ACJ are listed in the right column. Observing the results, we can find that ASJ has the ability to detect more geometric structure than ACJ. The anisotropic-scale branches of a junction can depict the layout of indoor scenes. By contrast, the results of ACJ just represent the very local information. For example, there are several rectangles in the Fig. 7, our ASJ can produce the boundary of the rectangle while ACJ just detect the corner points and orientations around the corners of rectangle. 14 Figure 6: The scale consistency between the original image and scaled image. The yellow circles represent the scale estimated in the scaled image with scale factor s while red circles represent the scales detected in original images. The scale factors are s = 0.6 for the top row and s = 0.3 for the bottom. Figure 7: Some results of ASJ for the input images in the first column are shown in the middle column. The junctions detected by ACJ are shown in the right column for comparison. 6.3 ASJ Matching In order to evaluate our approach, we collect more than 100 images to perform our proposed approach ASJ. Some of the collected images are from indoor 3D reconstruction dataset [29, 30] while others are taken by ourselves. As shown in Fig. 8, the collected images are less texture than natural images. Some of them contain large viewpoint changes and indistinct texture repeated regions such as Fig. 8(b), Fig. 8(i) and Fig. 8(l). We define that two junctions are matched, only if the junction centers and orientations of branches are 15 (a) (b) (c) (d) (e) (f) (g) (h) (i) (j) (k) (l) Figure 8: Some example of collected indoor images used for comparison of different matching approaches. corresponding. In this sense, our matching result is somewhat beyond of local features and can be compared with existing approaches in different settings: - It is comparable to keypoint matching methods, if we regard junctions as a specific corner points with two orientations; - It is also comparable to line segment matching ones, if we take junctions as several intersecting line segments. For key-points matching, we compare the results of matched junctions with SIFT [10], Affine-SIFT [13,43], Hessian-Affine [44], EBR and IBR in [12]. Meanwhile, we compare maching accuracy with existing approaches LPI [14] and LJL [15] for matched line segments that measures the proportion of matches if their endpoints are corresponding. This rule is more strict for assessing line segment matching results. Interestingly, the approaches LPI [15] and LJL [15] use the epipolar geometry without outliers to assist their line segment matcher, our proposed method without epipolar geometry achieves better accuracy. The implementation for Affine-SIFT [13, 43], Hessian Affine [44], LPI [14] and LJL [15] are getting from authors’ homepage. EBR and IBR [12] are got from VGG’s website1 . The version of SIFT detector is provided by VLFeat2 . The descriptor used in our experiment is SIFT and the mismatches are filtered according to the ratio test with threshold 1.5 for ASJ , SIFT [10], Hessian-Affine [44], EBR [12] and IBR [12] by comparing the `2 -distance, which is the default threshold for computing matches from descriptor in VLFeat. Remarkably, the implementation of Affine-SIFT [13,43] provided by its authors use threshold 1.33 since they calculate the distance with `1 norm and we keep it unchanged. Since the released code for Affine-SIFT [13, 43] produce the matched result with outliers filtering, we remove this procedure in all fairness, which makes the results in our experiment different from the released executable program. All of parameters for compared approaches are the default value which is provided by their authors. 1 http://www.robots.ox.ac.uk/ 2 http://www.vlfeat.org ~vgg/research/affine/descriptors.html#binaries 16 Table 2: Comparison of different matching methods. The number of correct matches, number of total matches and the matching accuracy for the comparision with key-points matching results are reported in the first row. The results for key point matching approaches SIFT [10], Affine-SIFT [13, 43], Hessian-Affine [44], EBR [12] and IBR [12] are list in the 3-th row to 7-th row. The average matching accuracy for all collected images is reported in the last column. Image pairs Methods Ours (Junctions) SIFT [10] Affine-SIFT [13] Hessian-Affine [44] EBR [12] IBR [12] #correct #total accuracy (%) #correct #total accuracy (%) #correct #total accuracy (%) #correct #total accuracy (%) #correct #total accuracy (%) #correct #total accuracy (%) (a) (a) (b) (c) (d) (e) (f) (g) (h) (i) (j) (k) (l) 12 12 100.00 128 206 62.14 135 141 95.74 24 26 92.31 0 1 0.00 0 4 0.00 26 29 89.66 476 700 68.00 183 240 76.25 13 34 38.24 0 1 0.00 0 9 0.00 12 13 92.31 559 839 66.63 433 519 83.43 96 132 72.73 10 16 62.50 28 39 71.79 16 20 80.00 115 222 51.80 364 480 75.83 82 105 78.10 0 15 0.00 11 16 68.75 50 60 83.33 435 652 66.72 430 549 78.32 66 109 60.55 0 10 0.00 14 25 56.00 14 15 93.33 74 287 25.78 119 133 89.47 17 18 94.44 0 2 0.00 0 9 0.00 197 214 92.06 708 770 91.95 4141 4205 98.48 640 671 95.38 64 75 85.33 46 63 73.02 65 69 94.20 199 261 76.25 1271 1326 95.85 226 248 91.13 20 21 95.24 0 12 0.00 119 121 98.35 147 330 44.55 136 240 56.67 32 63 50.79 28 46 60.87 0 10 0.00 37 45 82.22 200 299 66.89 172 263 65.40 114 144 79.17 14 34 41.18 10 21 47.62 17 19 89.47 103 191 53.93 196 224 87.50 38 41 92.68 0 2 0.00 0 8 0.00 33 40 82.50 65 161 40.37 163 264 61.74 29 49 59.18 0 4 0.00 0 5 0.00 (b) Average accuracy 85.17% 62.69% 82.85% 79.68% 32.56% 31.84% (c) Figure 9: Top row: plotted correct matched ASJ in image pairs Fig. 8(a), Fig. 8(e) and Fig. 8(h). Bottom row: plotted correct matched keypoints by using Affine-SIFT [13, 43]. Although the number of correct matches for Affine-SIFT is more than ASJ, the ASJ can represent structure information for the input images while plotted key-points are confused if we do not have input image for reference. 6.3.1 Matching results for key-points matching As shown in Tab. 2, our proposed feature ASJ is compare with most widely used feature detectors. In the sense for key-points matching, we regard an ASJ as a key-point with two specific orientations. The matching accuracy for ASJ is better than other key-points matches in most cases. Representatively, in Fig. 8(i), the indistinct repeated region in chessboard are matched very well with the accuracy 98.35% since ASJs makes corner points contain more global information than other approaches, which represents the relative position with meaningful orientations in images. Comparing with the most related approach EBR and IBR [12], our proposed approach ASJ handles straight edges in a better way which can produce more key-points and more correct correspondences. In many cases as shown in Tab. 2, the results of EBR and IBR illustrate their limitation in indoor images which are dominated by straight edges. 17 In the aspect of absolute number of correct matches, ASJ is less than other approaches significantly. The approaches matching most number of correct matches are Affine-SIFT and SIFT. Since the junctions detected in indoor images represents the meaningful junctions in the scene, the fact that absolute number is less than SIFT key-points is not surprising. Nevertheless, ASJ represents the structure information compactly for scenes than key-points. To illustrate this, we plot the correct matched key-points and ASJs in the clean background, the structure of the scene can be represented by ASJs with their branches while plotted keypoints are hard to understand without their input images. As shown in Fig. 9, the matched ASJs represents the geometric information with small number of ASJs (12 for Fig. 9 (a), 50 for Fig. 9 (b) and 65 for Fig. 9(c) while matched ASIFT key-points show confused results even though the amount of matches are much more than ASJs. Some example of match results are shown in Fig. 10. (a) (#correct matches, #total matches) = (16, 20) (b) (#correct matches, #total matches) = (119, 121) Figure 10: Matched ASJs for image pairs Fig. 8 (d) and Fig. 8 (i) are shown in the sub-figures (a) and (b) respectively. The false matches are connected as yellow lines while correct matches are connected by cyan lines. 6.3.2 Matching results for line-segments matching We evaluate the matched line-segments with state-of-the-art approaches LPI [14] and LJL [15] for the comparison in a more strict rule that compare endpoints of corresponding line-segments instead of their line equation. For the example image pairs shown in Fig. 8, our proposed method is better than existing methods in considerable advantage for most cases. Some matched results for line segments are shown in Fig. 11 and Fig. 12. The number of correct matched line-segments are also comparable with other approaches. Besides of the matching accuracy, the result shown in Fig. 12 for our method cover the scene more complete. Different from the approaches LPI [14] and LJL [15], our approach performs better while not using any pre-estimated geometric information. As shown the Tab. 3, we will find that key-point driven approach for 18 Table 3: Comparison of different matching methods for line segment matching. The number of correct matches are counted by the rule that endpoints of corresponding line-segments are correct. We compare ASJ with state-of-the-art approaches LPI [14] and LJL [15] and report the number of correct matches, number of total matches and the matching accuracy in this table. The average matching accuracy is also compare in the last column. Image pairs Methods Ours (Line segments) LPI [14] LJL [15] #correct #total accuracy (%) #correct #total accuracy (%) #correct #total accuracy (%) (a) (b) (c) (d) (e) (f) (g) (h) (i) (j) (k) (l) 15 24 62.50 5 9 55.56 8 30 26.67 30 58 51.72 0 0 0.00 24 79 30.38 14 26 53.85 15 18 83.33 26 32 81.25 26 40 65.00 19 29 65.52 37 64 57.81 85 120 70.83 53 90 58.89 148 251 58.96 21 30 70.00 3 9 33.33 4 17 23.53 349 428 81.54 123 193 63.73 221 376 58.78 121 138 87.68 60 102 58.82 113 186 60.75 232 242 95.87 33 59 55.93 129 138 93.48 49 90 54.44 17 38 44.74 50 131 38.17 27 38 71.05 11 15 73.33 26 50 52.00 48 80 60.00 16 40 40.00 22 102 21.57 Average accuracy 71.55% 48.83% 52.95% Figure 11: Matched line-segments for image pair Fig. 8 (f). (#correct matches, #total matches) = (21, 30). Midpoints of matched line-segments are connect by cyan lines (if they are correct) or yellow lines (mismatches). Figure 12: Matched line segments for image pair Fig. 8 (b). Left and mid-left: correct matched line-segments for ASJ; Right and mid-right: correct matched line-segments for LJL [15]. The result of ASJ covers the scene more complete benefiting with the anisotropic scales for branches of junctions. line segment matching is possible to be failed because of the erroneous estimated geometric relationship. Observing the failed case reported in Tab. 3, the image pair in Fig. 12 is dominant by repeated texture and severe viewpoint change which are challenging for key-point matching. In such scenario, the induced epipolar geometry might be unreliable and therefore produce poor line segment matching results. On the other hand, 19 because our approach performs well in junction matching, we can also use the junction correspondences to refine the line segment matching result. 7 Conclusion In this paper, we proposed a novel junction detector ASJ which exploits the anisotropy of junctions via estimating the endpoints (length) of branches for isotropic scale junctions for indoor images which are dominanted by junctions in a more global manner. We then devised an affine invariant dissimilarity measure to match these anisotropic-scale junctions across different images. We tested our method on a collected indoor images and compared its performance with several current sate-of-the-art methods. The results demonstrated that our approach establishes new state-of-the-art performance on the indoor image dataset. References [1] C. Wu, “Towards linear-time incremental structure from motion,” in International Conference on 3D Vision, 2013, pp. 127–134. [2] D. J. Crandall, A. Owens, N. Snavely, and D. P. Huttenlocher, “Sfm with mrfs: Discrete-continuous optimization for large-scale structure from motion,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 35, no. 12, pp. 2841–2853, 2013. [3] S. Fuhrmann, F. Langguth, and M. Goesele, “MVE - A multi-view reconstruction environment,” in Eurographics Workshop on Graphics and Cultural Heritage, Darmstadt, Germany, 2014, pp. 11–18. [4] P. Moulon, P. Monasse, R. Marlet, and Others, “Openmvg. an open multiple view geometry library.” https://github.com/openMVG/openMVG. [5] B. Wang, X. Bai, X. Wang, W. Liu, and Z. Tu, “Object recognition using junctions,” in European Conference on Computer Vision, 2010, pp. 15–28. [6] A. Y. S. Chia, D. Rajan, M. K. Leung, and S. Rahardja, “Object recognition by discriminative combinations of line segments, ellipses, and appearance features,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 34, no. 9, pp. 1758–1772, 2012. [7] J. Yan, J. Wang, H. Zha, X. Yang, and S. M. Chu, “Multi-view point registration via alternating optimization,” in AAAI Conference on Artificial Intelligence, 2015, pp. 3834–3840. [8] Y. Shen, W. Lin, J. Yan, M. Xu, J. Wu, and J. Wang, “Person re-identification with correspondence structure learning,” in IEEE International Conference on Computer Vision, 2015, pp. 3200–3208. [9] K. Mikolajczyk and C. Schmid, “An affine invariant interest point detector,” in European Conference on Computer Vision, 2002, pp. 128–142. [10] D. G. Lowe, “Distinctive image features from scale-invariant keypoints,” International Journal of Computer Vision, vol. 60, no. 2, pp. 91–110, 2004. [11] J. Matas, O. Chum, M. Urban, and T. Pajdla, “Robust wide baseline stereo from maximally stable extremal regions,” in British Machine Vision Conference, 2002, pp. 1–10. [12] T. Tuytelaars and L. J. V. Gool, “Matching widely separated views based on affine invariant regions,” International Journal of Computer Vision, vol. 59, no. 1, pp. 61–85, 2004. 20 [13] G. Yu and J. Morel, “ASIFT: an algorithm for fully affine invariant comparison,” IPOL Journal, vol. 1, pp. 11–38, 2011. [14] B. Fan, F. Wu, and Z. Hu, “Robust line matching through line-point invariants,” Pattern Recognition, vol. 45, no. 2, pp. 794–805, 2012. [15] K. Li, J. Yao, X. Lu, L. Li, and Z. Zhang, “Hierarchical line matching based on line-junction-line structure descriptor and local homography estimation,” Neurocomputing, vol. 184, pp. 207–220, 2016. [16] R. G. von Gioi, J. Jakubowicz, J. Morel, and G. Randall, “LSD: A fast line segment detector with a false detection control,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 32, no. 4, pp. 722–732, 2010. [17] ——, “LSD: a line segment detector,” IPOL Journal, vol. 2, pp. 35–55, 2012. [18] X. Shen and P. Palmer, “Uncertainty propagation and the matching of junctions as feature groupings,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 22, no. 12, pp. 1381–1395, 2000. [19] Z. Wang, F. Wu, and Z. Hu, “MSLD: A robust descriptor for line matching,” Pattern Recognition, vol. 42, no. 5, pp. 941–953, 2009. [20] D. Marr, “A computational investigation into the human representation and processing of visual information,” Vision, pp. 125–126, 1982. [21] E. H. Adelson, “Lightness perception and lightness illusions,” New Cogn. Neurosci, vol. 339, 2000. [22] C. Guo, S. C. Zhu, and Y. N. Wu, “Primal sketch: Integrating structure and texture,” Computer Vision and Image Understanding, vol. 106, no. 1, pp. 5–19, 2007. [23] T. Wu, G. Xia, and S. C. Zhu, “Compositional boosting for computing hierarchical image structures,” in CVPR, 18-23 June 2007. [24] M. Maire, P. Arbelaez, C. C. Fowlkes, and J. Malik, “Using contours to detect and localize junctions in natural images,” in CVPR, June 24-26 2008. [25] E. D. Sinzinger, “A model-based approach to junction detection using radial energy,” Pattern Recognition, vol. 41, no. 2, pp. 494–505, 2008. [26] Z. Püspöki and M. Unser, “Template-free wavelet-based detection of local symmetries,” IEEE Transactions on Image Processing, vol. 24, no. 10, pp. 3009–3018, 2015. [27] Z. Püspöki, V. Uhlmann, C. Vonesch, and M. Unser, “Design of steerable wavelets to detect multifold junctions,” IEEE Transactions on Image Processing, vol. 25, no. 2, pp. 643–657, 2016. [28] G. Xia, J. Delon, and Y. Gousseau, “Accurate junction detection and characterization in natural images,” International Journal of Computer Vision, vol. 106, no. 1, pp. 31–56, 2014. [29] F. Srajer, A. G. Schwing, M. Pollefeys, and T. Pajdla, “Match box: Indoor image matching via box-like scene estimation,” in International Conference on 3D Vision, 2014, pp. 705–712. [30] Y. Furukawa, B. Curless, S. M. Seitz, and R. Szeliski, “Reconstructing building interiors from images,” in IEEE Conference on Computer Vision and Pattern Recognition, September 27 - October 4 2009, pp. 80–87. [31] W. Förstner, “A feature based correspondence algorithm for image matching,” International Archives of Photogrammetry and Remote Sensing, vol. 26, no. 3, pp. 150–166, 1986. 21 [32] C. Harris and M. Stephens, “A combined corner and edge detector,” in Alvey Vision Conference, 1988, pp. 147–151. [33] K. Mikolajczyk and C. Schmid, “Scale & affine invariant interest point detectors,” International Journal of Computer Vision, vol. 60, no. 1, pp. 63–86, 2004. [34] W. Förstner, T. Dickscheid, and F. Schindler, “Detecting interpretable and accurate scale-invariant keypoints,” in IEEE Conference on Computer Vision and Pattern Recognition, 2009, pp. 2256–2263. [35] L. Alvarez and F. Morales, “Affine morphological multiscale analysis of corners and multiple junctions,” International Journal of Computer Vision, vol. 25, no. 2, pp. 95–107, 1997. [36] É. Vincent and R. Laganière, “Junction matching and fundamental matrix recovery in widely separated views,” in British Machine Vision Conference, 2004, pp. 1–10. [37] B. P. D. Ruff, “A pipelined architecture for the canny edge detector,” in Alvey Vision Conference, Cambridge, UK, 1987, pp. 1–4. [38] S. Ramalingam, M. Antunes, D. Snow, G. H. Lee, and S. Pillai, “Line-sweep: Cross-ratio for widebaseline matching and 3d reconstruction,” in IEEE Conference on Computer Vision and Pattern Recognition, 2015, pp. 1238–1246. [39] M. A. Fischler and R. C. Bolles, “Random sample consensus: A paradigm for model fitting with applications to image analysis and automated cartography,” Communications of the ACM, vol. 24, no. 6, pp. 381–395, 1981. [40] A. Desolneux, L. Moisan, and J.-M. Morel, From Gestalt Theory to Image Analysis: A Probabilistic Approach, 1st ed. Springer Publishing Company, Incorporated, 2007. [41] A. Neubeck and L. J. V. Gool, “Efficient non-maximum suppression,” in IEEE International Conference on Pattern Recognition, 2006, pp. 850–855. [42] K. Mikolajczyk and C. Schmid, “A performance evaluation of local descriptors,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 27, no. 10, pp. 1615–1630, 2005. [43] J. Morel and G. Yu, “ASIFT: A new framework for fully affine invariant image comparison,” SIAM J. Imaging Sciences, vol. 2, no. 2, pp. 438–469, 2009. [44] M. Perdoch, O. Chum, and J. Matas, “Efficient representation of local geometry for large scale object retrieval,” in IEEE Conference on Computer Vision and Pattern Recognition, 2009, pp. 9–16. 22
1cs.CV
arXiv:1605.07156v1 [cs.LG] 23 May 2016 Genetic Architect: Discovering Genomic Structure with Learned Neural Architectures Laura Deming∗, Sasha Targ∗, Nate Sauder, Diogo Almeida, Chun Jimmie Ye Institute for Human Genetics University of California, San Francisco, CA 94143, USA Enlitic San Francisco, CA 94111, USA [email protected], [email protected] [email protected], [email protected], [email protected] Abstract Each human genome is a 3 billion base pair set of encoding instructions. Decoding the genome using deep learning fundamentally differs from most tasks, as we do not know the full structure of the data and therefore cannot design architectures to suit it. As such, architectures that fit the structure of genomics should be learned not prescribed. Here, we develop a novel search algorithm, applicable across domains, that discovers an optimal architecture which simultaneously learns general genomic patterns and identifies the most important sequence motifs in predicting functional genomic outcomes. The architectures we find using this algorithm succeed at using only RNA expression data to predict gene regulatory structure, learn humaninterpretable visualizations of key sequence motifs, and surpass state-of-the-art results on benchmark genomics challenges. 1 Introduction Deep learning demonstrates excellent performance on tasks in computer vision, text and many other fields. Most deep learning architectures consist of matrix operations composed with non-linearity activations. Critically, the problem domain governs how matrix weights are shared. In convolutional neural networks – dominant in image processing – translational equivariance (“edge/color detectors are useful everywhere”) is encoded through the use of the convolution operation; in recurrent networks – dominant in sequential data – temporal transitions are captured by shared hidden-to-hidden matrices. These architectures mirror human intuitions and priors on the structure of the underlying data. Genomics is an excellent domain to study how we might learn optimal architectures on poorlyunderstood data because while we have intuition that local patterns and long-range sequential dependencies affect genetic function, much structure remains to be discovered. The genome is a very challenging data type, because although we have tens of thousands of whole genome sequences, we understand only a small subset of base pairs within each sequence. While the genetic code allows us to annotate the 5% of the genome encoding proteins (∼20,000 genes in the human genome), we do not have a “grammar” for decoding the rest of the non-coding sequences (90-95% of the mouse and human genomes) important for gene regulation, evolution of species and susceptibility to diseases. The availability of a wealth of genomic assays (PBM, CHIP-seq, Hi-C) allows us to directly measure the function of specific regions of the genome, creating an enormous opportunity to decode non-coding sequences. However, the overwhelming volume of new data makes our job as decoders of the genome quite complex. The design and application of new domain-specific ∗ Equal Contribution Submitted to 29th Conference on Neural Information Processing Systems (NIPS 2016). Do not distribute. architectures to these datasets is a promising approach for automating interpretation of genomic information into forms that humans can grasp. 2 Related Work Inspired by human foveal attention where global glances drive sequential local focus, attention components have been added to neural networks yielding state-of-the-art results on tasks as diverse as caption generation, machine translation, protein sublocalization, and differentiable programming. There are two main architectural implementations: hard attention, where the network’s focus mechanism non-differentiably samples from the available input, and soft attention, where the component outputs an expected glimpse using a weighted average. Beyond biological inspiration, these components enable improved performance and excellent intepretability. Other techniques have been applied for interpreting neural networks without changing their architectures (Simonyan et al. [2013], Zeiler and Fergus [2014], Springenberg et al. [2014]), but these are simply heuristics for finding the relevant regions of an input and do not work with all existing modern neural network components. Previous groups have demonstrated excellent progress applying deep learning to genomics. Both Alipanahi et al. [2015] and Lanchantin et al. [2016] provide initial results on the task of learning which sequences a transcription factor (a biological entity which affects gene expression) can bind using convolutional architectures. This problem appears suited for convolution, as motifs determining binding are expected to be modular (∼7-10 base pair units) and the setup of the task (preselected input sequences of fixed short length) does not allow for learning significant long-term dependencies. In particular, Alipanahi et al. [2015] demonstrated that a single-layer convolutional neural network, DeepBind, outperformed 26 other tested machine learning approaches in predicting probe intensities on protein binding microarrays from the DREAM5 PBM challenge, and then showed that the same architecture generalized to the related task of predicting transcription factor binding sites (TFBSs) from sequencing measurements of bound DNA. Subsequently, Lanchantin et al. [2016] showed that a deeper network with the addition of highway layers improved on DeepBind results in the majority of cases tested [Srivastava et al., 2015]. In addition, Basset [Kelley et al., 2015], an architecture trained to predict motifs of accessible DNA from sequencing regions of open chromatin, was able to map half of the first layer convolutional filters to human TFBSs. 3 Development of Genetic Architect Deep learning algorithm development is often dependent on the knowledge of human domain experts. Researchers in domains such as computer vision and natural language processing have spent much more time tuning architectures than in genomics. The challenge in genomics is that our insufficient understanding of biology limits our ability to inform architectural decisions based on data. Early genomic deep learning architectures have shown promising results but have undertaken only limited exploration of the architectural search space over possible components. In addition, not all components work well together, and there is evidence optimal component choice is highly dependent on the domain. Accordingly, we design a novel road-map for applying deep learning to data on which we have limited prior understanding, by developing an iterative architecture search over standard and cutting-edge neural net building blocks. Prior approaches to architecture search focus on finding the best architecture in a single step, rather than sequentially learning more about the architecture space and iteratively improving models (Bergstra et al. [2011], Bergstra and Bengio [2012], Snoek et al. [2012]). Our framework understands the results allowing us to sequentially narrow the search space and learn about which combinations of components are most important. Since our algorithm limits the most important hyperparameters to their best ranges, they no longer dominate the search space and we discover additional hyperparameters that are most important and can help us create a highly tuned architecture. The sequential nature allows us to fork our architectural search into independent subspaces of coadapted components, thus enabling further search in each parallel branch to be exponentially more efficient than considering the union of all promising architectures. The heart of the framework is an interactive visualization tool (Figure 4). Given any hyperparameter optimization run, it produces common patterns for the best few datapoints and presents this information in highly-interpretable decision trees showing effective architectural subspace and plots of the 2 Table 1: Mean and median AUC of models and percentage of datasets on which each model outperforms DeepBind or DeepMotif. model DeepBind DeepMotif AttentionNet mean AUC 0.904 0.927 0.933 median AUC 0.932 0.949 0.952 vs DeepBind 85.2 92.6 vs DeepMotif 67.6 interactions between the most significiant hyperparameters, informing general domain intuition and guiding future experiments. The framework is general enough to be applied to other domains, and is orthogonal to existing hyperparameter optimization algorithms. These algorithms can be applied in the inner loop of the sequential search of our tool, which then interprets the results and informs the user about the domain and how to manually prune the search space. We employ Genetic Architect to discover an optimal architecture for a novel genome annotation task, regression to predict lineage-specific gene expression based on genomic sequence inputs, for which six stages of architecture search were required. Figure 1A shows the sequential process of architecture search, the most important findings at each stage of the process, and tool-guided division of the search into two separate promising architectures. By splitting effective architectures into separate branches for further optimization, our tool identifies high-performing but architecture-specific choices that may be difficult to notice when architectures are mixed together. The application of our tool demonstrates the power in refining architectural components that dominate results to uncover additional hyperparameter combinations that perform well together. Several examples we encounter during use of the tool for design of architectures for genomics follow: 1) removal of batch normalization demonstrated clear superiority of exponential linear units, 2) dimensionality reduction in the middle of the convolutional network module was beneficial to the recurrent-based architectures (perhaps since it decreased the distance of long-range dependencies), and 3) in contrast, non-recurrent architectures required wider layers (likely to enable processing of long-range dependencies in final dense layers). In our search over architectures using soft attention, we found that fully-connected layers were preferred to convolutional layers as it made processing global information more important. Finally, only by proceeding through several steps of optimization did we find the unintuitive result that bidirectional LSTMs did not help with attentional models (perhaps because the preceding layer effectively attends to a single location, making it difficult to combine information from both directions). The final models learned by Genetic Architect consist of several initial layers of convolutions, residual blocks, an LSTM layer in the case of the PromoterNet architecture, and an attention-based dimensionality reducing step followed by fully-connected layers. Previous approaches to genome annotation use convolutional networks, which are ideal for detecting local features. However, more closely approximating the structure of genomic information would take into account that a real genome is a sequence, not a disjointed set, of local features – an input type on which recurrent architectures generally excel. In addition, with larger sequences to analyze (identifiable promoter sequences reach hundreds of base pairs in length), a neural network must learn to focus on the most important parts of the sequence and integrate new information derived from each part with the contextual information of the previously-seen sequence. As such, long genomic sequences seem an ideal fit for the recurrent attentional models learned. 4 Experimental Results 4.1 4.1.1 Tasks Transcription factor binding site (TFBS) classification The TFBS binary classification task was proposed by Alipanahi et al. [2015] and used as a benchmark by [Lanchantin et al., 2016]. The basic motivation is to learn a classifier that correctly predicts, from empirical binding data on a training sample of short DNA sequences, which sequences in a separate test set are TFBS (likely to be bound by biological entities, in this case, a given transcription factor protein). 3 Figure 1: Schematic of hyperparameter optimization and final architecture designs. A) Overview of steps taken in hyperparameter optimization to generate AttentionNet and PromoterNet. B) AttentionNet architecture. C) PromoterNet architecture. Figure 2: Results of AttentionNet on transcription factor binding site (TFBS) task. A) AttentionNet models outperform DeepMotif and DeepBind models trained on corresponding datasets. Each bar represents the difference in AUC for one of 108 different datasets. B) Mean of attention mask over all sequences in experiment. C) Recovery of transcription factor motifs by visualization of attention masks produced by AttentionNet over example sequences. The input and target data for the TFBS classification task consists of 108 datasets with an average of ∼31,000 sequences of 101 characters per dataset. Each sequence is a string of base pairs (A, C, G, or T) and is transformed into an array with one-hot encoding. Each sequence has an associated label (1 or 0) which indicates if this sequence is a TFBS. Each dataset represents a different chromatin immunoprecipitation sequencing (ChIP-seq) experiment with a specified transcription factor, and each sequence in the dataset a potential binding site. For each positive example, a negative example is generated. The data included in the TFBS classification task derive from ENCODE CHIP-seq experiments performed in K562 transformed human cell lines [Consortium, 2012]. 4 Figure 3: Results of PromoterNet on ImmGen lineage-specific expression prediction (ILSEP) task. A) Comparison of predicted versus observed gene expression for DeepBind, DeepMotif, and PromoterNet architectures. B) Visualization of attention mask over selected promoter sequences. C) Mean attention mask over all promoters. D) Visualization of attention masks learned by models trained on data from single lineages. 4.1.2 ImmGen lineage-specific expression prediction (ILSEP) regression In addition to the TFBS classification problem, neural network architectures could be extended to treat a much broader and complex variety of problems to do with interpreting biological data. Here, we develop a novel genomic benchmark task, ILSEP, which requires regression to predict empirically-determined related target data, namely, prediction of the amount of various biological entities produced in different cellular contexts given an input genomic sequence. The input dataset for the ILSEP task is 14,116 one-hot encoded (4,2000) input promoter sequences and corresponding (243,) floating point gene expression outputs ranging between 2.60 and 13.95 (see appendix for details). We split the dataset using 10-fold cross validation to obtain predictions for all promoter gene expression pairs. 5 4.2 4.2.1 Results on TFBS Model performance We benchmark the performance of AttentionNet models learned by hyperparameter optimization described above against published state-of-the-art neural network models on the TFBS task, DeepBind [Alipanahi et al., 2015] and DeepMotif [Lanchantin et al., 2016]. To compare the architectures, we train models for each of 108 datasets, as in Lanchantin et al. [2016]. In a head-to-head comparison on each dataset, AttentionNet outperforms DeepMotif in 67.6% of cases and the mean AUC across datasets for AttentionNet is 0.933, improving over both DeepMotif (0.927) and DeepBind (0.904) (Table 1). 4.2.2 Prediction and visualization of genomic information Interpretable information about sequence features is an important consideration for genomic learning tasks where fundamental understanding of biology is as important as prediction power. We hypothesize that a net which performed well on the TFBS classification task would be able to make biologically meaningful inferences about the sequence structure. We show that the mean attention weights across all positive sequences show a distinct “footprint” of transcription factor (TF) binding consistent with known nucleotide preferences within each sequence (Figure 2B). Further, visualizing the attention mask (with the addition of Gaussian blur) across input sequences for 10 representative TFs showed the net focusing its attention on parts of the sequence known to be regulatory (Figure 2C). To see if we could directly obtain motif sequences from the net, we took 10 nucleotides surrounding the position with highest attention for each of the top 100 sequences of a TF and averaged across the motifs. We took the maximum score for each nucleotide per position and queried the results against JASPAR, the “gold standard” TFBS database (with q < 0.5) [Mathelier et al., 2015]. 30/57 motifs possible to check (i.e. in JASPAR) were correct, and 39/57 corresponded to at least one transcription factor. By additionally searching the top 3 recurring sequences attended to for each TF, we recover a total of 42/57 correct motifs. 4.3 4.3.1 Results on ILSEP Model performance The PromoterNet architecture demonstrates a marked gain in performance over DeepBind and DeepMotif architectures adapted to the ILSEP regression task, achieving an average Pearson r correlation value of 0.587 between out-of-sample predictions and target expression values across lineages, compared to 0.506 and 0.441 for DeepBind [Alipanahi et al., 2015] and DeepMotif [Lanchantin et al., 2016] respectively (Figure 3A). We also train PromoterNet architectures on single task regression with a separate model for each of the 11 lineages and on cell type specific multi-task regression with one output unit for each of 243 cell types, which obtains similar improvements in average Pearson r correlation value of 0.592 over 0.502 for DeepBind and 0.498 for DeepMotif. 4.3.2 Promoter element recovery and visualization of proximal regulatory elements Visualization of attention mask weights from the PromoterNet model reveals attended locations over promoter sequences of 32 genes selected for highest mean expression across lineages are enriched directly adjacent to the TSS, suggesting that properties of the core promoter sequence constitute the most informative features for genes that do not show differences in expression across lineages (Figure 3B) (see appendix for list of genes). In contrast, attended locations over promoter sequences of 32 genes with maximal variance in expression across lineages span a much greater range of positions. This indicates that in genes with the greatest degree of lineage-specific expression, informative sequence features can occur throughout the promoter sequence. This observation merits follow up given previous reports that the performance of (non-deep) classifiers for cell type specific expression tasks trained only on TSS proximal promoter information is close to that of a random classifier [Natarajan et al., 2012]. Consistent with accepted understanding that TSS proximal regions contain genomic elements that control gene expression levels, we observe the maximum of average attention mask weights across all promoters occurs at the center of input sequences, which corresponds to 6 Table 2: Search space explored for AttentionNet and PromoterNet architectures, including techniques from Maas et al. [2013], Graham [2014], Shah et al. [2016], Ioffe and Szegedy [2015], He et al. [2015], Hochreiter and Schmidhuber [1997], Kingma and Ba [2014], Sutskever et al. [2013], Srivastava et al. [2014]. Hyperparameter conv filter size nonlinearity using batch normalization for convs number of conv filters number of convs before dim. reduction using residual blocks before dim. reduction type of dim. reduction dim. reduction stride number of convs after dim. reduction using residual blocks after dim. reduction number of RNN layers number of units in RNN RNN type using bidirectional RNNs RNN gradient clipping global reduction type number of FC layers number of units in FC using batch normalization for FCs dropout probability for FCs (after) L2 regularization optimizer learning rate scale batch size Values 3, 5, 7, 9 ReLU, Leaky ReLU, Very Leaky ReLU, ELU True, False 8, 16, 32, 64 1, 2, 3, 4, 5 True, False None, Max Pool, Mean Pool, Strided Conv 2, 4, 8 1, 2, 3, 4, 5 True, False 0, 1, 2 16, 32, 64 Simple RNN, LSTM True, False 0, 1, 5, 15 None, Attention, Max Pool, Mean Pool 0, 1, 2, 3 64, 128, 256, 512, 1024 True, False 0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6 0, 1e-3, 1e-4, 1e-5 Adam, SGD w/ Nesterov Momentum 0.03, 0.1, 0.3, 1.0, 2.0, 10. 25, 50, 125, 250 core promoter elements required for recruitment of transcriptional machinery [Maston et al., 2006] (Figure 3C). PromoterNet models trained for multi-task regression result in a global attention mask output across all lineages. To investigate whether the PromoterNet architecture is capable of learning distinct features for each lineage, we also visualize attention weights for a given promoter sequence from separate models, each trained on expression data for a single lineage. We find that genes selected for maximal variance in expression demonstrate distinct patterns of learned attention across lineages, while a shared pattern of attention is learned for a control gene with high mean expression in all lineages even when each lineage was trained on a separate model (Figure 3D). 5 Conclusion We tackle the problem of discovering architectures on datasets where human priors are not available. To do so we create a novel architecture search framework that is domain agnostic, is capable of sequential architectural subspace refinement and informing domain understanding, and is composable with existing hyperparameter optimization schemes. Using this search algorithm, we create stateof-the art architectures on significant challenges in the domain of genomics utilizing a combination of standard and cutting-edge components. In particular, the learned architecture is capable of simultaneous discovery of local and non-local patterns, important subsequences, and sequential composition thereby capturing substantial genomic structure. 7 Table 3: AttentionNet architecture Layer 3x1 conv 64 filters + BN + ELU 3x1 conv 64 filters + BN + ELU residual block (w/ 3x1 conv 64 filters + BN + ELU + 3x1 conv 64 filters + BN) residual block (w/ 3x1 conv 64 filters + BN + ELU + 3x1 conv 64 filters + BN) residual block (w/ 3x1 conv 64 filters + BN + ELU + 3x1 conv 64 filters + BN) residual block (w/ 3x1 conv 64 filters + BN + ELU + 3x1 conv 64 filters + BN) residual block (w/ 3x1 conv 64 filters + BN + ELU + 3x1 conv 64 filters + BN) attention (w/ 3x1 conv 64 filters + BN + tanh + 3x1 conv 1 filter + BN + softmax) FC 256 units + ELU + 0.2 dropout FC 256 units + ELU + 0.2 dropout FC 256 units + ELU + 0.2 dropout FC 1 unit + sigmoid Table 4: PromoterNet architecture Layer 5x1 conv 8 filters + BN + ELU 5x1 conv 8 filters + BN + ELU 5x1 conv 8 filters + BN + ELU 5x1 conv 8 filters + BN + ELU 4x1 maxpool, stride 4 residual block (w/ 5x1 conv 8 filters + BN + ELU + 5x1 conv 8 filters + BN) residual block (w/ 5x1 conv 8 filters + BN + ELU + 5x1 conv 8 filters + BN) residual block (w/ 5x1 conv 8 filters + BN + ELU + 5x1 conv 8 filters + BN) LSTM 16 units attention (w/ 5x1 conv 8 filters + BN + tanh + 5x1 conv 1 filter + BN + softmax) FC 256 units + ELU + 0.3 dropout FC 256 units + ELU + 0.3 dropout FC 256 units + ELU + 0.3 dropout FC 1 unit + sigmoid Figure 4: Example decision tree output from Genetic Architect visualization tool depicting significant hyperparameters for models with top 20% performance. 8 6 6.1 Appendix ILSEP data processing For the input sequences in the ILSEP task, we use sequences spanning 1 kilobase upstream and downstream of transcriptional start sites (TSS), the region of the promoter at which production of the gene is initiated, for 17,565 genes from the Eukaryotic Promoter Database [epd]. For the corresponding labels, we obtain expression data (log2 normalized microarray intensities) for each of these genes in each of 243 immune cell types from the ImmGen Consortium April 2012 release, which contains data for 21,755 genes x 243 immune cell types after quality control according to published methods [Ericson et al.]. Intersection of these two datasets by gene results in a dataset of 14,116 input promoter sequences and expression value target pairs. To create lineage-specific gene expression value targets, we combine cell types into 11 groups following the lineage tree outlined in previous work: B cells (B), dendritic cells (DC), gamma delta T cells (γδ), granulocytes (GN), macrophages (Mφ), monocytes (MO), natural killer cells (NK), stem and progenitor cells (SP), CD4+ T cells (T4), and CD8+ T cells (T8), and average expression values across samples within each group [Jojic et al., 2013]. 6.2 Selected genes (Figure 3B) Highest mean expression across lineages: Rac2, Rpl28, Pfn1, Rpl9, Ucp2, Tmsb4x, Tpt1, Rplp1, Hspa8, Srgn, Rpl27a, Rpl13a, Cd53, Eef2, Rps26, Cfl1, Ppia, Gm9104, Rps2, Rps27, Actg1, Laptm5, Rpl21, Eef1a1, Rplp0, Gm15427, Pabpc1, B2m, Gapdh, Actb, Rpl17, Rps6 Highest variance in expression across lineages: Plbd1, Tlr13, Tyrobp, Ifitm2, Pld4, Pla2g7, Gda, Cd96, Gzma, Nkg7, Ctsh, Klrb1c, Ccl6, Prkcq, Itgam, Sfpi1, Itk, Ms4a4b, Alox5ap, Ly86, Cd2, Fcer1g, Gimap3, Il2rb, Gimap4, Ifitm6, Cybb, Ifitm3, Mpeg1, H2-Aa, Cd3g, Lyz2 Random control: Krt84, Lrrc8b, 8030411F24Rik, Syngr2, Spint3, Slc17a4, Slc22a23, Thoc6, AF529169, Phf5a, Yif1b, 4930467E23Rik, Pgam1, Pcdhb1, Bak1, Neu3, Plcb2, Fabp4, Srgap1, Olfr1339, Sox12, Atg7, Gdf10, 1810008A18Rik, 1700011A15Rik, Anks4b, Magea2, Pygb, Spc25, Rras2, Slc28a3, 9130023H24Rik References Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. arXiv preprint arXiv:1312.6034, 2013. Matthew D Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In Computer vision–ECCV 2014, pages 818–833. Springer, 2014. Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. arXiv preprint arXiv:1412.6806, 2014. Babak Alipanahi, Andrew Delong, Matthew T Weirauch, and Brendan J Frey. Predicting the sequence specificities of dna-and rna-binding proteins by deep learning. Nature biotechnology, 2015. Jack Lanchantin, Ritambhara Singh, Zeming Lin, and Yanjun Qi. Deep motif: Visualizing genomic sequence classifications. arXiv preprint arXiv:1605.01133, 2016. Rupesh K Srivastava, Klaus Greff, and Jürgen Schmidhuber. Training very deep networks. In Advances in Neural Information Processing Systems, pages 2368–2376, 2015. David R Kelley, Jasper Snoek, and John Rinn. Basset: Learning the regulatory code of the accessible genome with deep convolutional neural networks. bioRxiv, page 028399, 2015. James S Bergstra, Rémi Bardenet, Yoshua Bengio, and Balázs Kégl. Algorithms for hyper-parameter optimization. In Advances in Neural Information Processing Systems, pages 2546–2554, 2011. James Bergstra and Yoshua Bengio. Random search for hyper-parameter optimization. The Journal of Machine Learning Research, 13(1):281–305, 2012. 9 Jasper Snoek, Hugo Larochelle, and Ryan P Adams. Practical bayesian optimization of machine learning algorithms. In Advances in neural information processing systems, pages 2951–2959, 2012. ENCODE Project Consortium. An integrated encyclopedia of dna elements in the human genome. Nature, 489(7414):57–74, 2012. Anthony Mathelier, Oriol Fornes, David J Arenillas, Chih-yu Chen, Grégoire Denay, Jessica Lee, Wenqiang Shi, Casper Shyr, Ge Tan, Rebecca Worsley-Hunt, et al. Jaspar 2016: a major expansion and update of the open-access database of transcription factor binding profiles. Nucleic acids research, page gkv1176, 2015. Anirudh Natarajan, Galip Gürkan Yardımcı, Nathan C. Sheffield, Gregory E. Crawford, and Uwe Ohler. Predicting cell-type–specific gene expression from regions of open chromatin. Genome Research, 22(9):1711–1722, 2012. doi: 10.1101/gr.135129.111. URL http://genome.cshlp. org/content/22/9/1711.abstract. Glenn A. Maston, Sarah K. Evans, and Michael R. Green. Transcriptional regulatory elements in the human genome. Annual Review of Genomics and Human Genetics, 7(1):29–59, 2006. doi: 10.1146/annurev.genom.7.080505.115623. URL http://dx.doi.org/10.1146/annurev. genom.7.080505.115623. PMID: 16719718. Andrew L Maas, Awni Y Hannun, and Andrew Y Ng. Rectifier nonlinearities improve neural network acoustic models. In Proc. ICML, volume 30, page 1, 2013. Benjamin Graham. Spatially-sparse convolutional neural networks. arXiv preprint arXiv:1409.6070, 2014. Anish Shah, Eashan Kadam, Hena Shah, and Sameer Shinde. Deep residual networks with exponential linear unit. arXiv preprint arXiv:1604.04112, 2016. Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015. Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385, 2015. Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735–1780, 1997. Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. Ilya Sutskever, James Martens, George Dahl, and Geoffrey Hinton. On the importance of initialization and momentum in deep learning. In Proceedings of the 30th international conference on machine learning (ICML-13), pages 1139–1147, 2013. Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15:1929–1958, 2014. Eukaryotic promoter database. URL http://epd.vital-it.ch/mouse/mouse_database.php. Jeff Ericson, Scott Davis, Jon Lesh, Melissa Howard, Diane Mathis, and Christophe Benoist. Immgen microarray gene expression data: Data generation and quality control pipeline. URL www.immgen. org/Protocols/ImmGenQCDocumentation_ALL-DataGeneration_0612.pdf. Vladimir Jojic, Tal Shay, Katelyn Sylvia, Or Zuk, Xin Sun, Joonsoo Kang, Aviv Regev, Daphne Koller, Immunological Genome Project Consortium, et al. Identification of transcriptional regulators in the mouse immune system. Nature immunology, 14(6):633–643, 2013. 10
9cs.NE
Preserving Privacy of Agents in Participatory-Sensing Schemes for Traffic Estimation arXiv:1609.01028v1 [math.OC] 5 Sep 2016 Farhad Farokhi and Iman Shames Abstract— A measure of privacy infringement for agents (or participants) travelling across a transportation network in participatory-sensing schemes for traffic estimation is introduced. The measure is defined to be the conditional probability that an external observer assigns to the private nodes in the transportation network, e.g., location of home or office, given all the position measurements that it broadcasts over time. An algorithm for finding an optimal trade-off between the measure of privacy infringement and the expected estimation error, captured by the number of the nodes over which the participant stops broadcasting its position, is proposed. The algorithm searches over a family of policies in which an agent stops transmitting its position measurements if its distance (in terms of the number of hops) to the privacy sensitive node is smaller than a prescribed threshold. Employing such symmetric policies are advantageous in terms of the resources required for implementation and the ease of computation. The results are expanded to more general policies. Further, the effect of the heterogeneity of the population density on the optimal policy is explored. Finally, the relationship between the betweenness measure of centrality and the optimal privacypreserving policy of the agents is numerically explored. I. I NTRODUCTION A sharp rise in the number of the networked platforms, such as smart phones and wearable gadgets, has enabled new technologies, such as participatory-sensing schemes, to be commercially viable. In these schemes, agents (or participants) and their networked devices act as sensing units to estimate a variable of interest. Waze1 and Mobile Millennium2 can be mentioned as examples of commercial and academic products that use participatory-sensing schemes for measuring the traffic flow in real time. These systems often recruit agents that are willing to provide data (by directly providing reports or letting the sensors on their devices to be remotely used). However, gathering data usually reveals some private information about the agents (e.g., the location of their house or office among many other variables), which might make them opt out of the system or switch off their connected devices (more often than needed). One way to alleviate the privacy related anxieties of the agents is to “systematically corrupt” the measurements collected by them. The objective of such corruption is to obfuscate the private information of each agent. A direct link between the intensity of corruption and the quality of the estimate, on the one hand, and the availability of the private information, on the other hand, can be established. This observation is at the core of The work of the authors was supported by a McKenzie Fellowship, ARC grant LP130100605, a grant from Melbourne School of Engineering. The authors are with the Department of Electrical and Electronic Engineering, the University Melbourne, Parkville, VIC 3010, Australia. 1 https://www.waze.com/ 2 http://traffic.berkeley.edu/ the literature on differential privacy (see [1]–[5] among other studies), where the responses to statistical queries on random databases are typically corrupted by Laplace noise to protect the privacy of the individuals in the database. In transportation systems, differential privacy might not be well-suited for preserving the privacy of the agents. To demonstrate this, as an example, consider a scenario in which the networked devices of the agents in a participatorysensing scheme provide Global Positioning System (GPS) measurements of their position in equidistant intervals of time. From the perspective of a subscribing agents, the privacy infringement is only an issue if the agent is close to a privacy sensitive node3 , such as its home or office. Therefore, when travelling through most of the network, transmitting accurate measurements of its position is not infringing the privacy of the agent (and thus the addition of the noise is conservative). In addition, if an agent is staying in a certain node for long durations of time (e.g., over night at home or during work hours at office), a simple averaging can significantly reduce the effect of any additive noise on the position measurements and, thus, revealing the position of private nodes. Hence, adding noise to the sensor measurements (at least indiscriminately with respect to the position) to protect the privacy of the agent is neither necessary nor beneficial. Therefore, a different approach is required for protecting the privacy of the agents in which they completely stop broadcasting their position based on their proximity to the private nodes. Such a method can form the basis of a software package that gives rise to the democratization of privacy-preserving tools and measures in transportation networks. The software simply asks for the privacy requirements of the agents and automatically turns off their GPS units if they are closer than an optimally selected level to their private nodes. Note that this proposal is not the novel aspect of this paper. Many commercial softwares provide similar (but application-specific) solutions. For instance, Strava4 enables users (mainly runners and cyclists) to construct a privacy zone (by specifying a position and radius) in which the GPS location of the user is not reported and is thus not revealed to a third-party5 . Though undoubtedly powerful in preserving privacy of the users over one single trip, such zones might prove ineffective in the 3 A rational agent, which is privacy-conscious enough to not want its path to be recorded at all, simply does not participate in the scheme. 4 http://www.strava.com/ 5 Thieves have used such measurements to steal valuable bikes. http: //www.telegraph.co.uk/technology/news/11372189/ Cycling-apps-put-you-at-risk-from-hi-tech-burglars. html long run. For instance, imagine that the same user gets out of its privacy zone in three different locations (on three different occasions). Now, equipped with the knowledge that the user’s house is in the same distance from these three positions (without even knowing that distance), a wellresourced attacker can simply pinpoint the position of the house of the user by triangulation. Therefore, more careful design strategies are required to protect the privacy of the users. This paper provides a provably privacy-preserving method for constructing the privacy zones based on the underlying transportation network. In this paper, first, a measure of privacy infringement for the agents is introduced. The measure is equal to the conditional probability that an external observer assigns to the private nodes of the agent given all its position measurements over time. By carefully selecting the set of nodes and edges over which the agent does not transmit its position, it can effectively reduce this conditional probability to mislead the maximum likelihood filters that can be used to find the location of the private nodes. However, this can only be achieved at the cost of not reporting the position at some nodes in the network, which would reduce the quality of the estimation provided by the participatory-sensing scheme. An algorithm to find an optimal trade-off between these two competing interests is provided. The algorithm searches over a family of policies in which the agent stops broadcasting its position measurements if its distance in terms of the number of hops to the private nodes is smaller than a level. Employing such symmetric policies are advantageous as they are easy to compute and to implement. This is due to the fact that the agent only needs to count the number of the nodes on its path and does not require a map of the city. However, they have a drawback because an agent that uses a symmetric policy should exclude a larger subgraph from its measurements to achieve the same level of privacy as an agent that does not restrict itself to such policies. The results are subsequently expanded to more general (possibly asymmetric) policies. The effect of the population density is then explored. The impact of the betweenness measure of centrality of the private nodes of an agent on the policy of that agent is numerically explored on a random geometric graph. The betweenness measure of centrality for a node is defined as the number of the shortest paths in the graph that pass through that node divided by the total number of the shortest paths [6, p. 39]. Intuitively, a node with a high betweenness measure connects many nodes to each other (and is thus very central). However, a node with a low betweenness measure can be removed from the graph with no devastating consequences. It is observed numerically that, for the node with the maximum betweenness in a random geometric graph, a fairly large exclusion radius should be selected to reduce the measure of the privacy infringement. In addition, by slightly increasing the radius of the exclusion zone, the number of the nodes and edges over which the agent stop its broadcasting its position measurements rapidly increases. The opposite behaviour is witnessed for the node with the minimum betweenness. Finally, the results are demonstrated on the City of Melbourne (the center of the Melbourne metropolitan area). The rest of the paper is organized as follows. This section is concluded by presenting some useful notations. Section II introduces the privacy measure and mathematically formulates the problem. Section III provides an algorithm for finding a symmetric policy that balances between the need for privacy and the quality of the estimation. Section IV extend the results to asymmetric policies. The effect of the heterogeneity of the population density is explored in Section V. The numerical examples are illustrated and their implications are discussed in Section VI. Finally, the paper is concluded in Section VII. A. Notations Consider an undirected G = (V, E), where V is the vertex set and E ⊆ V × V is the edge set. An undirected edge between nodes i, j ∈ V is denoted by {i, j}. A walk is a sequence v1 , e1 , v2 , e2 , . . . , ek−1 , vk of vertices vi ∈ G and edges ei ∈ E such that ei = (vi , vi+1 ) for all i < k. The vertices v1 and vk are called the initial and the terminal vertices of the walk, respectively. The length of the walk is the number of edges in it. A path is a walk in which all vertices are distinct. The distance d(i, j) between two vertices i, j ∈ V is the length of a shortest path with initial vertex i and terminal vertex j. Additionally, define the set of nodes with a distance δ from node i by Di (δ) where Di (δ) = {j|j ∈ V, d(i, j) = δ}. The length of the longest shortest path between any two vertices of a graph is the graph’s diameter. II. P ROBLEM F ORMULATION A transportation network, or simply a network, is modelled by an undirected graph G = (V, E), where the nodes and the edges represent the intersections and the road segments, respectively. Consider a set of mobile agents, denoted by A, that traverse throughout the network along its edges. The agents are participating in a passive6 participatorysensing scheme to estimate the state of the traffic (i.e., the number of the vehicles7 on each edge) in the network. Each agent a ∈ A is assumed to visit all nodes in V at least once8 . Any agent a ∈ A can choose whether to broadcast its position or not. In case of deciding not to broadcast the position, it can simply turn off the GPS sensor on its connected device or terminate the participatory-sensing application. Assume that agent a does not want an external 6 The term passive refers to the fact that the agents are not required to report traffic incidents (e.g., as in Waze). The participatory-sensing scheme receives GPS measurements of the agents at different times to construct an estimate of the traffic flow. An example of such a system can be found in [7]. 7 Note that there might be many more vehicles than agents since not everyone is participating in the sensing scheme. 8 For this assumption to be satisfied, it is only required that the agents visit any node by a non-zero probability (no matter how small). Then, as time goes to infinity, the agents visit all nodes with probability one. Removing this assumption can make the observer’s task at determining the private nodes of an agent harder. Therefore, this analysis can be used as a worstcase analysis of the privacy preserving policies for the agents. observer (with access to all its position measurements) to be able to determine if it has ever visited a prescribed set of nodes denoted by Sa ⊆ V. This set is assumed to be only known by agent a. The nodes sa ∈ Sa are termed the private nodes for agent a. For the sake of the simplicity of exposition, assume that Sa = {sa } for some sa ∈ V. The results of this paper can be easily generalized to the case that Sa is not a singleton (so long as the elements of Sa are “far enough” from each other on the graph). Assume that the observer has a uniform prior on privacy sensitive node sa of agent a. This assumption is removed later in the paper to account for the heterogeneity of the population density. Given the positions that the agent has broadcast (and the time stamp of those positions), the observer can construct the conditional probability pa (v) that node v belongs to the set Sa . Agent a ∈ A wants to keep the conditional probability πa := pa (sa ) for sa ∈ Sa small. This way, the observer does not have a good chance for correctly inferring that the agent has visited the node sa . Therefore, this conditional probability can be seen as a measure of privacy infringement for agent a. However, the agents want to achieve this goal with not drastically degrading the performance of the participatory-sensing scheme. Note that, if such a constraint is not enforced, the best policy of an agent is to never broadcast its position. Throughout this paper, agent a is assumed to follow a policy that instructs it to stop broadcasting its position when it is on a link {i, j} if d(i, sa ) ≤ ha or d(j, sa ) ≤ ha for sa ∈ Sa , where ha ∈ N is a prescribed integer number that is only known by agent a. The goal is to find ha optimally. Such a policy is favoured (in comparison to more general asymmetric ones) as it can be easily implemented: it does not require a map of the city. The agent simply stops broadcasting when its hop-distance to its private node, sa , is smaller than ha . As described earlier, the agents do not want to drastically degrade the quality of the participatory-sensing scheme. Let E(sa , ha ) denote the set of edges over which agent a stop broadcasting its position. It can be shown that E(sa , ha ) = {{i, j} ∈ E | d(i, sa ) ≤ ha ∨ d(j, sa ) ≤ ha }. This is inversely proportional to the quality of the estimation as, in many sensing schemes (e.g., the least mean square method), the covariance of the estimation error reduces by increasing the number of the measurements. Therefore, agent a may wish to keep ra := |E(sa , ha )| relatively small. Problem 1: For any agent a ∈ A, find ha to minimize πa + γa ra , where the constant γa > 0 is inversely proportional to the importance of privacy for agent a. For very large constant γa , the cost of the agent behaves similarly to ra . Therefore, the best policy of the agent is to report on all edges and, thus, select ha = 0. However, for very small γ, the cost of the agent is mostly determined by πa . Thus, the best policy of the agent is to never broadcast its position or, equivalently, set ha to be larger than the diameter of G. Alternatively, the agent can solve B(sa , ha ) Sb : sa ∈ Sa e a , ha ) : S(s : T (sa , ha ) e a , ha ), Fig. 1. An illustrative example of the sets Sa , T (sa , ha ), S(s B(sa , ha ), and Sb with ha = 1. the following problem. This problem formulation avoids the use of a non-intuitive parameter γa . Problem 2: For any agent a ∈ A, find ha to minimize ra subject to πa ≤ ξa , where the constant ξa ∈ [0, 1]. If ξa ≤ 1/|V|, the solution of Problem 2 is to select ha larger than the diameter of G. This is because, upon providing any position measurements, the conditional probability πa can only be increased (i.e., only private information can be leaked by providing measurements). For ξa = 1, the best policy of the agent is to select ha = 0. In this case, the agent has a low sensitivity to privacy infringement. A good aspect of this problem formulation is that the constant ξa can be intuitively selected based on the meaning of the maximum tolerable conditional probability πa . III. P RIVACY-P RESERVING P OLICY In the light of the aforementioned problem formulation, an external observer that collects the position broadcasts of agent a can form the set of nodes T (sa , ha ) ⊆ V in which agent a has transmitted its position. This is because it is assumed that each agent visits all the nodes in the network. If the observer waits long enough, the set of all the nodes that agent a has visited converges to T (sa , ha ) with probability one. Note that T (sa , ha ) = {i ∈ V | d(i, sa ) ≥ ha + 1}. (1) See Fig. 1 for an illustrative example of this set. The following immediately follows: e a , ha ) := V \ T (sa , ha ). sa ∈ S(s (2) This is a direct consequence of the selected set of policies. However, due to the nature of the policy of the agents, e a , ha ) that the observer can further remove points from S(s cannot possibly belong to Sa . This is investigated in the remainder of this section. The boundary of the set T (sa , ha ) e a , ha ) can be defined as interfacing with the set S(s e a , ha ) 6= ∅}, (3) B(sa , ha ) = {i ∈ T (sa , ha ) | Di (1) ∩ S(s where, for any m ∈ N and any i ∈ V, the set Di (m) denotes the set of nodes j ∈ V such that d(i, j) = m (i.e., that are of distance m to node i). Similarly, define  b e a , ha ) | ∃δ ∈ N[1,` +1] : Ds (δ) = B(sa , ha ) S := s ∈ S(s a  [ 0 e ∧ Ds (δ ) = S(sa , ha ) . (4) 0≤δ 0 ≤δ−1 e a , ha ) ∨ j ∈ S(s e a , ha )}|, min |{{i, j} ∈ E | i ∈ S(s where `a is the diameter of the subgraph induced by e a , ha ). Among all the subsets of V that can be picked S(s by the observer, Sb described by (4) is the smallest set that is guaranteed to include sa . The following results can be proved. b Theorem 1: πa = 1/|S|. Proof: The Bayes’ rule (e.g., see [8]) dictates that P{s ∈ Sa | T (sa , ha )} ∝P{T (sa , ha ) | s ∈ Sa }P{s ∈ Sa } ∝P{T (sa , ha ) | s ∈ Sa }, (5) where the notation ∝ shows that the both sides are proportional to each other (i.e., they are equal to each other if one is multiplied by an appropriate constant). Now, note that P{T (sa , ha ) | s ∈ Sa } = 1∃h∈N:T (s,h)=T (sa ,ha ) = 1∃h∈N:B(s,h)=B(sa ,ha )∧S(s , e a ,ha )=S(s,h) e where 1 is a characteristic function, i.e., 1p is equal to one if the statement p holds true and is equal to zero e h) = otherwise. By definition, B(s, h) = Ds (h+1) and S(s, S 0 h0 ∈N:h0 ≤h Ds (h ). Therefore, it can be deduced that P{T (sa , ha ) | s ∈ Sa } = 1s∈Sb. (6) Substituting (6) into (5) gives P{s ∈ Sa | T (sa , ha )} ∝ 1s∈Sb. P Noting that s∈V P{s ∈ Sa | T (sa , ha )} = 1 results in P{s ∈ Sa | T (sa , ha )} = computed by O(|V|4 ). Therefore, the set Sb can be computed e a , ha )| = by O(|V|6 ) operations because, at worst case, |S(s O(|V|). Finally, to perform all these operations for all ha , at most O(|V|7 ) operations are required. These complexity calculations are very conservative and, for most graphs, much fewer operations are required. Alternatively, Problem 2 can be cast as 1 1 . b s∈Sb |S| This concludes the proof. In this case, it can be proved that E(sa , ha ) = {{i, j} ∈ e a , ha ) ∨ j ∈ S(s e a , ha )}. Hence, Problem 1 can be E | i ∈ S(s cast as 1 e a , ha )∨j ∈ S(s e a , ha )}|, min +γ |{{i, j} ∈ E|i ∈ S(s b a 0≤ha ≤dG |S| where dG denotes the diameter of the graph G. For each sa , this problem can be easily solved by calculating the cost function for all applicable ha and, subsequently, by selecting ha corresponding to the smallest value. To calculate the cost, sets Di (δ) for all i ∈ V and δ need to be calculated. These sets can be determined by calculating ∆δ with ∆ denoting the adjacency matrix, i.e., ∆ij = 1 if there exists an edge {i, j} ∈ G. All these sets for δ upto dG , can be computed by O(|V|3 dG ) operations. Noting that, at worst case dG = O(|V|), all these sets can be 0≤ha ≤dG b ≥ 1/ξa s.t. |S| e a , ha ) ∨ j ∈ S(s e a , ha )}| is an Because |{{i, j} ∈ E | i ∈ S(s increasing function of ha , the optimal solution is to select ha b ≥ 1/ξa }. This to be the smallest element of the set {ha | |S| can also be done by checking all ha with at most O(|V|7 ) operations. IV. A SYMMETRIC P OLICIES In the previous section, the only viable family of policies for agent a is to stop transmitting its position measurements if its distance in terms of the number of hops to the privacy sensitive node sa is smaller than or equal to ha . The symmetry of the policy of the agents was utilized by the observer to further reduce the uncertainty of predicting the privacy sensitive node of the agents. This is clearly a drawback because, for achieving the same level of privacy, an agent that uses a symmetric policy must exclude a larger subgraph from its measurements. However, employing symmetric policies are also advantageous as they can be computed efficiently and their implementation is simpler than the asymmetric ones (the agent only needs to count the number of the nodes on its path). To formalize this intuition, the set of applicable policies of the agents is temporarily generalized. Agent a is assumed to follow a policy that instruct its connected device to stop broadcasting its position when it is on a link {i, j} if i ∈ Na or j ∈ Na . It is assumed that sa ∈ Na . Such an assumption is needed because the observer can deduce that a node is of special importance to an agent, if it stops there for a significant amount of time (as it is not only a way point on the path). The goal is to find the set Na optimally. Similar to the previous section, an external observer that collects the position broadcasts of agent a can form the set of nodes T (sa , ha ) ⊆ V in which agent a has transmitted its position. Clearly, Na = V \ T (sa , ha ). The following result can be proved. Theorem 2: πa = 1/|Na |. Proof: Similar to the proof of Theorem 1, the Bayes’ rule can be used to show that P{s ∈ Sa | T (sa , ha )} ∝P{T (sa , ha ) | s ∈ Sa }P{s ∈ Sa } ∝P{T (sa , ha ) | s ∈ Sa }. Now, note that P{T (sa , ha ) | s ∈ Sa } = 1s∈Na . Therefore, P{s ∈ Sa | T (sa , ha )} = This concludes the proof. 1 1s∈Na . |Na | Problem 1 can then be cast as 1 min + γa |{{i, j} ∈ E | i ∈ Na ∨ j ∈ Na }|. Na ∈2V :sa ∈Na |Na | Unfortunately, this optimization problem is very hard solve as the number of all the possible sets Na ∈ 2V such that sa ∈ Na grows exponentially with the number of the number of the nodes. A similar argument can also be presented for Problem 2 and is thus removed. If, in order to reduce the complexity of the problem, the search is conducted on the set of symmetric policies defined to be set of all policies of the form Na = {s ∈ V | d(s, sa ) ≤ ha } for ha ∈ N, the results of the previous section can be recovered. In this case, it can be also proved that 1 1 ≤ b |Na | |S| e a , ha ) = Na . Therefore, it can be inferred because Sb ⊆ S(s that the symmetric polices minimize an upper-bound on the costs over a smaller set of policies, i.e., the set of asymmetrical policies. This results in their superior efficiency in terms of computation and implementation. V. VARYING D ENSITY In most urban areas, the density of the population is not homogeneous throughout the city. Let ρ : V → R≥0 be a mapping that determines the density around any node. Following this observation, the observer can no longer assume a uniform prior P on the private nodes. Therefore, P{s ∈ Sa } = ρ(s)/ v∈V ρ(v). This captures the fact that it is more likely that the privacy sensitive node sa of agent a to belong to a densely populated area. In this case, the following result can be proved. P Theorem 3: πa = ρ(s)/ v∈Sb ρ(v). Proof: Similar to the proof of Theorem 1, it can be shown that P{s ∈ Sa | T (sa , ha )} ∝P{T (sa , ha ) | s ∈ Sa }P{s ∈ Sa } ∝P{T (sa , ha ) | s ∈ Sa }ρ(s) =1s∈Sbρ(s). As a result, ρ(s) 1s∈Sb. v∈Sb ρ(v) P{s ∈ Sa | T (sa , ha )} = P This concludes the proof. Following the result of Theorem 3, the problems that the agents need to solve can be adapted and the algorithm in Section III can be used to find an optimal privacy-preserving policy. Note that a “sensible” agent should also put less emphasize on protecting its privacy if its privacy sensitive node is in a densely populated area. This is because, in densely populated areas, even if the observer pinpoints the location of an agent upto a node, there are many residential and commercial areas in the surrounding that makes identifying the physical location of the agent impossible. Such a behaviour can be reflected in the selection of the term γa (if the agent makes such a decision). πa for sa with maximum betweenness πa for sa with minimum betweenness ra /|E| for sa with maximum betweenness ra /|E| for sa with minimum betweenness 1.0 0.8 0.6 0.4 0.2 0.0 5 10 ha 15 Fig. 2. πa and ra as a function of ha for nodes with the maximum and the minimum betweenness averaged over ten random geometric graphs with 1000 nodes in unit rectangle and connectivity radius of 0.1. VI. N UMERICAL E XAMPLE First, the results of Section III are demonstrated on random graphs. Consider a graph with |V| = 1000 nodes. The positions of the nodes are distributed uniformly inside a unit rectangle [0, 1]×[0, 1]. If the Euclidean distance between two nodes is smaller than or equal to 0.1, the nodes are assumed to be connected. This creates an undirected graph, which is referred to as a random geometric graph; see [9] for more information. The values of πa and ra (as function of ha ) are only illustrated for the nodes with the maximum and the minimum betweenness measures (as two extreme behaviours). The betweenness measure of centrality for a node is defined as the number of the shortest paths in the graph that pass through that node divided by the number of all the shortest paths in the graph. Intuitively, a node with a relatively large betweenness measure connect many nodes to each other. However, a node with a small betweenness measure can be removed from the graph with no devastating consequences. Fig. 2 shows πa and ra as a function of ha for nodes with the maximum and the minimum betweenness averaged over ten random geometric graphs. Based on the illustrated numerical example, it can be seen that, for the node with the maximum betweenness, a fairly large ha should be selected to reduce πa initially. This is because for these nodes the set B(sa , ha ) is very large and thus Sb most often contains only a few nodes. In addition, by increasing ha , ra rapidly increases. This is because the central nodes are often very close to all the nodes (as many shortest paths go through them). The reverse behaviour is observed for the node with the minimum betweenness. Transportation networks are most often highly structured Privacy Sensitive Node Fig. 3. The roads in the City of Melbourne 1.0 πa ra /|E| 0.8 R EFERENCES 0.6 0.4 0.2 0.0 which the agent stop its measurement transmission rapidly increases. The reverse behaviour is seen for the node with the minimum betweenness. Finally, note that if the agents want to hide their position on some edges (denoted by the privacysensitive edges), the same results can be used. To do so, the definition of the graph representing the transportation system should be modified. Specifically, to find the optimal policy, the line graph (see [10, pp. 71–82]) of the transportation network should be constructed. A line graph of a graph G = (V, E) is an undirected graph L(G) with the vertex set VL(G) = E and the edge set EL (G) = {(e, ē) ∈ VL(G) × VL(G) | i = ī ∨ j = j̄ for e = {i, j}, ē = {ī, j̄}}. In the line graph of the transportation, the roads represent the nodes and two roads are connected to each other by an edge (in the line graph) if they intersect. The future work can focus on understanding the effect of determined policies using simulators for transportation systems to measure the quality of the participatory-sensing schemes. Also financial incentives can be designed to improve the estimation quality in different areas of the city. 10 20 30 ha 40 50 60 Fig. 4. Different values of πa versus the ratio of the nodes where the location is not reported for different values of ha . graphs as their design is not random (or at least one hopes) and follows careful consideration by the local governments. Therefore, in the next simulation, a scenario in the City of Melbourne. The goal is to ascertain the achievable levels of privacy for an agent starting his travel from the dark blue node9 in Fig. 3. The possible levels of privacy infringement are depicted in Figure 4. Evidently, with a fairly low ha , pa can be reduced drastically. This is also achieved at a relatively low cost because ra is still small. VII. C ONCLUSIONS AND F UTURE W ORK An algorithm for finding an optimal policy for preserving the privacy of the agents in a participatory-sensing scheme for traffic estimation is presented. The effect of the betweenness measure of centrality on the policy of the agents is numerically explored. In can be seen that, for the node with the maximum betweenness, a fairly large exclusion radius should be selected to enhance the privacy. In addition, by slightly increasing radius, the number of the nodes over 9 The interest in this node is not arbitrary as it pinpoints the position of a former residence of one of the authors. [1] C. Dwork, “Differential privacy: A survey of results,” in Theory and Applications of Models of Computation: 5th International Conference, TAMC 2008, Xi’an, China, April 25-29, 2008. Proceedings, M. Agrawal, D. Du, Z. Duan, and A. Li, Eds. Berlin, Heidelberg: Springer, 2008, pp. 1–19. [2] R. Chen, B. Fung, B. C. Desai, and N. M. Sossou, “Differentially private transit data publication: A case study on the Montreal transportation system,” in Proceedings of the 18th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2012, pp. 213–221. [3] F. Kargl, A. Friedman, and R. Boreli, “Differential privacy in intelligent transportation systems,” in Proceedings of the 6th ACM Conference on Security and Privacy in Wireless and Mobile Networks, 2013, pp. 107–112. [4] Y. Wang, Z. Huang, S. Mitra, and G. E. Dullerud, “Entropyminimizing mechanism for differential privacy of discrete-time linear feedback systems,” in Proceedings of the IEEE 53rd Annual Conference on Decision and Control, 2014, pp. 2130–2135. [5] J. Le Ny and G. J. Pappas, “Differentially private Kalman filtering,” in Proceedings of the 50th Annual Allerton Conference on Communication, Control, and Computing (Allerton), 2012, pp. 1618–1625. [6] M. O. Jackson, Social and Economic Networks, ser. Princeton University Press. Princeton University Press, 2010. [7] J. C. Herrera, D. B. Work, R. Herring, X. J. Ban, Q. Jacobson, and A. M. Bayen, “Evaluation of traffic data obtained via GPS-enabled mobile phones: The Mobile Century field experiment,” Transportation Research Part C: Emerging Technologies, vol. 18, no. 4, pp. 568 – 583, 2010. [8] R. Durrett, Probability: Theory and Examples, ser. Cambridge Series in Statistical and Probabilistic Mathematics. Cambridge University Press, 2010. [9] M. Penrose, Random Geometric Graphs, ser. Oxford Studies in Probability. Oxford University Press, 2003. [10] F. Harary, Graph Theory, ser. Addison-Wesley Series in Mathematics. Addison-Wesley Publishing Company, 1969.
3cs.SY
Frequency Regulation in Islanded Microgrid Using Demand Response Alireza Eshraghi , Mahdi Motalleb , Ehsan Reihani , Reza Ghorbani University of California, Riverside, Email: [email protected] University of Hawaii at Manoa, Emails: {motalleb, rezag}@hawaii.edu California State University, Bakersfield, Email: [email protected] Abstract—Introducing more Distributed Generation (DG) into power grid infrastructure drives more attention to understand how large scale DG affects grid operation. Islanding is an important concern in this area. Islanding refers to the condition that DGs within a microgrid continue energizing while the microgrid has been disconnected from the main grid. Considering the adverse effects of Islanding, it should be detected and managed in a proper way. After Islanding has been detected, even though the first option is tripping all inverterbased DG unit in the system, the system has this option to work as a stand-alone microgrid. For achieving this goal, the frequency of microgrid should be regulated. This paper proposes an islanding detection method based on current detection in a parallel arm with the fuse arm of the microgrid. After islanding detection, this paper presents an effective implementation Demand Response (DR) to regulate the frequency in islanded microgrid as an Ancillary Service (AS) considering the transient constraints of frequency in inverterbased generations. I. INTRODUCTION Maximizing the security of microgrid is desirable from a system designer viewpoint. In such a system all components work in the safe operation range and they have the ability to continue operation during system failures until the operator restore the system. Islanding detection is one of the critical issues in this context. During the islanding, the system should operate within an acceptable reliability and also be ready to connect to the main grid at the appropriate time. With increasing penetration of renewable energy in the microgrid, keeping the safe and sound operation of the microgrid has become more challenging. When a photovoltaic (PV) system or other Distributed Generation (DG) continue to power a part of the grid while that part has been isolated from the main electric utility islanding will occur [1]. Finding efficient methods in order to avoid islanding or at least control the islanded microgrid is critical to have a more reliable power system. Personal safety hazards, equipment damage, grid protection interference, and power quality issues are some of the adverse effects of islanding. IEEE-1547, UL1741, and IEC-62116 are some of the standards that are used to provide guidance when it comes to implementing DGs into a pre-existing network infrastructure [2, 3, 4]. Islanding detection methods can be divided into three different categories: passive, active, and communication based methods. In the passive methods a local parameter is compared with a predetermined threshold. A considerable difference shows that microgrid has been islanded. Having large None Detection Zone (NDZ) area makes these methods insufficient for the anti- islanding protection, although they have the advantages of being low cost and easily implemented. On the other hand, active methods are based on injecting a small disturbance into the system and monitoring the response of the system to decide whether microgrid is islanded or not. The injected disturbance will be corrected by the grid if the microgrid is still connected to it (?). However, system parameters will be changed considerably by the injection if the system is islanded. Power quality issues, being ineffective when the system has more than one DG are some disadvantage of this method even though it has the advantage of smaller NDZ area in comparison with passive ones [1, 5]. Although the first option is to trip the DG units after islanding detection, the second option is managing the microgrid to work perfectly and stably as a stand-alone system. After the islanding has occurred, the microgrid should operate stably using all available resources including DGs and also ancillary services (AS) which are contracted to stand by the microgrid to manage power delivery for balancing microgrid condition on short notice. AS refers to a variety of operations including regulation up, regulation down, spinning reserve, non-spinning reserve and reactive power. Purchasing for being available in the emergency situation is the difference between AS and other type of power products. Frequency regulation is one of the AS services that can be done in the islanding situation when the microgrid is disconnected from the main grid in order to maintain the system balance. For AS integration and managing, the islanding situation the amount that should be purchased, prioritizing the resources to be used, and defining who should pay for these services should be planned [6, 7, 8, 9, 21]. Frequency regulation can be attained using Demand Response (DR) both as a load and as generation. Aggregate of DR resources can be used to absorb the excess power generation from renewable resources when the generators produce at their minimum generation level. In [10, 11, 12, 22], DR are managed to participate in market in order to provide AS such as contingency reserve. A market model is proposed and profits of Generation Companies (GENCOs) and Demand Response Aggregators (DRAs) are determined after participation in DR market. In [13], impact of DR delay on the frequency of power system is investigated and fuzzy-PI based controller is used to remove the delay. DR is also used for primary frequency regulation in microgrid when there is an intermittent generation from wind turbines [14]. Commercial heating, ventilation, and air conditioning (HVAC) are large loads which can have a high effect on frequency and thus are a potential candidate for frequency regulation [15]. Different control strategies for providing frequency regulation from commercial HVAC systems and components are investigated and discussed. In case of islanding, wireless sensor networks can be utilized to detect islanding [16, 17] and operate available DR resources to regulate the frequency in island mode. The focus of this paper is to propose a new islanding detection method which can overcome typical challenges associated with other islanding detection methods. After islanding detected, this paper describes an effective implementation of DR as an AS instead of compulsory provision to handle the islanded microgrid. The paper defines this compulsory provision as Islanding Reserve (IR) which should be provided by GENCOs for maintaining the microgrid stable in the situation of islanding. DR can be used to provide some sort of AS to the system by providing some voluntary load shedding in the microgrid. Through this way generating units can be used for stabilizing the microgrid in the situation of islanding instead of using IR. Additionally, the failure probability of demand side to provide power in the critical situation is smaller than generating units since this service would be provided by combination of a large number of small loads which are less likely to fail at the same time. So it is a more reliable solution for managing the islanding condition [18]. The rest of this paper is organized as follows. Section II describes the proposed islanding detection method. Section III explains how the proposed method manage the microgrid in the islanding situation as a standalone system. In Section IV the simulation results are presented and analyzed. Finally, the conclusion is drawn in Section V. II. ISLANDING DETECTION Figure 1 shows a schematic diagram of the proposed method for islanding detection. In this method an impedance arm is placed in parallel with the Main Switch (MS). MS is the connection point of microgrid to the main grid and islanding is occurred when this switch is disconnected. In the normal grid connected operation, power exchange between microgrid and main grid is done through the MS since the Parallel Impedance Arm (PIA) has been short circuit by MS. When the system is islanded the whole current passes through a PIA which is equipped with the current sensor and an operable switch. A coordinator monitors the current sensor output and control the switch in PIA. When PIA’s current is detected (or it is more than a threshold value), then islanding is detected by the system. In order to stop energizing the microgrid completely, coordinator turns off the operable switch right after detecting the islanding situation. After islanding detected by the system, two scenarios might be initiated. The first one is tripping the DGs in the system. This method is currently in use with other anti-islanding methods. In this method after islanding has been detected the coordinator sends tripping command to all DGs’ inverters using communication methods such as ZigBee, RFID, or power line [19]. The other option is managing the microgrid to work as a standalone system perfectly and stably after islanding has been detected [20]. For achieving this, the frequency of the microgrid should be regulated which is the topic of the next section. Figure 1. Micro Grid equipped with the proposed method III. Frequency Regulation in the Island A. Frequency Control Method Frequency change is a result of an imbalance between load and generation. In order to control the frequency, the generator output is controlled by frequency controller to remove the imbalance. For this goal, the mechanical torque should be converted to electrical energy completely. In islanded microgrids with high penetration of renewable energy generation, as a result of decreasing the actual mass of physical rotating, the moment of inertia is reduced. This reduction makes the entire system more sensitive to imbalances and frequency droop. Equation (1) shows the dynamic relationship between mechanical power ( Pm ) and electrical power ( Pe ) using swing equation where  is the electrical power angle, s is the electrical angular velocity, and H is per unit inertia constant (second). Since the purpose of the model is for a small microgrid, it can be modeled with a single swing equation. 2 H d 2  Pm  Pe  S dt 2 (1) Load changes ( PL (s) ) in islanded microgrid effects the changes in output frequency ( (s ) ). This relationship is expressed in equation (2) where  g and T are the governor and turbine time constants, D is load change in percent over frequency change in percent, and R is speed regulation in percent. (1   g s )(1   T s ) ( s )  (2)  PL ( s ) ( 2 Hs  D )(1   g s )(1   T s )  1 / R With neglecting the losses in the microgrid, generation reduction can be supposed to be equal to load increase with an equivalent swing equation. Therefore, equation (2) can analyze the transient and dynamic behaviors of islanded microgrid. Equation (3) shows deviation of the steady state frequency: 1 (3) ss  (PL ) D  1/ R DGs work according to interconnection standard IEEE 1547 [2]. Inverter-based DG units are designed to trip after abnormal operating frequency detection out based on this standard. B. Market; competition between aggregator The profit of all participating parties is determined by clearing the market. In this market, IR can be purchased directly from aggregators using DR in the microgrid instead of utility. The proposed market framework has three main parts: first we calculate the cost which the generator(s) of the islanded grid pay to regulate the frequency in the absence of DR sources through increasing the generation (subsection 1 below). Second Demand Response Aggregators (DRAs) make a market to submit their bids and compete to each other to shed the loads in order to regulate the frequency (subsection 2 below). And finally, after clearing the market, profits of GENCO and DRAs are calculated based on their participation in the market (subsection 3 below). 1- IR cost curve for island’s GENCO using OPF Island’s GENCO provides the cost curves during the islanding. After islanding detected, the first step for the algorithm is to calculate the transient of frequency and new inertia. Based on IEEE-1547 standard [2], when the overshoot is less than 3 Hz, the fault needs to be cleared in less than 300s and for overshoot greater than 3Hz the time is 160ms. Unsuccessful clearance in this time frame leads to trip off for the inverter-based generations in the microgrid. In the case when the overshoot of frequency is greater than 3 Hz, Island’s GENCO starts to recover the frequency through its available reserves to at least 57 Hz within 160ms since DR is not fast enough to do the recovery in this short time. This amount of power is considered as emergency reserved. After the frequency reached to 57 Hz, the aggregators can compete with each other to sell DR to the GENCO. Clearly if the frequency is above 57Hz after islanding, the IR cost includes only the non-emergency reserve which can be supplied either by the utility or aggregator through DR. For frequency regulation where DR is responsible the nonemergency (57-60 Hz) zone is split into M sections which can be equal or unequal. Required power (  P ) for increasing the frequency in each section (  f ) by utility is calculated using equation (2). It should be considered that inertial constant (H) changes with power increasing in each section. According to IEEE-1547 standard [2], when the grid frequency is in the range of 57-58.5 Hz, the required power should be supplied within 300s. Otherwise the inverter-based generations (PVs) will trip off. Because of that, the non-emergency range can be divided in two sections: 1) 57-58.5 Hz where faster DR is needed, and 2) 58.5-60 Hz where the slower DR starts. The point where optimal grid frequency condition archives is the last point of the utility cost curve. Figure 2 explains the overall concept of the method which how GENCO and DRAs work together to regulate the frequency after islanding. Figure 3 shows the flowchart for IR cost curve (subsection 1). Figure 2. Demand response market implementation for open trading of ancillary services in the island 2-Forming DR market for the aggregators in the island For utilizing DR as a source of AS in the islanded microgrid to provide counter bids, a market needs to be constructed. It is considered that G aggregators participate in the DR market where each of them holding contracts with undefined number of costumers. The bid prices are DR DR DR F1 , F2 ,..., FG . Each aggregator allocates its resources based on the speed of DR response. DR categorize as faster DR for 57-58.5 Hz and slower DR for 58.5-60 Hz. This categorization of the loads and household appliances is based on the contracts, consumers’ desired level of comfort, and essential shedding levels. After dividing IR cost curve into M sections, at each section of cost cure, the market price can be calculated as follows where C IR ($/MW) is the cost offered by GENCO for IR. In each section of IR cost curve, the aggregator that offers the minimum price wins the competition. DR DR DR IR price = min{C , F1 , F2 ,..., FG } (4) 3-Calculations of profit By competition between aggregators in different sections of IR cost cure, the aggregators and utility profits can be calculated as: M Profit of g th aggregator   qk , g .Fk , g DR k 1 (5) Utility's profit  M  q k 1 M k .C kIR (7) G   q k , g .Fk , g DR k 1 g 1 qk , g is the shed load provided by the g th aggregator in the k th section ( k  M ) of the CR cost curve partition (MW). C kIR is the CR cost corresponding to section k. IV. TEST CASE AND SIMULATION RESULTS As a case study, it has been supposed that the islanded microgird is similar to IEEE 24-bus model after losing the largest generation (350MW located in bus 23). This generator is the connection between microgrid and the rest of grid. In other words, the micrgord is connected to the rest of grid through bus 23. Technical data for generators is available in [10]. It is assumed that islanding detected using method in section II by detecting current in PIA. In the moment of islanding, the frequency sensors measure the frequency of 49 Hz. GENCO’s parameters for frequency regulations are:  g =0.2s,  T =0.5s, D =0.8, R =0.05 per unit in the island. Using equation (2) with the known amount of inertia for the island ( H =5s), GENCO and DRA’s contribution are calculated to regulate the frequency. In the mentioned case study GENCO and DR’s contribution are 282.9 and 67.1 MW, respectively, based on the algorithm shown in Figure 3. Figure 4 shows the transient frequency at the starting point of the IR cost curve before using the market for AS which the overshoot is less than 3 Hz. After the emergency IR (282.9 MW) had been supplied by GENCO to restore the island frequency above 57 Hz, algorithms of Figure 5 is performed to determine how DR could then be used to affect the remaining IR. Figure 3. GENCO cost curve algorithm: determination of the CR cost curve for input into GENCO market algorithm. Figure 4. Transient frequency at the starting point of the CR cost curve M Total aggregators profit = G  q k 1 g 1 k,g .Fk , g DR (6) Figure 5 shows the cost of IR which GENCO should pay as an AS to regulate the island frequency. The red vertical line shows the border between the zones that should be supplied by faster and slower DR, based on the IEEE-1547 standard [2]. It means that 17.11 MW of the load should be shaded in faster DR zone less than 300s after the Islanding has been detected. Figure 6 demonstrates the bid prices for DR by two available aggregators in the island. Figure 7 shows the aggregate quantity of the shed load by DRA 1 (blue color with shedding 38.08 MW) and DRA 2 (yellow color with shedding 29.02 MW) in the market. The profit of GENCO and DRAs are: tot PRgenco =1225$ tot tot PRDRA ,1 =1372 $, and PRDRA, 2 =1200$. order to regulate the frequency in the islanded microgrid to run it as a standalone system. The simulation results show it clearly that the proposed method satisfy all the constraints for managing the frequency in the islanded situation. References [1] R. Teodorescu, M. Liserre, P. Rodríguez, Grid Converters for Photovoltaic and Wind Power Systems, John Wiley & Sons, 2010. [2] IEEE 1547: IEEE standard for interconneting distributed resources with electric power systems, 2003. [3] IEC 62116: Test procedure of islanding prevention measure for utilityinterconnected photovoltaic inverters, 2008. [4] UL 1741: Inverters, Converters, Controllers and Interconnection System Equipment for Use With Distributed Energy Resources, 2005. [5] S. Jang, K.H. Kim, "An islanding detection method for distributed generations using voltage unbalance and total harmonic distortion in current", IEEE Trans. Pow. Del., vol. 19, no. 2, pp. 745-752, Apr. 2004. [6] M. Dietmannsberger; D. Schulz, "Impacts of Low Voltage Distribution Grid Codes on Ancillary Services and Anti-IslandingDetection of Inverter-Based Generation," in IEEE Transactions on Energy Conversion , vol.PP, no.99, pp.1-1 [7] A. Zeinalzadeh, R. Ghorbani, J. Yee, Voltage reliability in the presence of high penetration of photovoltaic systems, IEEE American Control Conference (ACC), Boston, USA, 2016. [8] ]Y. J. Kim, E. Fuentes and L. K. Norford, "Experimental Study of Grid Frequency Regulation Ancillary Service of a Variable Speed Heat Pump," in IEEE Transactions on Power Systems, vol. 31, no. 4, pp. 3090-3099, July 2016. [9] S. Wang, L. Han, D. Wang, M. Shahidehpour and Z. Li, "Hierarchical charging management strategy of plug-in Hybrid Electric Vehicles to provide regulation service," 2012 3rd IEEE PES Innovative Smart Grid Technologies Europe (ISGT Europe), Berlin, 2012, pp. 1-6. Figure 5. Cost of IR which should be paid by GENCO Figure 6. Bid price for DR by two aggregators [10] M. Motalleb, M. Thornton, E. Reihani and R. Ghorbani, "A nascent market for contingency reserve services using demand response," Applied Energy, pp. 985-995, 2016. [11] M. Motalleb, M. Thornton, E. Reihani and R. Ghorbani, "Providing frequency regulation reserve services using demand response scheduling," Energy Conversion and Management, vol. 124, pp. 439452, 2016. Figure 7. Aggregate quantity load shed by DRAs V. CONCLUSION Considering the renewable energy escalation within the secondary network, a dynamic behavior of the grid needs to be considered with more precision. This paper present a new islanding detection method based on current detection in an added arm to the microgrid system which from one side eliminates unnecessary complexity of many other antiislanding methods and also can overcome typical challenges associated with those methods. After islanding detection, instead of tripping the inverter-based units in the microgrid, this paper presents a market framework to provide AS in [12] E. Reihani, M. Motalleb, M. Thornton and R. Ghorbani, "A novel approach using flexible scheduling and aggregation to optimize demand response in the developing interactive grid market architecture," Applied Energy, 183, 445-455., vol. 183, pp. 445-455, 2016. [13] P. Babahajiani; Q. Shafiee and Hassan Bevrani, “Intelligent Demand Response Contribution in Frequency Control of Multi-area Power Systems,” IEEE Trans. Smart Grid, June 2016. [14] S. A. Pourmousavi and M. H. Nehrir, “Real-Time Central Demand Response for Primary Frequency Regulation in Microgrids,” IEEE Trans. Smart Grid., vol. 3, pp. 1988–1996, Dec 2012. [15] I. Beil, I. Hiskens and S. Backhaus, “Frequency Regulation From Commercial Building HVAC Demand Response,” Proceedings of the IEEE, Vol. 104, No. 4, April 2016. [16] A. Eshraghi and R. Ghorbani, “Islanding detection and transient over voltage mitigation using wireless sensor networks,” IEEE Power & Energy Society General Meeting, July 2015. [17] A. Eshraghi and R. Ghorbani, “Islanding detection and over voltage mitigation using controllable loads,” Sustainable Energy, Grids and Networks, vol. 6, pp. 425-135, June 2016. [18] D. Kirschen, and G. Strbac, Fundamentals of Power System Economics, John Wiley & Sons Ltd, 2004. [19] A. Eshraghi, B. Maham, Z. Han, M. Banagar, Efficiency and coverage improvement of active RFID two-hop relay systems, in: IEEE Wireless Communications and Networking Conference, WCNC’14, Istanbul, Turkey, 2014, pp. 2002–2007. [20] A. Zeinalzadeh and Vijay Gupta, Minimizing risk of load shedding and renewable energy curtailment in a microgrid with energy storage, ArXiv e-prints, arXiv: 1611.08000, Nov. 2016. [21] A. Zeinalzadeh, and Vijay Gupta, Pricing energy in the presence of renewables, ArXiv e-prints, arXiv:1611.08006, Nov 2016. [22] A. Zeinalzadeh, R. Ghorbani, E. Reihani, Optimal power flow problem with energy storage voltage and reactive power control, The 45th ISCIE International Symposium on Stochastic Systems Theory and Its Applications, Okinawa, 2013. .
3cs.SY
1 Joint and Competitive Caching Designs in Large-Scale Multi-Tier Wireless Multicasting Networks arXiv:1706.07903v1 [cs.IT] 24 Jun 2017 Zitian Wang, Zhehan Cao, Ying Cui, Yang Yang Abstract Caching and multicasting are two promising methods to support massive content delivery in multi-tier wireless networks. In this paper, we consider a random caching and multicasting scheme with caching distributions in the two tiers as design parameters, to achieve efficient content dissemination in a two-tier large-scale cache-enabled wireless multicasting network. First, we derive tractable expressions for the successful transmission probabilities in the general region as well as the high SNR and high user density region, respectively, utilizing tools from stochastic geometry. Then, for the case of a single operator for the two tiers, we formulate the optimal joint caching design problem to maximize the successful transmission probability in the asymptotic region, which is nonconvex in general. By using the block successive approximate optimization technique, we develop an iterative algorithm, which is shown to converge to a stationary point. Next, for the case of two different operators, one for each tier, we formulate the competitive caching design game where each tier maximizes its successful transmission probability in the asymptotic region. We show that the game has a unique Nash equilibrium (NE) and develop an iterative algorithm, which is shown to converge to the NE under a mild condition. Finally, by numerical simulations, we show that the proposed designs achieve significant gains over existing schemes. Index Terms Cache, multicast, multi-tier wireless network, stochastic geometry, optimization, game theory, Nash equilibrium Z. Wang, Z. Cao and Y. Cui are with the Department of Electronic Engineering, Shanghai Jiao Tong University, China. Y. Yang is with the Intel Deutschland GmbH, Germany. This paper was submitted in part to IEEE GLOBECOM 2017. June 27, 2017 DRAFT 2 I. I NTRODUCTION The rapid proliferation of smart mobile devices has triggered an unprecedented growth of the global mobile data traffic. Multi-tier wireless networks have been proposed as an effective way to meet the dramatic traffic growth by deploying different tiers of point of attachments (POAs), e.g., base stations (BSs) or access points (APs) together, to provide better time or frequency reuse. In general, there are two scenarios, depending on whether different tiers are managed by the same operator. One typical example for the scenario of the same operator is deploying short range small-BSs together with traditional macro-BSs, i.e., heterogeneous wireless networks (HetNets). One typical example for the scenario of different operators is deploying IEEE 802.11 APs of different owners. To further reduce the load of the core network, caching at POAs in multi-tier wireless networks is recognized as a promising approach. Caching in cache-enabled multi-tier wireless networks for the case of the same operator is considered in many works. Cache-enabled multi-tier wireless networks with fixed topologies are considered in some of them. For example, in [1]–[3], the authors consider the optimal content placement at small-BSs to minimize the expected downloading time for files at the macro-BS in a single macro-cell with multiple small-cells. Note that [1]–[3] do not capture the stochastic natures of channel fading and geographic locations of POAs and users, and the obtained results in [1]–[3] may not be applied to real networks. To address these limitations, large-scale cache-enabled multi-tier wireless networks are considered in some other works, using tools from stochastic geometry. For example, in [4]–[6], the authors consider caching the most popular files at each small-BS in large-scale cache-enabled small-cell networks or HetNets. In [7], the authors propose a partition-based combined caching design in a largescale cluster-centric small-cell network. In [8] and [9], the authors consider random caching of a uniform distribution at small-BSs in a large-scale cache-enabled HetNet and a largescale cache-enabled small-cell network, respectively. In [10], each macro-BS caches the most popular files and each small-BS randomly caches popular files in a large-scale cache-enabled HetNet. Note that the focuses in [4]–[10] are only on performance analysis of some simple caching designs, which may not provide performance guarantee. In [11]–[14], the authors consider random caching and focus on the analysis and optimization of the probability that the signal-to-interference plus noise ratio (SINR) of a typical user is above a threshold, in a large-scale cache-enabled multi-tier wireless network. In [11], the authors consider two June 27, 2017 DRAFT 3 architectures (i.e., an always-on architecture and a dynamic on-off architecture), and formulate the optimization problem for each architecture, which is convex. For each problem, the closedform optimal solution is obtained. In [12], the authors consider two cooperative transmission schemes, and formulate the optimization problem under each scheme, which is nonconvex in the general case. For each problem, a stationary point is obtained using the standard gradient projection method. For [13], [14], in a special case where all tiers have the same threshold, the optimization problem is convex and the optimal solution is obtained; in the general case, the problem is nonconvex. In [14], the nonconvex problem is simplified to a convex one and the optimal solution to the simplified convex problem is used as a sub-optimal solution to the original nonconvex problem. In [15], the authors propose a random caching design, and focus on the maximization of the cache hit probability. The optimization problem is convex and the closed-form optimal solution is obtained. Note that [11]–[15] focus only on the typical user and do not consider the resource sharing among multiple users. Some works consider competitive caching among different POAs, using game theory. For instance, in [16], the authors consider an Exact Potential Game among cache-enabled femtoBSs where each femto-BS maximizes the expected number of its served users, prove the existence of Nash equilibrium (NE) and propose a convergent algorithm to obtain a NE. In [17], the authors consider a mean-field game among cache-enabled small-BSs where each small-BS minimizes its long run average cost, and obtain the unique mean field equilibrium. For example, in [18]–[20], the authors consider Stackelberg games among content providers and network operators. Specifically, the content providers rent part of the network resources from the network operators for content delivery to get payment from users. Note that in [16], [19], [20], the authors consider cache-enabled wireless networks with fixed topologies. In [17], [18], large-scale cache-enabled wireless networks are considered; in [17], a large-scale cache-enabled single-tier wireless network is considered; in [18], the authors consider a largescale cache-enabled multi-tier wireless network, but do not provide a convergent algorithm to find the Stackelberg equilibrium. On the other hand, enabling multicast service at POAs in multi-tier wireless networks is an efficient way to deliver popular contents to multiple requesters simultaneously by effectively utilizing the broadcast nature of the wireless medium. In our previous work [21], we consider analysis and optimization of a hybrid caching design and a corresponding multicasting design in a large-scale cache-enabled HetNet. The hybrid caching design requires the files stored June 27, 2017 DRAFT 4 at macro-BSs and pico-BSs to be nonoverlapping and the files stored at all macro-BSs to be identical. Thus, the spatial file diversity provided by the hybrid caching design is limited, which may cause network performance degradation at some system parameters. In our previous work [22], we consider analysis and optimization of a random caching design and a corresponding multicasting design in a large-scale cache-enabled single-tier network. The proposed random caching design in [22] can offer high spatial file diversity, ensuring good network performance over a wide range of system parameters, but can not be directly applied to HetNets. In summary, further studies are required to facilitate the design of practical cache-enabled multi-tier wireless multicasting networks for massive content dissemination. In this paper, we consider a random caching and multicasting design with caching distributions in the two tiers as the design parameters to provide high spatial file diversity. We derive tractable expressions for the successful transmission probabilities in the general region as well as the high SNR and high user density region (i.e., the asymptotic region), respectively, utilizing tools from stochastic geometry. Our main contributions are summarized below. • For the case of a single operator for the two tiers, we formulate the optimal joint caching design problem to maximize the successful transmission probability in the asymptotic region, which is a nonconvex problem in general. By using the block successive approximate optimization technique [23], we develop an iterative algorithm to obtain a stationary point. Specifically, by carefully choosing an approximation function, we obtain the closed-form optimal solution to the approximate optimization problem in each iteration. In addition, in the special case of the same cache size, we develop a low-complexity algorithm to obtain a globally optimal solution by extending the method in [14]. • For the case of two different operators, one for each tier, we formulate the competitive caching design game where each tier maximizes its successful transmission probability in the asymptotic region. We show that the game has a unique NE and develop an iterative algorithm to obtain the NE. In general, it is quite difficult to guarantee that an iterative algorithm can converge to the NE of a game, especially for a large-scale wireless network. By carefully analyze structural properties of the competitive caching design game, we provide a convergence condition for the proposed iterative algorithm, which holds in most practical scenarios. • Finally, by numerical simulations, we show that the proposed designs achieve significant June 27, 2017 DRAFT 5 gains over existing schemes in terms of successful transmission probability and complexity. We also show the caching probabilities of the proposed designs, revealing that the proposed designs offer high spatial file diversity. II. S YSTEM M ODEL A. Network Model We consider a general large-scale two-tier downlink network consisting of two tiers of POAs, e.g., BSs or APs, as shown in Fig. 1. The two tiers can be managed by a single operator (e.g., HetNet with BSs being POAs) or by two different operators (e.g., IEEE 802.11 APs of two owners).1 The locations of the POAs in tier 1 and tier 2 are spatially distributed as two independent homogeneous Poisson point processes (PPPs) Φ1 and Φ2 with densities λ1 and λ2 , respectively. The locations of the users are also distributed as an independent homogeneous PPP Φu with density λu . Each POA in the jth tier has one transmit antenna with transmission power Pj , where j = 1, 2. For notational convenience, we define σ1 , P1 P2 and σ2 , P2 . P1 Each user has one receive antenna. All POAs are operating on the same frequency band with a bandwidth W (Hz). Consider a discrete-time system with time being slotted and study one slot of the network. Both path loss and small-scale fading are considered: for path loss, a transmitted signal from either tier with distance D is attenuated by a factor D −α , where α > 2 is the path loss exponent [13], [14]; for small-scale fading, Rayleigh fading channels are adopted [24]. Let N , {1, 2, · · · , N} denote the set of N files in the two-tier network. For ease of illustration, assume that all files have the same size. File popularity is assumed to be identical among all users. Each user randomly requests one file, which is file n ∈ N with probability P an ∈ (0, 1), where n∈N an = 1. Thus, the file popularity distribution is given by a , (an )n∈N , which is assumed to be known apriori [13], [14].2 In addition, without loss of generality (w.l.o.g.), assume a1 > a2 > . . . > aN . The two-tier network consists of cache1 The network model considered in this paper is similar to that in [21]. But here, we consider a random caching design which is more general and includes the hybrid caching design in [21] as a special case. In addition, different from [13], [14], we specify the random caching design by the caching probabilities of file combinations, so as to investigate the file load distribution and the impact of multicasting. 2 Note that file popularity evolves at a slower timescale and learning methodologies can be employed to track the evolution of file popularity over time. June 27, 2017 DRAFT 6 POA in Tier 1 cache K1 = 3 POA in Tier 2 cache K2 = 2 User Signal N =8 Fig. 1. Network model. Each file n ∈ N corresponds to a Voronoi tessellation (in the same color as the file), determined by the locations and transmission powers of all POAs storing this file. enabled POAs. In the jth tier, each POA is equipped with a cache of size Kj < N to store different popular files out of N. We say every Kj different files form a combination. Thus, there are in total Ij , N Kj  different combinations, each with Kj different files. Let Ij , {1, 2, · · · , Ij } denote the set of Ij combinations. Combination i ∈ Ij can be characterized by an N-dimensional vector xj,i , (xj,i,n )n∈N , where xj,i,n = 1 if file n is included in combination i of tier j and xj,i,n = 0 otherwise. Note that there are Kj 1’s in each xj,i . Denote Nj,i , {n ∈ N : xj,i,n = 1} as the set of Kj files contained in combination i of tier j. B. Caching To provide high spatial file diversity, we consider a random caching design in the cacheenabled two-tier network where the caching distributions in the two tiers may be different, as illustrated in Fig. 1. The probability that combination i ∈ Ij is stored in each POA of tier j is pj,i , where pj,i satisfies 0 ≤ pj,i ≤ 1, i ∈ Ij , X pj,i = 1. (1) i∈Ij June 27, 2017 DRAFT 7 A random caching design in the tier j is specified by the caching distribution pj , (pj,i )i∈Ij .  combinations containing file Let Ij,n , {i ∈ Ij : xj,i,n = 1} denote the set of Ij,n , KNj−1 −1 n. Let Tj,n , X pj,i , n ∈ N (2) i∈Ij,n denote the probability that file n is stored at a POA in the jth tier. Therefore, the random caching design in the large-scale cache-enabled two-tier network is fully specified by the design parameters (p1 , p2 ). In this paper, we focus on serving cached files at POAs to get first-order insights into the design of cache-enabled wireless networks, as in [13], [14], [21], [22], [25]. POAs may serve uncached files through other service machanisms, the investigation of which is beyond the scope of this paper. Remark 1: Note that the random caching design considered in this paper is a generalization of the caching design where the most popular files are stored at each POA and the hybrid caching design proposed in [21]. In particular, by choosing the design parameters (p1 , p2 ) such that Tj,n = 1 for all n = 1, 2, · · · , Kj and Tj,n = 0 for all n = Kj + 1, Kj + 2, · · · , N, where j = 1, 2, the proposed random caching design turns to the design caching the most popular files [7], [9]. In addition, by choosing the design paprameters (p1 , p2 ) in a certain manner, the proposed random caching design can reflect identical caching in the 1st tier, random caching in the 2nd tier and nonoverlapping caching across the two tiers, and hence incorporate the hybrid caching design in [21] as a special case. Therefore, by carefully designing (p1 , p2 ), the proposed random caching design can achieve better performance than the two designs. Later, we shall see the advantage of the proposed random design in Section VI. C. Multicasting Consider a user requesting file n. If file n is not stored in any tier, the user will not be served. Otherwise adopt the following user association rule: i) if file n is stored only in the jth tier, the user is associated with the nearest POA in the jth tier storing file n; ii) if file n is stored in both tiers, the user is associated with the POA which stores file n and provides the maximum long-term average received power (RP) among all the POAs [13], [14]. Remark 2: Note that the content-centric user association considered in this paper is a generalization of the content-centric user association in [21]. In particular, Case ii) is not included in [21] due to the nonoverlapping caching constraint in [21]. June 27, 2017 DRAFT 8 We consider multicasting in the large-scale cache-enabled two-tier network. Consider a POA serving requests for k different files. Then, it transmits each of the k files only once to concurrently serve users requesting the same file, at a rate τ (bit/second) and over 1 k of the total bandwidth W using frequency division multiple access (FDMA). As a matter of fact, both multicast and unicast may happen (with different probabilities). Without loss of generality, as in [21], we refer to this transmission as multicast. Note that, by avoiding transmitting the same file multiple times to multiple users, this content-centric multicast can improve the efficiency of the utilization of the wireless medium and reduce the load of the wireless network, compared to the traditional connection-based unicast [24]. From the above illustration, we can see that the proposed multicasting design is also affected by the proposed caching design. Therefore, the design parameters (p1 , p2 ) affect the performance of the random caching and multicasting design. D. Performance Metric In this paper, we study w.l.o.g. the performance of a typical user u0 , which is located at the origin. Suppose u0 requests file n. Let j0 denote the index of the tier with which u0 is associated, and let j 0 denote the other tier. Let ℓ0 ∈ Φj0 denote the index of the serving d POA of u0 . We denote Dj,ℓ,0 and hj,ℓ,0 ∼ CN (0, 1) as the distance and the small-scale channel between POA ℓ ∈ Φj and u0 , respectively. We assume the complex additive white Gaussian noise of power N0 (evaluated over the entire frequency band) at u0 . For analytical tractability, as in [22] and [21], we assume all POAs are active for serving their own users. This corresponds to the worst-case interference strength for the typical user.3 When u0 requests file n and file n is transmitted by POA ℓ0 , the SINR of u0 is given by4 −α SINRn,0 = P −αj0 ℓ∈Φj0 \ℓ0 Dj0 ,ℓ,0 2 Dj0 ,ℓj00,0 hj0 ,ℓ0 ,0 P −αj 2 0 hj0 ,ℓ,0 + ℓ∈Φ Dj ,ℓ,0 hj 0 ,ℓ,0 j0 0 2 P j , n ∈ N. 0 Pj0 + (3) N0 Pj0 Note that, as in [7], [21], the transmitted symbols of file n from POA ℓ0 are treated as the desired signal, while the transmitted symbols of file n from other POAs are regarded as 3 The performance obtained under this assumption provides a lower bound on the performance of the practical network where some void POAs may be shut down. 4 The bandwidth for serving u0 is random, and affects the signal, interference and noise power experienced at u0 in the same manner, i.e., linearly. Thus, we can use the signal and noise power over the whole frequency band in calculating SINRn,0 [21]. June 27, 2017 DRAFT 9 interference.5 When Tj,n > 0 (i.e., u0 may be associated with tier j), let Kj,n,0 ∈ {1, · · · , Kj } denote the number of different cached files requested by the users associated with POA ℓ0 ∈ Φj . Note that Kj,n,0 is a discrete random variable, whose probability mass function (p.m.f.) depends on a, λu and the design parameters (p1 , p2 ). The file can be decoded correctly at u0 if the channel capacity between BS ℓ0 and u0 is greater than or equal to τ . Requesters are mostly concerned about whether their desired files can be successfully received. Therefore, we adopt the probability that a randomly requested file by u0 is successfully transmitted, referred to as the successful transmission probability, as the network performance metric [21]. Let Aj,n (pj , pj ) denote the probability that u0 requesting file n is associated with tier j. By total probability theorem, the successful transmission probability under the considered scheme is " X  W log2 1 + SINRn,0 ≥ τ q (p1 , p2 ) = an A1,n (p1 , p2 ) Pr K1,n,0 n∈N {z | " X ,q1 (p1 ,p2 )  W + an A2,n (p2 , p1 ) Pr log2 1 + SINRn,0 ≥ τ K2,n,0 n∈N {z | j0 = 1 # } # j0 = 2 . ,q2 (p1 ,p2 ) (4) } where qj (pj , pj ) represents the probability that a randomly requested file by u0 is successfully transmitted from a POA in tier j, also referred to as the successful transmission probability of tier j.6 III. P ERFORMANCE A NALYSIS In this section, we first analyze the successful transmission probability in the general region. Then, we analyze the successful transmission probability in the asymptotic region. A. Performance Analysis in General Region In this subsection, we analyze the successful transmission probability in the general region (i.e., the general SNR and general user density region), using tools from stochastic geometry. 5 The received signals from all the POAs transmitting file n may not be perfectly synchronized due to the large difference in distances from these POAs to u0 [26]. 6 Note that the expression of the successful transmission probability in (4) is different from the performance metrics in [21] and [24]. June 27, 2017 DRAFT 10 First, the user association probability Aj,n (pj , pj ) can be found in [13], [14] and is provided here for completeness: λj Tj,n Aj,n (pj , pj ) = λj Tj,n + λj Tj,n  P  α2 , Aj,n (Tj,n , Tj,n ). (5) j Pj File load Kj,n,0 and SINR SINRn,0 are correlated in a complex manner in general, as POAs with larger association regions have higher file load and lower SINR (due to larger user to POA distances) [27]. For the tractability of the analysis, as in [21], [22], [27], the dependence is ignored, i.e., " #  W Pr log2 1 + SINRn,0 ≥ τ j0 = j Kj,n,0  Kj   kτ X   ≈ Pr Kj,n,0 = k j = j0 Pr SINRn,0 ≥ 2 W − 1  j0 = j , j = 1, 2, n ∈ N . (6) k=1 To obtain the conditional p.m.f. of Kj,n,0 given j0 = j by generalizing the methods for calculating the p.m.f. of file load in [21], we need the probability density function (p.d.f.) of the size of the Voronoi cell of BS ℓ0 w.r.t. file m ∈ Nj,i,−n when ℓ0 contains combination i ∈ Ij,n , where Nj,i,−n , Nj,i \ {n}. However, since this p.d.f. is very complex and still unknown, we adopt the widely used approach in the existing literature [21], [22], [24], [27] and approximate this p.d.f. based on a tractable approximation of the p.d.f. of the size of the Voronoi cell to which a randomly chosen user belongs [28]. Under this approximation, the conditional p.m.f. of Kj,n,0 is given in the following lemma. Lemma 1 (Conditional p.m.f. of Kj,n,0): The conditional p.m.f. of Kj,n,0 given j0 = j is given by X pj,i   Pr Kj,n,0 = k | j0 = j ≈ Tj,n i∈I j,n X Y X ∈{S⊆Nj,i,−n :|S|=k−1} m∈X 1 − bj,m  Y bj,m , m∈Nj,i,−n \X (7) June 27, 2017 DRAFT 11    N    kτ 0 dd. d exp −πλj (θ1,k x + θ2,j,k y + θ3,j,k ) d2 exp − 2 W − 1 dα Pj 0    ! 2 kτ 2 2  kτ 2 2 2 α B′ = 2W − 1 + 1. , 1 − , 2− W − B ,1 − α α α α α      !  α2 2λj λj α2 kτ 2 2 − kτ 2 2 ′ W W = B σj 2 − 1 σ . ,1 − ,2 ,1 − −B + αλj α α α α λj j fj,k (x, y) , 2πλj θ1,k θ2,j,k θ3,j,k Z ∞ (10) (11) (12)     2 2  α2  2 2λj kτ 2  kτ 2 2 α W W σj 2 − 1 = 2 −1 B ,1 − ,1 − + . B α α α αλj α α (13) where k = 1, · · · , Kj , and7 bj,m  −3.5  b am λu Aj,m Tj,m , Tj,m   , , 1 +  3.5λj  bj,m (Tj,m , T ) , A j,m λj λj Tj,m + λj Tj,m (8)  P  α2 . (9) j Pj Proof: Please refer to Appendix A. Theorem 1 (Performance): The successful transmission probability q (p1 , p2 ) of u0 is q (p1 , p2 ) = q1 (p1 , p2 ) + q2 (p2 , p1 ) , (14) where qj (pj , pj ) = X Kj an n∈N  X X pj,i  k=1 i∈Ij,n Y X X ∈{S⊆Nj,i,−n :|S|=k−1} m∈X 1 − bj,m  Y m∈Nj,i,−n \X   bj,m  fj,k (Tj,n , Tj,n ), (15) bj,m is given by (8) and fj,k (Tj,n , Tj,n ) is given by (10) with θ1,k , θ2,j,k and θ3,j,k given by (11), R1 R1 ′ (12) and (13). Here, B (x, y, z) , z ux−1 (1 − u)y−1 du and B(x, y) , 0 ux−1 (1 − u)y−1 du denote the complementary incomplete Beta function and the Beta function, respectively. From Theorem 1, we can see that in the general region, the physical layer parameters α, W , λ1 , λ2 , λu , 7 P1 P2 , N0 N0 and the design parameters (p1 , p2 ) jointly affect the successful transmission   bj,m Tj,m , T Note that A j,m = June 27, 2017   Aj,m Tj,m ,Tj,m Tj,m . DRAFT 12 probability q (p1 , p2 ). The impacts of the physical layer parameters and the design parameters on q (p1 , p2 ) are coupled in a complex manner. B. Performance Analysis in Asymptotic Region The gain of multicasting over unicasting increases with user density [21]. In this subsection, to obtain design insights into caching and multicasting, we analyze the asymptotic successful transmission probability in the high SNR and high user density region. Note that in the rest of the paper, when considering the asymptotic region (i.e., the high SNR and user density region), we assume P1 N0 → ∞ and P2 N0 → ∞ while fixing the power ratio, i.e., σ1 (σ2 ). In addition, in the high user density region where λu → ∞, the discrete random variable Kj,n,0 → Kj in distribution. From Theorem 1, we can derive the successful transmission probability in the asymptotic region. Corollary 1 (Asymptotic Performance): When P N0 → ∞ and λu → ∞, q(p1 , p2 ) = q1,∞ (T1 , T2 ) + q2,∞ (T2 , T1 ) , q(T1 , T2 ), (16) where qj,∞ (Tj , Tj ) = X n∈N an Tj,n . θ1,Kj Tj,n + θ2,j,Kj Tj,n + θ3,j,Kj (17) Here, Tj,n is given by (2), and θ1,k , θ2,j,k and θ3,j,k are given by (11), (12) and (13). Proof: Please refer to Appendix B. Note that qj,∞ (Tj , Tj ) = lim P N0 →∞,λu →∞ qj (pj , pj ) and q∞ (T1 , T2 ) = lim P N0 →∞,λu →∞ q(p1 , p2 ); when λu → ∞ (corresponding to the full file load case), qj and q become functions of T1 and T2 instead of p1 and p2 . In addition, the asymptotic successful transmission probability in Corollary 1 and the performance metric in [13], [14] have different meanings, although they share similar forms. From Corollary 1, we can see that in the high SNR and high user density region, the impact of the physical layer parameters α, W , λj and σj , captured by θ1,j , θ2,j,Kj and θ3,j,Kj , and the impact of the design parameters (p1 , p2 ) on q∞ (T1 , T2 ) can be easily separated. In most practical cases, θ1,K1 , θ1,K2 > 0. Thus, we consider θ1,K1 , θ1,K2 > 0 in the rest of the paper. Fig. 2 verifies Theorem 1 and Corollary 1, and demonstrates the accuracy of the approximation adopted. Fig. 2 also indicates that q∞ (T1 , T2 ) provides a simple and good approximation for q (p1 , p2 ) in the high SNR (e.g., P N0 ≥ 120 dB) and the high user density region (e.g., λu ≥ 3 × 10−5 ). June 27, 2017 DRAFT Successful Transmission Probability 13 Asympt Monte Carlo Analytical 0.6 0.4 0.2 0 140 6 120 5 100 4 80 ×10 -5 3 60 2 Transmission SNR P/N0(dB) Successful transmission probability versus SNR NP0 and user density λu . N = 10, K1 = 3, K2 = 2,   10 1 1 −7 for all i = 1, 2, · · · , 10 , λ2 = 3 × 10−6 , p1,i = 10 3 , p2,i = (10) for all i = 1, 2, · · · , 2 , λ1 = 5 × 10 (3) 2 −γ P1 = 101.5 P , P2 = P , α = 4, W = 20 × 106 , τ = 35 × 104 and an = P n n−γ with γ = 1. Fig. 2. n∈N In the asymptotic region, from [21], we know that the constraints on (p1 , p2 ) in (1) and (2) can be equivalently rewritten as (T1 , T2 ) ∈ T1 × T2 , where Tj is defined as     X Tj,n = Kj . Tj , Tj 0 ≤ Tj,n ≤ 1, n ∈ N ,   (18) n∈N To obtain design insights into caching in large-scale multi-tier wireless multicasting networks, in Section IV and Section V, we focus on the joint and competitive caching designs in the asymptotic region, respectively. IV. J OINT C ACHING D ESIGN In this section, we consider the case that the two tiers of POAs are managed by a single operator, e.g., as in a HetNet. We first formulate the optimal joint caching design problem to maximize the successful transmission probability in the asymptotic region. Then, we develop an algorithm to obtain a stationary point. June 27, 2017 DRAFT 14 A. Optimization Problem Formulation In this subsection, we formulate the optimal joint caching design problem to maximize the successful transmission probability q∞ (T1 , T2 ) by optimizing the caching distributions of the two tiers, i.e., (T1 , T2 ). Problem 1 (Joint Caching Design): ∗ q∞ , max T1 ,T2 q∞ (T1 , T2 ) s.t. Tj ∈ Tj , where q∞ (T1 , T2 ) is given by (16) and Tj is given by (18). Problem 1 maximizes a differentiable (nonconcave in general) function over a convex set, and it is thus nonconvex in general. Note that Problem 1 and Problem 0 in [14] are mathematically equivalent, although this paper and [14] have different scopes. In the following subsection, we propose an efficient algorithm to solve Problem 1. In contrast, [14] simplifies the nonconvex problem to a convex one, and uses the optimal solution to the simplified problem as a sub-optimal solution to the original problem, which may not provide performance guarantee. B. Algorithm Design Recall that Problem 1 is to maximize a differentiable (nonconcave in general) function over a convex set. We can obtain a stationary point of Problem 1 using the gradient projection method with a diminishing stepsize [29, pp. 227], as summarized in Algorithm 1 for completeness. In Algorithm 1, the diminishing stepsize ǫ(t) satisfies ǫ(t) → 0 as t → ∞, ∞ ∞ 2 P P ǫ(t) = ∞ and ǫ(t) < ∞. In addition, Step 3 is the projection of T̄j,n (t + 1) onto set t=1 t=1  Tj . It is shown in [29, pp. 229] that the sequence (T1 (t), T2 (t)) generated by Algorithm 1 converges to a stationary point of Problem 1. Note that a stationary point is a point that satisfies the necessary optimality conditions of a nonconvex optimization problem, and it is the classic goal in the design of iterative algorithms for nonconvex optimization problems. However, the rate of convergence of Algorithm 1 is strongly dependent on the choices of stepsize ǫ(t). If it is chosen improperly, it may take a large number of iterations for Algorithm 1 to meet some convergence criterion. To address the above problem, in this subsection we propose an iterative algorithm to obtain a stationary point of Problem 1 more efficiently. This algorithm is based on the block June 27, 2017 DRAFT 15 Algorithm 1 Stationary Point of Problem 1 Based on the Standard Gradient Projection Method 1: Initialize t = 1 and choose any Tj (1) ∈ Tj (e.g., Tj,n (1) = Kj N for all n ∈ N ), j = 1, 2. ∂q∞ (T1 (t),T2 (t)) 2: For all n ∈ N , compute T̄j,n (t + 1) according to T̄j,n (t + 1) = Tj,n (t) + ǫ(t) . ∂Tj,n (t) n o  ∗ + 3: For all n ∈ N , compute Tj,n (t + 1) according to Tj,n (t + 1) = min T̄j,n (t + 1) − νj , 1 , where νj∗ satisfies n o  P ∗ + min T̄ (t + 1) − ν , 1 = Kj . j,n j n∈N 4: Set t = t + 1 and go to Step 2. successive upper-bound minimization algorithm originally proposed in [23]. It alternatively updates T1 and T2 by maximizing an approximate function of q∞ (T1 , T2 ), which is successively refined so that eventually the iterative algorithm can converge to a stationary point of Problem 1. Specifically, at iteration t, we update the caching distribution of the jth tier by maximizing the approximate function of q∞ (T1 , T2 ) given the caching distribution of the jth tier, and fix the caching distribution of the jth tier, where j = ((t + 1) mod 2) + 1. For notational convenience, we define     q∞ Tj , Tj , j = 1,    q̃∞ Tj , Tj ,     q∞ Tj , Tj , j = 2. (19) At iteration t, choose gj (Tj ; T1 (t), T2 (t)) to be an approximate function of q̃∞ (Tj , Tj (t)), where gj (Tj ; T1 (t), T2 (t)) is given by gj Tj ; T1 (t), T2 (t)  , qj,∞ (Tj , Tj (t)) + qj,∞ (Tj (t), Tj (t)) +   X ∂qj,∞ Tj (t), Tj (t) n∈N = qj,∞ (Tj , Tj (t)) + qj,∞ (Tj (t), Tj (t)) − X n∈N ∂Tj,n Tj,n − Tj,n (t) an θ2,j,Kj Tj,n (t) Tj,n − Tj,n (t)   2 .  θ1,Kj Tj,n (t) + θ2,j,Kj Tj,n (t) + θ3,j,Kj (20) Note that the first concave component function of q̃∞ (Tj , Tj (t)), i.e., qj,∞ (Tj , Tj (t)) is left unchanged, and only the second nonconcave (actually convex) component function, i.e., qj,∞ (Tj (t), Tj ) is linearized at Tj = Tj (t). This choice of the approximate function is beneficial from several aspects. Firstly, it can guarantee the convergence of the algorithm to a stationary point of Problem 1, which will be seen in Theorem 2. Secondly, the partial concavity of the original objective function is preserved, and the resulting algorithm typically converges much faster than Algorithm 1, where all component functions are linearized and June 27, 2017 DRAFT 16 no partial concavity is exploited. Thirdly, it yields a closed-form optimal solution to the optimization problem at each iteration, which will be explained in Lemma 2. Specifically,  gj (Tj ; T1 (t), T2 (t)) is strictly concave on Tj for any given T1 (t), T2 (t) ∈ T1 × T2 , and satisfies8     (21) gj Tj (t); T1 (t) , T2 (t) = q̃∞ Tj (t) , Tj (t) , T1 (t), T2 (t) ∈ T1 × T2 ,     gj Tj ; T1 (t) , T2 (t) ≤ q̃∞ Tj , Tj (t) , Tj ∈ Tj , T1 (t) , T2 (t) ∈ T1 × T2 , (22)  The conditions in (21) and (22) imply that gj Tj ; T1 (t), T2 (t) is a tight lower-bound of  q̃∞ (Tj , Tj (t)). The differentiability of gj Tj ; T1 (t), T2 (t) guarantees that the first-order  behavior of gj Tj ; T1 (t), T2 (t) is the same as q̃∞ (Tj , Tj (t)) locally. At each iteration t, we update the caching distribution of the jth tier given the caching distribution of the jth tier by solving the following problem, and fix the caching distribution of the jth tier, where j = ((t + 1) mod 2) + 1. Problem 2 (Optimization at Iteration t): For tier j = ((t + 1) mod 2) + 1, we have  Tj (t + 1) = argmax gj Tj ; T1 (t), T2 (t) Tj s.t. Tj ∈ Tj ,  where gj Tj ; T1 (t), T2 (t) is given by (20). Problem 2 is a convex optimization problem and Slater’s condition is satisfied, implying that strong duality holds. Using KKT conditions, we can obtain the closed-form optimal solution to Problem 2, as shown in the following lemma. Lemma 2 (Optimal Solution to Problem 2): For all j = ((t + 1) mod 2) + 1, the optimal solution to Problem 2 is given by Tj,n (t + 1) =    v     u     1 u (t) + θ a θ T 3,j,K n 2,j,K j j j,n u  u min  (t) T a θ n j,n 2,j,K  θ1,Kj u  j  t νj∗ (t) +       θ1,K Tj,n (t)+θ2,j,K Tj,n (t)+θ3,j,K  j j 8 j + 2  θ2,j,Kj Tj,n (t) + θ3,j,Kj   −   θ1,Kj          ,1 , n ∈ N,        Note that (21) holds since gj (Tj ; T1 (t), T2 (t)) and q̃∞ (Tj , Tj (t)) have the same value at the point where gj (Tj ; T1 (t), T2 (t)) is defined, i.e., (T1 , T2 ) = (T1 (t), T2 (t)). (22) holds since qj,∞ (Tj , Tj ) is a convex function of Tj for any given Tj ∈ Tj . June 27, 2017 DRAFT 17 Algorithm 2 Stationary Point of Problem 1 Based on BSUM 1: Initialize t = 1 and choose any Tj (1) ∈ Tj (e.g., Tj,n (1) = Kj N for all n ∈ N ), j = 1, 2. 2: Compute j = ((t + 1) mod 2) + 1. 3: For all n ∈ N , compute Tj,n (t + 1) according to Lemma 2. 4: For all n ∈ N , set Tj,n (t + 1) = Tj,n (t). 5: Set t = t + 1 and go to Step 2. where [x]+ , max{x, 0} and νj∗ (t) is the Lagrange multiplier that satisfies X Tj,n (t + 1) = Kj . n∈N Note that νj∗ (t) can be efficiently obtained by using bisection search. The details of the proposed iterative algorithm are summarized in Algorithm 2. Based on the conditions in (21) and (22), we show the convergence and optimality of Algorithm 2.  Theorem 2 (Convergence and Optimality of Algorithm 2): The sequence q∞ (T1 (t), T2 (t))  generated by Algorithm 2 is convergent, and every limit point of (T1 (t), T2 (t)) is a stationary point of Problem 1. Proof: Please refer to Appendix C. Different from Algorithm 1, Algorithm 2 does not rely on a stepsize. Thus, Algorithm 2 may have more robust convergence performance than Algorithm 1, as we shall illustrate later in Fig. 3. In the rest of this subsection, we consider a special case where K1 = K2 , K. In this case, 2 2 2 2 2 λ1 P1α θ1,K1 = λ2 P2α θ2,2,K2 , µ1,K , λ1 P1α θ2,1,K1 = λ2 P2α θ1,K2 , µ2,K and λ1 P1α θ3,1,K1 = 2 λ2 P2α θ3,2,K2 , µ3,K . In addition, q∞ (T1 , T2 ) can be further simplified as X 2 2 λ1 P1α T1,n + λ2 P2α T2,n q∞ (T1 , T2 ) = an , µ 1,K T1,n + µ2,K T2,n + µ3,K n∈N (23) which is a concave function of (T1 , T2 ). Thus, Problem 1 becomes a convex optimization problem, and a (globally) optimal solution can be obtained by standard convex optimization methods such as interior-point methods. However, when N is very large, standard convex optimization methods may not scale very well. Motivated by [14], by exploring structural properties of Problem 1 in this case, we develop a low-complexity algorithm to obtain an optimal solution. The method consists of two stages. In the first stage, we solve a relaxed version of Problem 1 to obtain a system of linear equations of an optimal solution to June 27, 2017 DRAFT 18 Problem 1. This stage is the same as that in [14], and is included for completeness. Denote 2 2 R , (Rn )n∈N , where Rn , P1α λ1 T1,n + P2α λ2 T2,n . Specifically, Problem 1 can be relaxed as follows. Problem 3 (Relaxed Version of Problem 1 When K1 = K2 = K [14]): X Rn , max an R θ 1,K Rn + µ3,K n∈N 2 2 0 ≤ Rn ≤ P1α λ1 + P2α λ2 , n ∈ N , X 2 2 Rn = (P1α λ1 + P2α λ2 )K. s.t. n∈N ∗ Let R denote the optimal solution to Problem 3. The optimal soluton to Problem 3 is given by [14, Proposition 3], i.e.,   !+ r    1  2 2 a µ n 3,K ∗ α α  Rn = min  − µ , P λ + P λ , n ∈ N, 3,K 1 2 1 2   ν∗  θ1,K  where ν ∗ is the Lagrange multiplier that satisfies   X 2 2 ∗ α α Rn = P1 λ1 + P2 λ2 K. (24) (25) n∈N ∗ Note that ν can be efficiently obtained by using bisection search. In addition, by Proposition 4 in [14], we know that the optimal solution to Problem 3 and an optimal solution to Problem 1 satisfy a system of linear equations: 2 2 ∗ ∗ + P2α λ2 T2,n = Rn∗ , n ∈ N . P1α λ1 T1,n (26) In the second stage, we solve the system of linear equations given in (26) to obtain an optimal solution (T∗1 , T∗2 ) to Problem 1. In our case, we can easily show that ∗ Tj,n = Rn∗ 2 α 2 α , n ∈ N , j = 1, 2 (27) P1 λ1 + P2 λ2 is a solution to the system of linear equations in (26). This stage is different from that in [14], ∗ as we can directly obtain Tj,n using the closed-form expression in (27), due to K1 = K2 . The details are summarized in Algorithm 3. Note that the complexity of Algorithm 3 is close to that of one iteration of Algorithm 2. Thus, the complexity of Algorithm 3 is much lower than Algorithm 2. June 27, 2017 DRAFT 19 Algorithm 3 Globally Optimal Solution 1: Obtain Rn∗ by (24) and (25). ∗ 2: Compute Tj,n by (27), n ∈ N , j = 1, 2. V. C OMPETITIVE C ACHING D ESIGN In this section, we study the scenario that the two tiers of POAs are managed by two different operators, e.g., IEEE 802.11 APs of two owners. The two different operators have their own interests and thus cannot be jointly managed. Besides, one operator may be sacrificed in order to achieve the maximum total utility. Therefore, we propose a game theoretic approach and adopt a NE as a desirable outcome. We first formulate the competitive caching design for the two different operators within the framework of game theory. Then, we characterize a NE of the game and develop an algorithm to obtain a NE. A. Game Formulation In this subsection, we formulate the competitive caching design for the two different operators within the framework of game theory. We consider a strategic noncooperative game, where the two operators are the players. The utility function of player j is the successful transmission probability for tier j, i.e., qj,∞ (Tj , Tj ). Each tier j competes against the other tier j by choosing its caching distribution Tj (i.e., strategy or action) in the set of admissible strategies Tj to maximize its utility function, i.e., qj,∞ (Tj , Tj ). Problem 4 (Competitive Caching Game): For all j = 1, 2, we have max qj,∞ (Tj , Tj ) Tj s.t. Tj ∈ Tj , where qj,∞ (Tj , Tj ) is given by (17) and Tj is given by (18). Let G denote the game. A solution, i.e., a NE,9 of game G is defined as follows. Definition 1 (Nash Equilibrium of Game G): A (pure) strategy profile (T†1 , T†2 ) ∈ T1 × T2 is a NE of game G if qj,∞ (T†j , Tj† ) ≥ qj,∞ (Tj , T†j ), Tj ∈ Tj , j = 1, 2. 9 (28) A NE is reached when each player, given the strategy profiles of the others, does not get any performance increase by unilaterally changing his own strategy [30]. June 27, 2017 DRAFT 20 By Definition 1, we know that a NE of game G is given by the following problem. Problem 5 (NE of Game G): For all j = 1, 2, we have T†j = argmax qj,∞ (Tj , T†j ), Tj s.t. Tj ∈ Tj . B. Nash Equilibrium In this subsection, we characterize a NE of game G. First, we show the existence and uniqueness of the NE of game G. Lemma 3 (Existence and Uniqueness of the NE of Game G): There exists a unique NE of game G. Proof: Please refer to Appendix D. We now obtain the closed-form expression of the unique NE of game G. Since qj,∞ (Tj , Tj ) is strictly concave on Tj for any given Tj ∈ Tj , Problem 5 is convex and Slater’s condition is satisfied, implying that strong duality holds. Using KKT conditions, we can solve Problem 5 and show Lemma 4. Lemma 4 (NE of Game G): Game G has a unique NE (T†1 , T†2 ) which is given by † Tj,n =  +  v     u     †   1 u an θ2,j,Kj T † + θ3,j,Kj + θ θ T 3,j,Kj  2,j,Kj j,n j,n t   , n ∈ N , j = 1, 2, , 1 min  − †    θ1,Kj θ1,Kj ν   j     where for all j = 1, 2, νj† is the Lagrange multiplier that satisties X † Tj,n = Kj . n∈N Remark 3: The file popularity distribution a and the physical layer parameters (captured † , n ∈ N , the physical layer in θ1,Kj , θ2,j,Kj and θ3,j,Kj ) jointly affect νj† . Given νj† and Tj,n parameters (captured in θ1,Kj , θ2,j,Kj and θ3,j,Kj ) affect the caching probabilities of all the files in the same way, while the popularity of file n (i.e., an ) only affects the caching probability † of file n (i.e., Tj,n ) [22]. June 27, 2017 DRAFT 21 Algorithm 4 Nash Equilibrium of Game G 1: Initialize t = 1 and choose any Tj (1) ∈ Tj (e.g., Tj,n (1) = Kj N for all n ∈ N ), j = 1, 2. 2: Compute j = ((t + 1) mod 2) + 1. 3: Compute Tj (t + 1) = argmax qj,∞ (Tj , Tj (t)). Tj ∈Tj 4: Set Tj (t + 1) = Tj (t). 5: Set t = t + 1 and go to Step 2. C. Algorithm Design In this subsection, we develop an iterative algorithm to obtain the NE of game G. It alternatively updates T1 while T2 is fixed and T2 while T1 is fixed, by solving the following problem at each iteration t. Problem 6 (Optimization at Iteration t): For player j = ((t + 1) mod 2) + 1, we have Tj (t + 1) = argmax qj,∞ (Tj , Tj (t)) Tj s.t. Tj ∈ Tj . Similar to Problem 5, using KKT conditions, we can obtain the closed-form expression of the unique optimal solution to Problem 6. We present it below for completeness. Lemma 5 (The Optimal Solution to Problem 6): For all j = ((t + 1) mod 2) + 1, the optimal solution to Problem 6 is given by Tj,n (t + 1) =  +  v     u      1 u an θ2,j,Kj Tj,n (t) + θ3,j,Kj   θ T (t) + θ 2,j,Kj j,n 3,j,Kj t   min  −  , 1, n ∈ N ,  θ1,Kj θ1,Kj νj† (t)       where νj† (t) is the Lagrange multiplier that satisfies X Tj,n (t + 1) = Kj . n∈N Note that Problem 5 and Problem 6 in Lemma 5 share similar forms. Thus, the NE of game G in Lemma 4 and the solution to Problem 6 share similar forms. Based on the optimal solution to Problem 6, at iteration t, we update the strategy of player j, and fix the strategy of player j, where j = ((t + 1) mod 2) + 1. The details for obtaining the NE of game G is summarized in Algorithm 4. June 27, 2017 DRAFT 22 Note that in general, it is quite difficult to guarantee that an iterative algorithm can converge to the NE of a game, especially for a large-scale wireless network. By carefully analyze structural properties of the competitive caching design game, we provide a convergence condition for Algorithm 4. Theorem 3 (Convergence of Algorithm 4): If        θ1,K2  θ1,K1 max 1, 1 − < 4, max 1, 1 −   θ3,1,K1  θ3,2,K2  (29) where θ1,k , θ2,j,k and θ3,j,k are given by (11), (12) and (13), Algorithm 4 converges to the unique NE of game G for all Tj (1) ∈ Tj , j = 1, 2, i.e., (T1 (t), T2 (t)) → (T†1 , T†2 ) as t → ∞, where (T†1 , T†2 ) is given by Lemma 4. Proof: Please refer to Appendix E. Note that the convergence condition given in Theorem 3 can be easily satisfied in most cases we are interested in, which will be shown in Fig. 3. VI. N UMERICAL R ESULTS In this section, we first illustrate the convergence and complexity of the proposed algorithms. Then, we compare the successful transmission probabilities and caching probabilities of the proposed algorithms with those of existing solutions. In the simulation, we choose W = 20 × 106 , τ = 4 × 104 , N = 500, α = 4, λ1 = 5 × 10−7 , λ2 = 3 × 10−6 and P1 = 101.6P2 . We assume that the popularity follows Zipf distribution, i.e., an = where γ is the Zipf exponent. −γ P n −γ , n∈N n A. Convergence and Complexity In this subsection, we show the convergence and complexity of the proposed algorithms. Fig. 3 illustrates the successful transmission probability versus the number of iterations when K1 6= K2 and K1 = K2 . From Fig. 3, we can observe that the rate of convergence of Algorithm 1 is strongly dependent on the choices of stepsize ǫ(t). In addition, Algorithm 2 and Algorithm 4 have more robust convergence performance than Algorithm 1, as they do not rely on a stepsize. Fig. 4 illustrates the computing time versus the cache size Kj and the Zipf exponent γ when K1 6= K2 and K1 = K2 . From Fig. 4, we can observe that the computing times of all the algorithms do not change much with Kj or γ, and the computing times of the proposed algorithms are shorter than that of Algorithm 2 in [21] which is to June 27, 2017 DRAFT 23 0.32 0.32 Alg. 1 (c=1000) Alg. 1 (c=100) Alg. 2 (proposed) Alg. 4 (proposed) 0.3 0.28 0.26 0.24 0.22 0.2 0.18 0 5 10 Number of Iterations 15 20 Successful Transmission Probability Successful Transmission Probability 0.34 0.3 Alg. 1 (c=1000) Alg. 1 (c=100) Alg. 4 (proposed) 0.28 0.26 0.24 0.22 0.2 0.18 0.16 0 (a) K1 = 55 and K2 = 35. Fig. 3. ǫ(t) = 5 10 Number of Iterations 15 20 (b) K1 = K2 = 35. Successful transmission probability versus the number of iterations. The stepsize for Algorithm 1 is c 2+t0.55 . We choose the same initial point for all the algorithms shown in Fig. 3 obtain an asymptotically optimal hybrid caching design. These observations demonstrate the advantage of the proposed algorithms in terms of complexity. B. Successful Transmission Probabilities and Caching Probabilities In this subsection, we compare the successful transmission probabilities and caching probabilities of the proposed joint and competitive caching designs with those of three baselines. Baseline 1 (most popular) refers to the design in which each POA in tier j stores the Kj most popular files [4]–[6]. Baseline 2 (i.i.d. file popularity) refers to the design in which each POA in tier j randomly stores Kj files, in an i.i.d. manner with file n being selected with probability an [31]. Baseline 3 (hybrid caching) refers to the hybrid caching design obtained by Algrithm 2 in [21]. The three baseline schemes also adopt the same multicasting scheme as in our design. Fig. 5 illustrates the successful transmission probability versus the cache size Kj and the Zipf exponent γ, respectively. From Fig. 5, we can observe that as Kj and γ increase, the successful transmission probability of each scheme increases. We can also observe that the two proposed designs outperform all the three baseline schemes. In addition, we can see that when Kj or γ is large, the two proposed designs reduce to the most popular caching design. When Kj or γ is small, the two proposed designs perform similarly as the hybrid caching design. These observations show that the two proposed designs can well adapt to the changes of the system parameters and can wisely utilize storage resources. June 27, 2017 DRAFT 24 0.1 0.09 Alg. 1 Alg. 2 (proposed) Alg. 4 (proposed) Alg. 2 in [21] 0.07 Computing time(s) 0.08 Computing time(s) 0.08 Alg. 1 Alg. 2 (proposed) Alg. 4 (proposed) Alg. 2 in [21] 0.07 0.06 0.05 0.06 0.05 0.04 0.04 0.03 0.03 0.02 0 10 20 30 40 50 60 70 0.02 0.2 80 0.3 0.4 0.5 Cache Size K2 0.05 0.05 0.045 0.045 0.04 0.04 0.035 0.035 Alg. 3 (proposed) Alg. 4 (proposed) Alg. 2 in [21] 0.025 0.02 0.01 0.005 30 40 50 1 1.1 1.2 0.02 0.01 20 0.9 60 70 80 Alg. 3 (proposed) Alg. 4 (proposed) Alg. 2 in [21] 0.025 0.015 10 0.8 0.03 0.015 0 0.7 (b) Zipf exponent γ at K1 = 55, K2 = 35. Computing time(s) Computing time(s) (a) Cache size K2 (K1 ) at γ = 0.55, K1 = K2 + 20. 0.03 0.6 Zipf Exponent γ 0.005 0.2 0.3 0.4 Cache Size K2 (c) Cache size K2 (K1 ) at γ = 0.55, K1 = K2 . 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 Zipf Exponent γ (d) Zipf exponent γ at K1 = K2 = 35. Fig. 4. Computing time versus the cache size or Zipf exponent γ. The stepsize for Algorithm 1 is ǫ(t) = c 2+t0.55 . For Algorithm 1, each point corresponds to the minimum computing time by choosing the optimal parameter c ∈ {500, 1000, 1500, 2000, 2500}. Fig. 6 illustrates the caching probabilities for the proposed joint caching design, competitive caching design and the hybrid caching design. From Fig. 6, we observe that under the proposed joint caching design and the hybrid caching design, when λ1 λ2 is above (below) some threshold, POAs of tier 1 (POAs of tier 2) cache the most popular files as they can offer relatively higher received powers. Recall that under the hybrid caching design, the files stored in the two tiers are non-overlapping, while the proposed joint caching design and competitive caching design allow a file to be stored in the two tiers. By comparing the caching probabilities under the three designs, we can see that the joint caching design and the competitive caching design June 27, 2017 DRAFT 25 0.8 joint caching (proposed) competitive caching (proposed) most popular i.i.d file popularity hybrid caching 0.4 Successful Transmission Probility Successful Transmission Probility 0.45 0.35 0.3 0.25 0.2 0.15 0 10 20 30 40 50 Cache Size K2 60 70 80 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.2 (a) cache size K2 (K1 ) at γ = 0.55, K1 = K2 + 20. Fig. 5. joint caching (proposed) competitive caching (proposed) most popular i.i.d file popularity hybrid caching 0.4 0.6 0.8 Zipf Exponent γ 1 1.2 (b) Zipf exponent γ at K1 = 55, K2 = 35. Successful transmission probability versus the cache size or Zipf exponent γ. offer much higher spatial file diversity, leading to higher successful transmission probabilities. VII. C ONCLUSION In this paper, we considered a random caching and multicasting scheme in a two-tier large-scale cache-enabled wireless multicasting network, operated by a single operator or two different operators. First, we derived tractable expressions for the successful transmission probabilities in the general region and the asymptotic region, respectively. Then, we formulated the optimal joint caching design problem in the asymptotic region. We develop an iterative algorithm, which is shown to converge to a stationary point. Next, we formulated the competitive caching design game in the asymptotic region, obtained the unique NE of the game and developed an iterative algorithm, which is shown to converge to the NE under a mild condition. Finally, by numerical simulations, we showed that the two proposed designs achieve significant gains over existing schemes, in terms of successful transmission probability and complexity. A PPENDIX A: P ROOF OF L EMMA 1 Let random variable Yj,m,n,i ∈ {0, 1} denote whether file m ∈ Nj,i \ {n} is requested from ℓ0 when ℓ0 contains combination i ∈ Ij,n . When ℓ0 contains combination i ∈ Ij,n , we P have Kj,n,0 = 1 + m∈Nj,i,−n Yj,m,n,i . For analytical tractability, as in [22], assume Yj,m,n,i, June 27, 2017 DRAFT 0 250 500 File Index 0.6 0.4 Tier 2 0.2 0 0 250 500 File Index Tier 1 0 0 250 500 File Index 1 0.5 Tier 2 0 0 Tier 1 0.5 0 0 250 500 File Index 1 Tier 2 0.5 0 250 500 File Index 0 0.5 Tier 1 0 0 250 500 File Index 1 0.5 Tier 2 0 250 500 File Index 0 250 500 File Index 1 Tier 1 0.5 0 0 250 500 File Index 1 0.5 Tier 2 0 0 Caching probability of file n (joint caching) 0 0.5 1 Caching probability of file n (competitive caching) Tier 1 1 Caching probability of file n (hybrid caching) 0.5 1 Caching probability of file n (joint caching) 1 Caching probability of file n (competitive caching) Caching probability of file n (hybrid caching) 26 1 Tier 1 0.5 0 0 250 500 File Index 1 0.5 Tier 2 0 250 500 File Index 0 250 500 File Index 0 250 500 File Index 1 0.5 Tier 2 0 0 250 500 File Index Tier 1 0 0 250 500 File Index 1 0.5 Tier 2 0 0 250 500 File Index 0.5 Tier 1 0 0 250 500 File Index 0.4 0.2 Tier 2 0 0 250 500 File Index (c) λ1 = 1.3 × 10−6 , λ2 = 2.2 × 10−6 , K1 = K2 = 35. Fig. 6. 0.5 Tier 1 0 0 250 500 File Index 1 0.5 Tier 2 0 0 250 500 File Index 0.4 1 0.5 Tier 1 0 0 250 500 File Index 1 0.5 Tier 2 0 0 250 500 File Index Caching probability of file n (joint caching) 0 0.5 1 Caching probability of file n (competitive caching) Tier 1 1 Caching probability of file n (hybrid caching) 0.5 1 Caching probability of file n (joint caching) 1 Caching probability of file n (competitive caching) Caching probability of file n (hybrid caching) (a) λ1 = 1.3 × 10−6 , λ2 = 2.2 × 10−6 , K2 = 35, K1 = 55. (b) λ1 = 9 × 10−9 , λ2 = 3.5 × 10−6 , K2 = 35, K1 = 55. Tier 1 0.2 0 0 250 500 File Index 1 Tier 2 0.5 0 0 250 500 File Index (d) λ1 = 9 × 10−9 , λ2 = 3.5 × 10−6 ,K1 = K2 = 35. Caching probabilities for the files in {5, 10, · · · , 500} of joint caching design, competitive caching design and hybrid caching design at α = 4 and γ = 0.55. m ∈ Nj,i \ {n} are independent. By Appendix C of [22], we have ≈   Pr Kj,n,0 = k | j0 = j X X pj,i i∈Ij,n Tj,n Y (1 − Pr[Yj,m,n,i = 0]) X ∈{S⊆Nj,i,−n :|S|=k−1} m∈X Similar to Appendix B in [32], we have  Y m∈Nj,i,−n \X   −3.5 am λu Aj,m Tj,m , Tj,m   Pr[Yj,m,n,i = 0] ≈ 1 +  3.5Tj,m λj June 27, 2017 Pr[Yj,m,n,i = 0]. (30) = bj,m . (31) DRAFT 27 By substituting (31) into (30), we can prove Lemma 1. A PPENDIX B: P ROOF OF C OROLLARY 1     kτ P2 P1 α N0 W When N0 → ∞ and N0 → ∞, we have exp − 2 − 1 d P1 → 1 and     kτ N α 0 exp − 2 W − 1 d P2 → 1. When λu → ∞, we have Kj,n,0 → Kj in distribution. Noting R∞  1 that 0 d exp −cd2 dd = 2c , we can solve integrals in (10). Thus, we can prove Corollary 1. A PPENDIX C: P ROOF OF T HEOREM 2 We show that the conditions in Theorem 2 (a) of [23] hold. i) By noting that (21) and  (22) hold and gj Tj ; T1 (t), T2 (t) is continuous and differentiable, we know that Assump- tion 2 in [23] is satisfied and q∞ (T1 , T2 ) is regular at any point in T1 × T2 [23]. ii) Since   gj Tj ; T1 (t), T2 (t) is strictly concave on Tj for any given T1 (t), T2 (t) ∈ T1 × T2 ,  Problem 2 has a unique solution for any given T1 (t), T2 (t) ∈ T1 × T2 . Therefore, by Theorem 2 (a) in [23], we can prove Theorem 2. A PPENDIX D: P ROOF OF L EMMA 3 First, we use Proposition 20.3 in [33] to prove the existence of NE of game G. It is obvious that for all j = 1, 2, the set of admissible strategies Tj is nonempty, compact and convex, and the utility function qj,∞ (Tj , Tj ) is a continuous function of (T1 , T2 ). Since qj,∞ (Tj , Tj ) is strictly concave on Tj for any given Tj ∈ Tj , then qj,∞ (Tj , Tj ) is quasi-concave on Tj for any given Tj ∈ Tj . Thus, by Proposition 20.3 in [33], we know that there exists at least one NE of game G. Next, we prove the uniqueness of NE by Theorem 2 in [34]. By the first-order strict concavity condition, we know that a strictly concave function must be diagonally strictly concave [34]. Thus, by Theorem 2 in [34], we know that there exists a unique NE of game G. A PPENDIX E: P ROOF OF T HEOREM 3 We prove the convergence of Algorithm 4 by verifying the conditions in Theorem 1 of [35]. i) It can be easily seen that for all j = 1, 2, qj,∞ (Tj , Tj ) is strictly concave on Tj for any given Tj ∈ Tj and is second-order Fréchet differentiable [36]. ii) By Lemma 5, we know June 27, 2017 DRAFT 28 that there exists an optimal solution to Problem 6 for any given Tj (t) ∈ Tj . iii) To guarantee the convergence of Algorithm 4, it remains to show that     (∇2T2 qj,∞ Tj , Tj )−1 ∇2Tj T qj,∞ Tj , Tj j j   × (∇2T2 qj,∞ Tj , Tj )−1 ∇2T j Tj =Tj (t+2),T =T (t+1) j j j   q T , T j Tj j,∞ j = ζ < 1, Tj =Tj (t),T =T (t+1) j j (32) 2 holds for any Tj (t) ∈ Tj and ((t + 1) mod 2) + 1 = j. Here, k · k2 denotes the spectral norm [36]. By Corollary 1, we have     (∇2T2 qj,∞ Tj , Tj )−1 ∇2Tj T qj,∞ Tj , Tj j j 2   −1 2 × (∇T2 qj,∞ Tj , Tj ) ∇T j   1 (a) = diag   4 (b) = max n∈N 1 4 1− j Tj Tj =Tj (t+2),T =T (t+1) j j  qj,∞ Tj , Tj θ1,Kj Tj,n (t + 2) θ2,j,Kj Tj,n (t + 1) + θ3,j,Kj θ1,Kj Tj,n (t + 2) 1− θ2,j,Kj Tj,n (t + 1) + θ3,j,Kj  Tj =Tj (t),T =T (t+1) j j ! 1 − ! 1 − 2 θ1,Kj Tj,n (t + 1) θ2,j,Kj Tj,n (t) + θ3,j,Kj θ1,Kj Tj,n (t + 1) θ2,j,Kj Tj,n (t) + θ3,j,Kj  n∈N     2  θ1,Kj Tj,n (t + 1) θ1,Kj Tj,n (t + 2) 1 × max 1 − max 1 − n∈N 4 n∈N θ2,j,Kj Tj,n (t + 1) + θ3,j,Kj θ2,j,Kj Tj,n (t) + θ3,j,Kj       (d) 1 θ1,Kj  θ1,Kj  < 1, ≤ max 1, 1 − max 1, 1 −   4 θ3,j,Kj  θ3,j,Kj  (c)    ≤ (33) where (a) is obtained by the definition of second-order derivative, (b) is obtained by the definition of spectral norm, (c) is obtained based on the formula max xn yn ≤ max xn · max yn , n ∈ N and (d) is obtained due to 1− 1− θ1,Kj Tj,n (t + 2) θ1,Kj ≤1− ≤ 1, θ3,j,Kj θ2,j,Kj Tj,n (t + 1) + θ3,j,Kj θ1,Kj θ3,j,Kj ≤1− θ1,Kj Tj,n (t + 1) θ2,j,Kj Tj,n (t) + θ3,j,Kj ≤ 1. (34) (35) Therefore, by Theorem 1 of [23], we can prove Theorem 3. R EFERENCES [1] K. Shanmugam, N. Golrezaei, A. Dimakis, A. Molisch, and G. Caire, “Femtocaching: Wireless content delivery through distributed caching helpers,” Information Theory, IEEE Transactions on, vol. 59, no. 12, pp. 8402–8413, Dec 2013. June 27, 2017 DRAFT 29 [2] J. Li, Y. Chen, Z. Lin, W. Chen, B. Vucetic, and L. Hanzo, “Distributed caching for data dissemination in the downlink of heterogeneous networks,” IEEE Transactions on Communications, vol. 63, no. 10, pp. 3553–3568, Oct 2015. [3] Y. Cui, F. Lai, S. Hanly, and P. Whiting, “Optimal caching and user association in cache-enabled heterogeneous wireless networks,” in Global Communications Conference (GLOBECOM), 2016 IEEE. IEEE, 2016, pp. 1–6. [4] E. Bastuğ, M. Bennis, M. Kountouris, and M. Debbah, “Cache-enabled small cell networks: Modeling and tradeoffs,” EURASIP Journal on Wireless Communications and Networking, 2015. [5] D. Liu and C. Yang, “Cache-enabled heterogeneous cellular networks: Comparison and tradeoffs,” in Communications (ICC), 2016 IEEE International Conference on. IEEE, 2016, pp. 1–6. [6] C. Yang, Y. Yao, Z. Chen, and B. Xia, “Analysis on cache-enabled wireless heterogeneous networks,” Wireless Communications, IEEE Transactions on, vol. 15, no. 1, pp. 131–145, Jan 2016. [7] Z. Chen, J. Lee, T. Q. Quek, and M. Kountouris, “Cooperative caching and transmission design in cluster-centric small cell networks,” IEEE Transactions on Wireless Communications, vol. 16, no. 5, pp. 3401–3415, 2017. [8] S. T. ul Hassan, M. Bennis, P. H. J. Nardelli, and M. Latva-aho, “Caching in wireless small cell networks: A storagebandwidth tradeoff,” IEEE Communications Letters, vol. PP, no. 99, pp. 1–1, 2016. [9] S. Tamoor-ul Hassan, M. Bennis, P. H. Nardelli, and M. Latva-Aho, “Modeling and analysis of content caching in wireless small cell networks,” in Wireless Communication Systems (ISWCS), 2015 International Symposium on. IEEE, 2015, pp. 765–769. [10] J. Zhang, X. Zhang, M. A. Imran, B. Evans, and W. Wang, “Energy efficiency analysis of heterogeneous cache-enabled 5g hyper cellular networks,” in Global Communications Conference (GLOBECOM), 2016 IEEE. IEEE, 2016, pp. 1–6. [11] Y. Chen, M. Ding, J. Li, Z. Lin, G. Mao, and L. Hanzo, “Probabilistic small-cell caching: Performance analysis and optimization,” IEEE Transactions on Vehicular Technology, 2016. [12] W. Wen, Y. Cui, F.-C. Zheng, S. Jin, and Y. Jiang, “Random caching based cooperative transmission in heterogeneous wireless networks,” arXiv preprint arXiv:1701.05761, 2017. [13] K. Li, C. Yang, Z. Chen, and M. Tao, “Optimization and analysis of probabilistic caching in n-tier heterogeneous networks,” arXiv preprint arXiv:1612.04030, 2016. [14] J. Wen, K. Huang, S. Yang, and V. O. Li, “Cache-enabled heterogeneous cellular networks: Optimal tier-level content placement,” arXiv preprint arXiv:1612.05506, 2016. [15] B. Serbetci and J. Goseling, “On optimal geographical caching in heterogeneous cellular networks,” in Wireless Communications and Networking Conference (WCNC), 2017 IEEE. IEEE, 2017, pp. 1–6. [16] Y. Tan, Y. Yuan, T. Yang, Y. Xu, and B. Hu, “Femtocaching in wireless video networks: Distributed framework based on exact potential game,” in Proc. IEEE ICCC. IEEE, 2016, pp. 1–6. [17] H. Kim, J. Park, M. Bennis, S.-L. Kim, and M. Debbah, “Ultra-dense edge caching under spatio-temporal demand and network dynamics,” arXiv preprint arXiv:1703.01038, 2017. [18] J. Li, J. Sun, Y. Qian, F. Shu, M. Xiao, and W. Xiang, “A commercial video-caching system for small-cell cellular networks using game theory,” IEEE Access, vol. 4, pp. 7519–7531, 2016. [19] K. Poularakis, G. Iosifidis, and L. Tassiulas, “A framework for mobile data offloading to leased cache-endowed small cell networks,” in Mobile Ad Hoc and Sensor Systems (MASS), 2014 IEEE 11th International Conference on. IEEE, 2014, pp. 327–335. [20] F. Shen, K. Hamidouche, E. Baştuğ, and M. Debbah, “A stackelberg game for incentive proactive caching mechanisms in wireless networks,” arXiv preprint arXiv:1609.02596, 2016. June 27, 2017 DRAFT 30 [21] Y. Cui and D. Jiang, “Analysis and optimization of caching and multicasting in large-scale cache-enabled heterogeneous wireless networks,” IEEE Trans. Wireless Commun., vol. 16, no. 1, pp. 250–264, 2017. [22] Y. Cui, D. Jiang, and Y. Wu, “Analysis and optimization of caching and multicasting in large-scale cache-enabled wireless networks,” IEEE Trans. Wireless Commun., vol. 15, no. 7, pp. 5101–5112, 2016. [23] M. Razaviyayn, M. Hong, and Z.-Q. Luo, “A unified convergence analysis of block successive minimization methods for nonsmooth optimization,” SIAM J. Optimization, vol. 23, no. 2, pp. 1126–1153, 2013. [24] S. Singh, H. S. Dhillon, and J. G. Andrews, “Offloading in heterogeneous networks: modeling, analysis, and design insights,” IEEE Trans. Wireless Commun., vol. 12, no. 5, pp. 2484–2497, March 2013. [25] J. Andrews, F. Baccelli, and R. Ganti, “A tractable approach to coverage and rate in cellular networks,” Communications, IEEE Transactions on, vol. 59, no. 11, pp. 3122–3134, November 2011. [26] S. H. Chae, J. Y. Ryu, T. Q. Quek, and W. Choi, “Cooperative transmission via caching helpers,” in Global Communications Conference (GLOBECOM), 2015 IEEE. IEEE, 2015, pp. 1–6. [27] S. Singh and J. Andrews, “Joint resource partitioning and offloading in heterogeneous cellular networks,” Wireless Communications, IEEE Transactions on, vol. 13, no. 2, pp. 888–901, Feb 2014. [28] S. M. Yu and S.-L. Kim, “Downlink capacity and base station density in cellular networks,” in Modeling Optimization in Mobile, Ad Hoc Wireless Networks (WiOpt), 2013 11th International Symposium on, May 2013, pp. 119–124. [29] D. P. Bertsekas, Nonlinear programming. Athena scientific Belmont, 1999. [30] G. Scutari, D. Palomar, and S. Barbarossa, “Competitive design of multiuser mimo systems based on game theory: A unified view,” IEEE Journal on Selected Areas in Communications, vol. 26, no. 7, 2008. [31] B. B. Nagaraja and K. G. Nagananda, “Caching with unknown popularity profiles in small cell networks,” in Global Communications Conference (GLOBECOM), 2015 IEEE. IEEE, 2015, pp. 1–6. [32] S. Singh, H. S. Dhillon, and J. G. Andrews, “Offloading in heterogeneous networks: Modeling, analysis, and design insights,” IEEE Transactions on Wireless Communications, vol. 12, no. 5, pp. 2484–2497, 2013. [33] M. J. Osborne and A. Rubinstein, A course in game theory. MIT press, 1994. [34] J. B. Rosen, “Existence and uniqueness of equilibrium points for concave n-person games,” Econometrica: Journal of the Econometric Society, pp. 520–534, 1965. [35] S. Li and T. Başar, “Distributed algorithms for the computation of noncooperative equilibria,” Automatica, vol. 23, no. 4, pp. 523–533, 1987. [36] D. G. Luenberger, Optimization by vector space methods. June 27, 2017 John Wiley & Sons, 1969. DRAFT
7cs.IT
What we talk about when we talk about monads Tomas Petriceka a The Alan Turing Institute, London, UK Abstract Computer science provides an in-depth understanding of technical aspects of programming concepts, but if we want to understand how programming concepts evolve, how programmers think and talk about them and how they are used in practice, we need to consider a broader perspective that includes historical, philosophical and cognitive aspects. In this paper, we develop such broader understanding of monads, a programming concept that has an infamous formal definition, syntactic support in several programming languages and a reputation for being elegant and powerful, but also intimidating and difficult to grasp. This paper is not a monad tutorial. It will not tell you what a monad is. Instead, it helps you understand how computer scientists and programmers talk about monads and why they do so. To answer these questions, we review the history of monads in the context of programming and study the development through the perspectives of philosophy of science, philosophy of mathematics and cognitive sciences. More generally, we present a framework for understanding programming concepts that considers them at three levels: formal, metaphorical and implementation. We base such observations on established results about the scientific method and mathematical entities – cognitive sciences suggest that the metaphors used when thinking about monads are more important than widely accepted, while philosophy of science explains how the research paradigm from which monads originate influences and restricts their use. Finally, we provide evidence for why a broader philosophical, sociological look at programming concepts should be of interest for programmers. It lets us understand programming concepts better and, fundamentally, choose more appropriate abstractions as illustrated in a number of case studies that conclude the paper. ACM CCS 2012 General and reference → Surveys and overviews; Social and professional topics → History of computing; Keywords monad, programming concept, abstraction, philosophy of science, metaphor The Art, Science, and Engineering of Programming Submitted December 1, 2017 Published March 29, 2018 doi 10.22152/programming-journal.org/2018/2/12 © Tomas Petricek This work is licensed under a “CC BY-NC 4.0” license. In The Art, Science, and Engineering of Programming, vol. 2, no. 3, 2018, article 12; 27 pages. What we talk about when we talk about monads 1 Introduction “A monad is just a monoid in the category of endofunctors. What is the problem?” This quote has been intended as a joke [25], but it, surprisingly well, captures the paradoxical nature of how we talk about monads. Monads have a precise and succinct category theoretical definition that formally defines exactly what a monad is. Yet, this definition does not help you understand monads. It does not explain how and why they are useful in programming and, in some cases, excludes use cases that the community considers as monads. The quote also alludes to the belief that formal mathematical treatment of a programming concept leads to an ideal kind of knowledge about programming. Once you know that a monad is a monoid in the category of endofunctors, you know all there is to know. You might want this paper to answer the question “What is a monad?”, but that would make it just another monad tutorial. Instead, I will answer the question you should have asked instead, “What do authors really say when they talk about monads?” The answer situates monads, and writing about monads, within the disciplines of cognitive science, philosophy of science and mathematics. This paper reviews some explanations of monads, but it does not explain monads. Instead, it helps you gain a deeper understanding using a number of important, and often neglected, perspectives. We look at how monads are taught (Section 2) from the perspective of cognitive sciences. This teaches us that metaphors play an important role in understanding monads and are not a kludge employed by bad monad tutorial writers. We review how monads are used in academic literature (Section 3) and use the idea of research paradigms from philosophy of science to explain why some questions are asked and some are ignored. Looking at how monads are used by programmers in practice (Section 4), we trace how the notion of monad evolves. Although the formal definition stays the same, the uses of monads and the intuition behind them shifts and the meaning of a monad changes in a broader socio-technical sense. We briefly consider how monads are talked about in the community of programmers (Section 5). This provides an additional evidence that the narrow technical perspective does not explain why and how monads are used. We conclude by looking at three concrete cases where monads were used in a way that later publications dismissed as incorrect (Section 6). We argue that those could have been prevented if the metaphorical, philosophical and social understanding of monads, presented in this paper, was taken into account. More generally, this paper provides foundations for a broader understanding of programming concepts that integrates formal and technical views with reflections obtained through cognitive sciences and philosophy. We argue that this is important not only to get a more complete understanding, but also for avoiding concrete problems when using programming concepts in practice. 12:2 Tomas Petricek 2 Teaching and understanding monads We start by briefly reviewing how monads are presented in academic literature and programming tutorials. The focus is on exemplifying how authors typically talk about monads, rather than on introducing monads in this paper. The side notes that authors make about monads reveal how monads are understood and the subtle transitions between mathematics and programming hint at the research paradigm in which much of work involving monads is grounded. A typical introduction to monads links the concept to its formal origin. We follow this narrative in the next section and start with category theory. It is worth noting that this is what historians call an “internal history” – a history told within the discipline of computer science. A historian would aim to trace exactly how much influence category theory had on the development of the concept of a monad in programming. In contrast, a computer scientist might emphasize the historical link with category theory as an additional argument for a broader importance of the concept. 2.1 From category theory to programming Monads were introduced by Godement [17] in algebraic topology in 1958. They became referred to as standard construction and triples before Saunders MacLane [34] popularized the name monad and also introduced the phrase “a monad is a monoid in the category of endofunctors”. The following definition of a monad is taken from a paper by Moggi [40] that first used monads in the context of programming languages: Definition 1. A monad over a category C is a triple (T, η, µ) where T : C → C is a functor, η : I d C → T and µ : T 2 → T are natural transformations such that: µA ◦ T µA = µA ◦ µ TA µA ◦ η TA = id TA = µA ◦ T ηA To a reader not familiar with category theory, the definition is very opaque. Understanding the details is not necessary for this paper, but it helps to think of the functor T as a polymorphic type (such as a list), natural transformations η and µ as functions and T 2 as a nested polymorphic type (list of lists of things). It is worth discussing the original context in which the definition appeared. Monads were used to embed an object into an object with a richer structure [1] and also to express many different constructions in terms of the same structure [36]. Both of these are among the motivations for using monads in programming. Moggi [40] used monads in semantics of programming languages to capture many different notions of computation that go beyond total functions, such as nondeterminism, side-effects and exceptions. His paper provides categorical definitions for several monads later used in programming, however, it does not introduce them as programming tools, but rather as proving tools: “This paper is about logics for reasoning about programs, in particular for proving equivalence of programs.” Wadler [57] is the first to use monads as programming tools. Interestingly, similar structure was independently proposed by Spivey [50] without a reference to monads. 12:3 What we talk about when we talk about monads Wadler translates categorical definition to a functional language. A functor becomes a type constructor (operator on types) with a map function and natural transformations become functions. Definition 2. A monad is an operator M on types, together with a triple of functions: map :: (x → y) → (M x → M y) unit :: x → M x join :: M (M x) → M x satisfying the following laws: (1) (2) (3) (4) (5) (6) join ◦ join = join ◦ map join join ◦ unit = id = join ◦ map unit map id = id map (g ◦ f ) = map g ◦ map f map f ◦ join = join ◦ map (map f ) map f ◦ unit = unit ◦ f The natural transformations µ and η are now the join and unit functions, respectively. The first two monad laws (1-2) are direct translation of the laws in Definition 1. The remaining laws (3-6) are properties of natural transformations and so they are made explicit here. The paper translates a number of monad definitions by Moggi into the language of functional programming, links monads with Haskell comprehension syntax and generalizes comprehensions from lists to any monad. We return to the topic of syntax in Section 4. The mapping is very direct, but it ignores the fact that programs are not guaranteed to terminate and so, strictly speaking, the programming language definition of a monad is not a correct category theoretical monad. 2.2 Bridging multiple levels of meaning The early development that established monads as a programming concept hints at one important property of programming concepts that is central to this paper. The meaning of a programming concept such as monad comprises aspects at three different levels. The first is a mathematical aspect that can be used for formal analysis. The second is an implementation of the concept that is used for some purpose in concrete programs or libraries. Finally, the third is a metaphorical or intuitive understanding what the concept is in terms of general examples or analogies. In case of monads this is, for example, the idea that “[monads] take some uninteresting object and turn it into something more structured” [1]. Importing monads from mathematics into program code is also an interesting step philosophically. We use mathematics as a model of programs. To better structure our proofs in the model, we use a certain device provided by mathematicians. This device is then imported back into the programming world – going in the opposite direction than was originally intended when creating formal model of programs. A mathematical monad and a programming monad are related, but they are not the same. In fact, philosophers would say that they are of a different kind [10], the 12:4 Tomas Petricek first being a priori and the second being a posteriori kind of knowledge. Some aspects of what a monad is change as they bridge the gap. Moggi introduced monads for reasoning about effectful programs, but Wadler uses them to implement effectful programs in a purely functional programming language. Even a very direct translation subtly changes the purpose of a monad. Another change is that Moggi used strong monads with an additional operation that is not needed in programming (because of how programming languages handle variables) and so this aspect is omitted when we use monads in programming. 2.3 How programmers talk about monads In programming, an alternative, but equivalent, definition of monads became popular shortly after the original appeared. The following is adapted from Wadler [58]. Definition 3. A monad is a triple (M , unit, >>=) consisting of a type constructor M and two operations of the following types: >>= :: unit :: M x → (x → M y) → M y x → Mx These operations must satisfy the following laws: (1) unit a >>= f = f a (2) m >>= unit = m (3) (m >>= f ) >>= g = m >>= (λx. f x >>= g) The >>= operator is known as bind and was initially written with the first two arguments switched and referred to as ?. The >>= version is easier to program with in Haskell, while ? is easier to explain, so it is worth showing both: ? :: (x → M y) → (M x → M y) >>= :: M x → (x → M y) → M y The ? operation takes a function of type x → M y with monadic output and lifts it into a function M x → M y where both the input and the output are monadic; unit turns a value x into a monadic value M x . Providing a more useful intuition about the meaning of the operations requires using a metaphor, which is what a typical monad tutorial does. We discuss such metaphors in the rest of this section. Note that M is now called a type constructor rather than a functor or operator on types. This is because the definition is now embedded in a language that supports polymorphic (generic) types that are used in the implementation. In a way, this makes the definition more narrow – monads could be encoded in many other ways and could be used in languages without polymorphic types, but the established definition heavily relies on this language feature and static types in general. The programming literature on monads interprets and explains the formal definition either as purely formal or using one of two metaphors. Some authors treat such metaphorical explanations as kludges that are only needed because the concept is difficult to explain otherwise [61]. We argue that this is not the case and the metaphors are an important part of what a monad is. Before explaining why, the rest of this section reviews the three explanations of monads. 12:5 What we talk about when we talk about monads The implementations of bind and unit for a concrete monad can perform a range of different things. Some authors, such as Wadler [58], try to avoid interpreting what the bind and unit operations of a monad represent and only describe concrete examples. This view is akin to formalism as advocated by Curry [7]. According to formalists, mathematical statements have no inherent meaning and are just syntactic forms. Proving a property involves no understanding, but only an application of string transformation rules. However, avoiding interpretation and metaphors might be merely a way of writing – a style preferred by the mathematically oriented part of the programming community. As noted by Bayma in an interview quoted by MacKenzie [35]: Monad as a formalist entity The way mathematicians write and talk are two different things. We write very proper, formal, very abstract. We think informally, intuitively. None of that is in the publication. When we get together we ask, “What does that mean?” (...). This suggests that, treating monad as a formalist entity is only done in writing, but when thinking and talking about monads, even a formalist uses metaphors. In writing, those are left out either for lack of space, or due to the belief that formal mathematics is a more pure, ideal form of knowledge (a topic we revisit in Section 3.2). The first metaphor is to see the monad M a as a container containing values of type a [13]. This is a concrete version of the intuitive understanding in mathematics (Section 2.1) where a monad embeds an object into an object with a richer structure. Using this metaphor, we can explain a number of standard monads: List monad – M a is a list of a values, or a container storing values in the list. Maybe monad – M a either contains a value of type a or is an empty box. Reader monad – M a contains a value of type a together with some other things. Tutorials using this metaphor often use illustrations to intuitively explain what the abstract operations of a monad do [2]. When drawing a box to represent M a, we follow some tutorial authors and draw multiple a values. This gives a useful intuition about the map and join operations, but it can mislead us to think that the container can always contain multiple values – even though the metaphor can also be used for containers that contain exactly one or zero or one values. Monad as a container : a / a map : a / b =⇒ unit join : bind : / aa a a a / b b aa / b b =⇒ aa / b b b b According to the metaphorical explanation, the unit operation takes a value and wraps it in a box. The map operation takes a function that turns a into b and applies it to all things in a box. The join operation takes a box of boxes and unwraps it into a single box containing everything that was previously in the inner boxes. The bind operation is better explained as a combination of map and join. It takes a function that produces a box, applies it to all values in a box and then unwraps the nested boxes. 12:6 Tomas Petricek The second metaphor is to see a monad as a computation [12]. Explanations using this metaphor typically use functions a → M b, although the monadic value M a can itself be seen as a computation. Monadic functions represent computations that are, in some way, non-standard, i.e. not naturally supported by the programming language. This can mean side effects in a pure functional language or asynchronous execution in an impure functional language. An ordinary function type cannot encode such computations and they are, instead, encoded using a data type that has the monadic structure. This way of talking about monads focuses on composition of monadic computations through the bind operation, rather than on explaining what the monad itself represents, so it is complementary to the monad-as-container metaphor. Ordinary functions such as f : a → b and g : b → c can be composed using function composition g ◦ f : a → c . We use bold font face for the type M a and write non-standard computations as as a → b. Note that, the input structure is now incompatible with the output structure, so functions like these cannot be directly composed using ◦. The unit function is a computation a → a that does nothing – it takes a value and returns it in a non-standard way without actually doing anything non-standard. The bind operation transforms a computation so that it can be composed into a bigger non-standard computation. Consider three functions: Monad as a computation f :a→b g : b→c h:c→d The bind operation turns a function with non-standard output into a function that also has a non-standard input and propagates its non-standard aspect. We use the ? version of the bind operation and write f ? for the result of applying bind to f . g? : b → c f :a→b h? : c → d Now the functions have compatible inputs and outputs and so we can compose them using h? ◦ g ? ◦ f to obtain one non-standard computation of type a → d. One of the tutorials that follows this idea [60] makes the metaphor even more concrete and explains computations a → b in terms of railway tracks from the point a to the point b. A non-standard monadic computation is a railway switch, so the three functions can be visually represented as follows. Rather than using bold face, the non-standard computation now has a straight track and a side track: f :a /b ( /c g:b ( • h:c /d ( • • The fact that the railway tracks do not link corresponds to the fact that the functions cannot be composed. The bind operation represents an adapter that transforms a track with a switch into a two-track so that the railway can be composed: f :a /b ( • / g? : b / )/ /c / h? : c /d • / /) • The railway switch is a good metaphor for some of the standard monads: 12:7 What we talk about when we talk about monads Maybe monad (again) – The direct track represents a computation that produces a value, while the side track represents a computation that produced no value. Exception monad – Similar, but the side track now represents a computation that failed and produced an exception instead. Several other monads such as the continuation monad and the resumption monad [20] can also be seen as creating non-standard computation (one that returns asynchronously and one that can be stopped), but are not easily visualized as a railway track. However, for the two common cases where the railway track metaphor fits, it provides an effective way of explaining the concept. 2.4 Metaphors as an inseparable component We typically see metaphors as a literary device. In the context of monad tutorials, they are seen as a kludge that aims to make understanding easier. Some argue [61] that this makes it hard to understand what monads really are and metaphors should be avoided in monad tutorials. However, research in cognitive science suggests the exact opposite. To quote Lakoff and Núñez [31]: One of the principal results in cognitive science is that abstract concepts are typically understood, via metaphor, in terms of more concrete concepts. In other words, mathematical ideas are often grounded in everyday experience and metaphors link the everyday experience with more abstract concepts. Moreover, most thought is unconscious and inaccessible to introspection, so we are not directly aware that we are thinking in terms of metaphors. One way to discover the metaphors behind our understanding is to look at the language we use to talk about abstract concepts [30]. This is also the case for monads. For example, the following are common phrases used when discussing monads: “In a monad” or “wrapped in a monad” is used to talk about the parameter a of a generic type M a. This is the language we use for the container metaphor. The unit operation is also called return, suggesting the computation metaphor – the operation creates a computation that does nothing and returns the value. The name of the bind operation is also significant as it suggests let binding which is used for sequencing computations. The bind operation serves similar purpose when we think of monads as non-standard computations. In summary, the two common metaphors used when explaining monads are more than just two concrete examples that are useful for understanding what a monad is. They are an inherent part of what a monad is to a programmer – both consciously and unconsciously. They provide a concrete concept, with attached everyday experience, that lets us think about monads via cognitive metaphors. Even a pure formalist treatment of monads – as syntactic forms with no inherent meaning that are manipulated through string operations – can be understood in terms of metaphors. The hidden metaphor is movement. When we say, “in the next step [of a proof]”, we are expressing ourselves as if we were talking about moving along a path. 12:8 Tomas Petricek 3 Using monads in programming research Since their introduction into programming language research, monads became a popular tool in academic work on programming language theory and in programming practice. We return to programming practice in the next section (Section 4) and briefly discuss how are monads treated in academic literature. 3.1 Reasoning about programs using monads We do not aim to present a comprehensive literature review. Instead, we look at one particular aspect of monads, namely the monad laws. Those were mentioned by the definitions in Section 2, but where do they come from? Are they the right ones and what does it mean for the laws to be right? And what does the treatment of monad laws reveal about how we think about programming and computer science? Algebraic laws about programming language constructs, such as those introduced by Hoare [21], are typically motivated by the aim to prove certain properties. If we have two programs that should intuitively be the same, we define a law that formalizes this requirement. For example, we might intuitively expect that if b then p else p has the same meaning as p and introduce the equality as a law [22]. Monad laws are not motivated by intuition about programs, but are, instead, imported from the category theoretical definition. The laws do not appear obvious when expressed in terms of bind and unit. They are better understood in terms of composition of monadic computations (following our second metaphor). Given monadic computations f : a → M b and g : b → M c , we define a monadic composition ˆ f : a → M c as λx. f x >>= g . The laws then guarantee the following properties: g◦ Origins of monad laws ˆ (g ◦ ˆ h) = ( f ◦ ˆ g) ◦ ˆh f ◦ ˆ f = f = f ◦ ˆ unit unit ◦ Those are the laws of a monoid and they guarantee that “a monad is a monoid in the category of endofunctors”. However, this is not how monad laws are presented in the programming context and so they may appear somewhat ad-hoc. Even though they do not originate from intuition about programs, monad laws are unanimously accepted by the programming community. In contrast, various extensions of monads [41, 45] usually motivate the laws by programming intuition, but there is often little agreement on the laws. The best example is the MonadPlus extension that adds an operation of type M a → M a → M a. There are at least two suggested sets of laws based on two different intuitions about the operation [14, 54]. Using monads for reasoning about programs was the original motivation by Moggi [40], but the immediate follow-up work used monads in a different way. Monad laws have later been used, as originally intended, for reasoning about programs with effects. For example, Gibbons and Hinze [15] use monad laws, together with laws about concrete monads, to reason about programs involving non-determinism, state and exceptions. Reasoning with monad laws 12:9 What we talk about when we talk about monads However, using monad laws to prove program properties is less ubiquitous than the early work might suggest. More often, papers that refer to monads define a library for a concrete problem such as parsing, concurrency or parallelism [4, 24, 37] that fits the monad structure and satisfies the laws. Such papers often include a reference to monads in their titles, but their novelty is in solving a concrete programming problem. It appears that monad laws matter less than the early work envisioned. Monad tutorials say that the purpose of the laws is to enable reasoning, but they rarely demonstrate such reasoning with a concrete example. There are also no programming tools offering, for example, refactoring of programs based on monad laws. There are refactoring tools that use monads [33] and that introduce monads [9], but not tools that are directly enabled by the monad laws. The use of monads for program reasoning remains a theme for an academic community that monads have since outgrown. 3.2 Monads and research paradigms An established philosophy of science idea is that scientific research is grounded in a research paradigm [27] which provides a framework within which normal science is done. This includes methods of inquiry and the kind of questions that can be asked. At a smaller scale, research programme [29] is shared by a part of the community. How and what we study using monads reveals the implicit assumptions of our current programming language research paradigm. In computer science, monads are rooted in a research programme that aims to “utilize the resources of logic to increase the confidence (...) in the correctness of a program”. Following Priestley [48], we refer to this as the Algol research programme. Using monads is a way of subscribing to a certain research programme. The aforementioned papers that solve parsing, concurrency or parallelism problems [4, 24, 37] could treat monads merely as an unimportant implementation artifact, but monads are an accepted tool of the research programme and so a solution based on monads is often preferred. In Section 6, we will see that this may be problematic. One of the core assumptions of the Algol research programme is that mathematics provides a fundamental source of knowledge about programming. This is what makes category theory a valid source of laws, even though the container and computation metaphors might suggest different laws.1 Monad tutorials also follow the Algol research programme and introduce monad laws even if they do not use them later. Equally interesting are questions that are rarely asked. In practice, many programmers struggle to understand monads because of their abstract nature. Some authors discuss how we could explain monads better, but the question whether it is desirable to use a monad (as opposed to a concrete notion) is often neglected. The assumption that abstraction is desirable is another part of the Algol research programme. Similarly, there are only few papers discussing syntax for using monads [16, 46] and those focus on formal properties of the notation, rather than on its cognitive aspects [3]. 1 For example, things stored in a container are not ordered, so we could argue that monadic bind should be commutative (i.e. a >>= λx.b >>= λ y. f x y = b >>= λ y.a >>= λx. f x y ). 12:10 Tomas Petricek 4 Using monads in programming practice In computer science research, uses of monads keep relatively close to their formal definition and their original purpose. In programming practice, some uses are also straightforward application of the original definitions, albeit not for reasoning but for implementing. Other uses stretch the original concept in new interesting ways. In this section, we look at some of the uses that are further away from the original definition. Those examples illustrate how programming concepts evolve. The monad of 2017 is not the same as the monad that was introduced into programming more than a quarter of a century ago. This is not because monads are used incorrectly, but because such evolution is a normal part of the life of programming concepts. 4.1 Monads in programming languages Moggi [40] realized that monads provide a common structure for talking about a number of notions of computations involving, among others, state, exceptions and non-determinism. This means that some reasoning about programs can be done just using the common monadic structure, but reasoning about concrete effects still needs to involve the concrete notion of computation. Translated to programming, monads were used to encode different notions of computations and the common structure allows code reuse. However, monads also became popular for sequencing computations and syntactic support for writing code using monads opened yet another direction. The first practical use of monads is for code reuse. In Haskell and other languages with higher-kinded types [59], it is possible to write code that works for any monad, provided that the implementation needs only unit and bind, written as return and >>=, respectively. For example: Code reuse mapM :: Monad m ⇒ (a → m b) → [a] → m [b] mapM f x = loop x [] where loop [] acc = return (reverse acc) loop (x : xs) acc = f x >>= λ y. loop xs ( y : acc) The function takes a list of values [a] and a function that returns mb for each value of a. It applies this function to all list elements and concatenates the results, composing individual monadic values using >>=. An interesting aspect of the code is that we know very little about what the function does for a concrete monad, to the extent that the name mapM may not be appropriate in a more specific context. It is also difficult to describe the function behavior without a reference to a concrete metaphor for thinking about monads – the above description achieves this, but at the cost of clarity. More natural description might say that the function a → mb returns a value wrapped in a monad (using the container metaphor) or that mapM composes monadic computations sequentially (using the computation metaphor). The metaphors are almost necessary to talk about the code. 12:11 What we talk about when we talk about monads The embedding of monads in Haskell can be used to define an order of evaluation (in an otherwise lazy language). This aspect has been utilized by the IO monad [47] to allow imperative programming and working with input/output. This also inspired the ‘do’ notation for working with monads in Haskell: Sequencing effects main :: IO () main = do putStr ”What is your name?” n ← readLn putStr (”Hello ” ++ n) The ‘do’ notation (which has been described in academic literature only after becoming widely used) is a simple syntactic sugar that allows writing a sequence of operations and inserts monadic bind >>= at appropriate places to ensure sequencing. The ‘do’ notation can be used with any monad, but it is closely linked with the metaphor that treats monads as computations. It has been criticized for making functional code look as imperative and also for making monadic style of programming preferable for syntactic reasons [5]. It is worth noting that the IO monad is, arguably, not a monad [42] in the sense that it is impossible to say whether it satisfies the monad laws. Without going into the full detail, the problem is that IO is an abstract data type (defined externally) and does not have a clear semantics for equality. The IO monad pioneered the use of monads for writing non-standard computations. In case of IO, the non-standard aspect is that the computation can perform effects, which is normally not possible in Haskell. Other languages introduced other kinds of non-standard computations. For example, F# computation expressions [46], a mechanism similar to the ‘do‘ notation has been introduced in order to simplify writing of asynchronous computations [52]. The nonstandard aspect here is that the computation can perform asynchronous I/O without blocking the current thread. For example: Non-standard computations let getLength url = async { try let! html = downloadAsync url return html.Length with e → return 0 } The let! construct is similar to ← in the ‘do’ notation and return is a keyword for the unit operation, but the computation expression syntax takes the idea of defining non-standard computations based on monads further in two ways. First, if we ignore the async {. . .} block and replace let! with let, then the code is ordinary synchronous F#. Rather than being a new notation for sequencing computations, the notation lifts ordinary F# computation into a non-standard one. Second, the try block (for exception handling) is an example of a keyword that can be exposed by providing additional operations beyond unit and bind. Monads are still an essential 12:12 Tomas Petricek part of the feature, but F# stretches into yet another direction. Unlike Haskell, F# also does not have an abstraction capturing monads in general (such as the Monad type class), but instead requires developers to define concrete computation builderes such as async {. . .} for each concrete monad they intend to use. In a way, monads exist in the F# specification, but not as a first-class language entity. Another instance of using monads to embed non-standard computations into a programming language is LINQ in C# and VB.Net [39]. The syntax used by LINQ is more akin to SQL. Like F#, it offers more keywords enabled by providing additional operations. Curiously enough, the unit operation is often ignored when talking about LINQ because it has no special syntax. Both Haskell ‘do’ notation and F# computation expressions are syntactic sugar, introduced primarily to provide nicer syntax when using monadic abstractions. Yet, in both languages, the notation can be, and has been, used by libraries that share little with the original monadic structure. For example, the Blaze library [49] allows users to compose HTML using the ‘do’ notation: Syntactic sugar sayHello :: String → Html sayHello name = H.body $ do H.h1 ”Welcome” H.p (”Hello ” ++ name) Here, the computation constructs a Html value and the ‘do’ notation is used just to concatenate multiple HTML elements. The Html type is not a generic type M a as required by the monad structure and it lacks the bind operation. A new version of the library later appeared that changes the structure to provide the monadic interface, not because the library did not work well, but to allow composition with other monads. The example shows that syntactic sugar originally designed for monads can later be used in a way that has very little to do with the original idea. In the next section, we briefly reflect on the evolution illustrated by this and the previous examples. 4.2 How programming concepts evolve Mathematical concepts such as polyhedron or function may appear timeless, but if we look at their history, it turns out that they evolve and definitions change to accommodate or exclude corner cases and newly discovered instances. Lakatos [28] demonstrates the process in mathematics using polyhedra and Euler’s formula (V − E + F = 2) that relates the number of vertices (V ), edges ( E ) and faces ( F ) of a polyhedron. The history of the formula is a process of proofs and refutations. A counter example that does not satisfy the formula (such as a polyhedron with a tunnel) is used to revise the definition in order to recover the proof. The path from category theoretical structure to a programming construct documented in Section 2 and Section 4.1 shows that programming concepts, such as monads, undergo a similar development. There is one interesting difference from mathematics though. In mathematics, the evolution is driven by aims to prove or disprove properties of an entity. In programming, there is a multitude of driving forces 12:13 What we talk about when we talk about monads including formal proofs using a mathematical model, the appearance of different implementations in various programming languages and also shifts in what metaphors are used to think and talk about the concept. More generally, the meaning of a programming language concept is constituted at three interlinked levels. For monads, the three levels provide the following: Formal level. A monad has a category theoretic definition. This is used in proofs, such as when reasoning about monadic code [15], but it also interacts with the two other levels. Examples used at the formal level contribute to the metaphorical understanding of what monads are, often because formal examples are shorter. Properties that hold at the formal level can also influence the implementation level, for example, when we show that a monad defined using bind is equivalent to a monad defined using join and map. Implementation level. Monads have been implemented as a type class definition (in Haskell), syntactic sugar (in F# and LINQ) and as libraries in many other languages. Unlike with Lakatos’ polyhedra, the uses that do not fit the formal definition have not (yet?) led to a revision of the definition, but monad comprehensions [16] led to a new way of syntactic reasoning about queries at the formal level [18]. The ‘do’ notation introduced the idea of understanding monads as computations and the F# implementation of the Maybe monad led to the development of the powerful railway track metaphor (Section 2.4). Metaphorical level. The influence of the metaphorical level is more difficult to trace as it is rarely documented in writing. However, thinking of monads as computations is likely the reason why most formal definitions now prefer bind over map and join (the former is more convenient for programming, but the latter is simpler for proving). Similarly, thinking of monads more generally as non-standard computations likely contributed to their introduction in F# [46]. As an impure language, F# does not need monads for implementing state or exceptions, but they become useful for asynchronous computations [52]. As discussed in Section 3, monads are rooted in the mathematical Algol research programme and so it is perhaps not surprising that the core of the evolution stays around the original formal definition. However, we can see that the concept develops. Monads turn from a formal entity inhabiting the mathematical world into the physical world of programs. This changes their purpose from reasoning to implementing. As new ways of thinking about monads appear, they become useful for solving new kinds of programming problems. This then leads to development of mathematical tools for using monads as a syntactic entity rather than category theoretical notion. The three different levels exist for other programming concepts including types, functions, processes or objects, but they interact differently. For example, several papers analyze the concept of type [26, 38, 44]. Using our three-level framework, the analyses suggest that types appeared independently at the formal and implementation levels [26], influenced by the ordinary English-language interpretation of the word ‘type’ [38] at the metaphorical level. Their implementation enabled features such as auto-completion [44], which then had effects on both formal (new kinds of reasoning) and metaphorical (types as real-world entities) levels. 12:14 Tomas Petricek 5 Monads and the programming community In the previous section, we describe the meaning of monads at three different levels: formal, implementation and metaphorical. In this section, we briefly consider one additional aspect – the social side of monads. The main focus of this paper is on the three aforementioned levels of meaning, but we find it necessary to briefly explore the social side, as it asks important questions and offers additional references for the discussion of arguably questionable uses of monads in Section 6. 5.1 Monads are just monoids in the category of endofunctors The opening quote of the paper is interesting for one more reason not mentioned before. “A monad is just a monoid in the category of endofunctors. What is the problem?” has become a cultural artifact of the programming language community. Search for the quote online and you can buy t-shirts and coffee mugs with it. Interestingly, the quote means two exactly opposite things to two groups of people. For some, it embodies the elegance of the structure. A simple category theoretical definition leads to a programming construct that is useful in practice. For others, it symbolizes the elitism of incomprehensible “ivory tower” approach to programming. Learning monads and writing a monad tutorial or writing a talk on monads has also become an important milestone in learning about theory of functional programming. This is illustrated by the growing number of monad tutorials recorded on the Haskell Wiki [6], although the list is now largely incomplete. Learning monads seems to have an aspect of what anthropologists call a rite of passage. 5.2 Sociology of monads To shed some light on the social and cultural importance of monads, we consider two points made about science and mathematics. As noted in Section 3, any science is grounded in a certain research programme that provides a number of basic assumptions that proponents of the research programme do not question. As a developer familiar with imperative programming who is learning pure functional languages, you need to change some of your basic assumptions about programming. The initial step is not, and cannot be, a rational process. We need to accept a different way of thinking and only then we can use rational reasoning to explore what follows from the assumptions. Feyerabend [11] looks at this change, analysing how old interpretations, which contradict new theory, are changed to allow the new theory to be accepted: The offensive interpretations are replaced by others, [using tactics in which] propaganda and appeal to distant, and highly theoretical, parts of common sense are used to defuse old habits and to enthrone new ones. As a concrete case, consider using input and output with and without monads. Initially, using monads will certainly appear cumbersome to the uninitiated. When explaining a monadic “Hello world” program, one needs to appeal to more distant benefits of monads. Some of those benefits may be practical, such as those discussed in Section 4.1, 12:15 What we talk about when we talk about monads but the mathematical roots of monads provide another appealing argument on its own. As noted by Hacking [19] who discusses experimentalism in sciences such as physics, “we find prejudices in favor of theory, as far back as there is institutionalized science”. The simple fact that monads are rooted in category theory may be a factor that contributes to their popularity and social attractivity. A concrete mechanism of how this works has been described by Lakoff and Núñez [31]. Their cognitive science research looks at how abstract mathematical ideas arise from everyday embodied experience. This contrasts with what they call The Romance of Mathematics—a belief that mathematics is an objective feature of the universe that leads to the impression that “mathematicians are the ultimate scientists, discovering absolute truths, not just about the physical universe, but about any possible universe”: The Romance of Mathematics makes a wonderful story. (...) It has attracted generations of young people to mathematics. [We want to believe] that, at least in doing mathematics, we can be rational, logical, and certain of our conclusions. But sadly, for the most part, it is not a true story. Just like attracting generations of young people to mathematics, The Romance of Mathematics attracts people to the mathematically rooted approach to programming. However, Lakoff and Núñez also describe some of the negative effects of The Romance of Mathematics. It contributes to a culture that “rewards incomprehensibility, in which it is the norm to write only for an audience of the initiated” [31] and it leads to “alienation of other educated people from mathematics” [31]. The aforementioned slogan about monads certainly fits this description. The audience of initiated sees it as elegant, while it causes an alienation of the educated, but uninitiated audience. 6 Undesirable uses of monads What was said so far in this paper might be of interest as a philosophical and historical analysis of an influential concept in programming languages, but there were no takeaways for practical programming or computer science research. The aim of this section is to change that. Despite the fact that negative results are rarely reported in academic literature, there are a number of cases where monads were used in an academic paper and their use was later revised or avoided. In this section, we review three such cases. For each of them, we suggest that treating monads in a more comprehensive way and considering the formal, implementation and metaphorical level could have prevented the undesirable use of monads. 6.1 Structuring the semantics of dataflow languages The first case we consider is the use of monads for giving the semantics of dataflow programming languages such as Lucid. In dataflow programming, programs are written as computations over streams. For example (x + prev x)/2 creates a stream where each value is calculated as the average between the current and the previous value of the stream represented by the variable x . 12:16 Tomas Petricek Orchard [43] discusses the history of the semantics of dataflow programming languages which was first written using monads and later revisited using comonads, category theoretical dual of monads: In 1995, Wadge proposed that the semantics of the dataflow language Lucid, which can be understood as an equational language for infinite streams, could be structured by a monad [56]. Ten years later, Uustalu and Vene gave a semantics for Lucid in terms of a comonad, and stated that “notions of dataflow cannot be structured with monads” [55]. There is an apparent conflict, which raises a number of questions. To summarize Orchard’s account, a stream Stream a can be seen as an (infinite) sequence of a values. The monadic semantics of the above expression (x + prev x)/2 is a function of type Stream a → Stream a, i.e. a function that takes a stream as an input and produces stream as an output. The core of the argument against using monads in this case is that monadic computations (as we’ve seen in Section 2.3) are structured as functions of type a → M b and the monad provides the essential operation that lifts those into composable functions M a → M b. In case of monadic semantics of Lucid, we already construct composable functions of the shape M a → M b ourselves. The operations of a monad are not used to provide plumbing for composition, but instead, they are used to give semantics of some of the Lucid operations. For example, consider the latest operation: History of dataflow semantics latest : Stream (Stream a) → Stream a The operation takes a stream of streams and produces a new stream that returns the current value of the current stream at each point in time. The first value will be the first value of the first stream, the second value will be the second value of the second stream, etc. This is a useful Lucid combinator and it has the same type as monadic join. However, unlike other uses of monads we have seen, such join operation does not provide a way of composing computations (in category theoretical terms, the computation is not captured by a Kleisli morphism). This has a number of consequences, as noted by Orchard [43]: A computation solely captured by Kleisli (...) morphisms benefits from equational laws for reasoning and optimization by simplification, as well as better syntactic support in languages. Such benefits are not available for [morphisms that do not follow this structure]. The solution proposed by Uustalu and Vene [55] is to structure the semantics using a comonad that provides a way of composing computations of type C a → b. This fits with dataflow programming, because we can structure many operations as functions Stream a → b that takes a stream (with current value and history) and computes the new current value. Does the discussion in this paper provide any hint that the use of monads for the semantics of dataflow is not desirable? The use of monads seems appropriate at the implementation level – we can define operations of the appropriate type and use them for writing dataflow programs. However, potential issues become apparent when we consider the formal and metaphorical level. Rethinking the use of monads 12:17 What we talk about when we talk about monads The formal aspects have been analyzed in detail by Orchard [43]. Although we can define a monad, the way we use it is not suitable for formal reasoning using Kleisli arrows. At the metaphorical level, a function of type a → Stream b can be seen as a producer of a stream, but not as a dataflow computation itself. We can see Stream a as a container (containing present and past values), but the latest operation cannot be easily interpreted as “unwrapping” a nested container; latest must throw away some values, which is not the case when unwrapping a nested container. 6.2 Parsers and a tempting abstraction The second case we consider is the use of monads in parsing. The early work on parser combinators [23] notes that there is a relationship with monads. Parsers were also mentioned by Wadler [57] and more work on monadic parsing soon followed [24]. A parser Parser a is a function String → (a, String) that takes an input string and returns a parsed value of type a together with the remaining unconsumed input. Parser combinators provide ways of combining parsers. We can define a choice combinator of type Parser a → Parser a → Parser a that takes two parsers and returns a new parser that succeeds if either of the two parsers succeed. Interestingly enough, it is also possible to provide the following two combinators: Understanding monadic parsers bind :: Parser a → (a → Parser b) → Parser b unit :: a → Parser a The unit operation creates a parser that always succeeds without consuming any input. The bind operation creates a parser that applies the first parser and, if it succeeds and produces a value of type a, calls the function to construct a parser to parse the rest of the input. This implements the monadic interface and so it becomes possible to use parsers with the ‘do’ notation. Swierstra and Duponcheel [51] later noted that the monadic parsers have several drawbacks and developed a way of fixing those: The normal disadvantages of conventional [monadic] parsers, such as their lack of speed and their poor error reporting are remedied. Their new approach provides an efficient implementation with better error reporting, but it cannot define the bind operation and thus is not monadic: The techniques [do not] extend to monad-based parsers. [T]he monadic formulation [causes] the evaluation of the parser construction over and over (...). One of the problems is that the parser needs to repeatedly call the function a → Parser b to construct a parser. This also means that the parser for the second part of the input is only known after parsing the first part of the input. For context-free grammars, this is not necessary as the structure of the parser does not depend on the parsed values. Swierstra and Duponcheel replace the bind operation with an operation of type Parser a → Parser b → Parser(a × b) which sequentially composes two parsers. Here, the second parser does not depend on the result of the first one and the combinator can be implemented more efficiently. It is tempting to implement the monadic interface for parsers, because it is well-defined and relatively easy to provide, but this makes it impossible to discover a more efficient implementation of parser combinators. 12:18 Tomas Petricek How could the understanding of cognitive and social aspects of monads prevente the undesirable use of monads in this case? There are two possible answers. First, the social side of monads explains why monads are a tool that one might want to use without considering whether it is needed. The bind combinator in the early papers was not necessarily useful, but it was implemented nevertheless, to show that parsers form a monad. Thus, being aware of the Algol research programme might make us reconsider whether bind provides merely an interesting result at the formal level, or whether it is genuinely useful at the implementation level. Second, we could imagine an understanding of monads that more strongly emphasizes the metaphorical level. Many of the standard, widely used monads fit one of the two metaphors we introduced in Section 2.4, but it is not obvious how to interpret parsers as either containers or as non-standard computations (or railway tracks). As noted earlier, the metaphors are not just useful for teaching. They capture the well-understood and tested use cases of monads. Rethinking the use of monads 6.3 Monad as the uninteresting part The last case of controversy about monads in computer science literature that we consider in this paper is the use of monads for concurrent and parallel programming. An example of work in this area is the Par monad [37]. The paper introduces a type Par a that represents a computation which may involve running work in parallel. The Par monad represents a computation, so it fits with one of the monad metaphors. It also implements both of the operations required by a monad and the implementation satisfied the required laws: Understanding parallel computations bind :: Par a → (a → Par b) → Par b unit :: a → Par a The unit operation creates a computation that immediately returns the given value. The bind operation sequentially composes the first computation with the one generated by the given function. An objection against using monad in this case is not that it is inappropriate, but that it is the least interesting thing about the abstraction. Monad provides a way of sequentially composing computations, but what really matters about Par a is what kind of parallelism and synchronization primitives it provides (forking and write-once shared variables). The title of the paper, “A monad for deterministic parallelism” [37] might suggest that a monad is used for deterministic parallelism, but the parts of the abstraction that provide parallelism are everything except for the monadic part, which is there to allow sequential composition. At the metaphorical level, we can see that the Par monad is a computation and we can also understand that sequencing is the least interesting part. The main purpose of the Par monad is to synchronize the complex system of railway tracks, rather than link them. This idea has been captured, for example, by the work on joinads [45], which extends monads (and the MonadPlus type class [54]) with the following operations: Rethinking the use of monads 12:19 What we talk about when we talk about monads merge :: m a → m b → m (a, b) choose :: m a → m a → m a The two operations provide additional way in which computations, or railway tracks, can be composed; merge joins two computations and returns a pair with both individual results and choose implements a non-deterministic choice. Why is the rhetorical focus of the paper about the Par type on the monadic abstraction? This is, most likely, the result of the social side of monads. They are a topic of interest for the community (Section 5) and they became a key tool of the purely functional research programme (Section 3.2). 7 A case for wider understanding This paper looks at the programming concept of a monad from a wider, historical, philosophical and cognitive perspective. The method we use is to consider the meaning of a programming concept at three different levels: the formal level used for proving mathematical properties about the concept, the implementation level at which concepts are used for writing concrete code and the metaphorical level which is used for intuitive thinking and explaining the concept. 7.1 Future and related work The idea of treating programming concepts as entities consisting of multiple levels is not new. Turner and Angius [53] treat programs as technical artifacts with two levels, one is a specification and function and the other is an implementation. Our analysis differs in that we look at programming concepts rather than programs as a whole and we separate the formal and intuitive aspects of the specification. We briefly hinted how similar analysis might apply to other programming concepts such as types in Section 4.2, but we believe that doing an in-depth analysis of a number of other concepts can help us better understand how programming concepts evolve in general. For example, looking at types suggests that the interaction pattern between the three levels that we uncovered for monads is just one particular kind. The other interesting problem is finding good ways of analysing individual levels. Theoretical computer science provides a rich set of resources for looking at the formal level. We also have ways of talking about the implementation level, but often do so indirectly via the formal level. For the metaphorical level, this paper referred to relevant work in cognitive sciences, but we believe there is much left to be done in understanding how we use metaphors when programming. There are also numerous uses of monads that we were not able to cover in this paper such as the link between monads and aspect-oriented programming [8, 32]. This relationship might provide yet another metaphor for thinking about monads that is perhaps equally interesting as the two metaphors, containers and computations, presented in this paper. 12:20 Tomas Petricek 7.2 Summary – What is a monad? The short answer to the question “What is a monad?” is that it is a monoid in the category of endofunctors or that it is a generic data type equipped with two operations that satisfy certain laws. This is correct, but it does not reveal an important bigger picture. This is because the question is wrong. In this paper, we aim to answer the right question, which is “What do authors really say when they talk about monads?” Our answer situates monads within the disciplines of cognitive science, philosophy of science and mathematics. We looked at the metaphors that are used when teaching monads and discussed why these should be seen as an inherent part of the answer. We looked at how monads are used in academic research and in practice. This illustrates how programming concepts evolve and reveals interactions between the formal, implementation and metaphorical levels. In the case of monads, the formal definition remains stable, but our intuitive understanding of the concept and how we use it in programming changes over time. Finally, we discussed why such broader understanding of programming concepts such as monads is useful. We looked at a number of cases, documented in the literature, where a monad was used in a way that was revised in later work. For each case, we suggested that a broader understanding of monads could help the original authors to avoid the issues discovered later. The anonymous reviewers provided fantastic feedback that helped me to better frame the paper and significantly improve many of the important sections. I would like to thank to fellow members of the Revolution & Beers Cambridge group, namely Dominic Orchard, Sam Aaron, Antranig Basman and Stephen Kell. I would also like to thank to Giacomo Citi for a QuickCheck reference and Torsten Grust for numerous corrections. This work was in part supported by The Alan Turing Institute under the EPSRC grant EP/N510129/1. Acknowledgements References [1] Carsen Berger. On some aspects of the theory of monads. Online at http://www. math.uchicago.edu/~may/VIGRE/VIGRE2011/REUPapers/Berger.pdf (last accessed 27 March 2018). 2011. [2] Aditya Bhargava. Functors, applicatives, and monads in pictures. Online at http: //adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html (last accessed 27 March 2018). 2013. [3] Alan Blackwell and Thomas Green. “Notational systems–the cognitive dimensions of notations framework”. In: HCI models, theories, and frameworks: toward an interdisciplinary science. Morgan Kaufmann (2003). doi: 10.1016/B978155860808-5/50005-8. 12:21 What we talk about when we talk about monads [4] Koen Claessen. “A Poor Man’s Concurrency Monad”. In: Journal of Functional Programming 9.3 (May 1999), pages 313–323. issn: 0956-7968. doi: 10.1017/ S0956796899003342. [5] The Haskell Wiki Community. Do notation considered harmful. Online at https: //wiki.haskell.org/Do_notation_considered_harmful (last accessed 27 March 2018). 2017. [6] The Haskell Wiki Community. Monad tutorials timeline. Online at https://wiki. haskell.org/Monad_tutorials_timeline (last accessed 27 March 2018). 2017. [7] Haskell Brooks Curry. Outlines of a formalist philosophy of mathematics. Volume 3. Elsevier, 1951. doi: 10.1111/j.1746-8361.1953.tb01104.x. [8] Wolfgang De Meuter. “Monads as a theoretical foundation for AOP”. In: International Workshop on Aspect-Oriented Programming at European Conference on Object-Oriented Programming. Volume 97. Springer, 1997. [9] Martin Erwig and Deling Ren. “Monadification of functional programs”. In: Science of Computer Programming 52 (2004), pages 101–129. doi: 10.1016/j.scico. 2004.03.004. [10] James H. Fetzer. “Program verification: the very idea”. In: Communications of the ACM 31.9 (Sept. 1988), pages 1048–1063. issn: 0001-0782. doi: 10.1145/ 48529.48530. [11] Paul Feyerabend. Against Method. Verso, 1993. isbn: 978-0-86091-646-8. [12] Cale Gibbard. Monads as computation. Online at https : / / wiki . haskell . org / Monads_as_computation (last accessed 27 March 2018). 2017. [13] Cale Gibbard. Monads as containers. Online at https://wiki.haskell.org/Monads_ as_containers (last accessed 27 March 2018). 2017. [14] Jeremy Gibbons. “Comprehending ringads”. In: A List of Successes That Can Change the World. Springer, 2016, pages 132–151. doi: 10.1007/978-3-319-309361_7. [15] Jeremy Gibbons and Ralf Hinze. “Just Do It: Simple Monadic Equational Reasoning”. In: Proceedings of the 16th ACM SIGPLAN International Conference on Functional Programming. ICFP ’11. Tokyo, Japan: ACM, 2011, pages 2–14. isbn: 978-1-4503-0865-6. doi: 10.1145/2034773.2034777. [16] George Giorgidze, Torsten Grust, Nils Schweinsberg, and Jeroen Weijers. “Bringing Back Monad Comprehensions”. In: Proceedings of the 4th ACM Symposium on Haskell. Haskell ’11. Tokyo, Japan: ACM, 2011, pages 13–22. isbn: 978-1-45030860-1. doi: 10.1145/2034675.2034678. [17] Roger Godement. Topologie algébrique et théorie des faisceaux. Volume 13. Hermann Paris, 1958. isbn: 978-2-7056-1252-8. [18] Torsten Grust. “Monad comprehensions: a versatile representation for queries”. In: The Functional Approach to Data Management. Springer, 2004, pages 288–311. doi: 10.1007/978-3-662-05372-0_12. 12:22 Tomas Petricek [19] Ian Hacking. Representing and intervening: introductory topics in the philosophy of natural science. Cambridge University Press, 1983. isbn: 978-1-107-26815-9. [20] William L. Harrison. “The essence of multitasking”. In: Proceedings of the 11th International Conference on Algebraic Methodology and Software Technology. AMAST’06. Springer-Verlag, 2006, pages 158–172. isbn: 3-540-35633-9. doi: 10.1007/11784180_14. [21] Charles Antony Richard Hoare. “An axiomatic basis for computer programming”. In: Communications of the ACM 12.10 (Oct. 1969), pages 576–580. issn: 0001-0782. doi: 10.1145/363235.363259. [22] Charles Antony Richard Hoare, Ian J. Hayes, He Jifeng, Carol C Morgan, A William Roscoe, Jeff W. Sanders, I Holm Sorensen, J. Michael Spivey, and Bernard A Sufrin. “Laws of programming”. In: Communications of the ACM 30.8 (1987), pages 672–686. doi: 10.1145/27651.27653. [23] Graham Hutton. “Higher-order functions for parsing”. In: Journal of functional programming 2.3 (1992), pages 323–343. doi: 10.1017/S0956796800000411. [24] Graham Hutton and Erik Meijer. “Monadic parser combinators”. In: NOTTCSTR-96-4 (1996). Available at http://eprints.nottingham.ac.uk/237/1/monparsing. pdf (last accessed 27 March 2018). [25] James Iry. A brief, incomplete, and mostly wrong history of programming languages. Online at http://james-iry.blogspot.co.uk/2009/05/brief-incompleteand-mostly-wrong.html (last accessed 27 March 2018). 2009. [26] Stephen Kell. “In search of types”. In: Proceedings of the 2014 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming & Software (Onward! 2014). ACM. 2014, pages 227–241. doi: 10.1145/2661136. 2661154. [27] Thomas S. Kuhn. The structure of scientific revolutions. Chicago: University of Chicago Press, 1970. isbn: 0-226-45812-1. [28] Imre Lakatos. Proofs and Refutations: The Logic of Mathematical Discovery. Cambridge philosophy classics. Cambridge University Press, 1976. isbn: 978-0521-29038-8. [29] Imre Lakatos. The methodology of scientific research programmes. Cambridge: Cambridge University Press, 1978. isbn: 978-0-521-28031-0. [30] George Lakoff and Mark Johnson. Metaphors We Live By. The University of Chicago Press, 1980. isbn: 978-0-226-46800-6. [31] George Lakoff and Rafael E Núñez. Where mathematics comes from: How the embodied mind brings mathematics into being. Basic Books, 2000. isbn: 978-0465-03771-1. [32] Ralf Lämmel. “Adding superimposition to a language semantics”. In: Proceedings of Foundations of Aspeect-Oriented Langauges. 2003, page 65. doi: 10.1.1.115.3187. 12:23 What we talk about when we talk about monads [33] Ralf Lämmel. “Reuse by Program Transformation”. In: Selected papers from the 1st Scottish Functional Programming Workshop (SFP99). Edited by Philip W. Trinder, Greg Michaelson, and Hans-Wolfgang Loidl. Volume 1. Trends in Functional Programming. Intellect, 2000, pages 144–153. isbn: 1-84150-024-0. [34] Saunders Mac Lane. Categories for the working mathematician. Volume 5. Springer Science & Business Media, 2013. isbn: 978-1-4419-3123-8. doi: 10.1007/ 978-1-4757-4721-8. [35] Donald MacKenzie. Mechanizing proof: computing, risk, and trust. MIT Press, 2004. isbn: 978-0-262-63295-9. [36] Ernie Manes. Monads of sets. Edited by M. Hazewinkel. Volume 3. Handbook of Algebra Supplement C. North-Holland, 2003, pages 67–153. doi: 10.1016/S15707954(03)80059-1. [37] Simon Marlow, Ryan Newton, and Simon Peyton Jones. “A Monad for Deterministic Parallelism”. In: Proceedings of the 4th ACM Symposium on Haskell. Haskell ’11. Tokyo, Japan: ACM, 2011, pages 71–82. isbn: 978-1-4503-0860-1. doi: 10.1145/2034675.2034685. [38] Simone Martini. “Several types of types in programming languages”. In: International Conference on History and Philosophy of Computing. Springer. 2015, pages 216–227. doi: 10.1007/978-3-319-47286-7_15. [39] Erik Meijer. “There is no impedance mismatch: language integrated query in Visual Basic 9”. In: OOPSLA Companion. 2006, pages 710–711. doi: 10.1145/ 1176617.1176686. [40] Eugenio Moggi. “Notions of computation and monads”. In: Information and computation 93.1 (1991), pages 55–92. doi: 10.1016/0890-5401(91)90052-4. [41] Alan Mycroft, Dominic Orchard, and Tomas Petricek. “Effect systems revisited – control-flow algebra and semantics”. In: Semantics, Logics, and Calculi. Springer, 2016, pages 1–32. doi: 10.1007/978-3-319-27810-0_1. [42] Russell O’Connor. IO is not a monad. Online at http://r6.ca/blog/20110520T 220201Z.html (last accessed 27 March 2018). 2011. [43] Dominic Orchard. Should I use a monad or a comonad. Online at https://www. cs.kent.ac.uk/people/staff/dao7/drafts/monad-or-comonad-orchard11-draft.pdf (last accessed 27 March 2018). 2012. [44] Tomas Petricek. “Against a universal definition of ‘Type’”. In: 2015 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software (Onward!) ACM. 2015, pages 254–266. doi: 10.1145/2814228. 2814249. [45] Tomas Petricek, Alan Mycroft, and Don Syme. “Extending Monads with Pattern Matching”. In: Proceedings of the 4th ACM Symposium on Haskell. Haskell ’11. Tokyo, Japan: ACM, 2011, pages 1–12. isbn: 978-1-4503-0860-1. doi: 10.1145/ 2034675.2034677. url: http://doi.acm.org/10.1145/2034675.2034677. 12:24 Tomas Petricek [46] Tomas Petricek and Don Syme. “The F# computation expression zoo”. In: International Symposium on Practical Aspects of Declarative Languages. Springer. 2014, pages 33–48. doi: 10.1007/978-3-319-04132-2_3. [47] Simon L Peyton Jones and Philip Wadler. “Imperative functional programming”. In: Proceedings of the 20th ACM SIGPLAN-SIGACT symposium on Principles of programming languages. ACM. 1993, pages 71–84. doi: 10.1145/158511.158524. [48] Mark Priestley. A Science of Operations - Machines, Logic and the Invention of Programming. History of Computing. Springer, 2011. isbn: 978-1-84882-555-0. [49] Michael Snoyman. “Warp: A Haskell web server”. In: IEEE Internet Computing 15.3 (2011), pages 81–85. doi: 10.1109/MIC.2011.70. [50] Mike Spivey. “A functional theory of exceptions”. In: Science of Computer Programming 14.1 (1990), pages 25–42. doi: 10.1016/0167-6423(90)90056-J. [51] S Doaitse Swierstra and Luc Duponcheel. “Deterministic, error-correcting combinator parsers”. In: International School on Advanced Functional Programming. Springer. 1996, pages 184–207. doi: 10.1.1.80.9967. [52] Don Syme, Tomas Petricek, and Dmitry Lomov. “The F# asynchronous programming model”. In: Practical Aspects of Declarative Languages (2011), pages 175– 189. doi: 10.1007/978-3-642-18378-2_15. [53] Raymond Turner and Nicola Angius. “The Philosophy of Computer Science”. In: The Stanford Encyclopedia of Philosophy. Edited by E. N. Zalta. January 2017 ed. 2017. url: https://plato.stanford.edu/entries/computer-science/. [54] Tarmo Uustalu. “A divertimento on MonadPlus and nondeterminism”. In: Journal of Logical and Algebraic Methods in Programming 85.5 (2016), pages 1086– 1094. doi: 10.1016/j.jlamp.2016.06.004. [55] Tarmo Uustalu and Varmo Vene. “The essence of dataflow programming”. In: Central European Functional Programming School. Springer. 2005, pages 135– 167. doi: 10.1007/11575467_2. [56] William Wadge. “Monads and intensionality”. In: International Symposium on Lucid and Intensional Programming. Volume 95. 1995. [57] Philip Wadler. “Comprehending monads”. In: Proceedings of the 1990 ACM conference on LISP and functional programming. ACM. 1990, pages 61–78. doi: 10.1145/91556.91592. [58] Philip Wadler. “Monads for functional programming”. In: International School on Advanced Functional Programming. Springer. 1995, pages 24–52. isbn: 3-54059451-5. [59] Philip Wadler and Stephen Blott. “How to make ad-hoc polymorphism less ad hoc”. In: Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages. ACM. 1989, pages 60–76. doi: 10.1145/75277.75283. [60] Scott Wlaschin. Railway oriented programming. Online at https://fsharpforfuna ndprofit.com/rop/ (last accessed 27 March 2018). 2014. 12:25 What we talk about when we talk about monads [61] Brent Yorgey. Abstraction, intuition, and the “monad tutorial fallacy”. Online at https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-themonad-tutorial-fallacy/ (last accessed 27 March 2018). 2009. 12:26 Tomas Petricek About the author Tomas Petricek Tomas is a Visiting Researcher at the Alan Turing institute, working on tools for open data-driven storytelling (http://thegamma.net). His many other interests include programming language theory (his PhD thesis is on coeffects, a theory of context-aware programming languages), open-source and functional programming (he is an active contributor to the F# ecosystem), but also understanding programming through the perspective of philosophy of science. Contact him at [email protected]. 12:27
6cs.PL
arXiv:1508.07713v1 [math.AC] 31 Aug 2015 A CHARACTERIZATION OF TRIANGLE-FREE GORENSTEIN GRAPHS AND COHEN-MACAULAYNESS OF SECOND POWERS OF EDGE IDEALS DO TRONG HOANG AND TRAN NAM TRUNG Abstract. We graph-theoretically characterize triangle-free Gorenstein graphs G. As an application, we classify when I(G)2 is Cohen-Macaulay. Introduction Throughout this paper let G be a simple graph (i.e., a finite, undirected, loopless and without multiple edges) with vertex set V (G) and edge set E(G) and let k be a fixed field. Two vertices u, v of G are adjacent if uv is an edge of G. An independent set in G is a set of vertices no two of which are adjacent to each other. An independent set in G is maximal (with respect to set inclusion) if the set cannot be extended to a larger independent set. The independence number of G, denoted by α(G), is the cardinality of the largest independent set in G. The girth of a graph G, denoted by girth(G), is the length of any shortest cycle in G or in the case G is a forest we consider the girth to be infinite. If G has girth at least 4, then G is triangle-free. In a 1970, Plummer [14] introduced the notion of considering graphs in which each maximal independent set has the same size α(G); he called a graph having this property a well-covered graph. In general, to compute α(G) of a graph G is an NPcomplete problem (see [10]), but it is polynomial for well-covered graphs. Characterize well-covered graphs is a difficult problem and the work on well-covered graphs that has appeared in the literature has focused on certain subclasses of well-covered graphs (see [15] for the survey). Recently, well-covered graphs with the Cohen-Macaulay property have been studied from an algebraic point of view. Let R = k[x1 , . . . , xn ] be a polynomial ring of n variables over the field k. Let G be a simple graph on the vertex set {x1 , . . . , xn }. We associate to the graph G a quadratic squarefree monomial ideal I(G) = (xi xj | xi xj ∈ E(G)) ⊆ R, 1991 Mathematics Subject Classification. 13D45, 05C90, 05E40, 05E45. Key words and phrases. Graph, Triangle-free, Well-covered, Edge ideal, Cohen-Macaulay, Gorenstein. 1 which is called the edge ideal of G. We say that G is Cohen-Macaulay (resp. Gorenstein) if I(G) is Cohen-Macaulay (resp. Gorenstein). Since G is well-covered whenever it is Cohen-Macaulay (see e.g., [25, Proposition 6.1.21]), it is a wide open problem to characterize graph-theoretically the Cohen-Macaulay graphs. Unfortunately, the Cohen-Macaulayness of graphs depends on the characteristic of the base field k (see, e.g., [25, Exercise 5.3.31]), so the characterization now has focused on certain families of Cohen-Macaulay graphs, such as trees, chordal graphs, bipartite graphs, graphs of girth at least 5, circulant graphs and so on (see [24], [6], [5], [9], [22]). If we focus on Gorenstein graphs G without isolated vertices, then not only is G well-covered, but is G\x also well-covered, with α(G) = α(G\x) for any vertex x. Such graphs form the so-called class W2 (see [20]). Thus in order to characterize Gorenstein graphs we should classify the class W2 , but this problem is also difficult (see [15]). Note that the Gorenstein property of graphs is also dependent on the characteristic of the base field k (see Proposition 2.1), so we cannot graph-theoretically characterize all Gorenstein graphs. In this paper, we are interested in triangle-free Gorenstein graphs. The answer is amazing: a triangle-free graph G is Gorenstein if and only if every non-trivial connected component of G belongs to W2 . Let ∆ be a simplicial complex over the vertex set {x1 , . . . , xn }. A classical result m in [2] implies that I∆ is Cohen-Macaulay (over k) for all m > 1 if and only if ∆ is a complete intersection; where I∆ is the Stanley-Reisner ideal of ∆. Recently, Terai and m Trung [21] showed that ∆ is a complete intersection whenever I∆ is Cohen-Macaulay for some m > 3. By contrast with this situation we have not known a characterization 2 is Cohen-Macaulay yet (see [8], [12], [16], [21]). On the other hand, of ∆ for which I∆ 2 Vasconcelos (see [23, Conjecture (B)]) suggests that ∆ must be Gorenstein if I∆ is Cohen-Macaulay. For edge ideals, we will prove that I(G)2 is Cohen-Macaulay if and only if G is triangle-free Gorenstein . The main result of the paper is the following theorem. Theorem 3.4. Let G be a simple graph without isolated vertices. Then, the following conditions are equivalent: (1) G is a triangle-free Gorenstein graph; (2) G is a triangle-free member of W2 ; (3) I(G)2 is Cohen-Macaulay. The paper is organized as follows. In Section 1, we recall some basic notations, terminology of the simplicial complexes. In Section 2, we characterize triangle-free Gorenstein graphs. In the last section, we prove the main result. 2 1. Preliminaries Let ∆ be a simplicial complex on the vertex set V (∆) = [n] = {1, 2, . . . , n}. Given any field k, we attach to ∆ the Stanley-Reisner ideal I∆ of ∆ to be the squarefree monomial ideal I∆ = (xj1 · · · xji | j1 < · · · < ji and {j1 , . . . , ji } ∈ / ∆) in R = k[x1 , . . . , xn ] and the Stanley-Reisner ring of ∆ to be the quotient ring k[∆] = R/I∆ . This provides a bridge between combinatorics and commutative algebra (see [17]). Then, we say that ∆ is Cohen-Macaulay (resp. Gorenstein) over k if k[∆] has the same property. The dimension of a face F ∈ ∆ is given by dim F = |F | − 1; the dimension of ∆, denoted dim ∆, is the maximum dimension of all its faces. Note that dim k[∆] = dim ∆ + 1. The link of F inside ∆ is the subcomplex of ∆: lk∆ F = {H ∈ ∆ | H ∪ F ∈ ∆ and H ∩ F = ∅}. The most widely used criterion for determining when a simplicial complex is CohenMacaulay is due to Reisner, which says that links have only top homology (see [17, Corollary 4.2, Page 60]). Lemma 1.1. ∆ is Cohen-Macaulay over k if and only if for all F ∈ ∆ and all e i (lk∆ F ; k) = 0. i < dim(lk∆ F ), we have H Let fi be the number of faces of ∆ of dimension i for each i, and let d := dim ∆ + 1. Then the f -vector of ∆ is f (∆) = (f−1 , f0 , f1 , . . . , fd−1 ); and this vector is related to e i (∆; k) via the reduced Euler characteristic of ∆: the dimensions of H χ e(∆) := d−1 X e i (∆; k) = (−1)i dimk H i=−1 d−1 X (−1)i fi = i=−1 X (−1)|F |−1 . F ∈∆ We call ∆ a pure simplicial complex if all its facets have the same dimension; and ∆ is an Eulerian complex if ∆ is pure and χ e(lk∆ F ) = (−1)dim lk∆ F for all F ∈ ∆. In this case, note that χ e(lk∆ F ) = χ e(Sd−1−|F | ) (see [18, Proposition 3.3]). The restriction of ∆ to a subset S of V (∆) is ∆S := {F ∈ ∆ | F ⊆ S}. The star of a vertex v in ∆ is st∆ (v) := {F ∈ ∆ | F ∪ {v} ∈ ∆}. Let core(V (∆)) := {x ∈ V (∆) | st∆ (x) 6= ∆}, then the core of ∆ is core(∆) := ∆core(V (∆)) . If ∆ = st∆ (v) for some vertex v, then ∆ is a cone over v. Thus ∆ = core(∆) means ∆ is not a cone. Let ∆ and Γ be simplicial complexes with disjoint vertex sets V (∆) and V (Γ), respectively. Define the join ∆ ∗ Γ to be the simplicial complex on the vertex set V (∆) ∪ V (Γ) with faces F ∪ H, where F ∈ ∆ and H ∈ Γ. It follows that ∆ = core(∆) ∗ hV (∆) \ core(V (∆))i, where for a finite set P , we denote hP i to be the simplex over the set P . 3 We then have a criterion for determining when Cohen-Macaulay complexes ∆ are Gorenstein due to Stanley (see [17, Theorem 5.1, Page 65]). Lemma 1.2. ∆ is Gorenstein if and only if core(∆) is an Eulerian complex which is Cohen-Macaulay. For a subset S of the vertex set of ∆, let ∆ \ S := {F ∈ ∆ | F ⊆ V (∆) \ S}. If S = {x}, we write ∆ \ x to mean ∆ \ {x}. Clearly, ∆ \ x = {F ∈ ∆ | x ∈ / F }. ∆ is called doubly Cohen-Macaulay (see [1]) if ∆ is Cohen-Macaulay, and for every vertex x of ∆ the subcomplex ∆ \ x is Cohen-Macaulay of the same dimension as ∆. If ∆ is Cohen-Macaulay, then k[∆] has a minimal free resolution of the form: 0 −→ Rβn−d (k[∆]) −→ · · · −→ Rβ1 (k[∆]) −→ Rβ0 (k[∆]) −→ k[∆] −→ 0 where d = dim k[∆] and βi (k[∆]) is the i-th Betti number of k[∆] for each i. The number βn−d (k[∆]) is called the type of k[∆] and is denoted by type(k[∆]). We then have ∆ is Gorenstein if and only if type(k[∆]) = 1 (see [17, Theorem 12.5, Page 50]) and ∆ is doubly Cohen-Macaulay if and only if type(k[∆]) = (−1)d−1 χ e(∆) (see [1]). d−1 If ∆ is Gorenstein with ∆ = core(∆), then χ e(∆) = (−1) by Lemma 1.2. Hence, Lemma 1.3. If ∆ is a Gorenstein simplicial complex with ∆ = core(∆), then ∆ is doubly Cohen-Macaulay. The following lemma is the key to investigate Cohen-Macaulay simplicial complexes in this paper. Lemma 1.4. Let ∆ be a Gorenstein simplicial complex with ∆ = core(∆). If S is a e i (∆ \ S, k) = 0 for all i. subset of V (∆) such that ∆S is a cone, then we have H Proof. We prove the lemma by induction on |S|. If |S| = 1, then S = {v} for some vertex v of ∆. Let d := dim(∆) + 1. By Lemma 1.3 we have ∆ is doubly CohenMacaulay, so ∆\v is Cohen-Macaulay of dimension d−1, and so by Reisner’s criterion e i (∆ \ v; k) = 0 for all i < d − 1. Hence it remains to prove, in this case, we have H e d−1 (∆ \ v; k) = 0. By [7, Lemma 2.1] we have the following exact sequence: that H e d−2 (lk∆ (v); k) −→ H e d−1 (∆; k) −→ H e d−1 (∆ \ v; k) −→ 0. 0 −→ H e d−1 (∆\v; k) = dimk H e d−1 (∆; k)−dimk H e d−2 (lk∆ (v); k). By Lemma This yields dimk H e d−1 (∆; k) = dimk H e d−2 (lk∆ (v); k) = 1. Thus, dimk H e d−1 (∆ \ 1.2 we obtain dimk H e d−1 (∆ \ v; k) = 0, as claimed. v; k) = 0, and thus H If |S| > 2. Assume that for all Gorenstein simplicial complexes Γ with Γ = core(Γ), and for all subsets T of V (Γ) such that |T | < |S| and ΓT is a cone; then we have e i (Γ \ T, k) = 0, for all i. H 4 Assume that ∆S is a cone with vertex v. Take any x ∈ S \ {v} and then let T := S \ {x} and Λ := ∆ \ T . Since ∆T is also a cone with vertex v and |T | = |S| − 1, by the e i (Λ; k) = H e i (∆ \ T ; k) = 0. Let T 0 := T ∩ V (lk∆ (x)), induction hypothesis we have H so that lkΛ (x) = lk∆ (x) \ T 0 . From Lemma 1.2 we imply that lk∆ (x) is Gorenstein with lk∆ (x) = core(lk∆ (x)). Note that lk∆ (x)T 0 is a cone over v and |T 0 | 6 |T | < |S|, e i (lkΛ (x); k) = H e i (lk∆ (x) \ T 0 ; k) = 0 by the induction hypothesis. so H Finally, [7, Lemma 2.1] gives rise to the following exact sequence: e i (Λ; k) −→ H e i (Λ \ x; k) −→ H e i (lkΛ (x); k). H e i (lkΛ (x); k) = 0 and H e i (Λ; k) = 0 we obtain H e i (Λ\x; k) = 0. Together with the facts H e i (∆ \ S; k) = 0, as required. As Λ \ x = ∆ \ S, which implies H  The lemma 1.4 has an interesting consequence. Corollary 1.5. Let ∆ be a Gorenstein simplicial complex. Then the simplicial complex ∆ \ F is Cohen-Macaulay for every face F of ∆. Proof. Assume that ∆ = core(∆) ∗ hP i where P = V (∆) \ core(V (∆)). Let F1 := F ∩ V (core(∆)) and F2 := P \ F . Then we have ∆ \ F = (core(∆) \ F1 ) ∗ hF2 i, hence ∆ \ F is Cohen-Macaulay if so is core(∆) \ F1 . Therefore, we may assume that ∆ = core(∆). We now claim that for all faces S of ∆ \ F and for all integers i < dim(∆ \ F ) − |S|, e i (lk∆\F (S); k) = 0. Indeed, by Lemma 1.2 we deduce that lk∆ (S) is Gorenstein then H with core(lk∆ (S)) = lk∆ (S). Next, we note that lk∆\F (S) = lk∆ (S) \ F 0 where F 0 = F ∩ V (lk∆ (S)). Now if F 0 = ∅, then lk∆\F (S) = lk∆ (S). Since dim(∆ \ F ) 6 dim(∆), the claim follows from Reisner’s criterion. If F 0 6= ∅, then lk∆ (S)F 0 is a cone because F 0 is also a face of lk∆ (S). By Lemma 1.4 we have e i (lk∆\F (S); k) = H e i (lk∆F (S) \ F 0 ; k) = 0, H as claimed. Together with Reisner’s criterion, this claim yields ∆ \ F is Cohen-Macaulay.  2. A Characterization of Triangle-free Gorenstein Graphs In this section we will graph-theoretically characterize triangle-free Gorenstein graphs. For a graph G, let ∆(G) be the set of all independent sets of G. Then, ∆(G) is a simplicial complex and it is the so-called independence complex of G. We can see that I(G) = I∆(G) and dim(∆(G)) = α(G) − 1, where α(G) denotes the independence number of G. Notice that ∆(G) = core(∆(G)) if and only if G has no isolated vertices; and G is well-covered if and only if ∆(G) is pure. 5 We now start by showing that the Gorenstein property of graphs in general depends on the characteristic of k . Gräbe[4] showed that the Gorenstein property of a certain triangulation of RP3 depends on the characteristic of the base field k. Actually, any triangulation of RP3 is Gorenstein if and only if char(k) 6= 2. Using this fact, we can prove the following fact. Proposition 2.1. The Gorenstein property of graphs depends on the characteristic of the base field. Proof. In order to get such a graph let us take a minimal triangulation ∆ of the projective space RP3 with the f -vector f (∆) = (1, 11, 51, 80, 40) constructed by Walkup [26]. Let Λ be the barycentric subdivision of ∆, i.e., Λ is the simplicial complex on ground set ∆ \ {∅} whose simplices are flags F0 ( F1 ( · · · ( Fi of elements Fj ∈ ∆ \ {∅}, j 6 i. Clearly, the minimal non-faces of Λ are subsets of ∆ with exactly two non-comparable elements, therefore IΛ is an edge ideal of a graph, say G. Since Λ is a triangulation of RP3 , G is Gorenstein if and only if char(k) 6= 2. Notice that G has 182 vertices since f (∆) = (1, 11, 51, 80, 40).  The neighborhood of a vertex x of G is the set NG (x) := {y ∈ V (G) | xy ∈ E(G)}. For an independent set S of G we denote the neighborhood of S by NG (S) := {x ∈ V (G) \ S | NG (x) ∩ S 6= ∅} and the localization of G with respect to S by GS := G \ (S ∪ NG (S)); so that ∆(GS ) = lk∆(G) (S); where for a subset U of V (G) we denote G \ U to be the induced subgraph of G on the vertex set V (G) \ U . Note that GS is Cohen-Macaulay (resp. Gorenstein) if so is G by Lemma 1.1 (resp. Lemma 1.2). Lemma 2.2. [3, Lemma 1] If G is a well-covered graph and S is a set of independent vertices of G, then GS is well-covered. Moreover, α(GS ) = α(G) − |S|. The same holds for graphs in W2 . Recall that a graph G is a member of W2 if G is well-covered and G \ x is well-covered with α(G) = α(G \ x) for all x ∈ V (G). Lemma 2.3. If a graph G is in W2 and S is an independent set of G, then GS is in W2 whenever |S| < α(G). Proof. The proof follows immediately by induction on |S| and using [13, Theorem 5].  We say that G is locally Cohen-Macaulay (resp. Gorenstein) if Gx is CohenMacaulay (resp. Gorenstein) for all vertices x. Lemma 2.4. Let G be a locally Gorenstein graph in W2 and let S be a nonempty independent set of G. Then we have GS is Gorenstein and ∆(GS ) is Eulerian with dim(∆(GS )) = dim(∆(G)) − |S|. 6 Proof. We have GS is Gorenstein since G is locally Gorenstein and S is nonempty. We now claim that GS has no isolated vertices. Indeed, if |S| < α(G) then GS is in W2 , so by definition of the class W2 we imply that GS has no isolated vertices. If |S| = α(G), then S is a maximal independent set of G, and then GS is the empty graph. Therefore, GS also has no isolated vertices, as claimed. From this claim we have ∆(GS ) = core(∆(GS )), so ∆(GS ) is Eulerian by Lemma 1.2. Finally, by Lemma 2.2 we have α(GS ) = α(G) − |S|, hence dim(∆(GS )) = α(GS ) − 1 = α(G) − 1 − |S| = dim(∆(G)) − |S|, as required.  We next show that the class W2 indeed contains all Gorenstein graphs without isolated vertices. Lemma 2.5. If G is a Gorenstein graph without isolated vertices, then G is in W2 . Proof. Since G is Gorenstein, it is well-covered. So it remains to prove that for any vertex x, we have G \ x is well-covered and α(G) = α(G \ x). As G has no isolated vertices, core(∆(G)) = ∆(G). Hence, by Lemma 1.3 we have ∆(G) is doubly CohenMacaulay. It follows that ∆(G\x) = ∆(G)\x is Cohen-Macaulay and dim(∆(G\x)) = dim(∆(G)). In other words, G \ x is Cohen-Macaulay with α(G \ x) = α(G). Thus, G is in W2 , as required.  In general, members of W2 need not be Gorenstein and an example is the 3-cycle, but any triangle-free member of W2 is Gorenstein. In order to prove this, we first show that the independence complex of a triangle-free member of W2 is Eulerian. Lemma 2.6. If G be a triangle-free graph in W2 , then ∆(G) is Eulerian. Proof. We prove the lemma by induction on α(G). If α(G) = 1, then G is complete. Since G is a triangle-free graph without isolated vertices, G must be an edge. It follows that ∆(G) is Eulerian. Assume that α(G) > 2. Let ∆ := ∆(G) and d := dim ∆(G)+1. For each vertex x of G, by Lemma 2.3 we have Gx is in W2 . Since lk∆ (x) = ∆(Gx ) and α(Gx ) = α(G) − 1, by the induction hypothesis we have lk∆ (x) is Eulerian. So in order to prove ∆ is Eulerian it remains to show that χ e(∆) = (−1)d−1 . Let a be a vertex of G, and let A := NG (a); so that A is a nonempty independent set of G because G is triangle-free. Let Γ := {F ∈ ∆ | F ∩ A 6= ∅}, 7 so that ∆ can be partitioned into ∆ = st∆ (a) ∪ Γ. Note that χ e(st∆ (a)) = 0 as st∆ (a) is a cone over a. Thus, X X X χ e(∆) = (−1)|F |−1 = (−1)|F |−1 + (−1)|F |−1 F ∈∆ F ∈Γ F ∈st∆ (a) =χ e(st∆ (a)) + X (−1)|F |−1 = F ∈Γ X (−1)|F |−1 . F ∈Γ Let Λ := hAi be the simplex over the vertices in A, and let Ω := Λ \ {∅}. For each S ∈ Ω, we define X X g(S) := (−1)|F |−1 and τ (S) := (−1)|F |−1 . F ∈Γ,S⊆F F ∈Γ,F ∩A=S Then, (1) χ e(∆) = X τ (S) and g(S) = X τ (F ). F ∈Ω,S⊆F S∈Ω For every S ∈ Ω, since S is a nonempty face of ∆, we have ∆(GS ) is Eulerian with dim(∆(GS )) = dim(∆(G))−|S| = d−1−|S|. It follows that χ e(∆(GS )) = (−1)d−1−|S| . Therefore, X X X (−1)|F |−1 = (−1)|F |+|S|−1 (−1)|F |−1 = g(S) = F ∈∆,S⊆F F ∈Γ,S⊆F = (−1)|S| X F ∈∆(GS ) (−1)|F |−1 = (−1)|S| χ e(GS ) = (−1)|S| (−1)d−1−|S| = (−1)d−1 . F ∈∆(GS ) We consider Ω as a poset with the partial order 6 being inclusion. Then, by (1) we have X g(S) = τ (F ). F ∈Ω,F >S Let µ be the Mobius function of the poset Ω. By the Mobius inversion formula (see [18, Proposition 3.7.2]) we have X X X τ (S) = µ(S, F )g(F ) = µ(S, F )(−1)d−1 = (−1)d−1 µ(S, F ). F ∈Ω,F >S F ∈Ω,F >S F ∈Ω,F >S Observe that for S, F ∈ Ω with S ⊆ F , we have T ∈ Ω and S 6 T 6 F if and only if S ⊆ T ⊆ F , so µ(S, F ) = (−1)|F |−|S| . Hence, X X τ (S) = (−1)d−1 (−1)|F |−|S| = (−1)d−1 (−1)|F |−|S| F ∈Ω,F >S = −(−1)d−1 X F ∈Λ,S⊆F (−1)|F |−1 = −(−1)d−1 χ e(lkΛ (S)). F ∈lkΛ (S) 8 Thus, by (1) we get X χ e(∆) = τ (S) = S∈Ω X τ (S) = −(−1)d−1 S∈Λ,S6=∅ X χ e(lkΛ (S)). S∈Λ,S6=∅ On the other hand, if S ∈ Λ and S 6= A, then lkΛ (S) = hA \ Si, which implies χ e(lkΛ (S)) = 0. Together with the equality above, this fact yields χ e(∆) = −(−1)d−1 χ e(lkΛ (A)) = −(−1)d−1 χ e({∅}) = −(−1)d−1 (−1) = (−1)d−1 , as required.  In what follows we use the exterior product to describe the homology groups of simplicial complexes. Assume that ∆ is a simplicial complex over the vertex set [n]. Then the exterior products eF = ej0 ∧ · · · ∧ eji , where F = {j0 , . . . , ji } ∈ ∆ with j0 < · · · < ji , form a basis of Cei (∆; k). The differentials ∂i : Cei (∆; k) −→ Cei−1 (∆; k) of the reduced chain complex Ce• (∆; k) are given by i X (−1)s ej0 ∧ · · · ∧ ebjs ∧ · · · ∧ eji , ∂i ( ej0 ∧ · · · ∧ eji ) = s=0 e i (∆; k) = ker(∂i )/ im(∂i+1 ). For simplicity, if and the ith homology group of ∆ is H ω ∈ Cei (∆; k), we write ∂ω instead of ∂i ω. With this notation we have (2) ∂(ω ∧ ν) = ∂ω ∧ ν + (−1)i+1 ω ∧ ∂ν for all ω ∈ Cei (∆; k) and ν ∈ Cej (∆; k). In the sequel we also need a concrete representation for elements of Cei (∆; k). Let P ω ∈ Cei (∆; k). Then, ω = F ∈Fi (∆) λF eF , where Fi (∆) = {F ∈ ∆ | dim F = i} and λF ∈ k for all F . Note that for two faces V and F of ∆ with V ⊆ F , by the alternative property of the wedge product we can write eF = eV ∧ aV,F eF \V where aV,F = −1 or aV,F = 1. Let A be a face of ∆. Then, we can rewrite ω as     X X X X  ω= λF eF  = eV ∧  λF aV,F eF \V  . V ⊆A F ∈Fi (∆), F ∩A=V V ⊆A F ∈Fi (∆), F ∩A=V For each V ⊆ A, let ωV := X λF aV,F eF \V F ∈Fi (∆), F ∩A=V so that ωV ∈ Cei−|V | (lk∆ (V ) \ A; k). Then, X (3) ω= eV ∧ ωV . V ⊆A We are now ready to prove the main result of this section. 9 Proposition 2.7. If G is a triangle-free graph without isolated vertices, then G is Gorenstein if and only if G is in W2 . Proof. If G is Gorenstein, then G is in W2 by Lemma 2.5. Conversely, we prove that G is Gorenstein when G ∈ W2 by induction on α(G). If α(G) = 1, then G is a complete triangle-free graph. As G is in W2 , it has no isolated vertices, so G is an edge. Thus, G is Gorenstein. Assume that α(G) > 2. Let ∆ := ∆(G). By Lemma 2.6 we have ∆ is Eulerian. For each vertex x of G, by Lemma 2.3 we have Gx is in W2 . Since α(Gx ) = α(G) − 1, by the induction hypothesis Gx is Gorenstein. So, G is locally Gorenstein. Since ∆ is Eulerian, by Lemma 1.2 we have ∆ is Gorenstein whenever ∆ is CohenMacaulay. As G is well-covered and locally Gorenstein, by Reisner’s criterion, G is Cohen-Macaulay if e i (∆; k) = 0, for all i < dim(∆). H Let a be any vertex of G and let A := NG (a). Notice that A is a nonempty independent set of G since G is a triangle-free member of W2 . e i (∆; k) = 0 we will prove that Given any i with i < dim(∆), in order to prove H e for every ω ∈ Ci (∆; k) such that ∂ω = 0, there is ζ ∈ Cei+1 (∆; k) such that ω = ∂ζ. Indeed, by Equation (3) we write ω as X eV ∧ ωV ω= V ⊆A where ωV ∈ Cei−|V | (∆(GV \ A); k). If ωF = 0 for any ∅ = 6 F ⊆ A, then ω ∈ Cei (∆(G \ A); k) = Cei (st∆ (a); k). Note e i (st∆ (a); k) = 0 because st∆ (a) is a cone over a, so ω = ∂ζ for some ζ ∈ that H Cei+1 (st∆ (a); k) ⊆ Cei+1 (∆; k). Assume that ωF 6= 0 for some ∅ = 6 F ⊆ A. Take such an F such that |F | is maximal. By Equation (2) we have X  ∂ω = ∂eV ∧ ωV + (−1)|V | eV ∧ ∂ωV = 0, V ⊆A which implies ∂ωF = 0. e i−|F | (∆(GF \ A); k) = 0. Indeed, if F = A, then ∆(GF \ We now claim that H A) = ∆(GF ) is Gorenstein with dim(∆(GF )) = dim(∆) − |F | by Lemma 2.4. Note that i − |F | < dim(∆) − |F | = dim(∆(GF \ A)), so by Reisner’s criterion we have e i−|F | (∆(GF \ A); k) = 0. H If F is a proper subset of A, then GF \ A = GF \ (A \ F ) and GF is a Gorenstein with ∆(GF ) = core(∆(GF )) by Lemma 2.4. Since A \ F is an independent set of GF , e i−|F | (∆(GF \ A); k) = 0, as claimed. by Lemma 1.4 we have H 10 e i−|F | (∆(GF \A); k) = 0, hence there is ηF ∈ Cei−|F |+1 (∆(GF \ By our claim we have H A); k) such that ωF = ∂(ηF ). Write F = {a1 , . . . , as } where a1 < · · · < as . Then, ∂eF = s X i−1 (−1) ea1 ∧ · · · ∧ ebai ∧ · · · ∧ eas = i=1 s X (−1)i−1 eF \{ai } . i=1 Since ∂(eF ∧ ηF ) = ∂eF ∧ ηF + (−1)|F | eF ∧ ∂ηF = ∂eF ∧ ηF + (−1)|F | eF ∧ ωF , we have |F | ω − ∂((−1) eF ∧ ηF ) = s X X eF \{ai } ∧ ((−1)|F |+i ηF ) + eV ∧ ωV . V ⊆A,V 6=F i=1 Note that (−1)|F | eF ∧ ηF ∈ Cei+1 (∆; k). By repeating this process after finitely many steps, we get an element η ∈ Cei+1 (∆; k) such that ω − ∂η ∈ Cei (∆(G \ A); k) = Cei (st∆ (a); k). e i (st∆ (a); k) = 0 and ∂(ω − ∂η) = ∂ω − ∂ 2 η = 0, there is ξ ∈ Cei+1 (st∆ (a); k) ⊆ Since H Cei+1 (∆; k) such that ω − ∂η = ∂ξ, i.e., ω = ∂(η + ξ), as required.  3. Cohen-Macaulayness of the second power of edge ideals In this section we complete the proof of the main result by characterizing graphs G such that I(G)2 is Cohen-Macaulay. If e is an edge of a given graph G, we can obtain a new graph by deleting e from G but leaving the vertices and the remaining edges intact. The resulting graph is denoted by G \ e. An edge e in G is said to be α-critical if α(G \ e) > α(G). If every edge of G is α-critical, G is called α-critical. Staples [19] proved that every triangle-free member of W2 is α-critical. We will use this property to give a characterization of triangle-free members of W2 . For an edge ab of G, let Gab be the induced subgraph G \ (NG (a) ∪ NG (b)) of G. Lemma 3.1. Let G be a graph. Then we have: (1) If Gx is well-covered with α(Gx ) = α(G) − 1 for all vertices x, then G is well-covered; (2) If Gab is well-covered with α(Gab ) = α(G) − 1 for all edges ab, then G is well-covered. 11 Proof. (1) is obvious. We now prove (2) by induction on α(G). If α(G) = 1, then G is a complete graph, and then α(Gab ) = 0 for every edge ab. Clearly, G is well-covered. Assume that α(G) > 2. We may assume that G has no isolated vertices. Let xy be an edge of G. Since Gxy is an induced subgraph of Gx , we have α(G) − 1 = α(Gxy ) 6 α(Gx ). On the other hand, the inequality α(G) − 1 > α(Gx ) is obvious, so α(Gx ) = α(G) − 1. Note that (Gx )ab = (Gab )x for all edges ab of Gx . Since Gab is well-covered with α(Gab ) = α(G) − 1, by Lemma 2.2 we have (Gx )ab is well-covered with α((Gx )ab ) = α((Gab )x ) = α(Gab ) − 1 = α(G) − 2 = α(Gx ) − 1. Therefore, Gx is well-covered by the induction hypothesis. By part (1) we have G is well-covered.  Lemma 3.2. Let G be a triangle-free graph without isolated vertices. Then G is in W2 if and only if Gab is well-covered with α(Gab ) = α(G) − 1 for all edges ab. Proof. Assume that G is in W2 . We will prove by induction on α(G) that Gab is well-covered with α(Gab ) = α(G) − 1 for all edges ab. Indeed, if α(G) = 1, then G is an edge. In this case, Gab is empty, so it is well-covered. Assume that α(G) > 2. We first prove α(Gab ) = α(G) − 1. Indeed, since G is α-critical by [19, Theorem 3.10], we have α(G \ ab) > α(G). Let F be a maximal independent set in G \ ab such that |F | = α(G \ ab). Then, F \ {a} and F \ {b} are independent sets in G. Consequently, |F | − 1 6 α(G). This implies α(G) = |F | − 1, so α(G \ ab) = |F | = α(G) + 1. Since {a, b} is an independent set G \ ab, we have Gab = (G \ ab){a,b} and F \ {a, b} is an independent set in Gab . Thus, α(Gab ) > |F | − 2 = α(G) − 1. On the other hand, since Gab is an induced subgraph of Ga , we have α(Gab ) 6 α(Ga ) = α(G) − 1. Therefore, α(Gab ) = α(G) − 1, as claimed. Next, we prove that Gab is well-covered. For any vertex x of Gab , by Lemmas 2.2 and 2.3 we have Gx is in W2 and α(Gx ) = α(G) − 1. Note that (Gab )x = (Gx )ab , so by the induction hypothesis we have (Gab )x is well-covered with α((Gab )x ) = α((Gx )ab ) = α(Gx ) − 1 = α(G) − 2 = α(Gab ) − 1. Hence, Gab is well-covered according to Lemma 3.1. Conversely, assume that Gab is well-covered and α(Gab ) = α(G) − 1 for all edges ab. We now prove by induction on α(G) that G is in W2 . Note that G is well-covered by Lemma 3.1. Moreover, α(G \ x) = α(G) for all vertices x since G is well-covered without isolated vertices. Therefore, it remains to prove that G \ x is well-covered. Now, if α(G) = 1, then G is an edge. In this case, G \ x is one vertex, so it is well-covered. Assume that α(G) > 2. We first claim that Gy has no isolated vertices for any vertex y of G. Assume on contrary that Gy has an isolated vertex z. Let Y := NG (y) 12 and Z := NG (z), so that Z ⊆ Y . Note that Y 6= ∅ and Z 6= ∅ because G has no isolated vertices. Since {y, z} is an independent set of G and G is well-covered, α(G{y,z} ) = α(G) − 2 by Lemma 2.2. On the other hand, for any w in Z, we have Gyw is an induced subgraph of G{y,z} , hence α(Gyw ) 6 α(G{y,z} ) = α(G) − 2 < α(G) − 1, a contradiction. Thus, Gy has no isolated vertices, as claimed. Now we return to prove that G \ x is well-covered. It suffices to show that (G \ x)y is well-covered with α((G \ x)y ) = α(G \ x) − 1 by Lemma 3.1. Indeed, if y and x are adjacent in G, then (G\x)y = Gy , and then (G\x)y is well-covered with α((G\x)y ) = α(Gy ) = α(G)−1 = α(G\x)−1. If y and x are not adjacent in G, then x is a vertex of Gy and (G\x)y = (Gy )\x. For every edge ab of Gy we have (Gy )ab = (Gab )y , so (Gy )ab is well-covered and α((Gy )ab ) = α((Gab )y ) = α(Gab ) − 1 = α(G) − 1 − 1 = α(Gy ) − 1. Since Gy has no isolated vertices as the claim above and α(Gy ) = α(G) − 1, by the induction hypothesis we have Gy is in W2 . In particular, (G \ x)y = (Gy ) \ x is wellcovered with α((G \ x)y ) = α((Gy ) \ x) = α(Gy ) = α(G) − 1 = α(G \ x) − 1, as required.  Lemma 3.3. If G is a triangle-free Gorenstein graph, then I(G)2 is Cohen-Macaulay. Proof. We may assume that G has no isolated vertices. By Proposition 2.7 we have G is in W2 . As G is Gorenstein, by [8, Corollary 2.3] it suffices to show that Gab is Cohen-Macaulay with α(Gab ) = α(G) − 1 for every edge ab of G. Let ab be an edge of G. By Lemma 3.2 we have α(Gab ) = α(G) − 1. So it remains to prove that Gab is Cohen-Macaulay. Let A := NG (a) \ {b}, so that A is a face of ∆(Gb ) since G is triangle-free. Note that Gab = Gb \ A, so ∆(Gab ) = ∆(Gb \ A) = ∆(Gb ) \ A. Since Gb is Gorenstein, by Corollary 1.5 we have ∆(Gb ) \ A is Cohen-Macaulay. It follows that Gab is Cohen-Macaulay, as required.  Now we are ready to prove the main result of this paper. Theorem 3.4. Let G be a simple graph without isolated vertices. Then, the following conditions are equivalent: (1) G is a triangle-free Gorenstein graph; (2) G is a triangle-free member of W2 ; (3) I(G)2 is Cohen-Macaulay. Proof. (1) ⇐⇒ (2) follows from Proposition 2.7. (1) =⇒ (3) follows from Lemma 3.3. (3) =⇒ (2) follows from [8, Corollary 2.3] and Lemma 3.2 since every Cohen-Macaulay graph is well-covered by [25, Lemma 6.1.21].  Remark 3.5. Let G be a connected graph in W2 . If G is not K2 or C5 , then girth(G) 6 4 by [13, Theorem 6]. Therefore, all connected Gorenstein graphs of girth at least 5 13 are only K1 , K2 and C5 ; so that the structure of triangle-free Gorenstein graphs is non trivial only for the ones of girth 4. Using the classification of the planar graphs of girth 4 in W2 due to Pinter [13] we obtain the family of the connected planar Gorenstein graphs of girth 4 is {Gn }n>3 where Gn is the graph on the vertex set {1, . . . , 3n − 1} with the edge ideal I(Gn ) being {x1 x2 , {x3k−1 x3k , x3k x3k+1 , x3k+1 x3k+2 , x3k+2 x3k−2 }k=1,...,n−1 , {x3l−3 x3l }l=2,...,n−1 }. (see also [9] for another proof) x3 x2 x9 x1 x3n−2 x11 x8 x5 x3n−3 x10 x4 x3n−1 x3n+2 x3n−4 x7 x3n−5 x6 x3n+1 x3n−6 x3n Figure 1. The graph Gn . Acknowledgment. We would like to thank Professors L. T. Hoa and N. V. Trung for helpful comments. Part of this work was done while we were at the Vietnam Institute of Advanced Studies in Mathematics (VIASM) in Hanoi, Vietnam. We would like to thank VIASM for its hospitality. We would also like to thank anonymous referees for many helpful comments. References [1] K. Baclawski, Cohen-Macaulay connectivity and geometric lattices, European J. Combinatorics 3 (1982), 293-305. [2] R.C. Cowsik and M.V. Nori, Fibers of blowing up, J. Indian Math. Soc. 40 (1976), 217-222. [3] A. Finbow, B. Hartnell and R. Nowakbwski, A characterisation of well covered graphs of girth 5 or greater, J. Combin. Theory, Ser. B, 57, 44-68, 1993. [4] H.-G. Gräbe, The Gorenstein property depends on characteristic, Beiträge Algebra Geom. 17 (1984), 169-174. [5] J. Herzog and T. Hibi, Distributive lattices, bipartite graphs and Alexander duality, J. Algebraic Combin. 22 (2005), no. 3, 289-302. [6] J. Herzog, T. Hibi and X. Zheng, Cohen-Macaulay chordal graphs. J. Combin. Theory Ser. A, 113 (2006), no. 5, 911-916. [7] T. Hibi, Buchsbaum complexes with linear resolutions, J. Algebra 179 (1996), 127-136. 14 [8] D. T. Hoang, N. C. Minh and T. N. Trung, Combinatorial characterzations of the CohenMacaulayness of the second power of edge ideals, J. Combin. Theory Ser. A, 120 (2013), 1073-1086. [9] D. T. Hoang, N. C. Minh and T. N. Trung, CohenMacaulay graphs with large girth, J. Algebra Appl. 14 (2015), no. 7, 1550112, 16 pp. [10] R.M. Karp, Reducibility among combinatorial problems, in Complexity of Computer Computations, Eds.: R.E. Miller and J.W. Thatcher, Plenum Press, New York, 1972, 85-103. [11] E. Miller and B. Sturmfels, Combinatorial commutative algebra. Springer, 2005. [12] N. C. Minh and N. V. Trung, Cohen-Macaulayness of monomial ideals and symbolic powers of Stanley-Reisner ideals, Adv. Mathematics 226 (2011), 1285-1306. [13] M. R. Pinter, A class of planar well-covered graphs with girth four, J. Graph Theory, 19 (1995), no. 1, 69-81. [14] M. D. Plummer, Some covering concepts in graphs, Journal of Combinatorial Theory, 8 (1970), 91-98. [15] M. D. Plummer, Well-covered graphs: Survey. Quaestiones Math. 16 (1993), no. 3, 253-287. [16] G. Rinaldo, N. Terai and K. Yoshida, On the second powers of Stanley-Reisner ideals, J. Commut. Algebra 3 (2011), no. 3, 405-430. [17] R. Stanley, Combinatorics and Commutative Algebra, 2. Edition, Birkhäuser, 1996. [18] R. Stanley, Enumerative Combinatorics. Volume 1, Cambridge University Press 1997. [19] J. Staples, On some subclasses of well-covered graphs, Vanderbilt Univ. Dept. of Math. Ph.D. thesis, August, 1975. [20] J. W. Staples, On some subclasses of well-covered graphs, J. Graph Theory 3 (1979), 197-204. [21] N. Terai and N. V. Trung, Cohen-Macaulayness of large powers of Stanley-Reisner ideals, Adv. Mathematics 229 (2012), 711-730. [22] K.N. Vander Meulen, A. Van Tuyl and C. Watt, Cohen-Macaulay Circulant Graphs. To appear Communications in Algebra arXiv:1210.8351 [23] W. V. Vasconcelos, Koszul homology and the structure of low codimension Cohen-Macaulay ideals, Trans. Amer. Math. Soc. 301 (1987), 591-613. [24] R. Villarreal, Cohen-Macaulay graphs, Manuscripta Math. 66 (1990), no. 3, 277-293. [25] R. Villarreal, Monomial Algebras, Monographs and Textbooks in Pure and Applied Mathematics Vol. 238, Marcel Dekker, New York, 2001. [26] D. W. Walkup, The lower bound conjecture for 3- and 4-manifolds, Acta Math. 125, 75-107 (1970). Institute of Mathematics, VAST, 18 Hoang Quoc Viet, Hanoi, Viet Nam E-mail address: [email protected] Institute of Mathematics, VAST, 18 Hoang Quoc Viet, Hanoi, Viet Nam E-mail address: [email protected] 15
0math.AC
Kayak: Safe Semantic Refactoring to Java Streams Cristina David1 , Pascal Kesseli2 , and Daniel Kroening2 1 University of Cambridge, UK University of Oxford, UK arXiv:1712.07388v1 [cs.PL] 20 Dec 2017 2 Abstract. Refactorings are structured changes to existing software that leave its externally observable behaviour unchanged. Their intent is to improve readability, performance or other non-behavioural properties. State-of-the-art automatic refactoring tools are syntax-driven and, therefore, overly conservative. In this paper we explore semantics-driven refactoring, which enables much more sophisticated refactoring schemata. As an exemplar of this broader idea, we present Kayak, an automatic refactoring tool that transforms Java with external iteration over collections into code that uses Streams, a new abstraction introduced by Java 8. Our refactoring procedure performs semantic reasoning and search in the space of possible refactorings using automated program synthesis. Our experimental results support the conjecture that semantics-driven refactorings are more precise and are able to rewrite more complex code scenarios when compared to syntax-driven refactorings. 1 Introduction Refactorings are structured changes to existing software which leave its externally observable behaviour unchanged. They improve non-functional properties of the program code, such as testability, maintainability and extensibility while retaining the semantics of the program. Ultimately, refactorings can improve the design of code, help finding bugs as well as increase development speed and are therefore seen as an integral part of agile software engineering processes [11, 22]. However, manual refactorings are a costly, time-intensive, and not least errorprone process. This has motivated work on automating specific refactorings, which promises safe application to large code bases at low cost. We differentiate in this context between syntax-driven and semantics-driven refactorings. While the former address structural changes to the program requiring only limited information about a program’s semantics, the latter require detailed understanding of the program semantics in order to be applied soundly. An example of a refactoring that requires a semantics-driven approach is Substitute Algorithm, where an algorithm is replaced by a clearer, but equivalent version [11]. A syntax-driven approach is insufficient to perform such substantial transformations. Figure 1 illustrates this using an example: Both loops in the code implement the same behaviour. In order to recognise this and apply Substitute Algorithm, pattern-based 2 Cristina David, Pascal Kesseli, and Daniel Kroening approaches need explicit patterns for vastly different syntaxes implementing the same semantics, which is infeasible for practical applications. Notably, the limitations of syntax-driven refactorings have been observed in several works, resulting in an emerging trend to incorporate more semantic information into refactoring decisions, such as Abstract Syntax Tree (AST) type information, further preventing compilation errors and behaviour changes [31– 33]. L i s t <I n t e g e r > o r g = getData ( ) ; L i s t <I n t e g e r > copy = new A r r a y L i s t < >(); f o r ( i n t i =0; i < o r g . s i z e ( ) ; ++i ) i f ( o r g . g e t ( i ) > 0 ) copy . add ( 2 ∗ o r g . g e t ( i ) ) ; I t e r a t o r <I n t e g e r > i t=o r g . i t e r a t o r ( ) ; while ( i t . hasNext ( ) ) { i n t tmp = i t . nex t ( ) ∗ 2 ; i f ( tmp <= 0 ) continue ; copy . add ( tmp ) ; } Fig. 1: Limitations of pattern-based refactorings. In this paper, we take a step further in this direction by proposing a fully semantic refactoring approach. There is a very broad space of methods that are able to reason about program semantics. The desire to perform refactorings safely suggests the use of techniques that overapproximate program behaviours. As one possible embodiment of semantics-driven refactoring, we leverage software verification technologies with the goal of reliably automating refactoring decisions based on program semantics, as in the case of the Substitute Algorithm refactoring. Our research hypothesis is that semantics-driven refactorings are more precise and can handle more complex code scenarios in comparison with syntax-driven refactorings. Demonstrator: Refactoring Iteration over Collections We use a particular refactoring as demonstrator for our idea. Nearly every modern Java application constructs and processes collections. A key algorithmic pattern when using collections is iteration over the contents of the collection. We distinguish external from internal iteration. To enable external iteration, a Collection provides the means to enumerate its elements by implementing Iterable. Clients that use an external iterator must advance the traversal and request the next element explicitly from the iterator. External iteration has a few shortcomings: – Is inherently sequential, and must process the elements in the order specified by the collection. This bars the code from using concurrency to increase performance. Kayak: Safe Semantic Refactoring to Java Streams 3 – Does not describe the intended functionality, only that each element is visited. Readers must deduce the actual semantics, such as finding an element or transforming each item, from the loop body. The alternative to external iteration is internal iteration, where instead of controlling the iteration, the client passes an operation to perform to an internal iteration procedure, which applies that operation to the elements in the collection based on the algorithm it implements. Examples of internal iteration patterns include finding an element by a user-provided predicate or transforming each element in a list using a provided transformer. In order to enable internal iteration, Java SE 8 introduces a new abstraction called Stream that lets users process data in a declarative way. The Stream package provides implementations of common internal iteration algorithms such as foreach, find and sort using optimised iteration orders and even concurrency where applicable. Users can thus leverage multicore architectures transparently without having to write multithreaded code. Internal iterations using Stream also explicitly declare the intended functionality through domain-specific algorithms. A call to Java 8 find using a predicate immediately conveys the code’s intent, whereas an externally iterating for loop implementing the same semantics is more difficult to understand. Figures 2 (a) and (b) illustrate this difference for the same find semantics. Finally, external iteration using a for loop violates Thomas’ DRY principle (“Don’t repeat yourself ” [17]) if the intended functionality is available as a Stream template. Internal iteration through Stream thus eliminates code duplication. I n t e g e r r e s u l t = nul l ; L i s t <I n t e g e r > data = getData ( ) ; f o r ( i n t e l : data ) i f ( e l % 2 == 0 ) { result = el ; break ; } (a) L i s t <I n t e g e r > n e w L i s t = getData ( ) ; Optional <I n t e g e r > r e s u l t = l i s t . stream ( ) . f i l t e r ( e l −> e l % 2 ) . findFirst (); (b) Fig. 2: Find element in list with external (a) vs. internal (b) iteration. For illustration, consider the example in Fig. 3 (a). This example uses external iteration to create a new list by multiplying all the positive values in the list list by 2. In this variant of the code, we use a while loop to sequentially process the elements in the list. In Fig. 3 (b), we have re-written the code using streams. This variant of the code does not use a loop statement to iterate through the list. Instead, the 4 Cristina David, Pascal Kesseli, and Daniel Kroening iteration is done internally by the stream. Essentially, we create a stream of Integer objects via Collection .stream(), filter it to produce a stream containing only positive values, and then transform it into a stream representing the doubled values of the filtered list. I t e r a t o r <I n t e g e r > i t= l i s t . i t e r a t o r ( ) ; L i s t <I n t e g e r > n e w L i s t=new A r r a y L i s t <I n t e g e r > ( ) ; while ( i t . hasNext ( ) ) { i n t e l=i t . nex t ( ) . i n t V a l u e ( ) ; i f ( e l > 0) n e w L i s t . add ( 2 ∗ e l ) ; } (a) L i s t <I n t e g e r > n e w L i s t=new A r r a y L i s t <I n t e g e r > ( ) ; n e w L i s t= l i s t . stream ( ) . f i l t e r ( e l −> e l >0) . map( e l −> new I n t e g e r ( 2 ∗ e l ) ) ; . c ollec t ( toList ( ) ) ; return n e w L i s t ; (b) Fig. 3: Filtering and mapping example with external (a) vs. internal (b) iteration. Goal of the paper In this paper, we are interested in refactoring Java code handing collections through external iteration to use streams. Our refactoring procedure is based on the program semantics and makes use of program synthesis. Contributions: – We present a program synthesis based refactoring procedure for Java code that handles collections through external loop iteration. – We have implemented our refactoring method in the tool Kayak. Our experimental results support our conjecture that semantics-driven refactorings are more precise and can handle more complex code scenarios than syntax-driven refactorings. 2 Preliminaries General refactorings As we want to preserve generality, we are interested in refactorings that are correct independent of their context. To motivate our decision, let’s look at the example in Fig. 4. We define a method removeNeg that removes the negative values in the list received as argument, which we later call for the list data. However, given that data contains only positive values, applying removeNeg does not have any effect. Kayak: Safe Semantic Refactoring to Java Streams 5 void removeNeg ( A r r a y L i s t <I n t e g e r > l ) { I t e r a t o r <I n t e g e r > i t = l . i t e r a t o r ( ) ; while ( i t . hasNext ( ) ) i f ( i t . nex t ( ) < 0 ) i t . remove ( ) ; } L i s t <I n t e g e r > data = new A r r a y L i s t < >(); C o l l e c t i o n s . addAll ( data , 1 , 2 , 3 ) ; removeNeg ( data ) ; Fig. 4: Filter example. Thus, for this particular calling context, we could refactor the body of removeNeg to a NO-OP. While this refactoring is correct for the code given in Fig. 4, it may cause problems during future evolution of the code as someone might use it for its original intended functionality (that of removing negative values). As we envision that our refactoring procedure will be used during the development process, we choose to not perform such strict refactorings. 3 Overview of our approach Given an original code Origin, we want to infer the refactored code Stream such that, for any initial program state Si , Origin and Stream produce the same final state, i.e., they are observationally equivalent. We consider a program state to consist of assignments to all the scalar variables plus a heap representation mapping all the Java reference variables to their corresponding heap addresses. Then, starting with a nondeterministic state Si (we use the notation Si =∗), every terminating trace according to the original code must end up in the same state reached by applying the refactored code (we discuss non-terminating behaviours in the last paragraph of Sec. 5). There are two things to be noted here: (1) The initial state only considers variables that are accessed by Origin as opposed to variables that are live at the beginning of Origin (we explain this in more detail in Sec. 3.1.) (2) We overapproximate the context of the initial code in the sense that we may consider more initial states than those reachable at the start of Origin in the user code. As a consequence, we obtain general refactorings (see Sec. 2). Next, we explain the main steps of our refactoring procedure: (i) Given the original code and a nondeterministic initial state as inputs, we generate constraints characterising the post-state Sf of the original code. As Origin contains potentially unbounded loops with external iteration, Sf is not straightforward to compute. We address this by assuming the existence of safety invariants and generating constraints over them. If we consider a generic loop with a pre- and post-state Si and Sf , respectively, guard G and transition relation T : {Si } while(G) T {Sf }, we generate the following constraints showing that any terminating execution starting in a state satisfying Si reaches a state satisfying Sf : ∃Sf , Inv.∀x, x′ .Si (x ) → Inv(x) ∧ (1) ′ ′ Inv(x) ∧ G(x) ∧ T (x, x ) → Inv (x ) ∧ (2) 6 Cristina David, Pascal Kesseli, and Daniel Kroening Inv(x) ∧ ¬G(x) → Sf (x ) (3) In this formula, (1) ensures that the safety invariant holds in any state satisfying Si , (2) checks that the invariant is inductive with respect to the transition relation, i.e. the transition relation maintains the invariant, and (3) ensures that the invariant establishes Sf on exit from the loop. This can be generalised to multiple, potentially nested, loops. The two existentially quantified second-order entities, Sf and Inv, are synthesised in the next step. (ii) We provide the constraints generated at the previous step to our program synthesiser (see Sec. 5), which outputs Sf and the necessary safety invariants. Note that Sf is synthesised such that it assigns all the scalar and reference variables and, the language in which is synthesised only contains operations that directly capture the semantics of the Java Stream interface. Consequently, Sf captures the semantics of the refactored code and Stream can be generated directly from Sf through a one-to-one translation. Essentially, our approach consists of computing the strongest postcondition of the original code in a language capturing the semantics of the Java Stream interface. If we do manage to find such a postcondition, then a refactoring exists and it is guaranteed to be equivalent to the original one by construction. Logical encoding In order to generate the constraints at point (i), we must identify a logical encoding for our analysis, which we use to express Inv and Sf . Our logic must have the ability to express: (1) operations supported by the Java Collection interface, (2) operations supported by the Java Stream interface, as well as (3) equality between collections (for lists this implies that we must be able to reason about both content of lists and the order of elements). For this purpose, we define the Java Stream Theory (JST). Due to lack of space, we only provide an informal presentation of JST in in Fig. 5 containing only the operations used in the examples in the paper. We make use the notion of incomplete collection/list represented by a list segment x→∗ y, i.e., the list starting at the node pointed by x and ending at the node pointed by y. Throughout the paper we take the liberty of referring to collections as lists. Also note that we capture side-effects by explicitly naming the current heap – heap variables h, h′ etc. are being introduced (as a front-end transformation), denoting the heap in which each function is to be interpreted. The mutation operators (e.g. get, add, set, remove) then become pure functions mapping heaps to heaps. 3.1 Discussion on aliasing In the overview of our approach (Sec. 3), when expressing the pre-state at the beginning of Origin, we only consider the variables (and collections) that are accessed by Origin (as opposed to all the live program variables). Thus, one might wonder if there aren’t any side-effects due to aliasing that we are not considering. The answer is no, our approach is safe for reference variables as well as the only two potential aliasing scenarios involving a reference variable p that is not directly used by Origin, which are the following: Kayak: Safe Semantic Refactoring to Java Streams 7 h′ = add(h, x, i, v): obtain h′ from h by inserting value v at position i in the list pointed by x. h′ = add last(h, x, v): equivalent to add(h, x, size(h, x, null), v) h′ = set(h, x, i, v): obtain h′ from h by setting the value of the i-th element in the list pointed by x to v. h′ = f ilter(h, x, y, λv.P (v), ret): obtain h′ from h by creating a new list ret containing all the elements in the list segment x→∗ y that match the predicate P . max(h, x, y): what is the maximum value stored in the list segment x→∗ y? h′ = map(h, x, y, λv.f (v), ret): obtain h′ from h by applying the mapping function f to each value in the list segment x→∗ y and storing the result in the list pointed by ret. h′ = skip(h, x, y, done, n, ret): obtain h′ by creating a new list ret containing the remaining elements of the list segment x→∗ y after discarding the first n elements (done denotes the number of elements that were already skipped). Fig. 5: Informal Description of JST. 1. p points to a collection that is modified by Origin. As the Stream refactoring is going to perform an equivalent transformation in-place, the refactoring will be transparent to p. 2. p is an iterator over a collection accessed by Origin. Then, if Origin modifies the collection, so will Stream, which will result in p being invalidated in both scenarios. Contrary, if Origin does not modify the collection, neither will Stream, and p will not be affected in either one of the cases. Next, we illustrate scenario 1 by considering again method removeNeg in Fig. 4 with the following calling context, where we assume p points to some list and we create an alias p′ of p: A r r a y L i s t <I n t e g e r > p ’ = p ; removeNeg ( p ) ; At a first glance, a potential refactoring for removeNeg is: l = l . stream ( ) . f i l t e r ( e l −> e l >=0) . c ollec t ( toList ( ) ) ; However, this is incorrect when using the refactored function in the calling context mentioned above: While the list p points to is correct, the list pointed by p′ is not updated. Thus, after the call to removeNeg, p will correctly point to the filtered list, whereas p′ will continue pointing to the old unfiltered list. To avoid such situations, we perform refactorings of code that mutates collections in-place. Thus, a correct refactoring for method removeNeg is: A r r a y L i s t <I n t e g e r > copy = new A r r a y L i s t <>( l ) ; l . clear (); copy . stream ( ) . f i l t e r ( e l −> e l >=0) . forEachOrder ed ( l : : add ) ; Here, we first create a copy copy of l. After performing the filtering on copy, we use forEachOrdered , provided by the Stream API, to add each element of the temporary stream back to the list pointed to by l (in the order encountered in the stream). Thus, we are not creating a new list with a new reference, but 8 Cristina David, Pascal Kesseli, and Daniel Kroening using the original one, which makes the refactoring transparent to the rest of the program, regardless of potential aliases. 4 Motivating Examples In this section, we illustrate our refactoring procedure on two examples. First example We start with the one in Fig. 3, where we create a new list by multiplying by 2 each positive value in the list list . As aforementioned, we must first introduce heap variables that capture the side-effects. For this purpose, we will use the following naming convention: the heap before executing the code (i.e., the initial heap for both the original and the refactored code) is called hi . All the other heaps manipulated by the original program have subscript o. I t e r a t o r <I n t e g e r > i t = i t e r a t o r ( h i , l i s t ) ; L i s t <I n t e g e r > n e w L i s t ; h o = new A r r a y L i s t <I n t e g e r >( h i , n e w L i s t ) ; while ( hasNext ( h o , i t ) ) { i n t ( e l , h o ) = nex t ( h o , i t ) . i n t V a l u e ( ) ; i f ( e l > 0) { h o = add last ( h o , newlist , 2 ∗ el );}} For this example, the post-state after the execution of the original code is captured by: Sf (hi , ho , list , newlist ) = ∃list ′ , h′o .h′o =filter (hi , list , null, λv.v > 0, list ′ ) ∧ ho =map(h′o , list ′ , null, λv.2×v, newlist ) The above says that the heap ho generated by the original code is equivalent to the heap generated by applying filter and map to hi . Then, the safety invariant required to prove Sf is identical with Sf with the exception that it considers that the list pointed by list has only been partially processed (up to the iterator it ): Inv(hi , ho , list , newlist , it) = ∃list ′ , h′o .h′o =filter (hi , list, it, λv.v > 0, list′ ) ∧ ho =map(h′o , list′ , null, λv.2×v, newlist )) Note that, as filter only processes the original list up to the iterator, map will consider the whole list generated by filter . As Sf directly captures the stream semantics, from Sf we generate stream code (see Fig 3 (b)). Second example In this example, we illustrate an aggregate refactoring, as well as the importance of checking equivalence between heap states. For this purpose, we use the code below, where we compute the sum of all the elements in the list pointed-to by l, while at the same time removing from the list pointed-to by p a number of elements equal to the size of l. Kayak: Safe Semantic Refactoring to Java Streams 9 I t e r a t o r <I n t e g e r > i t = p . i t e r a t o r ( ) ; i n t sum = 0 ; f o r ( i = 0 ; i <l . s i z e ( ) ; i ++) { sum += l . g e t ( i ) ; i f ( i t . hasNext ( ) ) { i t . nex t ( ) ; i t . remove ( ) ; } } If we were to only verify that the scalar variables after executing the original and the refactored code, respectively, are equal, and omit checking heap equivalence, then the following refactoring would be considered correct: sum = l . stream ( ) . r e d u c e ( 0 , ( a b)−>a+b ) ; This refactoring ignores the modifications performed to list p and only computes the sum of elements in the list pointed-to by l. In our case, we correctly find this refactoring to be unsound as the heap state reached after executing the original code (where p points to a modified list) is not equivalent to the one reached after executing this refactoring (where p points to the unmodified list). Instead, we find the following refactoring, where we correctly capture the mutation of p: sum = l . stream ( ) . r e d u c e ( 0 , ( a b)−>a+b ) ; A r r a y L i s t <I n t e g e r > copy = new A r r a y L i s t <>(p ) ; p. clear (); copy . stream ( ) . s k i p ( l . s i z e ( ) ) . forEachOrder ed ( p : : add ) ; 5 Synthesising Refactorings We compute the postcondition Sf and safety invariants by using a program synthesis engine. Such engines are used increasingly in program verification [10, 29]. Our program synthesiser makes use of Counter-Example Guided Inductive Synthesis (CEGIS) [30] for stream refactoring. We present its general architecture followed by a description of the parts specific to refactoring. General architecture of the program synthesiser The design of our synthesiser is given in Fig. 6 and consists of two phases, Synthesise and Verify. We will illustrate each of these phases by using as running example the first motivational example in Sec. 4. Our goal is to synthesise a solution (Sf , Inv). We start with a vacuous synthesise phase, where we generate a random candidate solution, which we pass to the verify phase. For this example, let’s assume that the random solution says that the heap manipulated by the original code is the same as the initial one (i.e. the original code does not affect the heap): Sf (hi , ho , list, newlist) = ho =hi . In the verify phase, we check whether the candidate solution is indeed a true solution for our synthesis problem (then we are “Done”), or compute a counterexample. We find such a counterexample by building a program Pverif , 10 Cristina David, Pascal Kesseli, and Daniel Kroening Candidate solution Synthesise Verify Done Counterexample UNSAT/ candidate Inputs Program Search UNSAT/ model Candidate P BMC-based Verifier Fig. 6: The refactoring refinement loop. on which we run Bounded Model Checking (BMC) [3]. BMC employs symbolic execution to map program semantics to a SAT instance [8] which verifies our equivalence constraints. If we manage to prove partial correctness of Pverif , then we are done. Otherwise, we provide the counterexample returned by BMC to the synthesise phase. Note that it is sound to use BMC because the program Pverif does not contain loops as it uses loop invariants. For the running example, BMC returns a counterexample with initial heap h′ce where the candidate Sf is not a true postcondition when list contains value 1 (added at position 0 through add (hce , list , 0, 1)): hce = new (hi , list ) ∧ h′ce = add (hce , list, 0, 1). Next, in the synthesise phase, we add the counterexample from the previous phase to Inputs and search for a new candidate solution by constructing a program Psynth on which we run in parallel BMC and a genetic algorithm (GA) to find a new candidate solution that holds for all the Inputs. GA simulates an evolutionary process using selection, mutation and crossover operators. Its fitness function is determined by the number of passed tests. GA maintains a large population of programs which are paired using crossover operation, combining successful program features into new solutions. In order to avoid local minima, the mutation operator replaces instructions by random values at a comparatively low probability. Moreover, we use a biased crossover operation, selecting parents that solve distinct counterexample sets for reproduction. We use the result of either BMC or GA, depending on which one returns first. Again, it is sound to use BMC as the program Psynth does not contain loops. For the running example, BMC returns first with a candidate solution saying that the heap ho after the stream code is the following (for brevity, we omit the invariant which is very similar to Sf ): h′o = filter (hi , list , null, λv.true, list ′ ) ∧h0 = map(h′o , list ′ , null, λv.2×v, newlist ) This solution is almost correct, apart from the filter predicate, which does no actual filtering as the predicate is true. Returning to the verify phase, we find one further counterexample denoting a list with value 0 (which should be filtered out but it isn’t): hce =new (hi , list) ∧ h′ce =add (hce , list, 0, 0). Back in the synthesise phase, this counterexample refines the f ilter predicate, leading to the next solution: h′o = filter (hi , list , null, λv.v 6= 0, list ′ ) ∧ho = map(h′o , list , null, λv.2×v, newlist ) Still not matching the original algorithm, the verify phase provides one final counterexample (a list containing value −2 that should be filtered out, but it isn’t): hce =new (hi , list) ∧ h′ce =add (hce , list, 0, −2) In the final synthesise phase we get the solution provided in Sec. 4. Kayak: Safe Semantic Refactoring to Java Streams 11 Elements specific to stream refactoring In order to use program synthesis for stream refactoring, we required the following: (i) The target instruction set is JST restricted to the stream operations, which requires both the verify and synthesise phases in the program synthesiser to support the JST transformers. JST directly models Java Streams such that, once the synthesiser finds a postcondition Sf , we only require very light processing to generate valid Java Stream code. In particular, this processing involves the stream generation (see examples below). Some examples of the generated stream code are provided below, where the LHS denotes either the post-heap ho or some other scalar variable r captured by Sf (expressed in JST), and the RHS represents the corresponding stream refactoring. For illustration, in the first example, after the synthesiser finds that ho in Sf is h′o =f ilter(hi , l, null, λv.P (v), l′ ), we generate the stream refactoring by adding the stream generation l.stream() before the stream filtering f ilter(λv.P (v)). Note that ≡ stands for reference equality. This means that, as shown in Sec. 3.1, we must generate Java code that modifies the original collection in place. h′o =f ilter(hi , l, null, λv.P (v), l′ ) ⇒ l′ ≡ l.stream().f ilter(λv.P (v)) h0 =sorted(hi , l, null, l′ ) ⇒ l′ ≡ l.stream().sorted() h0 =skip(hi , l, null, k, 0, l′ ) ⇒ l′ ≡ l.stream().skip(k) r=f orall(hi , l, null, λv.P (v)) ⇒ r=l.stream().allM atch(v → P (v)) r=max(h, l, null) ⇒ r=l.stream().max() (ii) The search strategy: we parameterise the solution language, where the main parameter is the length of the solution program, denoted by l. At each iteration we synthesise programs of length exactly l. We start with l = 1 and increment l whenever we determine that no program of length l can satisfy the specification. When we do successfully synthesise a program, we are guaranteed that it is of minimal length since we have previously established that no shorter program is correct. This is particularly useful for our setting, where we are biased towards short refactorings (see Sec. 6.1). Terminating and exceptional behaviour Next, we discuss how our refactoring interacts with non-terminating and exceptional behaviours of the original code. If the original code throws an exception, then the same happens for our modelling, and thus we fail to find a suitable refactoring. The non-terminating behaviour can be due to either iterating over a collection with an unbounded number of elements or to a bug in the code that does not properly advance the iteration through the collection. Regarding the former, we assume that the code to be refactored handles only collections with a bounded number of elements. With respect to the second reason for non-termination, if such a bug exists in the original code, then it will also exist in our modelling. Thus, we will fail to find a suitable refactoring. 12 6 Cristina David, Pascal Kesseli, and Daniel Kroening Experiments Benchmark Selection We provide an implementation of our refactoring decision procedure, which we have named Kayak. We employed the GitHub Code Search to find relevant Java classes that contain integer collections with refactoring opportunities to streams. Kayak currently supports refactorings from Java external iterators to Streams for integer collections only. This limitation is not conceptual, but rather due to our Java front-end based on CBMC [8], which will be extended in future work. The queries were specified conservatively as to not exceed the CBMC front-end capabilities and we manually ruled out search results which cannot be implemented using the Java 8 Stream specification. We used the following search queries on 8/8/2016: – List<Integer>+for+if+break++language%3AJava&type=Code – List<Integer>+while+it+remove&type=Code – List<Integer>+while+add We found 50 code snippets with loops from the results that fit these restrictions. Experimental Setup In order to validate our hypothesis that semantics-driven refactorings are more precise than syntax-driven ones, we compare Kayak against the Integrated Development Environments IntelliJ IDEA 2016.13 and NetBeans 8.24 , as well as against LambdaFicator by Franklin et al. [12]. These tools all provide a “Replace with collect” refactoring, which matches Java code against preconfigured external iteration patterns and transforms the code to a stream expression if they concur. We manually inspect each transformation for both tools to confirm correctness. Since Kayak’s software synthesis can be a time-consuming process, we impose a time limit of 300 s for each benchmark. All experiments were run on a 12-core 2.40 GHz Intel Xeon E5-2440 with 96 GB of RAM. Genetic Algorithm Configuration We implemented a steady state genetic algorithm implementation in CEGIS, whose fitness function is determined by the number of passed tests. We employ a biased crossover operation, selecting parents which solve distinct counterexamples in the CEGIS counterexample set for reproduction. The intent is to have parent refactorings which work for distinct intput sets produce offspring which behave correctly for both input sets. The population size, replacement and mutation rates are configurable and were set to 2000, 15% and 1% respectively for our experimental evaluation. Results Our results show that Kayak outperforms IntelliJ, NetBeans 8.2 and LambdaFicator by a significant margin: Kayak finds 39 out of 50 (78%) possible refactorings, whereas IntelliJ only transforms 10 (20%) and both NetBeans 8.2 and LambdaFicator transform 11 benchmarks (22%) successfully. IntelliJ, NetBeans and LambdaFicator combined find 15 (30%) refactorings. This is due to 3 4 https://www.jetbrains.com/idea/ https://netbeans.org/ Kayak: Safe Semantic Refactoring to Java Streams 13 the fact that there are many common Java paradigms, such as ListIterator or Iterator :: remove, for which none of the tools contain pre-configured patterns and thus have no way of refactoring. The fact that none of the pattern-based tools provide for these situations suggests that it is impractical to try to enumerate every possible refactoring pattern in IDEs. If the pattern-based tools find a solution, they transform the program safely and instantaneously, even in cases where Kayak fails to synthesise a refactoring within the allotted time limit. Where Kayak synthesised a valid refactoring, it did so within an average of 8.5 s. It is worth mentioning that the syntax-driven tools and Kayak complement each other very well in our experiments, which is illustrated by the fact that both approaches combined would have solved 44 out of the 50 refactorings (88%) correctly. Loops which match the expected patterns of syntax-driven tools are handled with ease by such tools, regardless of semantic complexity. Kayak on the other hand abstracts away even stark syntactical differences and recognizes equivalent semantics instead, but is limited by the computational complexity of its static analysis engine. Kayak’s maximum memory usage (heap+stack) was 125MB over all benchmarks according to valgrind massif. We found that the majority of timeouts for Kayak are due to an incomplete instruction set in the synthesis process. We plan to implement missing instructions as the program progresses out of its research prototype phase into an industrial refactoring tool set. A link to all benchmarks used in the experiment is provided in the footnote5 . 6.1 Threats to Validity Our hypothesis is that we have given exemplary evidence that semantics-based refactoring can be soundly applied, are more precise and enable more complex refactoring schemata. As we use program analysis technology, all standard threats to validity in this domain apply here as well; we summarise these only briefly. Selection of benchmarks Our claim relates to “usual” programs written by human programmers, and our results may be skewed by the choice of benchmarks. We address this concern by collecting our benchmarks from GitHub, which hosts a representative and exceptionally large set of open-source software packages. Commercial software may have different characteristics, was not covered by our benchmarks, and thus our claim may not extend to commercial, closed-source software. Furthermore, all our benchmarks are Java programs, and our claim may not extend to any other programming language. We focused our experimental work on the exemplar of refactoring iteration over collections, and our technique may not be more widely applicable. Finally, our Java front-end is still incomplete, only supporting lists of integers and lacking models for many Java system classes. This restricts our selection to a subset of the benchmarks in our GitHub search results, which may be biased in favour of our tool. We will address this issue by extending the front-end to accept additional Java input. 5 https://drive.google.com/open?id=0ByIexo3Z5N91ZlNFZTNpdU5USjQ 14 Cristina David, Pascal Kesseli, and Daniel Kroening Quality of refactorings Refactorings need to generate code that remains understandable and maintainable. Syntax-driven refactoring has good control over the resulting code; the code generated by our semantic method arises from a complex search procedure, and may be difficult to read or maintain. It is difficult to assess how well our technique does with respect to this subjective goal. Firstly, we conjecture that small refactorings are preferable to larger ones (measuring the number of operations). Our method guarantees that we find the shortest possible refactoring due to the way we parameterise and search the space of candidate programs (as described in Sec. 5). It is unclear whether human programmers indeed prefer the shortest possible refactoring. Secondly, our method can exclude refactorings that do not improve readability of the program. For instance, we exclude transformations that include only peek and foreach, which are offered by the Stream API. A refactoring that uses these transformers can be trivially applied to virtually any loop processing a collection in iteration order but is generally undesirable. Finally, we manually inspected the refactorings obtained with our tool and found them to represent sensible transformations. Efficiency and scalability of the program synthesiser We apply heavy-weight program analysis. This implies that our broader claim is threatened by scalability limits of these techniques. The scalability of our particular refactoring procedure is gated by the program synthesiser. While for the majority of our experiments the synthesiser was able to find a solution quickly, there were a few cases where it failed to find one at all. The problem was that the synthesise portion of the CEGIS loop failed to return with a candidate solution. Different instruction sets for the synthesis process can help mitigate this effect. Better syntax-driven refactoring Our hypothesis relates semantics-driven to syntaxdriven refactoring. While we have undertaken every effort to identify and benchmark the existing syntax-driven refactoring methods, there may be means to achieve comparable or better results by improving syntax-driven refactoring. 7 Related Work Program refactoring Cheung et al. describe a system that automatically transforms fragments of application logic into SQL queries [6]. Moreover, similar to our approach, the authors rely on synthesis technology to generate invariants and postconditions that validate their transformations (a similar approach is presented in [19]). The main difference (besides the actual goal of the work, which is different from ours) to our work is that the lists they operate on are immutable and do not support operations such as remove. Capturing the potential side effects caused by such operations is one of our work’s main challenges. Syntax-driven refactoring base program transformation decisions on observations on the program’s syntax tree. Visser presents a purely syntax-driven framework [34]. The presented method is intended to be configurable for specific refactoring tasks, but cannot provide guarantees about semantics preservation. Kayak: Safe Semantic Refactoring to Java Streams 15 The same holds for [9] by Cordy et al., [23] by Sawin et al., [20] by Bae et al. and [7] by Christopoulou et al. In contrast to these approaches, our procedure constructs an equivalence proof before transforming the program. In [15], Gyori et al. present a similar refactoring to ours but performed in a syntax-driven manner. Steimann et al. present Constraint-Based Refactoring in [31], [33] and [32]. Their approach generates explicit constraints over the program’s abstract syntax tree to prevent compilation errors or behaviour changes by automated refactorings. The approach is limited by the information a program’s AST provides and thus favours conservative implementations of syntax-focused refactorings such as Pull Up Field. Fuhrer et al. implement a type constraint system to introduce missing type parameters in uses of generic classes (cf. [13]) and to introduce generic type parameters into classes which do not provide a generic interfaces despite being used in multiple type contexts (cf. [24]). O’Keffe and Cinnéide present search-based refactoring [26, 27], which is similar to syntax-driven refactoring. They rephrase refactoring as an optimisation problem, using code metrics as fitness measure. As such, the method optimises syntactical constraints and does not take program semantics into account. Kataoka et al. interpret program semantics to apply refactorings [21], but use dynamic test execution rather than formal verification, and hence their transformation lacks soundness guarantees. Franklin et al. implement a pattern-based refactoring approach transforming statements to stream queries [16]. Their tool LambdaFicator [12] is available as a NetBeans branch. We compared Kayak against it in our experimental evaluation in Sec. 6. Program synthesis An approach to program synthesis very similar to ours is Syntax Guided Synthesis (SyGuS) [1]. SyGuS synthesisers supplement the logical specification with a syntactic template that constrains the space of allowed implementations. Thus, each semantic specification is accompanied by a syntactic specification in the form of a grammar. Other second-order solvers are introduced in [2, 14]. As opposed to ours, these focus on Horn clauses. 8 Conclusion We conjecture that refactorings driven by the semantics of programs have broader applicability and are able to address more complex refactoring schemata in comparison to conventional syntax-driven refactorings, thereby increasing the benefits of automated refactoring. The space of possible semantic refactoring methods is enormous; as an instance, we have presented a method for refactoring iteration over Java collection classes based on program synthesis methods. Our experiments indicate that refactoring using this specific instance is feasible, sound and sufficiently performant. Future research must broaden the evidence for our general hypothesis by considering other programming languages, further, ideally more complex refactoring schemata, and other semantics-based analysis techniques. 16 Cristina David, Pascal Kesseli, and Daniel Kroening References 1. R. Alur et al. Syntax-guided synthesis. In FMCAD, 2013. 2. T. A. Beyene, C. Popeea, and A. Rybalchenko. Solving existentially quantified Horn clauses. In CAV, LNCS, pages 869–882. Springer, 2013. 3. A. Biere, A. Cimatti, E. M. Clarke, O. Strichman, and Y. Zhu. Bounded model checking. Advances in Computers, 58:117–148, 2003. 4. A. Bouajjani, C. Dragoi, C. Enea, and M. Sighireanu. Accurate invariant checking for programs manipulating lists and arrays with infinite data. In Automated Technology for Verification and Analysis (ATVA), LNCS. Springer, 2012. 5. M. Brain, C. David, D. Kroening, and P. Schrammel. Model and proof generation for heap-manipulating programs. In European Symposium on Programming (ESOP), LNCS, pages 432–452. Springer, 2014. 6. A. Cheung, A. Solar-Lezama, and S. Madden. Optimizing database-backed applications with query synthesis. In Conference on Programming Language Design and Implementation, PLDI, pages 3–14, 2013. 7. A. Christopoulou, E. Giakoumakis, V. E. Zafeiris, and S. Vasiliki. Automated refactoring to the strategy design pattern. Information and Software Technology, 54(11):1202 – 1214, 2012. 8. E. Clarke, D. Kroening, and F. Lerda. A tool for checking ANSI-C programs. In Tools and Algorithms for the Construction and Analysis of Systems, pages 168–176. Springer, 2004. 9. J. R. Cordy, T. R. Dean, A. J. Malton, and K. A. Schneider. Source transformation in software engineering using the TXL transformation system. Information and Software Technology, 44(13):827 – 837, 2002. 10. C. David, D. Kroening, and M. Lewis. Using program synthesis for program analysis. In Logic for Programming, Artificial Intelligence, and Reasoning (LPAR-20), LNCS, pages 483–498. Springer, 2015. 11. M. Fowler. Refactoring: Improving the Design of Existing Code. Addison-Wesley, 1999. 12. L. Franklin, A. Gyori, J. Lahoda, and D. Dig. LAMBDAFICATOR: from imperative to functional programming through automated refactoring. In 35th International Conference on Software Engineering, ICSE ’13, San Francisco, CA, USA, May 18-26, 2013, pages 1287–1290, 2013. 13. R. M. Fuhrer, F. Tip, A. Kiezun, J. Dolby, and M. Keller. Efficiently refactoring java applications to use generic libraries. In ECOOP 2005 - Object-Oriented Programming, 19th European Conference, Glasgow, UK, July 25-29, 2005, Proceedings, pages 71–96, 2005. 14. S. Grebenshchikov, N. P. Lopes, C. Popeea, and A. Rybalchenko. Synthesizing software verifiers from proof rules. In PLDI, pages 405–416, 2012. 15. A. Gyori, L. Franklin, D. Dig, and J. Lahoda. Crossing the gap from imperative to functional programming through refactoring. In ESEC/SIGSOFT FSE, pages 543–553. ACM, 2013. 16. A. Gyori, L. Franklin, D. Dig, and J. Lahoda. Crossing the gap from imperative to functional programming through refactoring. In Proceedings of the 2013 9th Joint Meeting on Foundations of Software Engineering, ESEC/FSE 2013, pages 543–553, New York, NY, USA, 2013. ACM. 17. A. Hunt and D. Thomas. The Pragmatic Programmer: From Journeyman to Master. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 1999. Kayak: Safe Semantic Refactoring to Java Streams 17 18. S. Itzhaky, A. Banerjee, N. Immerman, A. Nanevski, and M. Sagiv. Effectivelypropositional reasoning about reachability in linked data structures. In Computer Aided Verification (CAV), LNCS, pages 756–772. Springer, 2013. 19. M. Iu, E. Cecchet, and W. Zwaenepoel. JReq: Database queries in imperative languages. In Compiler Construction (CC), pages 84–103, 2010. 20. S.-U. Jeon, J.-S. Lee, and D.-H. Bae. An automated refactoring approach to design pattern-based program transformations in Java programs. In Asia-Pacific Software Engineering Conference (APSEC), pages 337–345, 2002. 21. Y. Kataoka, D. Notkin, M. D. Ernst, and W. G. Griswold. Automated support for program refactoring using invariants. In Proceedings of the IEEE International Conference on Software Maintenance (ICSM’01), ICSM ’01. IEEE Computer Society, 2001. 22. J. Kerievsky. Refactoring to patterns. In Extreme Programming and Agile Methods, volume 3134 of LNCS, page 232. Springer, 2004. 23. R. Khatchadourian, J. Sawin, and A. Rountev. Automated refactoring of legacy Java software to enumerated types. In Software Maintenance, 2007. ICSM 2007. IEEE International Conference on, pages 224–233, 2007. 24. A. Kiezun, M. D. Ernst, F. Tip, and R. M. Fuhrer. Refactoring for parameterizing java classes. In 29th International Conference on Software Engineering (ICSE 2007), Minneapolis, MN, USA, May 20-26, 2007, pages 437–446, 2007. 25. P. Madhusudan, G. Parlato, and X. Qiu. Decidable logics combining heap structures and data. In Principles of Programming Languages (POPL), pages 611–622, 2011. 26. M. O’Keeffe and M. Cinnéide. Search-based refactoring: an empirical study. Journal of Software Maintenance and Evolution: Research and Practice, 20(5):345–364, 2008. 27. M. O’Keeffe and M. Cinnéide. Search-based refactoring for software maintenance. Journal of Systems and Software, 81(4):502 – 516, 2008. 28. R. Piskac, T. Wies, and D. Zufferey. Automating separation logic using SMT. In Computer Aided Verification (CAV), LNCS, pages 773–789. Springer, 2013. 29. R. Sharma and A. Aiken. From invariant checking to invariant inference using randomized search. In Computer Aided Verification (CAV), pages 88–105, 2014. 30. A. Solar-Lezama. Program sketching. STTT, 15(5-6):475–495, 2013. 31. F. Steimann. Constraint-based model refactoring. In J. Whittle, T. Clark, and T. Kühne, editors, Model Driven Engineering Languages and Systems: 14th International Conference (MODELS), pages 440–454. Springer, 2011. 32. F. Steimann, C. Kollee, and J. von Pilgrim. A refactoring constraint language and its application to Eiffel. In M. Mezini, editor, ECOOP 2011 – Object-Oriented Programming: 25th European Conference, pages 255–280. Springer, 2011. 33. F. Steimann and J. von Pilgrim. Constraint-based refactoring with Foresight. In J. Noble, editor, ECOOP 2012 – Object-Oriented Programming: 26th European Conference, pages 535–559. Springer, 2012. 34. E. Visser. Program transformation with Stratego/XT. Rules, strategies, tools, and systems in Stratego/XT 0.9. Technical Report UU-CS-2004-011, Department of Information and Computing Sciences, Utrecht University, 2004. A Another motivational example Next, we provide a more involved example where the original code has nested loops. For this purpose we use the code for selection sort in Fig. 7 (a). First, we 18 Cristina David, Pascal Kesseli, and Daniel Kroening introduce the heap variable as shown in Fig. 7 (b). Also, we provide in Fig. 8 more of the JST operations (especially those used by the example that were not provided in Fig. 5). If Inv out and Inv in are the safety invariants for the outer and inner loops, respectively, then the constraints for the outer loop are (we omit the inner loop as it follows directly from the equations (1), (2), (3) in Sec. 2): ∀hi , ho , l, j.∃min, h′o , temp.Invout (hi , ho , l, 0) ∧ (4) (Invout (hi , ho , l, j) ∧ j<(size(ho , l)−1) ∧ (5) Invin (hi , ho , l, size(ho , l), j, min) ∧ (6) temp=get(ho , l, j) ∧ h′o =set(ho , l, j, get(ho , l, min)) ∧ (7) ho =set(h′o , l, min, temp)) ⇒ Invout (hi , ho , l, j+1) ∧ (8) Invout (hi , ho , l, j) ∧ j≥(size(ho , l)−1) ⇒ Sf (hi , ho , l) (9) Constraint (4) says that the outer loop’s invariant must hold in the initial state, constraints (5), (6), (7) and (8) check that Inv out is re-established by the outer loop’s body (by making use of Inv in ), whereas (9) asserts that the Sf postcondition must hold on exit from the outer loop. For this example, we find the following solution: Invout (hi , ho , l, j) = ∃h′o , itj .ho = sorted(h′o , l, itj , l′ ) ∧ h′o = getIterator(ho, l, j, itj ) ∧ max(h′o , l′ , itj )≤min(h′o , itj , null) Invin (hi , ho , l, i, j, min) = ∃h′o , h′′o .(min(h′′o , itj , iti )=min ∧ h′o =getIterator(ho, l, j, itj ) ∧ h′′o =getIterator(ho, l, i, iti )) Sf (hi , ho , l) = ho =sorted(hi , l, null, l) The invariant of the outer loop expresses the fact that the lists l in the original code is sorted until element j. Because our theory JST supports iterator-based sorted predicate (rather than index-based), we need to create iterator itj to the j-th element in the list l. Additionally, the invariant of the outer loop captures the fact that the maximum element in the already sorted portion of list l is at most equal to the minimum element from the portion still to be sorted. The inner loop’s invariant captures the fact that the minimum element in the list segment between the j-th and the i-th element is min (program variable). The postcondition sf captures the fact that list l is sorted in ho . From postcondition Sf we generate the following refactored code, where we modify l in-place by using a local copy. L i s t <I n t e g e r > s o r t i n g ( L i s t <I n t e g e r > l ) { L i s t <I n t e g e r > copy = new L i s t <>( l ) ; l . clear (); copy . stream ( ) . s o r t e d ( ) . forEachOrder ed ( l : : add ) ; } Kayak: Safe Semantic Refactoring to Java Streams void s o r t i n g ( L i s t <I n t e g e r > l ) { i n t min , temp ; f o r ( i n t j = 0 ; j < l . s i z e () −1; j ++) { min = j ; f o r ( i n t i = j +1; i < l . s i z e ( ) ; i ++) i f ( l . g e t ( i )< l . g e t ( min ) ) min = i ; temp = l . g e t ( j ) ; l . s e t ( j , l . g e t ( min ) ) ; l . s e t ( min , temp ) ; } } (a) void s o r t i n g ( L i s t <I n t e g e r > l ) { i n t min , temp ; h o = copyHeap ( h i ) ; f o r ( i n t j = 0 ; j < s i z e ( h o , l ) −1; j ++) { min = j ; f o r ( i n t i = j +1; i < s i z e ( h o , l ) ; i ++) i f ( g e t ( h i , l , i )< l . g e t ( h o , l , min ) ) min = i ; temp = g e t ( h o , l , j ) ; h o ’ = s e t ( h o , l , j , g e t ( h o , l , min ) ) ; h o = s e t ( h o ’ , l , min , temp ) ; } } (b) Fig. 7: Selection sort: (a) original code (b) with explicit heap variables. 19 20 Cristina David, Pascal Kesseli, and Daniel Kroening alias(h, x, y): do x and y point to the same node in heap h? size(h, x, y): what is the length of the list segment from x to y in h? get(h, x, i): what is the value stored in the i-th node of the list pointed by x in heap h? h′ = remove(h, x): obtain h′ from h by removing the node pointed by x. In h′ , x and all its aliases will point to the successor of the removed node. h′ = removeV al(h, x, y, v): obtain h′ from h by removing the node with value v from the list segment x→∗ y. exists(h, x, y, λv.P (v)): is there any value v in the list segment x→∗ y such that P (v) holds? f orall(h, x, y, λv.P (v)): is it the case that for all values v1 . . . vn in the list segment x→∗ y, P (v1 ) . . . P (vn ) hold? h′ = sorted(h, x, y, ret): obtain h′ from h by sorting the elements stored in the list segment x→∗ y in the list ret (h′ will contain both the list segment x→∗ y and the list ret). min(h, x, y): what is the minimum value stored in the list segment x→∗ y? h′ = limit(h, x, y, done, n, ret): obtain h′ by creating a new list ret containing the elements of the list segment x→∗ y, after its length was truncated to n (done denotes the number of elements that were dropped). reduce(h, x, y, v, λa b.f (a, b)): performs a reduction on the elements of the list segment x→∗ y, using the identity value v and the accumulation function f , and returns the reduced value. h′ = concat(h, x, y, a, b, ret): obtain h′ from h by creating a new list ret containing all the elements in the list segment x→∗ y followed by all the elements in the list segment a→∗ b. h′ = copy(h, x, y, ret): obtain h′ by creating a new list ret that contains the elements of the list segment x→∗ y. h′ = new (h, x) obtain h′ from h by assigning x to point to null. equalLists(h, x, y, h′ , a, b) is list segment x→∗ y in heap h equal to list segment a→∗ b in heap h′ (i.e., do they contain the same elements in the same order)? h′ = getIterator(h, x, i, it) obtain heap h′ by creating a new iterator it that points to the i-th element in the list pointed-to by x. Fig. 8: Informal Description of JST (continuation from Fig. 5). B Java Stream Theory We designed JST such that it meets several criteria: 1. Express operations allowed by the Java Collection interface, operations allowed by the Java Stream interface as well as equality between collections (for lists this implies that we must be able to reason about both content of lists and the order of elements). 2. JST must be able to reason about the content and size of partially constructed lists (i.e., list segments), which are required when expressing safety invariants. For illustration, in Fig. 3, the safety invariant captures the fact that hs is obtained from hi by filtering the list segment list→∗ it. 3. JST must enable concise Sf postconditions and invariants as we use program synthesis to infer these. Thus, the smaller they are, the easier to synthesise. To the best of our knowledge, there is no existing logic that meets all the criteria above. The majority of recently developed decidable heap logics are not Kayak: Safe Semantic Refactoring to Java Streams 21 expressive enough (fail points 1 and 2) [4,5,10,18,25,28], whereas very expressive logics such as FOL with transitive closure are not concise and easily translatable to stream code (fail point 3). While our theory is undecidable, we found it works well for our particular use case. Semantics. We first define the model used to interpret JST formulae. The set of reference variables is denoted by P V . Note that, as already mentioned in the paper, these reference variables are those accessed in the code to be refactored (as opposed to all the reference variables in the program). Definition 1 (Heap). A heap over reference variables P V is a tuple H = hG, LP , LD i. G is a graph with vertices V (G) and edges E(G), LP : P V → V (G) is a labelling function mapping each reference variable to a vertex of G and LD : V (G) → D is a labelling function associating each vertex to its data value (where D is the domain of the data values). Given that we are interested in heaps managed by Java Collections, we restrict the class of models to those where each vertex has outdegree 0 or 1 (i.e. we cannot have multiple edges coming out of a node). We assume that the reference variables include a special name null. Function val(h, x) returns the value stored in the node pointed by x, next(h, x) returns a reference to the next node after the one pointed by x and it is defined as the unique vertex such that (x, next(x)) ∈ E(h), and add0(h, e, x) returns the heap obtained by appending element e at the beginning of the list pointed by x. For the latter we provide the pointwise definition: def add0V (h, e, x) = V (h) ∪ {q} where q is a fresh vertex def add0LD (h, e, x) = LD (h)[q 7→ e] def add0E (h, e, x) = E(h) ∪ {(q, LP (h)(x))} The semantics of JST is defined recursively in Fig. 9. Note that functions minimum and maximum return the minimum and maximum between the values receives as arguments, respectively. While in Fig. 9 we provide the semantics for index-based operations (e.g. set(x, y, i, v)), we also support iterator-based ones (e.g. h′ =set(h, it, v) returns the heap obtained by setting the value of the node pointed by it to v in heap h). One important check that we must be able to perform in order to prove equivalence between program states is is that of heap equivalence. In order to define this notion we first assign P V∩ to be the set of reference variables that are used by both the original code and the refactored one (this excludes local variables such as iterators that are used by only one of the codes). Then: Definition 2. Heap h and h′ are equivalent, written as h=h′ , iff the underlying graphs reachable from P V∩ are isomorphic. Intuitively, this means that all the lists in h and h′ pointed-to by the same variable from P V∩ , respectively, are equal. 22 Cristina David, Pascal Kesseli, and Daniel Kroening val(h, x) = LD (h)(x) (10) alias(h, x, y) ⇔ LP (h)(x)=LP (h)(y) (11) i=0 get(h, x, i)=val(h, x) (12) i>0 get(h, x, i)=get(h, next(h, x), i−1) (13) alias(h, x, y) size(h, x, y) = 0 (14) ¬alias(h, x, y) size(h, x, y) = 1+size(h, next(h, x), y) (15) alias(h, x, y) max (h, x, y) = −∞ (16) alias(h, x, y) min(h, x, y) = ∞ (17) alias(h, x, y) exists(h, x, y, λv.P (v)) = f alse (18) alias(h, x, y) forall(h, x, y, λv.P (v)) = true (19) h′ = copy(h, x, null, l) add(h, x, 0, v)=add0(h′ , v, l) (20) h′ = copy(h, next(h, x), null, l) set(h, x, 0, v)=add0(h′ , v, l) (21) halias(h1 , x, y) ∧ alias(h2 , a, b) equalLists(h1 , x, y, h2 , a, b) = true (22) alias(h1 , x, y) ∧ ¬alias(h2 , a, b) equalLists(h1 , x, y, h2 , a, b) = f alse (23) ¬halias(h1 , x, y) ∧ alias(h2 , a, b) equalLists(h1 , x, y, h2 , a, b) = f alse (24) Fig. 9: Inference rules for Java Collection Theory. Kayak: Safe Semantic Refactoring to Java Streams 23 alias(h, x, y) ∧ h′ =h[Lp (h′ )=LP (h) ∪ {ret 7→ null}] copy(h, x, y, ret)=h′ (25) ¬alias(h, x, y) ∧ h′ = copy(h, next(h, x), y, ret) copy(h, x, y, ret)=add0(h′ , val(h, x), ret) (26) i > 0 ∧ h′ = add(h, next(h, x), i−1, v) add(h, x, i, v)=add0(h′ , val(h, x), next(h′ , x)) (27) i > 0 ∧ h′ = set(h, next(h, x), i−1, v) set(h, x, i, v)=add0(h′ , val(h, x), next(h′ , x)) (28) alias(h, x, y) ∧ h′ =h[Lp (h′ )=LP (h)∪{ret7→null}] map(h, x, y, λv.f (v), ret)=h′ (29) ¬alias(h, x, y) ∧ h′ =map(h, next(h, x), y, λv.f (v), ret) map(h, x, y, λv.f (v), ret) = add 0(h′ , f (val(h, x)), ret) (30) alias(h, x, y)∧h′ =h[Lp (h′ )=LP (h)∪{ret7→null}] skip(h, x, y, done, n, ret)=h′ (31) ¬alias(h, x, y) ∧ n>0 skip(h, x, y, done, n, ret)=skip(h, next(h, x), y, done+1, n−1, ret) (32) ¬alias(h, x, y) ∧ n=0 ∧ h′ =h[Lp (h′ )=LP (h)∪{ret7→LP (h)(x)}] skip(h, x, y, done, n, ret)=h′ (33) alias(h, x, y) ∧ h′ =h[Lp (h′ )=LP (h)∪{ret7→null}] filter (h, x, y, λv.P (v), ret)=h′ (34) ¬alias(h, x, y) ∧ ¬P (val(h, x)) filter (h, x, y, λv.P (v), ret)=filter (h, next(h, x), y, λv.P (v), ret) (35) ¬alias(h, x, y) ∧ P (val(h, x)) ∧ h′ =filter (h, next(h, x), y, λv.P (v), ret) filter (h, x, y, λv.P (v), ret) = add 0(h′ , val(h, x), ret) (alias(h, x, y) ∨ n=0) ∧ h′ =h[Lp (h′ )=LP (h)∪{ret7→null}] limit(h, x, y, done, n, ret)=h′ ¬alias(h, x, y) ∧ n>0 ∧ h′ =limit(h, next(h, x), y, done+1, n−1, ret) limit(h, x, y, done, n, ret)=add0(h′ , val(h, x), ret) Fig. 9: Inference rules for Java Collection Theory. (36) (37) (38) 24 Cristina David, Pascal Kesseli, and Daniel Kroening alias(h, x, y) ∧ h′ =h[Lp (h′ )=LP (h)∪{ret7→null}] sorted(h, x, y, ret) = h′ ¬alias(h′ , x, y) ∧ h′ =sorted(removeV al(h, x, y, min(h, x, y)), x, y, ret) sorted(h, x, y, ret) = add0(h′ , min(h, x, y), ret) (39) (40) ¬alias(h, x, y) max (h, x, y) = maximum(P (val(h, x)), max (h, next(h, x), y)) (41) ¬alias(h, x, y) min(h, x, y) = minimum(P (val(h, x)), min(h, next(h, x), y)) (42) ¬alias(h, x, y) exists (h, x, y, λv.P (v)) ⇔ P (val(h, x)) ∨ exists (h, next(h, x), y, λv.P (v)) (43) ¬alias(h, x, y) forall(h, x, y, λv.P (v)) ⇔ P (val(h, x)) ∧ forall (h, next(h, x), y, λv.P (v)) (44) alias(h, x, y) reduce(h, x, y, v, λa b.f (a, b)) = v (45) ¬alias(h, x, y) reduce(h, x, y, v, λa b.f (a, b)) = f (v, reduce(h, next(h, x), y, v, λa b.f (a, b))) (46) ¬alias(h1 , x, y) ∧ ¬alias(h2 , a, b) (47) val(h1 , x) == val(h2 , a) ∧ equalLists(h1 , next(h1 , x), y, h2 , next(h2 , a), b) Fig. 9: Inference rules for Java Collection Theory. Kayak: Safe Semantic Refactoring to Java Streams 25 Set collections For our refactoring procedure, we use lists as the internal representation for collections denoting sets, meaning that we impose an order on the elements of sets. While we may miss some refactorings, this procedure is sound: if two collections are equal with respect to some ordering, they are also equal when no order is imposed.
6cs.PL
HYPERBOLICITY AND CUBULABILITY ARE PRESERVED UNDER ELEMENTARY EQUIVALENCE SIMON ANDRÉ arXiv:1801.09411v1 [math.GR] 29 Jan 2018 Abstract. The following properties are preserved under elementary equivalence, among finitely generated groups: being hyperbolic (possibly with torsion), being hyperbolic and cubulable, and being a subgroup of a hyperbolic group. In other words, if a finitely generated group G has the same first-order theory as a group possessing one of the previous property, then G enjoys this property as well. 1. Introduction In the middle of the twentieth century, Tarski asked whether all non-abelian finitely generated free groups satisfy the same first-order theory. In [Sel06], Sela answered Tarski’s question in the positive (see also the work of Kharlampovich and Myasnikov, [KM06]) and provided a complete characterization of finitely generated groups with the same first-order theory as the free group F2 . Sela extended his work to give in [Sel09] a classification of torsion-free hyperbolic groups up to elementary equivalence. In addition, Sela proved the following striking theorem (see [Sel09], Theorem 7.10). Theorem 1.1 (Sela). A finitely generated group with the same first-order theory as a torsion-free hyperbolic group is itself torsion-free hyperbolic. Recall that a finitely generated group is called hyperbolic (in the sense of Gromov) if its Cayley graph (with respect to any finite generating set) is a hyperbolic metric space: there exists a constant δ > 0 such that any geodesic triangle is δ-slim, meaning that any point that lies on a side of the triangle is at distance at most δ from the union of the two other sides. At first glance, there doesn’t seem to be any reason that hyperbolicity is preserved under elementary equivalence. Sela’s theorem above is thus particularly remarkable, and it is natural to ask whether it remains valid if we allow hyperbolic groups to have torsion. We answer this question positively. Theorem 1.2. A finitely generated group with the same first-order theory as a hyperbolic group is itself hyperbolic. More precisely, if Γ is a hyperbolic group and G is a finitely generated group such that Th∀∃ (Γ) = Th∀∃ (G) (meaning that Γ and G satisfy the same first-order sentences of the form ∀x1 . . . ∀xm ∃y1 . . . ∃yn ϕ(x1 , . . . , xm , y1 , . . . , yn ), where ϕ is quantifier-free), then G is hyperbolic. Furthermore, we show that being a subgroup of a hyperbolic group is preserved under elementary equivalence, among finitely generated groups. More precisely, we prove the following theorem. Theorem 1.3. Let Γ be a group that embeds into a hyperbolic group, and let G be a finitely generated group. If Th∀∃ (Γ) ⊂ Th∀∃ (G), then G embeds into a hyperbolic group. Recall that CAT(0) cube complexes are a particular class of CAT(0) spaces (see [Sag14] for an introduction) and that a group is called cubulable if it admits a proper and cocompact action by isometries on a CAT(0) cube complex. Groups which are both hyperbolic and cubulable have remarkable properties and play a leading role in the proof of the virtually Haken conjecture (see [Ago13]). By using a result of Hsu and Wise, we prove: Theorem 1.4. Let Γ be a hyperbolic group and G a finitely generated group. Suppose that Th∀∃ (Γ) = Th∀∃ (G). Then Γ is cubulable if and only if G is cubulable. 1 2 Some remarks. Note that, in Theorem 1.3, we do not need to assume that Γ is finitely generated. In contrast, in the theorems above, it is impossible to remove the assumption of finite generation on G. For instance, Szmielew proved in [Szm55] that Z and Z × Q have the same first-order theory. Note also that it is not sufficient to assume that Γ and G satisfy the same universal sentences, i.e. of the form ∀x1 . . . ∀xm ϕ(x1 , . . . , xm ), where ϕ is quantifier-free. For example, the class of finitely generated groups satisfying the same universal sentences as F2 appears to coincide with the well-known class of non-abelian limit groups, also known as finitely generated fully residually free non-abelian groups, and this class contains some non-hyperbolic groups, such as F2 ∗ Z2 . In Theorem 1.3 above, in the special case where Γ is a free group, we can prove that G is hyperbolic. Indeed, Sela proved in [Sel01] that a limit group is hyperbolic if it does not contain Z2 , and this holds for a finitely generated group G such that Th∀∃ (F2 ) ⊂ Th∀∃ (G) (see 2.17). More generally, Sela’s result remains true if we replace F2 by a finitely generated locally hyperbolic group Γ (that is, every finitely generated subgroup of Γ is hyperbolic). If Γ is such a group, it turns out that the hyperbolic group built in the proof of Theorem 1.3, in which G embeds, is in fact locally hyperbolic. So G is locally hyperbolic as well. As a consequence, the following theorem holds. Theorem 1.5. Let Γ be a finitely generated locally hyperbolic group, and let G be a finitely generated group. If Th∀∃ (Γ) ⊂ Th∀∃ (G), then G is a locally hyperbolic group. In the rest of the introduction, we give some details about the proofs of the previous theorems. Strategy of proof. In the language of groups, a system of equations in n variables is a conjunction of formulas of the form w(x1 , . . . , xn ) = 1, where w(x1 , . . . , xn ) stands for an element of the free group F (x1 , . . . , xn ). Given a group Γ, a finite system of equations Σ(x1 , . . . , xn ) = 1 admits a non-trivial solution in Γn if and only if Γ satisfies the first-order sentence ∃x1 . . . ∃xn (Σ(x1 , . . . , xn ) = 1) ∧ ((x1 6= 1) ∨ . . . ∨ (xn 6= 1)), if and only if there exists a non-trivial homomorphism from GΣ to Γ, where GΣ = hs1 , . . . , sn | Σ(s1 , . . . , sn )i. Hence, the study of the set Hom(GΣ , Γ), for any (finite) system of equations Σ, is a first step towards understanding the whole first-order theory of the group Γ. In the case where Γ is a torsion-free hyperbolic group, Sela proved that there is a finite description of the set Hom(G, Γ) (called the Makanin-Razborov diagram), for any finitely generated group G. His work has subsequently been generalized by Reinfeldt and Weidmann to the case of a hyperbolic group possibly with torsion. Below is the basis of this description (see Theorems 2.2 and 2.5 for completeness). Theorem 1.6 (Sela, Reinfeldt-Weidmann). Let Γ be a hyperbolic group, and let G be a finitely generated one-ended group. There exists a finite set F ⊂ G \ {1} such that, for every non-injective homomorphism f ∈ Hom(G, Γ), there exists a modular automorphism σ of G such that ker(f ◦ σ) ∩ F 6= ∅. The modular group of G, denoted by Mod(G), is a subgroup of Aut(G) defined by means of the JSJ decomposition of G (see Section 2.5 for details). Its main feature is that each modular automorphism acts by conjugation on every non-abelian rigid vertex group of the JSJ decomposition of G. This theorem will be our starting point. First, we will consider a particular case. Let G = hs1 , . . . , sn | Σ(s1 , . . . , sn )i be a finitely presented one-ended group, and let Γ be a hyperbolic group. Assume that Th∀ (Γ) = Th∀ (G) (that is, Γ and G satisfy the same universal sentences). Suppose in addition that G is a rigid group (meaning that G does not split non-trivially over a virtually abelian group). Then the modular group of G coincides with the group of inner automorphisms. As a consequence, Theorem 1.6 provides us with a finite set F = {w1 (s1 , . . . , sn ), . . . , wk (s1 , . . . , sn )} ⊂ G \ {1} such that every non-injective homomorphism f ∈ Hom(G, Γ) kills an element of F . We claim that G embeds into Γ. 3 Otherwise, every homomorphism from G to Γ kills an element of F ; in other words, the group Γ satisfies the following first-order sentence: ∀x1 . . . ∀xn (Σ(x1 , . . . , xn ) = 1) ⇒ ((w1 (x1 , . . . , xn ) = 1) ∨ . . . ∨ (wk (x1 , . . . , xn ) = 1)). Since Th∀ (Γ) = Th∀ (G), this sentence is true in G as well. Taking x1 = s1 , . . . , xn = sn , the previous sentence means that an element of F is trivial, contradicting the fact that F ⊂ G \ {1}. So we have proved that G embeds into Γ. At this stage, we cannot conclude that G is hyperbolic, because hyperbolicity is not inherited by finitely presented subgroups (see [Bra99]). However, assuming that the group Γ is rigid as well, we can prove in the same way that Γ embeds into G (before doing so, it is necessary to observe that Theorem 1.6 is still valid for subgroups of hyperbolic groups, see Corollary 2.4). Let us summarize the previous discussion: given a rigid hyperbolic group Γ and a rigid finitely presented group G, we have shown that if Th∀ (Γ) = Th∀ (G), then G and Γ are isomorphic. In the case where G is not finitely presented anymore, but only finitely generated, this result remains true because hyperbolic groups are equationally noetherian, which means that, for any infinite system of equations Σ(x1 , . . . , xn ) = 1, there exists a finite subsystem Σ0 (x1 , . . . , xn ) = 1 such that Σ and Σ0 have exactly the same solutions in Γn (see [RW14]). What happens when G is not assumed to be rigid anymore ? In this case, the modular group Mod(G) is in general infinite, and we cannot fully express Theorem 1.6 by means of first-order logic, since the power of expression of first-order logic is not sufficient to express precomposition by an automorphism. The challenge is to express some fragments of Theorem 1.6 that are enough to capture the hyperbolicity (or cubulability) of Γ and prove the hyperbolicity of G in turn. To do so, we shall follow a strategy comparable with that used by Perin in [Per11]. If G does not embed into Γ, the idea is to consider the following immediate corollary of Theorem 1.6: for every homomorphism f : G → Γ, there exists a homomorphism f 0 : G → Γ that kills an element of F and that coincides with f in restriction to each non-abelian rigid vertex group of the JSJ splitting of G, up to conjugacy by an element of Γ. One can easily see that this statement is expressible by a first-order sentence satisfied by Γ (see Section 3.2 for details). Since Γ and G are elementarily equivalent, this sentence is satisfied by G as well. Now, taking for f the identity of G, we get a special homomorphism f 0 that kills an element of F and coincides with the identity, up to conjugacy, in restriction to each nonabelian rigid vertex group of the JSJ splitting of G. In the torsion-free case, an important part of the work consists in transforming f 0 into a retraction, which leads to the notion of a hyperbolic tower in the sense of Sela. In the presence of torsion, there are new difficulties and we do not know how to get a retraction (see further details below). This leads to the notion of a quasi-tower (that we introduce in Section 5), which is more complicated than the notion of a hyperbolic tower. The torsion-free case. The proof that hyperbolicity and cubulability are first-order invariants among torsion-free finitely generated groups is based on the following result proved by Sela in [Sel09] (though it is not explicitly stated). Theorem 1.7 (Sela). Let Γ be a non-elementary torsion-free hyperbolic group, and let G be a finitely generated group with the same first-order theory as Γ. There exist a subgroup Γ0 of Γ and a subgroup G0 of G such that: • Γ0 and G0 are isomorphic; • Γ is a hyperbolic tower over Γ0 ; • G is a hyperbolic tower over G0 . 4 Hyperbolic towers have been introduced by Sela in [Sel01] (see Definition 6.1) to solve Tarski’s problem about the elementary equivalence of free groups (see also Kharlampovich and Myasnikov’s NTQ groups). More generally, Sela used towers in [Sel09] to classify those finitely generated groups with the same first-order theory as a given torsion-free hyperbolic group. Roughly speaking, a hyperbolic tower is a group obtained by successive addition of hyperbolic floors, and a hyperbolic floor is a group obtained by gluing a retracting surface to another group (see Example 1.8 below). We refer the reader to [Per11] for a precise definition of hyperbolic towers. Example 1.8. Let Σ be a surface with boundary (with Euler characteristic at most -2, or a punctured torus). Denote by S its fundamental group and by B1 , . . . , Bn its boundary subgroups (well-defined up to conjugacy). Let H be a group and let h1 , . . . , hn be elements of H of infinite order. We define a graph of groups with two vertices labelled by S and H, and n edges between them identifying Bi with hhi i for each 1 ≤ i ≤ n. Call G the fundamental group of this graph of groups. We say that G is a hyperbolic floor over H if there exists a retraction r : G → H (such that r(S) is non-abelian). Figure 1. The group G is a hyperbolic floor over H in the sense of Sela. In the previous example, if G is hyperbolic, then H is hyperbolic, as a retract of G. Conversely, if H is hyperbolic, it follows from the Bestvina-Feighn combination theorem (see [BF92]) that G is hyperbolic as well. As a consequence, since a hyperbolic tower is a group obtained by successive addition of hyperbolic floors, the following holds: if a group G is a hyperbolic tower over a group H, then G is hyperbolic if and only if H is hyperbolic. In the same way, using a combination theorem proved by Hsu and Wise (see [HW15]), we can prove: if a group G is a hyperbolic tower over a group H, then G is hyperbolic and cubulable if and only if H is hyperbolic and cubulable. Now, the fact that hyperbolicity and cubulability are first-order invariants (among torsion-free finitely generated groups) follows immediately from Theorem 1.7. Figure 2. The group G is a hyperbolic tower over G0 in the sense of Sela. 5 A new phenomenon arising from the presence of torsion. To give a flavour of the influence of torsion, let us briefly describe a new phenomenon, which occurs only in the presence of torsion. In the case of torsion-free groups, performing a HNN extension over a finite group is the same as doing a free product with Z, and it is well-known that if G is a torsion-free non-elementary hyperbolic group, then G and G ∗ Z have the same universal theory (and even the same first-order theory, as a consequence of the work of Sela). By contrast, it turns out that the situation is very different in the presence of torsion: in general, performing a HNN extension over a finite subgroup, even trivial, modifies the universal theory of a hyperbolic group. Let us consider the following simple example: Example 1.9. Let G = F2 × Z/2Z. Then the sentence ∀x∀y (x2 = 1) ⇒ (xy = yx) is satisfied by G, but not by G ∗ Z. This example shows that, in general, the class of groups with the same universal theory as a given hyperbolic group with torsion is not closed under HNN extensions and amalgams over finite groups. In Section 4, we deal with this problem by proving the following result. Theorem 1.10. Every hyperbolic group Γ embeds into a hyperbolic group Γ possessing the property that the class of Γ-limit groups is closed under amalgamated free products and HNN extensions over finite groups. We will see that this result plays an important role in our proofs. Quasi-towers. In order to prove our main theorems, we aim to generalize Theorem 1.7 to the case where Γ is a hyperbolic group possibly with torsion (see Theorem 6.8). When looking for a generalization of hyperbolic towers in the presence of torsion, we are brought to perform HNN extensions over finite groups, and this leads to new difficulties, as illustrated by Example 1.9 above. In Section 5 we introduce quasi-floors and quasi-towers. It is important to stress that quasi-towers are more complicated than hyperbolic towers in the sense of Sela, the major complication being that if a group G is a quasi-floor over a group H, then H is neither a subgroup, nor a quotient of G. Roughly speaking, a quasi-tower is a group obtained by successive addition of quasi-floors, and Figure 1.6 below illustrates what a quasi-floor is. Figure 3. The group G is a quasi-floor over H. The groups A and B are one-ended, and F is finite. There exist a homomorphism r : G → H, maybe not surjective, and a homomorphism j : H → G, maybe not injective. However, r can be viewed as a "piecewise retraction", and j can be viewed as a "piecewise inclusion". Indeed, r ◦ j is inner on A and B, and j is injective on A, B and F . The groups G and H are subgroups of a bigger group G0 that retracts onto H via an epimorphism ρ : G0 → H such that ρ|G = r. Let us say a few words about the proof of Theorem 1.7, which we aim to generalize. Let Γ be a torsion-free hyperbolic group, and let G be a finitely generated group with the same first-order theory as Γ. First-order logic provides us with a sequence of hyperbolic floors G = G0  G 1  · · ·  G n  · · · , r1 r2 rn 6 and this sequence is necessarily finite thanks to the descending chain condition 2.7 for Γ-limit groups. In the presence of torsion, we cannot use this theorem straightaway for two reasons: • if a group G is a quasi-floor over a group H, the homomorphism r : G → H associated with the quasi-floor structure is maybe not surjective, • and Th∀ (G) is not equal to Th∀ (H) in general, since the first-order theory with one quantifier is sensitive to amalgams and HNN extensions over finite groups (see Example 1.9). This second difficulty will be resolved by means of Theorem 1.10. The problem of nonsurjectivity of r will be solved by proving that if G = G 0 → G1 → · · · → Gn → · · · r1 r2 rn is a sequence of quasi-floors, there exists a subgroup Hn < Gn , for each n, such that the restriction of rn to Hn is an epimorphism onto Hn+1 . Acknowledgements. I am very grateful to my advisor Vincent Guirardel for his help, and for the time he spent carefully reading previous versions of this paper. I would also like to thank Chloé Perin for a talk she gave at "Session états de la recherche de la SMF", where she explained the proof of Theorem 1.1. It has been an important source of inspiration. Contents 1. Introduction 2. Preliminaries 3. How to extract information from the JSJ using first-order logic 4. Torsion-saturated groups 5. Quasi-floors and quasi-towers 6. Proofs of the theorems 6.1. How to build a quasi-floor using first-order logic 6.2. Being a subgroup of a hyperbolic group is a first-order invariant 6.3. Being hyperbolic is a first-order invariant 6.4. Being hyperbolic and cubulable is a first-order invariant 7. From a preretraction to a quasi-floor References 1 6 16 20 23 29 29 31 31 34 35 43 2. Preliminaries In this section we recall some facts and definitions about the elementary theory of groups, Γ-limit groups, K-CSA groups, JSJ decompositions. We also prove some results that will be useful in the sequel, and whose proofs are independent from the main body of the paper. 2.1. The elementary theory of groups. For detailed background, we refer the reader to [Mar02]. A first-order formula in the language of groups is a finite formula using the following symbols: ∀, ∃, =, ∧, ∨, ⇒, 6=, 1 (standing for the identity element), −1 (standing for the inverse), · (standing for the group multiplication) and variables x, y, g, z . . . which are to be interpreted as elements of a group. A variable is free if it is not bound by any quantifier ∀ or ∃. A sentence is a formula without free variables. Given a formula ϕ(x1 , . . . , xp ) with p ≥ 0 free variables, and p elements g1 , . . . , gp of a group G, we say that ϕ(g1 , . . . , gp ) is satisfied by G if its interpretation is true in G. This is denoted by G |= ϕ(g1 , . . . , gp ). 7 The elementary theory of a group G, denoted by Th(G), is the collection of all sentences which are true in G. The universal-existential theory of G, denoted by Th∀∃ (G), is the collection of sentences true in G which are of the form ∀x1 . . . ∀xp ∃y1 . . . ∃yq ϕ(x1 , . . . , xp , y1 , . . . , yq ) where p, q ≥ 1 and ϕ is a quantifier-free formula with p + q free variables. In the same way, we define the universal theory of G, denoted by Th∀ (G), and its existential theory Th∃ (G). 2.2. Γ-limit groups. Let Γ and G be two groups. We say that G is fully residually Γ if, for every finite subset F ⊂ G, there exists a homomorphism f : G → Γ whose restriction to F is injective. If G is countable, then G is fully residually Γ if and only if there exists a sequence (fn ) of homomorphisms from G to Γ such that, for every non-trivial element g ∈ G, fn (g) is non-trivial for every n large enough. Such a sequence is called a discriminating sequence. Γ-limit groups have been introduced by Sela in [Sel09] to study Hom(G, Γ), where Γ stands for a torsion-free hyperbolic group, and G stands for a finitely generated group. Sela proved that Γ-limit groups are exactly those finitely generated fully residually Γ groups. Reinfeldt and Weidmann generalized this result when Γ is hyperbolic possibly with torsion and, more generally, when Γ is equationally noetherian (see [RW14]). The following easy proposition builds a bridge between group theory and first-order logic. Proposition 2.1. Let G and Γ be finitely generated groups. Suppose that G is finitely presented or that Γ is equationally noetherian. Then G is fully residually Γ if and only if Th∀ (Γ) ⊂ Th∀ (G). The proofs of our main results rely essentially on the following four theorems, proved by Sela for torsion-free hyperbolic groups and later generalized by Reinfeldt and Weidmann to the case of hyperbolic groups possibly with torsion. Theorem 2.2 (Sela, Reinfeldt-Weidmann). Let Γ be a hyperbolic group and let G be a oneended finitely generated group. There exist non trivial elements g1 , . . . , gk of G such that, for every non-injective homomorphism f : G → Γ, there exist a modular automorphism σ ∈ Mod(G) and an integer 1 ≤ ` ≤ k such that f ◦ σ(g` ) = 1. Remark 2.3. In the case where G is not a Γ-limit group, the result is obvious. The modular group Mod(G) is a subgroup of Aut(G) that will be defined in Section 2.5.2, by means of the JSJ decomposition. The following easy corollary will be useful in the sequel. Corollary 2.4. Let Γ be a group that embeds into a hyperbolic group, and let G be a oneended finitely generated group. There exist non trivial elements g1 , . . . , gk of G such that, for every non-injective homomorphism f : G → Γ, there exist a modular automorphism σ ∈ Mod(G) and an integer 1 ≤ ` ≤ k such that f ◦ σ(g` ) = 1. Proof. Denote by i an embedding of Γ into a hyperbolic group Ω. By the previous theorem, there exist non trivial elements g1 , . . . , gk of G such that every non-injective homomorphism from G to Ω kills some g` , up to precomposition by a modular automorphism. If f : G → Γ is a non-injective homomorphism, then i ◦ f is non-injective as well, so i ◦ f ◦ σ(g` ) = 1 for some 1 ≤ ` ≤ k and some σ ∈ Mod(G). Since i is injective, we have f ◦ σ(g` ) = 1.  For every γ ∈ Γ, we write ιγ for the inner automorphism x 7→ γxγ −1 . Theorem 2.5 (Sela, Reinfeldt-Weidmann). Let Γ be a hyperbolic group and let G be a oneended finitely generated group. Suppose that G embeds into Γ. Then there exists a finite set {ϕ1 , . . . , ϕ` } of monomorphisms from G into Γ such that, for every monomorphism 8 f : G → Γ, there exist a modular automorphism σ ∈ Mod(G), an integer 1 ≤ ` ≤ k and an element γ ∈ Γ such that f = ιγ ◦ ϕ` ◦ σ. Remark 2.6. In contrast with Theorem 2.2, the previous theorem does not extend to the case where Γ is a subgroup of a hyperbolic group. Theorem 2.7 (Sela, Reinfeldt-Weidmann). Let Γ be a hyperbolic group. Let (Gn ) be a sequence of Γ-limit groups. If (fn : Gn → Gn+1 ) is a sequence of epimorphisms, then fn is an isomorphism for n sufficiently large. Theorem 2.8 (Sela, Reinfeldt-Weidmann). Let Γ be a hyperbolic group and G a Γ-limit group. Then every abelian subgroup of G is finitely generated. In the next section, we shall prove the following proposition, which is a consequence of the theorem above. Proposition 2.9. Let Γ be a hyperbolic group and G a finitely generated group. Suppose that Th∀∃ (Γ) ⊂ Th∀∃ (G). Then every abelian subgroup of G is virtually cyclic. But before proving this proposition, we need to define K-CSA groups. 2.3. Virtual cyclicity of abelian subgroups. 2.3.1. K-CSA groups. A group is said to be CSA if its maximal abelian subgroups are malnormal. It is well-known that every torsion-free hyperbolic group is CSA. However, it is not true anymore in the presence of torsion. To overcome this problem, Guirardel and Levitt defined K-CSA groups in [GL16] (Definition 9.7). Definition 2.10. A group G is called a K-CSA group (where K > 0) if the following conditions hold: • every finite subgroup of G has order bounded by above by K (hence, an element g has infinite order if and only if g K! 6= e); • every element g of infinite order is contained in a unique maximal virtually abelian subgroup of G, denoted by M (g). Moreover M (g) is K-virtually torsion-free abelian (i.e. M (g) has a torsion-free abelian subgroup of index less than K); • M (g) is equal to its normalizer. We recall some useful facts about K-CSA groups. The proofs can be found in [GL16]. Proposition 2.11. Every hyperbolic group is K-CSA for some K > 0. Proposition 2.12. Let G be a K-CSA group. (1) If g, h ∈ G have infinite order, the following conditions are equivalent: (a) M (g) = M (h). (b) g K! and hK! commute. (c) hg, hi is virtually abelian. (2) Let H be an infinite virtually abelian subgroup of G. Then H is contained in a unique maximal virtually abelian subgroup of G, denoted by M (H). This group is almost malnormal: if M (H)g ∩ M (H) is infinite, then g belongs to M (H). Moreover, for every element h of H of infinite order, M (H) = M (h). Proposition 2.13. Let G be a K-CSA group and g an element of G of infinite order. The subgroup M (g) is definable without quantifiers with respect to g. In other words, there exists a first-order formula ψK (x, y) without quantifiers such that M (g) = {h ∈ G | ψK (h, g)}. 9 Proof. First, let us remark that M (g) = {h ∈ G | hg, hi is K-virtually abelian}. Indeed, if hg, hi is K-virtually abelian, then hg, hi ⊂ M (g) by maximality of M (g). Conversely, if h ∈ M (g) then hg, hi is a subgroup of M (g), which is K-virtually abelian, so hg, hi is K-virtually abelian. We now prove that there exists a first-order formula ψK (x, y) with two free variables such that hg, hi is K-virtually abelian if and only if ψK (g, h) is true in G. Let π : F2 = hx, yi → G be the epimorphism sending x to g and y to h. If A is a subgroup of hg, hi of index less than K, there exists a subgroup B of hx, yi of index less than K such that A = π(B). Denote by H1 , . . . , Hn the n subgroups of F2 , of index ≤ K. For each 1 ≤ i ≤ n, let (wi,j (x, y))1≤j≤ni be a finite generating set of Hi . We can define ψK (g, h) by ni ^ ni n ^ _ ψK (g, h) = [wi,k (g, h), wi,` (g, h)] = 1. i=1 k=1 `=1  One can prove that the property K-CSA is defined by a set of universal formulas (see [GL16], Proposition 9.9). Since every hyperbolic group is K-CSA for some K > 0 (see above), the following holds: Proposition 2.14. Let Γ be a hyperbolic group. There exists a constant K > 0 such that every Γ-limit group is K-CSA. 2.3.2. Abelian subgroups are virtually cyclic. First, recall the following well-known result: Lemma 2.15. There exists a ∀∃-sentence φ such that, if G is a finitely generated torsionfree abelian group, G |= φ if and only if G is cyclic. Proof. Since Zn /2Zn has 2n elements, it results from the pigeonhole principle that the following ∀∃-sentence is verified by Zn if and only if n = 1: ∀x1 ∀x2 ∀x3 ∃x4 (x1 = x2 x24 ) ∨ (x1 = x3 x24 ) ∨ (x2 = x3 x24 ).  The following results will be important in the sequel. Proposition 2.16. Let Γ be a hyperbolic group and G a finitely generated group such that Th∀∃ (Γ) ⊂ Th∀∃ (G). If g is an element of G of infinite order, then M (g) is virtually cyclic. Corollary 2.17. Let Γ be a hyperbolic group and G a finitely generated group such that Th∀∃ (Γ) ⊂ Th∀∃ (G). Then every abelian subgroup of G is virtually cyclic. Proof of Corollary 2.17. By Proposition 2.14, G is K-CSA for some K. Let H be an infinite abelian subgroup of G. By Proposition 2.12, H is contained in a unique maximal virtually abelian subgroup of G, denoted by M (H), and M (H) = M (h) for every element h of H of infinite order (note that such an element exists since H is abelian, finitely generated (according to Lemma 2.8) and infinite). According to Proposition 2.16 above, M (h) is virtually cyclic, hence H is virtually cyclic.  Proof of Proposition 2.16. By Proposition 2.14, Γ and G are K-CSA for some K. Let g be an element of G of infinite order. Since the group M (g) is K-virtually torsion-free abelian, it has a normal torsion-free abelian subgroup N of index dividing K!. For every element h of M the element hK! belongs to N . Denote by N (g) the subgroup of M (g)  (g) K! generated by h | h ∈ M (g) . It is a subgroup of N , so it is torsion-free abelian. It is enough to show that N (g) is cyclic. Then we will be able to conclude that M (g) is virtually cyclic. Indeed, if N (g) is cyclic, so is hxK! , y K! i for every x, y ∈ M (g). As a consequence there is no pair of elements of M (g) generating a subgroup isomorphic to Z2 . Since M (g) is virtually abelian and finitely generated (according to Lemma 2.8), it is thus virtually cyclic. 10  K! For every integer ` ≥ 1, let N` (g) = hK! 1 · · · h` | h1 , . . . , h` ∈ M (g) . Since N (g) is finitely generated, there an integer r and some elements g1 , . . . , gr of M (g) such that  exist K! N (g) is generated by g1 , . . . , grK! . We claim that N (g) = Nr (g). In order to see this, remark that, since N (g) is abelian, every element h ∈ N (g) can be written as follows:  n 1  nr h = g1K! · · · grK! = (g1n1 )K! · · · (grnr )K! , where n1 , . . . , nr lie in Z. This proves that N (g) ⊂ Nr (g), and the reverse inclusion is immediate. Then, recall that there exists a first-order formula without quantifiers ψ(x, y) such that M (g) = {h ∈ G | ψ(h, g)} (see Proposition 2.13). Hence n  o K! Nr (g) = h ∈ G | ∃h1 . . . ∃hr h = hK! . 1 · · · hr ∧ ψ(h1 , g) ∧ . . . ∧ ψ(hr , g) It remains to prove that Nr (g) is cyclic. Recall that, by Lemma 2.15, a finitely generated torsion-free abelian group is cyclic if and only if it satisfies ∀x1 ∀x2 ∀x3 ∃x4 φ(x1 , x2 , x3 , x4 ), where φ(x1 , x2 , x3 , x4 ) : (x1 = x2 x24 ) ∨ (x1 = x3 x24 ) ∨ (x2 = x3 x24 ). Since Γ is a hyperbolic group, every torsion-free abelian subgroup of Γ is cyclic, so satisfies the previous sentence. We can write a ∀∃-sentence ϕr satisfied by Γ, with the following interpretation: for every element γ of Γ of infinite order, Nr (γ) is cyclic. Below is the sentence ϕr , where hi stands K! for (hi,1 , . . . , hi,r ) and xi := hK! i,1 · · · hi,r .  ϕr : ∀γ∀h1 ∀h2 ∀h3 ∃h4  3 ^ r ^ i=1 j=1 ψ(hi,j , γ) ∧ γ K!    r ^  6= 1  ⇒  ψ(h4,j , γ) ∧ φ(x1 , x2 , x3 , x4 ) j=1 Since Th∀∃ (Γ) ⊂ Th∀∃ (G), the sentence ϕr is true in G as well. It follows that N (g, r) is cyclic. This concludes the proof.  2.4. Generalized Baumslag’s lemma. We shall generalize a criterion proved by Baumslag in the case of free groups (see [Bau62] Proposition 1 or [Bau67] Lemma 7) that will be useful to show that some sequences of homomorphisms taking values in a hyperbolic group are discriminating. A proof in the hyperbolic case can be found in [Os93], Lemma 2.4. We include a proof for completeness. If g is an element of infinite order of a hyperbolic group G, we denote by g + and g − the attracting and repellings fixed points of g on the boundary ∂G of G. We begin with a preliminary lemma. Lemma 2.18. Let G be a hyperbolic group and S a finite generating set of G. Let g, h, x be elements of G such that g and h have infinite order. For every p ≥ 1, denote by αp a geodesic path between g p and g p−1 in Cay(G, S), and βp a geodesic path between xhp−1 and xhp in Cay(G, S). Denote by γ a path joining 1 and x. If g + 6= x · h+ , then there exist two constants λ and k such that for every integers p ≥ 1 and q ≥ 1, wp,q = αp · · · α1 ·γ ·β1 · · · βq is a (λ, k)-quasi-geodesic. Proof. It is well-known that p ∈ Z 7→ g p and p ∈ Z 7→ hp are quasi-geodesics, i.e. there exist constants λg , kg and λh , kh such that for every p, αp · · · α1 is a (λg , kg )-quasi-geodesic joining g p and 1, and β1 · · · βp is a (λh , kh )-quasi-geodesic joining x and xhp . An easy computation gives length(wp,q ) ≤ max(λg , λh )(d(1, g p ) + d(1, xhq )) + (kg + kh + length(γ) + λh d(1, x)). Since g + = 6 x · h+ , there exists a constant C such that the Gromov product (g p , xhq )1 is less than C, that is d(1, g p ) + d(1, xhq ) − d(g p , xhq ) ≤ 2C. It follows that length(wp,q ) ≤ λd(g p , xhq ) + k for some constants λ and k.  One can now prove the following criterion generalizing that of Baumslag. 11 Proposition 2.19. Let a0 , a1 , . . . , am , c1 , . . . , cm be elements of a hyperbolic group. Let w(p1 , . . . , pm ) = a0 cp11 a1 cp22 a2 · · · am−1 cpmm am with p1 , . . . , pm ≥ 0. Suppose that the two following conditions hold: (1) every ci has infinite order; + (2) for every i ∈ J1, m − 1K, c+ i 6= ai · ci+1 . Then there exists a constant C such that w(p1 , . . . , pm ) 6= 1 for every p1 , . . . , pm ≥ C. Proof. We will prove that there exist constants λ, k satisfying the following property: for every integer n, there exists an integer p(n) such that for every p1 , . . . , pm ≥ p(n), w(p1 , . . . , pm ) (viewed as a path in Cay(G, S), for a given finite generating set S) is a local (λ, k, n)-quasi-geodesic, i.e. every subword of w(p1 , . . . , pm ) whose length is less than n is a (λ, k)-quasi-geodesic. Then, it will follow from [CDP90] Theorem 1.4 that there exist three constants L, λ0 and k 0 such that for every p1 , . . . , pm ≥ p(dLe), w(p1 , . . . , pm ) is a (λ0 , k 0 )-quasi-geodesic. Hence: d(1, w(p1 , . . . , pm )) ≥ 1/λ0 (length(w(p1 , . . . , pm )) − k 0 ). Moreover lim p1 ,...,pm →+∞ length(w(p1 , . . . , pm )) = +∞, so d(1, w(p1 , . . . , pm )) ≥ 1 for every p1 , . . . , pm large enough. As a consequence, w(p1 , . . . , pm ) 6= 1 for every p1 , . . . , pm large enough. To prove the existence of constants λ and k, let’s look at subwords of w(p1 , . . . , pm ). For every n, every subword of w(p1 , . . . , pm ) whose length is less that n is a subword of a word of the form cki or cki ai cki+1 where i ∈ J1, m − 1K. Now, it suffices to show that the words above are quasi-geodesic with constants that do not depend on k. This follows from Lemma 2.18.  If G is a hyperbolic group, each element g of infinite order is contained in a unique maximal virtually abelian subgroup of G, denoted by M (g), namely the stabilizer of the pair of points {g + , g − }. The straightforward following corollary of Proposition 2.19 is easier to use in practice. Corollary 2.20. Let a0 , a1 , . . . , am and c be elements of a hyperbolic group. Let (εi ) in {−1, +1}m . Let w(p) = a0 cε1 p a1 cε2 p a2 · · · am−1 cεm p am with p ≥ 0. Suppose that the two following conditions hold: (1) c has infinite order; (2) for every i ∈ J1, m − 1K, ai ∈ / M (c). Then there exists a constant C such that w(p) 6= 1 for p ≥ C. 2.5. The canonical JSJ splitting and the modular group. 2.5.1. The canonical JSJ splitting. Definition 2.21. A group G is called a finite-by-orbifold group if it is an extension F → G → π1 (O) where O is a compact hyperbolic 2-orbifold possibly with boundary, and F is an arbitrary finite group called the fiber. We call extended boundary subgroup of G the preimage in G of a boundary subgroup of π1 (O). We define in the same way extended conical subgroups. In the case where O has only conical singularities, i.e. has no mirrors, we say that G is a conical finite-by-orbifold group. Definition 2.22. A vertex v of a graph of groups is said to be quadratically hanging (denoted by QH) if its stabilizer Gv is a finite-by-orbifold group F → G → π1 (O) such that O has non-empty boundary, and such that any incident edge group is finite or contained in an extended boundary subgroup. We also say that Gv is QH. 12 A one-ended finitely generated K-CSA group G has a canonical JSJ splitting over virtually abelian groups (see [GL16], Theorem 9.14). In the case where all finitely generated abelian subgroups of G are virtually cyclic, G has a canonical JSJ decomposition ∆ over Z, the class of virtually cyclic groups with infinite center. We refer the reader to [GL16], Section 9.2, for a construction of ∆ using the tree of cylinders. The benefit of this decomposition ∆ is that its QH vertex groups have no mirrors. In the sequel, all one-ended groups will be K-CSA without Z2 , and the expression "the JSJ splitting" or "the Z-JSJ splitting" will always refer to the canonical JSJ splitting over Z obtained by the tree of cylinders. Below are the properties of ∆ that will be useful in the sequel. • The graph ∆ is bipartite, with every edge joining a vertex carrying a virtually cyclic group to a vertex carrying a non-virtually-cyclic group. • There are two kinds of vertices of ∆ carrying a non-cyclic group: rigid ones, and QH ones. If v is a QH vertex of ∆, every incident edge group Ge coincides with an extended boundary subgroup of Gv . Moreover, given any extended boundary subgroup B of Gv , there exists a unique incident edge e such that Ge = B. • The action of G on the associated Bass-Serre tree T is acylindrical in the following strong sense: if an element g ∈ G of infinite order fixes a segment of length ≥ 2 in T , then this segment has length exactly 2 and its midpoint has virtually cyclic stabilizer. • Let v be a vertex of T , and let e, e0 be two distinct edges incident to v. If Gv is not virtually cyclic, then the group hGe , Ge0 i is not virtually cyclic. 2.5.2. The modular group. Let G be a one-ended finitely generated K-CSA group that does not contain Z2 . The modular group Mod(G) of G is the subgroup of Aut(G) composed of all automorphisms that act by conjugaison on non-QH vertex groups of the Z-JSJ splitting, and on finite subgroups of G, and that act trivially on the underlying graph of the Z-JSJ splitting. 2.6. Stallings-Dunwoody splitting. Let G be a finitely generated group. Suppose that there exists a constant K such that every finite subgroup of G has order less than K. Then G splits over finite groups as a graph of groups all of whose vertex groups are finite or one-ended. Such a splitting is called a Stallings-Dunwoody splitting of G; it is not unique, but the conjugacy classes of one-ended vertex groups do not depend on the splitting. A one-ended subgroup of G that appears as a vertex group of a Stallings-Dunwoody splitting is called a one-ended factor of G. If G is a Γ-limit group, where Γ is hyperbolic, one can prove that there exists a uniform bound on the order of finite subgroups of G (see [RW14] Lemma 1.18). As a consequence, G has a Stallings-Dunwoody splitting. 2.7. Preliminaries on orbifolds. In the sequel, all orbifolds are compact, 2-dimensional, hyperbolic and conical (i.e. without mirrors). 2.7.1. Cutting an orbifold into elliptic components. Definition 2.23. A set C of simple closed curves on a conical orbifold is said to be essential if its elements are non null-homotopic, two-sided, non boundary-parallel, pairwise non parallel, and represent elements of infinite order (in other words, no curve of C circles a singularity). Proposition 2.24. Let O be a hyperbolic orbifold. Suppose that S = π1 (O) acts minimally on a tree T in such a way that its boundary elements are elliptic. Then there exists an essential set C of curves on O, and a surjective S-equivariant map f : TC → T , where TC stands for the Bass-Serre tree associated with the splitting of S dual to C. In other words: • every element of S corresponding to a loop of C fixes an edge of T ; • every fundamental group of a connected component of O \ C is elliptic. 13 The proposition above is proved in [MS84] for surfaces (see Theorem 3.2.6), and the generalization to compact hyperbolic 2-orbifolds of conical type is straightforward. Then, Proposition 2.24 extends to finite-by-orbifold groups through the following observation: if G is a finite extension F ,→ G  π1 (O) acting minimally on a tree T , then the action factors through G/F ' π1 (O), because F acts as the identity on T . Indeed, since F is finite, it fixes a point x of T . Since F is normal, the non-empty subtree of T pointwise-fixed by F is invariant under the action of G. Since this action is minimal, F fixes T pointwise. 2.7.2. Non-pinching homomorphisms. Definition 2.25. Let G and G0 be conical finite-by-orbifold groups. A homomorphism from G to G0 is called a morphism of finite-by-orbifold groups if it sends each extended boundary subgroup injectively into an extended boundary subgroup, and if it is injective on finite subgroups. q Definition 2.26. Let G be a conical finite-by-orbifold group F ,→ G  π1 (O). Let p be a homomorphism from G to a group G0 . Let α be a two-sided and non-boundary-parallel simple loop on O representing an element of infinite order, and let Cα = q −1 (α) ' F o Z (well defined up to conjugacy). The curve α (or Cα ) is said to be pinched by p if p(Cα ) is finite. The homomorphism p is said to be non-pinching if it does not pinch any two-sided simple loop. Otherwise, p is said to be pinching. Proposition 2.27. Let O and O0 be conical hyperbolic orbifolds. Let G and G0 be their fundamental groups. Let p : G → G0 be a non-pinching morphism of orbifolds. Suppose that p(G) is not contained in a conical or boundary subgroup of G0 . Then [G0 : p(G)] < +∞. Proof. Suppose that p(G) has infinite index in G0 . Then p(G) is the fundamental group of a geometrically finite hyperbolic conical orbifold of infinite volume. Therefore, p(G) splits as a graph of groups ∆ whose edge groups are trivial, whose vertex groups are conical or boundary subgroups of G0 , and such that each boundary subgroup of p(G) is elliptic in the Bass-Serre tree T of ∆. This splitting is non-trivial because p(G) is not contained in an extended boundary subgroup or an extended conical subgroup of G0 . By definition of a morphism of orbifolds, each boundary subgroup of G is contained in a boundary subgroup of p(G), so is elliptic in T . Then it follows from Proposition 2.24 that there exists a simple loop on O pinched by p. This is a contradiction.  Let G be the fundamental group of a conical hyperbolic orbifold with boundary. We will associate to G a number, denoted by k(G) and called the complexity of G, such that the following proposition holds. Proposition 2.28. Let O and O0 be conical hyperbolic orbifolds, with non-empty boundary. Denote by G and G0 their fundamental groups. Let p : G → G0 be a morphism of orbifolds. If p(G) has finite index in G0 , then k(G) ≥ k(G0 ), with equality if and only if p is an isomorphism. We need two definitions. Definition 2.29 (Euler characteristic). Let O be a conical orbifold with m conical points of orders p1 , . . . , pm , and let Σ be the underlying surface. The Euler characteristic of O is  m  X 1 . χ(O) := χ(Σ) − 1− pi i=1 A compact orbifold is hyperbolic if and only if χ(O) < 0. Definition 2.30 (Complexity of a virtually free group). Let G be a virtually free group, and let ∆ be a Stallings decomposition of G. Denote by V (∆) the set of vertices of ∆, and 14 by E(∆) its set of edges. We define the complexity k(∆) of ∆ as follows: X X 1 1 k(∆) := − . |Ge | |Gv | e∈E(∆) v∈V (∆) This number does not depend on ∆. We define the complexity of G as k(G) := k(∆) for any decomposition ∆ of G as a graph of groups with finite edge groups and finite vertex groups. The Euler characteristic and the complexity k defined above are linked through the following lemma. Lemma 2.31. Let O be a conical hyperbolic orbifold. Assume that O possesses at least one boundary component, so that π1 (O) is virtually free. Then k(π1 (O)) = −χ(O). Proof. Let C be a maximal set of properly embedded arcs in O that are pairwise non parallel and non boundary-parallel. Let n be the cardinality of C. Let m be the number of connected components of O \ C, denoted by O1 , . . . , Om . Each connected component Oi of O \PC is an annulus or a disc with one singular point. P One can see that χ(O) is equal to 1≤i≤m χ(Oi ) − n, and that k(π1 (O)) is equal to 1≤i≤m k(π1 (Oi )) + n (since k(A ∗ B) = k(A) + k(B) + 1 for any virtually free groups A and B). So the lemma follows from the following observation: for each 1 ≤ i ≤ m, k(π1 (Oi )) = −χ(Oi ).  Now, Proposition 2.28 follows easily from the lemma below. Lemma 2.32. Let G and G0 be two free products of finite groups and of a free group. Let ∆ and ∆0 be two Stallings decomposition of G and G0 respectively. Assume that edge groups of ∆ and ∆0 are trivial. Let φ : G  G0 be an epimorphism that is injective on finite subgroups of G. Then k(G) ≥ k(G0 ), with equality if and only if φ is injective. Proof of Proposition 2.28. Denote by d the index of p(G) in G0 . There exists a covering orbifold O00 of O0 of degree d such that p(G) ' π1 (O00 ). As a consequence, χ(O00 ) = dχ(O0 ), so k(p(G)) = dk(G0 ) thanks to Lemma 2.31. According to Lemma 2.32, k(G) ≥ k(p(G)). Now, assume that k(G) = k(G0 ). Then d = 1, so p is surjective, and p is injective by Lemma 2.32. Hence, p is an isomorphism.  Proof of Lemma 2.32. If ∆ is reduced to a point, then φ is obviously injective. From now on, we will suppose that ∆ has at least two vertices. Let T, T 0 be Bass-Serre trees of ∆, ∆0 respectively. We build a φ-equivariant map f : T → T 0 in the following way: for every vertex v of T , there exists a vertex v 0 of T 0 such that φ(Gv ) = G0v0 . Moreover, v 0 is unique since φ is injective on finite subgroups, and edge groups of ∆0 are trivial. We let f (v) = v 0 . Next, if e is an edge of T , with endpoints v and w, there exists a unique path e0 from f (v) to f (w) in T 0 . We let f (e) = e0 . Let us denote by d0 the natural distance function on T 0 . Up to subdivising the edges of T , we can assume that, for every adjacent vertices v, w ∈ T , d0 (f (v), f (w)) ∈ {0, 1}. We will prove that φ can be written as a composition i◦πn ◦· · ·◦π0 , with n ≥ 0, π0 = id and i injective, such that k(π` ◦ · · · ◦ π0 (G)) ≥ k(π`+1 ◦ · · · ◦ π0 (G)) for every 0 ≤ ` < n (if n > 0), with equality if and only if π`+1 = id. Step 1. Assume that there exist two adjacent vertices v, w such that d0 (f (v), f (w)) = 0. Let e be the edge between v and w. We collapse e in T , as well as all its translates under the action of G. Collapsing e gives rise to a new vertex x labelled by hGv , Gw i if v and w are not in the same orbit, or hGv , gi if w = g · v. Call S1 the resulting tree. Now, let N be the kernel of the restriction of φ to Gx , let T1 := S1 /hhN ii, G1 := G/hhN ii and h1 : T  T1 , π1 : G  G1 the associated surjections. The homomorphism φ factors through π1 as φ = φ1 ◦ π1 , and the map f factors through h1 as f = f1 ◦ h1 . Since T 0 has finite vertex groups, the stabilizer Gx /N ' φ(Gx ) of h1 (x) in T1 is finite, so T1 /G1 is 15 a Stallings splitting of G1 . Thus, k(G1 ) = k(T /G1 ) by definition. Let us compare k(G1 ) with k(G). It is not hard to see that  1 1 1  − + if v and w are not in the same orbit 1 − |Gv | |Gw | |Gx /N | k(G) − k(G1 ) = . 1 1  1 − + if v and w are in the same orbit |Gv | |Gx /N | Hence, if v and w are in the same orbit, it is clear that k(G) > k(G1 ). If v and w are not in the same orbit, there are four distinct cases: if |Gv | ≥ 2 and |Gw | ≥ 2, it is clear that k(G) > k(G1 ); if |Gv | = 1 and |Gw | ≥ 2 (respectively |Gw | = 1 and |Gv | ≥ 2), then Gx = Gw (respectively Gx = Gv ) and k(G) ≥ k(G1 ) with equality if and only if N = {1}, i.e. π1 = id; if |Gv | = |Gw | = 1, then Gx = N = {1}, i.e. π1 = id. If the φ1 -equivariant map f1 : T1 → T 0 collapses some edge, we repeat the previous operation. Since T has only finitely many orbits of edges under the action of G, the procedure terminates after finitely many steps. So we can assume, without loss of generality, that f1 sends adjacent vertices on adjacent vertices. Step 2. Assume that f1 folds some pair of edges, as pictured below. e’ w0 v f1 (w) = f1 (w0 ) f1 (v) e w Let us fold e and e0 together in T1 , as well as all their translates under the action of G1 . Note that e and e0 are not in the same Gv -orbit since T 0 has trivial edge stabilizers and φ is injective on Gv . Folding e and e0 together gives rise to a new vertex x labelled by hGw , G0w i if w and w0 are not in the same orbit, or hGw , gi if w0 = g·w. Call S2 the resulting tree. Now, let N be the kernel of the restriction of φ1 to (G1 )x , let T2 := S2 /hhN ii, G2 := G1 /hhN ii and h2 : T1  T2 , π2 : G1  G2 the associated surjections. The homomorphism φ1 factors through π2 as φ1 = φ2 ◦ π2 , and the map f1 factors through h2 as f1 = f2 ◦ h2 . Since T 0 has finite vertex groups, the stabilizer (G1 )x /N ' φ1 ((G1 )x ) of h2 (x) in T2 is finite, so T2 /G2 is a Stallings splitting of G2 . As in the first step, we can see that k(G1 ) > k(G2 ). Again, we can repeat this operation only finitely many times since T has only finitely many orbits of edges under the action of G. At the end, with obvious notations, we get a φn -equivariant map fn : Tn → T 0 that is locally injective, so injective. It remains to prove that φn is injective: if φn (g) = 1, then for every vertex v of Tn , fn (gv) = fn (v), so gv = v. Since Gn acts on Tn with trivial edge stabilizers, we get g = 1.  We deduce the following result from Proposition 2.27 and Proposition 2.28. Proposition 2.33. Let O and O0 be conical hyperbolic orbifolds, with non-empty boundary. Denote by G and G0 their fundamental groups. If p : G → G0 is a non-pinching morphism of orbifolds such that p(G) is not contained in a conical or boundary subgroup of G0 , then k(G) ≥ k(G0 ), with equality if and only if p is an isomorphism. We will now generalize the proposition above to finite extensions of conical hyperbolic orbifolds. First, we need the following lemma. Lemma 2.34. Let O and O0 be conical hyperbolic orbifolds. Let G and G0 be two finite extensions F ,→ G  π1 (O) and F 0 ,→ G0  π1 (O0 ). If p : G → G0 is a homomorphism whose restriction to F is injective and whose image is infinite, then p(F ) ⊂ F 0 . As a consequence, p induces a homomorphism q from π1 (O) to π1 (O0 ). 16 F S π f F0 S0 π1 (O) q π0 π1 (O0 ) Proof. Firstly, we make the following observation: if A is a finite subgroup of G0 which is not contained in F 0 , then the normalizer NG0 (A) of A in G0 is finite. Indeed, if A is not contained in F 0 , then π(A) is a non-trivial finite subgroup of O0 , so its normalizer is a finite cyclic group (since we can see π(A) as an elliptic subgroup of PSL(2, R) acting on H2 ). Now, if p(F ) is not contained in F 0 , then p(G) ⊂ NG0 (p(F )), which is finite. This is a contradiction.  Proposition 2.35. Let O and O0 be conical hyperbolic orbifolds, with non-empty boundary. Let G and G0 be two finite extensions F ,→ G  π1 (O) and F 0 ,→ G0  π1 (O0 ). Let p : G → G0 be a non-pinching morphism of finite-by-orbifold groups such that p(G) is not contained in an extended conical or boundary subgroup of G0 . Then k(G) ≥ k(G0 ), with equality if and only if p is an isomorphism. Proof. k(π1 (O)) = |F |k(G) and k(π1 (O0 )) = |F 0 |k(G0 ). By the previous lemma, p induces a morphism of orbifolds q : π1 (O) → π1 (O0 ). According to Proposition 2.33, k(π1 (O)) ≥ k(π1 (O0 )), so |F |k(G) ≥ |F 0 |k(G0 ). But p(F ) ⊂ F 0 , and p is injective in restriction to F , so |F 0 | ≥ |F |. As a consequence, k(G) ≥ k(G0 ). Moreover, if k(G) = k(G0 ), then k(π1 (O)) ≥ k(π1 (O0 )), so q : π1 (O) → π1 (O0 ) is an isomorphism by Proposition 2.33, and p|F : F → F 0 is an isomorphism, so p is an isomorphism.  3. How to extract information from the JSJ using first-order logic 3.1. Preliminary examples. Let Γ be a hyperbolic group, and let G be a finitely generated group such that Th∀∃ (Γ) = Th∀∃ (G). For convenience, suppose that G is one-ended. We saw in the previous section that G does not contain Z2 , and has a canonical JSJ splitting ∆ over Z (the class of virtually cyclic groups with infinite center). Our aim is to prove that G is a hyperbolic group. Since the JSJ splitting is acylindrical, and since the QH vertex groups are hyperbolic by definition, it suffices to prove that all non-QH vertex groups of ∆ are hyperbolic (as a consequence of the Bestvina-Feighn combination theorem, see proposition 3.11). Hence, the main issue is to manage to extract information about non-QH vertex groups of ∆ by means of first-order logic. We shall give two motivating examples. The simplest example arises when Γ and G are both rigid (that is, they are one-ended, their canonical JSJ splittings over Z are reduced to a point, and they are not finite-by-orbifold). Example 3.1. Let Γ be a hyperbolic group, and let G be a finitely generated group such that Th∀∃ (Γ) = Th∀∃ (G). Suppose that Γ and G are rigid (i.e. do not split non-trivially over a virtually cyclic group). We shall prove that Γ and G are isomorphic. Since G is a Γ-limit group, there exists a discriminating sequence (fn ) of homomorphisms from G to Γ (see Section 2.2). By definition of the modular group, Mod(G) = Inn(G), so it results easily from Sela’s shortening argument 2.2 that fn is necessarily injective for n large enough. Hence, G embeds into Γ. Now, using Corollary 2.4, we prove in the same way that Γ embeds into G. As a one-ended hyperbolic group, Γ is co-Hopfian, so G ' Γ. The second example below is a little more complicated, and much more instructive. First of all, note that we cannot express the full statement of the shortening argument 2.4 in first-order logic, since precomposition by a modular automorphism is not expressible by a first-order formula in general. To deal with this problem, let’s consider the following 17 corollary of the shortening argument 2.4, which follows immediately from the definition of the modular group. Corollary 3.2. Let Γ be a group that embeds into a hyperbolic group, and let G be a oneended finitely generated group. There exists a finite set F ⊂ G \ {1} with the following property: for every non-injective homomorphism f : G → Γ, there exists a homomorphism f 0 : G → Γ such that • ker(f 0 ) ∩ F 6= ∅; • f and f 0 coincide, up to conjugacy by an element of Γ, on non-QH vertex groups of the Z-JSJ splitting ∆ of G, and on finite subgroups of G. We say that f and f 0 are ∆-related (see Definition 3.4 below). Below is our second example. Example 3.3. Let Γ be a hyperbolic group, and let G be a finitely generated group such that Th∀∃ (Γ) = Th∀∃ (G). Suppose that Γ and G are one-ended, and that there is no QH vertex in the JSJ decompositions of Γ and G. Then Γ and G are isomorphic. In particular, G is hyperbolic. Sketch of proof. First, we prove that G embeds into Γ. Argue by contradiction and suppose that every homomorphism from G to Γ is non-injective. By Corollary 3.2, there exists a finite set F ⊂ G such that, for every homomorphism f : G → Γ, there exists f 0 : G → Γ that kills an element of F and that coincides with f up to conjugacy on every vertex group of the canonical Z-JSJ splitting ∆ of G. One easily sees that this fact can be expressed by a ∀∃-sentence verified by Γ (see the next section for details). Since Th∀∃ (Γ) ⊂ Th∀∃ (G), this sentence is also verified by G, and its interpretation in G yields the following: for every endomorphism f : G → G, there exists an endomorphism f 0 : G → G that kills an element of F and that coincides with f up to conjugacy on every vertex group of the canonical ZJSJ splitting ∆ of G. Taking f = idG , we get an endomorphism of G that kills an element of F and that is inner in restriction to every vertex group. But we will prove further that such an endomorphism is necessarily injective (see Proposition 7.2). This contradicts the fact that f 0 kills an element of F . Hence, we have shown that G embeds into Γ. Now, using Corollary 3.2, we prove in the same way that Γ embeds into G. As a one-ended hyperbolic group, Γ is co-Hopfian, so G ' Γ.  New difficulties arise when Γ and G are not supposed to be one-ended, or when the canonical Z-JSJ splittings of Γ and G contain QH vertices. However, the example above highlights the crucial role played by endomorphims of G that coincide up to conjugacy with the identity of G on non-QH vertex groups. This example also brings out the key idea to obtain these special homomorphisms, due to Sela-Perin, that consists in expressing a consequence of the shortening argument 2.2 by a ∀∃-sentence that Γ verifies (assuming G is one-ended). Since Γ and G have the same ∀∃-theory, G satisfies this sentence as well, and its interpretation in G provides us with a special endomorphism of G. This example leads us to the definition of related homomorphisms. 3.2. Related homomorphisms. The following definition is similar (but slightly different) to Definition 5.9 and Definition 5.15 of [Per11]. Definition 3.4 (Related homomorphisms). Let G be a one-ended finitely generated KCSA group and let G0 be a group. Let ∆ be the canonical JSJ splitting of G over Z. Let f and f 0 be two homomorphisms from G to G0 . We say that f and f 0 are ∆-related if the two following conditions hold: • for every non-QH vertex v of ∆, there exists an element gv ∈ G0 such that f 0 |Gv = ιgv ◦ f|Gv ; 18 • for every finite subgroup F of G, there exists an element g ∈ G0 such that f 0 |F = ιg ◦ f|F . Note that being ∆-related is an equivalence relation on Hom(G, G0 ). Remark 3.5. The second condition above can be reformulated as follows: for every QH vertex v, and for every finite subgroup F of Gv , there exists an element g ∈ G0 such that f|F = ιg ◦ f 0 |F . Indeed, every finite group has Serre’s property (FA), so every finite subgroup F of G is contained in a conjugate of some vertex group Gw of ∆. Furthermore, if w is a non-QH vertex, it follows from the first condition that there exists an element g ∈ G0 such that f|F = ιg ◦ f 0 |F . Definition 3.6 (Preretraction). Let G be a finitely generated K-CSA group and let H be a one-ended subgroup of G. Let ∆ be the canonical JSJ splitting of H over Z. A preretraction from H to G is a homomorphism H → G that is ∆-related to the inclusion of H into G. The following lemma shows that being ∆-related can be expressed in first-order logic. Lemma 3.7 (compare with [Per11] Lemma 5.18). Let G be a finitely generated group that possesses a canonical Z-JSJ splitting ∆, and let {g1 , . . . , gn } be a generating set of G. Let G0 be a group. There exists an existential formula ϕ(x1 , . . . , x2n ) with 2n free variables such that, for every f, f 0 ∈ Hom(G, G0 ), f and f 0 are ∆-related if and only if G0 verifies ϕ (f (g1 ), . . . , f (gn ), f 0 (g1 ), . . . , f 0 (gn )) . Proof. Firstly, remark that there exist finitely many (say p ≥ 1) conjugacy classes of finite subgroups of QH vertex groups of ∆ (indeed, a QH vertex group possesses finitely many conjugacy classes of finite subgroups, and ∆ has finitely many vertices). Denote by F1 , . . . , Fp a system of representatives of those conjugacy classes. Denote by R1 , . . . , Rm the non-QH vertex groups of ∆. Remark that these groups are finitely generated since G and the edge groups of ∆ are finitely generated. Denote by {Ai }1≤i≤p+m the union of {Fi }1≤i≤p and {Ri }1≤i≤m . For every i ∈ J1, m+pK, let {ai,1 , . . . , ai,ki } be a finite generating set of Ai . For every i ∈ J1, m + pK and j ∈ J1, ki K, there exists a word wi,j in n letters such that ai,j = wi,j (g1 , . . . , gn ). Let ψ(x1 , . . . , x2n ) : ∃u1 . . . ∃um m+p ki ^ ^ wi,j (x1 , . . . , xn ) = ui wi,j (xn+1 , . . . , x2n )ui −1 . i=1 j=1 Since f (ai,j ) = wi,j (f (g1 ), . . . , f (gn )) and f 0 (ai,j ) = wi,j (f 0 (g1 ), . . . , f 0 (gn )) for every i ∈ J1, m + pK and j ∈ J1, ki K, the homomorphisms f and f 0 are ∆-related if and only if the sentence ψ (f (g1 ), . . . , f (gn ), f 0 (g1 ), . . . , f 0 (gn )) is satisfied by G0 .  3.3. Centered graph of groups. We need to define relatedness in a more general context. In order to deal with groups that are not assumed to be one-ended, we define below the notion of a centered graph of groups. We denote by Z the class of groups that are either finite or virtually cyclic with infinite center. Definition 3.8 (Centered graph of groups). A graph of groups over Z, with at least two vertices, is said to be centered if the following conditions hold: • the underlying graph is bipartite, with a QH vertex v such that every vertex different from v is adjacent to v; • every incident edge group Ge coincides with an extended boundary subgroup or with an extended conical subgroup of Gv (see Definition 2.21); • given any extended boundary subgroup B, there exists a unique incident edge e such that Ge is conjugate to B in Gv ; 19 • if an element of infinite order fixes a segment of length ≥ 2 in the Bass-Serre tree of the splitting, then this segment has length exactly 2 and its endpoints are translates of v. The vertex v is called the central vertex. Figure 4. A centered graph of groups. Edges with infinite stabilizer are depicted in bold. The following proposition will be crucial in the sequel. Proposition 3.9. Let G be a group that splits as a centered graph of groups, with central vertex v. Then the following assertions are equivalent. • G is hyperbolic • For every vertex w 6= v, Gw is hyperbolic. This is an easy consequence of the two following well-known results. Proposition 3.10 ([Bow98], Proposition 1.2). If a hyperbolic group splits over quasiconvex subgroups, then every vertex group is quasi-convex (so hyperbolic). Recall that a subgroup H of a group G is called almost malnormal if H ∩ gHg −1 is finite for every g in G \ H. Note that edge groups in a centered graph of groups are almost malnormal in the central vertex group. Proposition 3.11 ([BF92], corollary of the combination theorem). Let G = A ∗C B be an amalgamated product such that A and B are hyperbolic and C is virtually cyclic and almost malnormal in A or B. Then G is hyperbolic. Let G = A∗C be an HNN extension such that A is hyperbolic and C is virtually cyclic and almost malnormal in A. Then G is hyperbolic. We also define relatedness for centered splittings. Definition 3.12 (Related homomorphisms). Let G and G0 be two groups. Suppose that G possesses a centered splitting ∆, with central vertex v. Let f and f 0 be two homomorphisms from G to G0 . We say that f and f 0 are ∆-related if the two following conditions hold: • for every vertex w 6= v, there exists an element gw ∈ G0 such that f 0 |Gw = ιgw ◦ f|Gw ; • for every finite subgroup F of G, there exists an element g ∈ G0 such that f 0 |F = ιg ◦ f|F . Note that being ∆-related is an equivalence relation on Hom(G, G0 ). Remark 3.13. Let G be a one-ended finitely generated K-CSA group and let ∆ be the canonical JSJ splitting of G over Z. Let v a be a QH vertex of ∆, and let star(v) be the subgraph of ∆ composed of v and all its incident edges. Let us denote by Λ the splitting of G obtained by collapsing to a point each connected component of the complement of star(v) in ∆. This new splitting is obviously a centered splitting of G. Moreover, if two homomorphisms are ∆-related, then they are Λ-related. 20 4. Torsion-saturated groups In the presence of torsion, the universal theory of a hyperbolic group is not closed under HNN extensions and amalgamated free products over finite groups. This is a simple example: the universal sentence ∀x∀y (x2 = 1) ⇒ (xy = yx), which means that any involution is central, is verified by F2 ×Z/2Z but not by (F2 ×Z/2Z)∗{1} = (F2 ×Z/2Z)∗Z. For the same reason, (F2 × Z/2Z) ∗ (F2 × Z/2Z) does not have the same universal theory as F2 × Z/2Z. To control this phenomenon, we will prove that every hyperbolic group G embeds into a hyperbolic group G that possesses the following property: the class of G-limit groups is closed under HNN extensions and amalgamated free products over finite groups. Definition 4.1. We say that a group G is torsion-saturated if the two following conditions hold. (1) For every isomorphism α : F1 → F2 between finite subgroups F1 , F2 of G, there exists an element g ∈ G such that gxg −1 = α(x) for every x ∈ F1 . (2) For every finite subgroup F of G, there exists an infinite subset {g1 , g2 , . . .} of G such that gn has infinite order, M (gn ) = hgn i×F for every n, and M (gn ) 6= M (gm ) whenever n 6= m. Remark 4.2. The second condition is equivalent to the following: there exist two elements a, b ∈ G generating a free group, and such that M (a) = hai × F and M (b) = hbi × F . We shall see that every hyperbolic group embeds into a torsion-saturated hyperbolic group (see Theorem 4.8 below). The main interest of torsion-saturated groups resides in the following result. Theorem 4.3. Let G be a torsion-satured hyperbolic group. Then the class of G-limit groups is closed under HNN extensions and amalgamated free products over finite groups. Proof. Let H be a G-limit group. Let α : F1 → F2 be an isomorphism between two finite subgroups F1 , F2 of H. We shall prove that the HNN extension H∗α is a G-limit group. According to Lemma 4.4 below, there exists an isomorphism β : F10 → F20 between finite subgroups F10 , F20 of G such that H∗α is a G∗β -limit group. But G∗β is a G-limit group thanks to Lemma 4.6 below, so H∗α is a G-limit group. It remains to treat the case of an amalgamated free product. Let A, B be G-limit groups. Let F be a finite group that embeds into A and B. According to Lemma 4.5 below, there exists a finite subgroup F 0 of G such that A ∗F B is a G∗F 0 -limit group, and G∗F 0 is a G-limit group by Lemma 4.6, so A ∗F B is a G-limit group as well.  Lemma 4.4. Let G be a hyperbolic group and let H be a G-limit group. Let α : F1 → F2 be an isomorphism between finite subgroups F1 , F2 of H. Then there exists an isomorphism β : F10 → F20 between finite subgroups F10 , F20 of G such that H∗α is a G∗β -limit group. Lemma 4.5. Let G be a hyperbolic group. Suppose that the first condition of Definition 4.1 holds, that is: for every isomorphism α : F1 → F2 between finite subgroups F1 , F2 of G, there exists an element g ∈ G such that gxg −1 = α(x) for every x ∈ F1 . Let A, B be G-limit groups. Let F be a finite group that embeds into A and B. Then there exists a finite subgroup F 0 of G such that A ∗F B is a G∗F 0 -limit group. Lemma 4.6. Let G be a hyperbolic group, and let α : F1 → F2 be an isomorphism between finite subgroups F1 , F2 of G. Suppose that the two following conditions hold: (1) there exists an element g ∈ G such that gxg −1 = α(x) for every x ∈ F1 ; (2) there exists an infinite subset E = {g1 , g2 , . . .} ⊂ G such that gn has infinite order, M (gn ) = hgn i × F1 for every n, and M (gn ) 6= M (gm ) whenever n 6= m. Then G∗α is a G-limit group. 21 Proof of Lemma 4.4. Let (φn ) be a discriminating sequence of homomorphisms from H to G. Without loss of generality, we can suppose that φn is injective in restriction to F1 and F2 . We will construct a discriminating sequence (ρn ) of homomorphisms from H∗α to G∗β , for some β that will be defined below. Since G has finitely many conjugacy classes of finite subgroups, there exist two finite subgroups F10 , F20 of G such that, up to extracting a subsequence, φn (F1 ) is conjugate to F10 and φn (F2 ) is conjugate to F20 for every n. Up to composing φn by an inner automorphism of G, one can assume that φn (F1 ) = F10 and ιgn ◦ φn (F2 ) = F20 for some gn ∈ G. Denote by βn the isomorphism from F10 to F20 making the following diagram commute: F1 φn |F1 α F2 F10 βn ιgn ◦φn |F2 F20 Since Isom(F10 , F20 ) is finite, there exists an isomorphism β between F10 and F20 such that (up to extracting a subsequence) βn = β for every n. Let t and u be the stable letters of H∗α and G∗β , i.e. txt−1 = α(x) for all x ∈ F1 and uyu−1 = β(y) for all y ∈ F10 . For every n, we define a map ρn from H∗α to G∗β as follows: ( φn (x) if x ∈ H ρn (x) = . gn−1 u if x = t The map ρn clearly extends to a homomorphism since the diagram commutes, and we claim that the sequence (ρn ) is discriminating. Let x be a non-trivial element of H∗α . If x lies in H, it is obvious that ρn (x) is non-trivial for every n large enough since (φn ) is discriminating. Assume now that x ∈ / H. Then x can be written in reduced form as ε ε 1 2 x = h0 t h1 t h2 · · · with n > 0, hi ∈ H, εi = ±1, hi ∈ / F1 if εi = −εi+1 = 1 and hi ∈ / F2 if εi = −εi+1 = −1. One has: ρn (x) = φn (h0 )(gn u)ε1 φn (h1 )(gn u)ε2 φn (h2 ) · · · . One has to prove that ρn (x) 6= 1 for every n large enough. In order to apply Britton’s lemma, one verifies that, for every subword of w of the form uvu−1 with v not involving u, v does not lie in F10 , and that for every subword of w of the form u−1 vu with v not involving u, v does not lie in F20 . • If uvu−1 is a subword of w with v not involving u, then v is of the form φn (hi ) with hi ∈ / F1 , and φn (hi ) ∈ / F10 for every n large enough because (φn ) is discriminating. −1 • Similarly, if u vu is a subword of w with v not involving u, then v is of the form gn φn (hi )gn−1 with hi ∈ / F2 , and gn φn (hi )gn−1 ∈ / F20 = gn φn (F2 )gn−1 for every n large enough because (ιgn ◦ φn ) is discriminating. Hence, it follows from Britton’s lemma that ρn (x) 6= 1 for every n large enough.  Remark 4.7. Note that in the previous proof, the hypothesis that G is hyperbolic is only used to ensure that G has finitely many classes of finite subgroups. Proof of Lemma 4.5. Let (φn ) be a discriminating sequence from A to G, and let (ψn ) be a discriminating sequence from B to G. For every n large enough, φn (F ) and ψn (F ) are isomorphic to F . By hypothesis, there exists an element gn ∈ G making the following diagram commute: 22 φn (F ) φn ιgn F ψn ψn (F ) Let χn = ιgn−1 ◦ψn . So χn and φn coincide on F . Since (φn ) and (χn ) are discriminating, we can assume that φn and χn are injective on F . Since G has only finitely many conjugacy classes of finite subgroups, we can assume that φn (F ) = χn (F ) = F 0 for every n, for some finite subgroup F 0 of G, up to extracting a subsequence and precomposing by an inner automorphism. Let G∗F 0 = hG, t | [t, x] = 1 ∀x ∈ F 0 i be the HNN-extension of G over the identity of 0 F . For every n, we define a homomorphism ρn from A ∗F B to G∗F 0 as follows: ( φn (x) if x ∈ A ρn (x) = . ιt ◦ χn (x) if x ∈ B We claim that the sequence (ρn ) is discriminating, i.e. that for every non-trivial element x ∈ A ∗F B, ρn (x) 6= 1 for every n large enough. If x ∈ F \ {1}, then ρn (x) = φn (x), so ρn (x) is non-trivial for every n large enough since (φn ) is discriminating. Assume now that x ∈ / F . Then x can be written in a reduced form a1 b1 a2 b2 · · · ak bk with ai ∈ A \ F and bi ∈ B \ F (except maybe a1 and bk ). The following holds: ρn (x) = φn (a1 )tχn (b1 )t−1 φn (a2 )tχn (b2 )t−1 · · · φn (ak )tχn (bk )t−1 . Since (φn ) and (χn ) are discriminating, φn (ai ) ∈ / F 0 and χn (bi ) ∈ / F 0 for every n large enough (except maybe φn (a1 ) and χn (bk )). Hence, it follows from Britton’s lemma that ρn (x) 6= 1 for every n large enough.  Proof of Lemma 4.6. Let G = hS | Ri be a presentation of G, and let G∗α = hS, t | R, txt−1 = α(x) ∀x ∈ F1 i be a presentation of G∗α . By hypothesis, there exists an element g ∈ G such that gxg −1 = α(x) for every x ∈ F1 . Up to replacing t by g −1 t, we can assume that F1 = F2 and that α is the identity of F1 . The presentation of G∗α becomes hS, t | R, [t, x] = 1 ∀x ∈ F1 i. For every gn ∈ E, and for every integer p, we define a map φp,n from G∗α to G by ( z 7→ z if z ∈ G . φp,n : t 7→ gnp The map φp,n clearly extends to a homomorphism since ιt and ιgnp coincide on F1 for every p, because M (gn ) = hgn i × F1 by hypothesis. Denote by Bm the ball of radius m in G∗α (for a given generating set). We shall prove the existence of two sequences (nm ) ∈ NN and (pnm ) ∈ NN such that φpnm ,nm (x) 6= 1 for every x ∈ Bm \ {1}, for every m. Let x ∈ Bm \ {1}. If x lies in G, φp,n (x) 6= 1 for all p and n. Assume now that x does not belong to G. Then x can be written in a reduced form as x = y0 tε1 y1 tε2 · · · tεk yk with k > 0, εi = ±1, yi ∈ / F1 if εi = −εi+1 . We claim that for p and n sufficiently large, the homomorphism φp,n verifies φp,n (x) 6= 1. In order to prove this, we will use Baumslag’s lemma 2.20 with c = gn . We have φp,n (x) = y0 gnε1 p y1 gnε2 p · · · gnεk p yk . First, let us rewrite φp,n (x) under a more convenient form. Let i ∈ J1, k−1K, and suppose that εi = εi+1 = 1, and that yi lies in F1 . Then, we replace the subword gnp yi gnp yi+1 by 23 gn2p yi yi+1 . In the case where εi+2 = −1, note that yi yi+1 does not belong to F1 , since yi ∈ F1 and yi+1 ∈ / F1 . In the case where εi+2 = 1, we repeat the previous operation, and so on. Similarly, if εi = εi+1 = −1 and yi lies in F1 , we replace the subword gn−p yi gn−p yi+1 of φp,n by gn−2p yi yi+1 , and so on. At the end of this process, we have φp,n (x) = z0 gnε1 n1 p z1 gnε2 n2 p · · · gnε` n` p z` , with n1 , . . . , n` ∈ N∗ , and zi ∈ / F1 for every i ∈ J1, ` − 1K. We can now use Baumslag’s lemma 2.20 with c = gn . We claim that there exists n(x) such that zi does not belong to M (gn ) for every n ≥ n(x) and for every i ∈ J1, ` − 1K. Indeed, suppose that zi lies in M (gn ) = hgn i × F1 , for some n. Since zi does not belong to F1 , it has infinite order, so M (zi ) is well-defined and M (zi ) = M (gn ). Then the claim follows from the fact that M (gm ) 6= M (gn ) if n 6= m (by hypothesis). Let nm := max{n(x) | x ∈ Bm }. By Corollary 2.20, there exists an integer pnm such  that ker(φpnm ,nm ) ∩ Bm = {1}. This concludes the proof. We conclude this section by proving that every hyperbolic group embeds into a torsionsaturated hyperbolic group. Theorem 4.8. Every hyperbolic group embeds into a torsion-saturated hyperbolic group. Proof. Let G be a hyperbolic group and denote by F1 , . . . , Fm a system of representatives of the conjugacy classes of finite subgroups of G. We build a graph of groups as follows: begin with a vertex v labelled by G, then for every pair {i, j} ⊂ J1, mK (including {i, i}), if Fi and Fj are isomorphic, then for every isomorphism α ∈ Isom(Fi , Fj ) add two edges from v to itself labelled by α. Denote by G the fundamental group of this graph of groups. It is hyperbolic by Bestvina-Feighn’s combination theorem [BF92]. Let us prove that it is torsion-saturated. By definition, for every isomorphism α : F1 → F2 between finite subgroups of G, there exists an element g of G such that gxg −1 = α(x), for all x ∈ F1 . Hence the first condition of Definition 4.1 is satisfied by G. It remains to verify that the second condition holds. Let F be a finite subgroup of G. We can assume that F = Fi for some 1 ≤ i ≤ m. Let a and b be the two stable letters associated with the two HNN extensions over the identity of Fi . The group ha, bi is free, and M (a) = hai × F , M (b) = hbi × F . This concludes the proof.  5. Quasi-floors and quasi-towers Hyperbolic floors and hyperbolic towers have been introduced by Sela in [Sel01] to solve Tarski’s problem about the elementary equivalence of free groups (see also Kharlampovich and Myasnikov’s NTQ groups). Since we want to deal with torsion, we need new definitions. We introduce below quasi-floors and quasi-towers. 5.1. Definitions. Definition 5.1 (Quasi-floor). Let G and H be two groups. Let ∆ be a centered splitting of G. Let VG be the set of vertices of ∆, and v the central vertex. Suppose that H splits as a graph of groups with finite edge groups, and denote by VH the set of vertices of this splitting. We say that G is a quasi-floor over H if there exist two homomorphisms r : G → H and j : H → G, a partition VH = VH1 t VH2 and a bijection s : VG \ {v} → VH1 such that the following conditions hold: • j ◦ r is ∆-related to the identity of G; • for every w in VG \ {v}, r(Gw ) = Hs(w) ; • for every u ∈ VH2 , Hu is finite and j is injective on Hu . If, moreover, there exists a one-ended subgroup A of G such that A ∩ ker(r) 6= {1}, the quasi-floor is said to be strict. 24 Remark 5.2. Recall that the first condition means that j ◦ r is inner on every vertex group Gw , with w 6= v, and on every finite subgroup of Gv (see Definition 3.12). It is not hard to see that the three conditions in the previous definition imply the following: • j is injective in restriction to any one-ended subgroup of H; • r ◦ j is inner on every Hu , with u ∈ VH1 ; u • for every u in VH1 , there exists gu ∈ G such that j(Hu ) = Ggs−1 . (u) Note in particular that r sends Gw isomorphically on Hs(w) (for every w 6= v), and that j sends Hu isomorphically on a conjugate of Gs−1 (u) (for every u ∈ VH1 ). Figure 5. G is a quasi-floor over H. On this figure, |VH1 | = 3 and |VH2 | = 1. The black vertex (on the right) is labelled by a finite group. Edges with infinite stabilizer are depicted in bold. Sometimes it is convenient to think of G and H as subgroups of a bigger group G0 that retracts onto H via an epimorphism ρ : G0 → H such that ρ|G = r, as illustrated below. However, it should be noted that the existence of ρ does not guarantee the existence of a homomorphism j : H → G as in the previous definition. Figure 6. The groups G and H can be viewed as subgroups of a bigger group that retracts onto H. Edges with infinite stabilizer are depicted in bold. We stress that a hyperbolic floor in the sense of Sela (see [Per11], Definition 5.4) is a quasi-floor in the sense of the previous definition. Example 5.3. Let G be a group, and H a subgroup of G. Suppose that G is a hyperbolic floor over H in the sense of Sela. Then G is a quasi-floor over H in the sense of the previous definition. In this particular case, the set VH2 is empty, j is the inclusion of H into G, and r is a retraction from G onto H, i.e. r ◦ j is the identity of H (see Figure 7 below). It should be noted that in the definition of a quasi-floor, no assumption is made about the image of the QH group Gv , whereas in the definition of a hyperbolic floor, r(Gv ) is assumed to be non-abelian. It turns out that this hypothesis is not necessary to prove that hyperbolicity is preserved under elementary equivalence. 25 Figure 7. G is a hyperbolic floor over H in the sense of Sela, r ◦ j = idH . In the definition of a quasi-floor, r is not a retraction (it is not even surjective), j is not injective and H is not a subgroup of G. However, r can be viewed as a "piecewise retraction" from G to H, and j can be viewed as a "piecewise inclusion" from H to G. Indeed, as we mentionned in Remark 5.2, it follows easily from Definition 5.1 that r ◦ j is inner on every vertex group Hu with u ∈ VH1 (in particular on every one-ended subgroup of H), and that j is injective on every vertex group Hu with u ∈ VH (in particular on every one-ended subgroup of H). It is important to emphasize that, maybe, our construction of a quasi-floor (in Section 7) might be modified to ensure that r is an epimorphism, and that j is a monomorphism. However, it seemed to us that this could give rise to a number of new technical difficulties. These complications will be avoided by using Theorem 4.8 stating that every hyperbolic group embeds into a torsion-saturated hyperbolic group (see Definition 4.1). Here below is an example of a quasi-floor in the presence of torsion. Example 5.4. Let A = (hxi × F (x1 , x2 )) ∗ (hyi × F (x3 , x4 )), with x of order 6 and y of order 10. F (xi , xj ) stands for the free group on two generators xi and xj . Let Σ be the orientable surface of genus two with two boundary components, and let S = π1 (Σ). Call hb1 i and hb2 i its two boundary subgroups. Let B = hzi × S with z of order 2. Let us define a graph of groups with two vertices labelled by A and B, and two edges linking these vertices, identifying the extended boundary subgroup hzi × hb1 i with hx3 , [x1 , x2 ]i < A by z 7→ x3 , b1 7→ [x2 , x1 ], and the extended boundary subgroup hzi×hb2 i with hy 5 , [x3 , x4 ]i < A by z 7→ y 5 , b2 7→ [x4 , x3 ]. Call G the fundamental group of this graph of groups. First, note that G cannot be a quasi-floor over A. To see that, remark that each involution of G commutes with an element of order 3 and with an element of order 5, whereas there are two conjugacy classes of involutions in A: those commuting with an element of order 3, and those commuting with an element of order 5. Hence, there cannot exist any homomorphism G → A that is injective on finite subgroups. We shall prove that G is a quasi-floor over A∗hx3 i'hy5 i . Here is a presentation of G: + * tx3 t−1 = y 5 , x6 = y 10 = 1, x, y, x1 , x2 , x3 , x4 , s1 , s2 , s3 , s4 , t [s3 , s4 ][s1 , s2 ][x2 , x1 ]t−1 [x4 , x3 ]t = 1, G= [x, x1 ] = [x, x2 ] = [y, x3 ] = [y, x4 ] = 1 The group G retracts onto tx3 t−1 = y 5 , x6 = y 10 = 1, * H= + ' A∗hx3 i'hy5 i x, y, x1 , x2 , x3 , x4 , t [x, x1 ] = [x, x2 ] = [y, x3 ] = [y, x4 ] = 1 via the epimorphism r : G → H defined   a 7→ a r : si 7→ xi   si 7→ t−1 xi t1 as follows: if a ∈ {x, y, x1 , x2 , x3 , x4 , t} . if 1 ≤ i ≤ 2 if 3 ≤ i ≤ 4 Hence, G is a quasi-floor over H = A∗hx3 i'hy5 i . See Figure 8 below. We now define quasi-towers, which are obtained by successive addition of quasi-floors. 26 Figure 8. G is a quasi-floor over H, but not over A. Definition 5.5 (Quasi-tower). Let G and H be two groups. We say that G is a quasitower over H if there exists a finite sequence of groups (Gm )0≤m≤n , with n ≥ 1, G0 = G and Gn = H, such that for every integer m in J1, nK, the group Gm−1 is a quasi-floor over Gm . If, moreover, every quasi-floor is strict, then the quasi-tower is said to be strict. We end this subsection with two definitions that are comparable to Sela’s elementary prototype (Definition 7.3 of [Sel09]) and Sela’s elementary core (Definition 7.5 of [Sel09]). Definition 5.6 (Quasi-prototype). A quasi-prototype is a group G that is not a strict quasi-floor over any group H. Example 5.7. A one-ended hyperbolic group whose Z-JSJ splitting does not contain any QH vertex is a quasi-prototype. Definition 5.8 (Quasi-core). Let G be a group. If G is not a quasi-prototype, a quasi-core of G is a group C satisfying the two following conditions: • G is a strict quasi-tower over C. • C is a quasi-prototype. If G is a quasi-prototype, we define G as the only quasi-core of G. Remark 5.9. Note that if a quasi-core exists, it is not unique a priori. 5.2. Inheritance of hyperbolicity. Here is an easy but essential proposition. Proposition 5.10. Let G and H be two groups. Suppose that G is a quasi-tower over H. The following hold: • G is hyperbolic if and only if H is hyperbolic. • G embeds into a hyperbolic group if and only if H embeds into a hyperbolic group. • G is hyperbolic and cubulable if and only if H is hyperbolic and cubulable. The proof of the third claim is postponed to Section 6.4 (see Proposition 6.13). Proof. We shall prove the proposition in the case where G is a quasi-floor over H, the general case follows immediately by induction. Let ∆G and ∆H be the splittings of G and H associated with the quasi-floor structure. By definition, ∆G is a centered graph of groups. Let VG be its set of vertices, and let v be the central vertex. Denote by VH1 the set of vertices of ∆H whose stabilizers are infinite. By definition, there exists a bijection s : VG \ {v} → VH1 such that Gw ' Hs(w) for every w ∈ VG \ {v}. We prove the first claim. Suppose that H is hyperbolic. Then, by Proposition 3.10, Hu is hyperbolic for every vertex u of ∆H . As a consequence, the vertex groups of ∆G are hyperbolic. Since each edge group of ∆G is virtually cyclic and almost malnormal in Gv , it follows from the Bestvina-Feighn combination theorem (see Proposition 3.11) that G is hyperbolic. Conversely, if G is hyperbolic, we prove in exactly the same way that H is hyperbolic. Now, let us prove the second claim (see Figure 9 below). Suppose that H embeds into a hyperbolic group Γ. In particular, each Hu embeds into Γ. As a consequence, each Gw 27 embeds into Γ, for w ∈ VG \ {v}. We construct a graph of groups ∆ΓG from ∆G by replacing each vertex group Gw by Γ. Recall that ∆G is 2-acylindrical by definition of a centered graph of groups 3.8, so ∆ΓG is 2-acylindrical. Call Ω the fundamental group of ∆ΓG . It is clear that G embeds into Ω. Moreover, Ω is hyperbolic by the combination theorem of Bestvina and Feighn. Conversely, if G embeds into a hyperbolic group, we prove in the same way that H embeds into a hyperbolic group.  Figure 9. The group G is a quasi-floor over H. If G embeds into a hyperbolic group Γ, then H embeds into a hyperbolic group. Conversely, if H embeds into a hyperbolic group Γ, then G embeds into a hyperbolic group. Edges with infinite stabilizer are depicted in bold. 5.3. Every Γ-limit group has a quasi-core. We shall prove the following result: Proposition 5.11. Let Γ be a hyperbolic group, and G a Γ-limit group. Then G has a quasi-core C. Moreover, G is hyperbolic if and only if C is hyperbolic. The second part of the previous proposition is an immediate consequence of Proposition 5.10 above. It remains to prove the first part, that is: Proposition 5.12. If Γ is a hyperbolic group, then every Γ-limit group has a quasi-core. In other words, the previous proposition claims that a Γ-limit group is either a quasiprototype, either a strict quasi-tower over a quasi-prototype. The proposition is an easy consequence of the following lemma. Lemma 5.13. There does not exist any infinite sequence (Gn )n≥0 of finitely generated groups such that G0 is a Γ-limit group and, for every integer n, Gn is a strict quasi-floor over Gn+1 . First, note that if Γ is a torsion-free hyperbolic group, it follows from the descending chain condition 2.7 that there does not exist any infinite sequence (Gn )n≥0 such that G0 is a Γ-limit group and Gn is a hyperbolic floor over Gn+1 (in the sense of Sela). In the presence of torsion, however, Definition 5.1 has two drawbacks that seem to be obstacles to the use of the descending chain condition: if G is a Γ-limit group, and if G is a quasi-floor over H, then in general H is neither a Γ-limit group, nor a quotient of G. We remedy the first issue using the fact that every hyperbolic group embeds into a torsion-saturated hyperbolic group (see Theorem 4.8). Proposition 5.14. Let Γ be a hyperbolic group, and G a Γ-limit group. Let Γ be a torsionsaturated hyperbolic group containing Γ. Suppose that G is a quasi-floor over a finitely generated group H. Then H is a Γ-limit group. Proof. Let ∆H be the splitting of H over finite groups associated to the structure of a quasi-floor. It follows from the definition of a quasi-floor that every vertex group of ∆H embeds into G (see Remark 5.2), so is a Γ-limit group. By Theorem 4.3, the class of Γ-limit groups is closed under HNN extensions and amalgamated free products over finite groups, so H is a Γ-limit group.  28 The following corollary is immediate. Corollary 5.15. Let Γ be a hyperbolic group. Let Γ be a torsion-saturated hyperbolic group containing Γ. Let (Gn )n≥0 be a sequence of finitely generated groups such that G0 is a Γlimit group and Gn is a quasi-floor over Gn+1 for every n. Then every Gn is a Γ-limit group. Then, the following proposition remedies the lack of surjectivity in the definition of a quasi-floor, under the assumption that each quasi-floor is a Γ-limit group. Proposition 5.16. Let Γ be a hyperbolic group. There does not exist any infinite sequence (Gn )n≥0 of groups such that, for every integer n, Gn is a strict quasi-floor over Gn+1 and Gn is a Γ-limit group. Proof. Let (Gn )n≥0 be a sequence of groups such that, for every n, Gn is a strict quasifloor over Gn+1 and Gn is a Γ-limit group. Denote by rn : Gn → Gn+1 and jn : Gn+1 → Gn the associated homomorphisms, for every n. Let G0n = rn ◦ · · · ◦ r0 (G0 ). We shall apply the descending chain condition 2.7 to the sequence (G0n )n≥0 . It follows from the definition of a strict quasi-floor that there exists a one-ended subgroup An of Gn such that An ∩ ker(rn+1 ) 6= {1}. In addition, the restriction of rn ◦ · · · ◦ r0 ◦ j0 ◦ · · · ◦ jn to An is a conjugation. Consequently, rn ◦ · · · ◦ r0 (j0 ◦ · · · ◦ jn (An )) ∩ ker(rn+1 ) 6= {1}. So the restriction of rn+1 to G0n = rn ◦ · · · ◦ r0 (G0 ) is not injective. Hence, the descending chain condition 2.7 implies that the sequence (G0n ) is finite, so the sequence (Gn ) is finite as well.  We can now prove Lemma 5.13, which implies Proposition 5.12. Proof of Lemma 5.13. Let (Gn )n≥0 be a sequence of finitely generated groups such that G0 is a Γ-limit group and, for every integer n, Gn is a strict quasi-floor over Gn+1 . We aim to prove that this sequence is finite. By Corollary 5.15, every Gn is a Γ-limit group, where Γ stands for a torsion-saturated hyperbolic group containing Γ. Then it follows from Proposition 5.16 that the sequence (Gn )n≥0 is finite.  5.4. Quasi-floor and relatedness. Here is a result that will be useful in the next section. Proposition 5.17. Let G and H be two finitely generated groups. Suppose that G is a quasi-floor over H. By definition, G splits as a centered splitting ∆G . Let r : G → H and j : H → G be the homomorphisms associated with the quasi-floor structure. Let K be a one-ended group having a Z-JSJ splitting, denoted by ∆K . Then, (1) for every monomorphism f : K ,→ G, j ◦ r ◦ f and f are ∆K -related; (2) for every monomorphism f : K ,→ H, r ◦ j ◦ f and f are ∆K -related. Proof. We shall prove the first assertion. We have to prove that f and j ◦ r ◦ f coincide, up to conjugacy by an element of G, on every non-QH vertex group of ∆K , as well as on every finite subgroup of K. The condition concerning finite subgroups is obvious, since j ◦ r is inner on each finite subgroup of G. Now, let R be a non-QH vertex group of ∆K . We shall prove that f (R) belongs to a non-QH vertex of ∆G . By definition, R is elliptic in every tree on which K acts with edge stabilizers in Z or finite. Therefore, f (R) is elliptic in the Bass-Serre tree T of ∆G (indeed, the preimage under f of every Z-subgroup (resp. finite subgroup) of G is a Z-subgroup (resp. finite subgroup) of K, because f is injective). We make the following observation: let S be a finite-by-orbifold group, and let B be a subgroup of S. If B is elliptic in every splitting of S over Z, then B is finite or lies in an extended boundary subgroup (see [GL16] Corollary 5.24 (5)). As a consequence, if R is rigid, f (R) lies in a conjugate of a non-QH vertex group of ∆G . In the case where R is virtually cyclic, then f (R) may possibly lie in a boundary subgroup of the central QH vertex group of ∆G . In any case, f (R) lies in a conjugate of a non-QH vertex group of 29 ∆G . Hence, since j ◦ r is ∆G -related to the identity of G, there exists an element g in G such that j ◦ r ◦ f |R = ιg ◦ f |R . This finishes the proof of the first assertion. We now prove the second assertion. By definition, there exists a splitting ∆H of H over finite groups such that r ◦ j is inner on every one-ended vertex group of this splitting (see Remark 5.2). Since f (K) ' K is one-ended, it is contained in a one-ended vertex of ∆H . Thus, r ◦ j is inner on f (K).  6. Proofs of the theorems In this section, we shall prove our main results by admitting Proposition 6.2, whose proof is postponed to Section 7 for sake of clarity. 6.1. How to build a quasi-floor using first-order logic. We shall prove the following proposition by means of first-order logic. Proposition 6.1. Let Γ be a group that embeds into a hyperbolic group, and let G be a finitely generated group such that Th∀∃ (Γ) ⊂ Th∀∃ (G). Suppose that Γ is a quasi-tower over a group Γ0 , and that G is a quasi-tower over a group G0 . Let H be a one-ended subgroup of G0 . Then one of the following holds: • H embeds into Γ0 , • or there exists a non-injective preretraction H → G0 , that is a homomorphism related to the inclusion of H into G0 (see Definition 3.6). But before proving the proposition above, let us explain how it will be used in the sequel. In Section 7, we shall prove the following proposition, whose proof is quite technical. Proposition 6.2. Let G be a finitely generated group possessing a Z-JSJ splitting. Let H be a one-ended factor of G (defined in Section 2.6) that is not finite-by-orbifold. If there exists a non-injective preretraction H → G, then G is a strict quasi-floor. Propositions 6.1 and 6.2 above are complementary and explain how to build quasi-floors. The first one states the existence of a non-injective preretraction under certain conditions, while the second one asserts that a strict quasi-floor can be built using a non-injective preretraction. Combining these two propositions, we get: Proposition 6.3. Let Γ be a group that embeds into a hyperbolic group, and let G be a finitely generated group such that Th∀∃ (Γ) ⊂ Th∀∃ (G). Let G0 be a quasi-core of G. Suppose that Γ is a quasi-tower over a group Γ0 . Let H be a one-ended factor of G0 that is not finite-by-orbifold. Then H embeds into Γ0 , Proof of Proposition 6.1. By hypothesis, G is a quasi-tower over a group G0 . Denote by j : G0 → G the associated homomorphism. Let H be a one-ended subgroup of G0 , and let ∆ be its canonical Z-JSJ splitting. Note that j|H is injective (see Remark 5.2). We suppose that H does not embed into Γ0 . We will prove the existence of a non-injective homomorphism H → G0 related to the inclusion of H into G0 . Step 1. There exist non-trivial elements h1 , . . . , hk ∈ H such that every homomorphism f : H → Γ is ∆-related to a homomorphism f 0 : H → Γ that kills some h` . Proof of Step 1. Since Γ is a quasi-tower over Γ0 , there exists by definition a finite sequence of groups (Γm )0≤m≤n such that Γ0 = Γ and Γn = Γ0 , and for every 1 ≤ m ≤ n there exist two homomorphisms rm : Γm−1 → Γm and jm : Γm → Γm−1 such that jm ◦ rm is related to the identity of Gm−1 . Let r0 = j0 = idΓ . Let f be a homomorphism from H to Γ. First, we shall prove that f is related to a noninjective homomorphism u. Since there is no monomorphism from H into Γ0 , rn ◦· · ·◦r0 ◦f : 30 H → Γ0 is non-injective. Let N be the smallest integer such that rN ◦ · · · ◦ r0 ◦ f is noninjective. If N = 0, f is non-injective, so we define u := f . If N ≥ 1, then f is injective, so j1 ◦ r1 ◦ f is related to f by Lemma 5.17. If N = 1, we define u := j1 ◦ r1 ◦ f . If N ≥ 2, then r1 ◦ f is injective, so j2 ◦ r2 ◦ r1 ◦ f is related to r1 ◦ f by Lemma 5.17. Thus j1 ◦ j2 ◦ r2 ◦ r1 ◦ f is related to j1 ◦ r1 ◦ f , which is itself related to f . An easy induction proves that we can take u := j0 ◦ · · · jN ◦ rN ◦ · · · ◦ r0 ◦ f . Now, it follows from Corollary 3.2 that there exists a homomorphism f 0 that kills h` for some ` ∈ J1, kK and that is related to u, which is itself related to f . By transitivity, f 0 is related to f . Step 2. There exists a non-injective homomorphism p : H → G that is related to j|H . Proof of Step 2. The proof consists in expressing by a first-order sentence the statement of Step 1, and by interpreting this sentence in G. Let H = hs1 , . . . , sn | w1 , w2 , . . .i be a (possibly infinite) presentation of H. Let Wi = {w1 , . . . , wi } for every i ≥ 0. Denote by Hi the finitely presented group hs1 , . . . , sn | Wi i. By hypothesis, Γ embeds into a hyperbolic group Ω. As a hyperbolic group, Ω is equationally noetherian (see [RW14], Corollary 6.13). Then Γ and G are equationally noetherian, as Ω-limit groups (see [OH07] Corollary 2.10). As a consequence, the sets Hom(H, Γ) and Hom(H, G) are respectively in bijection with Hom(Hi , Γ) and Hom(Hi , G) for i large enough (see Lemma 5.2 of [RW14]). Hence, there exists an integer i such that Hom(H, Γ) (resp. Hom(H, G)) is in bijection with the n-tuples in Γn (resp. Gn ) solutions of the following system of equations, denoted by Σi (x1 , . . . , xn ):  w1 (x1 , . . ., xn ) = 1    .. Σi (x1 , . . . , xn ) : . .    wi (x1 , . . ., xn ) = 1 Let f and f 0 be homomorphisms from H to Γ. Recall that there exists an existential formula φ(x1 , . . . , x2n ) with 2n free variables such that  Γ |= φ f (s1 ), . . . , f (sn ), f 0 (s1 ), . . . , f 0 (sn ) if and only if f and f 0 are ∆-related (see Lemma 3.7). We can write a ∀∃ first-order sentence µ, verified by Γ, whose interpretation in Γ is the statement of Step 1: for every homomorphism f : H → Γ, there exists a homomorphism f 0 : H → Γ that is ∆-related to f and that kills some h` . The sentence µ is the following:      µ : ∀x1 . . . ∀xn ∃y1 . . . ∃yn  Σi (x1 , . . . , xn ) ⇒   Σi (y1 , . . . , yn )  ∧ φ(x . W1 , . . . , xn , y1 , . . . , yn )  ∧ hi (y1 , . . . , yn ) = 1  i∈J1,kK Since µ ∈ Th∀∃ (Γ) ⊂ Th∀∃ (G), the sentence µ is true in G as well. The interpretation of µ in G is the following: for every homomorphism f : H → G, there exists a homomorphism f 0 : H → G that is ∆-related to f and that kills some h` . By taking f = j|H , we get a non-injective homomorphism p : H → G that is related to j|H . Step 3. We have proved the existence of a non-injective homomorphism p : H → G that is related to j|H . Let r : G → G0 be the homomorphism associated with the structure of a quasi-tower. r ◦ p : H → G0 is related to (r ◦ j)|H , which is related to the inclusion of H into G0 by the second assertion of Lemma 5.17 (note that this assertion is stated for a quasi-floor, but it extends obviously to the case of a quasi-tower). This concludes the proof.  31 6.2. Being a subgroup of a hyperbolic group is a first-order invariant. We shall prove that the property of being a subgroup of a hyperbolic group is preserved under elementary equivalence, among finitely generated groups. More precisely, we will prove the following theorem. Theorem 6.4. Let Γ be a group that embeds into a hyperbolic group Ω, and let G be a finitely generated group. If Th∀∃ (Γ) ⊂ Th∀∃ (G), then G embeds into a hyperbolic group. Proof. Since G is a Ω-limit group, it possesses a quasi-core G0 (according to Proposition 5.12). Notice that every one-ended factor of G0 that is finite-by-orbifold is hyperbolic, as a consequence of Corollary 2.17. If each one-ended factor of G0 is finite-by-orbifold, then G0 is hyperbolic, so G embeds into a hyperbolic group by Proposition 5.10. Otherwise, let H1 , . . . , Hp be the one-ended factors of G0 that are not finite-by-orbifold. It follows from Proposition 6.3 that each Hk embeds into Γ, so into Ω. Let Ω0 be the group obtained by replacing by Ω each Hk in a Stallings-Dunwoody splitting of G0 . It is clear that G0 embeds into Ω0 . In addition, Ω0 is hyperbolic. So by Proposition 5.10, G embeds into a hyperbolic group Ω00 .  Let us observe that, if Ω is locally hyperbolic, then Ω00 is locally hyperbolic as well. As a consequence, the following theorem holds. Theorem 6.5. Let Γ be a locally hyperbolic group, and let G be a finitely generated group. If Th∀∃ (Γ) ⊂ Th∀∃ (G), then G is a locally hyperbolic group. Remark 6.6. We stress that the theorem above can be derived more directly from Sela’s shortening argument, without using quasi-towers. In [Sel01], Sela proved (Corollary 4.4) that a limit group is hyperbolic if and only if it does not contain Z2 . Therefore, a finitely generated group G satisfying Th∀∃ (F2 ) ⊂ Th∀∃ (G) is hyperbolic (thanks to Corollary 2.17). In fact, Sela’s proof shows that G is locally hyperbolic, and it turns out that this proof remains valid if we replace F2 by a given locally hyperbolic group. 6.3. Being hyperbolic is a first-order invariant. Let G be a finitely generated group with the same first-order theory as a hyperbolic group Γ. In this section, we shall prove that G is hyperbolic. Let G0 be a quasi-core of G, and Γ0 a quasi-core of Γ (these groups exist thanks to Proposition 5.12). According to Proposition 5.10, it is enough to prove that G0 is hyperbolic. Denote by G01 , . . . , G0n the one-ended vertex groups of a StallingsDunwoody decomposition ∆G0 of G0 that are not finite-by-orbifold. It is enough to prove that G01 , . . . , G0n are hyperbolic, because the finite-by-orbifold vertex groups of ∆G0 are hyperbolic. Indeed, by Theorem 6.4, G embeds into a hyperbolic group, so G0 embeds into a hyperbolic group as well (thanks to Proposition 5.10). Denote by Γ01 , . . . , Γ0m the one-ended vertex groups of a Stallings-Dunwoody splitting of 0 Γ that are not finite-by-orbifold. We aim to prove that each G0k is isomorphic to some Γ0` . Since G embeds into a hyperbolic group, it follows from Proposition 6.3 that there exist two applications τ : J1, nK → J1, mK and σ : J1, mK → J1, nK such that G0k embeds into Γ0τ (k) for every k ∈ J1, nK, and Γ0` embeds into G0σ(`) for every ` ∈ J1, mK. We will prove that we can choose τ and σ so that σ ◦ τ is a permutation of J1, nK. It will be enough to conclude (see Proposition 6.8). For example, suppose that n = m = 1. Then G01 embeds into Γ01 and Γ01 embeds into G01 . Since Γ is assumed to be hyperbolic, Γ0 is hyperbolic as well, by Proposition 5.10. As a one-ended hyperbolic group, Γ01 is co-Hopfian, so G01 is isomorphic to Γ01 . Recall that the co-Hopf property for one-ended hyperbolic groups has been proved by Sela in the torsion-free case (see [Sel97]) and by Moioli in the general case, in his PhD thesis (see [Moi13]). In order to prove the existence of τ and σ such that σ ◦ τ is a permutation of J1, nK, we need to strenghten Proposition 6.3. 32 Proposition 6.7. Let Γ be a group, and let G be a finitely generated group. Suppose that • Γ embeds into a hyperbolic group Ω; • Th∀∃ (Γ) ⊂ Th∀∃ (G); • Γ is a quasi-tower over a group Γ0 . As a Ω-limit group, G has a quasi-core G0 . Denote by G01 , . . . , G0n the one-ended vertex groups of a Stallings-Dunwoody splitting of G0 that are not finite-by-orbifold, and denote by Γ01 , . . . , Γ0m the one-ended vertex groups of a Stallings-Dunwoody splitting of Γ0 that are not finite-by-orbifold. • There exists a homomorphism f : G0 → Γ0 and an application τ : J1, nK → J1, mK such that, for every k ∈ J1, nK, the restriction of f to G0k is injective and f (Gk ) is contained in Γ0 γτ k(k) for some γk ∈ Γ0 . • Denote by I ⊂ J1, nK the set of indices i ∈ J1, nK such that f (G0i ) = Γ0 γτ i(i) and Γ0τ (i) is hyperbolic. If i lies in I, then for every j 6= i, and for every γ ∈ Γ0 , f (G0j ) 6⊂ f (G0i )γ . As a consequence, for every i ∈ I and j ∈ J1, nK, τ (i) = τ (j) ⇔ i = j. Proof. Suppose for the sake of contradiction that the proposition is false. Then, for every homomorphism f : G0 → Γ0 , one of the following holds: • there exists k ∈ J1, nK such that f|G0k is non-injective, • or I 6= ∅, the restriction of f to each G0k is injective, and there exist i ∈ I,j ∈ J1, nK 0 with i 6= j, and γ, γ 0 ∈ Γ0 such that f (G0j ) ⊂ f (G0i )γ = Γ0 γτ (i) . Let’s find a contradiction. Step 1. We will prove that there exist some finite subsets X1 ⊂ G01 , . . . , Xn ⊂ G0n containing only elements of infinite order, and a finite set F ⊂ G0 \ {1} such that, for every homomorphism f : G0 → Γ, one of the following claims is true: • there exists k ∈ J1, nK such that f|G0k is ∆k -related to a homomorphism f 0 : G0k → Γ that kills an element of F (where ∆k stands for the Z-JSJ splitting of G0k ), • or there exist an element γ ∈ Γ and two elements xk ∈ Xk and x` ∈ X` (with k 6= `) such that f (xk ) = γf (x` )γ −1 . Proof of Step 1. In a first time, we will define the set F and the sets X1 , . . . , Xn . Definition of F . Since Γ embeds into a hyperbolic group, for each k ∈ J1, nK, Corollary 2.4 to Sela’s shortening argument 2.2 provides us with a finite set Fk ⊂ G0k such that every non-injective homomorphism from G0k to Γ kills an element of Fk , up to precomposition by a modular automorphism of G0k . We let F := F1 ∪ · · · ∪ Fn . Definition of X1 , . . . , Xn . In the case where I is empty, let X1 = · · · = Xn = ∅. Now, assume that I is non-empty. For each k ∈ J1, nK, since G0k is not finite-by-orbifold, there exists at least one non-QH vertex group Ak in the Z-JSJ splitting ∆k of G0k . Fix an element of infinite order xk ∈ Ak . For each ` ∈ J1, nK \ {k}, if G0` is not hyperbolic, let Xk,` := ∅; if G0` is hyperbolic, let Yk,` := {f (xk ) | f ∈ Mono(G0k , G0` )} and let Xk,` be a set of representatives for the orbits of Yk,` under the action of G0` by conjugation. Note that Xk,` is finite thanks to Sela’s shortening argument 2.5. Last, we let [ Xk := {xk } ∪ Xk,` . 1≤`6=k≤n Now, we will prove that these sets have the expected property. The group Γ being a quasi-tower over Γ0 , there exists a finite sequence of groups (Γp )0≤p≤N such that Γ0 = Γ and ΓN = Γ0 , and such that Γp−1 is a quasi-floor over Γp , for each p ∈ J1, N K. Let rp : Γp−1 → Γp and jp : Γp → Γp−1 be the homomorphisms associated with the quasi-floor structure, for each p ∈ J1, N K. Let f ∈ Hom(G0 , Γ). If there exists a vertex group G0k such that f|G0k is non-injective, then it follows from Corollary 2.4 that there exists f 0 : G0k → Γ that is ∆k -related to f|G0k 33 and kills an element of F . Otherwise, if there exists a vertex group G0k such that (r1 ◦ f )|G0k is non-injective, then (j1 ◦ r1 ◦ f )|G0k is non-injective as well, so it follows from Corollary 2.4 that there exists f 0 : G0k → Γ that is ∆k -related to (j1 ◦ r1 ◦ f )|G0k and kills an element of F . But (j1 ◦ r1 ◦ f )|G0k is ∆k -related to f|G0k according to Proposition 5.17, so f 0 is ∆k -related to f|G0k and satisfies the first claim. Otherwise, we look at r2 ◦ r1 ◦ f , etc. If, after N steps, we have not found any f 0 satisfying the first claim, then the morphism 0 f = rN ◦ · · · ◦ r1 ◦ f ∈ Hom(G0 , Γ0 ) is injective on each G0j . So, by hypothesis, the set I is non-empty and there exist k, ` ∈ J1, nK with k 6= `, i ∈ I and γ, γ 0 ∈ Γ0 such that f 0 (G0k ) is contained in ιγ (f 0 (G0` )) = ιγ 0 (Γ0i ). As a consequence, G0` is hyperbolic and    −1 f 0 |G0 ◦ ιγ −1 ◦ f|G0k ∈ Mono(G0k , G0` ). ` Hence, by definition of Xk and X` , there exist xk ∈ Xk and x` ∈ X` such that f 0 (xk ) = ιγ (f 0 (x` )). So j1 ◦ · · · ◦ jN ◦ f 0 (xk ) = ιγ 0 ◦ j1 ◦ · · · ◦ jN ◦ f 0 (x` ) for some γ 0 ∈ Γ. But j1 ◦ · · · ◦ jN ◦ f 0 = j1 ◦ · · · ◦ jN ◦ rN ◦ · · · ◦ r1 ◦ f is related to f thanks to Proposition 5.17. Therefore, f (xk ) = ιγ 00 ◦ f (x` ) for some γ 00 ∈ Γ. This concludes the proof of the first step. Step 2. The statement of Step 1 is expressible by a ∀∃-sentence, denoted by φ, which is true in Γ (as in the proof of Proposition 6.1, Step 2). Since Th∀∃ (Γ) ⊂ Th∀∃ (G), φ is true in G as well. Thus, for every f ∈ Hom(G0 , G), one of the following claims is true: • there exist a vertex group G0k together with a homomorphism f 0 : G0k → G which is ∆k -related to f|G0k and kills an element of F , • or there exist an element g ∈ G and two elements xk ∈ Xk and x` ∈ X` (with k 6= `) such that f (xk ) = gf (x` )g −1 , with xk of infinite order. By definition, G is a quasi-tower over G0 . Let r : G → G0 and j : G0 → G be the two homomorphisms associated with this structure of a quasi-tower. Taking f := j, the second claim above is false. Otherwise, j(G0k ) ∩ j(G0` )g is infinite, so r ◦ j(G0k ) ∩ r ◦ j(G0` )r(g) is infinite, since r is injective in restriction to j(G0k ). But r ◦ j is inner on G0k and on G0` . Hence, there exists an element h ∈ G0 such that G0k ∩ hG0` h−1 is infinite. This is a contradiction, since G0k and G0` are two different vertex groups of a Stallings-Dunwoody decomposition of G0 . As a consequence, the first claim is necessarily true (for f := j). There exist a vertex group G0k together with a homomorphism f 0 : G0k → G which is ∆k -related to j|G0k and kills an element of F . Then (r ◦ f 0 )|G0k : G0k → G0 is a non-injective preretraction, by Lemma 5.17. It follows from Proposition 6.2 that G0 is a strict quasi-floor. This is a contradiction, since G0 is a quasi-core by hypothesis.  We can now prove that hyperbolicity is preserved under elementary equivalence. Proposition 6.8. Let Γ be a hyperbolic group and G a finitely generated group such that Th∀∃ (Γ) = Th∀∃ (G). Let G0 be a quasi-core of G and Γ0 a quasi-core of Γ. Then every one-ended factor of G0 that is not finite-by-orbifold is isomorphic to a one-ended factor of Γ0 . Therefore, G0 is hyperbolic. Thanks to Proposition 5.10 about inheritance of hyperbolicity, the corollary below is immediate. Corollary 6.9. Let Γ be a hyperbolic group and G a finitely generated group such that Th∀∃ (Γ) = Th∀∃ (G). Then G is hyperbolic. Proof of Proposition 6.8. Let G01 , . . . , G0n be the one-ended vertex groups of a StallingsDunwoody splitting of G0 that are not finite-by-orbifold, and let Γ01 , . . . , Γ0m be the oneended vertex groups of a Stallings-Dunwoody splitting of Γ0 that are not finite-by-orbifold. Since Γ is hyperbolic, Γ0 is hyperbolic (by Proposition 5.10), so Γ01 , . . . , Γ0m are hyperbolic. 34 Let f : G0 → Γ0 and h : Γ0 → G0 be the homomorphisms given by Proposition 6.7 (note that f exists because G embeds into a hyperbolic group, by Proposition 6.4). Let τ : J1, nK → J1, mK be the map such that, for every i ∈ J1, nK, f (G0i ) is contained in a conjugate of Γ0τ (i) . As in Proposition 6.7, denote by I ⊂ J1, nK the set of indices i ∈ J1, nK such that f (G0i ) = Γ0τ (i) up to conjugacy (and Γ0τ (i) is hyperbolic). Let σ : J1, mK → J1, nK be the map such that, for every j ∈ J1, mK, h(Γ0j ) is contained in a conjugate of G0σ(j) . Denote by J ⊂ J1, mK the set of indices j ∈ J1, mK such that h(Γ0j ) = G0σ(j) up to conjugacy, and G0σ(j) is hyperbolic. If i ∈ J1, nK is periodic under σ ◦ τ , then f induces an isomorphism between G0i and f (G0i ) = Γ0τ (i) , because one-ended hyperbolic groups are co-Hopfian. As a consequence, i belongs to I. So it follows from Proposition 6.7 that i is the unique preimage of τ (i) under the map τ . Similarly, if j ∈ J1, mK is periodic under τ ◦ σ, then h induces an isomorphism between Γ0j and h(Γ0j ) = G0σ(j) . Therefore, G0σ(j) is hyperbolic and j lies in J. So it follows from Proposition 6.7 that j is the unique preimage of σ(j) under the map σ. One easily checks that any such pair of maps σ, τ between finite sets are necessarily bijective, and that every element is periodic. Hence, for every i ∈ J1, nK, f induces an isomorphism between G0i and Γ0τ (i) (up to conjugacy), which is hyperbolic. This concludes the proof.  6.4. Being hyperbolic and cubulable is a first-order invariant. In this section, we shall prove the following theorems. Theorem 6.10. Let Γ be a hyperbolic group and let G be a finitely generated group. Suppose that Th∀∃ (Γ) = Th∀∃ (G). Then Γ is cubulable if and only if G is cubulable. Theorem 6.11. Let Γ and G be two finitely generated groups. Suppose that Th∀∃ (Γ) = Th∀∃ (G). Then Γ is hyperbolic and cubulable if and only if G is hyperbolic and cubulable. Note that Theorem 6.11 above follows immediately from Theorem 6.10 and from the fact that hyperbolicity is preserved under elementary equivalence, among finitely generated groups (see Theorem 6.8). We refer the reader to [Sag14] for a definition of CAT(0) cube complexes. Definition 6.12. A group G is said to be cubulable if it acts properly and cocompactly on a CAT(0) cube complex. Before proving Theorem 6.10, we shall prove the following proposition. Proposition 6.13. Let G be a hyperbolic group. If G is a quasi-tower over a group H, then G is cubulable if and only if H is cubulable. In order to prove this result, we need a combination theorem for hyperbolic and cubulable groups, analogous to that of Bestvina and Feighn for hyperbolic groups (see 3.11). Recall that a subgroup H of a group G is called almost malnormal if H ∩ gHg −1 is finite for every g in G \ H. Note that edge groups in a centered graph of groups are almost malnormal in the central vertex group (see Definition 3.8). In [HW15], Hsu and Wise proved the following result, as a special case of their main theorem. Proposition 6.14 (Combination theorem for hyperbolic and cubulable groups). Let G = A ∗C B be an amalgamated product such that A and B are hyperbolic and cubulable, and C is virtually cyclic and almost malnormal in A or in B. Then G is hyperbolic and cubulable. Let G = A∗C be an HNN extension such that A is hyperbolic and cubulable, and C is virtually cyclic and almost malnormal in A. Then G is hyperbolic and cubulable. 35 We also need the following proposition, proved by Haglund, claiming that cubulability is inherited by quasi-convex subgroups. Proposition 6.15 ([Hag08], Corollary 2.29). Let G be a cubulable group. If H is a quasiconvex subgroup of G, then H is cubulable. Let us now prove Proposition 6.13 and Theorem 6.10. Proof of Proposition 6.13. We shall prove the proposition in the case where G is a quasifloor over H, the general case follows immediately. Since G is assumed to be hyperbolic, by Proposition 5.10, the group H is hyperbolic. Let ∆G and ∆H be the splittings of G and H associated with the quasi-floor structure. By definition, ∆G is a centered graph of groups. Let VG be its set of vertices, and let v be the central vertex. Denote by VH1 the set of vertices of ∆H whose stabilizers are infinite. By definition, there exists a bijection s : VG \ {v} → VH1 such that Gw ' Hs(w) for every w ∈ VG \ {v}. Suppose that H is cubulable. Then, by Proposition 6.15, Hu is cubulable for every vertex u of ∆H . As a consequence, the vertex groups of ∆G are cubulale. Since each edge group of ∆G is virtually cyclic and almost malnormal in Gv , it follows from the combination theorem 6.14 that G is cubulable. Conversely, if G is cubulable, we prove in exactly the same way that H is cubulable.  Proof of Theorem 6.10. Let Γ be a hyperbolic group and let G be a finitely generated group such that Th∀∃ (Γ) = Th∀∃ (G). Suppose that Γ is cubulable. We will prove that G is cubulable. Let us denote by G0 a quasi-core of G and by Γ0 a quasi-core of Γ. According to Proposition 6.13, Γ0 is cubulable, so each vertex group of a Stallings-Dunwoody splitting of Γ0 is cubulable, by Proposition 6.15. Moreover, according to Proposition 6.8, every vertex group of a Stallings-Dunwoody splitting of G0 (that is not finite-by-orbifold) is isomorphic to a vertex group of a Stallings-Dunwoody splitting of Γ0 . Consequently, by Theorem 6.14 the group G0 is cubulable. Then, it follows from Proposition 6.13 that G is cubulable. Symmetrically, if G is cubulable, then so is Γ (because G is hyperbolic, by Theorem 6.8).  7. From a preretraction to a quasi-floor In the previous section, we proved our main theorems by admitting that we can build a strict quasi-floor by means of a non-injective preretraction. This is a precise statement: Proposition 7.1. Let G be a finitely generated K-CSA group that does not contain Z2 . Suppose that G has a one-ended factor H that is not finite-by-orbifold. Let ∆ be the Z-JSJ splitting of H. Suppose that there exists a non-injective homomorphism p : H → G that is ∆-related to the inclusion of H into G. Then G is a strict quasi-floor. The goal of this section is to prove the proposition above. 7.1. A preliminary proposition. Proposition 7.2. Let G be a one-ended finitely generated K-CSA group that does not contain Z2 , so that G has a Z-JSJ splitting denoted by ∆. Let p be an endomorphism of G. If p is ∆-related to the identity of G and sends every QH group isomorphically to a conjugate of itself, then p is injective. Proof. Let T be the Bass-Serre tree of ∆. We denote by V the set of vertices of T . First of all, let us recall some properties of ∆ that will be useful in the sequel (see Section 2.5). (1) The graph ∆ is bipartite, with every edge joining a vertex carrying a virtually cyclic group to a vertex carrying a non-virtually-cyclic group. 36 (2) Let v be a vertex of T , and let e, e0 be two distinct edges incident to v. If Gv is not virtually cyclic, then the group hGe , Ge0 i is not virtually cyclic. (3) The action of G on T is 2-acylindrical: if an element g ∈ G fixes a segment of length > 2 in T , then g has finite order. If ∆ is reduced to a point, then p is obviously injective. From now on, we will suppose that ∆ has at least two vertices. As a first step, we build a p-equivariant map f : T → T . Let v1 , . . . , vn be some representatives of the orbits of vertices. For every 1 ≤ k ≤ n, there exists gk ∈ G such that p(Gvk ) = gk Gvk gk−1 . We let f (vk ) = gk · vk , so that p(Gvk ) = Gf (vk ) . Then we define f on each vertex of T by equivariance. Next, we define f on the edges of T in the following way: if e is an edge of T , with endpoints v and w, there exists a unique path e0 from f (v) to f (w) in T . We let f (e) = e0 . Now we will prove that f is injective, which allows to conclude that p is injective. Indeed, if p(g) = 1 for some g ∈ G, then for every vertex v ∈ V one has p(g)·f (v) = f (g ·v) = f (v), thus g · v = v for every v. Since the action of G on ∆ is 2-acylindrical, g has finite order. Moreover the restriction of p to every element of finite order is injective (by definition of ∆-relatedness), so g = 1, which proves that p is injective. We now prove that f is injective. The proof will proceed in two steps: first, one shows that f sends adjacent vertices on adjacent vertices, then one proves that there are no foldings. f sends adjacent vertices to adjacent vertices: let’s consider two adjacent vertices v and w of T . One has d(f (v), f (w)) ≤ 2, because the action of G on T is 2-acylindrical and p is injective on edge groups, which are virtually cylic and infinite. Since the graph is bipartite, d(f (v), f (w)) and d(v, w) = 1 have the same parity. Hence d(f (v), f (w)) = 1. There are no foldings: let v be a vertex of T , let w and w0 be two distinct vertices adjacent to v. Denote by e and e0 the edges between v and w, and between v and w0 respectively. Argue by contradiction and suppose that f (w) = f (w0 ), then f (e) = f (e0 ) since there are no circuits in a tree. e0 w0 v f (e) = f (e0 ) f (v) f (w) = f (w0 ) e w If Gv is not virtually cyclic, then hGe , Ge0 i is not virtually cyclic (see the second property of ∆ recalled above), thus p(hGe , Ge0 i) is not virtually cyclic since hGe , Ge0 i is contained in Gv , and p is injective on Gv . Hence one can assume now that Gv is virtually cyclic. There exists an element g ∈ G such that w0 = g · w. Since f is p-equivariant, p(g) · f (w) = f (w), i.e. p(g) ∈ Gf (w) = p(Gw ). As a consequence, there exists an element h ∈ Gw such that p(g) = p(h). Up to multiplying g by the inverse of h, one can assume that p(g) = 1. Then g does not fix a point of T , because p is injective on vertex groups and g 6= 1. It follows that g is hyperbolic, with translation length equal to 2. 37 ge gv e0 w0 v e w The group hGe0 , Gge i is not virtually cyclic since Gw0 is not virtually cyclic. It follows that p(hGe0 , Gge i) is not virtually cyclic (indeed, p is injective on Gw0 ). On the other hand, p(hGe0 , Gge i) is equal to p(hGe0 , Ge i) because p(g) = 1. Thus p(hGe0 , Ge i) is not virtually cyclic. It is a contradiction.  7.2. Building a quasi-floor from a non-injective preretraction. Definition 7.3 (Maximal pinched set, pinched quotient, pinched decomposition). Let G be a group that splits as a centered splitting ∆G , with central vertex v. The stabilizer Gv of v is a conical finite-by-orbifold group F ,→ Gv  π1 (O). Denote by q the epimorphism from Gv onto π1 (O). Let G0 be a group, and let p : G → G0 be a homomorphism. Let S be an essential set of curves on O (see Definition 2.23). Suppose that each element of S is pinched by p (meaning that p q −1 (α) is finite for every α ∈ S), and that S is maximal for this property. The set S is called a maximal pinched set for p. Note that S may be empty. For every α ∈ S, q −1 (α) is a virtually cyclic subgroup of Gv , isomorphic to F o Z. Let Nα = ker p|q−1 (α) , and let N be the subgroup of G normally generated by {Nα }α∈S . The quotient group Q = G/N is called the pinched quotient of G associated with S. Let π : G  Q be the quotient epimorphism. Since each Nα has finite index in q −1 (α), and since p is injective on finite subgroups, killing N gives rise to new conical points and new QH vertices. The group Q splits naturally as a graph of groups ∆Q obtained by replacing the vertex v in ∆G by the splitting of π(Gv ) over finite groups obtained by killing N (see Figure 10 below). ∆Q is called the pinched decomposition of Q. Figure 10. For convenience, on this figure, F is trivial. For each α ∈ S, there exists a smallest integer n ≥ 1 such that p(αn ) = 1. Killing hαn i gives rise to a conical point of order n. The new QH vertices coming from v are denoted by v1 , v2 , v3 . We keep the same notations. Suppose that there exists an endomorphism p of G that is ∆G -related to the identity of G. Let S be a maximal pinched set for p, let Q be the pinched quotient and let ∆Q be its pinched decomposition. Denote by v1 , . . . , vn the new vertices coming from v (see Figure 10 above). Let π : G  Q be the quotient epimorphism. There exists a unique homomorphism φ : Q → G such that p = φ ◦ π. This homomorphism is non-pinching since S is assumed to be maximal. We will need a lemma. 38 Lemma 7.4. We keep the same notations. Assume that p does not send Gv isomorphically to a conjugate of itself, and denote by F the set of edges of ∆Q with finite stabilizer. Let Y be a connected component of ∆Q \ F, and let QY be its stabilizer. Then φ(QY ) is elliptic in the Bass-Serre tree of ∆G . Moreover, Y contains at most one vertex w different from the vertices vk coming from the central vertex v. If it does, then φ(QY ) = φ(Qw ). Proof. First, we shall prove that φ(Qvk ) is elliptic in the Bass-Serre tree T of ∆G , for every k ∈ J1, nK. Denote by Ok the underlying orbifold of Qvk . We shall use Proposition 2.24 to split Qvk as a graph of groups all of whose vertex groups are elliptic in T via φ. If C is an extended boundary subgroup of Qvk , C is of the form π(C 0 ) where C 0 stands for an extended boundary subgroup of Gv , so φ(C) = p(C 0 ) is elliptic in T by definition of ∆G -relatedness. Consequently, by Proposition 2.24, there exists a set Ck of disjoint simple loops on Ok such that, if X is a connected component of Ok \ Ck , and if H is the preimage of π1 (X) in Qvk , then φ(H) is elliptic in the Bass-Serre tree T . Let ∆Q (Ck ) be the splitting of Q obtained by replacing vk in ∆Q by the splitting of Qvk dual to Ck . First, note that if Ck is empty, then φ(Qvk ) is obviously elliptic in T . Assume now that Ck is non-empty and denote by vk,1 , . . . , vk,m the new vertices coming from vk . Let T 0 be the Bass-Serre tree of ∆Q (Ck ). Let wk,i , wk,j ∈ T 0 be two representatives of vk,i , vk,j ∈ ∆Q (Ck ) that are adjacent in T 0 and linked by an edge with infinite stabilizer. By the previous paragraph, there exists a non-empty subset I ⊂ T pointwise-fixed by  φ Qwk,i , and a non-empty subset J ⊂ T pointwise-fixed by φ Qwk,j . Let x ∈ I and y ∈ J such that d(x, y) = d(I, J), where d is the natural metric on T . By definition of a centered splitting, if an element of G of infinite order fixes a segment of length ≥ 2 in T , then this segment has length exactly 2 and its endpoints are translates of the central vertex v. Therefore, since f is non-pinching on Qvk , d(x, y) ∈ {0, 1, 2}, and d(x, y) = 2 if and only if x and y are translates of v. We will prove that d(x, y) = 0. First, suppose that d(x, y) = 2. Then we can assume without loss of generality that  x = v, i.e. φ Qwk,i < Gv . Since f is non-pinching on Qwk,i , the group φ Qwk,i is  infinite, so it is not contained in an extended conical subgroup of Gv . If φ Qwk,i is not contained in an extended boundary subgroup of Gv , then it follows from Proposition 2.35 that k(Qwk,i ) ≥ k(Gv ), with equality if and only if f induces an isomorphism from Qwk,i to Gv . This is a contradiction since the complexity decreases as soon as we cut along a loop or pinch a loop (so k(Qwk,i ) ≤ k(Gv )), and Qwk,i is not isomorphic to Gv . Therefore,   φ Qwk,i is necessarily contained in an extended boundary subgroup of Gv . Then φ Qwk,i fixes a point z in T such that d(x, z) = 1. As a consequence, d(z, y) = 1 or d(z, y) = 3. This last case is impossible since an element of G of infinite order fixes a segment of length ≤ 2 in T . So d(z, y) = 1, and this contradicts the definition of x. Now, suppose that d(x, y) = 1. Since ∆G is bipartite, one can assume, up  to composing φ by an inner automorphism and permuting x and y, that x = v. If φ Qwk,i is not contained in an extended boundary subgroup of Gv , we get a contradiction thanks to Proposition  2.35, as above. Thus φ Qwk,i is contained in an extended boundary subgroup of Gv . So  φ Qwk,i has a fixed point z in T such that d(x, z) = 1, so d(z, y) = 0 or d(z, y) = 2. This last case is impossible since z and y are not translates of v. As a consequence, d(z, y) = 0, and this contradicts the definition of x. Hence, we have proved that d(x, y) = 0. As a conclusion, φ(Qvk ) is elliptic in the Bass-Serre tree T of ∆G , for every k ∈ J1, nK. Now, let w be a vertex of ∆Q , different from the vertices vi , such that w and vk are linked by an edge with infinite stabilizer. Let T 00 be the Bass-Serre tree of ∆Q . For convenience, we still denote by w and vk two adjacent representatives of w and vk in T 00 linked by an edge with infinite stabilizer. We shall prove that φ(Qvk ) is contained in φ(Qw ). We have proved the existence of a subset I ⊂ T pointwise-fixed by φ(Qvk ). Since p|Gw is inner, φ(Qw ) fixes a vertex y = g · w of T , and φ(Qw ) = Gy = gGw g −1 . Let x be a 39 point of T such that d(x, y) = d(I, y). Since y is not a translate of v, it follows from the definition of a centered splitting that d(x, y) ≤ 1. Suppose for the sake of contradiction that d(x, y) = 1. Then we can assume without loss of generality that x = v. Hence, φ induces a non-pinching morphism of finite-by-orbifold groups from Qvk to Gv . Since φ is non-pinching, the group φ Qwk,i is infinite, so it is not contained in an extended conical  subgroup of Gv . If φ Qwk,i is not contained in an extended boundary subgroup of Gv , it follows from Proposition 2.35 that k(Qwk,i ) ≥ k(Gv ), with equality if and only if φ is an isomorphism. On the other hand, the complexity decreases as soon as we cut along a loop or pinch a loop, so k(Gv ) = k(Qwk,i ) and p sends Gv isomorphically to a conjugate  of itself. This contradicts the hypothesis. We have proved that φ Qwk,i is contained in an extended boundary subgroup of Gv , so it fixes a point z in T such that d(x, z) = 1. As a consequence, z = y or d(z, y) = 2. This last case is impossible since y and z are not translates of v, so z = y and this contradicts the definition of x. Hence, we have proved that φ Qwk,i fixes y, i.e. φ(Qvk ) < φ(Qw ). Now, let w1 and w2 be two vertices of ∆Q , different from the vertices vi , such that w1 and vk are linked by an edge with infinite stabilizer, and w2 and vk are linked by an edge with infinite stabilizer. We have shown that φ(Qvk ) < φ(Qw1 ) and φ(Qvk ) < φ(Qw2 ). Remark, in addition, that Qvk has an extended boundary subgroup C such that φ(C) is infinite. Hence, φ(Qw1 ) ∩ φ(Qw2 ) is infinite. By definition of a centered splitting, if an element of G of infinite order fixes a segment of length ≥ 2 in T , then this segment has length exactly 2 and its endpoints are translates of the central vertex v. Therefore, w1 = w2 . This completes the proof.  Proposition 7.5. Let G be a group possessing a centered splitting ∆G , with central vertex v. Suppose that G is not finite-by-orbifold, and that there exists an endomorphism p of G that is ∆G -related to the identity of G and that does not send Gv isomorphically to a conjugate of itself. Suppose that there exists a one-ended subgroup A of G such that Gv < A and p|A is non-injective. Then G is a strict quasi-floor. Proof. A. The non-pinching case. Suppose that p is non-pinching on Gv . By hypothesis, p does not send Gv isomorphically to a conjugate of itself, so it follows from Lemma 7.4 that ∆G has only one vertex w different from v, and that p(Gv ) < p(Gw ). Since p is inner on Gw , there exists an element g ∈ G such that ιg ◦ p is a retraction from G onto Gw . Hence, G is a quasi-floor over Gw , and this quasi-floor is strict since, by hypothesis, there exists a one-ended subgroup A of G such that Gv < A and p|A is non-injective. B. The pinching case. Step 1: pinching a maximal set of simple loops. Let S be a maximal pinched set for p, let Q be the pinched quotient and let ∆Q be its pinched decomposition. Denote by v1 , . . . , vn the new vertices coming from v (see Figure 11 below). Let π : G  Q be the quotient epimorphism. There exists a unique homomorphism φ : Q → G such that p = φ ◦ π. This homomorphism is non-pinching since S is assumed to be maximal. By Lemma 7.4, for every k ∈ J1, nK, there exists a vertex w of ∆G such that φ(Qvk ) is contained in a conjugate of Gw . If w is unique, let wk := w. If w is not unique, then we can assume that w 6= v (since ∆G is bipartite), and we let wk := w. Our construction consists in eliminating the new vertices v1 , . . . , vn coming from the central vertex v. We will illustrate each step of the construction in the case of the example pictured above (Figure 11). 40 Figure 11. Step 1. Edges with infinite stabilizer are depicted in bold. Step 2: eliminating orbifolds with non-empty boundary. Let F be the set of edges of ∆Q with finite stabilizer. For every k ∈ J1, nK, we denote by Yk the connected component of ∆Q \ F containing vk . By Lemma 7.4, φ(QYk ) = φ (Qwk ) for each k ∈ J1, nK such that the underlying orbifold of Qvk has non-empty boundary. Therefore, the quotient of Q by the subgroup normally generated by n  o  ker φ|QY | the underlying orbifold of Qvk has non-empty boundary k splits naturally as a graph of groups Λ obtained by replacing in ∆Q each subgraph Yk as above by a new vertex labelled by φ(QYk ) = φ(Qwk ) = φ ◦ π (Gwk ) = p (Gwk ) = Ggwk for some g ∈ G. For the sake of clarity, this new vertex is still denoted by wk (see Figure 12 below). Call Q0 the fundamental group of Λ, and let ∆Q0 := Λ. Note that this graph of groups has finite edge groups. Let π 0 : Q  Q0 be the quotient epimorphism. There exists a unique homomorphism φ0 : Q0 → G such that p = φ0 ◦ π 0 ◦ π. Figure 12. Step 2. Edges with infinite stabilizer are depicted in bold. Note that, by construction, ∆Q0 has finite edge groups. Step 3: eliminating vertices vk such that wk = v. Let vk be a vertex such that wk = v. Note that, by definition of wk , φ0 (Q0vk ) is not contained in an extended boundary subgroup of Gv . Since φ0 is non-pinching on Q0vk (by maximality of S), and since the complexity of Q0vk is strictly less than the complexity of Gv , it follows from Proposition 2.35 that φ0 (Q0vk ) is contained in an extended conical subgroup of Ggv . As in the previous step, we replace the vertex vk by a new vertex labelled by φ0 (Q0vk ). This new vertex is called xk (see Figure 13 below). We perform the previous operation for each QH vertex vk such that wk = v. Let Λ be the resulting graph of groups. Call Q00 its fundamental group, and let ∆Q00 := Λ. Let π 00 : Q0  Q00 be the quotient epimorphism. There exists a unique homomorphism φ00 : Q00 → G such that p = φ00 ◦ (π 00 ◦ π 0 ◦ π). Step 4: eliminating the remaining QH vertices. Denote by V the set of vertices of Λ = ∆Q00 coming from v and that have not been treated yet. For each vk ∈ V , recall that wk stands for a vertex of ∆G such that φ(Qvk ) is contained in a conjugate of Gwk . Note that wk is not a translate of the central vertex v of ∆G (see Step 3). 41 Figure 13. Step 3. In this example, w2 = v. The  vertex v2 is replaced by 0 0 a vertex x2 labelled by the finite group φ Qv2 . To complete the proof, it is convenient to adopt a topological point of view. Let XG be a K(G, 1) obtained as a graph of spaces using, for each vertex or edge w of ∆G , a w (see [SW79]). Let X 00 be a K(Q00 , 1) obtained in the same K(Gw , 1) denoted by XG Q way. There exists a continuous map f :XQ00 → XG inducing φ00 : Q00 → G at the level  vk wk of fundamental groups and such that f XQ ⊂ f XQ for each remaining vertex vk 00 00 w and X w for each vertex coming from v, and f induces an homeomophism between XQ 00 G w that does not come from v. We define an equivalence relation ∼ on XQ00 by x ∼ y if vk wk x = y, or if x ∈ XQ 00 , y ∈ XQ00 and f (x) = f (y). Let g : XQ00  (XQ00 / ∼) be the quotient map. There exists a unique continuous function h : (XQ00 / ∼) → XG such that f = h ◦ g. Hence φ00 = h∗ ◦ g∗ . Note that the homomorphism g∗ is not surjective in general. Call H the fundamental group of XQ00 / ∼, let j = h∗ and r = g∗ ◦ π 00 ◦ π 0 ◦ π, so that p = j ◦ r. Note that XQ00 / ∼ naturally has the structure of a graph of spaces, and denote by ∆H the corresponding splitting of H. We claim that G is a strict quasi-floor over H (see below). Let us explain the topological construction above from an algebraic point of view in the case of our example. The only remaining vertex coming from the central vertex v is v3 (see Figure 13). Up to replacing Q00 by Q00 /hhker(ϕ)ii, where ϕ stands for the restriction of φ00 to the stabilizer Q00v3 of v3 in Q00 , we can assume that φ00 is injective on Q00v3 . We know that φ00 (Q00v3 ) is contained in Ggw3 for some g ∈ G. Moreover, φ00 sends Q00w3 isomorphically onto Ghw3 for some h ∈ G. As a consequence, i := (φ00 )−1 ◦ ιhg−1 ◦ φ00 : Q00 v3 → Q00 w3 is a monomorphism. We add an edge e to the graph of groups ∆Q00 between v3 and w3 identifying Q00 v3 with its image i(Q00v3 ) in Q00w3 (see Figure 14 below). Call H the fundamental group of this graph of groups. In other words, we obtain H by adding a new generator t to Q00 , as well as the relation ιt (x) = i(x) for every x ∈ Q00v3 . Last, we collapse the edge e, and we call ∆H the resulting splitting of H (see Figure 15 below). We define r : G → H as the composition of π 00 ◦ π 0 ◦ π : G → Q00 with the natural homomorphism from Q00 to H. Note that r is not surjective in general. Then, we define a morphism j from H to G that extends φ00 : Q00 → G by sending t to hg −1 . Since p = φ00 ◦ (π 00 ◦ π 0 ◦ π), we have p = j ◦ r. Figure 14. In this example, w3 = w1 . We define H as the fundamental group of the graph of groups obtained by adding an edge e to the graph ∆Q00 , identifying Q00v3 with i(Q00v3 ) < Q00w3 . The natural homomorphism from Q00 to H is not surjective in general. 42 Figure 15. After collapsing the edge e, we get the desired splitting ∆H of H. It remains to verify that (G, H, ∆G , ∆H , r, j) is a strict quasi-floor. • j ◦ r = p is ∆-related to the identity of G by definition of p. • Let VG be the set of vertices of ∆G , and let VH be the set of vertices of ∆H . Recall that v stands for the central vertex of ∆G . By construction of H and ∆H , the homomorphism r : G → H induces a bijection s between VG \ {v} and a subset V1 ⊂ VH such that r(Gw ) = Hs(w) , for every w ∈ VG \ {v}. • Let V2 = VH \ V1 . By construction (see Step 3 above), for every w ∈ V2 , the vertex group Hw is finite and j is injective on Hw . • By hypothesis, there exists a one-ended subgroup A of G such that Gv < A and p|A is non-injective, with p = j ◦ r. So A ∩ ker(r) 6= {1}. Hence, the quasi-floor is strict.  Before proving Proposition 6.2, we need an easy lemma. Lemma 7.6. Let G be a group with a splitting over finite groups. Denote by T the associated Bass-Serre tree. Let H be a group with a splitting over infinite groups, and let S be the associated Bass-Serre tree. If p : H → G is a homomorphism injective on edge groups of S, and such that p(Hv ) is elliptic in T for every vertex v of S, then p(H) is elliptic in T. Proof. Consider two adjacent vertices v and w in S. Let Hv and Hw be their stabilizers. The group Hv ∩ Hw is infinite by hypothesis. Moreover, p is injective on edge groups, thus p(Hv ∩ Hw ) is infinite. Hence p(Hv ) ∩ p(Hw ) is infinite. Since edge groups of T are finite, p(Hv ) and p(Hw ) fix necessarily the same unique vertex x of T . As a consequence, for each vertex v of S, p(Hv ) fixes x. It follows that the group p(H) fixes the vertex x.  We shall now prove the main result of this section. Proposition 7.1. Let G be a finitely generated K-CSA group that does not contain Z2 . Suppose that G has a one-ended factor H that is not finite-by-orbifold. Let ∆ be the Z-JSJ splitting of H. Suppose that there exists a non-injective homomorphism p : H → G that is ∆-related to the inclusion of H into G. Then G is a strict quasi-floor. Proof. Let Λ be a Stallings-Dunwoody splitting of G containing a vertex vH with stabilizer H. Let T be its Bass-Serre tree. Step 1. We shall prove that there exists a QH vertex v of ∆ such that Hv is not sent isomorphically to a conjugate of itself by p. Suppose for the sake of contradiction that each stabilizer Hv of a QH vertex v of ∆ is sent isomorphically to a conjugate of itself by p. As a consequence, p(Hv ) is elliptic in T , for every QH vertex v. On the other hand, if w is a non-QH vertex of ∆, p(Hw ) is elliptic in T by definition of ∆-relatedness. Therefore, it follows from Lemma 7.6 above that p(H) is elliptic in T , because p is injective on edge groups of ∆, and T has finite edge groups. Moreover, since p is inner on non-QH vertices of ∆, p(H) is contained in gHg −1 for some g ∈ G (note that there exists at least one 43 non-QH vertex since H is not finite-by-orbifold by hypothesis). Up to composing p by the conjugation by g −1 , one can thus assume that p is an endomorphism of H. Now, by Proposition 7.2, p is injective. This is a contradiction. Hence, we have proved that there exists a QH vertex v of ∆ such that Hv is not sent isomorphically to a conjugate of itself by p. Step 2. We shall complete the proof using Proposition 7.5. For this purpose, we shall construct a centered splitting of G, together with an endomorphism of G satisfying the hypotheses of Proposition 7.5. First, we refine Λ by replacing the vertex vH by the splitting ∆ of H. With a little abuse of notation, we still denote by v the vertex of Λ corresponding to the QH vertex v of ∆ defined in the previous step. Then, we collapse to a point every connected component of the complement of star(v) in Λ (where star(v) stands for the subgraph of Λ constituted of v and all its incident edges). The resulting graph of groups (still denoted by Λ) is non-trivial, since H is not finite-by-orbifold (by hypothesis). So Λ is a centered splitting of G, with central vertex v. The homomorphism p : H → G is well-defined on Gv because Gv = Hv is contained in H. Moreover, p restricts to a conjugation on each edge e of Λ incident to v. Indeed, either e is an edge coming from ∆, either Ge is a finite subgroup of H ; in each case, p|Ge is a conjugation since p is ∆-related to the inclusion of H into G. Therefore, one can define an endomorphism q : G → G that coincides with p on Gv = Hv and coincides with a conjugation on every vertex group Gw of Λ, with w 6= v. Hence, the endomorphism q is Λ-related to the identity of G (in the sense of Definition 3.12), and q does not send Gv isomorphically to a conjugate of itself, by Step 1. Let us prove that the restriction of q to H is non-injective. In the case where q kills an element of Hv , the claim is obvious. If the restriction of q to Hv is injective, then q is a fortiori non-pinching on Hv , and it follows that q(Hv ) is elliptic in T . Indeed, by Proposition 2.24, one can cut the underlying orbifold of Hv into connected components that are elliptic in T via q ; but edge groups of T are finite, and q is non-pinching on Hv , so q(Hv ) is elliptic in T by Lemma 7.6. Again by Lemma 7.6, q(H) is contained in H (up to conjugacy), so q induces an endomorphism of H. Now, we are ready to find a non-trivial element in ker(q) ∩ H. Let ∆0 be the splitting of H obtained by collapsing every connected component of the complement of star(v) in the Z-JSJ splitting ∆ of H. With abuse of notation, we still denote by v the vertex of ∆0 coming from the vertex v of ∆. The splitting ∆0 is centered, with central vertex v, and q|H is an endomorphism of H that does not send Hv isomorphically to a conjugate of itself. Moreover, q|H is ∆0 -related to the identity of H (in the sense of Definition 3.12); indeed, if w is a vertex of ∆0 different from v, there exists a vertex w̃ ∈ Λ such that Hw is contained in Gw̃ , and q restricts to a conjugation on Gw̃ since q is Λ-related to the identity of G, by construction. So it follows from Lemma 7.4 that ∆0 has only one vertex w different from v, and that q(Hv ) < q(Hw ). Since q is inner on Hw , there exists an element h ∈ H such that ιh ◦ q is a retraction from H onto Hw . Let x be an element of Hv that does not belong to Hw . Let y = ιh ◦ q(x); we have seen that y lies in Hw , so ιh ◦ q(y) = y. Hence, ιh ◦ q(xy −1 ) = 1, with xy −1 ∈ H \ {1}. We have proved that the restriction of q to H is non-injective. Now, it follows from Proposition 7.5 that G is a strict quasi-floor. This concludes the proof.  References [Ago13] Ian Agol. The virtual Haken conjecture. Doc. Math., 18:1045–1087, 2013. With an appendix by Agol, Daniel Groves, and Jason Manning. [Bau62] Gilbert Baumslag. On generalised free products. Math. Z., 78:423–438, 1962. [Bau67] Benjamin Baumslag. Residually free groups. Proc. London Math. Soc. (3), 17:402–418, 1967. [BF92] M. Bestvina and M. Feighn. A combination theorem for negatively curved groups. J. Differential Geom., 35(1):85–101, 1992. 44 [Bow98] Brian H. Bowditch. Cut points and canonical splittings of hyperbolic groups. Acta Math., 180(2):145–186, 1998. [Bra99] Noel Brady. Branched coverings of cubical complexes and subgroups of hyperbolic groups. J. London Math. Soc. (2), 60(2):461–480, 1999. [CDP90] M. Coornaert, T. Delzant, and A. Papadopoulos. Géométrie et théorie des groupes, volume 1441 of Lecture Notes in Mathematics. Springer-Verlag, Berlin, 1990. Les groupes hyperboliques de Gromov. [Gromov hyperbolic groups], With an English summary. [GL16] Vincent Guirardel and Gilbert Levitt. JSJ decompositions of groups. ArXiv e-prints, February 2016. [Hag08] Frédéric Haglund. Finite index subgroups of graph products. Geom. Dedicata, 135:167–209, 2008. [HW15] Tim Hsu and Daniel T. Wise. Cubulating malnormal amalgams. Invent. Math., 199(2):293–331, 2015. [KM06] Olga Kharlampovich and Alexei Myasnikov. Elementary theory of free non-abelian groups. J. Algebra, 302(2):451–552, 2006. [Mar02] David Marker. Model theory, volume 217 of Graduate Texts in Mathematics. Springer-Verlag, New York, 2002. An introduction. [Moi13] Christophe Moioli. Graphes de groupes et groupes co-hopfiens. PhD thesis, 2013. [MS84] John W. Morgan and Peter B. Shalen. Valuations, trees, and degenerations of hyperbolic structures. I. Ann. of Math. (2), 120(3):401–476, 1984. [OH07] Abderezak Ould Houcine. Limit groups of equationally Noetherian groups. In Geometric group theory, Trends Math., pages 103–119. Birkhäuser, Basel, 2007. [Os93] A. Yu. Ol0 shanskiı̆. On residualing homomorphisms and G-subgroups of hyperbolic groups. Internat. J. Algebra Comput., 3(4):365–409, 1993. [Per11] Chloé Perin. Elementary embeddings in torsion-free hyperbolic groups. Ann. Sci. Éc. Norm. Supér. (4), 44(4):631–681, 2011. [RW14] Cornelius Reinfeldt and Richard Weidmann. Makanin-razborov diagrams for hyperbolic groups. 2014. [Sag14] Michah Sageev. CAT(0) cube complexes and groups. In Geometric group theory, volume 21 of IAS/Park City Math. Ser., pages 7–54. Amer. Math. Soc., Providence, RI, 2014. [Sel97] Z. Sela. Structure and rigidity in (Gromov) hyperbolic groups and discrete groups in rank 1 Lie groups. II. Geom. Funct. Anal., 7(3):561–593, 1997. [Sel01] Zlil Sela. Diophantine geometry over groups. I. Makanin-Razborov diagrams. Publ. Math. Inst. Hautes Études Sci., (93):31–105, 2001. [Sel06] Zlil Sela. Diophantine geometry over groups. VI. The elementary theory of a free group. Geom. Funct. Anal., 16(3):707–730, 2006. [Sel09] Zlil Sela. Diophantine geometry over groups. VII. The elementary theory of a hyperbolic group. Proc. Lond. Math. Soc. (3), 99(1):217–273, 2009. [SW79] Peter Scott and Terry Wall. Topological methods in group theory. In Homological group theory (Proc. Sympos., Durham, 1977), volume 36 of London Math. Soc. Lecture Note Ser., pages 137– 203. Cambridge Univ. Press, Cambridge-New York, 1979. [Szm55] W. Szmielew. Elementary properties of Abelian groups. Fund. Math., 41:203–271, 1955. Simon André Université de Rennes 1, CNRS, IRMAR - UMR 6625, F-35000 Rennes, France. E-mail address: [email protected]
4math.GR
From Push/Enter to Eval/Apply by Program Transformation Maciej Piróg Jeremy Gibbons Department of Computer Science University of Oxford [email protected] [email protected] Push/enter and eval/apply are two calling conventions used in implementations of functional languages. In this paper, we explore the following observation: when considering functions with multiple arguments, the stack under the push/enter and eval/apply conventions behaves similarly to two particular implementations of the list datatype: the regular cons-list and a form of lists with lazy concatenation respectively. Along the lines of Danvy et al.’s functional correspondence between definitional interpreters and abstract machines, we use this observation to transform an abstract machine that implements push/enter into an abstract machine that implements eval/apply. We show that our method is flexible enough to transform the push/enter Spineless Tagless G-machine (which is the semantic core of the GHC Haskell compiler) into its eval/apply variant. 1 Introduction There are two standard calling conventions used to efficiently compile curried multi-argument functions in higher-order languages: push/enter (PE) and eval/apply (EA). With the PE convention, the caller pushes the arguments on the stack, and jumps to the function body. It is the responsibility of the function to find its arguments, when they are needed, on the stack. With the EA convention, the caller first evaluates the function to a normal form, from which it can read the number and kinds of arguments the function expects, and then it calls the function body with the right arguments. The difference between the two calling conventions is thoroughly discussed by Marlow and Peyton Jones [12]. The terms PE and EA are also used in the literature to describe abstract machines, which deal directly with program expressions, and thus do not distinguish between ‘code’ of a function and a caller. Roughly speaking, a PE machine keeps on its stack some kind of resources, which can be accessed whenever needed. In case of curried functions, they are arguments, which can be freely used by a function body. An EA machine keeps on its stack continuations, which are very often synonymous with evaluation contexts [4, 7]. Such a machine has two kinds of configurations: ‘eval’ configurations evaluate (sub)expressions independently of the context, while ‘apply’ configurations construct a new expression from the obtained value and the next continuation. Encouraged by the fact that some machines (such as the Spineless Tagless G-machine (STG) [12] used in the Glasgow Haskell Compiler) come in two versions realising the two conventions, one may suspect that the calling convention of a machine is orthogonal to the other aspects of its computational model. If so, is there a generic method of relating two such incarnations of a single machine? In this article, we give a partial answer to this question: we present a semi-mechanical method of derivation of an EA machine from its PE counterpart. Our method is based on the correspondence between interpreters written in a functional language and abstract machines, studied extensively by Danvy et al. [1]. The key observation is that tail-recursive functions are similar in structure to state-transition systems, and thus tail-recursive interpreters of programming calculi correspond to abstract machines. Moreover, a flat tail-recursive structure can always Olivier Danvy & Ugo de’Liguoro (Eds.): WoC’15 Postproceedings EPTCS 212, 2016, pp. 53–62, doi:10.4204/EPTCS.212.4 c M. Piróg and J. Gibbons This work is licensed under the Creative Commons Attribution License. 54 From Push/Enter to Eval/Apply by Program Transformation be obtained via CPS transformation followed by defunctionalisation of the resulting continuations. This method can be used to transform between different abstract machines, as long as we can encode the initial abstract machine as a functional program: abstract encoding functional program transformation −−−−−→ −−−−−−−−−−−−→ machine program tail-recursive decoding abstract functional −−−−−→ machine program Our method proposes a new tool for the ‘encoding’ part, as there are multiple choices of how one represents an abstract machine as a functional program. In particular, one can use different data structures to represent the type of the stack of the original machine. In detail, our derivation consists of the following steps: • We start with a PE machine, which is a slight generalisation of a machine proposed by Krivine [10]. It normalises terms to weak-head normal form using the call-by-name evaluation strategy. Then, we give a (big-step [6]) encoding of this machine in Haskell. (We do not use any Haskell-specific features, and the choice of Haskell over any other functional language is in this case arbitrary. The ‘lazy list concatenation’ that we use in this paper is unrelated to the lazy semantics of Haskell.) • We then perform semantics-preserving program transformations on this encoding. They are purely syntactic, that is they are not directed by any semantic understanding of the machine. In detail, we implement the stack using a list with lazy concatenation, and then apply the CPS transformation to reify the recursive calls of the operations that work on the stack as transitions of the machine. • Finally, we decode the resulting EA machine from the program obtained by these transformations. There are some strong similarities between the resulting machines and the application-related rules of the two versions of the STG machine [12] used in the Haskell GHC compiler. Thus our method proves to be useful even when dealing with real-life implementations. 2 The Krivine machine for a language with multi-argument binders We first define λ MULT , a version of the lambda calculus in which a λ -abstraction can bind more than one variable at a time, and in which an expression can be applied to a tuple of arguments. Its syntax is given by the following grammar, where e, e0 , . . . stand for expressions, x, x1 , . . . denote variables, and ha1 . . . an i is a non-empty tuple containing elements a1 , . . . , an : e ::= x | e0 he1 . . . en i | λ hx1 . . . xn i.e Intuitively, an expression e0 he1 . . . en i roughly corresponds to e0 e1 · · · en in the standard lambda calculus, while λ hx1 . . . xn i.e corresponds to λ x1 . . . . λ xn .e. Note that the λ MULT calculus is different from the one obtained by simply adding finite products to the standard lambda calculus and treating λ -abstractions as uncurried functions: for example, the term (λ hx1 . . . x4 i.e) hx1 x2 i hx3 x4 i has an ‘arity’ mismatch in the latter calculus. We give an operational semantics to λ MULT in terms of a PE abstract machine, which normalises a given expression to weak-head normal form using the call-by-name evaluation strategy. The machine is a natural extension of an abstract machine proposed by Krivine [10] (see also Biernacka and Danvy [2]), which was originally defined for a language with multi-argument binders, but with applications limited to a single argument (and not a tuple of arguments). Each machine configuration is a pair (e, s) consisting M. Piróg and J. Gibbons 55 of an expression and a stack of expressions. We write ‘:’ for the stack constructor (the ‘push’ operation), and ε for the empty stack. We write e[e1 /x1 , . . . , en /xn ] to denote an expression e in which expressions e1 , . . . , en are substituted for variables x1 , . . . , xn respectively. The transition rules are as follows: (e0 he1 . . . en i, s) ⇒ (e0 , e1 : · · · :en :s) (λ hx1 . . . xn i.e, e1 : · · · :en :s) ⇒ (e[e1 /x1 , . . . , en /xn ], s) (K-APP) (K-FUN) The initial configuration of the machine for an expression e is (e, ε ). The transition K-APP evaluates applications: it pushes the arguments on the stack and continues with the head of the application. The transition K-FUN deals with abstractions: if the abstraction needs n arguments and there are at least n expressions on the stack, the machine continues with the body of the abstraction, with the appropriate variables substituted. The machine halts when there are no transitions that match the left-hand sides of K-APP or K-FUN, that is, when trying to evaluate an application for which there are not enough arguments on the stack or when trying to evaluate a free variable. 3 Haskell implementation Now, we present a deep embedding of λ MULT and the machine in Haskell. The definition of terms is as follows: type Identifier = ... data Term = Var Identifier | App Term [Term] | Fun [Identifier] Term subst :: [(Term, Identifier)] -> Term -> Term subst = ... Neither the choice of the type of identifiers nor any concrete implementation of subst affect the derivation in any way. The Haskell encoding of the machine uses an abstract datatype representing the stack of the machine. It has two operations: type Stack a = ... push :: [a] -> Stack a -> Stack a pop :: Int -> Stack a -> Maybe ([a], Stack a) In the above, the function push places a tuple of values on top of the stack. The function pop n s attempts to extract the first n values from the top of the stack s. If the stack contains too few elements, pop returns Nothing. The most obvious implementation of this interface uses the list datatype: type Stack a = [a] push :: [a] -> Stack a -> Stack a push = (++) pop :: Int -> Stack a -> Maybe ([a], Stack a) pop n xs | length xs >= n = Just (take n xs, drop n xs) | otherwise = Nothing From Push/Enter to Eval/Apply by Program Transformation 56 The encoding of the transition rules is straightforward. We include the cases in which the machine halts: eval :: Term -> Stack Term -> (Term, Stack Term) eval (App t ts) s = eval t (push ts s) eval (Fun xs t) s = case pop (length xs) s of Just (ts1, ts2) -> eval (subst (zip ts1 xs) t) ts2 Nothing -> (Fun xs t, s) eval (Var i) s = (Var i, s) 4 -- K-APP -- K-FUN -- halt -- halt Deriving a PE machine Now, we transform the program described in the previous section. We proceed in three stages. First, we choose a different implementation of the stack datatype and the two associated operations. Then we perform CPS transformation, which reifies the recursive calls in pop as steps of execution of the abstract machine. Finally, to eliminate the higher-order functions that arise from CPS transformation, we perform inlining. 4.1 Lazy concatenation Another possible implementation of the Stack datatype is a list with lazy concatenation. It is defined as a list of lists, so that the push operation can be defined simply as consing the first argument to the front of the structure: type Stack a = [[a]] push :: [a] -> Stack a -> Stack a push xs xss = xs : xss pop :: Int -> Stack a -> Maybe ([a], Stack a) pop n ys = pop’ [] n ys pop’ :: [a] -> Int -> Stack a -> Maybe ([a], Stack a) pop’ acc n ys | m == n = Just (acc, ys) | m > n = Just (take n acc, drop n acc : ys) | m < n && length ys > 0 = pop’ (acc ++ head ys) n (tail ys) | otherwise = Nothing where m = length acc The definition of pop uses an auxiliary function pop’, which is tail-recursive. We maintain the invariant that there are no empty inner lists. That is why we include the separate case m == n to make sure that pop’ does not leave an empty list at the front of the structure. We use these definitions in our encoding of the machine. Note that we do not do that for performance reasons, because we do not intend to ever execute these programs. We use Haskell as a metalanguage to derive one abstract machine from another abstract machine. The equivalence of the programs guarantees M. Piróg and J. Gibbons 57 the equivalence of the machines. We still use regular cons-lists to represent tuples, hence standard list functions length and zip. 4.2 CPS translation Since pop’ is tail-recursive, we can see its definition as an encoding of yet another abstract machine. Our intention is to fuse the two machines together. Thus, eval cannot treat pop as an atomic operation any longer. We need an explicit transfer of control: eval calls pop, which calls eval back instead of just returning a value. We can easily achieve this behaviour with the call-by-value CPS translation of pop and pop’. We obtain functions popCPS and pop’CPS, with the property popCPS n ys k = k (pop n ys) and pop’CPS acc n ys k = k (pop’ acc n ys) for any continuation k, that is, a function of the type k :: (Maybe ([a], Stack a) -> o). From this, we easily obtain that evalCPS given below is extensionally equal to eval. popCPS :: Int -> Stack a -> (Maybe ([a], Stack a) -> o) -> o popCPS n ys k = pop’CPS [] n ys k pop’CPS :: [a] -> Int -> Stack a -> (Maybe ([a], Stack a) -> o) -> o pop’CPS acc n ys k | m == n = k (Just (acc, ys)) | m > n = k (Just (take n acc, drop n acc : ys)) | m < n && length ys > 0 = pop’CPS (acc ++ head ys) n (tail ys) k | otherwise = k Nothing where m = length acc evalCPS :: Term -> Stack Term -> (Term, Stack Term) evalCPS (App t ts) s = evalCPS t (push ts s) evalCPS (Fun xs t) s = popCPS (length xs) s aux where aux (Just (ts1, ts2)) = evalCPS (subst (zip ts1 xs) t) ts2 aux Nothing = (Fun xs t, s) evalCPS (Var i) s = (Var i, s) 4.3 Inlining We observe that in the entire program the function popCPS is called in one place only, and its continuation aux is not modified throughout the recursive calls of pop’CPS. So, we know what the continuation inside popCPS and pop’CPS is, up to its free variables. We can inline the body of the continuation, and supply values for its free variables as arguments of the popCPS operation. In detail, we first lambda-lift aux. As a result, it becomes a separate function: evalCPS2 evalCPS2 evalCPS2 evalCPS2 :: Term -> (App t ts) (Fun xs t) (Var i) Stack Term -> (Term, Stack Term) s = evalCPS2 t (push ts s) s = popCPS (length xs) s (aux2 xs t s) s = (Var i, s) From Push/Enter to Eval/Apply by Program Transformation 58 aux2 :: [Identifier] -> Term -> Stack Term -> Maybe ([Term], Stack Term) -> (Term, Stack Term) aux2 xs t s (Just (ts1, ts2)) = evalCPS2 (subst (zip ts1 xs) t) ts2 aux2 xs t s Nothing = (Fun xs t, s) Second, we inline the definitions of popCPS and push in evalCPS2. Additionally, we define a function pop’In with the property that pop’CPS vs n s (aux xs t s) = pop’In vs n t xs s. Applying this equality in the definition of evalCPS2, we obtain the following: pop’In :: [Term] -> Int -> Term -> [Identifier] -> Stack Term -> (Term, Stack Term) pop’In acc n t xs ys | m == n = evalIn (subst (zip acc xs) t) ys | m > n = evalIn (subst (zip (take n acc) xs) t) (drop n acc : ys) | m < n && length ys > 0 = pop’In (acc ++ head ys) n t xs (tail ys) | otherwise = (Fun xs t, []) where m = length acc evalIn evalIn evalIn evalIn :: Term -> (App t ts) (Fun xs t) (Var i) Stack Term -> (Term, Stack Term) s = evalIn t (ts : s) s = pop’In [] (length xs) t xs s s = (Var i, s) Now, we are almost ready to decode the final machine. The very last observation is that the argument n is redundant in pop’In: it is always equal to the length of xs, since they are equal in the call in evalIn, and they are not changed throughout the recursive calls. Therefore, we can eliminate it in the decoding, and compare the length of the accumulator to the length of xs. So, the Haskell encoding becomes as follows, in which we have pop’In2 acc t xs ys = pop’In acc (length xs) t xs ys. pop’In2 :: [Term] -> Term -> [Identifier] -> Stack Term -> (Term, Stack Term) pop’In2 acc t xs ys | m == n = evalIn2 (subst (zip acc xs) t) ys | m > n = evalIn2 (subst (zip (take n acc) xs) t) (drop n acc : ys) | m < n && length ys > 0 = pop’In2 (acc ++ head ys) t xs (tail ys) | otherwise = (Fun xs t, []) where m = length acc n = length xs evalIn2 evalIn2 evalIn2 evalIn2 :: Term -> (App t ts) (Fun xs t) (Var i) Stack Term -> (Term, Stack Term) s = evalIn2 t (ts : s) s = pop’In2 [] t xs s s = (Var i, s) We are left with two tail- and mutually-recursive functions. Seen as transition rules, they represent two types of configuration of an abstract machine: evalIn2 represents ‘eval’ configurations with an expression and a stack, while pop’In2 represents ‘apply’ configurations, which we denote pap (short M. Piróg and J. Gibbons 59 (e0 he1 . . . ek i, s) (E-APP) ⇒ (e0 , he1 . . . ek i:s) (λ hx1 . . . xn i.e, s) (E-FUN) ⇒ (pap(ε , e, x1 . . . xn ), s) (pap(e1 : · · · :en :ε , e, x1 . . . xn ), s) (A-EQ) ⇒ (e[e1 /x1 , . . . , en /xn ], s) (pap(e1 : · · · :ek :ε , e, x1 . . . xn ), s) (A-GT) ⇒ (e[e1 /x1 , . . . , en /xn ], hen+1 . . . ek i:s), where k > n (pap(e1 : · · · :ek :ε , e, x1 . . . xn ), h f1 . . . fm i:s) (A-LT) ⇒ (pap(e1 : · · · :ek : f1 : · · · : fm :ε , e, x1 . . . xn ), s), where k < n Figure 1: The eval/apply abstract machine for ‘partial application’). The latter consists of a list of accumulated actual arguments (acc), the body of the abstraction (t), a tuple of formal arguments (xs), and the stack (ys). The transitions of the machine are shown in Figure 1. Intuitively, a pap configuration stores an abstraction and a small stack of accumulated actual arguments. When there are enough arguments, the application is performed (A-EQ and A-GT). When there are too few arguments, the small stack is extended with the arguments from the top frame of the main stack (A-LT). 5 The applicative fragment of the STG machine The machine that we arrived at is the applicative fragment of the EA STG machine (as introduced by Marlow and Peyton Jones [12]) in disguise. We only need to slightly rearrange the rules, as shown in Figure 2. First, if e0 in E-APP is an abstraction, the transition is always followed by E-FUN, which can be followed only by A-LT (since n in E-FUN is greater than 0), and then one of the rules A-EQ, A-GT, or A-LT. We fuse these three possible execution paths into three rules: STG-TCALL, STG-EXACT, and STG-CALLK. We can reuse them to deal with abstractions when there are some arguments on the stack, by constructing an application (STG-PAP2), so that a path E-FUN⇒A-LT⇒(A-EQ, A-GT, or A-LT) becomes STG-PAP2⇒(STG-TCALL, STG-EXACT, or STG-CALLK). We proceed similarly with the pap configurations (STG-RETFUN), so that transitions A-EQ, A-GT, and A-LT become STG-RETFUN⇒STG-TCALL, STG-RETFUN⇒STG-EXACT, and STG-RETFUN⇒STG-CALLK respectively. Note that the rearranging of the rules can be done also on the level of Haskell programs by means of inlining and expanding of the definitions. Marlow and Peyton Jones [12] introduced two versions of the STG machine: push/enter and eval/apply, which differ only in the part that deals with abstractions and applications (they share transitions rules for algebraic data types and call-by-need updates). The rules of the machine shown in Figure 2 correspond to the application-related rules of the EA STG machine: a rule called STG-XXX here is called XXX in From Push/Enter to Eval/Apply by Program Transformation 60 (e0 he1 . . . ek i, s) (STG-TCALL) ⇒ (e0 , he1 . . . ek i:s), where e0 is not an abstraction ((λ hx1 . . . xn i.e) he1 . . . en i, s) (STG-EXACT) ⇒ (e[e1 /x1 , . . . , en /xn ], s) ((λ hx1 . . . xn i.e) he1 . . . ek i, s) (STG-CALLK) ⇒ (e[e1 /x1 , . . . , en /xn ], hen+1 . . . ek i:s), where k > n ((λ hx1 . . . xn i.e) he1 . . . ek i, s) (STG-PAP2) ⇒ (pap(e1 : · · · :ek :ε , e, x1 . . . xn ), s), where k < n (λ hx1 . . . xn i.e, he1 . . . ek i:s) (STG-RETFUN) ⇒ ((λ hx1 . . . xn i.e) he1 . . . ek i, s) (pap(e1 : · · · :en :ε , e, x1 . . . xk ), h f1 . . . fm i:s) (STG-PCALL) ⇒ ((λ hx1 . . . xk i.e) he1 . . . en f1 . . . fm i, s) Figure 2: The STG-like abstract machine the formulation by Marlow and Peyton Jones [12]. The difference is that partial applications in the EA STG machine are allocated in the heap. Therefore, there is no need for a separate pap configuration in STG, but there is a pap type of heap objects. 6 Discussion Eval/apply machines are also known as ‘eval/continue’ machines (see Danvy [5] for a discussion), since they have a strong connection with continuations and evaluation contexts [3, 4, 7, 14], which makes them modular and more amenable for reasoning. That is why they are attractive underlying evaluation models for modular and formally verified compilation techniques. The direction of our transformation (from PE to EA) also reflects the pragmatic choice of EA over PE in the Glasgow Haskell Compiler [12]. Our derivation can be easily applied to different known PE machines, such as Leroy’s ZINC [11]. Our method is inspired by Danvy et al.’s functional correspondence between evaluators and abstract machines [1]. It is important to notice that Danvy et al. use CPS translation as a tool to flatten the structure of evaluators, while here, since the pop’ operation is already in a flat, tail-recursive form, we use it to reify the recursive calls of pop’ as transitions of the machine, and no new stack of continuations emerges. The PE STG machine is in reality a hybrid machine, which is apparent in its original, three-stack formulation [9]: the machine is PE in the argument stack, but it is EA in the return and update stacks. The equivalence of two simpler variants of the EA and PE STG machines has been shown by Encina and Peña [8] by deriving both machines from a single natural semantics. Piróg and Biernacki [13] used a technique based on Danvy’s functional correspondence to derive the PE STG machine from a big-step operational semantics. M. Piróg and J. Gibbons 61 Acknowledgements We are grateful to Filip Sieczkowski, Dariusz Biernacki, and the anonymous reviewers for their valuable comments. References [1] Mads Sig Ager, Dariusz Biernacki, Olivier Danvy & Jan Midtgaard (2003): A functional correspondence between evaluators and abstract machines. In: Proceedings of the 5th International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming, 27-29 August 2003, Uppsala, Sweden, ACM, pp. 8–19, doi:10.1145/888251.888254. [2] Malgorzata Biernacka & Olivier Danvy (2007): A concrete framework for environment machines. ACM Transactions on Computational Logic 9(1), pp. 1–30, doi:10.1145/1297658.1297664. [3] Malgorzata Biernacka & Olivier Danvy (2007): A syntactic correspondence between context-sensitive calculi and abstract machines. Theoretical Computer Science 375(1-3), pp. 76–108, doi:10.1016/j.tcs.2006. 12.028. [4] Olivier Danvy (2004): On Evaluation Contexts, Continuations, and the Rest of the Computation. In Hayo Thielecke, editor: ACM-SIGPLAN Continuations Workshop (CW’04), Technical report CSR-04-1, School of Computer Science, University of Birmingham, United Kingdom, pp. 13–23. Available at http://cs. au.dk/~danvy/DSc/29_danvy_cw-2004.pdf. [5] Olivier Danvy (2009): Towards Compatible and Interderivable Semantic Specifications for the Scheme Programming Language, Part I: Denotational Semantics, Natural Semantics, and Abstract Machines. In Jens Palsberg, editor: Semantics and Algebraic Specification, Lecture Notes in Computer Science 5700, Springer Berlin Heidelberg, pp. 162–185, doi:10.1007/978-3-642-04164-8_9. [6] Olivier Danvy & Kevin Millikin (2008): On the equivalence between small-step and big-step abstract machines: a simple application of lightweight fusion. Information Processing Letters 106(3), pp. 100–109, doi:10.1016/j.ipl.2007.10.010. [7] Olivier Danvy & Lasse R. Nielsen (2004): Refocusing in Reduction Semantics. Technical Report RS-04-26, Basic Research in Computer Science (BRICS), University of Aarhus, Denmark. Available at http://www. brics.dk/RS/04/26/BRICS-RS-04-26.pdf. [8] Alberto de la Encina & Ricardo Peña-Marı́ (2009): From natural semantics to C: A formal derivation of two STG machines. Journal of Functional Programming 19(1), pp. 47–94, doi:10.1017/S0956796808006746. [9] Simon L. Peyton Jones (1992): Implementing Lazy Functional Languages on Stock Hardware: The Spineless Tagless G-Machine. Journal of Functional Programming 2(2), pp. 127–202, doi:10.1017/ S0956796800000319. [10] Jean-Louis Krivine (2007): A call-by-name lambda-calculus machine. Higher-Order and Symbolic Computation 20(3), pp. 199–207, doi:10.1007/s10990-007-9018-9. [11] Xavier Leroy (1990): The ZINC experiment: an economical implementation of the ML language. Technical report 117, INRIA. Available at http://gallium.inria.fr/~xleroy/publi/ZINC.pdf. [12] Simon Marlow & Simon L. Peyton Jones (2006): Making a fast curry: push/enter vs. eval/apply for higher-order languages. Journal of Functional Programming 16(4-5), pp. 415–449, doi:10.1017/ S0956796806005995. [13] Maciej Piróg & Dariusz Biernacki (2010): A systematic derivation of the STG machine verified in Coq. In Jeremy Gibbons, editor: Proceedings of the 3rd ACM SIGPLAN Symposium on Haskell, Haskell 2010, Baltimore, MD, USA, 30 September 2010, ACM, pp. 25–36, doi:10.1145/1863523.1863528. [14] Filip Sieczkowski, Malgorzata Biernacka & Dariusz Biernacki (2010): Automating Derivations of Abstract Machines from Reduction Semantics: A Generic Formalization of Refocusing in Coq. In Jurriaan Hage & 62 From Push/Enter to Eval/Apply by Program Transformation Marco T. Morazán, editors: Implementation and Application of Functional Languages—22nd International Symposium, IFL 2010, Alphen aan den Rijn, The Netherlands, September 1-3, 2010, Revised Selected Papers, Lecture Notes in Computer Science 6647, Springer, pp. 72–88, doi:10.1007/978-3-642-24276-2_ 5.
6cs.PL
arXiv:1311.6563v1 [cs.LO] 26 Nov 2013 Higher-order semantics for quantum programming languages with classical control George Philip Atzemoglou Wolfson College, Oxford Department of Computer Science, University of Oxford Submitted for the degree of Doctor of Philosophy Michaelmas Term 2012 To my grandfathers, George and Ermis. Abstract This thesis studies the categorical formalisation of quantum computing, through the prism of type theory, in a three-tier process. The first stage of our investigation involves the creation of the dagger lambda calculus; a lambda calculus for dagger compact categories [AC04]. Our second contribution lifts the expressive power of the dagger lambda calculus to that of a quantum programming language, by adding classical control in the form of complementary classical structures [CPP10, CD11] and dualisers [CPP08]. Finally, our third contribution demonstrates how our lambda calculus can be applied to various well known problems in quantum computation. Our construction of the dagger lambda calculus extends the linear typed lambda calculus, by defining a higher-order language for quantum protocols which is an internal language for dagger compact categories. The resulting language includes a linear negation operator and redefines the notion of binding as a symmetric relation whose scope spans the entire sequent. Reduction works by means of an explicit substitution, in the spirit of the operational semantics of the linear chemical abstract machine. The rules for explicit substitution act globally on the entire typing judgement, instead of limiting their scope to a specific subterm. This particular implementation of reduction enables us to enrich our typing dynamics by allowing the binding not just of variables, but of arbitrary terms. An elimination procedure allows us to reconstruct application using Cut, hence removing it from our primitive rule set. The new rules allow for a fully symmetric language, where inputs and outputs are treated as elements of a symmetric relation, and give rise to a new structural rule called the dagger-flip. The resulting set of rules is minimal and simple to use, which allows us to prove with ease properties like i ii subject reduction, confluence, strong normalisation and consistency. Our analysis of the language’s semantics is completed by a proof that the dagger lambda calculus is an internal language for dagger compact categories. In our second contribution, we provide a controlled way of breaching the linearity constraints of the dagger lambda calculus. Instead of the exponential connective of linear logic, we enrich our language with a view of axiomatising the basis structures of Hilbert spaces. We achieve this by providing the type-theoretic equivalent of complementary classical structures, which allows us to implement a controlled form of copying and deleting of terms in our classical basis. In order to retain sensible types, our language is also equipped with dualisers in a non self-dual setting, allowing us to factor the familiar notion of Currying by making its rule admissible in the dagger lambda calculus. Our final contribution is in the study of three well known applications of quantum computation. We first demonstrate the expressiveness of the dagger lambda calculus by using it to represent the formalism of Quantum Key Distribution; we then put it to use, by using the language to verify the protocol’s procedures. Our second application is in the quantum Fourier transform; we demonstrate how our language can represent a controlled phase gate, we use that construction to build a quantum Fourier transform, and we then use the dagger lambda calculus to ”run” a sample input through the quantum Fourier transform. Lastly, our third application provides an examination of the teleportation protocol, explaining how it is represented in our language, demonstrating corrections and the flow of measurement outcomes, and showing how a quantum term actually ends up teleporting from one party to the other. Contents I Introduction 1 1 Motivation 2 2 Outline of the Dissertation 4 II 6 Background material 3 Quantum computing 7 4 Category theory 4.1 Basic notions . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 More advanced notions . . . . . . . . . . . . . . . . . . . . . . 4.3 Specific constructions . . . . . . . . . . . . . . . . . . . . . . 9 9 10 11 5 Frobenius algebras 15 6 Categorical model 18 6.1 Categorical quantum computation . . . . . . . . . . . . . . . 18 6.2 Representation of classical structures . . . . . . . . . . . . . . 21 7 Linear logic 27 7.1 Multiplicative quantum logic . . . . . . . . . . . . . . . . . . 28 8 The linear typed lambda calculus 31 III 34 Quantum programming and classical control 9 The dagger lambda calculus 35 9.1 Language construction . . . . . . . . . . . . . . . . . . . . . . 35 iii iv CONTENTS 9.2 9.3 9.1.1 Scalars . . . . . . . . . . . . . . . . . . . . Proofs of properties . . . . . . . . . . . . . . . . 9.2.1 Subject reduction . . . . . . . . . . . . . . 9.2.2 Normalisation . . . . . . . . . . . . . . . . 9.2.3 Confluence . . . . . . . . . . . . . . . . . 9.2.4 Consistency . . . . . . . . . . . . . . . . . Correspondence to dagger compact categories . . 9.3.1 A signature for dagger compact categories 9.3.2 The free dagger compact category . . . . 9.3.3 The dagger lambda calculus . . . . . . . . 9.3.4 The syntactic category . . . . . . . . . . . 9.3.5 Proof of equivalence . . . . . . . . . . . . 10 Classical control in the †λ-calculus 10.1 Classical structures . . . . . . . . . . . . . . 10.2 Dualisers . . . . . . . . . . . . . . . . . . . 10.3 Monoidal product of terms and phase shifts 10.4 Unbiased and classical constants . . . . . . 10.5 Complementary observables . . . . . . . . . IV Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 47 47 48 49 51 51 52 52 54 54 61 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 64 68 70 73 74 81 11 Quantum Key Distribution 82 12 Quantum Fourier Transform 88 13 Teleportation Protocol 93 V 96 Conclusion 14 Concluding remarks 97 14.1 Future work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 14.2 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 98 Part I Introduction 1 Chapter 1 Motivation Quantum mechanics was initially developed in the first third of the previous century, with quantum computation being explicitly studied since the 1980’s. Though a lot of work has been done on quantum programming languages, it is still a nascent branch of science, where most of the languages have not yet been developed to higher levels of abstraction. As a result, while we do have a handful of quantum algorithms which provide promising results in the area of computational efficiency, much of the work involved in designing such an algorithm seems to be still largely based on guesswork; there is no clear set of rules, or unifying principle, that would easily allow us to combine computational primitives into building a new and efficient quantum algorithm. Furthermore, even though quantum computation is probably a more powerful means of computation than classical computing, this remains an unproven conjecture to this day. Unless we develop the means of abstracting our computational primitives to higher notions, thereby setting the foundations for a solid theory of algorithms and figuring out what gives quantum computers their extra power, we will probably never be able to prove a computational speedup or write efficient algorithms en masse. Since the turn of the century, we have seen increasing interest in the development of a quantum programming language. One very actively pursued approach has been from a programming languages perspective [Sel04a, Sel04b, vTD03, vT04, SV06, SV08, SV10]. The researchers in this field, whose work has been seminal in establishing a semantic approach to quantum programming language design, have focused in designing a higher order lambda calculus for quantum computation with classical control. More specifically, in [SV10], a quantum lambda calculus with a complicated set of rules is presented, whose structural equations nevertheless allow for higher- 2 CHAPTER 1. MOTIVATION 3 order structures. The rest of the work towards constructing a concrete model for the language’s semantics remains an open problem. Another very successful approach has come from a category theoretic perspective, where researchers have proposed a variety of diagrammatic calculi: Starting with the work of [AC04] and [Sel07]; progressing into the classical structures of [CP06], [CP07] and [CPP10]; the dualisers of [CPP08]; up until the full axiomatisation of bases through complementary observables in [CD08] and [CD11]. Because of their design, these languages are capable of expressing both quantum and classical processes, which makes them ideal for representing measurement based quantum computation, the computational paradigm that is closest to being practically implemented. Furthermore, these languages possess an obvious visual appeal and are, as a result, easy to understand and work with. Despite all that, the diagrammatic calculus does not readily lend itself to higher order operations. Moreover, despite some recent results by [DP10] and [Kis11], which deal with the issue of automated rewriting in the diagrammatic calculus, the rewrite steps are not always immediately apparent or easy to follow. The purpose of this dissertation is to bridge these two approaches, hence bringing the programming languages approach closer to the categorical approach of complementary observables, by casting the diagrammatic formalism into the rich and well established tradition of type theory. The language presented in part III of the dissertation attempts this bridge by providing a higher-order computational interpretation for the categorical semantics of [AC04], [CD11], [CPP08] and [CPP10]. The dagger lambda calculus is expressive enough to perform operations on arbitrary (black box) functions and, as such, it is capable of encoding many well known quantum algorithms. The natural way in which the dagger lambda calculus represents higherorder operations, together with the simplicity of its sequent rewriting, make it an ideal tool to be used side by side with the diagrammatic calculus. The two calculi can then complement each other, by providing the best of both worlds; visual clarity, intuitive rewrite rules and higher-order expressibility. Chapter 2 Outline of the Dissertation Part I serves as an introduction to the semantics of quantum programming languages. It prepares the ground for the rest of the thesis by presenting the main motivation for research in this area. The current section will explain the structure of the remaining parts of the dissertation, by providing an outline of the various sections and subsections. In order to make this dissertation more self-contained, part II covers all of the background material that will be used in the constructive portions of this work. This presentation starts with a quick overview of quantum computing in chapter 3. Chapter 4 provides some background on category theory, including definitions for a selection of topics from [Mac98], as well as the definitions for many of the categories that will be used in later chapters. Chapter 6 explains how the categorical structures of [AC04], together with the Frobenius algebras of [CD08], can be used to model quantum computation and classical control structures. Chapter 7 contains a brief presentation of linear logic, as well as a variant by [AD06] that is better suited for quantum computation. Finally, chapter 8, the last chapter in this part of the dissertation, prepares the ground for the later parts by presenting the linear typed lambda calculus of [AT10]. Part III of the dissertation forms the main constructive portion of this work. It begins by introducing in section 9.1 the dagger lambda calculus, a language for quantum protocols that corresponds to dagger compact categories. The next section, 9.2, provides proofs of the language’s most important properties; namely of subject reduction, strong normalisation, confluence and consistency. Section 9.3 presents a proof of the language’s correspondence to dagger compact categories by showing that the syntactic category is indeed a free dagger compact category. In section 10.1, the 4 CHAPTER 2. OUTLINE OF THE DISSERTATION 5 dagger lambda calculus is enriched with the classical structures of [CP06], [CP07] and [CPP10]. The language is then further enriched by introducing the notion of a dualiser [CPP08] in section 10.2, which can be used as a primitive to factor the notion of Currying, hence making the language’s Curry rule admissible. Sections 10.3 and 10.4 define the monoidal product and phase shift operations in the calculus and outline the requirements for the properties of unbiasedness and classical constants. Section 10.5 enriches the dagger lambda calculus with the complementary classical structures of [CD11], which lift its expressive power from quantum protocols to that of a quantum programming language. Part IV focuses on the applications of the language designed in part III. Chapter 11 shows how the dagger lambda calculus can be used to perform the Quantum Key Distribution of [Eke91], using the formalism of [CWW+ 11]. Chapter 12 then demonstrates how the language can represent and run a quantum Fourier transform, the most essential part of Shor’s factoring algorithm [Sho97]. Completing the applications’ part, chapter 13 uses the language to perform the teleportation protocol. Finally, the dissertation comes to a close in part V. This part highlights the importance of the higher-order computational interpretation provided in the dissertation, by outlining the structural insights that were gained through the study of its semantics. A list of possible directions for future work is provided, along with some concluding remarks. Part II Background material 6 Chapter 3 Quantum computing Quantum computing is a radically different paradigm for computation which relies on the laws of quantum mechanics, in the hopes of achieving a higher computational efficiency than its currently used classical counterpart. This section will cover some fundamental concepts of quantum computing [Mer07, NC00], reviewing all the material that is necessary for understanding this dissertation. Classical computers operate on regular bits, whose value is either 0 or 1. When studying quantum computers, we view |0i and |1i as orthonormal vectors, using them as a basis to span a complex Hilbert space. We are free to pick a different set of orthonormal vectors as the basis of our Hilbert space, however, the one mentioned earlier is usually referred to as the standard basis. The length of a vector in this Hilbert space does not really matter; we therefore only keep its direction and group all like vectors up to a complex multiple into equivalence classes called rays. Qubits, the quantum analogue of a bit, can have any of these rays as their value. This means that the value or state of any qubit can be written as |ψi = α|0i + β|1i where α and β are complex coefficients. The fact that a quantum state can be ”a little bit of” |0i and ”a little bit of” |1i at the same time, is called superposition. Transformations of a quantum system’s state are described by unitary operations acting on the system’s Hilbert space. Since the underlying field for our Hilbert spaces is the field of complex numbers, state vectors in H can be trivially shown to be isomorphic to the linear maps in C → H. The isomorphism maps every state |ψi to the linear map spanned by 1 7→ ψ. By a slight abuse of notation, we sometimes use |ψi to refer to 7 CHAPTER 3. QUANTUM COMPUTING 8 the linear map as such: |ψi : C → H :: c 7→ cψ The state of composite quantum systems is represented by the tensor product of the Hilbert spaces that describe their constituent parts. This behaves like a regular Kronecker product; for a system composed of A and B, we write A ⊗ B. Similarly, for two linear maps f and g running parallel to each other, each acting on a different state of a composite system, we would write f ⊗ g. It seems natural that we could use |ψi ⊗ |φi to describe the state of two qubits. We tend to write |00i for |0i ⊗ |0i and |11i for |1i ⊗ |1i. Because of superposition, however, there are some cases where a state cannot be written as the tensor product of two or more states. Typical examples of this are the Bell states: |00i + |11i, |00i − |11i, |01i + |10i and |01i − |10i. Hilbert spaces come equipped with an inner-product which, as a convention in quantum computation, is usually defined as linear in the second argument: h−|−i : H × H → C In order to formally introduce Dirac notation in our work, we want to further refine the definition of an inner-product by breaking it down to a composition of a bra hφ| and a ket |ψi, yielding hφ|ψi = hφ| ◦ |ψi. A bra hφ| stands for the dual vector of |φi. At this point it is useful to introduce the notion of an adjoint or, more precisely, a Hermitian adjoint for linear maps: (f : H1 → H2 ) 7→ (f † : H2 → H1 ) Building up on our convention to use |φi to represent linear maps, we will define the adjoint of that map to be equivalent to the dual of the corresponding state vector [NC00]: (|φi)† ≡ hφ| : H → C Performing a measurement on a quantum system against some orthonormal basis destroys its state, by making it collapse into one of the basis vectors. To define this more formally, a measurement against some orthonormal basis consists of a set of projectors Pi , each sending the measured state to one of the basis vectors. At the time of measurement, the system’s wave function collapses, causing a non-deterministic jump in the system’s state by stochastically applying one of the projectors to the state vector. If we represent the state as a linear combination of basis vectors, the square of the complex coefficient of any basis vector gives us the probability of collapsing to that outcome during a measurement. Chapter 4 Category theory Category theory is an area of mathematics that provides us with a means of reasoning about common properties of abstract structures; it allows the use of diagrammatic reasoning while, at the same time, extending connections to mathematical logic. The rest of this dissertation makes extensive use of category theory [Mac98]. Therefore, for the sake of completeness, we will provide definitions for all of the notions used. 4.1 Basic notions Since this chapter is about category theory, we will begin our exposition appropriately by providing a definition for categories. Following that, we will be able to define functors and natural transformations, all of which will be used extensively later on. Definition 4.1.1 (Category). A category is a collection of objects and arrows between objects such that the following conditions hold: • There is a composition operator ◦, that can take any two arrows of the form f : A → B and g : B → C and produce a new arrow g◦f : A → C • Composition is associative, so h ◦ (g ◦ f ) = (h ◦ g) ◦ f • For every object A in our category, there is an identity arrow idA : A→A • The identity arrows satisfy the unit law, whereby, for any arrow f : A → B in our category, idB ◦ f = f = f ◦ idA 9 10 CHAPTER 4. CATEGORY THEORY Definition 4.1.2 (Functor). A functor is a morphism between categories, mapping objects to objects and arrows to arrows, in a way that preserves identities and composition. Example. Consider two categories C and D. A functor F : C → D, assigns to each object A ∈ C an object F A ∈ D and to each arrow f : A → B of C an arrow F f : F A → F B in D. Since it preserves identities and composition, it will have to be the case that F (idA ) = idF A and F (g ◦ f ) = F g ◦ F f . Definition 4.1.3 (Natural transformation). When F and G are functors such that F, G : C → D, a natural transformation η : F ⇒ G is a collection of arrows ηA : F A → GA in D for every object A in C. These arrows have to be such that for any f : A → B in C, the following diagram commutes: ηA FA GA Ff Gf FB GB ηB Note. When all the ηA of a natural transformation are isomorphisms, we call η a natural isomorphism. 4.2 More advanced notions We now wish to define a way of describing how different categories are related to each other. In order to do that, consider categories C and D, with functors F and G between them such that: F C G D The strictest and perhaps most obvious type of relation occurs when both of these functors are identity endofunctors F = G = Id, which would mean that the categories are equal. An isomorphism is a weaker kind of relation where G ◦ F = IdC and F ◦ G = IdD . An even weaker kind of relation is an equivalence, where instead of requiring the composition of functors to be equal to the identity functor, we ask that there be a natural isomorphism between them. In other words G ◦ F ∼ = IdC and F ◦ G ∼ = IdD . Continuing down that path leads us to a very important notion called an adjunction, which is another yet weaker kind of relation between categories [Che07]. To define this more rigorously: 11 CHAPTER 4. CATEGORY THEORY Definition 4.2.1 (Adjunction). Let C and D be categories, with functors F : C → D and G : D → C. We say there is an adjunction hF, G, η, εi when there exist two natural transformations η : IdC ⇒ GF and ε : F G ⇒ IdD , respectively called the unit and counit of the adjunction, such that the following diagrams commute: ηG Fη G GF G 1G F F GF Gε 1F εF G F Note. We say that F is left adjoint to G, writing this as F ⊣ G. Similarly, G is right adjoint to F . Definition 4.2.2 (Monad). A monad hT, η, µi in a category C consists of an endofunctor T : C → C, together with two natural transformations η : IdC ⇒ T and µ : T 2 ⇒ T , such that the following diagrams commute: T3 Tµ ηT T2 µT T µ T2 µ T2 1T µ T Tη T 1T T Corollary 4.2.1 (Adjunctions define a monad). Any adjunction hF, G, η, εi defines a monad. This can be done by setting T = GF , which would make the unit of our adjunction a natural transformation of the form η : IdC ⇒ T and our µ = GεF : GF GF ⇒ GF . The resulting monad would be of the form hF G, η, GεF i. This can be easily verified by checking that the following diagrams do indeed commute: GF GF GF GF GεF GεF GF GεF GF GF 4.3 ηGF GF GF GεF GF GF GF η GF GF 1T GεF GF 1T GF Specific constructions Definition 4.3.1 (Monoidal category). A monoidal category is a category that has been equipped with an bifunctor called tensor ⊗ : C × C −→ C. Up to appropriate natural isomorphisms, the tensor is associative and features a special object I that acts as a left and right identity: 12 CHAPTER 4. CATEGORY THEORY ∼ = αA,B,C : A ⊗ (B ⊗ C) −→ (A ⊗ B) ⊗ C ∼ = λA : I ⊗ A −→ A ∼ = ρA : A ⊗ I −→ A The tensor product thus forms a monoid, with I acting as the unit. These isomorphisms have to further satisfy some conditions called coherence conditions. These can be summarily represented by requiring that the following diagrams commute for all A, B, C and D: (A ⊗ B) ⊗ (C ⊗ D) αA C⊗ ,B , D αA ⊗B λI = ρI : I ⊗ I −→ I ((A ⊗ B) ⊗ C) ⊗ D αA,B⊗C,D A ⊗ (I ⊗ B) idA ⊗ λB idA ⊗ αB,C,D A ⊗ ((B ⊗ C) ⊗ D) D αA,B,C ⊗ idD A ⊗ (B ⊗ (C ⊗ D)) ,C , (A ⊗ (B ⊗ C)) ⊗ D αA,I,B ρA (A ⊗ I) ⊗ B dB ⊗i A⊗B Definition 4.3.2 (Symmetric monoidal category). A symmetric monoidal category is a monoidal category with an additional natural isomorphism ∼ = called symmetry, σA,B : A ⊗ B −→ B ⊗ A, such that the following diagrams 13 CHAPTER 4. CATEGORY THEORY commute: idA ⊗ σB,C A ⊗ (B ⊗ C) αA,C,B A ⊗ (C ⊗ B) (A ⊗ C) ⊗ B σA,C ⊗ idB αA,B,C A⊗B C ⊗ (A ⊗ B) σA⊗B,C σA,B ,B A⊗I σB,A id A B⊗A (C ⊗ A) ⊗ B αC,A,B ρA (A ⊗ B) ⊗ C A⊗B σA,I I ⊗A λA A Definition 4.3.3 (Symmetric monoidal closed category). A symmetric monoidal closed category is a symmetric monoidal category where, for any two objects A and B, there is an exponential object 1 A ⊸ B, together with an evaluation morphism evA,B : (A ⊸ B) ⊗ A −→ B. In addition to that, on any arrow of the form f : C ⊗ A −→ B, a process called Currying yields a unique morphism Λ(f ) : C −→ (A ⊸ B) such that: evA,B ◦ (Λ(f ) ⊗ idA ) = f Λ(f ) ⊗ idA C ⊗A (A ⊸ B) ⊗ A f evA,B B Definition 4.3.4 (Compact closed category). A compact closed category is a symmetric monoidal category where, for every object A, there is a dual 1 Note that these are different from the exponential connectives of linear logic. 14 CHAPTER 4. CATEGORY THEORY object A∗ along with two morphisms ηA : I −→ A∗ ⊗A and εA : A⊗A∗ −→ I such that: (εA ⊗ idA ) ◦ (idA ⊗ ηA ) = idA and (idA∗ ⊗ ηA ) ◦ (εA ⊗ idA∗ ) = idA∗ The dual object is unique up to canonical isomorphism. Corollary 4.3.1 (Closure of Compact Closed Categories). Every compact closed category is closed. Proof. All of the exponential structure can be recreated by setting A ⊸ B = A∗ ⊗ B. The evaluation function can be simulated by: evA,B = ρA ◦ (idB ⊗ εA ) ◦ (idB ⊗ σ) ◦ α−1 ◦ (σ ⊗ idA ) Definition 4.3.5 (Dagger compact category). A †-compact category is a compact closed category that is equipped with an involutive, contravariant, identity-on-objects endofunctor. That functor, called dagger, reverses all arrows, leaves objects unchanged, and preserves the tensor structure. For any f : A → B, it will be the case that f † : B → A and f †† = f . Moreover, for any object A in our category, it must be the case that σA,A∗ ◦ ε†A = ηA Chapter 5 Frobenius algebras This chapter presents a quick overview of Frobenius algebras, how they generalise over a category’s monoidal structure, as well as some related algebraic properties that will be used extensively in the parts of this dissertation that deal with classical structures. We will provide diagrammatic representations to accompany many of the textual definitions for the required conditions and properties. It should be noted that, as a notational convention, all the diagrams should be read from bottom to top. Frobenius algebras were studied since the 1930’s but have become exceedingly popular, in the past three decades, in the mathematical representation of quantum physics [JS91, KL01, Koc03]. More recent developments in quantum information theory [CP07, CD08, CPP10, CD11] have used these algebras to axiomatise the notion of a classical basis in quantum computation. We will start by presenting some of the most common definitions of a Frobenius algebra, adapted from [Str04]: Definition 5.0.6 (Frobenius algebra). A Frobenius algebra A is a finite dimensional, unital and associative algebra over a field k, that is equipped with a nondegenerate bilinear pairing σ : A ⊗ A → k. The bilinear form must be such that the following condition holds σ((ab) ⊗ c) = σ(a ⊗ (bc)), for a, b, c ∈ A. Alternatively, we could say that the algebra is Frobenius if it is equipped with a linear function ε : A → k, such that: ε(ab) = 0 for all a ∈ A implies b = 0. In order to generalise this to the categorical setting, we will look at monoidal categories, and will define what it means for an object in that 15 16 CHAPTER 5. FROBENIUS ALGEBRAS category to have a Frobenius structure associated with it. Definition 5.0.7 (Frobenius structure). We say that an object A in a monoidal category C has a Frobenius structure attached to it when it is equipped with four morphisms, µ : A ⊗ A → A, η : I → A, δ : A → A ⊗ A and ε : A → I, such that the following conditions hold: • (A, µ, η) forms a monoid, • (A, δ, ε) forms a comonoid, • and (idA ⊗ µ) ◦ (δ ⊗ idA ) = δ ◦ µ = (µ ⊗ idA ) ◦ (idA ⊗ δ) We denote the Frobenius structure as (A, µ, η, δ, ε). In the case of dagger monoidal categories, the dagger functor can give us µ = δ† and η = ε† , simplifying the Frobenius structure into (A, δ, ε). The conditions required by our definition are easier to visualise in diagrammatic form. In order to achieve this, we will represent our fundamental morphisms, δ and ε as follows: δ : A −→ A ⊗ A :: ai 7→ ai ⊗ ai ǫ : A −→ I :: ai 7→ 1 This allows us to represent the monoidal and comonoidal conditions diagrammatically as such: Monoid conditions = = = = Comonoid conditions = = = = 17 CHAPTER 5. FROBENIUS ALGEBRAS The last condition in the definition, also known as the Frobenius condition, thus becomes particularly easy to visualise: = = We will now define two important properties, symmetry and isometry, that will be used in later parts of our exposition. We will start with the definition of symmetry: Definition 5.0.8 (Symmetric algebra). Consider the symmetry isomorphism σA,B : A ⊗ B → B ⊗ A that is part of the definition of a symmetric monoidal category. A Frobenius algebra over an object of such a category is symmetric if its underlying monoid and comonoid are commutative and cocommutative, respectively. This means that δ must be δ = σA,A ◦ δ and µ must be µ = µ ◦ σA,A . = = The last property that we will define in this chapter is isometry: Definition 5.0.9 (Isometric or special algebra). A Frobenius algebra (A, µ, η, δ, ε) over an object A is said to be isometric or special if µ ◦ δ = idA . = Chapter 6 Categorical model This section presents the categories used to model quantum computation and classical operations in the rest of the dissertation. It begins by explaining how the Hilbert space formalism can be recast into the language of †-compact categories [AC04]. One of the biggest practical advantages of monoidal categories is that, on many occasions, they “formally justify their absence” [Coe06], meaning that they can be represented using a graphical calculus that greatly simplifies categorical reasoning. This section also demonstrates how every element of the initial quantum structure can be represented graphically in what resembles a two dimensional Dirac notation. Following our notational convention for the direction of the compositional flow of time, all the diagrams should be read from bottom to top. The next part of this section deals with classical operations, which are modelled in terms of internal spider monoids, as well as with the computational interplay inherent in introducing complementarity. 6.1 Categorical quantum computation The category we will be using to model quantum computation is called FDHilb and is the category of finite dimensional complex Hilbert spaces. Its objects are finite dimensional Hilbert spaces and its arrows are linear maps. Monoidal multiplication is represented by the Kronecker tensor product, while the monoidal unit object corresponds to the set of complex numbers I = C. Associativity of the tensor and tensor identities are up to equality, so αA,B,C , λA and ρA are reduced to identity arrows. The adjoint is modelled using the dagger functor. In terms of the picture calculus, the dagger denotes flipping a picture upside down, while the arrows 18 19 CHAPTER 6. CATEGORICAL MODEL continue pointing the same way they were before (i.e. upwards). For any three arrows f : A → B, g : C → D and h : E → F , associativity allows us to write their tensor product as: F D B g f h E C A By bifunctoriality of the tensor, we know that it preserves composition. For any arrows of the form f : A → B, g : B → C, h : D → E and k : E → F , once we add composition to our diagrams, the following property should become more evident: (g ◦ f ) ⊗ (k ◦ h) = (g ⊗ k) ◦ (f ⊗ h) F C g g k B E f A F C = k E B f h D A h D Moreover, it should also be evident that the tensor preserves identities: idA⊗B = idA ⊗ idB B A The proper graphical representation for the unit I is ”no line”, while arrows containing I as their domain or codomain are represented as follows: ψ:I→A A ψ φ† : A → I φ† φ† ◦ ψ : I → I φ† A ψ 20 CHAPTER 6. CATEGORICAL MODEL A special case of arrows called scalars consists of all arrows of the form c : I → I. In these specific cases, our categorical structure collapses to the point where tensor is equal to composition. In other words c1 ⊗ c2 = c1 ◦ c2 = c2 ⊗ c1 . Scalars can be moved freely around in the category’s graphical representation. Symmetry corresponds to a well known quantum operation called swap; it is graphically represented by a pair of crossing lines. The following properties are more easily understood graphically: A B B A D B D B g B A A A C D f B C = = B A f g B A A σA,B ◦ σA,B = idA ⊗ idB C σB,D ◦ (f ⊗ g) = (g ⊗ f ) ◦ σA,C Compact closure is used to model entangled states. These are the only cases where we see arrows pointing downwards, as the ∗ in A∗ reverses the arrow’s direction. The graphical representation looks like this: dA : I −→ A∗ ⊗ A eA : A ⊗ A∗ −→ I These have to adhere to a property, fundamental in proving teleportation, whose graphical representation is reminiscent of yanking a wire: = = CHAPTER 6. CATEGORICAL MODEL 6.2 21 Representation of classical structures One of the fundamental known distinctions between quantum and classical computation is derived from no-go theorems. Classical computers routinely copy and delete data; it is such a commonplace thing to do that we hardly ever notice how entwined it is to the classical computational paradigm itself. Quantum computers, on the other hand, cannot perform either of these operations. In this part of this section, we will see how to turn this problem into a very important feature, which will in turn enable us to account for classical operations within the, already defined, quantum categorical framework. The following result [WZ82] is referred to as the no-cloning theorem: Theorem 6.2.1 (No-cloning theorem). There is no quantum operation D, such that D : |0i ⊗ |ψi 7→ |ψi ⊗ |ψi D : |0i ⊗ |φi 7→ |φi ⊗ |φi unless |ψi and |φi are orthogonal. The ancilla qubit |0i is sometimes not included in information-theoretic notation [CP07, Abr10], reducing D to D : |ψi 7→ |ψi ⊗ |ψi. Another result [PB00], complementary to the no-cloning theorem, is commonly referred to as the no-deleting theorem. In the original formulation of this result, Pati and Braunstein used an ancilla qubit |Ai and included a qubit state in a standard state |Σi, making E look more like E : |ψi ⊗ |ψi ⊗ |Ai 7→ |ψi ⊗ |Σi ⊗ |Aψ i. The formulation we will use is more common in the information-theoretic literature [CP07, Abr10]: Theorem 6.2.2 (No-deleting theorem). There is no quantum operation E, such that E : |ψi 7→ 1 E : |φi 7→ 1 unless |ψi and |φi are orthogonal. From these two theorems, we can deduce that the only cases of quantum states that we could treat as classical are those pertaining to orthogonal vectors. This seems to reinforce the notion of a classical basis spanning a complex Hilbert space. 22 CHAPTER 6. CATEGORICAL MODEL Definition 6.2.1 (Classical structure (categorical)). A classical structure 2 [CP07, CD08, CPP10] is defined in terms of special †-Frobenius cocommutative comonoids, also referred to as spider monoids. These are represented by a triplet (A, δ, ǫ), where A is an object and δ and ǫ are two morphisms of the form: δ : A −→ A ⊗ A :: ai 7→ ai ⊗ ai ǫ : A −→ I :: ai 7→ 1 where the ai are the orthogonal vectors to which copying and deleting take place. These two maps, also called copying and deleting maps, have to satisfy a number of conditions to ensure that they are well behaved and that their addition does not cause a collapse of the compact structure. More specifically, they must satisfy all of the conditions of a cocommutative comonoid, as well as the isometry and Frobenius conditions. Example. To help the reader become more accustomed to our new concepts, we will present a linear algebraic example with matrices. Suppose that our chosen basis consisted of |0i and |1i, the computational basis. The appropriate δ to copy the basis vectors would be:   1 0  0 0    and ε = 1 1 δ=  0 0  0 1 It should be easy to verify that δ|0i = |00i, δ|1i = |11i, ε|0i = 1 and ε|1i = 1. The Hermitian adjoints of those states, δ† and ε† , would be:     1 0 0 0 1 † † δ = and ε = 0 0 0 1 1 Once again we can verify that δ† , also known as fusion, merges two basis states when they are the same: δ† |00i = |0i and δ† |11i = |1i. The ε† operation “creates” a state by being itself equivalent up to a scalar multiple to the constant state |+i. 2 N.B. Thanks to [CPV08], we now know that classical structures are in bijective correspondence to bases. 23 CHAPTER 6. CATEGORICAL MODEL When expressed more rigorously, the comonoid conditions require that the copying and deleting maps form an internal cocommutative comonoid: (δ ⊗ idA ) ◦ δ = (idA ⊗ δ) ◦ δ (ǫ ⊗ idA ) ◦ δ = (idA ⊗ ǫ) ◦ δ = idA δ = σA,A ◦ δ Because of the dagger functor, all of the comonoidal conditions can be reversed to give us the conditions required of a commutative monoid: δ† ◦ (δ† ⊗ idA ) = δ† ◦ (idA ⊗ δ† ) δ† ◦ (ǫ† ⊗ idA ) = δ† ◦ (idA ⊗ ǫ† ) = idA δ† = δ† ◦ σA,A The graphical representation for all of these conditions corresponds to connected graphs. Furthermore, the inputs and outputs on all of the required equations match, so, as proved in [CP06, CPP10, CD08], we can equivalently define classical structures using the spider theorem. This theorem states that if a graph generated by δ and ǫ is connected, then it is completely characterized by its domain and codomain. If the domain is A . . ⊗ A} | ⊗ .{z n and the codomain is |A ⊗ .{z . . ⊗ A}, then it can be reduced to a ”spider” with m n input and m output wires. m outputs b b b b b b b b b b b b b b b b n inputs b b b b b b b b Arbitrary states that are points of A (i.e. of the form |ψi : I −→ A) are denoted by ”black dots”: A ψ := ψ and ψ† := ψ† A 24 CHAPTER 6. CATEGORICAL MODEL On any classical structure (A, δ, ǫ), we define a map K that lifts3 any state |ψi of A to the endomorphism K δ (ψ) := δ† ◦ (|ψi ⊗ idA ) : A −→ A. Similarly, we can lift any bra hψ| by setting K δ (ψ)† = K δ (ψ∗ ) = (ψ † ⊗ idA ) ◦ δ : A −→ A. We denote these graphically as: ψ = ψ ψ† ψ∗ = = ψ† = ψ∗ The monoid operation δ† : A⊗A −→ A, also known as fusion, can be used to combine arbitrary states. For two states |ψi and |φi, their fusion is written as ψ ⊙ φ := δ† ◦ (ψ ⊗ φ). The same operation can be used to merge pairs of lifted states K δ (ψ ⊙ φ) := δ† (K δ (ψ) ⊗ K δ (φ)) = δ† (K δ (φ) ⊗ K δ (ψ)). As per the definition of δ† , the fusion operation is associative and commutative. This concept of fusion can be represented diagrammatically as follows: = ψ ψ ⊙φ φ Example. Let |+α i and |+β i be states such that:     1 1 iα iβ |+α i = |0i + e |1i = and |+β i = |0i + e |1i = eiα eiβ The fusion of those two states will be:    1 0 0 0   δ† ◦ (|+α i ⊗ |+β i) = 0 0 0 1  1 eiβ eiα ei(α+β)   =   1 ei(α+β)  = |+α+β i 3 The notation used for this lifting by [CD08] is Λµ (ψ). In our case, we avoid using the letter Λ, to prevent any confusion with the letter used for Currying. 25 CHAPTER 6. CATEGORICAL MODEL After combining all of these definitions, we can prove [CD08] that classical structures follow what is known as the generalized spider theorem: Theorem 6.2.3 (Spider theorem). Any connected graph generated by the operations of the classical structure (A, δ, ǫ), states |ψi i : I −→ A and the †compact K structure, is completely characterized by its domain, codomain and Kδ( ψi ). The graphical representation is that of a ”decorated spider” i m outputs b b b b b b b b b b b b K ψi i b b b b b b b b b b n inputs b b Definition 6.2.2 (Unbiasedness (categorical)). A point α : I −→ A is unbiased relative to (A, δ, ǫ) iff K δ (α) is unitary. In other words, there needs to be a scalar s : I −→ I such that s · α ⊙ α† = ǫ† , or graphically: α† = α∗ α = = α⊙α∗ α Example. Recall the state |+α i from our previous example. States of the form |+θ i will always be unbiased with respect to the classical basis structure we defined for copying |0i and |1i. That is because δ† ◦ (|+θ i ⊗ |+−θ i) will always be equal to |+0 i = ε† . Definition 6.2.3 (Complementarity (categorical)). Two classical structures (A, δG , ǫG ) and (A, δR , ǫR ) in a †-compact category are called complementary if the points that are classical for one are unbiased for the other and vice versa. δG and ǫG are depicted using green dots; the points they copy 26 CHAPTER 6. CATEGORICAL MODEL and delete are drawn in red and are unbiased for the second classical structure. δR and ǫR are depicted using red dots; they copy and delete green points, which are unbiased for the green classical structure. Graphically this condition is depicted as: = α = α α β β = = α β α∗ β β∗ Example. Let (A, δG , ǫG ) be the classical structure that we described earlier for copying and deleting |0i and |1i. Let (A, δR , ǫR ) be a similarly constructed classical structure that can copy and delete |+i and |−i (i.e. state vectors orthogonal to the computational basis), such as:   1 0  0 1    δR = √12   0 1  and εR = 1 0 1 0 As one can easily verify ,the two classical structures are an example of structures that are complementary to one another. Chapter 7 Linear logic This section provides an overview of the structures found in some flavours of linear logic, building up to the corresponding logic for compact closed categories, while illustrating how some of these concepts relate to category theoretic notions and properties. Linear logic is a resource sensitive logic, first introduced in [Gir87]. Whereas other logics provide the structural rules of weakening and contraction in order to facilitate predicate re-use or non-use in proving theorems, linear logic drops the indiscriminate use of these rules and treats predicates as resources that need to be expended in order to produce proofs. In terms of the Gentzen sequent calculus, the rules of weakening and contraction would be represented as: Weakening ⊢Γ ⊢ Γ, A Contraction ⊢ Γ, A, A ⊢ Γ, A Due to its resource sensitivity, linear logic finds many applications in computer science, such as in type theory, the semantics of programming languages, and the study of concurrency. The definitions and presentation of this section are largely based on [Abr93] and [AT10]. The sequent rules for linear logic are as follows: ⊢ A⊥ , A Exchange Unit Times ⊢ Γ, A, B, ∆ ⊢ Γ, B, A, ∆ Perp ⊢1 ⊢ Γ, A ⊢ ∆, B ⊢ Γ, ∆, A ⊗ B 27 Cut ⊢ Γ, A ⊢ ∆, A⊥ ⊢ Γ, ∆ ⊢Γ ⊢ Γ, − Par ⊢ Γ, A, B ⊢ Γ, A B & Axiom 28 CHAPTER 7. LINEAR LOGIC With ⊢ Γ, A ⊢ Γ, B ⊢ Γ, A&B Plus (i) ⊢ Γ, A ⊢ Γ, A ⊕ B Plus (ii) ⊢ Γ, B ⊢ Γ, A ⊕ B In order to recover the structural rules of weakening and contraction, we can introduce an exponential operator called bang, which is denoted by ! Dereliction Weakening 7.1 ⊢ Γ, A ⊢ Γ, !A ⊢Γ ⊢ Γ, !A Of Course Contraction ⊢!Γ, A ⊢!Γ, !A ⊢ Γ, !A, !A ⊢ Γ, !A Multiplicative quantum logic We will now focus on and extend the multiplicative fragment of linear logic by choosing to ignore the rules for additives and exponentials. The reader is referred to [AT10] for a comprehensive, yet still accessible, overview of multiplicative linear logic. That logic was extended by [AD06], to yield a multiplicative quantum logic that simulates the compact structure found in compact closed categories. The key idea lies in the definition of linear negation, whereby multiplicative conjunction (tensor) is equated with multiplicative disjunction (par), by trivializing the notion of De Morgan duality. This is the most natural way of introducing compactness to linear logic and uses A⊥ to represent the dual object A∗ in our category. Linear negation in this case is characterized by the following laws: A⊥⊥ = A 1⊥ = 1 (A ⊗ B)⊥ = A⊥ ⊗ B ⊥ A ⊸ B = A⊥ ⊗ B A categorical interpretation will be given for each of the rules presented, in order to better illustrate the Curry-Howard parallelism. The proof rules for this logic are as follows: 29 CHAPTER 7. LINEAR LOGIC Id Logic Categories A⊢A idA : A −→ A N R Γ⊢A ∆⊢B Γ, ∆ ⊢ A ⊗ B f : Γ −→ A g : ∆ −→ B f ⊗ g : Γ ⊗ ∆ −→ A ⊗ B N L Γ, A, B ⊢ C Γ, A ⊗ B ⊢ C f : (Γ ⊗ A) ⊗ B −→ C f ◦ aA,B,Γ : Γ ⊗ (A ⊗ B) −→ C Cut Γ ⊢ A A, ∆ ⊢ B Γ, ∆ ⊢ B f : Γ −→ A g : A ⊗ ∆ −→ B g ◦ (f ⊗ id∆ ) : Γ ⊗ ∆ −→ B ⊸E Γ⊢A⊸B ∆⊢A Γ, ∆ ⊢ B f : Γ −→ (A ⊸ B) g : ∆ −→ A evA,B ◦ (f ⊗ g) : Γ ⊗ ∆ −→ B ⊸R Γ, A ⊢ B Γ⊢A⊸B f : Γ ⊗ A −→ B Λ(f ) : Γ −→ (A ⊸ B) At this point, it is interesting to compare the two worlds and see how some notions translate from one to the other. The identity rule corresponds to identity arrows in our categories. The Cut rule defines function composiN tion. The right tensor rule ( R) defines tensoring, while the left tensor rule N ( L) defines the associativity of the tensor. Linear implication (⊸) is a notion equivalent to a category’s exponential objects, so naturally, implication elimination (⊸ E) and the right implication rule (⊸ R) respectively define the category’s Evaluation and Currying functions. The only structural rule in this logic is the rule known as exchange: Γ, A, B, ∆ ⊢ C Γ, B, A, ∆ ⊢ C f : Γ ⊗ A ⊗ B ⊗ ∆ −→ C f ◦ (idΓ ⊗ sA,B ⊗ id∆ ) : Γ ⊗ B ⊗ A ⊗ ∆ −→ C This rule corresponds to the symmetry isomorphism for the tensor. All we need in order to have a fully fledged representation of symmetric monoidal closed categories is a monoidal unit. That is denoted by 1 and comes with the simple rule of ⊢ 1. We use the right implication rule to transform our identity rule to ⊢ A ⊸ A which, when translated via the linear negation laws, becomes ⊢ A⊥ ⊗ A, or the equivalent of dA : I −→ A∗ ⊗ A in our CHAPTER 7. LINEAR LOGIC 30 category. Thus, we can now represent compact structure in this flavour of linear logic. Chapter 8 The linear typed lambda calculus This section will provide an overview of the linear typed lambda calculus of [AT10], to prepare the ground for our extension to dagger compact categories in the next section. We will define well formed formulas for terms, types and sequents and provide Gentzen-style inference rules for deriving these formulas. This lambda calculus provides a computational interpretation for symmetric monoidal closed categories and is in direct correspondence with the multiplicative fragment of intuitionistic linear logic. Definition 8.0.1 (Variables and terms in the lambda calculus). The fundamental building blocks of our language are variables. They are denoted by single letters and are traditionally represented using the later letters of the alphabet (i.e. x, y, z). These variables can then be combined with each other to form composite terms, denoted by different combinations of the following forms: t ::= x | t1 ⊗ t2 | let ψ be x ⊗ y in c | λx.t | f a Definition 8.0.2 (Types in the lambda calculus). Every term in our language, regardless of whether it is a variable or composite, has a type. Types can appear as any combination of the following forms: type ::= A | A⊗B | A ⊸B 31 CHAPTER 8. THE LINEAR TYPED LAMBDA CALCULUS 32 Definition 8.0.3 (Typing judgements in the lambda calculus). The typing judgements, or sequents, of our language are composed of terms and their respective types. They are always of the form: x1 : A1 , x2 : A2 , . . . , xn : An ⊢ t : B A set of typing rules is used to produce typing judgements. Now that we know which formulas are well formed, we can continue our language exposition by providing these rules in the form of a Gentzen-style Sequent Calculus. The set of inference rules corresponds to the rules that were presented in the section on linear logic. The rules and their respective correspondences in category theory are as follows: Id Lambda Calculus Categories x:A⊢x:A idA : A −→ A N R Γ⊢a:A ∆⊢b:B Γ, ∆ ⊢ a ⊗ b : A ⊗ B f : Γ −→ A g : ∆ −→ B f ⊗ g : Γ ⊗ ∆ −→ A ⊗ B N L Γ, x : A, y : B ⊢ c : C Γ, ψ : A ⊗ B ⊢ let ψ be x ⊗ y in c : C f : (Γ ⊗ A) ⊗ B −→ C f ◦ aA,B,Γ : Γ ⊗ (A ⊗ B) −→ C Cut Γ ⊢ c : A x : A, ∆ ⊢ b : B Γ, ∆ ⊢ b[c/x] : B f : Γ −→ A g : A ⊗ ∆ −→ B g ◦ (f ⊗ id∆ ) : Γ ⊗ ∆ −→ B ⊸R Γ, x : A ⊢ b : B Γ ⊢ λx.b : A ⊸ B f : Γ ⊗ A −→ B Λ(f ) : Γ −→ (A ⊸ B) ⊸E Γ⊢g:A⊸B ∆⊢a:A Γ, ∆ ⊢ ga : B f : Γ −→ (A ⊸ B) g : ∆ −→ A evA,B ◦ (f ⊗ g) : Γ ⊗ ∆ −→ B Applying these rules a number of times can lead us to composite but reducible forms. These are reduced using a process called β-reduction as follows: β (λx.b)a −→ b[a/x] β let a ⊗ b be x ⊗ y in c −→ c[a/x, b/y] CHAPTER 8. THE LINEAR TYPED LAMBDA CALCULUS 33 The notation b[c/x] is referred to as substitution and means ”take b and replace all free occurrences of x in it with c”. Substitution is a meta operation that takes place outside of the language. In defining an operational semantics for substitution, care has to be taken to prevent us from violating the capture of free variables4 of terms. A more rigorous way of defining substitution is given by an induction on the structure of b: ( c for x = y, y [c/x] := y for x 6= y (pq)[c/x] := (p[c/x])(q[c/x]) (λz.q)[c/x] := λz.(q[c/x]) A number of interesting translations take place between N category theoretic and lambda calculus notions. One of them occurs in L, the rule that defines tensor associativity in our category, whereby we gain a rule on how to type a term when, instead of using two variables for its derivation, we plug in a composite term in their place. Another interesting case is Cut, the rule that defines composition of functions, which in the lambda calculus corresponds to a type rule for substitution. Implication elimination (⊸ E), the rule responsible for the evaluation operation in closed categories, turns out to be function application. Consequently, the related notion of Currying that comes with the right implication rule (⊸ R), corresponds to lambda abstraction. Similarly to the way we defined rules in the section on Logic, we need to add the structural rule of Exchange, in order to account for the symmetry isomorphism of the tensor: Γ, x : A, y : B, ∆ ⊢ c : C Γ, y : B, x : A, ∆ ⊢ c : C 4 f : Γ ⊗ A ⊗ B ⊗ ∆ −→ C f ◦ (idΓ ⊗ sA,B ⊗ id∆ ) : Γ ⊗ B ⊗ A ⊗ ∆ −→ C In the cases where b is a λ-abstraction, certain provisions have to be in place to prevent us from violating the capture of free variables. These provisions are that x 6= z and z 6∈ F V (c). Part III Quantum programming and classical control 34 Chapter 9 The dagger lambda calculus Dagger compact categories were first introduced in [ABP99], albeit under a different name, using some of the terminology of [DR89]. They were later proposed by [AC04] and [Sel07] as an axiomatic framework for the study of quantum protocols. Though a lot of work has been done on categorically driven quantum programming languages [SV06], [SV08] and [SV10], these lambda calculi did not provide a way of modelling the dagger functor of dagger compact categories. The work of [BS10] highlighted the importance of dagger compact categories for the semantics of quantum computation; it presented a rough correspondence between quantum computation, logic and the lambda calculus, yet its type theory fell short of providing a correspondence to the entire structure of dagger compact categories. This section fills this gap by presenting the dagger lambda calculus: a computational interpretation for dagger compact categories. 9.1 Language construction We will now construct a language for dagger compact categories by defining well formed formulas for terms, types and sequents. The rules for deriving these formulas will be given in the form of Gentzen-style inference rules. In order to give computational meaning to our language, we will begin our presentation of the typing dynamics by reformalising the linear typed lambda calculus of [AT10] with the explicit substitution used by the linear chemical abstract machine of [Abr93]. The linear negation we will be using causes a significant collapse between conjunction and disjunction, extends tensor to a (potentially) binding operator, and provides us with a semantics similar to that of the proof nets in [AD06]. The set of rules we use to define 35 CHAPTER 9. THE DAGGER LAMBDA CALCULUS 36 this language is kept at a minimum, allowing for clean proofs of the various desired properties. Many familiar computational notions do not appear as primitives, but they do arise as constructed notions in good time. Definition 9.1.1 (Variables, constants and terms in the dagger lambda calculus). The fundamental building blocks of our language are variables; they are denoted by single letters and are traditionally represented using the later letters of the alphabet (i.e. x, y, z). We also allow for the use of constant terms (i.e. c1 , c2 , c3 ); these are terms with an inherent value, that cannot serve as placeholders for substitution. These primitives can then be combined with each other to form composite terms, denoted by different combinations of the following forms: htermi ::= variable | htermi∗ | htermi ⊗ htermi | constant Definition 9.1.2 (Types in the dagger lambda calculus). Every term in our language, regardless of whether it is a variable, a constant or composite, has a type. We will first start by defining a set of atomic types; these are traditionally represented using capital letters (i.e. A, B, C). Atomic types can then be combined to give us types of the following forms: htypei ::= atomic | htypei∗ | htypei ⊗ htypei The star operator that we use is not a repetition operator; instead, it corresponds to a particular form of linear negation. As one would expect from a negation operation, the star operator is involutive (a∗ )∗ ≡ a and (A∗ )∗ ≡ A. Abramsky [Abr93] proposed using linear negation as the passageway between Intuitionistic Linear Logic and Classical Linear Logic. The linear negation used in [AD06] ”trivialized” the notion of De Morgan duality of [Abr93] by setting (A ⊗ B)∗ := A∗ ⊗ B ∗ . The linear negation that we use is similar to the one used in [CPP08]; it distributes differently over tensor by performing a swap of the terms/types at hand and allows for a more ”planar” representation. Definition 9.1.3 (Linear negation). The star operator is a form of linear negation whose De Morgan duality is defined by: (a ⊗ b)∗ :=b∗ ⊗ a∗ ∗ ∗ on terms and ∗ (A ⊗ B) :=B ⊗ A on types. CHAPTER 9. THE DAGGER LAMBDA CALCULUS 37 Definition 9.1.4 (Scalars). One of the language’s atomic types, denoted by I, acts as the tensor unit. One of the very important properties of the type I is negation invariance, whereby I ≡ I ∗ . We say that a term i is a scalar iff it is of type I. Definition 9.1.5 (Dimensions). For every type A, we will define a scalar constant DA : I, referring to it as the dimension of type A. The dimension of I is defined to be DI = 1 : I, where 1 = 1∗ : I ≡ I ∗ . Definition 9.1.6 (Soup). All of the computation in our language is performed inside a relational soup. The soup is a set, consisting of pairs of equityped terms, connecting them to each other in a form of explicit substitution. A soup connection between two terms of type A is written as t1 :A t2 or t1 : t2 ; to simplify our notation in the soup, we omit writing the type whenever there is no ambiguity about the type of the connected terms. The resulting soup is of the form S = {v1 : v2 , . . . , vm−1 : vm }. We use the following property {a1 : a2 } ≡ {a2∗ : a1∗ } to equate some soup terms by collapsing them into the same congruence class. We also define soup negation as (S ∪ S ′ )∗ := S∗ ∪ S∗′ , where {t : u}∗ := {t∗ : u∗ }. Definition 9.1.7 (Typing judgements in the dagger lambda calculus). The typing judgements, or sequents, of our language are composed of terms, their respective types and a relational soup. A typing judgement is thus represented by: t1 : A1 , t2 : A2 , . . . , tn : An ⊢S t : B Example. In the following typing judgement, the types of t1 and t2 are both known to be A. Similarly, we know that both DC and 1 are scalars, so their type is I. We omit writing the types for soup connections t1 : t2 and DC : 1 but, to prevent ambiguity, we have to write it for x :B x, because we have no other way of deducing it from the sequent: t1 : A ⊢{t1 :t2 ,x:B x,DC :1} t2 : A Now that we know which formulas are well formed in our language, we can proceed by defining a notion of binding. Contrary to what we are used to from the lambda calculus, where the notion of binding is restricted in scope to the confines of a single term, the dagger lambda calculus supports a binding that is global and whose scope spans the entire typing judgement. The computational interpretation of classical linear logic, which was provided by [Abr93] in his linear chemical abstract machine, views two occurrences of the same variable as two ends of a communication channel. Adhering to the spirit of that definition, we define binding as follows: CHAPTER 9. THE DAGGER LAMBDA CALCULUS 38 Definition 9.1.8 (Bound variables and terms in the dagger lambda calculus). For any variable x, we say that it is a bound variable when it appears twice within a given sequent. As such, variable capture is not limited to the scope of a single term but spans the entire sequent. For any term t that does not contain any occurrences of constants, we say that term is captured when it consists entirely of variables that are captured within the scope of the current sequent. We use the phrases bound term and bundle of bound variables interchangeably when referring to captured terms. Trivially, a bound variable is also a bound term. Example. In the following sequent, x1 , x2 , y1 , y2 and f are all bound variables. The individual variables may be free when looking at subterms x1∗ ⊗ y1 and x2∗ ⊗ y2 but, when considering the scope of the entire sequent, they are captured by other occurrences of themselves in the soup. Moreover, the terms x1∗ ⊗ y1 and x2∗ ⊗ y2 are both bound terms because they contain no constants and they consist solely of variables that are captured by variables in the soup: x1∗ ⊗ y1 : A∗ ⊗ B ⊢{x1∗ ⊗y1 :f,f :x2∗ ⊗y2 } x2∗ ⊗ y2 : A∗ ⊗ B In the following sequent, f , y, x1 and x2 are bound variables; they can also be viewed as bound terms since a single variable is a term and since they do not contain any constants. The term x1 ∗ ⊗x1 is a bundle of bound variables because it contains no constants and consists solely of bound variables. The term c∗ ⊗ x2 , however, is not a bundle of bound variables because it contains a constant called c: f : A∗ ⊗ B ⊢{x1 ∗⊗x1 :c∗ ⊗x2 ,f :x2∗ ⊗y} y : B Remark. As will become obvious from our language’s sequent rules, which will impose linearity constraints on the introduction of variables, the nature of linearity in our language mandates that all of the variables within a given sequent occur exactly twice. This means that all of the free variables in a given term will occur once more in the sequent within which they reside, hence becoming captured in the scope of that sequent. Within that scope, all terms will essentially consist of captured variables and constants. Definition 9.1.9 (α-renaming on variables in the dagger lambda calculus). A bound variable x can be α-renamed by replacing all of its instances, in a given sequent, with a bundle of bound variables t. The term t has to be of the same type as x, must not contain any constants (since it will be a bundle of bound variables), and it must consist of variables that do not already appear in the sequent. CHAPTER 9. THE DAGGER LAMBDA CALCULUS 39 We can now extend the operation of α-renaming to operate on captured terms: Definition 9.1.10 (α-renaming on terms in the dagger lambda calculus). A bound term t can be α-renamed by either α-renaming its constituent variables or, in cases where t appears twice in a given sequent, by replacing all of its instances with a variable x. The variable x has to be of the same type as t and it must not already appear in the sequent. Definition 9.1.11 (α-equivalence in the dagger lambda calculus). We define a notion of α-equivalence as the reflexive, symmetric and transitive closure of α-renaming. In other words, we say that two sequents are αequivalent, or equivalent up to α-renaming, when one can be transformed to the other by α-renaming zero or more terms. Example. Going back to the examples we used earlier, the sequent x1∗ ⊗ y1 : A∗ ⊗ B ⊢{x1∗ ⊗y1 :f,f :x2∗ ⊗y2 } x2∗ ⊗ y2 : A∗ ⊗ B is α-equivalent to g : A∗ ⊗ B ⊢{g:f,f :x2∗ ⊗y2 } x2∗ ⊗ y2 : A∗ ⊗ B because we can α-rename the bound term x1∗ ⊗ y1 into the variable g. Similarly, the sequent f : A∗ ⊗ B ⊢{x1 ∗⊗x1 :c∗ ⊗x2 ,f :x2∗ ⊗y} y : B is α-equivalent to x3∗ ⊗ y2 : A∗ ⊗ B ⊢{x1 ∗⊗x1 :c∗ ⊗x2 ,x3∗ ⊗y2 :x2∗ ⊗y1 } y1 : B because we can α-rename the bound variable y into y1 and also α-rename the bound variable f into the term x3∗ ⊗ y2 . Definition 9.1.12 (Typing contexts in the dagger lambda calculus). The left-hand-side of a typing judgement is actually a list of typed terms. We use the letters Γ and ∆ as shorthand for arbitrary (possibly empty)N lists of such terms. Let ∆ be the list t1 : T1 , t2 : T2 , . . . , tn : Tn . We define ∆ to be the term (((t1 ⊗ t2 ) ⊗ . . .) ⊗ tn ) : (((T1 ⊗ T2 ) ⊗ . . .) ⊗ Tn ), referring to it as ∆ in tensor form. CHAPTER 9. THE DAGGER LAMBDA CALCULUS 40 Our language exposition features a Gentzen-style Sequent Calculus, which provides us with the inference rules used to produce judgements. Rules with a double line are bidirectional; sequents matching the top of the rule can be used to derive sequents matching the bottom and vice versa. The rules are formed in a way that allows composite terms to appear to the left of the turnstile. The set of sequent rules is: x:A⊢x:A Id, a : A ⊢S b : B Negation, a∗ : A∗ ⊢S∗ b∗ : B ∗ Γ ⊢ S1 a : A ∆ ⊢ S2 b : B N ⊗R, Γ, ∆ ⊢S1 ∪S2 a ⊗ b : A ⊗ B Γ, a : A, b : B ⊢S c : C ⊗L, Γ, a ⊗ b : A ⊗ B ⊢S c : C Γ ⊢ S1 a : A a′ : A, ∆ ⊢S2 b : B Cut, Γ, ∆ ⊢S1 ∪S2 ∪{a:a′ } b : B a : A, Γ ⊢S b : B Curry. Γ ⊢S a∗ ⊗ b : A∗ ⊗ B Linearity constraints: The identity axiom (Id) is the only inference rule we have for introducing variables into our expressions. Consequently, variables are always introduced as bound pairs. We should note at this point that ⊗R and Cut are the only two rules that can be used to merge two typing judgements. In order to preserve linearity, we have to impose a very important condition on such a merge; in doing so, we will prevent the appearance of more than two instances of a variable in a given sequent. The condition required, in order to merge two sequents, is that they do not share any common variables. Whenever we want to use the ⊗R and Cut rules to merge two sequents whose variables overlap, we have to α-rename them first to ensure that the linearity condition is satisfied. We sometimes use sequents with an empty right-hand-side, like a : A, Γ ⊢, as shorthand for a : A, Γ ⊢ 1 : I. Such sequents are easy to produce by using Uncurrying, the inverse of the Curry rule, together with the constant 1 : I: CHAPTER 9. THE DAGGER LAMBDA CALCULUS 41 Γ ⊢ a∗ : A∗ ⊢1:I ⊗R ∗ Γ ⊢ a∗ ⊗ 1 : A ⊗ I Uncurry a : A, Γ ⊢ 1 : I The language has a structural exchange rule that can be used to swap terms on the left hand side of a sequent. When navigating through a proof tree, instances of the exchange rule can be used to keep track of which terms were swapped and at which points during a derivation: Γ, a : A, b : B, ∆ ⊢ c : C Exchange. Γ, b : B, a : A, ∆ ⊢ c : C Our language also has two unit rules, λΓ and ρΓ , that are used to more accurately represent scalars: Γ ⊢S∪{i∗ :1} b : B λΓ , Γ ⊢S∪{i∗ :1} b : B ρΓ . i : I, Γ ⊢S b : B Γ, i : I ⊢S b : B Our language dynamics are defined through soup rules. These rules explain how the relational connections propagate within the soup, giving rise to an operational semantics for a form of ”global substitution” that resembles pattern matching on terms. The soup propagation rules, called bifunctoriality, trace and cancellation respectively, are: S ∪ {a ⊗ b : c ⊗ d} −→ S ∪ {a : c, b : d} S ∪ {x :A x} −→ S ∪ {DA : 1} S ∪ {1 : 1} −→ S where ψ is a constant and x is a variable. Our soup rules also contain a consumption rule. This rule uses up a relational connection between {t : u} to perform a substitution in the typing judgement. Note, however, that the term we are substituting for has to be one that was captured in the scope of the sequent:    Γ ⊢S∪{t:u} b : B −→ Γ ⊢S b : B t/u if u does not contain constants,    Γ ⊢S∪{t:u} b : B −→ Γ ⊢S b : B u/t if t does not contain constants. CHAPTER 9. THE DAGGER LAMBDA CALCULUS 42 If t and u are both without constants, linearity implies that their constituent variables were all captured in the scope of the original sequent. In such a case, we can choose the way in which we want to substitute. This gives us a symmetric notion of substitution, where our choice of substitution does not affect the typing judgement, as the sequents will be equivalent up to alpha renaming. Example. Consider the following sequent: f : A∗ ⊗ B ⊢{f :c∗ ⊗y} y : B The variable f is captured within the scope of the sequent. As such, we can use the consumption rule to consume the connection in the soup and substitute c∗ ⊗ y for f in the rest of the sequent. This will change the sequent to: c∗ ⊗ y : A∗ ⊗ B ⊢ y : B Alternatively, if we had α-renamed the original sequent to: x1∗ ⊗ y1 : A∗ ⊗ B ⊢{x1∗ ⊗y1 :c∗ ⊗y2 } y2 : B we could have then used the bifunctoriality rule to split the soup connection: x1∗ ⊗ y1 : A∗ ⊗ B ⊢{x1∗ :c∗ ,y1 :y2 } y2 : B The first connection of the resulting soup is only consumable in one way, since c is a constant, by substituting c∗ for x1∗ . The second soup connection, however, presents us with a choice, since both y1 and y2 are captured in the sequent. One choice will give us c∗ ⊗ y2 : A∗ ⊗ B ⊢ y2 : B while the other choice will give us c∗ ⊗ y1 : A∗ ⊗ B ⊢ y1 : B Upon closer inspection, one will notice that all three of the resulting sequents are α-equivalent. Definition 9.1.13 (Soup reduction). We use the term soup reduction to refer to the binary relation that extends α-equivalence with the sequent transformations that are caused by applying one of the soup rules. Thus, for two sequents Γ ⊢S1 t : T and Γ ⊢S2 t : T , if the soup S1 is transformed into S2 through the application of one of the soup propagation rules, S1 → S2 , then we say that one sequent reduces to the other via soup reduction. Similarly, if a sequent J1 is transformed into J2 by using the consumption rule to perform a substitution, we say that J1 reduces to J2 via soup reduction. 43 CHAPTER 9. THE DAGGER LAMBDA CALCULUS Definition 9.1.14 (Soup equivalence). We define a notion of soup equivalence as the reflexive, symmetric and transitive closure of soup reduction. In other words, we say that two sequents J1 and J2 are soup-equivalent, or equivalent up to soup-reduction, when we can convert one to the other by using zero or more instances of α-renaming and soup reduction. We can now use the rules that we have defined so far in order to express the computational notion of application: Definition 9.1.15 (Application in the dagger lambda calculus). Let t and f be terms such that t : A and f : A∗ ⊗ B for some types A and B. We define the application f t as representing a variable x : B, along with a connection in our soup. The origins of the application affect the structure of its corresponding soup connection: f t : B, Γ ⊢ c : C := x : B, Γ ⊢{f :t∗ ⊗x}∗ c : C Γ ⊢ f t : B := Γ ⊢{f :t∗ ⊗x} x : B For an application originating inside our soup, we have: {f t : c} := {x : c} ∪ {f : t∗ ⊗ x} {c : f t} := {c : x} ∪ {f : t∗ ⊗ x}∗ Corollary 9.1.1 (Beta reduction). This immediately allows us to represent a form of beta reduction. Instead of relying on an implicit meta concept of substitution, our beta reduction is going to express the binding and reduction β of terms by connecting them in the context soup by setting (a∗ ⊗ b)t −→ b while causing {t : a} or {t : a}∗ to be added to the relational soup. Proof. This is derived from our definition of application because (a∗ ⊗ b)t represents a variable x along with one of two possible connections in our soup. The soup connection can be manipulated into: {a∗ ⊗ b : t∗ ⊗ x} → {a∗ : t∗ , b : x} → {t : a} ∪ {b : x} {a∗ ⊗ b : t∗ ⊗ x}∗ → {a∗ : t∗ , b : x}∗ → {t : a}∗ ∪ {x : b} The connection between b and x can then be consumed to change the variable x into a b. All that remains is {t : a} or {t : a}∗ . Now that all of the language’s rules are in place, we can make up for its apparent lack of a λ operator by defining it to be a notational shorthand: CHAPTER 9. THE DAGGER LAMBDA CALCULUS 44 Definition 9.1.16 (Lambda abstraction in the dagger lambda calculus). λa.b := a∗ ⊗ b and A ⊸ B := A∗ ⊗ B The following combinators are used in the rest of this dissertation: idA := λa.a (where a : A) b̄ := λg.λf.λa.g(f a) s̄ := λ(a ⊗ b).(b ⊗ a) t̄ := λf.λg.λ(x1 ⊗ x2 ).(f x1 ⊗ gx2 ) Theorem 9.1.1 (Admissibility of ⊸ E). We can also use the definition of application to demonstrate that an implication elimination rule (⊸ E) is admissible within our set of rules: Γ ⊢ S1 t : A a:A⊢a:A a∗ : A∗ ⊢ a∗ : A∗ b:B⊢b:B a∗ : A∗ , b : B ⊢ a∗ ⊗ b : A∗ ⊗ B ∆ ⊢S2 f : A∗ ⊗ B a∗ ⊗ b : A∗ ⊗ B ⊢ a∗ ⊗ b : A∗ ⊗ B Cut ∆ ⊢S2 ∪{f :a∗ ⊗b} a∗ ⊗ b : A∗ ⊗ B Uncurry a : A, ∆ ⊢S2 ∪{f :a∗ ⊗b} b : B Cut Γ, ∆ ⊢S1 ∪S2 ∪{t:a,f :a∗ ⊗b} b : B Γ, ∆ ⊢S1 ∪S2 ∪{f :t∗ ⊗b} b : B Γ, ∆ ⊢S1 ∪S2 f t : B We define some additional notational conventions, so that we can more easily describe the reversal in the causal order of computation: Definition 9.1.17 (Complex conjugation). Let f : A∗ ⊗ B be an arbitrary function. As a notational convention, we set f ∗ := s̄f : B ⊗ A∗ . Theorem 9.1.2 (Admissibility of †-flip). We can use the language’s rules and definitions in order to admit a new structural rule called the †-flip. This rule contains all the computational symmetry that we will later need in order to model the dagger functor: a : A ⊢S b : B a∗ : A∗ ⊢S∗ b∗ : B ∗ b : B, a∗ : A∗ ⊢S∗ a∗ : A∗ , b : B ⊢S∗ b : B ⊢ S∗ a : A Negation Uncurry Exchange Curry CHAPTER 9. THE DAGGER LAMBDA CALCULUS 45 Theorem 9.1.3 (Interchangeability of †-flip and Negation). Alternatively, we could have defined the language by including †-flip in our initial set of sequent rules. That would have allowed us to admit the Negation rule as a derived rule: a : A ⊢S b : B †-flip b : B ⊢ S∗ a : A Uncurry a∗ : A∗ , b : B ⊢S∗ Exchange b : B, a∗ : A∗ ⊢S∗ Curry a∗ : A∗ ⊢S∗ b∗ : B ∗ 9.1.1 Scalars Similarly to the attachable monoid that is described in [Abr05] for multiplying scalars, we can optionally define a multiplication operation for the scalars in the dagger lambda calculus. This is not part of the structure that is necessary to model dagger compact categories computationally, hence the designation optional, but it does provide a good example of how connections propagate in the soup: Definition 9.1.18 (Scalar multiplication). For any two scalars m : I and n : I, we define a multiplication operation m · n : I such that: m·1 =1·m=m and {m · p : n · q} := {m : n, p : q} The operation features a number of properties. To help the reader get more accustomed to the way things propagate in the soup, we will demonstrate some of them as an example. First of all, scalar multiplication is associative: Lemma 9.1.1 (Associativity of multiplication). (a · b) · c = a · (b · c) Proof. {(a · b) · c : 1} = {(a · b) · c : (1 · 1) · 1} = {a : 1, b : 1, c : 1} = {a · (b · c) : 1 · (1 · 1)} = {a · (b · c) : 1} CHAPTER 9. THE DAGGER LAMBDA CALCULUS 46 The multiplication operation is also commutative: Lemma 9.1.2 (Commutativity of multiplication). m · n = n · m Proof. {m · n : 1} = {m · n : 1 · 1} = {m : 1, n : 1} = {n : 1, m : 1} = {n · m : 1 · 1} = {n · m : 1} It is sesquilinear : Lemma 9.1.3 (Sesquilinearity of scalar connections). {m : n} = {m·n∗ : 1} Proof. {m : n} = {m · 1 : 1 · n} = {m : 1, 1 : n} = {m : 1, n∗ : 1} = {m · n∗ : 1 · 1} = {m · n∗ : 1} Finally, it is easy to deduce that the dimension of a tensor of types distributes into a product of dimensions: Corollary 9.1.2 (Dimension multiplication). {DA · DB : 1} = {DA⊗B : 1} Proof. {DA · DB : 1} = {DA : 1, DB : 1} = {a ⊗ b :A⊗B a ⊗ b} = {a :A a, b :B b} = {DA⊗B : 1} CHAPTER 9. THE DAGGER LAMBDA CALCULUS 9.2 47 Proofs of properties Many lambda calculi suffer from being complicated, which makes it hard to prepare and follow proofs about their properties. Our language is tractable and consists of a minimal set of rules. As a result, most of the language’s properties are easy to prove by structural inductions. Throughout the rest of this section, we prove that our lambda calculus satisfies most of the really important properties a calculus can have, namely subject reduction, confluence, strong normalisation and consistency. 9.2.1 Subject reduction The first thing we have to prove, in order to demonstrate that our typing system is well defined, is the consistency of our typing dynamics. In other words, we have to verify that the way in which relational connections propagate through our soup preserves type assignments. This is easy to observe because our soup only connects equityped terms. Pair consumption substitutes a term for another of the same type, thus preserving types. Theorem 9.2.1 (Subject reduction). Let J1 and J2 be two typing judgements such that J1 = Γ ⊢S t1 : A1 and J2 = ∆ ⊢S ′ t2 : A2 . Suppose that these two judgements are such that we can use a soup reduction rule S −→ S ′ to reduce one to the other: J1 −→ J2 . Then, the reduction will not alter type assignments in any way: types(Γ) = types(∆) and A1 ≡ A2 . Proof. Due to the way the dagger lambda calculus was designed, the proof of subject reduction will be trivial. We will prove this by induction on the rules of the soup reduction. There are four different rules that could be used when performing a soup reduction: • S ∪ {a ⊗ b : c ⊗ d} −→ S ∪ {a : c, b : d} (the bifunctoriality rule); • S ∪ {x :A x} −→ S ∪ {DA : 1} (the trace rule); • S ∪ {1 : 1} −→ S (the cancellation rule); • The consumption rule. If the reduction is an instance of one of the first three rules, then the theorem holds trivially; types(Γ) = types(∆) and A1 ≡ A2 since the bifunctoriality, trace and cancellation rules do not alter anything outside of the soup. If the soup reduction is an instance of the consumption rule, then a soup connection will be consumed to substitute a term at the other end of a CHAPTER 9. THE DAGGER LAMBDA CALCULUS 48 bounded pair of variables. The substitution may be global in scope, but it does not affect the sequent’s typing, since it is substituting one term for another one of the same type. The act of consumption itself does not affect the typing of the sequent either, since it removes a connection from the soup without affecting the terms outside. Therefore, regardless of the soup rule used, soup reduction has no effect on the typing of terms outside of the soup. This ensures that the typing dynamics of the dagger lambda calculus will be consistent. 9.2.2 Normalisation Strong normalisation is a highly sought after property for lambda calculi, primarily because of the implications it has on the practical implementation of the language. A reduction that is strongly normalising implies that every sequent has a normal form. Furthermore, it requires that the normal form is attained after a finite number of steps, without any chance of running into an infinite reduction loop. We now prove that the dagger lambda calculus has this property: Theorem 9.2.2 (Strong normalisation). Every sequence of soup reduction steps is finite and ends with a typing judgement that is in normal form. Proof. We begin by proving a simplified form of the theorem, where the terms connected in our soup are all of atomic type. Obviously, in a setting like this, the first reduction rule for our soup would never be used since there would be no tensored terms. The simplified theorem can be proved by induction on the length of the soup. In judgements where the soup is empty, or only contains pairs of constants that are not usable, it is obvious that reduction cannot proceed any further and that we have already reached a normal form in a finite (actually zero) number of steps. For a reduction soup with at least one usable connection, there are three possible ways this could go: (a) A pair of the form {x :A x} can be transformed into {DA : 1}, a scalar reference of the dimension of A. This will either give us an unusable soup connection or, if the type A is I, it will give us {1 : 1}, which can later be thrown away by using the cancellation rule. Either way, since our soup has a finite length, we will be left with a smaller usable soup. Hence, by the induction hypothesis, a normal form is attainable after finitely many steps. CHAPTER 9. THE DAGGER LAMBDA CALCULUS 49 (b) A pair of the form {1 : 1} can be thrown out of the soup as it does not contribute anything to our sequent. In doing so, since our soup has a finite length, we are left with a smaller soup. Hence, by the induction hypothesis, a normal form is attainable after finitely many steps. (c) A pair of the form {t : u}, where t or u is bound, can be consumed to perform a substitution. In doing so, since our soup has a finite length, we are again left with a smaller soup. By the induction hypothesis, we can attain a normal form after finitely many steps. This completes our proof of the simplified form of the theorem. In order to prove the full theorem, we perform an induction on the structure of the relational soup: (i) A relational soup that does not contain connections between tensored terms leads to a normal form after finitely many steps. This was already proved in the simplified version of this theorem. (ii) A connection between two tensors {a ⊗ b : c ⊗ d} can be reduced into two distinct connections {a : c, b : d}. The resulting pairs consist of subterms of the original pair. Hence, by the induction hypothesis, we can attain a normal form after finitely many steps. 9.2.3 Confluence Another very important property for our language is the Church-Rosser property. It ensures that we can end up with the same sequent regardless of the reduction path we choose to follow. A careful observation of our rewrite rules will reveal that the rules are all left-linear. Lemma 9.2.1 (Left-linearity). All of our soup rewrite rules are left-linear. Proof. In accordance with the linearity constraints of our language, no variable appears more than twice on the left hand side of any of our soup reduction rules: S ∪ {a ⊗ b : c ⊗ d} −→ S ∪ {a : c, b : d} S ∪ {x :A x} −→ S ∪ {DA : 1} S ∪ {1 : 1} −→ S S ∪ {t : u} −→ S (if t or u is a bound variable) CHAPTER 9. THE DAGGER LAMBDA CALCULUS 50 One should note, at this point, that our soup rules do exhibit a form of ”harmless” overlap. More specifically, the consumption rule (S ∪ {t : u} −→ S) forms a critical pair with itself in cases where t and u are both bound. Fortunately, as we will see in the next lemma, these pairs can be proved to be trivial as they correspond to sequents that are equivalent up to α-renaming. Lemma 9.2.2 (Symmetry of substitution). Let J be a typing judgement of the form J := Γ ⊢S∪{t:u} a : A, where t and u are both bound. The connection {t : u} can be consumed in either of two ways; one substitutes t for u and the other substitutes u for t in the typing judgement. Let’s call these J1 and J2 respectively. J1 will then be α-equivalent to J2 . Proof. We know that J −→ J1 :=    Γ ⊢S a : A t/u J −→ J2 :=    Γ ⊢S a : A u/t Since t and u are both bound, by linearity, we know that they appear exactly once in Γ ⊢S a : A. After substitution is performed, J1 will have two occurrences of t where t and u used to be, so t will be a bound term in that judgement. Similarly, J2 will have two occurrences of u where t and u used to be, so u will be a bound term in that judgement. These bound terms occur in the exact same spots, so we can alpha-rename J1 to J2 and vice versa. Corollary 9.2.1 (No overlap). The rewrite rules have no overlap up to α-equality of typing judgements. Theorem 9.2.3 (Confluence). Our reduction rules have the Church-Rosser property. Proof. Our set of rewrite rules is left-linear and has no significant overlap, since it only gives rise to critical pairs that are trivial up to α-equivalence. Therefore, our rewrite rules constitute a weakly orthogonal rewrite system, which is weakly confluent according to [Klo92]. Since the rewrite system is both strongly normalising and weakly confluent, we can use Newman’s lemma to conclude that it also possesses the Church-Rosser property. See [Klo92] for a more detailed explanation of the properties of orthogonal rewriting systems. CHAPTER 9. THE DAGGER LAMBDA CALCULUS 9.2.4 51 Consistency In order to show that our type theory is consistent, we have to show that our soup dynamics do not collapse all equityped terms to the same element. Theorem 9.2.4 (Consistency). There exist two terms of the same type, henceforth referred to as t1 and t2 , such that Γ ⊢S1 t1 : A and Γ ⊢S2 t2 : A could never reduce to the same typing judgement. Proof. Consider two combinators of the same type, t1 = idA⊗A and t2 = s̄A⊗A . Both terms are closed, containing no free variables or constants. The sequents ⊢ idA⊗A : (A ⊗ A) ⊸ (A ⊗ A) and ⊢ s̄A⊗A : (A ⊗ A) ⊸ (A ⊗ A) are distinct normal forms: They are clearly distinct from one another and cannot be further reduced using any of our rules, thereby proving that they could never reduce to the same typing judgement. 9.3 Correspondence to dagger compact categories The purpose of this section is to provide a full Curry-Howard-Lambek correspondence between the dagger lambda calculus and dagger compact categories. We start by defining a directed graph G, representing a signature for dagger compact categories. We then show how that graph can be interpreted to define the free dagger compact category CF ree and the dagger lambda calculus †λ. An appropriate Cut-elimination procedure is defined to partition the sequents of the dagger lambda calculus into equivalence classes up to soup equivalence. The resulting equivalence classes are modular proof invariants represented by denotations. We show that the types and denotations can be used to form a syntactic category, CSynt , and prove that the category is dagger compact. The diagram below, fashioned to resemble the diagram at the bottom of page 49 in [Mac98], is provided to help visualise the Curry-Howard-Lambek correspondence. In this diagram, U CF ree and U CSynt are the underlying graphs of their respective categories, where identities, composition, natural isomorphisms and other structural elements of the parent categories have been ”forgotten” by applying the forgetful functor U . F is the unique functor between the free and the syntactic category, 52 CHAPTER 9. THE DAGGER LAMBDA CALCULUS that satisfies the rest of the conditions in the diagram. CF ree !F †λ ℓ CSynt UCF ree G UF UCSynt We will prove an equivalence between the free category and the syntactic category. We should note at this point that our typing conventions of an involutive negation (A ≡ (A∗ )∗ ) and negation invariance of the tensor unit (I ≡ I ∗ ) implicitly introduce equivalence classes on types. Our proof of equivalence will be achieved by fully exhibiting the correspondence in objects and arrows between the two categories, up to the equivalence classes that are induced by our typing conventions. 9.3.1 A signature for dagger compact categories The notion of signature we will be using combines that of the algebraic signature of [Sel10] with the directed graph used by [Mac98]. Consider a set of object variables Σ0 . Using the tensor operation, an associated tensor identity and the duality operator star, we can construct the free (⊗, I, ∗ )algebra over Σ0 . This corresponds to the set of all object terms or vertices in a compact closed category and will be denoted by Dagger(Σ0 ). Now consider a set Σ1 of morphism variables or edges between those vertices. Let dom, cod be a pair of functions such that dom, cod : Σ1 −→ Dagger(Σ0 ). Throughout the rest of this section, we will be referring to the graph G as the directed graph whose vertices and edges are defined by Dagger(Σ0 ) and Σ1 . This graph forms the signature upon which we will base both the dagger lambda calculus and our description of the free dagger compact category; it includes all of the symbols but none of the logic of the languages that we want to describe. 9.3.2 The free dagger compact category We will now show how to define the free dagger compact category CF ree as an interpretation of the graph G. A highly intuitive introduction to free categories and how they can be generated from directed graphs can be found CHAPTER 9. THE DAGGER LAMBDA CALCULUS 53 in [Mac98]. Furthermore, a more extensive presentation of the process of constructing of various kinds of free categories can be found in [Sel10]. A more detailed presentation of the incremental buildup to the construction of free dagger compact categories can also be found in [Abr05]. The set of objects for the free category in this section will be the same as the set of vertices Dagger(Σ0 ) in the graph G. The set of edges Σ1 in the graph is used to generate morphisms for the free category. Thus, an edge of the form f : A → B generates an arrow in CF ree which we will denote as hA, f, Bi. The free category over a directed graph, also referred to as a path category, includes morphisms that correspond to the paths generated by combining adjoining edges in G. These morphisms are formed using the free category’s composition operation. Given two morphisms hA, f, Bi and hB, g, Ci, we write their composition in CF ree as hA, f, B, g, Ci. Since the free category is a monoidal category, it allows us to consider two of the graph’s edges concurrently by bringing together their corresponding categorical morphisms using a monoidal tensor product. Given two morphisms hA, f, Bi and hC, h, Di, we write their tensor product as hA ⊗ C, f ⊗ h, B ⊗ Di. The free category generated by the graph G also includes a number of morphisms that are part of the dagger compact logical structure. The identities are represented by: hAi, hBi, hCi, . . . The monoidal natural isomorphisms are written as: hA ⊗ (B ⊗ C), αA,B,C , (A ⊗ B) ⊗ Ci hI ⊗ A, λA , Ai hA ⊗ I, ρA , Ai The symmetry isomorphism is written as: hA ⊗ B, σA,B , B ⊗ Ai And the units and counits are written as: hI, ηA , A∗ ⊗ Ai hA ⊗ A∗ , εA , Ii For every map hA, f, Bi in the free category, the dagger compact logical structure contains maps f∗ and f † , represented by hA∗ , f∗ , B ∗ i and CHAPTER 9. THE DAGGER LAMBDA CALCULUS 54 hB, f † , Ai respectively. When acting on compositions of paths, such as hA, f, B, g, C, . . . , X, h, Y, t, Zi, the dagger operator reverses the order of operations, yielding: hZ, t† , Y, h† , X, . . . , C, g † , B, f † , Ai 9.3.3 The dagger lambda calculus This section demonstrates how the graph signature G can be interpreted to derive the dagger lambda calculus. The set of types used by †λ is precisely the set of vertices Dagger(Σ0 ) used in graph G. Every edge f :A→B in Σ1 is interpreted as a sequent a : A ⊢{f :a∗ ⊗b} b : B up to alpha-equivalence. These interpretations essentially introduce constants, in our case f : A∗ ⊗ B, written as sequents that are reminiscent of η-expanded forms. The rest of the rules of the dagger lambda calculus can be used to process and combine sequents, yielding a richer logical structure. 9.3.4 The syntactic category Following a method that is similar to [Mel09], we will define a process of Cut-elimination by using the soup reduction relation to partition the sequents of the dagger lambda calculus into equivalence classes. The resulting equivalence classes are modular proof invariants called denotations. This section demonstrates how these denotations give rise to a dagger compact categorical structure CSynt called the syntactic category. Definition 9.3.1 (Denotations). We will use the term denotations to refer to the equivalence classes that are formed by partitioning the sequents of the lambda calculus according to soup equivalence. Hence, two sequents will correspond to the same denotation if and only if they are equivalent up to soup reduction. Theorem 9.3.1 (The syntactic category). The types of the lambda calculus and the denotations generated by soup equivalence form a category whose objects are types and whose arrows are denotations. CHAPTER 9. THE DAGGER LAMBDA CALCULUS 55 Proof. As we noticed during the proof of the subject reduction property, soup reduction rules do not affect our language’s type assignments. Consequently, the type of the premises used by a sequent will be the same across all sequents in a given denotation. Similarly, the type of the conclusion produced by a sequent will be the same across all sequents in a given denotation. For any sequent Γ ⊢S b : B, corresponding to a denotation [π1 ], we will say that its domain is Γ and its codomain is B, writing this as [π1 ] : Γ → B. Let [f ] : A → B and [g] : B → C be denotations representing the soup equivalent forms of some sequents a : A ⊢S1 b : B and b′ : B ⊢S2 c : C respectively. For any two such denotations, where the codomain of the first matches the domain of the second, we will define a composition operator ◦ that can combine them into [g] ◦ [f ] : A → C. The new denotation will represent all the soup equivalent forms of the sequent that is generated by combining the two sequents using the Cut rule: a : A ⊢ S1 b : B b′ : B ⊢ S 2 c : C Cut a : A ⊢S1 ∪S2 ∪{b:b′ } c : C The composition operation we just defined inherits associativity from the Cut rule; the order in which Cuts are performed does not matter since the connected terms are allowed to ”float” freely within the soup. Therefore, [h] ◦ ([g] ◦ [f ]) = ([h] ◦ [g]) ◦ [f ]. Moreover, for every type A, there is a denotation [idA ] that represents the sequent generated by the Identity axiom (Id): x : A ⊢ x : A. Composing a denotation [f ] : A → B with an identity yields [f ] ◦ [idA ] or [idB ] ◦ [f ] depending on whether we compose with an identity on the right or on the left. The two resulting denotations represent x:A⊢x:A a : A ⊢S b : B x : A ⊢S∪{x:a} b : B and a : A ⊢S b : B x:B⊢x:B a : A ⊢S∪{b:x} x : B both of which are soup equivalent to a : A ⊢S b : B and the rest of the sequents represented by [f ]. Hence [idB ] ◦ [f ] = [f ] = [f ] ◦ [idA ] We call this category the syntactic category. We will now incrementally check that it satisfies the criteria needed to be a dagger compact category. Definition 9.3.2 (Syntactic category notational conventions). For notational convenience, we define the following combinators: αA,B,C := λ (a ⊗ (b ⊗ c)) . ((a ⊗ b) ⊗ c) : (A ⊗ (B ⊗ C)) ⊸ ((A ⊗ B) ⊗ C) α−1 A,B,C := λ ((a ⊗ b) ⊗ c) . (a ⊗ (b ⊗ c)) : ((A ⊗ B) ⊗ C) ⊸ (A ⊗ (B ⊗ C)) CHAPTER 9. THE DAGGER LAMBDA CALCULUS 56 λA := λ(1 ⊗ a).a : (I ⊗ A) ⊸ A λ−1 A := λa.(1 ⊗ a) : A ⊸ (I ⊗ A) ρA := λ(a ⊗ 1).a : (A ⊗ I) ⊸ A ρ−1 A := λa.(a ⊗ 1) : A ⊸ (A ⊗ I) σA,B := λ(a ⊗ b).(b ⊗ a) : (A ⊗ B) ⊸ (B ⊗ A) −1 := σB,A = λ(b ⊗ a).(a ⊗ b) : (B ⊗ A) ⊸ (A ⊗ B) σA,B ηA := λ1.(x∗ ⊗ x) : I ⊸ (A∗ ⊗ A) εA := λ(x ⊗ x∗ ).1 : (A ⊗ A∗ ) ⊸ I Theorem 9.3.2 (Monoidal category). The syntactic category is a monoidal category Proof. Let [f ] : A → B and [g] : C → D be denotations representing the soup equivalent forms of some sequents a : A ⊢S1 b : B and c : C ⊢S2 d : D respectively. We define a monoidal product ⊗ that can combine them into [f ] ⊗ [g] : A ⊗ B → C ⊗ D. The new denotation will represent all the soup equivalent forms of the sequent that is generated by combining the two sequents using the right tensor rule: a : A ⊢ S1 b : B c : C ⊢ S2 d : D N R a : A, c : C ⊢S1 ∪S2 b ⊗ d : B ⊗ D Let [f ] : A → B, [g] : B → P , [h] : C → D and [t] : D → Q be denotations in the syntactic category. Using composition and tensor, we can combine these denotations to form ([g] ◦ [f ]) ⊗ ([t] ◦ [h]), which represents the soup equivalent sequents of: c : C ⊢ S2 d : D d′ : D ⊢S4 q : Q a : A ⊢ S1 b : B b′ : B ⊢ S 3 p : P Cut Cut a : A ⊢S1 ∪S3 ∪{b:b′ } p : P c : C ⊢S2 ∪S4 ∪{d:d′ } q : Q N R a : A, c : C ⊢S1 ∪S2 ∪S3 ∪S4 ∪{b:b′ ,d:d′ } p ⊗ q : P ⊗ Q We can also combine the same denotations to form ([g] ⊗ [t]) ◦ ([f ] ⊗ [h]), which represents the soup equivalent sequents of: b′ : B ⊢ S 3 p : P d′ : D ⊢S4 q : Q N R b′ : B, d′ : D ⊢S3 ∪S4 p ⊗ q : P ⊗ Q N a : A ⊢ S1 b : B c : C ⊢ S2 d : D N L R b′ ⊗ d′ : B ⊗ D ⊢S3 ∪S4 p ⊗ q : P ⊗ Q a : A, c : C ⊢S1 ∪S2 b ⊗ d : B ⊗ D Cut a : A, c : C ⊢S1 ∪S2 ∪S3 ∪S4 ∪{b⊗d:b′ ⊗d′ } p ⊗ q : P ⊗ Q 57 CHAPTER 9. THE DAGGER LAMBDA CALCULUS Applying our soup’s bifunctoriality rule, {b ⊗ d : b′ ⊗ d′ } → {b : b′ , d : d′ }, reduces one of these sequents to the other, which means that they belong to the same equivalence class. Hence, the two sequents are represented by the same denotation: ([g] ◦ [f ]) ⊗ ([t] ◦ [h]) = ([g] ⊗ [t]) ◦ ([f ] ⊗ [h]) The tensor product also preserves identities since a⊗b : A⊗B ⊢ a⊗b : A⊗B is α-equivalent to x : A ⊗ B ⊢ x : A ⊗ B. The denotation [αA⊗B,C,D ] ◦ [αA,B,C⊗D ] represents the soup equivalent sequents of: a : A, b ⊗ (c ⊗ d) : B ⊗ (C ⊗ D) ⊢S1 ((a3 ⊗ b3 ) ⊗ c3 ) ⊗ d3 : ((A ⊗ B) ⊗ C) ⊗ D where the soup S1 is:   αA,B,C⊗D : λ (a ⊗ (b ⊗ (c ⊗ d))) . ((a2 ⊗ b2 ) ⊗ (c2 ⊗ d2 )) , αA⊗B,C,D : λ ((a2 ⊗ b2 ) ⊗ (c2 ⊗ d2 )) . (((a3 ⊗ b3 ) ⊗ c3 ) ⊗ d3 ) Similarly, the denotation ([αA,B,C ] ⊗ [idD ]) ◦ [αA,B⊗C,D ] ◦ ([idA ] ⊗ [αB,C,D ]) represents the soup equivalent sequents of: a : A, b ⊗ (c ⊗ d) : B ⊗ (C ⊗ D) ⊢S2 ((a3 ⊗ b3 ) ⊗ c3 ) ⊗ d3 : ((A ⊗ B) ⊗ C) ⊗ D where the soup S2   αB,C,D α  A,B⊗C,D αA,B,C is:  : λ (b ⊗ (c ⊗ d)) . ((b1 ⊗ c1 ) ⊗ d1 ) ,  : λ (a ⊗ ((b1 ⊗ c1 ) ⊗ d1 )) . ((a2 ⊗ (b2 ⊗ c2 )) ⊗ d3 ) ,  : λ (a2 ⊗ (b2 ⊗ c2 )) . ((a3 ⊗ b3 ) ⊗ c3 ) We can use our soup’s bifunctoriality and substitution rules to show that S1 and S2 are equivalent. Hence, the two denotations we constructed are equal, which corresponds to the associativity pentagon for monoidal categories: [αA⊗B,C,D ] ◦ [αA,B,C⊗D ] = ([αA,B,C ] ⊗ [idD ]) ◦ [αA,B⊗C,D ] ◦ ([idA ] ⊗ [αB,C,D ]) (A ⊗ B) ⊗ (C ⊗ D) a a A ⊗ (B ⊗ (C ⊗ D)) ((A ⊗ B) ⊗ C) ⊗ D id ⊗ a a ⊗ id A ⊗ ((B ⊗ C) ⊗ D) a (A ⊗ (B ⊗ C)) ⊗ D CHAPTER 9. THE DAGGER LAMBDA CALCULUS 58 Now consider the denotation ([ρA ] ⊗ [idB ]) ◦ [αA,I,B ], which represents the soup equivalent sequents of: a : A, i ⊗ b : I ⊗ B ⊢S3 a3 ⊗ b2 : A ⊗ B where the soup S3 is:   αA,I,B : λ(a ⊗ (i ⊗ b)).((a2 ⊗ i2 ) ⊗ b2 ), ρA : λ(a2 ⊗ i2 ).a3 and the denotation [idA ] ⊗ [λB ], which corresponds to the soup equivalent sequents of: a : A, i ⊗ b : I ⊗ B ⊢S4 a3 ⊗ b2 : A ⊗ B where the soup S4 is:  λB : λ(i ⊗ b).b2 , a : a3  The two soups, S3 and S4 , are equivalent up to soup reduction, which means that the two denotations representing them are equal: ([ρA ] ⊗ [idB ]) ◦ [αA,I,B ] = [idA ] ⊗ [λB ] The syntactic category, therefore, satisfies all of the requirements and coherence conditions of a monoidal category. Theorem 9.3.3 (Symmetric monoidal category). The syntactic category is a symmetric monoidal category Proof. Consider the denotation [σB,A ] ◦ [σA,B ], representing the soup equivalent sequents of: a : A, b : B ⊢{σA,B :λ(a⊗b).(b2 ⊗a2 ), σB,A :λ(b2 ⊗a2 ).(a3 ⊗b3 )} a3 ⊗ b3 : A ⊗ B These sequents are soup equivalent to x : A ⊗ B ⊢ x : A ⊗ B, which means that the denotation used as a symmetry isomorphism is involutive: [σB,A ] ◦ [σA,B ] = [idA⊗B ] Moreover, if we consider [λA ] ◦ [σA,I ], the denotation corresponding to the sequent: a : A, i : I ⊢{σA,I :λ(a⊗i).(i2 ⊗a2 ),λA :λ(i2 ⊗a2 ).a3 } a3 : A and [ρA ], the denotation corresponding to: a : A, i : I ⊢{ρA :λ(a⊗i).a3 } a3 : A CHAPTER 9. THE DAGGER LAMBDA CALCULUS 59 Since the two sequents are soup equivalent, we can say that: [ρA ] = [λA ] ◦ [σA,I ] Finally, consider the denotation [αC,A,B ] ◦ [σA⊗B,C ] ◦ [αA,B,C ], which represents the soup equivalent sequents of: a : A, b ⊗ c : B ⊗ C ⊢S5 (c3 ⊗ a3 ) ⊗ b3 : (C ⊗ A) ⊗ B where the soup S5 is:   αA,B,C σA⊗B,C  αC,A,B  : λ (a ⊗ (b ⊗ c)) . ((a1 ⊗ b1 ) ⊗ c1 ) ,  : λ ((a1 ⊗ b1 ) ⊗ c1 ) . (c2 ⊗ (a2 ⊗ b2 )) ,  : λ (c2 ⊗ (a2 ⊗ b2 )) . ((c3 ⊗ a3 ) ⊗ b3 ) and the denotation ([σA,C ]⊗[idB ])◦[αA,C,B ]◦([idA ]⊗[σB,C ]), which represents the soup equivalent sequents of: a : A, b ⊗ c : B ⊗ C ⊢S6 (c3 ⊗ a3 ) ⊗ b3 : (C ⊗ A) ⊗ B where the soup S6 is:   : λ(b ⊗ c).(c1 ⊗ b1 ),  σB,C  αA,C,B : λ (a ⊗ (c1 ⊗ b1 )) . ((a2 ⊗ c2 ) ⊗ b3 ) ,   σA,C : λ(a2 ⊗ c2 ).(c3 ⊗ a3 ) The two sequents are soup equivalent, so the denotations representing them are equal: [αC,A,B ] ◦ [σA⊗B,C ] ◦ [αA,B,C ] = ([σA,C ] ⊗ [idB ]) ◦ [αA,C,B ] ◦ ([idA ] ⊗ [σB,C ]) The syntactic category, therefore, satisfies all of the requirements and coherence conditions of a symmetric monoidal category. Theorem 9.3.4 (Compact closure). The syntactic category is a compact closed category Proof. Consider the denotation [λA ]◦([εA ]⊗[idA ])◦[αA,A∗ ,A ]◦([idA ]⊗[ηA ])◦ [ρA ]−1 , which represents the soup equivalent sequents of x1 : A ⊢S7 x8 : A where the soup S7 is:  −1  : λx1 .(x2 ⊗ i1 ), ρA         η : λi .(x ⊗ x ),  A  1 3∗ 4 αA,A∗ ,A : λ (x2 ⊗ (x3 ⊗ x4 )) . ((x5 ⊗ x6∗ ) ⊗ x7 ) ,       ε : λ(x5 ⊗ x6∗ ).i2 ,    A  λA : λ(i2 ⊗ x7 ).x8 CHAPTER 9. THE DAGGER LAMBDA CALCULUS 60 Using our soup reduction rules, we can reduce the above sequent to x : A ⊢ x : A, hence showing that: [λA ] ◦ ([εA ] ⊗ [idA ]) ◦ [αA,A∗ ,A ] ◦ ([idA ] ⊗ [ηA ]) ◦ [ρA ]−1 = [idA ] Now, let us consider [ρA∗ ] ◦ ([idA∗ ] ⊗ [εA ]) ◦ [αA∗ ,A,A∗ ]−1 ◦ ([ηA ] ⊗ [idA∗ ]) ◦ [λA∗ ]−1 ; the denotation that corresponds to the soup equivalent sequents of x1∗ : A∗ ⊢S8 x8∗ : A∗ , where the soup S8 is:   −1 : λx .(i ⊗ x ), λ ∗ 1∗ 1 2∗   A       : λi1 .(x3∗ ⊗ x4 ),   ηA −1 αA∗ ,A,A∗ : λ ((x3∗ ⊗ x4 ) ⊗ x2∗ ) . (x5∗ ⊗ (x6 ⊗ x7 )) ,       εA : λ(x6 ⊗ x7∗ ).i2 ,     ρA∗ : λ(x5∗ ⊗ i2 ).x8∗ Using our soup reduction rules, we can reduce the above sequent to x∗ : A∗ ⊢ x∗ : A∗ , hence showing that: [ρA∗ ] ◦ ([idA∗ ] ⊗ [εA ]) ◦ [αA∗ ,A,A∗ ]−1 ◦ ([ηA ] ⊗ [idA∗ ]) ◦ [λA∗ ]−1 = [idA∗ ] The syntactic category thus satisfies both of the yanking conditions that are required of a compact closed category. Theorem 9.3.5 (Dagger compact closure). The syntactic category is a dagger compact category Proof. Let [f ] : A → B be a denotation representing the soup equivalent sequents of a : A ⊢S9 b : B. For every such denotation [f ], we define its dagger [f ]† : B → A such that it represents the soup equivalent sequents of the †-flipped version of the original sequent: b : B ⊢S9∗ a : A. The †-flip rule, however, is involutive since (S9∗ )∗ = S9 , hence ([f ]† )† = f . Now consider the denotation [σA,A∗ ] ◦ [εA ]† , which represents the soup equivalent sequents of: i : I ⊢S10 x3∗ ⊗ x4 : A∗ ⊗ A where the soup S10 is:  εA∗ σA,A∗ : (λ(x1 ⊗ x2∗ ).1)∗ , : λ(x1 ⊗ x2∗ ).(x3∗ ⊗ x4 )  By using soup reduction, we get S10 → {ηA : λi.(x3∗ ⊗ x4 )}. But the sequent i : I ⊢{ηA :λi.(x3∗ ⊗x4 )} x3∗ ⊗ x4 : A∗ ⊗ A is represented by the denotation [ηA ], which means that [σA,A∗ ] ◦ [εA ]† = [ηA ] The syntactic category, therefore, satisfies all of the requirements of a dagger compact category. CHAPTER 9. THE DAGGER LAMBDA CALCULUS 9.3.5 61 Proof of equivalence We will now prove that the free dagger compact category CF ree is equivalent to the syntactic category CSynt . Lemma 9.3.1 (Essentially surjective on objects). The set of objects in the free category and the set of objects in the syntactic category are surjective, up to isomorphism. Proof. Recall Dagger(Σ0 ); the free (⊗, I, ∗ )-algebra over the set of object variables Σ0 . The sets of objects in CF ree and CSynt both correspond to Dagger(Σ0 ), up to the equivalence classes induced by (A∗ )∗ ≡ A and I ∗ ≡ I. Lemma 9.3.2 (Equal arrows correspond to equal denotations). If two arrows, hA, f, Bi and hA, f ′ , Bi are equal in the free category, then they will also be equal in the syntactic category: [f ] = [f ′ ] : A → B. Proof. The structure of the free category CF ree imposes the minimum number of equalities for a category to be dagger compact. Moreover, both the free category and the syntactic category derive their symbols from the same signature graph G. Since we have already shown that CSynt is dagger compact, the same steps can be used to show that any arrows hA, f, Bi and hA, f ′ , Bi that are equal in the free category, correspond to equal denotations [f ] = [g] in the syntactic category. Lemma 9.3.3 (Equal denotations correspond to equal arrows). Any denotations that are equal in the syntactic category, correspond to equal arrows in the free category. Proof. Let [f ] : Γ → B and [g] : Γ → B be denotations in the syntactic category such that [f ] = [g]. Since the two denotations are equal, the sequents they represent in the dagger lambda calculus must be equivalent up to soup reduction. Without loss of generality, lets assume that [f ] represents a sequent J1 and that [g] represents a sequent J2 , where J1 → J2 . The soup reduction relation consists of four soup rules: bifunctoriality, trace, cancellation and consumption. We prove this theorem by induction on the structure of the soup reduction linking J1 and J2 : • If we use a bifunctoriality rule, then we will be reducing a sequent of the form Γ ⊢S∪{x1 ⊗x2 :x3 ⊗x4 } b : B to one of the form Γ ⊢S∪{x1 :x3 ,x2 :x4 } b : B. By carefully separating the appropriate connections, we can break down [g] into ([π2 ]◦[π1 ])⊗([π4 ]◦[π3 ]) where: [π1 ] represents Γ1 ⊢S1 x1 : CHAPTER 9. THE DAGGER LAMBDA CALCULUS 62 T1 ; [π2 ] represents x3 : T1 ⊢S2 b1 : B1 ; [π3 ] represents Γ2 ⊢S3 x2 : T2 ; [π4 ] represents x4 : T2 ⊢S4 b2 : B2 ; and Γ = Γ1 , Γ2 , S = S1 ∪S2 ∪S3 ∪S4 , b = b1 ⊗ b2 and B = B1 ⊗ B2 . The individual [πi ] denotations can be reconstructed in a different way to form ([π2 ] ⊗ [π4 ]) ◦ ([π1 ] ⊗ [π3 ]), which actually forms [f ]. But hΓ1 , π1 , T1 , π2 , B1 i⊗hΓ2 , π3 , T2 , π4 , B2 i = hΓ, π1 ⊗ π3 , T1 ⊗ T2 , π2 ⊗ π4 , Bi because CF ree is a dagger compact category, so hΓ, f, Bi = hΓ, g, Bi. • If we use a trace rule on J1 , we do not in any way affect the information that is contained in the soup connection, we are simply rewriting it using different notation, so we are in no way affecting the derivation of J2 from sequents represented by smaller denotations. • If we use a cancellation rule on J1 , the information contained on the connection we are striking out is nil, so we are in no way affecting the derivation of J2 from sequents represented by smaller denotations. In this case, [f ] represents hΓ, f, Bi = hΓ, g, Bi ⊗ 1 in the free category, which is the same as hΓ, g, Bi. • If we use a consumption rule on J1 , then the bound variable we are substituting for will either appear to the left or to the right of the turnstile, or it will appear elsewhere in the soup. – If the bound variable appears to the left of the turnstile then the general form of the sequent J1 can be written as t1 : T1 , x : T2 , t3 : T3 ⊢S∪{x:t2 } b : B. Let Γ = T1 ⊗ T2 ⊗ T3 . Since J2 is the result of consuming a soup connection that was created by performing a Cut with the identity, the sequent can be written as t1 : T1 , t2 : T2 , t3 : T3 ⊢S b : B. This means that [f ] = [g] ◦ [idΓ ], which causes hΓ, f, Bi = hΓ, g, Bi ◦ hΓi = hΓ, g, Bi. – If the bound variable appears to the right of the turnstile then the general form of the sequent J1 can be written as Γ ⊢S∪{t2 :x} t1 ⊗ x ⊗ t3 : B. Since J2 is the result of consuming a soup connection that was created by performing a Cut with the identity, the sequent can be written as Γ ⊢S t1 ⊗ t2 ⊗ t3 : B. This means that [f ] = [idB ] ◦ [g], which causes hΓ, f, Bi = hBi ◦ hΓ, g, Bi = hΓ, g, Bi. – If the bound variable appears elsewhere in the soup, then J1 will be the result of applying the Cut rule twice on J2 , each time with an instance of the identity. The denotation representing J1 will CHAPTER 9. THE DAGGER LAMBDA CALCULUS 63 either be [f ] = ([idB ] ◦ [idB ]) ◦ [g] or [f ] = [g] ◦ ([idΓ ] ◦ [idΓ ]), both of which cause hΓ, f, Bi = hΓ, g, Bi. We have, therefore, shown that in all cases, hΓ, f, Bi = hΓ, g, Bi. Theorem 9.3.6 (Equivalence between the free category and the syntactic category). The free dagger compact category CF ree and the syntactic category CSynt are equivalent. Proof. The two categories derive their symbols from a common signature graph G. As we have already shown, bearing in mind the equivalence classes that we have induced on types, the categories are essentially surjective on objects. Moreover, arrows that are equal in the free category are equal in the syntactic category and vice versa. This means that the functor F is full and faithful, causing the notions of equality between arrows overlap in these two categories. Consequently, the categories are equivalent. Corollary 9.3.1 (Internal language). The dagger lambda calculus is an internal language for dagger compact categories. Chapter 10 Classical control in the †λ-calculus In this section we will see how the dagger lambda calculus can be imbued with classical control structures, similar to the ones in [CD11]. We will begin by defining classical structures within the dagger lambda calculus, hence allowing it to support the Frobenius algebras of [CP06], [CP07] and [CPP10]. We will then demonstrate how our extension of the lambda calculus can be used to represent the notion of dualiser that was introduced in [CPP08], as well as how this notion now makes the Currying rule admissible in our language. Finally, we will further extend the dagger lambda calculus with complementary classical structures, by defining a notion of complementarity that extends that of [CD11], with the dualisers of [CPP08], to allow for non self-dual †-compact structures. Throughout this entire section, we will be using a version of the dagger lambda calculus that has been modified to simplify our notation. In order to do this, we will be restricting our attention to strict dagger compact categories; categories whose monoidal natural isomorphisms, αA,B,C , λΓ and ρΓ , are identities. As a result, instances of the ⊗L, λΓ and ρΓ rules will be equated with the identity, allowing us to be more relaxed when it comes to tensor identities and parenthesising terms. 10.1 Classical structures As we have seen in chapter 3 and section 6.2, of part II of this dissertation, the classical world is a lot less ”restrictive” than the quantum world in that it allows us to freely copy and delete data. Classical states can be thought 64 CHAPTER 10. CLASSICAL CONTROL IN THE †λ-CALCULUS 65 of as a basis that spans a vector space of quantum states and it is in this subset of the quantum world that the linearity restrictions can be relaxed. Linear logic [Gir87] achieves its resource sensitivity by dropping the rules of weakening and contraction. In place of those rules, Girard introduced the exponential connective !A, denoting an infinite supply of the type A, as a more tightly controlled way of breaching linearity. In designing the dagger lambda calculus, we have also dropped the rules of weakening and contraction. Instead of replacing them, however, with an exponential connective, we will extend our language by providing a stricter and yet more controlled way of relaxing resource sensitivity. This will be done by supporting the Frobenius algebras of [CP06], [CP07] and [CPP10] with copying and deleting maps and will allow us to model the behaviour of a classical basis. For every type A in the dagger lambda calculus, we will be introducing two constants; G21 : A ⊸ A ⊗ A and G01 : A ⊸ I. This allows us to represent the copying and deleting operations as sequents in our language: ⊢ G01 : A∗ x1 : A ⊢{G21 :x1∗ ⊗x2 ⊗x3 } x2 ⊗ x3 : A ⊗ A Definition 10.1.1 (Notational conventions for classical structures in the dagger lambda calculus). For notational convenience, we will use A⊗n as shorthand for A . . ⊗ A}. We also define G11 , G12 and G10 as follows: | ⊗ .{z n times G11 G10 := (G01 )∗ G12 := (G21 )∗ , := idA , We will define the copying and deleting maps by describing all of the conditions that we require them to satisfy in the dagger lambda calculus. The first such condition is the comonoidal coassociativity condition: 5 4 3 2 1 5 4 3 = = 1 3 5 4 2 1 which requires the following two soups, S1 and S2 , to be equal in the lambda calculus: S1 = {G21 : x1∗ ⊗ x2 ⊗ x3 , G21 : x2∗ ⊗ x4 ⊗ x5 } CHAPTER 10. CLASSICAL CONTROL IN THE †λ-CALCULUS 66 S2 = {G21 : x1∗ ⊗ x4 ⊗ x2 , G21 : x2∗ ⊗ x5 ⊗ x3 } This allows us to relate the sequents for x1 : A ⊢S1 x4 ⊗ x5 ⊗ x3 : A⊗3 and x1 : A ⊢S2 x4 ⊗ x5 ⊗ x3 : A⊗3 , matching the equality of arrows that is required in the categorical setting. Since it does not matter whether we copy one or the other part of a copied pair, we can write both cases as: x1 : A ⊢{G31 :x1∗ ⊗x4 ⊗x5 ⊗x3 } x4 ⊗ x5 ⊗ x3 : A⊗3 The next condition we require of the dagger lambda calculus is the comonoidal identity condition: 2 2 = = 1 1 which requires the following soups, S3 , S4 and S5 , to be equal to each other: S3 = {G21 : x1∗ ⊗ G10 ⊗ x2 } S4 = {G11 : x1∗ ⊗ x2 } −→ {x1 : x2 } S5 = {G21 : x1∗ ⊗ x2 ⊗ G10 } This allows us to relate the sequents for x1 : A ⊢S3 x2 : A, x1 : A ⊢S4 x2 : A and x1 : A ⊢S5 x2 : A, matching the equality of arrows that is required in the categorical setting, to get an identity sequent x : A ⊢ x : A. We will also require the copy map to satisfy a cocommutativity requirement: 2 3 = 1 2 3 3 2 1 which requires the following soups, S6 and S7 , to be equal in the dagger lambda calculus: S6 = {G21 : x1∗ ⊗ x2 ⊗ x3 } CHAPTER 10. CLASSICAL CONTROL IN THE †λ-CALCULUS 67 S7 = {G21 : x1∗ ⊗ x3 ⊗ x2 } This allows us to relate the sequents for x1 : A ⊢S6 x2 ⊗ x3 : A ⊗ A and x1 : A ⊢S7 x2 ⊗ x3 : A ⊗ A, matching the equality of arrows that is required in the categorical setting. Since all spider monoids have to be special, we require the copying map to satisfy the isometry condition: 4 2 3 = 1 which requires the following soups to be equal:  2 S8 = G1 : x1∗ ⊗ x2 ⊗ x3 , G12 : (x2 ⊗ x3 )∗ ⊗ x4 S9 = {G11 : x1∗ ⊗ x4 } −→ {x1 : x4 } and allows us to match x1 : A ⊢S8 x4 : A with x1 : A ⊢S9 x4 : A and the identity sequent x : A ⊢ x : A. Finally, we require the copying and deleting maps to satisfy the Frobenius condition: 4 5 4 5 := 1 2 4 = 3 1 2 5 = 3 1 4 2 5 3 1 2 which requires the following soups to be equal to each other in the dagger lambda calculus: S10 = {G21 : x1∗ ⊗ x4 ⊗ x3 , G12 : (x3 ⊗ x2 )∗ ⊗ x5 } S11 = {G12 : (x1 ⊗ x2 )∗ ⊗ x3 , G21 : x3∗ ⊗ x4 ⊗ x5 } S12 = {G21 : x2∗ ⊗ x3 ⊗ x5 , G12 : (x1 ⊗ x3 )∗ ⊗ x4 } CHAPTER 10. CLASSICAL CONTROL IN THE †λ-CALCULUS 68 and allows us to relate the sequents for x1 : A, x2 : A ⊢S10 x4 ⊗ x5 : A ⊗ A, x1 : A, x2 : A ⊢S11 x4 ⊗ x5 : A ⊗ A and x1 : A, x2 : A ⊢S12 x4 ⊗ x5 : A ⊗ A matching the equality of arrows that is required in the categorical setting. All of these soup equality conditions can be rewritten as equalities between terms to make them more readable. The following table lists the term equalities corresponding to each of the conditions: Comonoidal associativity Comonoidal identity b̄(t̄G21 idA )G21 = b̄(t̄idA G21 )G21 b̄(t̄G01 idA )G21 = G11 = b̄(t̄idA G01 )G21 Cocommutativity Isometry Frobenius G21 = b̄σA,A G21 b̄G12 G21 = G11 b̄(t̄idA G12 )(t̄G21 idA ) = b̄G21 G12 = b̄(t̄G12 idA )(t̄idA G21 ) 10.2 Dualisers In this subsection, we will demonstrate how the dagger lambda calculus with classical structures can be used to present the notion of a dualiser [CPP08]; an explicit witness of the passage from one object to its dual or, in our case, from one type to its linear negation. While [CPP10] and [CD11] do not use this form of dualiser, we consider them very important from a programming language perspective as they allow us to differentiate inputs from outputs and make the flow of information explicit in the language. After defining the dualiser, the rest of the subsection will show how this notion makes the Currying rule admissible in our language. CHAPTER 10. CLASSICAL CONTROL IN THE †λ-CALCULUS 69 Definition 10.2.1 (Dualiser). For every type A, we define a constant dA : A ⊸ A∗ , the dualiser, as a shorthand for G02 : A∗ ⊗ A∗ . In other words, the dualiser will be dA := (G20 )∗ = G02 : A∗ ⊗ A∗ . The sequents [dA ] and [dA ]† that represent the η-expanded form of the dualiser and its dual are: x1 : A ⊢{dA :x1∗ ⊗x2∗ } x2∗ : A∗ 2 x2∗ : A∗ ⊢{dA∗ :x2 ⊗x1 } x1 : A 2 2 := 1 2 := 1 1 1 Theorem 10.2.1 (Unitarity of the dualiser). The sequent representing the η-expanded form of the dualiser is unitary. In other words, we can compose a dualiser sequent [dA ] with its dagger [dA ]† , via a Cut, and the result will be an identity sequent: x3 : A ⊢{dA :x3∗ ⊗x2∗ } x2∗ : A∗ †-flip x1 : A ⊢{dA :x1∗ ⊗x2∗ } x2∗ : A∗ x2∗ : A∗ ⊢{dA∗ :x2 ⊗x3 } x3 : A Cut x1 : A ⊢{dA :x1∗ ⊗x2∗ ,dA∗ :x2 ⊗x3 } x3 : A whose soup is equal to {G11 : x1∗ ⊗ x3 }. Proof. Consider the following soup reduction steps: {dA : x1∗ ⊗ x2∗ , dA∗ : x2 ⊗ x3 } → {G02 : x1∗ ⊗ x2∗ , G20 : x2 ⊗ x3 } → {G12 : (x1 ⊗ x2 )∗ ⊗ G10 , G21 : (G10 )∗ ⊗ x2 ⊗ x3 } → (Frobenius) {G12 : (x1 ⊗ G10 )∗ ⊗ x2 , G21 : x2∗ ⊗ G10 ⊗ x3 } → (Identity) {G11 : x1∗ ⊗ x2 , G11 : x2∗ ⊗ x3 } → {x1 : x2 , x2 : x3 } → {x1 : x3 } Having properly defined dualisers in the dagger lambda calculus, we proceed to show how classical structures and dualisers can be used to reconstruct the Currying rule. CHAPTER 10. CLASSICAL CONTROL IN THE †λ-CALCULUS 70 Theorem 10.2.2 (Admissibility of the Currying rule). The Currying rule is admissible in a dagger lambda calculus with classical structures and dualisers. Proof. We can construct a big sequent following the steps outlined in this proof tree: x2 : A ⊢{dA :x2∗ ⊗x1∗ } x1∗ : A∗ x2 : A ⊢{G02 :x2∗ ⊗x1∗ } x1∗ : A∗ ⊢{G20 :x2 ⊗x3 } x2 ⊗ x3 : A ⊗ A ⊢{G21 :(G10 )∗ ⊗x2 ⊗x3 } x2 ⊗ x3 : A ⊗ A x2 : A ⊢{G12 :x2∗ ⊗x1∗ ⊗G10 } x1∗ : A∗ x3 : A ⊢ x3 : A x2 : A, x3 : A ⊢{G12 :x2∗ ⊗x1∗ ⊗G10 } x1∗ ⊗ x3 : A∗ ⊗ A ⊢{G21 :(G10 )∗ ⊗x2 ⊗x3 ,G12 :(x1 ⊗x2 )∗ ⊗G10 } x1∗ ⊗ x3 : A∗ ⊗ A We can then use the following reduction steps on the resulting sequent’s soup: {G21 : (G10 )∗ ⊗ x2 ⊗ x3 , G12 : (x1 ⊗ x2 )∗ ⊗ G10 } → (F robenius) {G12 : (x1 ⊗ G10 )∗ ⊗ x2 , G21 : x2∗ ⊗ G10 ⊗ x3 } → (Identity) {G11 : x1∗ ⊗ x2 , G11 : x2∗ ⊗ x3 } → {x1 : x2 , x2 : x3 } → {x1 : x3 } This gives us ⊢ x∗ ⊗x : A∗ ⊗A, which is called a cup. Once we have this term, we can Cut it with any sequent of the form a : A ⊢S b : B to reconstruct the Currying rule: ⊢ x∗ ⊗ x : 10.3 x1∗ : A∗ ⊢ x1∗ : A∗ a : A ⊢S b : B N R x1∗ : A∗ , a : A ⊢S x1∗ ⊗ b : A∗ ⊗ B ⊗A ⊢S∪{x∗ ⊗x:x1∗ ⊗a} x1∗ ⊗ b : A∗ ⊗ B ⊢S a∗ ⊗ b : A∗ ⊗ B A∗ Monoidal product of terms and phase shifts This section shows how the monoidal operation defined by G12 can be used to fuse together the terms of the dagger lambda calculus, or lift them into phase shifts in a sequent. This usage of the monoidal operation, described in [CD08] and [CD11], makes our language more expressive by allowing us to introduce rotations on quantum states. CHAPTER 10. CLASSICAL CONTROL IN THE †λ-CALCULUS 71 Definition 10.3.1 (Monoidal product). We define the notation G[φ ⊙ ψ]10 : A to represent the product generated by the action of the monoidal operation G12 : A⊗A ⊸ A on two terms φ and ψ. More specifically, we set G[φ⊙ψ]10 := G12 (φ ⊗ ψ). := φ φ⊙ψ ψ Corollary 10.3.1 (Associativity and commutativity of ⊙). The ⊙ operator inherits associativity and commutativity from the monoidal associativity and commutativity conditions of G12 . This allows us to introduce the following notation for the fusion of multiple terms: K ψi := ψ1 ⊙ . . . ⊙ ψn Given a classical structure, we now define a way of performing rotations against the axis defined by that observable structure. These rotations, also known as phase shifts, are more easily visualised as rotations of a qubit’s vector in the Bloch sphere [JNN12]: Definition 10.3.2 (Phase shift). The phase shift generated by the action of G12 on a term ψ is represented by the η-expanded form of the term G[ψ]11 := λx.G12 (ψ ⊗ x): x1 : A ⊢{G[ψ]11 :x1∗ ⊗x2 } x2 : A → x : A ⊢ G[ψ ⊗ x]10 : A CHAPTER 10. CLASSICAL CONTROL IN THE †λ-CALCULUS ψ 72 := ψ The composition, under Cut, of the phase shifts generated by two terms φ and ψ is: x1 : A ⊢{G[φ]11:x1∗ ⊗x2 } x2 : A x2 : A ⊢{G[ψ]11 :x2∗ ⊗x3 } x3 : A x1 : A ⊢{G12 :(φ⊗x1 )∗ ⊗x2 ,G12 :(ψ⊗x2 )∗ ⊗x3 } x3 : A x1 : A ⊢{G12 :(φ⊗ψ)∗ ⊗x2 ,G12 :(x2 ⊗x1 )∗ ⊗x3 } x3 : A Cut Monoidal associativity The resulting sequent can be rewritten as x1 : A ⊢{G12 :(G[φ⊙ψ]10 ⊗x1 )∗ ⊗x3 } x3 : A Which is actually a lifting of the monoidal product of those terms x1 : A ⊢{G[G[φ⊙ψ]10]11 :x1∗ ⊗x3 } x3 : A Definition 10.3.3 (Lifting of the monoidal product of terms). We define a shorthand for the lifting of the monoidal product of terms: G[φ ⊙ ψ]11 := G[G[φ ⊙ ψ]10 ]11 Corollary 10.3.2 (Phase shift commutativity). Phase shifts generated by the action of G12 are commutative under Cut: G[φ ⊙ ψ]11 = G[ψ ⊙ φ]11 Proof. The composition of the phase shift corresponding to a term φ, with that of a term ψ, produces: x1 : A ⊢{G12 :(φ⊗ψ)∗ ⊗x2 ,G12 :(x2 ⊗x1 )∗ ⊗x3 } x3 : A Composing the phase shifts the other way around results in: x1 : A ⊢{G12 :(ψ⊗φ)∗ ⊗x2 ,G12 :(x2 ⊗x1 )∗ ⊗x3 } x3 : A The monoidal commutativity condition allows us to transform G12 : (φ⊗ψ)∗ ⊗ x2 into G12 : (ψ ⊗ φ)∗ ⊗ x2 , in our soup, which makes the two sequents equal. CHAPTER 10. CLASSICAL CONTROL IN THE †λ-CALCULUS 73 It therefore follows that the resulting sequents, G[φ ⊙ ψ]11 and G[ψ ⊙ φ]11 , are also equal. ψ φ = = φ 10.4 φ⊙ψ ψ Unbiased and classical constants This section establishes the properties of unbiasedness and classicality for constants, with respect to a given observable structure. The notion of unbiasedness differs slightly from the one presented in [CD08] and [CD11], as it uses the dualisers of [CPP08] to allow for non self-dual structures. The properties of unbiasedness and classicality will later be used in defining the interaction between complementary observables. Definition 10.4.1 (Unbiasedness (dagger lambda calculus)). We say that a constant k : A is unbiased with respect to an observable structure (A, G21 , G01 ) when there exists a scalar s : I such that we can match the sequents: ⊢{dA∗ :k⊗x1 ,G1 :(k⊗x1 )∗ ⊗x2 ,s:1} x2 : A and ⊢{G1 :x2 } x2 : A 2 0 by equating their soups:   dA∗ : k ⊗ x1 , G12 : (k ⊗ x1 )∗ ⊗ x2 , s : 1 = G10 : x2 2 2 1 s k k∗ = CHAPTER 10. CLASSICAL CONTROL IN THE †λ-CALCULUS 74 Intuitively, a constant is said to be classical, with respect to a given observable structure, when it is copied and deleted by that structure. More formally, this is defined as: Definition 10.4.2 (Classicality (dagger lambda calculus)). We say that a constant k : A is classical, with respect to an observable structure (A, G21 , G01 ), when we can match the following pairs of sequents: ⊢{G2 :k∗ ⊗x1 ⊗x2 } x1 ⊗ x2 : A ⊗ A with ⊢{k:x1,k:x2} x1 ⊗ x2 : A ⊗ A 1 and ⊢{G0 :k∗ } with ⊢ 1 by equating their respective soups:  2 G1 : k∗ ⊗ x1 ⊗ x2 = {k : x1 , k : x2 } and 1  2 G01 : k∗ = ∅ 1 2 = = k k k k 10.5 Complementary observables This section introduces two interacting observable structures to our lambda calculus, a Green one and a Red one, as the final step towards axiomatising basis structures in the dagger lambda calculus. The two observable structures are similar to the ones described in the later parts of [CD11], with the added support for non self-dual †-compact structures and the dualisers of [CPP08]. The interaction between the two observable structures is defined by requiring that they satisfy a Bi-algebra and a Hopf law condition. We then show that the interaction between Green and Red makes them complementary, as they possess certain properties with regards to classical and unbiased constants. Finally, we define a function that can be used to transform the Green sequents into Red ones and vice versa. CHAPTER 10. CLASSICAL CONTROL IN THE †λ-CALCULUS 75 Definition 10.5.1 (Complementary observable structures (dagger lambda calculus)). For every type A in the dagger lambda calculus, we define two observable structures: A Green structure (A, G21 , G01 ) and a Red structure (A, R12 , R10 ). Each of these observable structures comes with a dualiser; we ∗ will use dZ A : A ⊸ A to refer to the dualiser generated by the Green ∗ observable structure and dX A : A ⊸ A to refer to the one generated by Red. We define the interaction between these two observable structures by describing the conditions that we require them to satisfy in the dagger lambda calculus. The first such condition is the Bi-algebra condition: 7 8 7 3 5 6 4 = √ D 3 4 5 3 6 1 1 8 2 2 which requires the following two soups, S13 and S14 , to be equal in the lambda calculus:  2  G21 : x2∗ ⊗ x5 ⊗ x6 ,   G1 : x1∗ ⊗ x3 ⊗ x4 , R1 : (x3 ⊗ x5 )∗ ⊗ x7 , R21 : (x4 ⊗ x6 )∗ ⊗ x8 , S13 =  √2  D:1 S14 = o n R21 : (x1 ⊗ x2 )∗ ⊗ x3 , G21 : x3∗ ⊗ x7 ⊗ x8 This allows us to relate the sequents for x1 : A, x2 : A ⊢S13 x7 ⊗ x8 : A ⊗ A and x1 : A, x2 : A ⊢S14 x7 ⊗ x8 : A ⊗ A, matching the equality of arrows that is required in the categorical setting. The next condition that we require of the interaction between the Green and Red observable structures in the dagger lambda calculus is the Hopf law CHAPTER 10. CLASSICAL CONTROL IN THE †λ-CALCULUS 76 condition: 6 6 5 2 4 3 = 1 1 which requires the following two soups, S15 and S16 , to be equal in the lambda calculus:  2   G1 : x1∗ ⊗ x3 ⊗ x2 , R21 : (x5 ⊗ x2 )∗ ⊗ x6 ,  S15 = dZ : x ⊗ x4∗ , dX A ∗ : x4 ⊗ x5 ,  A 3∗  D:1 S16 = n G01 : x1∗ , R01 : x6 o This allows us to relate the sequents for x1 : A ⊢S15 x6 : A and x1 : A ⊢S16 x6 : A, or in other words x1 : A ⊢S15 x6 : A with G10 : A ⊢ R01 : A, matching the equality of arrows that is required in the categorical setting. We will now show an interesting property about the interaction that we have defined against the two observable structures. When a constant is classical against the Green structure, it is unbiased against the Red one. Conversely, when a constant is classical against the Red structure, it is unbiased against the Green one. Theorem 10.5.1 (Complementarity). Let k : A be a constant such that {G21 : k∗ ⊗ x1 ⊗ x2 } = {k : x1 , k : x2 } and {G01 : k∗ }. (1) The interaction 1 between the two observable structures causes {dX A∗ : k ⊗ x5 , R2 : (x5 ⊗ k)∗ ⊗ x6 , D : 1} to be equal to {R01 : x6 }. Similarly, let ℓ : A be a constant such that {R12 : ℓ∗ ⊗ x1 ⊗ x2 } = {ℓ : x1 , ℓ : x2 } and {R10 : ℓ∗ }. (2) The interaction 1 1 causes {dZ A∗ : ℓ ⊗ x5 , G2 : (x5 ⊗ ℓ)∗ ⊗ x6 , D : 1} to be equal to {G0 : x6 }. Proof. (1) We begin by trying to fuse together k∗ and k, in a manner that is similar to the definition of unbiasedness. We, therefore, start with the CHAPTER 10. CLASSICAL CONTROL IN THE †λ-CALCULUS 77 following set of connections in our soup: 1 {dX A∗ : k ⊗ x5 , R2 : (x5 ⊗ k)∗ ⊗ x6 , D : 1} By the definition of dualisers and since k is classical under the Green observable structure, we can use the explicit witness of the passage between k and k∗ to produce: X 1 {dZ A : k∗ ⊗ x4∗ , dA∗ : x4 ⊗ x5 , R2 : (x5 ⊗ k)∗ ⊗ x6 , D : 1} Since k is classical under the Green observable structure, we can replace the two k’s with a Green copy map, operating on a single k: 1 X {G21 : k∗ ⊗ x3 ⊗ x2 , dZ A : x3∗ ⊗ x4∗ , dA∗ : x4 ⊗ x5 , R2 : (x5 ⊗ x2 )∗ ⊗ x6 , D : 1} We can now use the Hopf law to separate some of the connections so that we get: {G01 : k∗ , R01 : x6 } Since k is classical under the Green observable structure, we can safely remove the first soup connection as it deletes a k, which simplifies our soup to what we have been trying to prove: {R01 : x6 } 6 6 6 6 5 5 5 = 2 4 2 = k 1 3 k = 4 4 k∗ 2 k 3 k 1 k (2) We begin by trying to fuse together ℓ∗ and ℓ, in a manner that is similar to the definition of unbiasedness. We, therefore, start with the following set of connections in our soup: 1 {dZ A∗ : ℓ ⊗ x5 , G2 : (x5 ⊗ ℓ)∗ ⊗ x6 , D : 1} CHAPTER 10. CLASSICAL CONTROL IN THE †λ-CALCULUS 78 By the definition of dualisers and since ℓ is classical under the Red observable structure, we can use the explicit witness of the passage between ℓ and ℓ∗ to produce: Z 1 {dX A : ℓ∗ ⊗ x4∗ , dA∗ : x4 ⊗ x5 , G2 : (x5 ⊗ ℓ)∗ ⊗ x6 , D : 1} Since ℓ is classical under the Red observable structure, we can replace the two ℓ’s with a Red copy map, operating on a single ℓ: 1 Z {R12 : ℓ∗ ⊗ x3 ⊗ x2 , dX A : x3∗ ⊗ x4∗ , dA∗ : x4 ⊗ x5 , G2 : (x5 ⊗ x2 )∗ ⊗ x6 , D : 1} We can now use the Hopf law to separate some of the connections so that we get: {R10 : ℓ∗ , G10 : x6 } Since ℓ is classical under the Red observable structure, we can safely remove the first soup connection as it deletes a ℓ, which simplifies our soup to what we have been trying to prove: {G10 : x6 } 6 6 6 6 5 5 5 = 2 4 2 k = 1 3 k 2 4 4 k∗ = k 3 k 1 k We can now define the notion of complementarity to describe the property of the interaction that was proved in the previous theorem. CHAPTER 10. CLASSICAL CONTROL IN THE †λ-CALCULUS 79 Definition 10.5.2 (Complementarity (dagger lambda calculus)). We say that two observable structures are complementary when their interaction causes the constants that are classical under one structure to be unbiased against the other. Having defined the interaction between complementary observables, we will now define a function that can be used to transform Green sequents into Red ones and vice versa. Definition 10.5.3 (Hadamard (dagger lambda calculus)). For every type A in the dagger lambda calculus, we define a constant H : A ⊸ A, called the Hadamard. The sequent that represents the η-expansion of the Hadamard, also known as the Hadamard gate, is: x1 : A ⊢{H:x1∗ ⊗x2 } x2 : A The Hadamard must satisfy certain conditions; namely, the Hadamard gate must be involutive under Cut, and the Hadamard must allow us to transform Green sequents into Red ones. The first condition, involution under Cut, means that we must be able to relate the following sequent: x1 : A ⊢{H:x1∗ ⊗x2 ,H:x2∗ ⊗x3 } x3 : A to the identity sequent x1 : A ⊢{x1 :x3 } x3 : A, by equating their soups: {H : x1∗ ⊗ x2 , H : x2∗ ⊗ x3 } = {x1 : x3 } 3 H 2 H = 1 Moreover, the Hadamard can be capable of transforming a Green copying sequent to a Red one. This is achieved by requiring that the following two soups, S17 and S18 , be equal in our lambda calculus:   H : x1∗ ⊗ x2 , G21 : x2∗ ⊗ x3 ⊗ x4 , S17 = H : x3∗ ⊗ x5 , H : x4∗ ⊗ x6 S18 = o n R12 : x1∗ ⊗ x5 ⊗ x6 CHAPTER 10. CLASSICAL CONTROL IN THE †λ-CALCULUS 5 80 6 H H 3 4 5 6 = 2 1 H 1 Finally, the Hadamard must be capable of transforming a Green deleting sequent to a Red one. This is achieved by requiring that the following two soups, S19 and S20 , be equal in our lambda calculus: o n S19 = H : x1∗ ⊗ x2 , G01 : x2∗ S20 = n R10 : x1∗ 2 H 1 = o 1 Part IV Applications 81 Chapter 11 Quantum Key Distribution Key distribution has traditionally been a very important area of cryptography. While the need for securely distributing a symmetric key has waned with the advent of public key cryptography, key distribution is still required in cases where processing speed is paramount as well as in cases where the level of secrecy does not allow us to rely on complexity assumptions. Because of the nature of the algorithms involved, encrypting messages with one-time pads is inherently faster than encrypting with a public key. Moreover, public key encryption relies on complexity assumptions that, though conjectured correct, have never been proven to be so. Elaborate schemes have been designed for publicising public keys, yet these are usually vulnerable to man-in-the-middle attacks or rely on a pre-existing secure communication channel. The big advantage of Quantum Key Distribution, as it was presented in [BB84] and [Eke91], is that it allows us to securely distribute a symmetric key in a tamper-proof manner. This chapter explains how the dagger lambda calculus can be used to perform Quantum Key Distribution, by expressing the formalism that was used in [CWW+ 11]. We will begin by presenting a high level description of the steps involved in the protocol: 1. Alice chooses two random strings of bits; a = a1 , a2 , . . . , a4n and b = b1 , b2 , . . . , b4n . 2. She then uses those strings to generate a string of qubits |ψi = |ψ1 i, |ψ2 i, . . . |ψ4n i by using a function m : A ⊗ B → B such that |ψi i = m ◦ (ai ⊗ bi ), where m acts as an identity on bi if ai is |0i and as a Hadamard on bi if ai is |1i. 3. Alice transfers the string of quantum bits ψ via a quantum channel to 82 CHAPTER 11. QUANTUM KEY DISTRIBUTION 83 Bob. 4. Bob chooses a random string of bits c = c1 , c2 , . . . , c4n and measures each qubit |ψi i in the Z-basis if ci = 0 and in the X-basis if ci = 1, yielding d = d1 , d2 , . . . , d4n . 5. Bob sends c to Alice via a classical channel. 6. Alice sends a ⊕ c = a1 ⊕ c1 , a2 ⊕ c2 , . . . , a4n ⊕ c4n to Bob via a classical channel. 7. Alice and Bob check for which i, ai ⊕ ci = 0. They maintain the corresponding bi and di respectively and they throw away the rest. 8. Alice and Bob should on average each be left with 2n bits, which should coincide if there has been no attack. 9. Alice and Bob agree on a subset of roughly half of the remaining bits and compare them to ensure that they haven’t been tampered with. 10. If they coincide, they should on average be left with n bits, with which they can engage in one-time-pad cryptographic communication. The first step in expressing Quantum Key Distribution, is defining the function m : A ⊗ B → B. When considering this from a linear algebraic perspective, m is defined by its action on the standard basis, whereby m(|0i⊗ idB ) = idB and m(|1i ⊗ idB ) = HB . Consequently, in order to represent the function in the dagger lambda calculus, we will use a term m : (A ⊗ B) ⊸ B such that the following equalities hold in the soup: {m : (R01 ⊗ b)∗ ⊗ b′ } = {idB : b∗ ⊗ b′ } {m : (R[π]10 ⊗ b)∗ ⊗ b′ } = {H : b∗ ⊗ b′ } Lemma 11.0.1 (Controlled unitary 1). If copies of the same classical input, in the dagger lambda calculus, are used as control terms for both m and (m∗ )∗ , then the resulting maps will cancel each other out of the soup when composed:    m : (a2 ⊗ b1 )∗ ⊗ b2 , (m∗ )∗ : (a4 ⊗ b1 ) ⊗ b3∗ , = G01 : a1∗ , b3 : b2 2 G1 : a1∗ ⊗ a2 ⊗ a3 , dA : a3∗ ⊗ a4∗ 84 CHAPTER 11. QUANTUM KEY DISTRIBUTION Proof. If a1 is R01 , then it is copied by G21 into a2 and a3 :  m : (R01 ⊗ b1 )∗ ⊗ b2 , (m∗ )∗ : (R01 ⊗ b1 ) ⊗ b3∗ which, by the definition of m, results in two identities:   idB : b1∗ ⊗ b2 , idB ∗ : b1 ⊗ b3∗ = b1 : b2 , b1∗ : b3∗ = {b3 : b2 } If, on the other hand, a1 is R[π]21 , then it will again be copied by G21 into a2 and a3 :  m : (R[π]10 ⊗ b1 )∗ ⊗ b2 , (m∗ )∗ : (R[π]10 ⊗ b1 ) ⊗ b3∗ which, by the definition of m, results in two applications of the Hadamard gate:   H : b1∗ ⊗ b2 , (H∗ )∗ : b1 ⊗ b3∗ = H : b1∗ ⊗ b2 , H : b3∗ ⊗ b1 = {b3 : b2 } Lemma 11.0.2 (Controlled unitary 2). If the classical values that are used in the dagger lambda calculus as control terms for m and (m∗ )∗ do not coincide, then the resulting maps will compose into a Hadamard transform in the soup:    m : (a1 ⊗ b1 )∗ ⊗ b2 , (m∗ )∗ : (a4 ⊗ b1 ) ⊗ b3∗ ,   dA : a3∗ ⊗ a4∗ , = G01 : a0∗ , H : b3∗ ⊗ b2  2  G1 : a0∗ ⊗ a1 ⊗ a2 , R[π]11 : a2∗ ⊗ a3 ∗ Proof. If a0 is R01 , then it will be copied by G21 into a1 and a2 :   m : (R01 ⊗ b1 )∗ ⊗ b2 , (m∗ )∗ : (a4 ⊗ b1 ) ⊗ b3∗ , dA : (R[π]10 )∗ ⊗ a4∗ By the definition of m, the soup reduces to:   idB : b1∗ ⊗ b2 , (H∗ )∗ : b1 ⊗ b3∗ = idB : b1∗ ⊗ b2 , H : b3∗ ⊗ b1 = {H : b3∗ ⊗ b2 } If, on the other hand, a0 is R[π]10 , then it will again be copied by G21 into a1 and a2 :   m : (R[π]10 ⊗ b1 )∗ ⊗ b2 , (m∗ )∗ : (a4 ⊗ b1 ) ⊗ b3∗ , dA : (R01 )∗ ⊗ a4∗ Which, by the definition of m, reduces to:  H : b1∗ ⊗ b2 , idB ∗ : b1 ⊗ b3∗ = {H : b3∗ ⊗ b2 } CHAPTER 11. QUANTUM KEY DISTRIBUTION 85 Switching back to category-theoretic notation, we will now present an adaptation of the diagram that was derived in [CWW+ 11], which will be used to represent the protocol’s procedures: b2 B b9 B b5 b8∗ B∗ B b4 m A B b6∗ m B A B∗ b7∗ m m B B∗ B∗ A∗ B ∗ A∗ b3 b1 a2 a3 a1 A a6∗ a5∗ A a7∗ A∗ a4 This can translated to the dagger lambda calculus, where the corresponding sequent would be represented by a1 : A, a4 : A ⊢S1 b5 ⊗ b9 : B ⊗ B and where the soup S1 would be of the form:   ∗ : b8 ⊗ b9 , d B       1 : (b ⊗ b ) ⊗ b , 1 : (b ⊗ b ) ⊗ b ,   G G   2 4 ∗ 5 6 7 8∗ 2 2     ∗ ∗ (m∗ ) : (b3 ⊗ a6 ) ⊗ b6∗ , (m∗ ) : (b1 ⊗ a7 ) ⊗ b7∗ , S1 = m : (a2 ⊗ b1 )∗ ⊗ b2 , m : (a3 ⊗ b3 )∗ ⊗ b4 ,       2 :a ⊗a ⊗a , 2 :a ⊗a ⊗a ,     G G 5 6∗ 7∗ 1∗ 2 3 1 1     dA : a4∗ ⊗ a5∗ In both the categorical diagram and the sequent in the dagger lambda calculus, Alice’s control input is denoted by a1 and Bob’s control input is denoted by a4 . We will use the soup derivations of the dagger lambda calculus to verify the protocol’s behaviour, in a way that resembles the CHAPTER 11. QUANTUM KEY DISTRIBUTION 86 verification what was performed in the categorical setting by [CWW+ 11]. In order to verify the protocol, we will first examine the case where a1 and a4 coincide by “hardwiring” them to two different copies of the same original state. This will be done by performing a Cut on a0 : A ⊢{G21 :a0∗ ⊗a1 ⊗a4 } a1 ⊗ a4 : A ⊗ A with a1 : A, a4 : A ⊢S1 b5 ⊗ b9 : B ⊗ B. The resulting sequent can be written as a0 : A ⊢S2 b5 ⊗ b9 : B ⊗ B, where the soup S2 is:   dB ∗ : b8 ⊗ b9 ,       1 : (b ⊗ b ) ⊗ b , 1 : (b ⊗ b ) ⊗ b ,   G G   6 7 8∗ 2 4 ∗ 5 2 2     ∗ ∗    (m∗ ) : (a6 ⊗ b3 ) ⊗ b6∗ , (m∗ ) : (a7 ⊗ b1 ) ⊗ b7∗ ,  m : (a2 ⊗ b1 )∗ ⊗ b2 , m : (a3 ⊗ b3 )∗ ⊗ b4 , S2 =     dA : a5∗ ⊗ a7∗ ,           d : a ⊗ a , A 4∗ 6∗     4 G1 : a0∗ ⊗ a2 ⊗ a3 ⊗ a4 ⊗ a5 At this point, we can simplify the soup by using Lemma 12.0.2 twice:   dB ∗ : b8 ⊗ b9 ,      1  G2 : (b2 ⊗ b4 )∗ ⊗ b5 , G12 : (b6 ⊗ b7 ) ⊗ b8∗ , b :b , b6 : b 4 ,      7 2  G01 : a0∗ We can use soup reduction to rewrite this as:   dB ∗ : b8 ⊗ b9 ,   1 1 G : (b2 ⊗ b4 )∗ ⊗ b5 , G2 : (b4 ⊗ b2 ) ⊗ b8∗ ,   2 G01 : a0∗ Which is essentially:  G01 : a0∗ , G20 : b5 ⊗ b9 The resulting sequent reduces to: a0 : A ⊢{G01 :a0∗ } b ⊗ b : B ⊗ B Similarly, to examine the case where the control inputs do not coincide, we can perform a Cut on a0 : A ⊢{G21 :a0∗ ⊗a1 ⊗a,R11 [π]:a∗ ⊗a4 } a1 ⊗ a4 : A ⊗ A with a1 : A, a4 : A ⊢S b5 ⊗ b9 : B ⊗ B. The resulting sequent can be written 87 CHAPTER 11. QUANTUM KEY DISTRIBUTION as a0 : A ⊢S3 b5 ⊗ b9 : B ⊗ B, where the      G1 : (b2 ⊗ b4 )∗ ⊗ b5 ,    2 ∗   (m∗ ) : (a6 ⊗ b3 ) ⊗ b6∗ , S3 = m : (a2 ⊗ b1 )∗ ⊗ b2 ,          4 G1 : a0∗ ⊗ a2 ⊗ a3 soup S3 is: dB ∗ : b8 ⊗ b9 , G12 : (b6 ⊗ b7 ) ⊗ b8∗ , (m∗ )∗ : (a7 ⊗ b1 ) ⊗ b7∗ , m : (a3 ⊗ b3 )∗ ⊗ b4 , dA : a5∗ ⊗ a7∗ , dA : a4∗ ⊗ a6∗ , ⊗ a4 ⊗ a5 The resulting sequent reduces to:                    a0 : A ⊢{G01 :a0∗ } G10 ⊗ G10 : B ⊗ B This completes our functional verification of the protocol from within the sequents of our dagger lambda calculus. We have proved that in both the case when the control inputs over lap and when they don’t, the protocol’s behaviour is as expected. Chapter 12 Quantum Fourier Transform The quantum Fourier transform is a calculation that lies at the heart of many quantum algorithms, including Shor’s factoring algorithm [Sho97]. Functionally, when considering its action on basis states,the transformation is exactly the same transformation as the discrete Fourier transform. Because the transform is a linear operator, its action on arbitrary quantum states is completely determined by its discreet counterpart. In this chapter we will explain how the QFT is constructed, present its corresponding diagrammatic representation in the picture calculus, and demonstrate that the dagger lambda calculus is expressive enough by using it to represent the transform. We will then proceed by “running” a calculation through, while observing how connections propagate in the soup. In order to keep our exposition simple, we will limit our description to the behaviour of the two-qubit QFT, though it should not be hard to generalise our QFT to a larger numbers of qubits. As we can see from [NC00] and [CD11], the only gates that are required to construct the quantum Fourier transform are the Hadamard gate and a gate called ∧Zα that performs a controlled Z rotation on an arbitrary angle α. In Hilbert spaces, the two-qubit QFT can be expressed as (H ⊗ idA ) ◦ ∧Zπ/2 ◦(idA ⊗H). We can verify its behaviour on a given input (for example |10i) by applying it to that state. This would give us: (H ⊗ idA ) ◦ ∧Zπ/2 ◦ (|1i ⊗ |0i) = (H ⊗ idA ) ◦ (|1i ⊗ |+π/2 i) = |−i ⊗ |+π/2 i The dagger lambda calculus is best used alongside the diagrammatic calculus, so that one can complement the other. We will proceed by explaining how the quantum Fourier transform can be represented in the calculus for 88 89 CHAPTER 12. QUANTUM FOURIER TRANSFORM complementary observables, as well as how these diagrams translate to sequents and soup connections in the dagger lambda calculus. The two notations will be presented side by side: a set of soup connections on the left and a picture on the right. For a more complete exposition of the diagrammatic representation, the reader is referred to [CD11]. The first step towards constructing a QFT in the dagger lambda calculus, consists of representing the controlled phase gate ∧Zα . The sequent for this gate can be written as a1 : A, a2 : A ⊢S a5 ⊗ a9 : A ⊗ A where the soup S is:   G[α/2]11 : a8∗ ⊗ a9 ,       R21 : (a6 ⊗ a7 )∗ ⊗ a8 , S= G2 : (a1 ⊗ a3 )∗ ⊗ a5 ⊗ a6 , G[−α/2]11 : a4∗ ⊗ a7 ,       2 R12 : a2∗ ⊗ a3 ⊗ a4 We will use Sα in the dagger lambda calculus to denote the soup S of the controlled phase gate, along with its associated angle of rotation α. In the context of Hilbert spaces, we presented a way of generating the two-qubit quantum Fourier transform by using ∧Zπ/2 , the controlled Z rotation with angle π/2, composed with some Hadamard transforms. Therefore, in the dagger lambda calculus, it can be written as: a1 : A, a0 : A ⊢Sπ/2 ∪{H:a0∗ ⊗a2 ,H:a5∗ ⊗a10 } a10 ⊗ a9 : A ⊗ A Similarly to the diagrammatic “execution” that was presented in [CD11], we can now “run” the two-qubit quantum Fourier transform in the dagger lambda calculus by plugging in an input state in place of a1 and a0 in our sequent. We will be using |10i = R[π]10 ⊗ R01 , by plugging in R[π]10 for a1 and R01 for a0 . The soup thus becomes: 10 9 π/4 H 8  H : a5∗ ⊗ a10 ,      G22 : (R[π]10 ⊗ a3 )∗ ⊗ a5 ⊗ a6 ,      G[π/4]11 : a8∗ ⊗ a9 , R21 : (a6 ⊗ a7 )∗ ⊗ a8 , G[−π/4]11 : a4∗ ⊗ a7 , R12 : a2∗ ⊗ a3 ⊗ a4 , H : (R01 )∗ ⊗ a2 5       6 7 -π/4      4 3 2 H π 90 CHAPTER 12. QUANTUM FOURIER TRANSFORM We can then use G22 to copy R[π]10 across three terms, a3 , a5 and a6 , giving us: 9 10 π/4 H 8  H : (R[π]10 )∗ ⊗ a10 , G[π/4]11 : a8∗ ⊗ a9 ,     R21 : (R[π]10 ⊗ a7 )∗ ⊗ a8 ,  G[−π/4]11 : a4∗ ⊗ a7 ,   R12 : a2∗ ⊗ R[π]10 ⊗ a4 ,    H : (R01 )∗ ⊗ a2 π       7 π -π/4 π      4 2 H The red phase terms, R[π]11 , can be written in a simpler way: 10 H 9 π/4 8  H : (R[π]10 )∗ ⊗ a10 , G[π/4]11 : a8∗ ⊗ a9 ,     R[π]11 : a7∗ ⊗ a8 ,  G[−π/4]11 : a4∗ ⊗ a7 ,    R[π]11 : a2∗ ⊗ a4 ,   H : (R01 )∗ ⊗ a2            π π 7 -π/4 4 π 2 H 91 CHAPTER 12. QUANTUM FOURIER TRANSFORM We can then commute red and green phases as follows: 10 9 π/4 H 8  H : (R[π]10 )∗ ⊗ a10 , G[π/4]11 : a8∗ ⊗ a9 ,     R[π]11 : a7∗ ⊗ a8 ,  R[π]11 : a4∗ ⊗ a7 ,   G[π/4]11 : a2∗ ⊗ a4 ,    H : (R01 )∗ ⊗ a2 π       π 7 π      4 π/4 2 H The red phases cancel each other out, since two consecutive π rotations bring us back where we started: 10 9 π/4 H    H : (R[π]10 )∗ ⊗ a10 , G[π/4]11 : a8∗ ⊗ a9 ,  G[π/4]11 : a2∗ ⊗ a8 ,   H : (R01 )∗ ⊗ a2 8 π π/4 2 H We can now use the Hadamards to transform the remaining red terms into green ones: 10    G[π]10 : a10 , G[π/4]11 : a8∗ ⊗ a9 ,  G[π/4]11 : a2∗ ⊗ a8 ,   G10 : a2 π 9 π/4 8 π/4 2 CHAPTER 12. QUANTUM FOURIER TRANSFORM 92 Which in the end reduces to the two-qubit quantum Fourier transform’s known output for our choice of input: n G[π]10 : a10 , G[π/2]10 : a9 o 10 π 9 π/2 The quantum Fourier Transform’s behaviour on other possible inputs can be verified by following a similar process for the rest of the basis states. The fact that the dagger lambda calculus can represent the quantum Fourier transform and, by extension, Shor’s factoring algorithm speaks volumes about the language’s expressive power. Chapter 13 Teleportation Protocol The teleportation protocol, one of the most famous quantum protocols, uses entanglement to teleport an arbitrary quantum state. In the most common presentation of the protocol, Alice is in possession of a qubit with a quantum state that she wants to teleport to Bob. Alice and Bob share a classical twobit communication channel but, since the qubit has not been measured, its state carries much more information than two classical bits. In order for Alice to teleport the data, she makes use of an entangled pair of qubits that she shares with Bob. Alice performs a Bell basis measurement on her qubit and her part of the entangled pair of qubits; she then uses the classical communication channel to communicate the result of that measurement to Bob, who uses it to perform a unitary correction on his qubit. Remark. Similarly to the remark of [CD11] about their ZX-calculus, the diagrammatic forefather of the dagger lambda calculus, our language does not represent the non-deterministic aspect of measurements. Every sequent in this lambda calculus, like every diagram in the ZX-calculus, corresponds to one run of the experiment, as far as measurements are concerned. For this reason, measurements are replaced by the projections into which they will resolve in this run of the experiment. To avoid having to consider sequents for every possible outcome of an experiment, the dagger lambda calculus could be extended to support the conditional diagrams of [DP10] and [CD11]. This would be a significant departure from the simplified logic of the lambda calculus and thereby one that merits to be studied in its own right. Consequently, we include this later on, in the Further work section of this dissertation. Back to our description of the teleportation protocol, Alice’s Bell basis measurement will resolve to a projection on one of the Bell basis states: 93 94 CHAPTER 13. TELEPORTATION PROTOCOL hΨ+ |, hΨ− |, hΦ+ | or hΦ− |. We therefore use h+α | and h+β | to represent the outcome of the measurement, where the four possible pairs of α, β ∈ {0, π} range over all the outcomes of a measurement against the Bell basis. We will now present a diagram for part of the teleportation protocol, like the one used by [CD11], but adapted to support dualisers. Note that this diagram is from before the unitary corrections are performed. The full diagram for teleportation, with all the corrections, will be presented shortly afterwards: α β 8 H 7 5 6 Alice 2 1 3 Bob 4 This diagram can easily be represented as a sequent in the lambda calculus. The sequent will be a1 : A ⊢S a3 : A, where the soup S is:   0 :a , 0 :x G[β] G[α]   8∗ 4∗ 1 1       H : a7∗ ⊗ a8 ,   1 R2 : (a5 ⊗ a6 )∗ ⊗ a7 ,      G21 : x1∗ ⊗ x4 ⊗ x5 dA∗ : a2 ⊗ a6 ,      x∗ ⊗ x : a2∗ ⊗ a3 Note that, in this sequent, the terms a2∗ and a3 represent the entangled pair of qubits that are shared between Alice and Bob. Alice possesses a2∗ and Bob possesses a3 . Bob receives the results of Alice’s projection, α and β, from the classical communication channel. We will now present the full diagram, which includes the unitary corrections that will be performed by Bob; the classical communication channel is not represented in the diagram with any wires but is instead reflected by the fact that Alice’s α and β measurements are matched by corresponding corrections by Bob. Having received Alice’s measurement values classically, Bob can perform a red phase rotation by an angle of β, followed by a green phase rotation by an angle 95 CHAPTER 13. TELEPORTATION PROTOCOL of α, on his term a3 . This completes Bob’s unitary correction, who should now possess Alice’s original input state: α β 10 8 α H 7 9 β 5 6 Alice 2 1 3 Bob 4 Going back to the lambda calculus, the sequent for the full diagram is expressed by performing a Cut of a1 : A ⊢S a3 : A with a3 : A ⊢{R[β]11 :a3∗ ⊗a9 ,G[α]11 :a9∗ ⊗a10 } a10 : A, which gives us: a1 : A ⊢S∪{R[β]11 :a3∗ ⊗a9 ,G[α]11:a9∗ ⊗a10 } a10 : A We will now start performing operations in our soup, to simplify the existing connections, and prove that the teleportation sequent does actually produce Alice’s original input state when Bob runs his corrections at the other end. We will use the soup rules for lifting terms, to lift G[α]01 and G[β]01 into phase shifts. We will also use the rule for the Hadamard gate, to transform the resulting G[β]11 to a R[β]11 . The resulting soup will be of the form:   1 :a ⊗a , G[α]   9∗ 10 1     R[β]11 : a3∗ ⊗ a9 , R[β]11 : a5∗ ⊗ a3 ,       1 G[α]1 : a1∗ ⊗ a5 But recall that α, β ∈ {0, π}, so 2α = 2β = 0. The consecutive red β rotations hence cancel out and so do the remaining green α rotations after them. This leaves us with the following soup, thus proving that Alice’s original input state was teleported to Bob:  a1 : a10 Part V Conclusion 96 Chapter 14 Concluding remarks We have now completed our study of the dagger lambda calculus; a higherorder language that was initially defined with dagger compact categories in mind, but which was later imbued with classical control by enriching it with complementary control structures. The dagger lambda calculus has proven to be a powerful and expressive language, capable of running quantum protocols and programs. Our main motivation behind this language has been to bridge the gap between two different approaches towards quantum computation, by reconciling the diagrammatic formalism with the type theoretic research of higher-order quantum programming languages. Our study of the language’s semantics has revealed a number of insights about the building blocks of quantum computation, such as the symmetry of substitution, or the admissibility of some of the rules, giving us the ability to decompose classical notions of computation into finer primitives. 14.1 Future work As per our remark in chapter 13, the dagger lambda calculus in its current form does not have a way of representing the non-deterministic aspect of measurements. Every sequent in the lambda calculus corresponds to one run of the experiment, where measurements are, as a result, replaced by the projections into which they will resolve. A way of binding measurement results, using conditional diagrams, was recently proposed by [DP10] as a modification to the diagrammatic calculus. One area of future work is the modification of the dagger lambda calculus, so that it supports conditional sequents. This would require a significant departure from the language’s original structure, but it would be interesting to examine whether these 97 CHAPTER 14. CONCLUDING REMARKS 98 new connections between measurement results could be incorporated into a richer type of soup. Another area for potential future work is that of Measurement Based Quantum Computation [RB01, RB02, RBB03]. Since the dagger lambda calculus supports both quantum and classical data, it would be ideally suited for such a computational paradigm. The lambda calculus could be extended to support a language like the Measurement Calculus of [DKP07]. It would then be interesting to investigate whether the dagger lambda calculus can exhibit an equational correspondence to the Measurement Calculus, as well as to analyse the language’s properties in a way that is similar to the analysis we performed in section 9.2. Once we have defined a programming language that fully supports Measurement Based Quantum Computation and the non-deterministic behaviour of measurements, we will be able to use it to represent all of the elements of quantum algorithms. There are not many efficient quantum algorithms out there. By representing the ones that are available, however, we will be able to spot their common elements and distil the structural elements that are responsible for the quantum mechanical speedup. 14.2 Acknowledgements I would like to thank my supervisors, Samson Abramsky and Bob Coecke, for their guidance and support throughout the course of my DPhil. Samson is an inexhaustible source of information in the areas of type theory, logic and category theory. In addition to being a supporting, fatherly figure for his students, he could always see many steps ahead in my research and steer me clear of problems. Moreover, his advice has been instrumental in helping me shape the dagger lambda calculus, which serves as the cornerstone of this dissertation. Bob introduced me to categorical quantum computing and his guidance in the early stages of my DPhil inspired my interest in diagrammatic calculi and measurement based quantum computation. I also want to thank my examiners, Prakash Panangaden and Jonathan Barrett, for their very detailed and helpful comments and the corrections they suggested. I am also thankful towards the anonymous reviewers at a premature conference submission of mine (if you are reading this, you know who you are); their feedback has proved invaluable in shaping the exposition of some of my chapters. I particularly want to thank my friend and colleague Nikos Tzevelekos for teaching me category theory and for the many in depth discussions and CHAPTER 14. CONCLUDING REMARKS 99 insights he offered during the development of my calculus. I also want to thank Rick Blute, Andrzej Murawski and Andreas Doering for their helpful feedback on early drafts of my research, and Peter Selinger, Benoı̂t Valiron, John Baez and Mike Stay for our discussions on quantum programming languages. Thanks are also due to Ross Duncan, Mehrnoosh Sadrzadeh, Simon Perdrix, Éric Paquette, Chris Heunen, Jaime Vicary, Aleks Kissinger, Bill Edwards, Alejandro Dı́az-Caro and Duško Pavlović for answering questions, sharing their ideas and offering advice on topics ranging from Frobenius algebras and logic, to free categories and quantum programming. I am also thankful to Bob Harper, Benjamin Piece and Frank Pfenning for their lectures at the 2010 Oregon Programming Languages Summer School and for the engaging discussions we had in between sessions. I am particularly grateful to Joel Spencer, for transmitting to me his love of mathematical logic and theoretical computer science during my undergraduate years. I am also grateful to Erasmia Kiriazi and Elias Kamouzis for lighting up in me a passion for mathematics. I am grateful to the US Office of Naval Research, FQXi, and the Levelhulme Foundation for supporting my studies financially; this research would not have been possible without them. I also want to thank my college, Wolfson College, and the Department of Computer Science for supporting my trip to attend the 2010 Oregon Programming Languages Summer School. An acknowledgements section, like this one, would not be complete without mentioning those whose love, friendship, and support have accompanied me throughout my DPhil. A doctoral degree is as much a struggle with one’s inner self as it is a struggle with uncovering the secrets of science and, in that sense, personal relationships play a pivotal role in helping the human achieve his true potential. I am thankful to my fiancée, Chara Tzanetaki, for her unwavering love and support throughout the best and the worst times in my doctoral research. Chara has always been there to push me forward, lift my spirits in times I could not do so myself, and even proofread drafts of my research. I am also thankful to my parents, my brother, my friends from Oxford: Yiannis Hadjimichael, Konstantinos Stamatis, Thomas Papadopoulos, Illektra Apostolidou, Mary Kopsacheili and Kyriaki Michailidou; as well as my friends from Greece: Tasos Katechis, Nicholas Tsiroyiannis, Konstantinos Nikolaras, George Pallis. Finally, a big thanks to my friends in Cambridge: Napoleon Katsos, Nausica Smith, and little George Jason Katsos who are now a lot more than just friends and a lot more than just family. Bibliography [ABP99] Samson Abramsky, Rick Blute, and Prakash Panangaden. Nuclear and trace ideals in tensored ∗-categories. Journal of Pure and Applied Algebra, 143:3–47, 1999. [Abr93] Samson Abramsky. Computational interpretations of linear logic. Theoretical Computer Science, 111:3–57, 1993. (DOI:10.1.1.16.2984). [Abr05] Samson Abramsky. Abstract scalars, loops, and free traced and strongly compact closed categories. In In Proceedings of the First Conference on Algebra and Coalgebra in Computer Science (CALCO 2005), volume 3629, pages 1–31. Springer Lecture Notes in Computer Science, 2005. (arXiv:0910.2931v1 [quant-ph]). [Abr10] Samson Abramsky. No-cloning in categorical quantum mechanics. In S. Gay and I. Mackie, editors, Semantic Techniques in Quantum Computation. Cambridge University Press, 2010. (arXiv:0910.2401v2 [quant-ph]). [AC04] Samson Abramsky and Bob Coecke. A categorical semantics of quantum protocols. In Proceedings of the 19th IEEE conference on Logic in Computer Science (LiCS’04). IEEE Computer Science Press, 2004. (arXiv:quant-ph/0402130v5). [AD06] Samson Abramsky and Ross Duncan. A categorical quantum logic. Mathematical Structures in Computer Science, 16:469– 489, 2006. (arXiv:quant-ph/0512114v1). [AT10] Samson Abramsky and Nikos Tzevelekos. Introduction to categories and categorical logic. In Bob Coecke, editor, New Structures for Physics. Springer Lecture Notes in Physics, 2010. (arXiv:1102.1313v1 [math.CT]). 100 BIBLIOGRAPHY 101 [BB84] Charles H. Bennett and Gilles Brassard. Quantum cryptography: Public key distribution and coin tossing. In Proceedings of the IEEE International Conference on Computers, Systems, and Signal Processing, pages 175–179. IEEE Press, 1984. [BS10] John Baez and Michael Stay. Physics, topology, logic and computation: A rosetta stone. In Bob Coecke, editor, New Structures for Physics. Springer Lecture Notes in Physics, 2010. (arXiv:0903.0340v3 [quant-ph]). [CD08] Bob Coecke and Ross Duncan. Interacting quantum observables. In Proceedings of the 35th International Colloquium on Automata, Languages and Programming, pages 298–310. Lecture Notes in Computer Science 5126, Springer-Verlag, 2008. (arXiv:0906.4725v1 [quant-ph]). [CD11] Bob Coecke and Ross Duncan. Interacting quantum observables: Categorical algebra and diagrammatics. New Journal of Physics, 13:043016, 2011. (arXiv:0906.4725v3 [quant-ph]). [Che07] Eugenia Cheng. Adjunctions 1. TheCatsters Channel, YouTube, September 13 2007. (http://www.youtube.com/watch?v=loOJxIOmShE). [Coe06] Bob Coecke. Introducing categories to the practicing physicist. Advanced Studies in Mathematics and Logic, Polimetrica Publishing, 30:45–74, 2006. (arXiv:0808.1032v1 [quant-ph]). [CP06] Bob Coecke and Éric Oliver Paquette. POVMs and Naimark’s theorem without sums. Electronic Notes in Theoretical Computer Science, 2006. (arXiv:quant-ph/0608072). [CP07] Bob Coecke and Duško Pavlović. Quantum measurements without sums. In G. Chen, L. Kauffman, and S. Lamonaco, editors, Mathematics of Quantum Computing and Technology, pages 567–604. Taylor and Francis, 2007. (arXiv:quant-ph/0608035). [CPP08] Bob Coecke, Éric Oliver Paquette, and Simon Perdrix. Bases in diagrammatic quantum protocols. Electronic Notes in Theoretical Computer Science, 218:131–152, 2008. (arXiv:0808.1029v1 [quant-ph]). BIBLIOGRAPHY 102 [CPP10] Bob Coecke, Éric Oliver Paquette, and Duško Pavlović. Classical and quantum structuralism. In S. Gay and I. Mackie, editors, Semantic Techniques in Quantum Computation. Cambridge University Press, 2010. (arXiv:0904.1997v2 [quant-ph]). [CPV08] Bob Coecke, Duško Pavlović, and Jamie Vicary. A new description of orthogonal bases. Mathematical Structures in Computer Science, page 13, 2008. (arXiv:0810.0812v1 [quant-ph]). [CWW+ 11] Bob Coecke, Quanlong Wang, Baoshan Wang, Yongjun Wang, and Qiye Zhang. Graphical calculus for quantum key distribution (extended abstract). Electronic Notes in Theoretical Computer Science, 270(2):231–249, 2011. ¡ce:title¿Proceedings of the 6th International Workshop on Quantum Physics and Logic (QPL 2009)¡/ce:title¿. [DKP07] Vincent Danos, Elham Kashefi, and Prakash Panangaden. The measurement calculus. Journal of the ACM (JACM), 54(2), 2007. (arXiv:0704.1263v1 [quant-ph]). [DP10] Ross Duncan and Simon Perdrix. Rewriting measurementbased quantum computations with generalised flow. In Proceedings of the 37th international colloquium conference on Automata, languages and programming: Part II, ICALP’10, pages 285–296, Berlin, Heidelberg, 2010. Springer-Verlag. [DR89] Sergio Doplicher and John E. Roberts. A new duality theory for compact groups. Inventiones mathematicae, 98(1):157–218, 1989. [Eke91] Arthur K. Ekert. Quantum cryptography based on bells theorem. Physical review letters, 67(6):661–663, 1991. [Gir87] Jean-Yves Girard. Linear logic. Theoretical Computer Science, 50(1):1–102, 1987. [JNN12] J. R. Johansson, P. D. Nation, and Franco Nori. Qutip: An open-source python framework for the dynamics of open quantum systems. Computer Physics Communications, 183(8):1760 – 1772, 2012. (arXiv:1110.0573 [quant-ph]). [JS91] André Joyal and Ross Street. An introduction to tannaka duality and quantum groups. In Aurelio Carboni, Maria Pedicchio, and Guiseppe Rosolini, editors, Category Theory, volume BIBLIOGRAPHY 103 1488 of Lecture Notes in Mathematics, pages 411–492. Springer Berlin / Heidelberg, 1991. [Kis11] Aleks Kissinger. Pictures of processes: Automated graph rewriting for monoidal categories and applications to quantum computing. PhD thesis, Department of Computer Science, University of Oxford, 2011. (arXiv:1203.0202 [math.CT]). [KL01] Thomas Kerler and Volodymyr Vasyliovych Lyubashenko. Non-Semisimple Topological Quantum Field Theories for 3Manifolds with Corners. Springer, 2001. [Klo92] Jan Willem Klop. Term rewriting systems. In S. Abramsky, D.M. Gabbay, and T.S.E. Maibaum, editors, Handbook of Logic in Computer Science, volume 2, pages 1–116. Oxford University Press, 1992. (DOI:10.1.1.35.425). [Koc03] Joachim Kock. Frobenius Algebras and 2-D Topological Quantum Field Theories, volume 59 of London Mathematical Society Student Texts. Cambridge University Press, 2003. [Mac98] Saunders Mac Lane. Categories for the Working Mathematician. Springer, second edition, 1998. [Mel09] Paul-André Melliès. Categorical semantics of linear logic. Panoramas et synthèses - Société mathématique de France, (27):1–196, 2009. (DOI:10.1.1.62.5117). [Mer07] N. David Mermin. Quantum Computer Science: An Introduction. Cambridge University Press, first edition, 2007. [NC00] Michael A. Nielsen and Isaac L. Chuang. Quantum Computation and Quantum Information. Cambridge University Press, 2000. [PB00] Arun Kumar Pati and Samuel L. Braunstein. Impossibility of deleting an unknown quantum state. Nature, 404:164–165, 2000. (arXiv:quant-ph/9911090v2). [RB01] Robert Raussendorf and Hans J. Briegel. A one-way quantum computer. Physical Review Letters, 86(22):5188, 2001. DOI:10.1103/PhysRevLett.86.5188. BIBLIOGRAPHY 104 [RB02] Robert Raussendorf and Hans J. Briegel. Computational model underlying the one-way quantum computer. Quantum Information and Computation, 2, 2002. (arXiv:quant-ph/0108067v2). [RBB03] Robert Raussendorf, Dan E. Browne, and Hans J. Briegel. Measurement-based quantum computation on cluster states. Physical Review A, 68, 2003. (arXiv:quant-ph/0301052v2, DOI:10.1103/PhysRevA.68.022312). [Sel04a] Peter Selinger. A brief survey of quantum programming languages. In Proceedings of the 7th International Symposium on Functional and Logic Programming, volume 2998, pages 1–6, Nara, Japan, 2004. Springer Lecture Notes in Computer Science. (DOI:10.1.1.94.463). [Sel04b] Peter Selinger. Towards a quantum programming language. Mathematical Structures in Computer Science, 14(4):527–586, 2004. (DOI:10.1.1.144.6380). [Sel07] Peter Selinger. Dagger compact closed categories and completely positive maps. In Proceedings of the 3rd International Workshop on Quantum Programming Languages (QPL 2005), volume 170, pages 139–163, Chicago, 2007. Electronic Notes in Theoretical Computer Science. (DOI:10.1.1.134.2476). [Sel10] Peter Selinger. A survey of graphical languages for monoidal categories. In Bob Coecke, editor, New Structures for Physics. Springer Lecture Notes in Physics, 2010. (arXiv:0908.3347v1 [math.CT]). [Sho97] Peter W. Shor. Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. In SIAM Journal on Scientific and Statistical Computing, volume 26, page 14841509, 1997. arXiv:quant-ph/9508027v2. [Str04] Ross Street. Frobenius monads and pseudomonoids. Journal of Mathematical Physics, 45(10.III):3930–3948, 2004. (DOI:10.1063/1.1788852). [SV06] Peter Selinger and Benoı̂t Valiron. A lambda calculus for quantum computation with classical control. Mathematical Structures in Computer Science, 16(3):527–552, 2006. (arXiv:cs/0404056v2 [cs.LO]). BIBLIOGRAPHY 105 [SV08] Peter Selinger and Benoı̂t Valiron. A linear-non-linear model for a computational call-by-value lambda calculus (extended abstract). In Proceedings of the Eleventh International Conference on Foundations of Software Science and Computation Structures (FOSSACS 2008), volume 4962, pages 81–96, Budapest, 2008. Springer Lecture Notes in Computer Science. (arXiv:0801.0813v1 [cs.LO]). [SV10] Peter Selinger and Benoı̂t Valiron. Quantum lambda calculus. In S. Gay and I. Mackie, editors, Semantic Techniques in Quantum Computation. Cambridge University Press, 2010. (http://www.mscs.dal.ca/~selinger/papers.html#qlambdabook). [vT04] André van Tonder. A lambda calculus for quantum computation. SIAM Journal on Computing, 33(5):1109–1135, 2004. (arXiv:quant-ph/0307150v5). [vTD03] André van Tonder and Miquel Dorca. Quantum computation, categorical semantics and linear logic. Archive, 2003. (arXiv:quant-ph/0312174v4). [WZ82] William K. Wootters and Wojciech H. Zurek. A single quantum cannot be cloned. Nature, 299:802–803, 1982. (DOI:10.1038/299802a0). List of Definitions 4.1.1 4.1.2 4.1.3 4.2.1 4.2.2 4.3.1 4.3.2 4.3.3 4.3.4 4.3.5 Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition (Category) . . . . . . . . . . . . . . . . (Functor) . . . . . . . . . . . . . . . . . (Natural transformation) . . . . . . . . (Adjunction) . . . . . . . . . . . . . . . (Monad) . . . . . . . . . . . . . . . . . (Monoidal category) . . . . . . . . . . . (Symmetric monoidal category) . . . . (Symmetric monoidal closed category) (Compact closed category) . . . . . . . (Dagger compact category) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 10 10 11 11 11 12 13 13 14 5.0.6 5.0.7 5.0.8 5.0.9 Definition Definition Definition Definition (Frobenius algebra) . . . . . (Frobenius structure) . . . . (Symmetric algebra) . . . . . (Isometric or special algebra) . . . . . . . . . . . . . . . . 15 16 17 17 6.2.1 6.2.2 6.2.3 Definition (Classical structure (categorical)) . . . . . . . Definition (Unbiasedness (categorical)) . . . . . . . . . . Definition (Complementarity (categorical)) . . . . . . . . 22 25 25 8.0.1 8.0.2 8.0.3 Definition (Variables and terms in the lambda calculus) . Definition (Types in the lambda calculus) . . . . . . . . . Definition (Typing judgements in the lambda calculus) . 31 31 31 9.1.1 Definition (Variables, constants and terms in the dagger lambda calculus) . . . . . . . . . . . . . . . . . . . . . . . Definition (Types in the dagger lambda calculus) . . . . Definition (Linear negation) . . . . . . . . . . . . . . . . Definition (Scalars) . . . . . . . . . . . . . . . . . . . . . Definition (Dimensions) . . . . . . . . . . . . . . . . . . . 36 36 36 37 37 9.1.2 9.1.3 9.1.4 9.1.5 106 . . . . . . . . . . . . . . . . . . . . . . . . LIST OF DEFINITIONS 9.1.6 9.1.7 9.1.8 9.1.9 9.1.10 9.1.11 9.1.12 9.1.13 9.1.14 9.1.15 9.1.16 9.1.17 9.1.18 9.3.1 9.3.2 10.1.1 10.2.1 10.3.1 10.3.2 10.3.3 10.4.1 10.4.2 10.5.1 10.5.2 10.5.3 107 Definition (Soup) . . . . . . . . . . . . . . . . . . . . . . Definition (Typing judgements in the dagger lambda calculus) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Definition (Bound variables and terms in the dagger lambda calculus) . . . . . . . . . . . . . . . . . . . . . . . . . . . Definition (α-renaming on variables in the dagger lambda calculus) . . . . . . . . . . . . . . . . . . . . . . . . . . . Definition (α-renaming on terms in the dagger lambda calculus) . . . . . . . . . . . . . . . . . . . . . . . . . . . Definition (α-equivalence in the dagger lambda calculus) Definition (Typing contexts in the dagger lambda calculus) Definition (Soup reduction) . . . . . . . . . . . . . . . . . Definition (Soup equivalence) . . . . . . . . . . . . . . . Definition (Application in the dagger lambda calculus) . Definition (Lambda abstraction in the dagger lambda calculus) . . . . . . . . . . . . . . . . . . . . . . . . . . . Definition (Complex conjugation) . . . . . . . . . . . . . Definition (Scalar multiplication) . . . . . . . . . . . . . Definition (Denotations) . . . . . . . . . . . . . . . . . . Definition (Syntactic category notational conventions) . . Definition (Notational conventions for classical structures in the dagger lambda calculus) . . . . . . . . . . . . . . . Definition (Dualiser) . . . . . . . . . . . . . . . . . . . . Definition (Monoidal product) . . . . . . . . . . . . . . . Definition (Phase shift) . . . . . . . . . . . . . . . . . . . Definition (Lifting of the monoidal product of terms) . . Definition (Unbiasedness (dagger lambda calculus)) . . . Definition (Classicality (dagger lambda calculus)) . . . . Definition (Complementary observable structures (dagger lambda calculus)) . . . . . . . . . . . . . . . . . . . . Definition (Complementarity (dagger lambda calculus)) . Definition (Hadamard (dagger lambda calculus)) . . . . . 37 37 38 38 39 39 39 42 43 43 44 44 45 54 55 65 69 71 71 72 73 74 75 79 79 List of Theorems, Lemmas and Corollaries 4.2.1 4.3.1 Corollary (Adjunctions define a monad) . . . . . . . . . . Corollary (Closure of Compact Closed Categories) . . . . 11 14 6.2.1 6.2.2 6.2.3 Theorem (No-cloning theorem) . . . . . . . . . . . . . . . Theorem (No-deleting theorem) . . . . . . . . . . . . . . Theorem (Spider theorem) . . . . . . . . . . . . . . . . . 21 21 25 9.1.1 9.1.1 9.1.2 9.1.3 9.1.1 9.1.2 9.1.3 9.1.2 9.2.1 9.2.2 9.2.1 9.2.2 9.2.1 9.2.3 9.2.4 9.3.1 9.3.2 9.3.3 9.3.4 9.3.5 Corollary (Beta reduction) . . . . . . . . . . . . . . Theorem (Admissibility of ⊸ E) . . . . . . . . . . . Theorem (Admissibility of †-flip) . . . . . . . . . . . Theorem (Interchangeability of †-flip and Negation) Lemma (Associativity of multiplication) . . . . . . Lemma (Commutativity of multiplication) . . . . . Lemma (Sesquilinearity of scalar connections) . . . Corollary (Dimension multiplication) . . . . . . . . Theorem (Subject reduction) . . . . . . . . . . . . . Theorem (Strong normalisation) . . . . . . . . . . . Lemma (Left-linearity) . . . . . . . . . . . . . . . . Lemma (Symmetry of substitution) . . . . . . . . . Corollary (No overlap) . . . . . . . . . . . . . . . . Theorem (Confluence) . . . . . . . . . . . . . . . . Theorem (Consistency) . . . . . . . . . . . . . . . . Theorem (The syntactic category) . . . . . . . . . . Theorem (Monoidal category) . . . . . . . . . . . . Theorem (Symmetric monoidal category) . . . . . . Theorem (Compact closure) . . . . . . . . . . . . . Theorem (Dagger compact closure) . . . . . . . . . 43 44 44 45 45 46 46 46 47 48 49 50 50 50 51 54 56 58 59 60 108 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 LIST OF THEOREMS, LEMMAS AND COROLLARIES 9.3.1 9.3.2 9.3.3 9.3.6 61 61 61 9.3.1 Lemma (Essentially surjective on objects) . . . . . . . . Lemma (Equal arrows correspond to equal denotations) . Lemma (Equal denotations correspond to equal arrows) . Theorem (Equivalence between the free category and the syntactic category) . . . . . . . . . . . . . . . . . . . . . Corollary (Internal language) . . . . . . . . . . . . . . . . 10.2.1 10.2.2 10.3.1 10.3.2 10.5.1 Theorem (Unitarity of the dualiser) . . . . . . . . Theorem (Admissibility of the Currying rule) . . Corollary (Associativity and commutativity of ⊙) Corollary (Phase shift commutativity) . . . . . . . Theorem (Complementarity) . . . . . . . . . . . . . . . . . 69 70 71 72 76 11.0.1 11.0.2 Lemma (Controlled unitary 1) . . . . . . . . . . . . . . . Lemma (Controlled unitary 2) . . . . . . . . . . . . . . . 83 84 . . . . . . . . . . . . . . . 63 63
6cs.PL
Interpretable sparse SIR for functional data arXiv:1606.00614v4 [math.ST] 2 Mar 2018 Victor Picheny Rémi Servien Nathalie Villa-Vialaneix Received: date / Accepted: date Abstract space is infinite, and even if the digitized version of the curves is considered, the number of evaluation We propose a semiparametric framework based on points is typically much larger than the number of Sliced Inverse Regression (SIR) to address the issue of observations. variable selection in functional regression. SIR is an Recently, an increasing number of works have foeffective method for dimension reduction which comcused on variable selection in this functional regresputes a linear projection of the predictors in a lowsion framework, in particular in the linear setting. dimensional space, without loss of information on the The problem is to select parts of the definition doregression. In order to deal with the high dimensionmain of X that are relevant to predict Y . Considality of the predictors, we consider penalized versions ering digitized versions of the functional predictor of SIR: ridge and sparse. We extend the approaches X, approaches based on Lasso have been proposed of variable selection developed for multidimensional to select a few isolated points of X (Ferraty et al, SIR to select intervals that form a partition of the 2010; Aneiros and Vieu, 2014; McKeague and Sen, definition domain of the functional predictors. Select2010; Kneip et al, 2016). Alternatively, other authors ing entire intervals rather than separated evaluation proposed to perform variable selection on predefined points improves the interpretability of the estimated functional bases. For instance, Matsui and Konishi coefficients in the functional framework. A fully auto(2011) used L1 regularization on Gaussian basis funcmated iterative procedure is proposed to find the crittions and Zhao et al (2012); Chen et al (2015) on ical (interpretable) intervals. The approach is proved wavelets. efficient on simulated and real data. The method However, in many practical situations, the relevant is implemented in the R package SISIR available on CRAN at https://cran.r-project.org/package= information may not correspond to isolated evaluaSISIR. Keywords : functional regression; SIR; tion points of X neither to some of the components of its expansion on a functional basis, but to its value Lasso; ridge regression; interval selection. on some continuous intervals, X([ta , tb ]). In that case, variable selection amounts to identify those intervals. As advocated by James et al (2009), a de1 Introduction sirable feature of variable selection provided by such This article focuses on the functional regression prob- an approach is to enhance the interpretability of the lem, in which a real random variable Y is predicted relation between X and Y . Indeed, it reduces the deffrom a functional predictor X(t) that takes values in a inition domain of the predictors to a few influential functional space (e.g., L2 ([0, 1]), the space of squared intervals, or it focuses on some particular aspects of integrable functions over [0, 1]), based on a set of ob- the curves in order to obtain expected values for Y . served pairs (X, Y ), (xi , yi )i=1,...,n . The main chal- Tackling this issue can be seen as selecting groups of lenge with functional regression lies in its high di- contiguous variables (i.e., intervals) instead of selectmension: the underlying dimension of a functional ing isolated variables. Fraiman et al (2016), in the 1 linear setting, and Fauvel et al (2015); Ferraty and Hall (2015), in a nonparametric framework, propose several alternatives to do so. However, no specific contiguity constraint is put on groups of variables. In the present work, we propose a semi-parametric model that selects intervals in the definition domain of X with an automatic approach. The method is based on Sliced Inverse Regression (SIR, Li, 1991): the main idea of SIR is to define a low dimensional data-driven subspace on which the functional predictors can be projected. This subspace, called Effective Dimension Reduction (EDR) space is defined so as to optimize the prediction ability of the projection. As a particular case, the method includes the linear regression. Our choice for SIR is motivated by the fact that the method is based on a semi-parametric model that is more flexible than linear models. The method has been extended to the functional framework in previous works (Ferré and Yao, 2003; Ferré and Villa, 2006) and sparse (i.e., `1 penalized) versions of the approach have also already been proposed in Li and Nachtsheim (2008) and Li and Yin (2008) for the multivariate framework. Building on these previous proposals, we show that a tailored group-Lasso-like penalty allows us to select groups of variables corresponding to intervals in the definition domain of the functional predictors. Our second contribution is a fast and automatic procedure for building intervals in the definition domain of the predictors without using any prior knowledge. As far as we know, the only works that propose a method to both define and select relevant intervals in the domain of the predictors are the work of Park et al (2016) and Grollemund et al (2018), both in the linear framework. Our approach is based on an iterative procedure that uses the full regularization path of the Lasso. The paper is organized as follows: Section 2 presents the SIR approach in a multidimensional framework and its adaptations to the highdimensional and functional frameworks, which are based on regularization and/or sparsity constraints. Section 3 describes our proposal when the domain of the predictors are partitioned using a fixed set of intervals. Then, Section 4 describes an automatic procedure to find these intervals and Section 5 provides practical methods to tune the different parameters in a high dimensional framework. Finally, Section 6 evaluates our approach on simulated and real-world datasets. 2 A review on SIR and regularized versions In this section, we review the standard SIR for multivariate data and its extensions to the highdimensional setting. Here, (X, Y ) denotes a random pair of variables such that X takes values in Rp and Y is real. We assume given n i.i.d. realizations of (X, Y ), (xi , yi )i=1,...,n . 2.1 The standard multidimensional case When p is large, classical modeling approaches suffer from the curse of dimensionality. This problem might occur even if p is smaller than n. A standard way to overcome this issue is to rely on dimension reduction techniques. This kind of approaches is based on the assumption that there exists an Effective Dimension Reduction (EDR) space SY |X which is the smallest subspace such that the projection of X on SY |X retains all the information on Y contained in the predictor X. More precisely, SY |X is assumed of the form Span{a1 , . . . , ad }, with d  p, such that > Y = F (a> 1 X, . . . , ad X, ), (1) in which F : Rp+1 → R is an unknown function and  is an error term independent of X. To estimate this subspace, SIR is one of the most classical approaches when p < n: under an appropriate and general enough condition, Li (1991) shows that a1 , . . . , ad can be estimated as the first d Σorthonormal eigenvectors of the generalized eigenvalue problem: Γa = λΣa, in which Σ is the covariance matrix of X and Γ is the covariance matrix of E(X|Y ). In practice, Σ is replaced by the empirical covari  b = 1 Pn xi − X xi − X > , and Γ is esance, Σ i=1 n timated by “slicing” the observations (yi )i as follows. 2 2.2 The range of Y is partitioned into H consecutive and non-overlapping slices, denoted hereafter S1 , . . . , SH . An estimate of E(X|Y ) is thus simply obtained by X 1 , . . . , X H in which X h is the average of the observations xi such that yi is in Sh and X h is associated with the empirical frequency p̂h = nnh with nh b is thus defined the number of observations in Sh . Γ PH > as h=1 p̂h X h X h . Regularization in dimensional setting H X b + µ2 Ip )ACh − p̂h Ch> A> (Σ h=1 2 E1 (A, C) = high- In the high-dimensional setting, directly applying a PH ridge penalty, µ2 h=1 p̂h kACh k2Ip (for a given µ2 > b −1 (see 0), to E1 would require the computation of Σ Equation (2)) that does not exist when n < p. However, Bernard-Michel et al (2008) show that this problem can be rewritten as the minimization of SIR has different equivalent formulations that can be useful to introduce regularization and sparsity. Cook (2004) shows that the SIR estimate can be obtained by minimizing over A ∈ Rp×d and C = (C1 , ..., CH ), with Ch ∈ Rd (for h = 1, . . . , H), H X the H X  p̂h X h − X ACh , (4) h=1 p̂h k(X h − X) − 2 b ΣAC h kΣ b −1 , (2) which is well defined even for the high-dimensional setting. Minimizing this quantity with respect to A leads to define the columns of A (and hence the p 2 in which k.k2Σ b −1 = searched vectors aj ) as the first d eigenvectors of b −1 is the norm ∀ u ∈ R , kukΣ −1 b −1 u and the searched vectors aj are the columns  b u> Σ b Σ + µ2 Ip Γ. of A. h=1 An alternative formulation is described in Chen and Li (1998), where SIR is written as the following optimization problem: max Cor(φ(Y aj ,φ ), a> j X), 2.3 Sparse SIR Sparse estimates of aj usually increase the interpretability of the model (here, of the EDR space) by focusing on the most important predictors only. Also, Lin et al (2018) prove the relevance of sparsity for SIR in high dimensional setting by proposing a consistent screening pre-processing of the variables before the SIR estimation. A different and very commmon approach is to handle sparsity directly by a sparse penalty (in the line of the well-known Lasso). However, contrary to ridge regression, adding directly a sparse penalty to Equation (2) does not allow a reformulation valid for the case n < p. To the best of our knowledge, only two alternatives have already been published to use such methods, one based on the regression formulation (2) and the other on the correlation formulation (3) of SIR. Li and Yin (2008) derive a sparse ridge estimator from the work of Ni et al (2005). Given (Â, Ĉ), solution of the ridge SIR, a shrinkage index vector α = (α1 , . . . , αp )> ∈ Rp is obtained by minimizing a (3) where φ is any function R → R and (aj )j are Σorthonormal. So, SIR can be interpreted as a canonical correlation problem. The authors also prove that the solution of φ optimizing Equation (3) for a given aj is φ(y) = a> j E(X|Y = y), and that aj is also obtained as the solution of the mean square error op2 timization minaj E φ(Y ) − a> j X . However, as explained in Li and Yin (2008) and Coudret et al (2014) among others, in a high dimenb is singular and the SIR sional setting (n < p), Σ problem is thus ill-posed. The same problem occurs in the functional setting (Dauxois et al, 2001). Solutions to overcome this difficulty include variable selection (Coudret et al, 2014), ridge regularization or sparsity constraints. 3 least square error with `1 penalty: Es,1 (α) = H X p̂h  b X h − X − ΣDiag(α) ÂĈh 2 + Ip h=1 µ1 kαk`1 , (5) Pp for a given µ1 ∈ R+∗ where kαk`1 = j=1 |αj |. Once the coefficients α have been estimated, the EDR space is the space spanned by the columns of Diag(α̂)Â, where α̂ is the solution of the minimization of Es,1 (α). An alternative is described in Li and Nachtsheim (2008) using the correlation formulation of the SIR. After the standard SIR estimates â1 , . . . , âd have been computed, they solve d independent minimization problems with sparsity constraints introduced as an `1 penalty: ∀ j = 1, . . . , d, Es,2 (asj ) = • using the approach of Li and Yin (2008) based on shrinkage coefficients, the indices αj where αj > 0 are the same on all the d components of the EDR. This makes sense because the vectors aj themselves are not relevant: only the space spanned by them is and so there is no interest to select different variables j for the d estimated directions. Moreover, this allows to formulate the optimization in a single problem. However, this problem relies on a least square minimization with dependent variables in a high dimensional space Rp ; • on the contrary, the approach of Chen and Li (1998) relies on a least square problem based on projections and is thus obtained from d independent optimization problems. The dimension of the dependent variable is reduced (1 instead of p) but the different vectors which span the EDR space are estimated independently and not simultaneously. n X 2  Pâj (X|yi ) − (asj )> xi + µ1,j kasj k`1 , i=1 (6) b = yi )> âj , with in which Pâj (X|yi ) = E(X|Y b E(X|Y = yi ) = X h for h such that yi ∈ Sh in the b case of a sliced estimate of E(X|Y ) and µ1,j > 0 is a parameter controlling the sparsity of the solution. Note that both proposals have problems in the high-dimensional setting: In our proposal, we combine both advantages of Li and Yin (2008) and Li and Nachtsheim (2008) using a single optimization problem based on the correlation formulation of SIR. In this problem, the dimension of the dependent variable is reduced (d instead of p) when compared to the approach of Li and Yin (2008) and it is thus computationally more efficient. Identical sparsity constraints are imposed on all d • In their proposal, Li and Yin (2008) avoid the dimensions using a shrinkage approach, but instead b by working in the issue of the singularity of Σ of selecting the nonzero variables independently, we original scale of the predictors for both the ridge adapt the sparsity constraint to the functional setting and the sparse approach (hence the use of the to avoid selecting isolated measurement points. The k.kIp -norm in Equation (5) instead of the stan- next section describes this approach. dard k.kΣ b −1 -norm of Equation (2)). However, for the ridge problem, this choice has been proved to produce a degenerate problem by Bernard- 3 Sparse and Interpretable SIR Michel et al (2008). (SISIR) • Li and Nachtsheim (2008) base their sparse version of the SIR on the standard estimates of the In this section, a functional regression framework is SIR problem that cannot be computed in the assumed. X is thus a functional random variable, taking value in a (infinite dimensional) Hilbert space. high-dimensional setting. (xi , yi )i=1,...,n are n i.i.d. realizations of (X, Y ). Moreover, the other differences between these two However, xi are not perfectly known but observed approaches can be summarized in two points: on a given (deterministic) grid τ = {t1 , . . . , tp }. We 4 denote by xi = (xi (tj ))j=1,...,p ∈ Rp the i-th observation, by xj = (xi (tj ))i=1,...,n the observations at tj and by X the n×p matrix (x1 , . . . , xn )> . Unless said otherwise, the notations are derived from the ones introduced in the multidimensional setting (Section 2) by using the xi as realizations of X. Some very common methods in functional data analysis, such as splines (Hastie et al, 2001), use the supposed smoothness of X to project them in a reduced dimension space. Contrary to these methods, we do not use or need that the observed functional predictor is smooth. We take advantage of the functional aspects of the data in a different way, using the natural ordering of the definition domain of X to impose sparsity on the EDR space. To do so, we assume that this definition domain is partitioned into D contiguous and non-overlapping intervals, τ1 , . . . , τD . In the present section, these intervals are supposed to be given a priori and we will describe later (in Section 4) a fully automated procedure to obtain them from the data. The following two subsections are devoted to the description of the two steps (ridge and sparse) of the method, adapted from Bernard-Michel et al (2008); Li and Yin (2008); Li and Nachtsheim (2008). 3.1 j = 1, . . . , d. It is easy  to prove that these b columns are Σ + µ2 Ip -orthonormal eigenvec −1 b + µ2 Ip b tors of Σ Γ. 2. For a given A, the optimal Ĉ = (Ĉ1 , . . . , ĈH ) ∈ Rd,H is given by the first order derivation condition over the minimized criterion. This h i b + µ2 A> A Ĉh = is equivalent to A> ΣA  that gives Ĉh = A> X h − X h i−1  b + µ2 A> A = A> ΣA A> X h − X  > A X h − X  because the columns of A b + µ2 Id -orthonormal. are Σ 3.2 Interval-sparse estimation Once  and Ĉ have been computed, the estimated b projections of (E(X|Y = yi ))i=1,...,n onto the EDR b space are obtained by: P (E(X|Y = yi )) = (X h − > X) Â, for h such that yi ∈ Sh . This d dimensional vector will be denoted by (Pi1 , . . . , Pid )> . In addition, we will also denote by Pj (for j = 1, . . . , d), Pj = (P1j , . . . , Pnj )> ∈ Rn . D shrinkage coefficients, α = (α1 , . . . , αD ) ∈ RD , one for each interval (τk )k=1,...,D , are finally estimated. If Λ(α) = Diag α1 I|τ1 | , . . . , αD I|τD | ∈ Rp×p , this leads to solve the following Lasso problem Ridge estimation The ridge step is the minimization of Equation (4), over (A, C) to obtain  and Ĉ. In practice, the solution is computed as follows: α̂ = arg min α∈RD d X n X > kPij − (Λ(α) âj ) xi k2 + µ1 kαk`1 j=1 i=1 1. The estimator of A ∈ Rp×d is the solution of d the ridge X  penalized  SIR and is composed of the = arg min kPj − (X∆(âj )) αk2 + µ1 kαk`1 , b + µ2 Ip -orthonormal eigenvectors of first d Σ α∈RD j=1  −1 b + µ2 Ip b associated with the d largest Σ Γ with ∆(âj ) the (p × D)-matrix such that ∆lk (âj ), is eigenvalues. In practice, the same procedure the l-th entry of â , â , if t ∈ τ and 0 otherwise. j jl l k as the one described in Ferré and Yao (2003); This problem can be rewritten as Ferré and Villa (2006) is used: first, orthonorarg min kP − ∆(XÂ) αk2 + µ1 kαk`1 (7) mal eigenvectors (denoted hereafter (b̂j )j=1,...,d ) α∈RD  −1/2  −1/2 b + µ2 Ip b Σ b + µ2 Ip  1  of the matrix Σ Γ P are computed. Then,  is the matrix whose with P =  .. , a vector of size dn and ∆(XÂ) =  .   −1/2 b + µ2 Ip b̂j for columns are equal to Σ Pd 5   X∆(â1 )   ..  , a (dn) × D-matrix. . X∆(âp ) α̂ are used to define the âsj of the vectors spanning the EDR space by: a method called sequential bifurcation (Bettonvil, 1995) which allows them to sequentially split in two the most promising intervals (starting from a unique interval covering the entire domain of X). Here, we propose the inverse approach: we start with small intervals and merge them sequentially. Our approach is based on the standard sparse SIR (which is used as a starting point) and iteratively performs the most relevant merges in a flexible way (contrary to a splitting approach, we do not need to arbitrary set the splitting positions). The intervals (τk )k=1,...,D are first initialized to a very fine grid, taking for instance τk = {tk } for all k = 1, . . . , p (hence, at the beginning of the procedure, D = p). The sparse step described in Section 3.2 is then performed with the a priori intervals (τk )k=1,...,D : the set of solutions of Equation (7), for varying values of the regularization parameter µ1 , is obtained using a regularization path approach, as described in Friedman et al (2010). Three elements are retrieved from the path results: ∀ l = 1, . . . , p, âsjl = α̂k âjl for k such that tl ∈ τk . Once the sparse vectors (âsj )j=1,...,d have been obtained, an Hilbert-Schmidt orthonormalization apb proach is used to make them Σ-orthonormal. Of note, as a single shrinkage coefficient is defined for all (âjl )tl ∈τk , the method is close to group-Lasso (Simon et al, 2013), in the sense that, for a given k ∈ {1, . . . , D}, estimated (âsjl )j=1,...,d, tl ∈τk are either all zero or either all different from zero. However, the approach differs from group-Lasso because groupsparsity is not controlled by the L2 -norm of the group but by a single shrinkage coefficient associated to that group: the final optimization problem of Equation (7) is thus written as a standard Lasso problem (on α). Another alternative would have been to use fusedLasso (Tibshirani et al, 2005) to control the total variation norm of the estimates. However, the method does not explicitely select intervals and, as illustrated in Section 6.1, is better designed to produce piecewise constant solutions than solutions that have sparsity properties on intervals of the definition domain. 4 • (α̂∗k )k=1,...,D are the solutions of the sparse problem for the value µ∗1 of µ1 that minimizes the GCV error; − • (α̂+ k )k=1,...,D and (α̂k )k=1,...,D are the first solutions, among the path of solutions, such that at most (resp. at least) a proportion P of the coefficients are non zero coefficients (resp. are zero coefficients), for a given chosen P , which should be small (0.05 for instance). An iterative procedure to select the intervals Then, the following sets are defined: D1 = {k : α̂− k 6= 0} (called “strong non zeros”) and D2 = {k : α̂+ k = 0} (called “strong zeros”). This step is illustrated in Figure 1. Intervals are merged using the following rules: The previous section described our proposal to detect the subset of relevant intervals among a fixed, predefined set of intervals of the definition domain of the predictor, (τk )k=1,...,D . However, choosing a priori a proper set of intervals is a challenging task without expert knowledge, and a poor choice (too small, too large, or shifted intervals) may largely hinder interpretability. In the present section, we propose an iterative method to automatically design the intervals, without making any a priori choice. In a closely related framework, Fruth et al (2015) tackle the problem of designing intervals by combining sensitivity indices, linear regression models and • “neighbor rule”: consecutive intervals of the same set are merged (τk and τk+1 are merged if both k and k + 1 belong to D1 or if they both belong to D2 ) (see a) and b) in Figure 2); • “squeeze rule”: τk , τk+1 and τk+2 are merged if both k and k+2 belong to D1 while k+1 ∈ / D2 (or if both k and k+2 belong to D2 while k+1 ∈ / D1 ) 6 Algorithm 1 Overview of the complete procedure 1: Ridge estimation 2: Choose µ2 and d according to Section 5 3: Solve the ridge penalized SIR to obtain  and Ĉ, ridge estimates of the SIR (see details in Section 3.1) 4: Sparse estimation 5: Initialize the intervals (τk )k=1,...,D to τk = {tk } 6: repeat 7: Estimate and store (α̂∗k )k=1,...,D the solutions of the sparse problem that minimizes the GCV error − 8: Estimate (α̂+ k )k=1,...,D and (α̂k )k=1,...,D such that at most (resp. at least) a proportion P of the coefficients are non zero coefficients (resp. are zero coefficients), for a given chosen P (details in Section 4) Figure 1: Example of regularization path with D = 9: Update the intervals (τk )k=1,...,D according to 20: (α̂k )k=1,...,D are plotted according to different the “neighbor” and the “squeeze” rules (see Secvalues of the tuning parameter µ1 . The vertical dottion 4) ted line represents the optimal value µ∗1 that pro- 10: until τ1 6= [t1 , tp ] vides the solutions (α̂∗k )k=1,...,D of the sparse prob- 11: Output : A collection of models (α̂∗k )k=1,...,D lem. (α̂k )k∈D1 and (α̂k )k∈D2 are respectively repre- 12: Select the model (α̂∗k )∗k=1,...,D∗ that minimizes sented in bold and in pointed lines for P = 0.1. the CV error 13: Active intervals (for interpretation) are consecutive τk with non zero coefficients α̂∗k and lk + lk+2 > lk+1 with lk = max τk − min τk (see c) and d) in Figure 2). 5 If the current value of P does not yield any fusion between intervals, P is updated by P ← P + P0 in which P0 is the initial value of P . The procedure is iterated until all the original intervals have been merged. The result of the method is a collection of models (α̂∗k )k=1,...,D , starting with p intervals and finishing with one. The final selected model is the one that minimizes the CV error. In practice, this often results in a very small number of contiguous intervals which are of the same type (zero or non zero) and are easily interpretable (see Section 6). Let us remark that the intervals (τk )k=1,...,D are not used in the ridge step of Section 3.1, which can thus be performed once, independently of the interval search. The whole procedure is described in Algorithm 1. Choice of parameters in the high dimensional setting The method requires to tune four parameters : the number of slices H, the dimension of the EDR space p, the penalization parameter of the ridge regression µ2 and of the one of the sparse procedure µ1 . Two of these parameters, H and µ1 , are chosen in a standard way (see Section 6 for further details). This section presents a method to jointly choose µ2 and d, for which no solution has been proposed that is suited to our high-dimensional framework. Two issues are raised to tune these two parameters: i) they depend from each other and ii) the existing methods to tune them are only valid in a low-dimensional setting (p < n). We propose an iterative method which adapts existing approaches only valid for the low dimension 7 Figure 2: Illustration of the merge procedure for the intervals. 5.2 framework and combine them to find an optimal joint choice for µ2 and d. Choosing d in a high dimensional setting The results of CV (i.e., the values of E1 (A, C) esti- 5.1 A Cross-Validation (CV) criterion mated by L-fold CV) are not directly usable for tuning d. The reason is similar to the one developed in for µ2 Biau et al (2005); Fromont and Tuleau (2006): different d correspond to different MLR (Multiple Linear Regression) problems which cannot be compared directly using a CV error. In such cases, an additional penalty depending on d is necessary to perform a relevant selection and avoid overfitting due to large d. Alternatively, a number of works have been dealing with the choice of d in SIR. Many of them are asymptotic methods (Li, 1991; Schott, 1994; Bura and Cook, 2001; Cook and Yin, 2001; Bura and Yang, 2011; Liquet and Saracco, 2012) which are not directly applicable in the high dimensional framework. When n < p, Zhu et al (2006); Li and Yin (2008) estimate d using the number of non zero eigenvalues of Γ, but their approach requires setting a hyper-parameter to which the choice of d is sensitive. Portier and Delyon (2014) describes an efficient approach that can be used when n < p but it is based on bootstrap sampling and would thus be overly extensive in our situations where d has to be tuned jointly with µ2 (see next section). Another point of view can be taken from Li (1991) who introduces a quantity, denoted by R2 (d), which is the average of the squared canonical correlation between the space spanned by the columns of Σ1/2 A and the columns of the space spanned by the columns Using the results of Golub et al (1979), Li and Yin (2008) propose a Generalized Cross-Validation (GCV) criterion to select the regularization parameter µ2 and Bernard-Michel et al (2008) explain that this criterion can be applied to their modified estimator, using similar calculations. However, it requires b −1/2 , which does not exist in the computation of Σ the high dimensional setting. We thus used a different strategy, based on L-fold cross-validation (CV), which is also used to select the best dimension of the EDR space, d (see Section 5.2). More precisely, the data are split into L folds, L1 , . . . , LL and a CV error is computed for several values of µ2 in a given search grid and for a given (large enough d0 ). The optimal µ2 is chosen as the one minimizing the CV error for d0 . The CV error is computed based on the original regression problem E1 (A, C). In the expression of E1 (A, C) and for the iteration number l (∈ {1, . . . , L}), A and Ch are replaced by their estimates computed without the observations in fold number l. Then, an error is computed by replacing the values b by their empirical estimators for of p̂h , X h , X and Σ the observations in fold l. The precise expression is given in step 5 of Algorithm 2 in Appendix B. 8 b 1/2 A. b As explained in Ferré (1998), a relevant of Σ measure of quality choice of a dimension d is h for thei b R(d) = d − E Tr Πd Πd , in which Πd is the Σorthogonal projector onto the subspace spanned by b d is the Σ-orthogonal b the columns of A and Π projector onto the space spanned by the columns of Â. This 2 bd (in which k.kF quantity is equal to 1 E Πd − Π described in Appendix B. 6 Experiments This section evaluates different aspects of the methods on simulated and real datasets. The relevance of the selection procedure is evaluated on simulated and 2 F real datasets in Sections 6.1 and 6.3. Additionally, its is the Frobenius norm; see the proof in Appendix A). efficiency in a regression framework is assessed on a practice, hIn  i the quantity Πd is unknown and real supervised regression problem in Section 6.2. bd E Tr Πd Π is thus frequently estimated by reAll experiments have been performed using the R sampling techniques as bootstrap. Here, we choose package SISIR. Datasets and R scripts are provided a less computationally demanding h approach i by per- at https://github.com/tuxette/appliSISIR. bd forming a CV estimation: E Tr Πd Π is estimated during the same L-fold loop described in Sec- 6.1 Simulated data tion 5.1. An additional problem comes from the b 6.1.1 Model description fact that, in the high dimensional setting, the Σorthogonal projector onto the space spanned by the To illustrate our approach, wePfirst consider two toy b is datasets, built as follow: Y = d log |hX, aj i| with columns of  is not well defined since the matrix Σ j=1 ill-conditioned. This estimate is replaced by its reg- X(t) = Z(t) +  in which Z is a Gaussian process b + µ2 Ip )-orthogonal pro- indexed on [0, 1] with mean µ(t) = −5 + 4t − 4t2 and ularized version using the (Σ jector onto the space spanned by the columns of  the Matern 3/2 covariance function (Rasmussen and b d is the (Σ+µ b 2 Ip )-orthogonal projector onto the Williams, 2006), and  is a centered Gaussian variable and Π space spanned by the columns of Â. Finally, for all independent of Z. The vectors aj have a sinusoidal b \l +µ2 Ip )-orthogonal shape, but l = 1, . . . , L, we computed the (Σ  on specific intervals Ij :  are nonzero only projector onto the space spanned by the columns of aj = sin t(2+j)π IIj (t). − (j−1)π 2 3 b \l and Â(l) are computed without Â(l) in which Σ From this basis, we consider two models with inthe observations in fold number lhand averaged i the creasing complexity: bd . results to obtain an estimate of E Tr Πd Π • (M1): d = 1, I1 = [0.2, 0.4] In practice, this estimate is often a strictly increas• (M2): d = 3 and I1 = [0, 0.1], I2 = [0.5, 0.65] ing function of d and we chose the optimal dimension and I3 = [0.65, 0.78]. as the largest one before a gap in this increase (“elbow rule”). For both cases the datasets consist of n = 100 ob- 5.3 servations of Y , digitized at p = 200 and 300 evaluation points, respectively. The number of slices used to estimate the conditional mean E(X|Y ) has been chosen equal to H = 10: according to Li (1991); Coudret et al (2014) among others, the performances of SIR estimates are not sensitive to the choice of H, as long as it is large enough (on a theoretical point of view, H is required to be larger than d + 1). The datasets are displayed in Figure 3, with a priori intervals provided to test the sparse penalty (see Section 6.1.3 for further details). Joint tuning The estimation of µ2 and d is jointly performed using a single CV pass in which both parameters are varied. Note that only the number of different values for µ2 strongly influences the computational time since SIR estimation is only performed once for all values b for the of d, and selecting the first d columns of A last computation of the two criteria, the estimation of E(A, C) and that of R(d). The overall method is 9 6 4 density 2 0.4 a1(t) 8 0.8 −3.0 −4.0 X(t) −5.0 1.0 0.2 1.0 5.05 t 5.25 5 4 3 density 1 0.0 a(t) 5.15 y 0.5 −3.5 −4.5 0.0 0.4 t 0.8 0 −1.0 −5.5 X(t) 0.6 1.0 t 2 0.6 0 0.0 −6.0 0.2 0.0 0.4 t 0.8 11.8 12.2 y Figure 3: Summary of the two simulated datasets: top (M1), bottom (M2). The left charts display ten samples of X, the colors showing the actual relevant intervals; the middle charts display the functions that span the EDR space with the relevant slices highlighted in color; the right charts display the distribution of Y . (M1) (M2) Figure 4: Top: CV error versus µ2 (log10 scale, for d = 1) and Bottom: estimation of E(R(d)) versus d (for µ2 = 1 in both cases), for models (M1) (left) and (M2) (right). vals: a selection of the estimates of a1 for (M1), Step 1: Ridge estimation and parame- corresponding to those models is shown in Figure 5. ter selection The first chart (Figure 5,a) corresponds to the stanThe method described in Section 3.1 with parame- dard sparse penalty in which the constraint is put on ter selection as in Section 5 has been used to obtain isolated evaluation points. Even though most of sethe ridge estimates of (aj ) and to select the param- lected points are founds in the relevant interval, the eters µ2 (ridge regularization) and d (dimension of estimated parameter â1 has an uneven aspect which the EDR space). Figure 4 shows the evolution of does not favor interpretation. By constrast, for a low number of intervals (less the CV error and of the estimation of E(R(d)) versus than 50, Figure 5, c and d), the selected relevant (respectively) µ2 and d among a grid search both for −2 −1 5 points (those corresponding to nonzero coefficients) µ2 ∈ {10 , 10 , ..., 10 } and d ∈ {1, 2, . . . , 10}. The have a much larger range than the original relevant chosen value for µ2 is 1 for both models and the chointerval (in red on the figure). sen values for d, given by the “elbow rule” are d = 1 The model selected by minimization of the crossfor both models. The true values are, respectively, validation error (Figure 5, b) was found relevant: this d = 1 and d = 3, which shows that the criterion approach lead us to choose the model with 142 intertends to slightly underestimate the model dimension. vals, which actually correspond to two distinct and consecutive intervals (a first one, which contains only 6.1.3 Step 2: Sparse selection and definition nonzero coefficients and a second one in which no of relevant intervals point is selected by the sparse estimation). This fiThe approach described in Section 4 is then applied nal estimation is very close to the actual direction a1 , to both models. The algorithm produces a large col- both in terms of shape and support. lection of models with a decreasing number of interThe same method is used for (M2). A compari6.1.2 10 (a) 200 intervals (b) 142 intervals SISIR standard sparse Figure 6: (M2) Left: comparison between the true intervals and the estimated ones. True intervals are represented in the upper side of the figure (in black) and by the gray background. Estimated intervals are represented by the red lines in the bottom of the figure and by the pink background. Right: same repre(c) 41 intervals (d) 5 intervals sentation for the standard sparse approach (penalty Figure 5: (M1) Values of âs1 corresponding to four is applied to tj and not to the intervals). models obtained using the iterative procedure with a different numbers of intervals. (b) is the chosen model s s s and (a) corresponds to a standard sparse estimation for a1 = (a1,1 , . . . , a1,p ). The tuning parameters λ and λ were selected by 10-fold CV over a 21 2 with no constraint on intervals. dimensional grid search. The idea behind fused Lasso is to have a large number of identical consecutive enson between the true relevant intervals and the esti- tries in as1 . In our framework, the hope is to automatmated ones is provided in Figure 6 (left). The sup- ically design relevant intervals using this property. port of each of the estimate â1 is fairly appropriate: it Results are displayed in Figure 7 for both simulated slightly overestimates the length of the two real inter- datasets. Contrary to simple Lasso, fused Lasso provals and contains only three additional isolated points duces a piecewise constant estimate. However, both which are not relevant for the estimation. Compared for (M1) and (M2), the method fails to provide a to the standard sparse approach (right part of Fig- sparse solution: almost the whole definition domain ure 6), the approach is much more efficient to select of the predictor is returned as relevant. the relevant intervals and provide more interpretable results by identifying properly important contiguous 6.2 Tecator dataset areas in the support of the predictors. As a basis for comparison, fused Lasso (Tibshirani Additionally, we tested the approach with the wellet al, 2005), as implemented in the R package gen- known Tecator dataset (Borggaard and Thodberg, lasso, was used with both (M1) and (M2) datasets. 1992), which consists of spectrometric data from the For comparison with our method, we applied fused food industry. This dataset is a standard benchmark Lasso on the output of the ridge SIR so as to find for functional data analysis. It contains 215 observaas1 ∈ Rp that minimizes: tions of near infrared absorbency spectra of a meat n X  2 Pâ1 (X|yi ) − (as1 )> xi + i=1 λ1 kas1 k`1 + λ2 p−1 X j=1 |as1j − as1,j+1 |, sample recorded on a Tecator Infratec Food and Feed Analyzer. Each spectrum was sampled at 100 wavelengths uniformly spaced in the range 850–1050 nm. The composition of each meat sample was determined by analytic chemistry, among which we focus on the percentage of fat content. The data is displayed in 11 (M1) (M2) Figure 7: (M1) Values of âs1 obtained with fused Lasso. The target relevant interval is highlighted in red. (M2) Comparison between the true intervals and the estimated ones. True intervals are represented in the upper side of the figure (in black) and by the gray background. Fused Lasso estimated intervals are represented by the red lines in the bottom of the figure and by the pink background. Figure 8: the left chart displays the original spectra whereas the right chart displays the first order derivatives (obtained by simple finite differences). The fat content is represented in both graphics by the color level and, as is already well known with this dataset, the derivative is a good predictor of this quantity: these derivatives were thus used as predictors (X) to explain the fat content (Y ). 1050 nm. Using the ridge estimation and the method described in Section 5, we set µ2 = 10−4 and d = 1. The relevance of the approach was then assessed in a regression setting. Following the simulation setting described in Hernández et al (2015), we split the data into a training and test sets with 150 observations for the training. This separation of the data was performed 100 times randomly. For each training data set, the EDR space was estimated and the projection of the predictors on this space obtained. A a Support Vector Machine (SVM, -regression method, package e1071 Meyer et al, 2015) was used to fit the link function F of Equation (1) from both the projection on the EDR space obtained by a simple ridge SIR and the projection on the EDR space obtained by SISIR. The mean square error was then computed on the test set. We found an averaged value equal to 5.54 for the estimation of the EDR space obtained by SISIR and equal to 11.11 when the estimation of the EDR space is directly obtained by ridge SIR only. The performance of SISIR in this simulation is thus half the value reported for the Nadaraya-Watson kernel estimate in Hernández et al (2015). Even if some methods achieve better performance on this data set (Hernández et al (2015) reported an average MSE of 2.41 for their non parametric approach), our method has the advantage of being easily interpretable because it extracts a few components which are themselves composed of a small number of relevant intervals: Figure 9 shows the intervals selected in the simulation with the smallest MSE, compared to the values selected by the standard Lasso. Our method is able to identify two intervals in the middle of the wavelength definition domain that are actually relevant to predict the fat content (according to the ordering of the colors in this area). On the contrary, standard sparse SIR selects almost the entire interval. Figure 8: Tecator. 215 near infrared spectra from the “Tecator” dataset (left) and corresponding first order derivatives (right). The color level indicates the 6.3 Sunflower yield percentage of fat content. Finally, we applied our strategy to a challenging agronomic problem, the inference of interpretable We first applied the method on the entire dataset climate-yield relationships on complex crop models. to check the relevance of the estimated EDR space We consider a process-based crop model called and corresponding intervals in the domain 850– SUNFLO, which was developed to simulate the an12 essentially a combination of the other four variables (Allen et al, 1998). The cultural year (i.e., the period on which the simulation is performed) is from weeks 16 to 41 (April to October). We voluntarily kept unnecessary data (11 weeks before simulation and 8 weeks after) for testing purpose (because these periods are known to be irrelevant for the prediction). The resulting curves contained 309 measurement points. Ten series of this dataset are shown in Figure 10, with colors corresponding to the yield Figure 9: Tecator. Left: original predictors (first that we intend to explain: no clear relationship can order derivatives) with a gray background superim- be identified between the the value of the curves at posed to highlight the active intervals found by our any measurement point and the yield value. procedure. Right: same figure for the standard sparse approach (no constraint on intervals). nual grain yield (in tons per hectare) of sunflower cultivars, as a function of time, environment (soil and climate), management practice and genetic diversity (Casadebaig et al, 2011). SUNFLO requires functional inputs in the form of climatic series. These series consist of daily measures of five variables over a year: minimal temperature, maximal temperature, global incident radiation, precipitations and evapotranspiration. The daily crop dry biomass growth rate is calculated as an ordinary differential equation function of incident photosynthetically active radiation, light interception efficiency and radiation use efficiency. Broad scale processes of this framework, the dynamics of leaf area, photosynthesis and biomass allocation to grains were split into finer processes (e.g leaf expansion and senescence, response functions to environmental stresses). Globally, the SUNFLO crop model has about 50 equations and 64 parameters (43 plant-related traits and 21 environment-related). Thus, due to the complexity of plant-climate interactions and the strongly irregular nature of climatic data, understanding the relation between yield and climate is a particularly challenging task. The dataset used in the experiment consisted of 111 yield values computed using SUNFLO for different climatic series (recorded between 1975 and 2012 at five French locations). We focused solely on evapotranspiration as a functional predictor because it is Figure 10: Sunflo. Ten series of evaportranspiration daily recordings. The color level indicates the corresponding yield and the dashed lines bound the actual simulation definition domain. Using the ridge estimation and the method described in Section 5, we set µ2 = 103 and d = 2. Then, we followed the approach described in Section 4 to design the relevant intervals. Figure 11 shows the selected intervals obtained after running our algorithm, as well as the points selected using a standard sparse approach. The standard sparse SIR (top of the figure) captures well the simulation interval (with only two points selected outside of it), but fails to identify the important periods within it. In contrast, SISIR (bottom) focuses on the second half of the simulation interval, and in particular its third quarter. This matches well expert knowledge, that reports little influence of the climate 13 conditions at early stage of the plant growth and almost none once the grains are ripe (Casadebaig et al, 2011). 1 bd Πd − Π 2 2 = F =   >  1 b b Tr Πd − Πd Πd − Πd 2 h i 1 bd + Tr [(Πd Πd )] − Tr Πd Π 2 1 h b b i Tr Πd Πd . 2 The norm of a M -orthogonal projector onto a space of dimension d is equal to d, we thus have that 1 bd Πd − Π 2 2 = d − Tr F h bd Πd Π i , which concludes the proof. B Joint choice of the parameters µ2 and d Figure 11: Sunflo. Top: standard sparse SIR (blue). Bottom: SISIR (pink). The colored areas depict the Notations: active intervals. The dashed lines bound the actual simulation definition domain. • Ll are observations in fold number l and Ll are the remaining observations; • Â(L, µ2 , d) and Ĉ(L, µ2 , d) are minimizers of the ridge regression problem restricted to observations i ∈ L. Note that for d1 < d2 , Â(τ, µ2 , d1 ) are the first d1 columns of Â(L, µ2 , d2 ) (and similarly for Ĉ(L, µ2 , d)); Acknowledgments The authors thank the two anonymous referees for relevant remarks and constructive comments on a previous version of the paper. A In Equivalent expressions for R2 (d) this section, we show 2 1 b . We have 2 E Πd − Πd that R2 (d) = F 14 L L bL • p̂L h , X h , X and Σ are, respectively, slices frequencies, conditional mean of X given the slices, mean of X given the slices and covariance of X for observations i ∈ L; bL bL • Π d,µ2 is the (Σ + µ2 Ip )-orthogonal projector onto the space spanned by the first d columns b d,µ is Π bL of Â(L, µ2 , d0 ) and Π 2 d,µ2 for L = {1, . . . , n}. Algorithm 2 dimensional problems. Statistics and Probability ∗ Letters 94:12–20 1: Set Gµ2 (finite search grid for µ2 ) and d0 ∈ N large enough Bernard-Michel C, Gardes L, Girard S (2008) A 2: for µ2 ∈ Gµ2 do note on sliced inverse regression with regulariza3: for l = 1, . . . , L do tions. Biometrics 64(3):982–986, DOI 10.1111/j. 4: Estimate Â(Ll , µ2 , d0 ) and Ĉ(Ll , µ2 , d0 ) 1541-0420.2008.01080.x 5: With the observations i ∈ Ll and for d ∈ {1, . . . , d0 }, compute Bettonvil B (1995) Factor screening by sequential bifurcation. Communications in Statistics, SimulaH  L  X Ll tion and Computation 24(1):165–185 l Ll l CVerrd,µ2 = p̂h Xh − X − h=1 Biau G, Bunea F, Wegkamp M (2005) Functional 2 classification in Hilbert spaces. IEEE Transactions Ll b Σ Â(Ll , µ2 , d)Ĉh (Ll , µ2 , d) L −1 b lon Theory 51:2163–2172 (Σ +I)Information in which  is a small positive number that makes b Ll + I) invertible. (Σ b Ll 6: For d ∈ {1, . . . , d0 }, compute Π d,µ2 7: For d ∈ {1, . . . , d0 }, compute R̂µ2 (d) = d − 8: 9: 1 L L X  b Ll Π b Tr Π d,µ2 d,µ2  l=1 end for Compute L CVerrµ2 ,d = 1X CVerrlµ2 ,d L l=1 end for State d∗ ← d0 . repeat Choose µ∗2 = arg minµ2 ∈Gµ2 CVerrµ2 ,d∗ 14: Update d∗ with an “elbow rule” in R̂µ∗2 (d) 15: until Stabilization of d∗ ∗ 16: Output: µ∗ 2 and d 10: 11: 12: 13: References Allen RG, Pereira LS, Raes D, Smith M (1998) Crop evapotranspiration-guidelines for computing crop water requirements-fao irrigation and drainage paper 56. FAO, Rome 300(9):D05,109 Borggaard C, Thodberg H (1992) Optimal minimal neural interpretation of spectra. Analytical Chemistry 64(5):545–551 Bura A, Cook R (2001) Extending sliced inverse regression: the weighted chi-squared test. Journal of the American Statistical Association 96(455):996– 1003 Bura E, Yang J (2011) Dimension estimation in sufficient dimension reduction: a unifying approach. Journal of Multivariate analysis 102(1):130–142, DOI 10.1016/j.jmva.2010.08.007 Casadebaig P, Guilioni L, Lecoeur J, Christophe A, Champolivier L, Debaeke P (2011) Sunflo, a model to simulate genotype-specific performance of the sunflower crop in contrasting environments. Agricultural and forest meteorology 151(2):163–178 Chen C, Li K (1998) Can SIR be as popular as multiple linear regression? Statistica Sinica 8:289–316 Chen S, Donoho D, Saunders M (2015) Atomic decomposition by basis puirsuit. SIAM Journal on Scientific Computing 20(1):33–61 Cook R (2004) Testing predictor contributions in sufficient dimension reduction. Annals of Statistics 32(3):1061–1092 Cook R, Yin X (2001) Dimension reduction and visualization in discriminant analysis. Australian & Aneiros G, Vieu P (2014) Variable in infiniteNew-Zealand Journal of Statistics 43(2):147–199 15 Coudret R, Liquet B, Saracco J (2014) Com- Friedman J, Hastie T, Tibshirani R (2010) Reguparison of sliced inverse regression aproaches larization paths for generalized linear models via for undetermined cases. Journal de la Société coordinate descent. Journal of Statistical Software Française de Statistique 155(2):72–96, URL 33(1):1–22 http://journal-sfds.fr/index.php/J-SFdS/ Fromont M, Tuleau C (2006) Functional classificaarticle/view/278 tion with margin conditions. In: Lugosi G, Simon H (eds) Proceedings of the 19th Annual ConferDauxois J, Ferré L, Yao A (2001) Un modèle ence on Learning Theory (COLT 2006), Springer semi-paramétrique pour variable aléatoire hilber(Berlin/Heidelberg), Pittsburgh, PA, USA, Lectienne. Comptes Rendus Mathématique Académie ture Notes in Computer Science, vol 4005, pp 94– des Sciences Paris 327(I):947–952, DOI 10.1016/ 108, DOI 10.1007/11776420 10 S0764-4442(01)02163-2 Fauvel M, Deschene C, Zullo A, Ferraty F (2015) Fast Fruth J, Roustant O, Kuhnt S (2015) Sequential designs for sensitivity analysis of functional inputs in forward feature selection of hyperspectral images computer experiments. Reliability Engineering & for classification with Gaussian mixture models. System Safety 134:260–267 IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing 8(6):2824–2831, Golub T, Slonim D, Wahba G (1979) GeneralDOI 10.1109/JSTARS.2015.2441771 ized cross-validation as a method for choosing a good ridge parameter. Technometrics 21(2):215– Ferraty F, Hall P (2015) An algorithm for nonlin223, DOI 10.2307/1268518 ear, nonparametric model choice and prediction. Journal of Computational and Graphical Statis- Grollemund P, Abraham C, Baragatti M, Pudlo P tics 24(3):695–714, DOI 10.1080/10618600.2014. (2018) Bayesian functional linear regression with 936605 sparse step functions, preprint arXiv 1604.08403 Ferraty F, Hall P, Vieu P (2010) Most-predictive design points for functiona data predictors. Biometrika 97(4):807–824, DOI 10.1093/biomet/ asq058 Hastie T, Tibshirani R, Friedman J (2001) The Elements of Statistical Learning. Data Mining, Inference and Prediction, Springer-Verlag, New York, USA Ferré L (1998) Determining the dimension in sliced Hernández N, Biscay R, Villa-Vialaneix N, Talavera inverse regression and related methods. Journal of I (2015) A non parametric approach for calibration the American Statistical Association 93(441):132– with functional data. Statistica Sinica 25:1547– 140, DOI 10.1080/01621459.1998.10474095 1566, DOI 10.5705/ss.2013.242 Ferré L, Villa N (2006) Multi-layer perceptron with James G, Wang J, Zhu J (2009) Functional linear functional inputs: an inverse regression approach. regression that’s interpretable. Annals of Statistics Scandinavian Journal of Statistics 33(4):807–823, 37(5A):2083–2108, DOI 10.1214/08-AOS641 DOI doi:10.1111/j.1467-9469.2006.00496.x Kneip A, Poß D, Sarda P (2016) Functional linear reFerré L, Yao A (2003) Functional sliced inverse regression with points of impact. Annals of Statistics gression analysis. Statistics 37(6):475–488 44(1):1–30, DOI 10.1214/15-AOS1323 Fraiman R, Gimenez Y, Svarc M (2016) Feature se- Li K (1991) Sliced inverse regression for dimension reduction. Journal of the American Statislection for functional data. Journal of Multivariate tical Association 86(414):316–342, URL http:// Analysis 146:191–208, DOI 10.1016/j.jmva.2015. www.jstor.org/stable/2290563 09.006 16 Li L, Nachtsheim C (2008) Sparse sliced inverse regression. Technometrics 48(4):503–510 Schott J (1994) Determining the dimensionality in sliced inverse regression. Journal of the American Statistical Association 89(425):141–148 Li L, Yin X (2008) Sliced inverse regression with Simon N, Friedman J, Hastie T, Tibshirani R (2013) regularizations. Biometrics 64(1):124–131, DOI A sparse-group lasso. Journal of Computational 10.1111/j.1541-0420.2007.00836.x and Graphical Statistics 22:231–245, DOI 10.1080/ 10618600.2012.681250 Lin Q, Zhao Z, Liu J (2018) On consistency and sparsity for sliced inverse regression in high dimensions. Tibshirani R, Saunders G, Rosset S, Zhu J, Knight J Annals of Statistics Forthcoming (2005) Sparsity and smoothness via the fused lasso. Journal of the Royal Statistical Society, Series B Liquet B, Saracco J (2012) A graphical tool for se67(1):91–108 lecting the number of slices and the dimension of the model in SIR and SAVE approches. Computational Statistics 27(1):103–125 Zhao Y, Ogden R, Reiss P (2012) Wavelet-based LASSO in functional linear regression. Journal of Computational and Graphical Statistics 21(3):600– 617, DOI 10.1080/10618600.2012.679241 Matsui H, Konishi S (2011) Variable selection for functional regression models via the l1 regularization. Computational Statistics and Data Analysis Zhu L, Miao B, Peng H (2006) On sliced in55(12):3304–3310, DOI 10.1016/j.csda.2011.06.016 verse regression with high-dimensional covariates. Journal of the American Statistical Association McKeague I, Sen B (2010) Fractals with point impact 101(474):360–643 in functional linear regression. Annals of Statistics 38(4):2559–2586, DOI 10.1214/10-AOS791 Meyer D, Dimitriadou E, Hornik K, Weingessel A, Leisch F (2015) e1071: Misc Functions of the Department of Statistics, Probability Theory Group (Formerly: E1071), TU Wien. R package version 1.6-7 Ni L, Cook D, Tsai C (2005) A note on shrinkage sliced inverse regression. Biometrika 92(1):242–247 Park A, Aston J, Ferraty F (2016) Stable and predictive functional domain selection with application to brain images, preprint arXiv 1606.02186 Portier F, Delyon B (2014) Bootstrap testing of the rank of a matrix via least-square constrained estimation. Journal of the American Statistical Association 109(505):160–172, DOI 10.1080/01621459. 2013.847841 Rasmussen C, Williams C (2006) Gaussian Processes for Machine Learning. The MIT Press, Cambridge, MA, USA 17
10math.ST
Safety-Aware Optimal Control of Stochastic Systems Using Conditional Value-at-Risk arXiv:1802.07903v1 [math.OC] 22 Feb 2018 Samantha Samuelson Abstract— In this paper, we consider a multi-objective control problem for stochastic systems that seeks to minimize a cost of interest while ensuring safety. We introduce a novel measure of safety risk using the conditional value-at-risk and a set distance to formulate a safety risk-constrained optimal control problem. Our reformulation method using an extremal representation of the safety risk measure provides a computationally tractable dynamic programming solution. A useful byproduct of the proposed solution is the notion of a risk-constrained safe set, which is a new stochastic safety verification tool. We also establish useful connections between the risk-constrained safe sets and the popular probabilistic safe sets. The tradeoff between the risk tolerance and the mean performance of our controller is examined through an inventory control problem. I. I NTRODUCTION Control and verification of safety-critical systems have been an important problem in many domains such as air traffic control, autonomous vehicles, robotics, energy systems, and food supply chains. A part of such systems can often be modeled as a stochastic system due to the environmental and/or model uncertainty. To verify that a stochastic system is evolving within a safe range of operation with a prespecified probability and to construct an associated safetypreserving controller, several reachability-based tools have been developed using Markov chain approximations [1], Hamilton-Jacobi-Isaacs reachability [2], barrier certificates [3], dynamic programming for probabilistic safe sets [4], and infinite-dimensional linear programming [5], among others. However, ensuring safety may not be the only objective in practice: it is also desirable to minimize a cost function of interest by employing an optimal controller. Even with the aforementioned verification tools, multi-objective stochastic optimal control of safety-critical systems is challenging. One safety-oriented suboptimal approach is to use a safe control action whenever the system ventures near the boundary of a probabilistic safe set; otherwise, an optimal control action is used [6]. A lexicographic optimal control approach has been proposed in [7] to guarantee that the probability for a system being safe is close to the maximum possible safety probability. On the other hand, [8] uses linear temporal logic as a constraint to enforce safety with probability 1 in an optimal control problem. Departing from such probabilistic and temporal logicbased methods, this paper proposes a risk-based approach to solving safety-aware optimal control of stochastic systems. This work is supported in part by NSF under ECCS-1708906 and CNS1657100. S. Samuelson and I. Yang are with the Electrical Engineering Department, University of Southern California, Los Angeles, CA 90089, USA. {sasamuel, insoonya}@usc.edu Insoon Yang Our method employs the conditional value-at-risk (CVaR) and a set distance to measure the risk of a system being unsafe. By solving an optimal control problem with associated safety risk constraints, we can design a control strategy that minimizes a cost function of interest while limiting the risk of unsafety. Unlike the probabilistic methods [6], [7], our proposed method does not require us to separately solve a verification problem to compute probabilistic safe sets or safe control policies. In other words, the risk-based approach merges the verification and optimal control procedures into a single step. A useful byproduct of our risk-constrained optimal control method is a novel verification tool, called the risk-constrained safe set. Such a set contains all initial states that can be driven to satisfy all safety risk constraints by an admissible control policy. The contributions of this work can be summarized as follows. First, we introduce a novel measure of safety risk by using CVaR and the distance between the system state and a desired set A for safety. This safety risk measure represents the conditional expectation of the distance between the state and A within the (1−α) worst-case quantile of an associated safety loss distribution, where α ∈ (0, 1). Our method enjoys an important advantage of CVaR over the value-at-risk (VaR) or the chance constraints that CVaR takes into account the possibility of tail events in which safety losses exceed VaR while VaR is incapable of distinguishing situations beyond VaR [9]. Second, we develop a computationally tractable dynamic programming solution through two reformulation procedures. The first step reformulates the CVaR constraint in an associated Bellman equation into a tractable expectation constraint. The second step removes the minimization problem for computing a set distance from the constraint in the case of finitely supported disturbance distributions. As a result, the reformulated Bellman equation can be solved by existing convex optimization algorithms when the system dynamics are affine and the cost function is convex. Third, we establish interesting connections between the proposed risk-constrained safe sets and the popular probabilistic safe sets. In addition, we propose a simple method to compute the risk-constrained safe sets from the Bellman equation. The tradeoff between the mean performance and risk tolerance of our controller is also studied through an example of stochastic inventory control. The remainder of this paper is organized as follows. Section II introduces the safety risk measure and an associated safety-aware optimal control problem. Its dynamic programming solution is developed in Section III. The connections between risk-constrained safe sets and probabilistic safe sets are discussed in Section IV. The performance and risk aversion of the designed controller are demonstrated in Section V through an application to inventory control. II. S ET D ISTANCE -BASED S AFETY R ISK Consider the following discrete-time stochastic system: xt+1 = f (xt , ut , wt ), (1) where xt ∈ Rn is the system state. The control input ut is assumed to lie in a convex set U ⊆ Rm . The stochastic disturbance wt ∈ W ⊆ Rl is defined on a standard filtered probability space (Ω, F, {Ft }t≥0 , P). Note that with the filtration {Ft }t≥0 , wt is Ft -measurable and thus so is xt+1 . We say that the system is safe at stage t if xt lies in a desired set A for safety, where A is a compact Borel set in Rn . The set A represents a safe range of operation in the state space. Such a setting has been extensively used in the literature of stochastic reachability analysis (e.g., [4]). As a first step to unify the safety specification and optimal control of stochastic systems, we propose a novel notion of safety risk using set distance and Conditional Value-at-Risk in the following subsection. A. Safety Specification Using Conditional Value-at-Risk For stochastic systems of the form (1), we can measure the loss of safety or the degree of unsafety at stage t as the distance between xt and the set A. The distance between a point x ∈ Rn and a set A ⊆ Rn is defined as follows: dist(x, A) := inf kx − yk. y∈A (2) If the system is safe at stage t, i.e., xt ∈ A, then the loss of safety dist(xt , A) = 0. On the other hand, when the system is unsafe, i.e., xt ∈ / A, the loss of safety increases as xt moves farther from the desired set A. Note that x 7→ dist(x, A) is convex due to the triangular inequality when the set A is convex. In addition, there exists a minimizer if the set A is compact. We assume that our desired set A for safety is convex and compact. To quantify safety risk, we adopt Conditional Value-atRisk (CVaR) among several risk measures that are coherent in the sense of Artzner et al. [10]. CVaR measures the expected value conditioned on being within a user-specified percentage ((1 − α) × 100%) of the worst-case loss scenario. CVaR of a random loss X is defined as1 CVaRα (X) := E[X | X ≥ VaRα (X)] with α ∈ (0, 1), where the value-atrisk (VaR) of X (with the cumulative distribution function FX ) is defined as VaRα (X) := inf{x ∈ R | FX (x) ≥ α}. The following extremal representation of CVaR is particularly useful in optimization of CVaR [11], [9]:   (X − z)+ . (3) CVaRα (X) = min E z + z∈R 1−α Suppose that the minimization problem above has a unique optimal solution. Then, the optimal solution corresponds to 1 This definition is valid when the probability distribution of X has no atom. For the definition of CVaR in general cases, refer to [9]. VaR at probability α, and CVaR represents VaR plus the expected safety losses exceeding VaR divided by 1 − α. Using CVaR, we can quantify the risk of the system unsafety at stage t + 1 given the information collected up to stage t − 1 as CVaRα [dist(xt+1 , A) | Ft−1 ] :=   (4) (dist(xt+1 , A) − Z)+ min Z +E | Ft−1 , 1−α Z∈L2 (Ω,Ft−1 ,P) which is a random variable adapted to Ft−1 . The safety risk (4) measures the conditional expectation of the distance between xt+1 and the desired set A within the (1 − α) worst-case quantile of the safety loss distribution. Note that we use the conditional version of CVaR (conditioned on Ft−1 ) [12], [13], which is not only practical but also essential to formulate an optimal control problem in a time-consistent way as explained in Section III-A. B. Safety-Aware Stochastic Optimal Control Our goals in designing a controller are twofold: while controlling the system (1), we want (i) to limit the safety risk (4) by a predefined threshold δ and (ii) to minimize a cost function of interest. These objectives can be achieved by solving the following risk-constrained stochastic optimal control problem:   TX −1 π min E r(xt , ut ) + q(xT ) π∈Π (5) t=0 s.t. CVaRπα [dist(xt+1 , A) | Ft−1 ] ≤ δ, t ∈ T , where r : Rn × Rm → R and q : Rn → R are a stagewise and terminal cost function of interest, respectively, and T := {0, 1, · · · , T − 1}. Here, the set Π of admissible control strategies is given by Π := {π := (π0 , · · · , πT −1 ) | πt (U|ht ) = 1 ∀ht ∈ Ht }, where Ht is the set of histories up to stage t whose element is of the form ht := (x0 , w0 , · · · , xt−1 , wt−1 , xt ) and πt is a stochastic kernel from Ht to U. In addition, Eπ and CVaRπα represent the expectation and CVaR taken with respect to the probability measure induced by a control strategy π. The risk tolerance parameter δ is nonnegative to be consistent with the nonnegativity of dist(xt+1 , A). When δ = 0, xt+1 must lie in the set A with probability 1, and thus the risk constraint becomes a hard (deterministic) constraint. The threshold δ is a user-specified design parameter and has a practical meaning: δ represents the maximum allowable expected deviation of the state from the set A conditioned on being in the (1 − α) worst-case quantile. The effect of δ on the minimal cost depends on problem instances and is studied through an example in Section V. III. DYNAMIC P ROGRAMMING AND C ONVEXITY A. Time-Consistency and Bellman Equation Suppose for a moment that we employ different safety risk constraints of the form CVaRα [dist(xs+1 , A) | F0 ] ≤ δ ∀s ∈ T . In words, we guarantee the risk constraints assuming that all of them are viewed at stage 0 with no information. The tower rule (or the law of total expectation) does not hold for CVaR. Thus, CVaRα [CVaRα [dist(xt+1 , A) | Ft−1 ] | F0 ] 6= CVaRα [dist(xt+1 , A) | F0 ], which implies that the risk constraint may be violated when evaluated at stage t with information collected up to stage t − 1. Therefore, this problem formulation is time-inconsistent, meaning that an optimal control strategy constructed before or at stage 0 is no longer optimal when viewed at later stages [14]. Dynamic programming is not directly applicable to such a timeinconsistent problem as we cannot break the problem into sub-problems whose optimal solutions can be used to solve the original problem. There are two main paths to resolve the issue of time-inconsistency. The first is to focus on optimal pre-commitment strategies that are optimal viewed only at stage 0, and cannot be revised at later stages. Several techniques have been developed to compute an optimal precommitment strategy for optimal control of CVaR [15], [16], [17], [18], [19], [20]. The second strategy is to employ timeconsistent dynamic risk measures that guarantee the timeconsistency of the control problem [14], [13], [21], [22]. This approach requires special care when interpreting the practical meaning of such risk measures as they are usually defined as a composition of multiple conditional risk mappings. Our problem formulation is closely related with the second approach: our conditional version of CVaR (4) ensures the time-consistency of the optimal control problem (5). By solving (5), a control strategy is designed offline before stage 0 to satisfy the risk constraint CVaRα [dist(xt+1 , A) | Ft−1 ] ≤ δ at stage t using information gathered up to stage t − 1. Thus, the designed control strategy ensures the risk constraint when viewed and evaluated at stage t. To check the applicability of dynamic programming, we decompose (5) into multiple sub-problems whose optimal solutions can be used to design an optimal strategy for (5). We define the value function associated with (5) as follows: vt (x) := inf Eπ π∈Π s.t  TX −1 We can significantly simplify the Bellman equation by reformulating the CVaR constraints as expectation constraints. Theorem 1 (Bellman equation I). The value function defined in (6) satisfies the following Bellman equation: vt (x) = inf r(x, u) + E[vt+1 (f (x, u, wt ))]   (dist(f (x, u, wt ), A) − z)+ ≤δ s.t. E z + 1−α (8) u∈U,z∈R for t ∈ T with vT (x) = q(x). Proof. Using the dynamic programming principle, we have vt (x) = inf u∈U r(x, u) + E[vt+1 (f (x, u, wt ))] s.t CVaRα [dist(f (x, u, wt ), A)] ≤ δ, which is equivalent to (7). We denote the right-hand side of (8) as v̂t (x) and show that v̂t = vt . To show that v̂t (x) ≤ vt (x) fixing an arbitrary x ∈ Rn , we first note that for any  > 0 there exists u? ∈ U such that vt (x) +  > r(x, u? ) + E[vt+1 (f (x, u? , wt ))] (9) and CVaRα [dist(f (x, u? , wt ), A)] ≤ δ. By the extremal representation (3) of CVaR, the second inequality is equivalent to   (dist(f (x, u? , wt ), A) − z)+ min E z + ≤ δ, z∈R 1−α which implies that there exists z ? ∈ R such that   (dist(f (x, u? , wt ), A) − z ? )+ E z? + ≤ δ. 1−α Combining this with the inequality (9), we have  r(xs , us ) + q(xT ) | xt = x s=t CVaRπα [dist(xs+1 , A) | Fs−1 ] ≤ δ, s vt (x) +  > inf r(x, u) + E[vt+1 (f (x, u, wt ))]   (dist(f (x, u, wt ), A) − z)+ ≤ δ. s.t. E z + 1−α u∈U,z∈R ∈ Tt , (6) which represents the minimum expected cost-to-go given the safety risk constraints are satisfied for all stages from t to T − 1, where Tt := {t, t + 1, · · · , T − 1}. We now use backward induction to confirm that the subproblems (6) can be used to solve (5). Note that vT is given by q. Suppose now that vt+1 is known. Then, vt (x) = inf E[r(x, u) + vt+1 (f (x, u, wt ))] u∈U s.t. CVaRα [dist(xt+1 , A) | Ft−1 ] ≤ δ Letting  → 0, we have v̂t (x) ≤ v(x). We now show that v̂t (x) ≥ v(x). For any  > 0, there exists (û, ẑ) ∈ U × R such that v̂t (x) +  > r(x, û) + E[vt+1 (f (x, û, wt ))] and (7) because the risk constraints for s ∈ Tt+1 are considered in the optimization problem (6) for vt+1 . However, the Bellman equation (7) involves a triple-level minimization problem with (i) the outer minimization problem over u, (ii) the middle-level minimization problem (4) for CVaR and (iii) the inner minimization problem (2) for the distance function.   (dist(f (x, û, wt ), A) − ẑ)+ ≤ δ. E ẑ + 1−α Due to the extremal formula (3) of CVaR, the second inequality implies that CVaRα [dist(f (x, û, wt ), A)] ≤ δ. Therefore, v̂t (x) +  > vt (x), which implies that v̂t (x) ≥ vt (x) as  → 0. The minimization problem in the reformulated Bellman equation (8) is a computationally tractable stochastic program while the original Bellman equation (7) involves a nontrivial CVaR constraint. A similar reformulation approach has been proposed by Krokhmal et al. [23] in the context of single-stage optimization with CVaR constraints. Unlike their method based on the Karush-Kuhn-Tucker conditions, however, our proof does not assume the existence of an optimal solution uopt or the convexity of the objective and constraint functions. In other words, the proposed method not only yields a computationally tractable version of the Bellman equation but also broadens the applicability of the efficient reformulation method in [23] for CVaR-constrained optimization. We will further enhance the computational tractability of (8) in Section III-C. B. Convexity of Value Functions We now provide conditions under which the stochastic program in the Bellman equation (8) and the value function vt are convex. Proposition 1. Suppose that (x, u) 7→ f (x, u, w) is affine on Rn × U for each w ∈ W, r is convex on Rn × U, and q is convex on Rn . Then, the value function vt is convex on Rn for all t ∈ T̄ . Proof. We use mathematical induction backward in time. At stage T , vT = q is convex on Rn . Suppose now that vt+1 is convex on Rn . At stage t, fix two arbitrary states x1 , x2 ∈ Rn . Due to the Bellman equation (8), for any  > 0 there exists (ui , z i ) ∈ U × R, i = 1, 2, such that i i i i i vt (x ) +  > r(x , u ) + E[vt+1 (f (x , u , wt ))] (10) and   (dist(f (xi , ui , wt ), A) − z i )+ ≤ δ. E zi + 1−α λ 1 2 n λ λ Let x := λx + (1 − λ)x ∈ R and (u , z ) := λ(u1 , z 1 ) + (1 − λ)(u2 , z 2 ) ∈ U × R. We first note that (x, u) 7→ dist(g(x, u, wt ), A) is convex for each wt ∈ W since x 7→ dist(x, A) is convex and (x, u) 7→ f (x, u, wt ) is affine. Thus, (x, u, z) 7→ (dist(f (x, u, wt ), A) − z)+ is convex for each wt ∈ W as a 7→ (a)+ is a convex increasing function. Therefore,   (dist(f (xλ , uλ , wt ), A) − z λ )+ E zλ + 1−α   1 (dist(f (x , u1 , wt ), A) − z 1 )+ 1 ≤ λE z + 1−α   (dist(f (x2 , u2 , wt ), A) − z 2 )+ 2 + (1 − λ)E z + 1−α ≤ λδ + (1 − λ)δ = δ. This implies that (uλ , z λ ) is a feasible solution of the minimization problem in (8) with x = xλ . Thus, vt (xλ ) ≤ r(xλ , uλ ) + E[vt+1 (f (xλ , uλ , wt ))]. Since r is convex on Rn ×U and (x, u) 7→ vt+1 (f (x, u, wt )) is convex due to the induction hypothesis, we have vt (xλ ) ≤ λr(x1 , u1 ) + (1 − λ)r(x2 , u2 ) + E[λvt+1 (f (x1 , u1 , wt )) + (1 − λ)vt+1 (f (x2 , u2 , wt ))]. Combining this inequality with (10), we finally obtain vt (xλ ) < λvt (x1 ) + (1 − λ)vt (x2 ) + . Letting  → 0, we conclude that x 7→ vt (x) is convex on Rn . This completes our inductive argument. Since vt is convex for all t ∈ T under the conditions in Proposition 1, the objective function of the stochastic program in the Bellman equation (8) is convex. The constraint is also convex since u 7→ f (x, u, wt ) is affine for each (x, wt ) and x 7→ dist(x, A) is convex. Therefore, the stochastic program in (8) is convex. This convexity is also used in our numerical experiments in Section V to approximate vt as the convex envelope of vt discretized over x. C. Finitely Supported Disturbance Distributions We now consider the case of finitely supported disturbance distributions. This case is practically important as most empirical distributions directly obtained from data have a finite support. Furthermore, the popular sample average approximation (e.g., [24]) reduces the control problem (5) with an infinite support to the case of finitely supported disturbance distributions. Suppose that the support W of the disturbance distribution is given by W := {w(i) ∈ Rl | i = 1, · · · , N }, (11) which is a finite set. In this case, we can further simplify the Bellman equation (8) as the following deterministic optimization problem by removing the set distance function from the constraints. Theorem 2 (Bellman equation II). Suppose that the disturbance distribution has a finite support of the form (11). Then, the Bellman equation (8) is equivalent to vt (x) = inf u∈U,y∈AN ,z∈R r(x, u) + N 1 X vt+1 (f (x, u, w(i) )) N i=1 PN s.t. z + ) − y (i) k − z)+ ≤δ N (1 − α) i=1 (kf (x, u, w (i) for t ∈ T with vT (x) = q(x). Proof. Let ṽt (x) be the right-hand side of the equality above. With the support (11), the constraint in the Bellman equation (8) can be rewritten as PN (dist(f (x, u, w(i) ), A) − z)+ z + i=1 ≤ δ, N (1 − α) where dist(f (x, u, w(i) ), A) = miny(i) ∈A kf (x, u, w(i) ) − y (i) k since A is compact and convex. Using an argument similar to the proof of Theorem 1, we have that ṽt = vt . Under the conditions in Proposition 1, the simplified Bellman equation involves a deterministic convex program, which can be efficiently solved by several existing convergent algorithms. The dimension of its optimization variable linearly increases the cardinality N of the support W. It is worth mentioning that our focus is not to resolve the fundamental scalability issue in dynamic programming: the computational complexity of our approach scales exponentially with the dimension n of state space as in standard dynamic programming. The major advantage of our method is to reformulate the triple-level optimization problem in the original Bellman equation (7) as a tractable single-level optimization problem. Proposition 2. If the risk threshold parameter δ = 0, then the risk-constrained safe set RSα (A) is a subset of the probabilistic safe set Sα (A). Furthermore, IV. R ISK -C ONSTRAINED S AFE S ETS which implies that x ∈ S1 (A). The reverse of the aforementioned argument is also valid. Thus, if x ∈ S1 (A), then x ∈ RSα,0 (A). Note also that S1 (A) ⊆ Sα (A) for any α ∈ (0, 1), the statement in the proposition holds. So far, we have viewed the CVaR-based safety risk as a constraint of an optimal control problem. In this section, we illustrate how the safety risk can be used to verify the safety of stochastic systems. A. Connection to Probabilistic Reachability Analysis We begin by establishing a few interesting connections between our risk-based approach and the probabilistic safety/reachability specifications. To verify that a stochastic system starting from a particular initial point can be controlled to operate in a safe range A with a pre-specified probability α, one can use the probabilistic safe set, defined as Sα (A) := {x ∈ Rn | ∃π ∈ Π s.t. x0 = x, Pπ (xt ∈ A, t = 1, · · · , T ) ≥ α}. If x0 ∈ Sα (A), then there exists a control strategy that guarantees the system safety with probability greater than or equal to α. Dynamic programming-based tools to compute such probabilistic safe sets have been developed for stochastic hybrid systems (SHS) [4], [25], [26], partially observable SHS [27], and stochastic systems under distributional ambiguity [6]. Departing from these tools for probabilistic safe sets, our risk-constrained method provides the following novel safe sets that can also be used for safety specification and verification: Definition 1 (Risk-constrained safe set). We define the riskconstrained safe set for A as RSα,δ (A) := {x ∈ Rn | ∃π ∈ Π s.t. x0 = x, CVaRπα [dist(xt+1 , A) | Ft−1 ] ≤ δ, t ∈ T } for some α ∈ (0, 1) and δ ≥ 0. In words, whenever x0 ∈ RSα,δ (A), we can control the system to satisfy the CVaR-based safety constraint for all stages. We will introduce a method to compute the riskconstrained safe sets in the next subsection. Before this, we take a close look at the CVaR constraint to relate RSα,δ (A) with Sα (A). Our first observation is that when δ = 0, dist(xt+1 , A) = 0 with probability 1 because (i) its (1 − α) worst-case quantile is less than or equal to zero and (ii) the distance is greater than or equal to zero by definition. This observation leads to the following proposition: RSα,0 (A) = S1 (A) ⊆ Sα (A) ∀α ∈ (0, 1). Proof. Fix the initial state x0 as x ∈ RSα,0 (A) for δ = 0. Then, there exists a strategy π ∈ Π such that for each α ∈ (0, 1), Pπ (dist(xt+1 , A) = 0 | xt , · · · , x1 ) = Pπ (xt+1 ∈ A | xt , · · · , x1 ) = 1 for all t ∈ T . Due to the chain rule, Pπ T \ T t−1  Y   \ {xt ∈ A} = Pπ xt ∈ A | {xs ∈ A} = 1, t=1 t=1 s=1 Proposition 2 implies that RSα,0 (A) can be used for very conservative decision-making in terms of safety via hard constraints. When δ > 0, we have another interesting connection between risk-constrained and probabilistic safe sets as follows: Proposition 3. Let Aδ := {x ∈ Rn | dist(x, A) ≤ δ} for any δ > 0. Then, the risk-constrained safe set RSα,δ (A) is a subset of the probabilistic safe set SαT (Aδ ), i.e., RSα,δ (A) ⊆ SαT (Aδ ). Proof. Choose an arbitrary initial state x from RSα,δ (A). Then, there exists a control policy π ∈ Π such that for each α ∈ (0, 1), Pπ (dist(xt+1 , A) ≤ δ | xt , · · · , x1 ) = Pπ (xt+1 ∈ Aδ | xt , · · · , x1 ) ≥ α for all t ∈ T .TThe chain T rule for conditional probability implies that Pπ ( t=1 {xt ∈ QT Tt−1 π Aδ }) = t=1 P (xt ∈ Aδ | s=1 {xs ∈ Aδ }) ≥ αT . Thus, x ∈ SαT (Aδ ) for each α ∈ (0, 1). Due to the definition of set distance-based safety risk, Proposition 3 compares RSα,δ (A) with the probabilistic safe set for a relaxed desirable set Aδ . To compare with Sα (A) instead of Sα (Aδ ), it is often useful to consider RSα,δ (A−δ ), which is contained in SαT (A), where A−δ := {x ∈ Rn | dist(x, Ac ) ≥ δ} for δ > 0. B. From Value Functions to Risk-Constrained Safe Sets We now propose a simple approach to computing the riskconstrained safe sets by using the value function of (5). The key idea is that x ∈ RSα,δ (A) if the control problem (5) with x0 = x has a non-empty feasible set. Theorem 3. Suppose that r(x, u) < +∞ ∀u ∈ U, q(x) < +∞ for each x ∈ Rn . Then, the risk-constrained safe set can be computed as RSα,δ (A) = {x ∈ Rn | v0 (x) < +∞}. Proof. Fix x ∈ RSα,δ (A). Then, there exists a control policy π̂ ∈ Π such that CVaRπ̂α [dist(xt+1 , A) | Ft−1 ] ≤ δ, t ∈ T , 350 140 130 300 120 250 100 200 90 v0 minimal cost 110 80 =1 150 70 100 60 50 40 = 20 50 0 2 4 6 8 10 12 14 16 δ Fig. 1: Minimal expected cost over independent simulations for several different parameters δ. where x0 = x. Suppose thatPv0 (x) = +∞. Since π̂ satisfies T −1 all the risk constraints, Eπ̂ [ t=0 r(xt , ut ) + q(xT ) | x0 = x] ≥ v0 (x) = +∞. However, r(xt , ut ) < +∞ ∀t ∈ T and q(xT ) < +∞ under the policy π̂. This is a contradiction and thus v0 (x) < +∞. We now choose an arbitrary initial state x0 = x such that v0 (x) PT<−1+∞. For any  > 0, there exists π̃ ∈ Π such that Eπ̃ [ t=0 r(xt , ut ) + q(xT ) | x0 = x] < vt (x) +  < +∞. Thus, CVaRπ̃α [dist(xt+1 , A) | Ft−1 ] ≤ δ, t ∈ T , where x0 = x. This implies that x ∈ RSα,δ (A). By Theorem 3, we can use our dynamic programming solution of (5) in two useful ways. First, we can verify whether a given initial state x0 will satisfy all the safety risk constraints by checking the value v0 (x0 ). Second, we can explicitly construct an optimal risk-averse policy π opt of (5) by solving associated Bellman equations backward in time. In particular, under the measurable selection condition (e.g., [28]), the Bellman equation admits an optimal solution uopt for each (t, x) and thus one can construct a non-randomized Markov policy, which is optimal, by letting πtopt (x) := uopt . V. A PPLICATION TO I NVENTORY C ONTROL To demonstrate the advantages of using our approach in a realistic problem, we examine an inventory control model. We define the state evolution function as xt+1 = xt + ut − wt , where ut is the quantity ordered/received at stage t, wt is the demand at stage t, and xt is the current inventory level. The control is bounded by u ∈ [0, 32], and we use a time horizon of one week, i.e., T := {0, 1, · · · , 7}. Any demand that is left unsatisfied is backlogged for the next stage, which is represented as a negative state value. We define the stagewise cost as r(xt , ut , wt ) := co (xt + ut − wt )+ + cu (wt − xt − ut )+ , where co = 1 represents the holding or storage cost and cu = 1 represents the cost of lost sales due to unavailable inventory. The desired set for safety is chosen as A = [0, 100]. We use N = 40 samples of wt , generated from the distribution wt ∼ N (20, 6). 0 0 20 40 60 80 100 120 x0 (initial state) Fig. 2: Value function v0 (minimal expected cost) for δ = 1, · · · , 20 on {x0 : v0 (x0 ) < +∞}. We first examine the tradeoff between the mean performance and the risk tolerance of our controller. Fig. 1 shows the mean total cost over independent simulations for several different risk tolerance values δ when α = 0.90. As the constraint is tightened by decreasing δ, the mean total cost increases. Having a larger δ corresponds to a larger allowable deviation from the desired set A, so the total cost decreases. The choice of optimal δ thus depends on the designer’s preference for either a low-risk or a low-cost controller. Fig. 2 plots the value function at stage t = 0, for various values of δ. Here, we can see how higher values of δ generate lower expected costs. This figure also shows another effect of tightening the CVaR constraint: the set RSα,δ (A) of feasible initial states becomes smaller as δ decreases. Let RSα,δ,t (A) be the time-dependent risk-constrained safe set initialized at stage t, that is the set of xt ’s for which the CVaR constraint can be satisfied at all future times. As shown in Fig. 3, the time-dependent safe set shrinks as we move backwards in time. A state at stage t is feasible and is in the time-dependent risk-constrained safe set if a control value can be found that satisfies two constraints: (i) CVaRα [dist(xt+1 , A) | Ft−1 ] must be no greater than δ and (ii) the future state must fall within the safe set in the next stage. The second constraint is strict and must hold for even the largest possible demand wt . The state at stage t must be large enough that even if we encounter the maximum demand max{w(i) } > umax := 32, which leads to xt+1 = xt +umax −max{w(i) } < xt , the future state remains within the safe set. This leads to the minimum feasible state at stage t being larger than the minimum feasible state at stage t+1. By a similar logic, the upper bound of RSα,δ,t (A) is no smaller at time t than t + 1 since min{w(i) } > 0. In this case, however, the CVaR constraint (i) is tighter than the constraint (ii)–the state at stage t must be small enough to guarantee the probability of exceeding Amax := 100 is small. We observe that the largest state for which the CVaR constraint is satisfied is constant across all of the stages. For this reason, the upper bound of RSα,δ,t (A) is also constant across all stages in this example. 7 6 time (day) 5 4 3 2 1 0 -1 0 20 40 60 80 100 120 x (state) Fig. 3: Time-dependent risk-constraint safe set RSα,δ,t for t = 0, · · · , 6. VI. C ONCLUSIONS AND F UTURE W ORK A risk-based approach has been proposed for safetyaware optimal control of stochastic systems. We developed a computationally tractable dynamic programming solution, which provides a risk-constrained optimal controller and safe set. The latter can be used for verifying the safety of stochastic systems in a risk-constrained manner while enjoying useful connections with probabilistic safe sets. We also identified the tradeoff between the risk tolerance and mean performance of our controller through a numerical example. This approach can be extended in several interesting ways. To alleviate the dimensionality issue in our dynamic programming solution, it is worth exploring an occupation measurebased method. Furthermore, a distributionally robust control tool can immunize the proposed controller from potential errors in the probability distribution of disturbances. R EFERENCES [1] J. Hu, M. Prandini, and S. Sastry, “Aircraft conflict prediction in the presence of a spatially correlated wind field,” IEEE Transactions on Intelligent Transportation Systems, vol. 6, no. 3, pp. 326–340, 2005. [2] I. M. Mitchell and J. A. Templeton, “A toolbox of hamilton- jacobi solvers for analysis of nondeterministic continuous and hybrid systems,” in International Workshop on Hybrid Systems: Computation and Control. Springer, 2005. [3] S. Prajna, A. Jadbabaie, and G. J. Pappas, “A framework for worstcase and stochastic safety verification using barrier certificates,” IEEE Transactions on Automatic Control, vol. 52, no. 8, pp. 1415–1429, 2007. [4] A. Abate, M. Prandini, J. Lygeros, and S. Sastry, “Probabilistic reachability and safety for controlled discrete time stochastic hybrid systems,” Automatica, vol. 44, no. 11, pp. 2724–2734, 2008. [5] N. Kariotoglou, M. Kamgarpour, T. H. Summers, and J. Lygeros, “The linear programming approach to reach-avoid problems for Markov decision processes,” Journal of Artificial Intelligence Research, accepted. [6] I. Yang, “A dynamic game approach to distributionally robust safety specifications for stochastic systems,” Automatica, accepted. [7] K. Lesser and A. Abate, “Multiobjective optimal control with safety as a priority,” IEEE Transactions on Control Systems Technology, accepted. [8] M. Svoreňová, I. Černá, and C. Belta, “Optimal control of MDPs with temporal logic constraints,” in Proceedings of the 52nd IEEE Conference on Decision and Control, 2013. [9] R. T. Rockafellar and S. Uryasev, “Conditional value-at-risk for general loss distribution,” Journal of Banking & Finance, vol. 26, pp. 1443–1471, 2002. [10] P. Artzner, F. Delbaen, J.-M. Eber, and D. Heath, “Coherent measures of risk,” Mathematical Finance, vol. 9, no. 3, pp. 203–228, 1999. [11] R. T. Rockafellar and S. Uryasev, “Optimization of conditional valueat-risk,” Journal of Risk, vol. 2, pp. 21–42, 2000. [12] A. Ruszczyński and A. Shapiro, “Conditional risk mappings,” Mathematics of Operations Research, vol. 31, no. 3, pp. 544–561, 2006. [13] A. Ruszczyński, “Risk-averse dynamic programming for markov decision processes,” Mathematical Programming, vol. 125, pp. 235–261, 2010. [14] P. Artzner, F. Delbaen, J.-M. Eber, D. Heath, and H. Ku, “Coherent multiperiod risk adjusted values and Bellman’s principle,” Annals of Operations Research, vol. 152, pp. 5–22, 2007. [15] N. Bäuerle and J. Ott, “Markov decision processes with averagevalue-at-risk criteria,” Mathematical Methods of Operations Research, vol. 74, pp. 361–379, 2011. [16] V. Borkar and R. Jain, “Risk-constrained Markov decision processes,” IEEE Transactions on Automatic Control, vol. 59, no. 9, pp. 2574– 2579, 2014. [17] Y. Chow, A. Tamar, S. Mannor, and M. Pavone, “Risk-sensitive and robust decision-making: a CVaR optimization approach,” in NIPS, 2015. [18] W. B. Haskell and R. Jain, “A convex analytic approach to riskaware Markov decision processes,” SIAM Journal on Control and Optimization, vol. 53, no. 3, pp. 1569–1598, 2015. [19] G. C. Pflug and A. Pichler, “Time-inconsistent multistage stochastic programs: Martingale bounds,” European Journal of Operational Research, vol. 249, no. 1, pp. 155–163, 2016. [20] C. W. Miller and I. Yang, “Optimal control of conditional value-atrisk in continuous time,” SIAM Journal on Control and Optimization, vol. 55, no. 2, pp. 856–884, 2017. [21] Y. L. Chow and M. Pavone, “Stochastic optimal control with dynamic, time-consistent risk constraints,” in Proceedings of 2013 American Control Conference, 2013. [22] O. Çavuş and A. Ruszczyński, “Risk-averse control of undiscounted transient Markov models,” SIAM Journal on Control and Optimization, vol. 52, no. 6, pp. 3935–3966, 2014. [23] P. Krokhmal, J. Palmquist, and S. Uryasev, “Portfolio optimization with conditional value-at-risk objective and constraints,” Journal of Risk, vol. 4, pp. 43–68, 2002. [24] S. M. Robinson, “Analysis of sample-path optimization,” Mathematics of Operations Research, vol. 21, no. 3, pp. 513–528, 1996. [25] S. Summers and J. Lygeros, “Verification of discrete time stochastic hybrid systems: A stochastic reach-avoid decision problem,” Automatica, vol. 46, no. 12, pp. 1951–1961, 2010. [26] J. Ding, M. Kamgarpour, S. Summers, A. Abate, J. Lygeros, and C. Tomlin, “A stochastic games framework for verification and control of discrete time stochastic hybrid systems,” Automatica, vol. 49, no. 9, pp. 2665–2674, 2013. [27] K. Lesser and M. Oishi, “Approximate safety verification and control of partially observable stochastic hybrid systems,” IEEE Transactions on Automatic Control, vol. 62, no. 1, pp. 81–96, 2017. [28] O. Hernández-Lerma and J. B. Lasserre, Discrete-Time Markov Control Processes: Basic Optimality Criteria. Springer, 2012.
3cs.SY
Process-Oriented Parallel Programming with an Application to Data-Intensive Computing arXiv:1407.5524v1 [cs.PL] 21 Jul 2014 Edward Givelberg April 4, 2018 Abstract We introduce process-oriented programming as a natural extension of object-oriented programming for parallel computing. It is based on the observation that every class of an object-oriented language can be instantiated as a process, accessible via a remote pointer. The introduction of process pointers requires no syntax extension, identifies processes with programming objects, and enables processes to exchange information simply by executing remote methods. Process-oriented programming is a high-level language alternative to multithreading, MPI and many other languages, environments and tools currently used for parallel computations. It implements natural object-based parallelism using only minimal syntax extension of existing languages, such as C++ and Python, and has therefore the potential to lead to widespread adoption of parallel programming. We implemented a prototype system for running processes using C++ with MPI and used it to compute a large three-dimensional Fourier transform on a computer cluster built of commodity hardware components. Three-dimensional Fourier transform is a prototype of a data-intensive application with a complex data-access pattern. The process-oriented code is only a few hundred lines long, and attains very high data throughput by achieving massive parallelism and maximizing hardware utilization. 1 Introduction The first commercially available microprocessor CPUs appeared in the early 1970s. These were singleprocessor devices that operated with a clock rate of less than 1 MHz. Over the course of the following three decades increasingly faster and cheaper CPUs were built. This was achieved in large part by persistently increasing the clock rate. By 2004 the CPU clock rates reached the 3-4 GHz range and heat dissipation became a major problem. In order to continue improving the performance and the cost, microprocessor designers turned to parallel computing. Today, nearly all computing devices (servers, tablets, phones, etc.) are built using processors with multiple computing cores, whose operating frequency is less than 3.5 GHz. The industry move to parallel computing succeeded because practically every application contains tasks that can be executed in parallel. And yet, a decade later the vast majority of computer programs are still being written for execution on a single processor, and parallel computation is being realized primarily using threads, sequential processes that share memory. Parallel programming is generally recognized as difficult, and has been a subject of extensive research (see [3], [9], [11] and references therein). The problem with threads is eloquently described in [10]. The author paints a bleak scenario: “If [...] programmers make more intensive use of multithreading, the next generation of computers will become nearly unusable.” 1 In the scientific computing community parallel programs are typically written in Fortran and C with OpenMP [2] and MPI [1]. Dozens of high-level languages for parallel programming have also been developed, but presently none of them is widely used. Even the so-called embarrassingly parallel computations are not embarrassingly easy to implement. In this paper we develop a new framework for parallel programming, which we call process-oriented programming. It is based on the fundamental observation that any class in an object-oriented language can be instantiated as a process, accessible via a remote pointer [6]. Such a process instantiates an object of the class and acts as a server to other processes, remotely executing the class interface methods on this object. The introduction of remote pointers enables a straightforward extension of object-oriented programming languages to process-oriented programming with hardly any syntax additions. We show that process-oriented programming is an efficient framework for parallel programming, and we propose it as a replacement for multithreading, MPI and many other languages, environments and tools currently used for parallel computations. We implemented a prototype system for running processes using C++ with MPI and investigated process-oriented programming in the context of data-intensive computing. The rapid growth of generated and collected data in business and academia creates demand for increasingly complex and varied computations with very large data sets. The data sets are typically stored on hard drives, so the cost of accessing and moving small portions of the data set is high. Nevertheless, a large number of hard drives can be used in parallel to significantly reduce the amortized cost of data access. In [7], we argued that a data-intensive computer can be built, using widely available (“commodity”) hardware components, to solve general computational problems involving very large data sets. The primary challenge in the construction of the data-intensive computer lies in software engineering. The software framework must balance programmer productivity with efficient code execution, i.e. big data applications with complex data access patterns must be realizable using a small amount of code, and this code must attain high data throughput, using massive parallelism. In this paper we aim to demonstrate that process-oriented programming is the right framework for the realization of the data-intensive computer. We chose the computation of a large three-dimensional Fourier transform as the subject of our study primarily because it can be considered as a prototype of a difficult data-intensive problem. We show that using processes our application can be realized with only a few hundred lines of code, which are equivalent to approximately 15000 lines of C++ with MPI. We also show that even with the complex data access patterns required for the computation of the 3D Fourier transform, our code attains very high data throughput by achieving massive parallelism and maximizing hardware utilization. In section 2 we describe a simple model of storage of a data set as a collection of data pages on multiple hard-drives. This model is used in the examples in section 3, where we introduce processes. The process-oriented implementation of the Fourier transform is described in section 4 and the efficiency of the computation is analyzed in section 5. We conclude with a discussion in section 6. Our presentation uses C++, but can be easily applied to any object-oriented language. size t is a large non-negative integer type used in C++ to represent the size of a data object in bytes. 2 2.1 The Data Set Data Pages We represent an N1 ×N2 ×N3 array of complex double precision numbers as a collection of N P1 ×N P2 ×N P3 pages, where each page is a small complex double precision array of size n1 × n2 × n3 . First, we define a Page class which stores n bytes of unstructured data: 2 class Page { public : Page ( size_t n , unsigned char * data ) ; ~ Page () ; protected : size_t n ; unsigned char * data ; }; The ArrayPage class is derived from the Page class to handle three-dimensional complex double-precision array blocks: class ArrayPage : public Page { public : ArrayPage ( int n1 , int n2 , int n3 , double * data ); // constructor that allocates data : ArrayPage ( int n1 , int n2 , int n3 ) ; void transpose13 () ; void transpose23 () ; . . . private : int n1 , n2 , n3 ; } The ArrayPage class may include functions for local computation with the array page data, such as the transpose functions that are important in the computation of the Fourier transform (see section 4.2). Throughout this paper the arrays have equal dimensions and the distinct variables n1, n2 and n3 are maintained only for the clarity of exposition. 2.2 Storage devices We store data pages on hard drives, using a single large file for every available hard drive. The following PageDevice class controls the hard drive I/O. class PageDevice { public : PageDevice ( string filename , size_t NumberOfPages , size_t PageSize ); ~ PageDevice () ; void write ( Page * p , size_t PageIndex ) ; void read ( Page * p , size_t PageIndex ) ; protected : string filename ; size_t NumberOfPages ; size_t PageSize ; private : 3 int f il e_ de s cr ip t or ; }; The implementation of this class creates a file filename of NumberOfPages * PageSize bytes. Pages of data are stored in the PageDevice object using a PageIndex address, where PageIndex ranges from 0 to NumberOfPages - 1. The write method copies a data page of size PageSize to the location with an offset PageIndex * PageSize from the beginning of the file filename. Similarly, the read method reads a page of data stored at a given integer address in the PageDevice. Linux direct I/O functions are used in the class implementation. For example, the Linux open function, used with the O DIRECT flag, attempts to minimize cache effects of the I/O to and from the specified file. For array pages we define the ArrayPageDevice, which extends PageDevice, as follows: class Ar ray Pa ge De v ic e : public PageDevice { public : A rr ay Pa geD ev ic e ( string filename , size_t NumberOfPages , int nn1 , int nn2 , int nn3 ): n1 ( nn1 ) , n2 ( nn2 ) , n3 ( nn3 ) , PageDevice ( filename , NumberOfPages , 2 * n1 * n2 * n3 * sizeof ( double ) ) {} void w r i t e _ t r a n s p o s e 1 3 ( Page * p , size_t PageIndex ) ; void r e a d _ t r a n s p o s e 1 3 ( Page * p , size_t PageIndex ) ; void w r i t e _ t r a n s p o s e 2 3 ( Page * p , size_t PageIndex ) ; void r e a d _ t r a n s p o s e 2 3 ( Page * p , size_t PageIndex ) ; . . . private : int n1 , int n2 , int n3 ; }; The implementation of the transpose methods is very simple. For example: void A rr ayPa g eD ev ic e :: r e a d _ t r a n s p o s e1 3 ( Page * p , size_t PageIndex ) { read (p , PageIndex ) ; p - > transpose13 () ; } In addition to the transpose methods the ArrayPageDevice class may provides various other methods for computing with n1 × n2 × n3 blocks of complex double precision data. Furthermore, in section 4.3 we extend ArrayPageDevice to include caching. 4 2.3 Page map Since we use multiple hard drives to store a single large array object, we introduce the PageMap class to specify the storage layout of a given array. The PageMap translates logical array page indices into storage addresses. A storage address consists of an id of the server, corresponding to the hard drive where the data page is stored, and the page index, indicating the address of the page on that hard drive. typedef struct { int server_id ; size_t page_index ; } address ; struct PageMap { virtual address PageAddress ( int i1 , int i2 , int i3 ); }; In most applications the PageMap would be a simple, on-the-fly computable function, but it is also possible to implement it using an array of pre-computed values. 3 Processes In this section we introduce processes into object-oriented programming languages and show that a complete framework for parallel programming with processes is obtained using only very small syntax extension. 3.1 Process creation, destruction and remote pointers Programming objects can be naturally interpreted as processes. Upon creation, such a process instantiates the object and proceeds to act as a server to other processes, remotely executing the class interface methods on this object. For example, a program running on the computing node machine0 can create a new PageDevice process on machine1, as follows: size_t n u mb er _o f _p ag es = 1024; size_t page_size = 32 * 1024 * 1024; char * re mote_mac hine = " machine1 " ; PageDevice * storage = new ( remote_ machine ) PageDevice ( " pagefile " , number_of_pages , page_size ); It can then generate a page of data and store it on the remote machine1 using the remote pointer storage: Page * page = G e n e r a t e D a t a P a g e () ; size_t PageAddress = 17; storage - > write ( page , PageAddress ) ; 5 The new PageDevice process on machine1 acts as a server which listens on a communications port, accepts commands from other processes, executes them and sends results back to the clients. The client-server protocol is generated by the compiler from the class desccription. Remote pointer dereferencing triggers a sequence of events, that includes several client-server communications, data transfer and execution of code on both the client and the server machines. Process semantics and remote pointers extend naturally to simple objects, as shown in the following example: double * data = new ( remote_ machine ) double [1024]; data [7] = 3.1415; double x = data [2]; When this code is executed on machine0, a new process is created on remote machine. This process allocates a block of 1024 doubles and deploys a server that communicates with the parent client running on machine0. The execution of data[7] = 3.1415; requires communication between the client and the server, including sending the numbers 7 and 3.1415 from the client to the server. Similarly, the execution of the following command leads to an assignment of the local variable x with a copy of the remote double data[2] obtained over the network using client-server communications. We emphasize that code execution is sequential: each instruction, and all communications associated with it, is completed before the following instruction is executed. Finally, we remark that the notion of the class destructor in C++ extends natually to process objects: destruction of a remote object causes termination of the remote process and completion of the correspoding client-server communications. 3.2 Parallel computation The sequential programming model requires an execution of an instruction to complete before the next instruction is executed. We defined remote method execution to conform to this model, and therefore the calling process is kept idle until it is notified that the remote method has completed. In order to enable parallel computation we introduce the start keyword to indicate that the calling process may proceed with the execution of the next statement without waiting for the current statement to complete. Example: A shared memory computation is constructed by providing access to the previously defined data block to several computing processes: const int N = 64; class C o m pu t i n g P r o c e s s ; C o m p u t i n g Pr o c es s * process_group [ N ]; for ( int i = 0; i < N ; i ++) start process_group [ i ] = new ( machine [ i ]) C o m p u t i n g P r o c e ss ( data ) ; The start keyword can be used also for remote method and remote function calls, as is shown below. An array of remote pointers defines a group of processes. It is easy to assign ids to the processes and to make them aware of the other processes in the group. This enables subsequent inter-process communication by remote method execution. Extending the example above, we assume that ComputingProcess is derived from the following ProcessGroupMember class. class P r o c e s s G r o u p M e m b e r { 6 public : int ID () const { return id ; } int N u m be r O f P r o c e s s e s () const { return N ; } P r o c e s s G r o u p M e m b e r ** ProcessGroup () const { return group ; } protected : virtual void S et Pr oc e ss Gr ou p ( int my_id , int my_N , P r o c e s s G r o u p M e m b e r ** my_group ); private : int id ; int N ; P r o c e s s G r o u p M e m b e r ** group ; }; The parameter my group of the SetProcessGroup method is a remote pointer to an array of remote processes, so a shallow copy implementation of SetProcessGroup will result in redundant future communications. The following deep copy implementation of SetProcessGroup, which copies the entire remote array of remote pointers to a local array of remote pointers, is preferable: void P r o c e s s G r o u p M e m b e r :: S et P ro ce ss G ro up ( int my_id , int my_N , P r o c e s s G r o u p M e m b e r ** my_group ) { id = my_id ; N = my_N ; group = new P r o c e s s G r o u p M e m b e r * [ N ]; for ( int i = 0; i < N ; i ++) // remote copy : group [ i ] = my_group [ i ]; } After instantiating the processes in process group the master process can form a process group as follows: for ( int id = 0; id < N ; id ++) process_group [ i ] - > Se t Pr oc es s Gr ou p ( i , N , process_group ); Alternatively, the master process can execute the SetProcessGroup calls in parallel, but this requires synchronizing the processes at the end. A standard way to do this is using barrier functions. A process executing the barrier function call must wait until all other processes in the group execute a barrier function call before proceeding with the execution of the next statement: for ( int id = 0; id < N ; id ++) start process_group [ i ] - > Se tP ro c es sG ro u p ( i , N , process_group ); process_group - > barrier () ; 7 node0& node1& dual&Intel&Xeon&X5650& 12&physical&cores& mul;threading& 48&GB&RAM& 24 x 1 TB 10 Gb/sec Ethernet network& switch& node2& 24 x100 MB/sec node3& Figure 1: Cluster configuration for data intensive computing: The nodes are interconnected by a high speed network (10 Gb/sec Ethernet). Each node has a 12 core Intel Xeon processor with 48 GB of RAM and 24 attached 1 TB hard-drives. Each hard drive has an I/O throughput in the range of 100-150 MB/sec. 3.3 Persistent objects and processes We view a large data set as a collection of persistent processes, which provide access to portions of the data 6/26/14& 1& set, as well as methods for computing with it. Persistent processes are objects that can be destroyed only by explicitly calling the destructor. The runtime system is responsible for storing process representation, and activating and de-activating processes, as needed. Processes can be accessed using a symbolic object address, similar to addresses used by the Data Access Protocol (DAP) [5], for example: PageDevice * page_device = " http :// data / set / PageDevice /34 " ; Because persistence is especially important for large data objects, in this paper we assume that all processes and all objects are persistent. 4 A program to compute the Fourier transform In this section we show how to use processes in a data-intensive application on a cluster, such as the one shown in Figure 1. We chose a large three-dimensional Fourier transform as an example of a data-intensive application and we give an extensive description of the process-oriented code. We consider the situation where the array data set is represented by a group of processes, and the Fourier transform is a separate application whose processes interact with the array processes. In section 4.3 we show how the efficiency of the parallel computation can be improved using server-side caching. 4.1 The Array We described a method of storing a large data set on multiple hard drives in section 2. We now define the Array class that is used in the Fourier transform computation. 8 The Array class describes a complex double precision three-dimensional array. It specifies the array domain, its storage layout and data access methods. We first define an auxiliary class to describe rectangular three-dimensional domains: class Domain { public : Domain ( int N11 , int N12 , int N21 , int N22 , int N31 , int N32 ); . . . }; The collection of hard drives attached to the cluster nodes can be turned into a distributed disk-based random access memory by launching a PageDevice process for every hard-drive on the cluster node to which this hard-drive is attached, but for computations with arrays we launch ArrayPageDevice processes that enable us to perform some of the array computations “close to the data”: A rr ay Pa g eDev i ce ** page_server = new A rr ay Pa g eD ev i ce * [ Nu mb e rO fS er v er s ]; for ( int i = 0; i < N u mb er Of S er ve rs ; ) page_server [ i ] = new ( machine [ i ]) A rr ay Pa g eD ev ic e ( filename [ i ] , NumberOfPages , N1 , N2 , N3 ); i ++ The ArrayPageDevice processes could be launched instead of the PageDevice processes, however in most applications it would be advantageous to launch them alongside existing PageDevice processes. In this case ArrayPageDevice must include a constructor that takes a pointer to an existing PageDevice process as a parameter. There would be essentially no communication overhead when the ArrayPageDevice process is launched on the same node as the corresponding PageDevice process. The PageDevice::read method, for example, will copy a page from a hard drive directly into a memory buffer that is accessible by the corresponding ArrayPageDevice process. Array storage layout is determined by the PageMap object. The assignment of array pages to servers may affect the degree of parallelism that can be achieved in the computation. We use the circulant map, which assigns array page (i1, i2, i3) to the server (i1 + i2 + i3) % NumberOfServers. To complete the specification of the PageMap, we assign the first available PageIndex address within the target PageServer. The Array class provides methods for a client process to compute over a small array subdomain. The client may use a small (e.g. 4 GB) memory buffer to assemble the subdomain from array pages that reside within page server processes, as determined by the array pagemap. class Array // complex double { public : Array ( Domain * ArrayDomain , 9 Domain * PageDomain , int NumberOfServers , A rr ay Pa g eD ev ic e ** page_server , PageMap * pagemap ); ~ Array () ; void read ( Domain * d , double * buffer ) ; void write ( Domain * d , double * buffer ) ; void r e a d _ t r a n s p o s e 1 3 ( Domain * d , double * buffer ); void w r i t e _ t r a n s p o s e 1 3 ( Domain * d , double * buffer ); void r e a d _ t r a n s p o s e 2 3 ( Domain * d , double * buffer ); void w r i t e _ t r a n s p o s e 2 3 ( Domain * d , double * buffer ); private : Domain * ArrayDomain ; Domain * PageDomain ; int N um be r Of Se rv e rs ; A rr ay Pa g eD ev ic e * page_server ; PageMap * pagemap ; }; An Array object is constructed by a single process, which can then pass the object pointer to any group of processes. Because an Array is a persistent object, it can also be accessed using a symbolic address, as described in section 3.3. Transpose I/O methods are used to compute with long and narrow array subdomains that are not aligned with the third dimension. In section 4.2 we show an application of the transpose methods to the computation of the Fourier transform. The transpose of array pages can be computed either on the client or on the servers. For example, the implementation of Array::read transpose13 can assemble the data by executing ArrayPageDevice::read transpose13 on the appropriate page server processes. Alternatively, it can execute ArrayPageDevice::read methods on these servers, followed by ArrayPage::transpose13 on the received pages. 4.2 FFT Processes We compute the three-dimensional Fourier transform using three separate functions, fft1, fft2 and fft3, each performing one-dimensional Fourier transforms along the corresponding dimension. The functions fft1 and fft2 are similar to fft3, except that subdomains are read and written using the I/O transpose operations of the Array class. Having read and transposed the data into a local memory buffer, Fourier transforms are computed along the third dimension. The result is then transposed back and written to the array. We therefore restrict our description below to the fft3 function. The computation of the fft3 function is performed in parallel using several FFT3 client processes: class FFT3 : public P r o c e s s G r o u p M e m b e r { public : 10 FFT3 ( int sign , Array * a ) ; ~ FFT3 () { delete buffer ; } void C o m p u t e T r a n s f o r m () ; private : double * buffer ; int sign ; Array * a ; }; We divide the array into n slabs along the first dimension. The master process launches n FFT3 processes, assigning each process to a slab. FFT3 ** fft = new FFT3 * [ n ]; for ( int i = 0; i < n ; i ++) fft [ i ] = new ( node [ i ]) FFT3 ( sign , a ) ; for ( int i = 0; i < n ; i ++) fft [ i ] - > Se tP ro c es sG ro u p (i , n , fft ) ; for ( int i = 0; i < n ; i ++) start fft [ i ] - > C o m p u t e T ra n s f o r m () ; Each process maintains a buffer that can hold a page line, where a page line is a collection of N P3 pages with page indices {(i1 , i2 , i3 ) : i3 = 0, 1, . . . , N P3 − 1} . For complex double precision array of 1283 pages, with each page consisting of 1283 points, the page line buffer is 4 GB. Each process computes: void FFT3 :: C o m p ut e T r a n s f o r m () { Domain * PageLine ; for every PageLine in the slab { a - > read ( PageLine , buffer ) ; call FFTW( sign , buffer ) ; a - > write ( PageLine , buffer ) ; ProcessGroup () -> barrier () ; } } An fft process assembles a page line by reading the pages from appropriate page servers. For each page line one FFTW [4] function call computes a set of n1 × n2 one-dimensional complex double Fourier transforms of size N3 each. The result pages are then sent back to the page servers and stored on hard drives. Although the fft processes do not communicate with each other, they share a common network and a common pool of page servers. The barrier synchronization at the end of each iteration is not strictly necessary. 4.3 Parallel execution; caching Each page line read and write operation consists of disk I/O and network transfer, with disk I/O being significantly more time consuming. We implement caching on the page server in order to carry out part of the disk I/O in parallel with the FFTW computation. class ArrayDevice : public A r ra yP ag e De vi ce 11 { public : A rr ay Pa g eD ev ic e ( string filename , int NumberOfPages , int n1 , int n2 , int n3 , int Nc ): A rr ay Pa g eD ev ic e ( filename , NumberOfPages , n1 , n2 , n3 , ), N u m b e r O f C a c h e P a g e s ( Nc ) {} void ReadIntoCache ( size_t page_index ) ; void read ( Page * p , size_t page_index ) ; . . . private : int N u m b e r O f C a c h e P a g e s ; Page ** cache ; }; An ArrayDevice server is configured with a cache that can hold a line of pages. In order to use ArrayDevice instead of ArrayPageDevice we add the following ReadIntoServerCache method to the Array class: void Array :: R e a d I n t o S e r v e r C a c h e ( Domain * domain ) { for every page ( i1 , i2 , i3 ) in domain { address a = pagemap - > PageAddress ( i1 , i2 , i3 ) ; int id = a . server_id ; size_t i = a . page_index ; start server [ id ] - > ReadIntoCache ( i ) ; } } The ArrayDevice:read method executes ArrayPageDevice::read if the requested page is not found in its cache; otherwise it returns (sends over the network) the cached page. The transform computation is now reorganized, so that instructions to read the next line of pages are sent to the page servers before the FFT of the current page line is started. void FFT3 :: C o m p ut e T r a n s f o r m () { Domain * PageLine ; for every PageLine in the slab { a - > read ( PageLine , buffer ) ; Domain * NextPageLine = next page line; start a - > R e a d I n t o S e r v e r C a c h e ( NextPageLine ) ; call FFTW( sign , buffer ) ; a - > write ( PageLine , buffer ) ; ProcessGroup () -> barrier () ; } 12 } After the completion of the FFT the servers are instructed to write pages to hard drives. An execution of the write method will take place only after the server has completed ArrayDevice::ReadIntoCache. The efficiency of server-side caching depends on the relative timing of the FFT computation and the page I/O. If necessary, write and WriteFromCache methods can be implemented in the ArrayDevice class analogously. 5 Computation of the Fourier Transform In this section we describe the computation of a large (64 TB) data-intensive Fourier transform on a small (8 nodes, 96 cores) cluster. We describe our prototype implementation of the process framework and analyze the performance of the Fourier transform computation. 5.1 Software Implementation of Processes The Fourier transform application was developed by completing the process-oriented code which is sketched in sections 2 and 4, translating it into C++ with MPI and linking it against an auxiliary library of tools for implementation of basic process functionality. We describe the procedure for ArrayDevice processes. In order to instantiate ArrayDevice processes, we created an ArrayDevice server class and a C++ program file ArrayDevice process.cpp containing the following code: // start the server and disconnect from parent process int main ( int argc , char ** argv ) { MPI_Init (& argc , & argv ) ; MPI_Comm parent ; M P I _ C o m m _ g e t _ p a r e n t (& parent ) ; ArrayDevice_server * s = new A r r a y D e v i c e _ s e r v e r () ; M P I _ C o m m _ d i s c o n n e c t (& parent ) ; MPI_Finalize () ; } In addition, we implemented the function void LaunchProcess ( const string & process_file_name , const string & machine_address , string & server_a ddress ); LaunchProcess uses MPI Comm spawn to create an MPI process by running the executable process file name on the remote machine specified by machine address. The launched process starts a server which uses MPI Open port to open a port and return the port address in the server address output parameter. The server process then disconnects from the launching process. In order to implement remote method execution we also created an ArrayDevice client class. The ArrayDevice client and the ArrayDevice server classes are automatically constructed from the ArrayDevice class. For the purposes of this example we use a simple name mangling scheme to first generate the following ArrayDevice interface class: class A r r a y D e v i c e _ i n t e r f a c e { 13 . . . public : virtual void A r r a y D e v i c e _ c r e a t e ( // constructor string filename , size_t numberofpages , size_t pagesize ); virtual void A r r a y D e v i c e _ d e s t r o y () ; // destructor virtual void A r r a y D e v i c e _ w r i t e ( Page * p , size_t page_index ) ; virtual void A r r a y D e v i c e _ R e a d I n t o C a c h e ( int n , size_t * page_index ); // commands used in client - server protocol enum A r r a y D e v i c e _ c o m m a n d { create_CMD = 0 , destroy_CMD = 1 , write_CMD = 2 , ReadIntoCache_CMD = 3 }; . . . }; The ArrayDevice interface class contains meta-information obtained from the ArrayDevice class. Both the ArrayDevice client and the ArrayDevice server classes are derived from ArrayDevice interface. ArrayDevice client is also derived from a general ProcessClient class, and similarly ArrayDevice server is derived from ProcessServer. Jointly, the ArrayDevice client, ArrayDevice server pair implement remote procedure calls (RPC) for ArrayDevice. The client-server communications protocol for ArrayDevice uses the ArrayDevice interface class and the general-purpose functionality implemented in ProcessClient and ProcessServer. The client-server implementation uses a simple object serialization library to send method parameters and results over the network. This serialization library is also used to implement a rudimentary file-based object persistence mechanism. Information is sent over the network using an MPIbased communications software layer. The translation procedure we implemented for the processes of the Fourier transform application can be extended and incorporated into a C++ compiler. It converts several hundred lines of process-oriented code into a C++/MPI application for computing Fourier transform, which is approximately 15000 lines long. A very small subset of MPI functions is used. The following is the almost complete list: • MPI Send, MPI Recv – for inter-process communication, • MPI barrier – for process synchronization, • MPI Open port, MPI Close port, MPI Comm accept – to implement client-server functionality, • MPI Comm spawn, MPI Info create, MPI Info set chines, – to spawn processes on specified target ma- • MPI Comm connect, MPI Comm disconnect, MPI Comm get parent – to manage process connections. Both MPICH and Intel MPI were used in our computation, and with both implementations we encountered problems with some MPI functions. The most significant bugs were found in MPI Comm spawn and 14 MPI Comm disconnect. 5.2 Fourier Transform Computation We used the process prototype implementation to carry out a computation of the Fourier transform of a (16K)3 -point array of complex double precision numbers. (We use the notation 1K = 1024, 16K = 16384 = 128 × 128.) The total size of the array is 64 TB. The computations were carried out on a cluster of 8 nodes, interconnected with a 10 Gb/sec Ethernet, similar to the cluster depicted in Figure 1. Each computational node has an Intel R Xeon R X5650 12 core CPU with hyperthreading, rated at 2.67GHz, and 24 attached 1 TB hard drives. The hard drives are manufactured by Samsung, model SpinPoint F3 HD103SJ, with manufacturer listed latency of 4.14 ms and average seek time of 8.9 ms. Benchamark hard drive read and write throughput is reported at over 100 MB/sec. The (16 K)3 -point array was broken up into 1283 ArrayPage pages of 128 × 128 × 128 points each. The resulting page size is 32 MB. The choice of the page size is constrained by the latency and seek time of the system’s hard drives: the smaller the page size, the lower the overall disk I/O throughput. We measured a typical page read/write time in the range of 0.25-0.35 sec. We used 4 of the 8 available nodes to store the Array object, creating 24 ArrayDevice processes on each node, one process for each available hard drive. Because ArrayDevice processes are primarily dedicated to disk I/O it is possible to run 24 processes on a 12-core node. The process framework makes it easy to shift computation closer to data by extending the ArrayDevice class, and in such case relatively more powerful CPUs may be needed to run the server processes. We used the other 4 nodes to run 16 processes of the Fourier transform application, 4 processes per node. Each of the 16 Fourier transform processes was assigned an array slab of 8 × 128 × 128 pages. The process computes the transform of its slab line by line in 8 × 128 = 1024 iterations. Although the 16 processes are independent of each other, they compete among themselves for service from 96 page servers. The wall clock time for a single iteration of ComputeTransform (see section 4.3) generally ranged from 68 to 78 seconds, with the average of approximately 73 seconds. The total speed of data processing (including reading, computing and writing the data) has been therefore close to 1 GB/sec. In the next section we analyze the performance in detail and indicate a number of ways to substantially improve it. 5.3 Performance analysis The computation of the Fourier transform was completed in the course of several long (over 10 hours) continuous runs. Our implementation of persistence mechanism for processes made it possible to stop and restart the computation multiple times. The primary reason for long runs was to test the stability and robustness of our implementation. We instrumented the code to measure the utilization of the system’s components: the network, the hard drives and the processors. Because the results did not vary substantially over the course of the computation, we present a detailed analysis of a typical iteration of ComputeTransform. The synchronization of the processes at the end of each iteration is not strictly necessary, but we found that it did not significantly affect performance, and made the code easier to analyze. On the other hand, we found that introducing additional barriers within the iteration would slow down the computation significantly. We now present detailed measurements of the component phases of the iteration. At the beginning of every iteration each process reads a page line consisting of 128 pages, which are evenly distributed among the 96 servers by the circulant map (see section 4.1). Except for the first iteration, the required pages have already been read from the hard drive and placed in the memory of the corresponding servers. Each server has either 21 or 22 pages to send to the clients. In total, 64 GB of data is sent from 15 the servers to the clients. Accordingly, the combined size of the server caches in each of the server nodes is slightly more than 16 GB. We timed the parallel reading of page lines by the 16 client processes in a typical time step: 15: Array :: read 11520 -11647 x 2432 -2559 x 0 -16383:: 4 GB , 17.3638 sec , 235.894 MB / sec 12: Array :: read 9216 -9343 x 2432 -2559 x 0 -16383:: 4 GB , 18.6695 sec , 219.395 MB / sec 0: Array :: read 0 -127 x 2432 -2559 x 0 -16383:: 4 GB , 21.6104 sec , 189.538 MB / sec 1: Array :: read 768 -895 x 2432 -2559 x 0 -16383:: 4 GB , 22.2821 sec , 183.824 MB / sec 11: Array :: read 8448 -8575 x 2432 -2559 x 0 -16383:: 4 GB , 22.4682 sec , 182.302 MB / sec 8: Array :: read 6144 -6271 x 2432 -2559 x 0 -16383:: 4 GB , 22.7035 sec , 180.412 MB / sec 14: Array :: read 10752 -10879 x 2432 -2559 x 0 -16383:: 4 GB , 22.9213 sec , 178.698 MB / sec 5: Array :: read 3840 -3967 x 2432 -2559 x 0 -16383:: 4 GB , 27.1039 sec , 151.122 MB / sec 6: Array :: read 4608 -4735 x 2432 -2559 x 0 -16383:: 4 GB , 27.0914 sec , 151.192 MB / sec 2: Array :: read 1536 -1663 x 2432 -2559 x 0 -16383:: 4 GB , 27.2604 sec , 150.255 MB / sec 4: Array :: read 3072 -3199 x 2432 -2559 x 0 -16383:: 4 GB , 28.1986 sec , 145.256 MB / sec 3: Array :: read 2304 -2431 x 2432 -2559 x 0 -16383:: 4 GB , 28.3351 sec , 144.556 MB / sec 7: Array :: read 5376 -5503 x 2432 -2559 x 0 -16383:: 4 GB , 28.9623 sec , 141.425 MB / sec 10: Array :: read 7680 -7807 x 2432 -2559 x 0 -16383:: 4 GB , 29.027 sec , 141.11 MB / sec 9: Array :: read 6912 -7039 x 2432 -2559 x 0 -16383:: 4 GB , 29.5628 sec , 138.553 MB / sec 13: Array :: read 9984 -10111 x 2432 -2559 x 0 -16383:: 4 GB , 30.1746 sec , 135.743 MB / sec The first number in each row is the client process id, followed by the description of the domain, domain size, the time it took to read it and the corresponding throughput. The fastest process completes the execution of the Array::read method (including sending the command and the parameter to page servers) in approximately 17.5 seconds, the slowest – in about 30 seconds. The faster processes proceed to start the execution of Array::ReadIntoServerCache immediately after completion of Array::read. The typical aggregate throughput during the parallel execution of Array::read is therefore significantly larger than 2 GB/sec. The maximal possible throughput to the four nodes computing the transform is approximately 4 GB/sec. In the Array::ReadIntoServerCache phase of the computation 16 clients send small messages to 96 page servers with instructions to read a total of 16 × 128 pages. These commands are queued for execution in the servers, so that the clients do not wait for the completion of the execution. The time measurements of the parallel execution of start Array::ReadIntoServerCache by the 16 client processes in a typical time step were: 14: Array :: R e a d I n t o S e r v e r C a c h e 10752 -10879 x 2560 -2687 x 0 -16383:: 9.36148 sec 13: Array :: R e a d I n t o S e r v e r C a c h e 9984 -10111 x 2560 -2687 x 0 -16383:: 2.10771 sec 10: Array :: R e a d I n t o S e r v e r C a c h e 7680 -7807 x 2560 -2687 x 0 -16383:: 3.25717 sec 12: Array :: R e a d I n t o S e r v e r C a c h e 9216 -9343 x 2560 -2687 x 0 -16383:: 9.5796 sec 8: Array :: Re a d I n t o S e r v e r C a c h e 6144 -6271 x 2560 -2687 x 0 -16383:: 9.81484 sec 11: Array :: R e a d I n t o S e r v e r C a c h e 8448 -8575 x 2560 -2687 x 0 -16383:: 13.6131 sec 9: Array :: Re a d I n t o S e r v e r C a c h e 6912 -7039 x 2560 -2687 x 0 -16383:: 2.67452 sec 5: Array :: Re a d I n t o S e r v e r C a c h e 3840 -3967 x 2560 -2687 x 0 -16383:: 5.16807 sec 2: Array :: Re a d I n t o S e r v e r C a c h e 1536 -1663 x 2560 -2687 x 0 -16383:: 5.0223 sec 4: Array :: Re a d I n t o S e r v e r C a c h e 3072 -3199 x 2560 -2687 x 0 -16383:: 4.08604 sec 0: Array :: Re a d I n t o S e r v e r C a c h e 0 -127 x 2560 -2687 x 0 -16383:: 10.6741 sec 3: Array :: Re a d I n t o S e r v e r C a c h e 2304 -2431 x 2560 -2687 x 0 -16383:: 3.94899 sec 1: Array :: Re a d I n t o S e r v e r C a c h e 768 -895 x 2560 -2687 x 0 -16383:: 9.98827 sec 6: Array :: Re a d I n t o S e r v e r C a c h e 4608 -4735 x 2560 -2687 x 0 -16383:: 5.16787 sec 15: Array :: R e a d I n t o S e r v e r C a c h e 11520 -11647 x 2560 -2687 x 0 -16383:: 14.9185 sec 7: Array :: Re a d I n t o S e r v e r C a c h e 5376 -5503 x 2560 -2687 x 0 -16383:: 3.27696 sec These results are significantly worse than expected. Our implementation of processes repeatedly establishes and breaks client-server connections. We found the MPI Comm connect function to be very fast, but with increasing number of client-server connections, it sporadically performed hundreds of times slower than usual. An implementation of caching connections is likely to reduce the total time for this phase of the computation to about 3 seconds. We timed the execution of the FFTW function call by every processor. 16 14: fftw 10752 -10879 x 2432 -2559 x 0 -16383 5.53611 sec 0: fftw 0 -127 x 2432 -2559 x 0 -16383 5.86336 sec 6: fftw 4608 -4735 x 2432 -2559 x 0 -16383 5.91158 sec 4: fftw 3072 -3199 x 2432 -2559 x 0 -16383 5.99485 sec 8: fftw 6144 -6271 x 2432 -2559 x 0 -16383 6.01364 sec 12: fftw 9216 -9343 x 2432 -2559 x 0 -16383 6.03876 sec 10: fftw 7680 -7807 x 2432 -2559 x 0 -16383 6.06033 sec 2: fftw 1536 -1663 x 2432 -2559 x 0 -16383 6.07081 sec 11: fftw 8448 -8575 x 2432 -2559 x 0 -16383 6.38444 sec 7: fftw 5376 -5503 x 2432 -2559 x 0 -16383 6.38421 sec 15: fftw 11520 -11647 x 2432 -2559 x 0 -16383 6.42032 sec 3: fftw 2304 -2431 x 2432 -2559 x 0 -16383 6.42975 sec 9: fftw 6912 -7039 x 2432 -2559 x 0 -16383 14.001 sec 13: fftw 9984 -10111 x 2432 -2559 x 0 -16383 14.5631 sec 5: fftw 3840 -3967 x 2432 -2559 x 0 -16383 14.5582 sec 1: fftw 768 -895 x 2432 -2559 x 0 -16383 14.878 sec The last 4 processes (9,13,5 and 1) ran on the same node. Throughout our computation these 4 processes executed the FFTW library function call significantly slower than the processes running on other nodes. Additional investigation of the configuration of this node is needed to speed up the computation. The reading of the pages on the server side is done concurrently with the FFTW computation. We include the measurements for a few of the 96 servers: . . . 34: 25: 57: 52: 40: 73: 21: 33: 89: 46: ArrayDevice :: ReadIntoCache : ArrayDevice :: ReadIntoCache : ArrayDevice :: ReadIntoCache : ArrayDevice :: ReadIntoCache : ArrayDevice :: ReadIntoCache : ArrayDevice :: ReadIntoCache : ArrayDevice :: ReadIntoCache : ArrayDevice :: ReadIntoCache : ArrayDevice :: ReadIntoCache : ArrayDevice :: ReadIntoCache : 22 21 22 22 22 21 22 22 21 22 pages , pages , pages , pages , pages , pages , pages , pages , pages , pages , 704 672 704 704 704 672 704 704 672 704 MB , MB , MB , MB , MB , MB , MB , MB , MB , MB , 5.59864 sec , 125.745 MB / sec 5.614 sec , 119.701 MB / sec 5.58319 sec , 126.093 MB / sec 5.59719 sec , 125.777 MB / sec 5.61367 sec , 125.408 MB / sec 5.57943 sec , 120.442 MB / sec 5.64487 sec , 124.715 MB / sec 5.63134 sec , 125.015 MB / sec 5.56771 sec , 120.696 MB / sec 5.62876 sec , 125.072 MB / sec . . . The reading throughput is close to the maximal throughput for this type of hard drives. For every server the page reading commands are scheduled before the page writing commands of the last phase of the iteration. The writing of the pages will therefore start only after the completion of the page read commands. The clients write pages in parallel, with the typical timing as follows: 8: Array :: write 6144 -6271 x 2432 -2559 x 0 -16383:: 4 GB , 22.3279 sec , 183.448 MB / sec 4: Array :: write 3072 -3199 x 2432 -2559 x 0 -16383:: 4 GB , 22.784 sec , 179.776 MB / sec 11: Array :: write 8448 -8575 x 2432 -2559 x 0 -16383:: 4 GB , 22.7165 sec , 180.31 MB / sec 12: Array :: write 9216 -9343 x 2432 -2559 x 0 -16383:: 4 GB , 23.083 sec , 177.447 MB / sec 15: Array :: write 11520 -11647 x 2432 -2559 x 0 -16383:: 4 GB , 23.0278 sec , 177.872 MB / sec 7: Array :: write 5376 -5503 x 2432 -2559 x 0 -16383:: 4 GB , 23.2437 sec , 176.22 MB / sec 0: Array :: write 0 -127 x 2432 -2559 x 0 -16383:: 4 GB , 23.7938 sec , 172.145 MB / sec 14: Array :: write 10752 -10879 x 2432 -2559 x 0 -16383:: 4 GB , 24.5307 sec , 166.975 MB / sec 10: Array :: write 7680 -7807 x 2432 -2559 x 0 -16383:: 4 GB , 24.2152 sec , 169.15 MB / sec 6: Array :: write 4608 -4735 x 2432 -2559 x 0 -16383:: 4 GB , 24.6648 sec , 166.066 MB / sec 2: Array :: write 1536 -1663 x 2432 -2559 x 0 -16383:: 4 GB , 24.7291 sec , 165.635 MB / sec 3: Array :: write 2304 -2431 x 2432 -2559 x 0 -16383:: 4 GB , 25.3921 sec , 161.31 MB / sec 9: Array :: write 6912 -7039 x 2432 -2559 x 0 -16383:: 4 GB , 21.8906 sec , 187.113 MB / sec 13: Array :: write 9984 -10111 x 2432 -2559 x 0 -16383:: 4 GB , 22.0268 sec , 185.956 MB / sec 1: Array :: write 768 -895 x 2432 -2559 x 0 -16383:: 4 GB , 21.7936 sec , 187.945 MB / sec 5: Array :: write 3840 -3967 x 2432 -2559 x 0 -16383:: 4 GB , 22.2789 sec , 183.851 MB / sec The results for page writing are fairly uniform, with the total time for each process between 22 and 25.5 seconds. The aggregate througfhput for this phase is therefore over 2.5 GB/sec. We did not implement explicit caching for writing pages. The implementation of Array::write is analogous to the implementation of Array::ReadIntoServerCache (see section 4.3): 17 void Array :: write ( Domain * domain ) { for every page in domain start write page to the appropriate server } There is a limited caching effect as a result of the start command: having transmitted the page to the server, the client disconnects and proceeds to transmit pages to other servers, while the server starts writing the page to disk only after the client has disconnected. We found that writing pages to hard drive with the O DIRECT flag is about twice as fast as reading, presumably because of buffering. The typical throughput measured was between 230 and 240 MB/sec: . . . 22: ArrayDevice :: write : 1 page , 32 MB , 0.136958 sec , 233.648 MB / sec 78: ArrayDevice :: write : 1 page , 32 MB , 0.135615 sec , 235.962 MB / sec 73: ArrayDevice :: write : 1 page , 32 MB , 0.13452 sec , 237.883 MB / sec 64: ArrayDevice :: write : 1 page , 32 MB , 0.136484 sec , 234.46 MB / sec 8: ArrayDevice :: write : 1 page , 32 MB , 0.137042 sec , 233.505 MB / sec 54: ArrayDevice :: write : 1 page , 32 MB , 0.136533 sec , 234.376 MB / sec 87: ArrayDevice :: write : 1 page , 32 MB , 0.136293 sec , 234.788 MB / sec . . . The conclusion of our performance analysis is that the presented computation could be sped up by 25% or more, but greater benefits can be derived from a more balanced hardware configuration. The aggregate throughput of the 24 hard drives of a cluster node is about 3 GB/sec, about 3 times the capacity of the incoming network connection. Furthermore, the FFTW computation takes only 10-20% of the total iteration time. It appears that a 2–4-fold increase in the network capacity of the present cluster is likely to result in a more balanced system with better hardware utilization, and a total runtime of under 20 seconds per iteration. 6 Discussion and Conclusions In this paper we introduced process-oriented programming as a natural extension of object-oriented programming for parallel computing. We implemented a prototype of the process framework and carried out a data-intensive computation. We have shown that a complex and efficient application can be built using only a few hundred lines of process-oriented code, which is equivalent to many thousands of lines of objectoriented code with MPI. The process-oriented code in this paper is an extension of C++, but processes can be introduced into any object-oriented language. The syntax extension is minimal. In C++, for example, it amounts to adding a parameter to the new operator and introducing the keyword start. Combined with the fact that creating a process can be thought of as simply placing an object on a remote machine, it suggests that a lot of existing code can be easily modified to run in parallel. Potentially the most important impact of the process-oriented extension of languages, such as C++ and Python, is a widespread adoption of parallel programming, as application developers realize the ability to easily create processes instead of using thread libraries and to place different objects on different CPU cores. The process-oriented programming model is based on a simple hardware abstraction: the computer consists of a collection of processors, interconnected by a network, where each processor is capable of running multiple processes. The run-time system is responsible for mapping the abstract model onto a concrete hardware system, and must provide the programmer with system functions describing the state of the hardware. The hardware abstraction of the process-oriented model makes it possible to create portable parallel applications and applications that run in the cloud. 18 Processes are accessible by remote pointers. Syntactically, executing a method on a remote process is not different from method execution on an object. Any class of an object-oriented language can be interpreted as a process, but even more importantly, in the process-oriented framework only processes that are class instances are allowed. We argue that object-based parallelism is a high level abstraction, which is naturally suitable for reasoning about parallelism. Although shared memory and message passing can be realized in a process-oriented language, these are lower implementation-level models. Process inheritance is a powerful aspect of object-based parallelism, as it enables the definition of new processes in terms of previously defined processes. In combination with process pointers, it gives the programmer the flexibility to adapt the computation to the hardware by adding simple methods to class definitions (see the comments at the end of section 4.1 about the computation of array page transpose). A process-oriented program, like a typical sequential program starts with a single main process. The main process may launch new processes on remote machines, as easily as it can create objects. In contrast with MPI, processes are explicitly managed by the programmer. Process launching is part of the program, and is not determined by the runtime command line parameters. Using process pointers and language data structures, the programmer can form groups of processes, assign process ids and perform tasks that in MPI would require using communicators. Processes exchange information by executing remote methods, rather than via shared memory or message passing. We’d like to use the analogy that writing programs with message passing today is like writing programs with GOTOs fifty years ago: it is easy to write intractable code. And just like GOTO statements are used in assembly languages, message passing is a low-level language construct underlying remote method execution in process-oriented programming. We introduced the start keyword to enable parallel execution of remote methods. In order to use the keyword the programmer must decide whether there is a need to wait for the remote task to complete before proceeding with the computation. In general, this decision is easy and intuitive, but keeping track of task dependencies is not. Each process executes only one method at a time and remote method execution requests are queued. The programmer must keep in mind the state of the execution queue for every process. This is possible only for very simple scenarios. We used barriers to synchronize processes. Barrier synchronization helps the programmer to keep track of the execution queues of the processes, but it may reduce the parallelism of the computation. We view a large data object as a collection of persistent processes. For a large data object a negligible amount of additional storage space is needed to store serialized processes alongside the data. Process persistence is needed to enable stopping and restarting a computation, and to make a data set accessible to several simultaneous applications. It is also needed to develop basic mechanisms for fault tolerance. In this paper we showed that the process-oriented view of a large data object is very powerful: using only a small amount of code the programmer can copy and reformat very large data objects, and even carry out complex operations, such as the Fourier transform. Yet, software users and application developers tend to see a data set as consisting of “just data”, and being independent of a specific programming language. We stop short of suggesting a solution for this problem, but in this context it is worth recalling the CORBA standard [8]. The introduction of process-oriented programming was motivated by our research in data-intensive computing. The data-intensive Fourier transform computation was carried out on a small cluster of 8 nodes (96 cores). Our measurements indicate that Petascale data-intensive computations can be efficiently carried out on a larger cluster, with more nodes and significantly increased network bandwidth. Such a cluster can serve as a general-purpose data-intensive computer, whose operating system and applications are developed as process-oriented programs. The introduction of process-oriented programming in this paper is far from complete. It is merely the 19 first step of an extensive research program. We tested a substantial subset of the process framework in a prototype implementation. A full-fledged implementation must include a compiler and a run-time system that substantially expand the basic prototype. 7 Acknowledgements I am grateful to J. J. Bunn for discussions that significantly improved the presentation of the material. References [1] MPI: A Message-Passing Interface Standard, version 3.0. http://www.mpi-forum.org/. [2] OpenMP 4.0 Specifications. http://openmp.org/wp/openmp-specifications/. [3] J. Diaz, C. Munoz-Caro, and A. Nino. A survey of parallel programming models and tools in the multi and many-core era. Parallel and Distributed Systems, IEEE Transactions on, 23(8):1369–1386, 2012. [4] M. Frigo and S. G. Johnson. The design and implementation of fftw3. Proceedings of the IEEE, 93(2):216–231, 2005. [5] J. Gallagher, N. Potter, T. Sgouros, S. Hankin, and G. Flierl. The data access protocol-DAP 2.0, 2004. [6] E. Givelberg. Object-oriented parallel programming. April 2014. arXiv:1404.4666 [cs.PL]. [7] E. Givelberg, A. Szalay, K. Kanov, and R. Burns. An architecture for a data-intensive computer. In Proceedings of the first international workshop on Network-aware data management, pages 57–64. ACM, 2011. [8] M. Henning. The rise and fall of CORBA. Queue, 4(5):28–34, June 2006. [9] M. Herlihy and N. Shavit. The Art of Multiprocessor Programming, Revised Reprint. Elsevier, 2012. [10] E. A. Lee. The problem with threads. Computer, 39(5):33–42, 2006. [11] T. G. Mattson, B. A. Sanders, and B. L. Massingill. Patterns for parallel programming. Pearson Education, 2004. 20
6cs.PL
arXiv:1610.04167v5 [cs.LG] 25 Mar 2018 Tensorial Mixture Models Or Sharir Department of Computer Science The Hebrew University of Jerusalem Israel [email protected] Ronen Tamari Department of Computer Science The Hebrew University of Jerusalem Israel [email protected] Nadav Cohen Department of Computer Science The Hebrew University of Jerusalem Israel [email protected] Amnon Shashua Department of Computer Science The Hebrew University of Jerusalem Israel [email protected] Abstract Casting neural networks in generative frameworks is a highly sought-after endeavor these days. Contemporary methods, such as Generative Adversarial Networks, capture some of the generative capabilities, but not all. In particular, they lack the ability of tractable marginalization, and thus are not suitable for many tasks. Other methods, based on arithmetic circuits and sum-product networks, do allow tractable marginalization, but their performance is challenged by the need to learn the structure of a circuit. Building on the tractability of arithmetic circuits, we leverage concepts from tensor analysis, and derive a family of generative models we call Tensorial Mixture Models (TMMs). TMMs assume a simple convolutional network structure, and in addition, lend themselves to theoretical analyses that allow comprehensive understanding of the relation between their structure and their expressive properties. We thus obtain a generative model that is tractable on one hand, and on the other hand, allows effective representation of rich distributions in an easily controlled manner. These two capabilities are brought together in the task of classification under missing data, where TMMs deliver state of the art accuracies with seamless implementation and design. 1 Introduction There have been many attempts in recent years to marry generative models with neural networks, including successful methods, such as Generative Adversarial Networks [19], Variational AutoEncoders [24], NADE [38], and PixelRNN [39]. Though each of the above methods has demonstrated its usefulness on some tasks, it is yet unclear if their advantage strictly lies in their generative nature or some other attribute. More broadly, we ask if combining generative models with neural networks could lead to methods who have a clear advantage over purely discriminative models. On the most fundamental level, if X stands for an instance and Y for its class, generative models learn P(X, Y ), from which we can also infer P(Y |X), while discriminative models learn only P(Y |X). It might not be immediately apparent if this sole difference leads to any advantage. In Ng and Jordan [31], this question was studied with respect to the sample complexity, proving that under some cases it can be significantly lesser in favor of the generative classifier. We wish to highlight a more clear cut case, by examining the problem of classification under missing data – where the value of some of the entries of X are unknown at prediction time. Under these settings, discriminative classifiers typically rely on some form of data imputation, i.e. filling missing values by some auxiliary method prior to prediction. Generative classifiers, on the other hand, are naturally suited to handle missing values through marginalization – effectively assessing every possible completion of the missing values. Moreover, under mild assumptions, this method is optimal regardless of the process by which values become missing (see sec. 3). It is evident that such application of generative models assumes we can efficiently and exactly compute P(X, Y ), a process known as tractable inference. Moreover, it assumes we may efficiently marginalize over any subset of X, a procedure we refer to as tractable marginalization. Not all generative models have both of these properties, and specifically not the ones mentioned in the beginning of this section. Known models that do possess these properties, e.g. Latent Tree Model [30], have other limitations. A detailed discussion can be found in sec. 4, but in broad terms, all known generative models possess one of the following shortcomings: (i) they are insufficiently expressive to model high-dimensional data (images, audio, etc.), (ii) they require explicitly designing all the dependencies of the data, or (iii) they do not have tractable marginalization. Models based on neural networks typically solve (i) and (ii), but are incapable of (iii), while more classical methods, e.g. mixture models, solve (iii) but suffer from (i) and (ii). There is a long history of specifying tractable generative models through arithmetic circuits and sumproduct networks [12, 34] – computational graphs comprised solely of product and weighted sum nodes. To address the shortcomings above, we take a similar approach, but go one step further and leverage tensor analysis to distill it to a specific family of models we call Tensorial Mixture Models. A Tensorial Mixture Model assumes a convolutional network structure, but as opposed to previous methods tying generative models with neural networks, lends itself to theoretical analyses that allow a thorough understanding of the relation between its structure and its expressive properties. We thus obtain a generative model that is tractable on one hand, and on the other hand, allows effective representation of rich distributions in an easily controlled manner. 2 Tensorial Mixture Models One of the simplest types of tractable generative models are mixture models, where the probability distribution is defined the convex combination of M mixing components (e.g. Normal distribuPM tions): P(x) = d=1 P(d)P(x|d; θd ). Mixture models are very easy to learn, and many of them are able to approximate any probability distribution, given sufficient number of components, rendering them suitable for a variety of tasks. The disadvantage of classic mixture models is that they do not scale will to high dimensional data (“curse of dimensionality”). To address this challenge, we extend mixture models, leveraging the fact many high dimensional domains (e.g. images) are typically comprised of small, simple local structures. We represent a high dimensional instance as X = (x1 , . . . , xN ) – an N -length sequence of s-dimensional vectors x1 , . . . , xN ∈ Rs (called local structures). X is typically thought of as an image, where each local structure xi corresponds to a local patch from that image, where no two patches are overlapping. We assume that the distribution of individual local structures can be efficiently modeled by some mixture model of few components, which for natural image patches, was shown to be the case [42]. Formally, for all i ∈ [N ] there exists di ∈ [M ] such that xi ∼ P (x|di ; θdi ), where di is a hidden variable specifying the matching component for the i-th local structure. The probability density of sampling X is thus described by: P (X) = XM d1 ,...,dN =1 P (d1 , . . . , dN ) YN i=1 P (xi |di ; θdi ) (1) where P (d1 , . . . , dN ) represents the prior probability of assigning components d1 , . . . , dN to their respective local structures x1 , . . . , xN . As with classical mixture models, any probability density function P(X) could be approximated arbitrarily well by eq. 1, as M → ∞ (see app. A). At first glance, eq. 1 seems to be impractical, having an exponential number of terms. In the literature, this equation is known as the “Network Polynomial” [12], and the traditional method to overcome its intractability is to express P (d1 , . . . , dN ) by an arithmetic circuit, or sum-product networks, following certain constraints (decomposable and complete). We augment this method by viewing P (d1 , . . . , dN ) from an algebraic perspective, treating it as a tensor of order N and dimension M in each mode, i.e., as a multi-dimensional array, Ad1 ,...,dN specified by N indices d1 , . . . , dN , each ranging in [M ], where [M ]≡{1, . . . , M }. We refer to Ad1 ,...,dN ≡P (d1 , . . . , dN ) as the prior tensor. Under this perspective, eq. 1 can be thought of as a mixture model with tensorial mixing weights, thus we call the arising models Tensorial Mixture Models, or TMMs for short. 2 input X representa.on 1x1 conv hidden layer 0 pooling hidden layer L-1 1x1 conv pooling dense (output) xi M r0 r0 Y rep(i, d) = P (xi |d; ✓d ) ⌦ ↵ pool0 (j, ) = conv0 (j 0 , ) conv(j, ) = a0,j, , rep(j, :) 0 j 2window poolL 1 ( )= Y rL-1 convL rL-1 0 1 (j , ) j 0 covers space ⌦ P (X)= aL , poolL 1 (:) Figure 1: A generative variant of Convolutional Arithmetic Circuits. 2.1 ↵ Tensor Factorization, Tractability, and Convolutional Arithmetic Circuits Not only is it intractable to compute eq. 1, but it is also impossible to even store the prior tensor. We argue that addressing the latter is intrinsically tied to addressing the former. For example, if we impose a sparsity constraint on the prior tensor, then we only need to compute the few nonzero terms of eq. 1. TMMs with sparsity constraints can represent common generative models, e.g. GMMs (see app. B). However, they do not take full advantage of the prior tensor. Instead, we consider constraining TMMs with prior tensors that adhere to non-negative low-rank factorizations. We begin by examining the simplest case, where the prior tensor A takes a rank-1 form, i.e. there QN (i) exist vectors v(1) , . . . , v(N ) ∈ RM such that Ad1 ,...,dN = i=1 vdi , or in tensor product nota(i) tion, A = v(1) ⊗ Q · · · ⊗ v(N ) . If we interpret1 vd = P (di =d) as a probability over di , and so P (d1 , . . . , dN ) = i P (di ), then it reveals that imposing a rank-1 constraint is actually equivalent to assuming the hidden variables d1 , . . . , dN are statistically independent. Applying it to eq. 1 reQN PM sults in the tractable form P (X) = i=1 d=1 P (di =d)P (xi |di , θdi ), or in other words, a product of mixture models. Despite the familiar setting, this strict assumption severely limits expressivity. When restricting the prior tensor of eq. 1 to a factorization, we must ensure it represents actual probabilities, i.e. it is non-negative and its entries sum to one. This can be addressed through a restriction to non-negative factorizations, which translates to limiting the parameters of each convolutional kernel to the simplex. There is a vast literature on the relations between non-negative factorizations and generative models [21, 30]. As opposed to most of these works, we apply factorizations merely to derive our model and analyze its expressivity – not for learning its parameters (see sec. 2.3). Latent Tree Model In a broader setting, we look at general factorization schemes that given sufficient resources could represent any tensor. Namely, the CANDECOMP/PARAFAC (CP) and the Hierarchical Tucker (HT) factorizations. The CP factorization is simply a sum of rank-1 tensors, extending the previous case, and HT factorization can be seen as a recursive application of CP (see def. in app. C). Since both factorization schemes are solely based on product and weighted sum operations, they could be realized through arithmetic circuits. As shown by Cohen et al. [9], this gives rise to a specific class of convolutional networks named Convolutional Arithmetic Circuits (ConvACs), which consist of 1×1-convolutions, non-overlapping product pooling layers, and linear activations. More specifically, the CP factorization corresponds to shallow ConvACs, HT corresponds to deep ConvACs, and the number of channels in each layer corresponds to the respective concept of “rank” in each factorization scheme. In general, when a tensor factorization is applied to eq. 1, inference is equivalent to first computing the likelihoods of all mixing components {P (xi |d; θd )}M,N d=1,i=1 , in what we call the representation layer, followed by a ConvAC. A complete network is illustrated in fig. 1. d1 d2 di dN From a generative perspective, the restriction of convolutional kernels to the simplex results in a latent tree graphical model, as illusx1 x2 xi xN trated in fig. 2. Each hidden layer in the ConvAC network – a pair of convolution and pooling operations, corresponds to a transition Figure 2: Graphical model between two levels in the tree. More specifically, each level is com- description of HT-TMM prised of multiple latent variables, one for each spatial position in the input to a hidden layer in the network. Each latent variable in the input to the l-th layer takes values in [rl−1 ] – the number of channels in the layer that precedes it. 1 A represents a probability, and w.l.o.g. we can assume all entries of v(i) are non-negative and 3 PM d=1 (i) vd =1 Pooling operations in the network correspond to the parent-child relationships in the tree – a set of latent variables are siblings with a shared parent in the tree, if they are positioned in the same pooling window in the network. The weights of convolution operations correspond to the transition matrix between a parent and each of its children, i.e. if Hp is the parent latent variable, taking values in (c) [rl ], and Hchild is one of its child variables, taking values in [rl−1 ], then P (Hchild =i|Hp =c)=wi , where w(c) is the 1×1 convolutional kernel for the c-th output channel. With the above graphical representation in place, we can easily draw samples from our model. To conclude this subsection, by leveraging an algebraic perspective of the network polynomial (eq. 1), we show that tractability is related to the tensor properties of the priors, and in particular, that low rank factorizations are equivalent to inference via ConvACs. The application of arithmetic circuits to achieve tractability is by itself not a novelty. However, the particular convolutional arithmetic circuits we propose lead to a comprehensive understanding of representational abilities, and as a result, to a straightforward architectural design of TMMs. 2.2 Controlling the Expressivity and Inductive Bias of TMMs As discussed in sec. 1, it is not enough for a generative model to be tractable – it must also be sufficiently expressive, and moreover, we must also be able to understand how its structure affects its expressivity. In this section we explain how our algebraic perspective enables us to achieve this. To begin with, since we derived our model by factorizing the prior tensor, it immediately follows that given sufficient number of channels in the ConvAC, i.e. given sufficient ranks in the tensor factorization, any distribution could be approximated arbitrarily well (assuming M is allowed to grow). In short, this amounts to saying that TMMs are universal. Though many other generative models are known to be universal, it is typically not clear how one may assess what a given structure of finite size can and cannot express. In contrast, the expressivity of ConvACs has been throughly studied in a series of works [9, 8, 11, 27], each of which examined a different attribute of its structure. In Cohen et al. [9] it was proven that ConvACs exhibit the Depth Efficiency property, i.e. deep networks are exponentially more expressive than shallow ones. In Cohen and Shashua [8] it was shown that deep networks can efficiently model some input correlations but not all, and that by designing appropriate pooling schemes, different preferences may be encoded, i.e. the inductive bias may be controlled. In Cohen et al. [11] this result was extended to more complex connectivity patterns, involving mixtures of pooling schemes. Finally, in Levine et al. [27], an exact relation between the number of channels and the correlations supported by a network has been found, enabling tight control over expressivity and inductive bias. All of these results are brought forth by the relations of ConvACs to tensor factorizations. They allow TMMs to be analyzed and designed in much more principled ways than alternative high-dimensional generative models.2 2.3 Classification and Learning TMMs realized through ConvACs, sharing many of the same traits as ConvNets, are especially suitable to serve as classifiers. We begin by introducing a class variable Y , and model the conditional likelihood P(X|Y =y) for each y ∈ [K]. Though it is possible to have separate generative models for each class, it is much more efficient to leverage the relation to ConvNets and use a shared ConvAC instead, which is equivalent to a joint-factorization of the prior tensors for all classes. This results in a single network, where instead of a single scalar output representing P(X), multiple outputs are driven by the network, representing P(X|Y =y) for each class y. Predicting the class of a given instance is carried through Maximum A-Posteriori, i.e. by returning the most likely class. In the 1 common setting of uniform class priors, i.e. P(Y =y)≡ K , this corresponds to classification by maximal network output, as customary with ConvNets. We note that in practice, naı̈ve implementation of ConvACs is not numerically stable3 , and this is treated by performing all computations in log-space, which transforms ConvACs into SimNets – a recently introduced deep learning architecture [7, 10]. |S| Suppose now that we are given a training set S = {(X (i) ∈(Rs )N , Y (i) ∈[K])}i=1 of instances and labels, and would like to fit the parameters Θ of our model according to the Maximum Likelihood 2 As a demonstration of the fact that ConvAC analyses are not affected by the non-negativity and normalization restrictions of our generative variant, we prove in app. D that the Depth Efficiency property still holds. 3 Since high degree polynomials (as computed by ACs) are susceptible to numerical underflow or overflow. 4 principle, or equivalently, by minimizing the Negative Log-Likelihood (NLL) loss function: L(Θ) = E[− log PΘ (X, Y )]. The latter can be factorized into two separate loss terms: L(Θ) = E[− log PΘ (Y |X)] + E[− log PΘ (X)] where E[− log PΘ (Y |X)], which we refer to as the discriminative loss, is commonly known as the cross-entropy loss, and E[− log PΘ (X)], which corresponds to maximizing the prior likelihood P(X), has no analogy in standard discriminative classification. It is this term that captures the generative nature of the model, and we accordingly refer to it as the generative loss. Now, let NΘ (X (i) ; y):= log PΘ (X (i) |Y =y) stand for the y’th output of the SimNet (ConvAC in log-space) realizing our model with parameters Θ. In the case of uniform class priors (P(Y =y) ≡ 1/K ), the empirical estimation of L(Θ) may be written as: XK (i) 1 X|S| 1 X|S| eNΘ (X ;Y ) − log PK log eNΘ (X ;y) (i) NΘ (X ;y) i=1 i=1 y=1 |S| |S| y=1 e (i) L(Θ; S) = − (i) (2) This objective includes the standard softmax loss as its first term, and an additional generative loss as its second. Rather than employing dedicated Maximum Likelihood methods for training (e.g. Expectation Minimization), we leverage once more the resemblance between our networks and ConvNets, and optimize the above objective using Stochastic Gradient Descent (SGD). 3 Classification under Missing Data through Marginalization A major advantage of generative models over discriminative ones lies in their ability to cope with missing data, specifically in the context of classification. By and large, discriminative methods either attempt to complete missing parts of the data before classification (a process known as data imputation), or learn directly to classify data with missing values [28]. The first of these approaches relies on the quality of data completion, a much more difficult task than the original one of classification under missing data. Even if the completion was optimal, the resulting classifier is known to be sub-optimal (see app. E). The second approach does not rely on data completion, but nonetheless assumes that the distribution of missing values at train and test times are similar, a condition which often does not hold in practice. Indeed, Globerson and Roweis [17] coined the term “nightmare at test time” to refer to the common situation where a classifier must cope with missing data whose distribution is different from that encountered in training. As opposed to discriminative methods, generative models are endowed with a natural mechanism for classification under missing data. Namely, a generative model can simply marginalize over missing values, effectively classifying under all possible completions, weighing each completion according to its probability. This, however, requires tractable inference and marginalization. We have already shown in sec. 2 that TMMs support the former, and will show in sec. F that marginalization can be just as efficient. Beforehand, we lay out the formulation of classification under missing data. Let X be a random vector in Rs representing an object, and let Y be a random variable in [K] representing its label. Denote by D(X , Y) the joint distribution of (X , Y), and by (x∈Rs , y∈[K]) specific realizations thereof. Assume that after sampling a specific instance (x, y), a random binary vector M is drawn conditioned on X =x. More concretely, we sample a binary mask m∈{0, 1}s (realization of M) according to a distribution Q(·|X =x). xi is considered missing if mi is equal to zero, and observed otherwise. Formally, we consider the vector x m, whose i’th coordinate is defined to hold xi if mi =1, and the wildcard ∗ if mi =0. The classification task is then to predict y given access solely to x m. Following the works of Rubin [36], Little and Rubin [28], we consider three cases for the missingness distribution Q(M=m|X =x): missing completely at random (MCAR), where M is independent of X , i.e. Q(M=m|X =x) is a function of m but not of x; missing at random (MAR), where M is independent of the missing values in X , i.e. Q(M=m|X =x) is a function of both m and x, but is not affected by changes in xi if mi =0; and missing not at random (MNAR), covering the rest of the distributions for which M depends on missing values in X , i.e. Q(M=m|X =x) is a function of both m and x, which at least sometimes is sensitive to changes in xi when mi =0. Let P be the joint distribution of the object X , label Y, and missingness mask M: P(X =x, Y=y, M=m) = D (X =x, Y=y) · Q(M=m|X =x) 5 For given x∈Rs and m∈{0, 1}s , denote by o(x, m) the event where the random vector X coincides with x on the coordinates i for which mi =1. For example, if m is an all-zero vector, o(x, m) covers the entire probability space, and if m is an all-one vector, o(x, m) corresponds to the event X =x. With these notations in hand, we are now ready to characterize the optimal predictor in the presence of missing data. The proofs are common knowledge, but provided in app. E for completeness. Claim 1. For any data distribution D and missingness distribution Q, the optimal classification rule in terms of 0-1 loss is given by predicting the class y ∈ [K], that maximizes P(Y=y|o(x, m)) · P(M=m|o(x, m), Y=y), for an instance x m. When the distribution Q is MAR (or MCAR), the optimal classifier admits a simpler form, referred to as the marginalized Bayes predictor: Corollary 1. Under the conditions of claim 1, if the distribution Q is MAR (or MCAR), the optimal classification rule may be written as: h∗ (x m) = argmaxy P(Y=y|o(x, m)) (3) Corollary 1 indicates that in the MAR setting, which is frequently encountered in practice, optimal classification does not require prior knowledge regarding the missingness distribution Q. As long as one is able to realize the marginalized Bayes predictor (eq. 3), or equivalently, to compute the likelihoods of observed values conditioned on labels (P(o(x, m)|Y =y)), classification under missing data is guaranteed to be optimal, regardless of the corruption process taking place. This is in stark contrast to discriminative methods, which require access to the missingness distribution during training, and thus are not able to cope with unknown conditions at test time. Most of this section dealt with the task of prediction given an input with missing data, where we assumed we had access to a “clean” training set, and only faced missingness during prediction. However, many times we wish to tackle the reverse task, where the training set itself is riddled with missing data. Tractability leads to an advantage here as well: under the MAR assumption, learning from missing data with the marginalized likelihood objective results in an unbiased classifier [28]. In the case of TMMs, marginalizing over missing values is just as efficient as plain inference – requires only a single pass through the corresponding network. The exact mechanism is carried out in similar fashion as in sum-product networks, and is covered in app. F. Accordingly, the marginalized Bayes predictor (eq. 3) is realized efficiently, and classification under missing data (in the MAR setting) is optimal (under generative assumption), regardless of the missingness distribution. 4 Related Works There are many generative models realized through neural networks, and convolutional networks in particular, e.g. Generative Adversarial Networks [19], Variational Auto-Encoders [24], and NADE [38]. However, most do not posses tractable inference, and of the few that do, non posses tractable marginalization over any set of variables. Due to limits of space, we defer the discussion on the above to app. G, and in the remainder of this section focus instead on the most relevant works. As mentioned in sec. 2, we build on the approach of specifying generative models through Arithmetic Circuits (ACs) [12], and specifically, our model is a strict subclass of the well-known SumProduct Networks (SPNs) [34], under the decomposable and complete restrictions. Where our work differs is in our algebraic approach to eq. 1, which gives rise to a specific structure of ACs, called ConvACs, and a deep theory regarding their expressivity and inductive bias (see sec. 2.2). In contrast to the structure we proposed, the current literature on general SPNs does not prescribe any specific structures, and its theory is limited to either very specific instances [14], or very broad classes, e.g fixed-depth circuits [29]. In the early works on SPNs, specialized networks of complex structure were designed for each task based mainly on heuristics, often bearing little resemblance to common neural networks. Contemporary works have since moved on to focus mainly on learning the structure of SPNs directly from data [33, 16, 1, 35], leading to improved results in many domains. Despite that, only few published studies have applied this method to natural domains (images, audio, etc.), on which only limited performance, compared to other common methods, was reported, specifically on the MNIST dataset [1]. The above suggests that choosing the right architecture of general SPNs, at least on some domains, remains to be an unsolved problem. In addition, both the previously studied manually-designed SPNs, as well as ones with a learned structure, lead to models, which 6 n= 0 25 50 75 100 125 150 LP HT-TMM 97.9 98.5 97.5 98.2 96.4 97.8 94.1 96.5 89.2 93.9 80.9 87.1 70.2 76.3 Table 1: Prediction for each two-class task of MNIST digits, under feature deletion noise. 0.50 0.75 0.90 0.95 0.99 0.25 0.50 0.75 0.90 0.95 0.99 98.9 99.1 98.9 97.6 95.7 87.3 97.8 98.6 98.7 97.5 95.6 86.7 78.9 94.6 97.2 96.7 94.8 85.0 32.4 68.1 83.9 89.0 88.3 78.2 17.6 37.9 56.4 71.0 74.0 66.2 11.0 12.9 16.7 21.3 30.5 31.3 i.i.d. (rand) rects (rand) 98.7 98.2 98.4 95.7 97.0 83.2 87.6 54.7 70.6 35.8 29.6 17.5 100 Test Accuracy (%) ptest 0.25 ptrain 90 80 70 60 50 rects (fixed) rects (rand) i.i.d. (rand) (1,7) (2,7) (3,7) (1,11) (2,11) (3,11) (1,15) (2,15) (3,15) (Number of Rectangles, Width) (b) MNIST with missing rectangles. (a) MNIST with i.i.d. corruption Figure 3: We examine ConvNets trained on one missingness distribution while tested on others. “(rand)” denotes training on distributions with randomized parameters. (a) i.i.d. corruption: trained with probability ptrain and tested on ptest . (b) missing rectangles: training on randomized distributions (rand) compared to training on the same (fixed) missing rectangles distribution. according to recent works on GPU-optimized algorithms [4], cannot be efficiently implemented due to their irregular memory access patterns. This is in stark contrast to our model, which leverages the same patterns as modern ConvNets, and thus enjoys similar run-time performance. An additional difference in our work is that we manage to successfully train our model using standard SGD. Even though this approach has already been considered by Poon and Domingos [34], they deemed it lacking and advocated for specialized optimization algorithms instead. Outside the realm of generative networks, tractable graphical models, e.g. Latent Tree Models (LTMs) [30], are the most common method for tractable inference. Similar to SPNs, it is not straightforward to find the proper structure of graphical models for a particular problem, and most of the same arguments apply here as well. Nevertheless, it is noteworthy that recent progress in structure and parameters learning of LTMs [22, 3] was also brought forth by connections to tensor factorizations, similar to our approach. Unlike the aforementioned algorithms, we utilize tensor factorizations solely for deriving our model and analyzing its expressivity, while leaving learning to SGD – the most successful method for training neural networks. Leveraging their perspective to analyze the optimization properties of our model is viewed as a promising avenue for future research. 5 Experiments We demonstrate the properties of TMMs through both qualitative and quantitative experiments. In sec. 5.1 we present state of the art results on image classification under missing data, with robustness to various missingness distributions. In sec. 5.2 we show that our results are not limited to images, by applying TMMs for speech recognition. Finally, in app. H we show visualizations of samples drawn from TMMs, shedding light on their generative nature. Our implementation, based on Caffe [23] and MAPS [4] (toolbox for efficient GPU code generation), as well as all other code for reproducing our experiments, are available at: https://github.com/HUJI-Deep/Generative-ConvACs. Extended details regarding the experiments are provided in app. I. 5.1 Image Classification under Missing Data In this section we experiment on two datasets: MNIST [25] for digit classification, and small NORB [26] for 3D object recognition. In our results, we refer to models using shallow networks as CP-TMM, and to those using deep networks as HT-TMM, in accordance with the respective tensor factorizations (see sec. 2). The theory discussed in sec. 2.2 guided our exact choice of architectures. Namely, we used the fact [27] that the capacity to model either short- or long-range correlations in the input, is related to the number of channels in the beginning or end of a network, respectively. In MNIST, discriminating between digits has more to do with long-range correlations than the basic strokes digits are made of, hence we chose to start with few channels and end with many – layer 7 100 90 80 70 60 50 40 30 20 10 Test Accuracy (%) KNN Zero Mean GSN NICE DPM NADE MP-DBM * SPN CP-TMM HT-TMM 0.00 0.25 0.50 0.75 0.90 Probability of Missing Pixels 0.95 0.99 (a) MNIST with i.i.d. corruption. KNN Zero Mean NICE DPM HT-TMM 0.00 0.25 0.50 0.75 0.90 Probability of Missing Pixels 0.95 100 90 80 70 60 50 40 30 20 10 KNN Zero Mean GSN NICE DPM NADE SPN CP-TMM HT-TMM (1,7) (2,7) (3,7) (1,11) (2,11) (3,11) (1,15) (2,15) (3,15) (Number of Rectangles, Width) Test Accuracy (%) Test Accuracy (%) Test Accuracy (%) 100 90 80 70 60 50 40 30 20 10 0.99 100 90 80 70 60 50 40 30 20 10 (b) MNIST with missing rectangles. KNN Zero Mean NICE DPM HT-TMM (1,7) (2,7) (3,7) (1,11) (2,11) (3,11) (1,15) (2,15) (3,15) (Number of Rectangles, Width) (d) NORB with missing rectangles. (c) NORB with i.i.d. corruption. Figure 4: Blind classification under missing data. (a,c) Testing i.i.d. corruption with probability p for each pixel. (b,d) Testing missing rectangles corruption with n missing rectangles, each of width and hight equal to W . (*) Based on the published results [18]. (†) Data imputation algorithms. widths were set to 64-128-256-512. In contrast, the classes of NORB differ in much finer details, requiring more channels in the first layers, hence layer widths were set to 256-256-256-512. In both cases, M = 32 Gaussian mixing components were used. We begin by comparing our generative approach to missing data against classical methods, namely, methods based on Globerson and Roweis [17]. They regard missing data as “feature deletion” noise, replace missing entries by zeros, and devise a learning algorithm over linear predictors that takes the number of missing features, n, into account. The method was later improved by Dekel and Shamir [13]. We compare TMMs to the latter, with n non-zero pixels randomly chosen and changed to zero, in the two-class prediction task derived from each pair of MNIST digits. Due to limits of their implementation, only 300 images per digit are used for training. Despite this, and the fact that the evaluated scenario is of the MNAR type (on which optimality is not guaranteed – see sec. 3), we achieve significantly better results (see table 1), and unlike their method, which requires several classifiers and knowing n, we use a single TMM with no prior knowledge. Heading on to multi-class prediction under missing data, we focus on the challenging “blind” setting, where the missingness distribution at test time is completely unknown during training. We simulate two kinds of MAR missingness distributions: (i) an i.i.d. mask with a fixed probability p ∈ [0, 1] of dropping each pixel, and (ii) a mask composed of the union of n (possibly overlapping) rectangles of width and height W , each positioned randomly in the image (uniform distribution). We first demonstrate that purely discriminative classifiers cannot generalize to all missingness distributions, by training the standard LeNeT ConvNet [25] on one set of distributions and then testing it on others (see fig. 3). Next, we present our main results. We compare our model against three different approaches. First, as a baseline, we use K-Nearest Neighbors (KNN) to vote on the most likely class, augmented with an l2 -metric that disregards missing coordinates. KNN actually scores better than most methods, but its missingness-aware distance metric prevents the common memory and runtime optimizations, making it impractical for real-world settings. Second, we test various dataimputation methods, ranging from simply filling missing pixels with zeros or their mean, to modern generative models suited to inpainting. Data imputation is followed by a ConvNet prediction on the completed image. In general, we find that this approach only works well when few pixels are missing. Finally, we test generative classifiers other than our model, including MP-DBM and SPN (sum-product networks). MP-DBM is notable for being limited to approximations, and its results show the importance of using exact inference instead. For SPN, we have augmented the model from Poon and Domingos [34] with a class variable Y , and trained it to maximize the joint probability P (X, Y ) using the code of Zhao et al. [41]. The inferior performance of SPN suggests 8 that the structure of TMMs, which are in fact a special case, is advantageous. Due to limitations of available public code and time, not all methods were tested on all datasets and distributions. See fig. 4 for the complete results. To conclude, TMMs significantly outperform all other methods tested on image classification with missing data. Although they are a special case of SPNs, their particular structure appears to be more effective than ones existing in the literature. We attribute this superiority to the fact that their architectural design is backed by comprehensive theoretical studies (see sec. 2.2). 5.2 Speech Recognition under Missing Data To demonstrate the versatility of TMMs, we also conducted limited experiments on the TIMIT speech recognition dataset, following the same protocols as in sec. 5.1. We trained a TMM and a standard ConvNet on 256ms windows of raw data at 16Hz sample rate to predict the phoneme at the center of a window. Both the TMM and the ConvNet reached 78% accuracy on the clean dataset, but when half of the audio is missing i.i.d., accuracy of the ConvNet with mean imputation drops to 34%, while the TMM remains at 63%. Utilizing common audio inpainting methods [2] only improves accuracy of the ConvNet to 48%, well below that of TMM. 6 Summary This paper focuses on generative models which admit tractable inference and marginalization, capabilities that lie outside the realm of contemporary neural network-based generative methods. We build on prior works on tractable models based on arithmetic circuits and sum-product networks, and leverage concepts from tensor analysis to derive a sub-class of models we call Tensorial Mixture Models (TMMs). In contrast to existing methods, our algebraic approach leads to a comprehensive understanding of the relation between model structure and representational properties. In practice, utilizing this understanding for the design of TMMs has led to state of the art performance in classification under missing data. We are currently investigating several avenues for future research, including semi-supervised learning, and examining more intricate ConvAC architectures, such as the ones suggested by Cohen et al. [11]). Acknowledgments This work is supported by Intel grant ICRI-CI #9-2012-6133, by ISF Center grant 1790/12 and by the European Research Council (TheoryDL project). Nadav Cohen is supported by a Google Fellowship in Machine Learning. References [1] Tameem Adel, David Balduzzi, and Ali Ghodsi. Learning the Structure of Sum-Product Networks via an SVD-based Algorithm. UAI, 2015. [2] A Adler, V Emiya, M G Jafari, and M Elad. Audio inpainting. IEEE Trans. on Audio, Speech and Language Processing, 20:922–932, March 2012. [3] Animashree Anandkumar, Rong Ge, Daniel Hsu, Sham M Kakade, and Matus Telgarsky. Tensor decompositions for learning latent variable models. Journal of Machine Learning Research (), 15(1):2773–2832, 2014. [4] Tal Ben-Nun, Ely Levy, Amnon Barak, and Eri Rubin. Memory Access Patterns: The Missing Piece of the Multi-GPU Puzzle. In Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, pages 19:1–19:12. ACM, 2015. [5] Yoshua Bengio, Éric Thibodeau-Laufer, Guillaume Alain, and Jason Yosinski. Deep Generative Stochastic Networks Trainable by Backprop. In International Conference on Machine Learning, 2014. [6] Richard Caron and Tim Traynor. The Zero Set of a Polynomial. WSMR Report 05-02, 2005. [7] Nadav Cohen and Amnon Shashua. SimNets: A Generalization of Convolutional Networks. In Advances in Neural Information Processing Systems NIPS, Deep Learning Workshop, 2014. 9 [8] Nadav Cohen and Amnon Shashua. Inductive Bias of Deep Convolutional Networks through Pooling Geometry. In International Conference on Learning Representations ICLR, April 2017. [9] Nadav Cohen, Or Sharir, and Amnon Shashua. On the Expressive Power of Deep Learning: A Tensor Analysis. In Conference on Learning Theory COLT, May 2016. [10] Nadav Cohen, Or Sharir, and Amnon Shashua. Deep SimNets. In Computer Vision and Pattern Recognition CVPR, May 2016. [11] Nadav Cohen, Ronen Tamari, and Amnon Shashua. Boosting Dilated Convolutional Networks with Mixed Tensor Decompositions. arXiv.org, 2017. [12] Adnan Darwiche. A differential approach to inference in Bayesian networks. Journal of the ACM (JACM), 50(3):280–305, May 2003. [13] Ofer Dekel and Ohad Shamir. Learning to classify with missing and corrupted features. In International Conference on Machine Learning. ACM, 2008. [14] Olivier Delalleau and Yoshua Bengio. Shallow vs. Deep Sum-Product Networks. Advances in Neural Information Processing Systems, pages 666–674, 2011. [15] Laurent Dinh, David Krueger, and Yoshua Bengio. NICE: Non-linear Independent Components Estimation. arXiv.org, October 2014. [16] R Gens and P M Domingos. Learning the Structure of Sum-Product Networks. Internation Conference on Machine Learning, 2013. [17] Amir Globerson and Sam Roweis. Nightmare at test time: robust learning by feature deletion. In International Conference on Machine Learning. ACM, 2006. [18] Ian Goodfellow, Mehdi Mirza, Aaron Courville, and Yoshua Bengio. Multi-Prediction Deep Boltzmann Machines. Advances in Neural Information Processing Systems, 2013. [19] Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative Adversarial Nets. Advances in Neural Information Processing Systems, 2014. [20] W Hackbusch and S Kühn. A New Scheme for the Tensor Representation. Journal of Fourier Analysis and Applications, 15(5):706–722, 2009. [21] Thomas Hofmann. Probabilistic latent semantic analysis. Morgan Kaufmann Publishers Inc., July 1999. [22] Furong Huang, Niranjan U N, Ioakeim Perros, Robert Chen, Jimeng Sun, and Anima Anandkumar. Scalable Latent Tree Model and its Application to Health Analytics. In NIPS Machine Learning for Healthcare Workshop, 2015. [23] Yangqing Jia, Evan Shelhamer, Jeff Donahue, Sergey Karayev, Jonathan Long, Ross B Girshick, Sergio Guadarrama, and Trevor Darrell. Caffe: Convolutional Architecture for Fast Feature Embedding. CoRR abs/1202.2745, cs.CV, 2014. [24] Diederik P Kingma and Max Welling. Auto-Encoding Variational Bayes. In International Conference on Learning Representations, 2014. [25] Yan LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. [26] Yann LeCun, Fu Jie Huang, and Léon Bottou. Learning Methods for Generic Object Recognition with Invariance to Pose and Lighting. Computer Vision and Pattern Recognition, 2004. [27] Yoav Levine, David Yakira, Nadav Cohen, and Amnon Shashua. Deep Learning and Quantum Entanglement: Fundamental Connections with Implications to Network Design. arXiv.org, April 2017. [28] Roderick J A Little and Donald B Rubin. Statistical analysis with missing data (2nd edition). John Wiley & Sons, Inc., September 2002. [29] James Martens and Venkatesh Medabalimi. On the Expressive Efficiency of Sum Product Networks. CoRR abs/1202.2745, cs.LG, 2014. [30] Raphaël Mourad, Christine Sinoquet, Nevin Lianwen Zhang, Tengfei Liu, and Philippe Leray. A Survey on Latent Tree Models and Applications. J. Artif. Intell. Res. (), cs.LG:157–203, 2013. 10 [31] Andrew Y Ng and Michael I Jordan. On Discriminative vs. Generative Classifiers: A comparison of logistic regression and naive Bayes. In Advances in Neural Information Processing Systems NIPS, Deep Learning Workshop, 2002. [32] F Pedregosa, G Varoquaux, A Gramfort, V Michel, B Thirion, O Grisel, M Blondel, P Prettenhofer, R Weiss, V Dubourg, J Vanderplas, A Passos, D Cournapeau, M Brucher, M Perrot, and E Duchesnay. Scikit-learn: Machine Learning in Python. Journal of Machine Learning Research (), 12:2825–2830, 2011. [33] Robert Peharz, Bernhard C Geiger, and Franz Pernkopf. Greedy Part-Wise Learning of Sum-Product Networks. In Machine Learning and Knowledge Discovery in Databases, pages 612–627. Springer Berlin Heidelberg, Berlin, Heidelberg, September 2013. [34] Hoifung Poon and Pedro Domingos. Sum-Product Networks: A New Deep Architecture. In Uncertainty in Artificail Intelligence, 2011. [35] Amirmohammad Rooshenas and Daniel Lowd. Learning Sum-Product Networks with Direct and Indirect Variable Interactions. ICML, 2014. [36] Donald B Rubin. Inference and missing data. Biometrika, 63(3):581–592, December 1976. [37] Jascha Sohl-Dickstein, Eric A Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep Unsupervised Learning using Nonequilibrium Thermodynamics. Internation Conference on Machine Learning, 2015. [38] Benigno Uria, Marc-Alexandre C ô t é, Karol Gregor, Iain Murray, and Hugo Larochelle. Neural Autoregressive Distribution Estimation. Journal of Machine Learning Research (), 17(205):1–37, 2016. [39] Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel Recurrent Neural Networks. In International Conference on Machine Learning, 2016. [40] Matthew D Zeiler and Rob Fergus. Visualizing and Understanding Convolutional Networks. In European Conference on Computer Vision. Springer International Publishing, 2014. [41] Han Zhao, Pascal Poupart, and Geoff Gordon. A Unified Approach for Learning the Parameters of Sum-Product Networks. In Advances in Neural Information Processing Systems NIPS, Deep Learning Workshop, 2016. [42] Daniel Zoran and Yair Weiss. From learning models of natural image patches to whole image restoration. ICCV, pages 479–486, 2011. 11 A The Universality of Tensorial Mixture Models In this section we prove the universality property of Generative ConvACs, as discussed in sec. 2. We begin by taking note from functional analysis and define a new property called PDF total set, which is similar in concept to a total set, followed by proving that this property is invariant under the cartesian product of functions, which entails the universality of these models as a corollary. Definition 1. Let F be a set of PDFs over Rs . F is PDF total iff for any PDF h(x) over Rs and for all  > 0 P < . In there exists M ∈ N, {f1 (x), . . . , fM (x)} ⊂ F and w ∈ 4M −1 s.t. h(x) − M i=1 wi fi (x) 1 other words, a set is a PDF total set if its convex span is a dense set under L1 norm. Q Claim 2. Let F be a set of PDFs over Rs and let F ⊗N = { N i=1 fi (x)|∀i, fi (x) ∈ F} be a set of PDFs over s N ⊗N the product space (R ) . If F is a PDF total set then F is PDF total set. Proof. If F is the set of Gaussian PDFs over Rs with diagonal covariance matrices, which is known to be a PDF total set, then F ⊗N is the set of Gaussian PDFs over (Rs )N with diagonal covariance matrices and the claim is trivially true. Otherwise, let h(x1 , . . . , xN ) be a PDF over (Rs )N and let  > 0. From the above, there exists K ∈ N, w ∈ 4M1 −1 and a set of diagonal Gaussians {gij (x)}i∈[M1 ],j∈[N ] s.t. g(x) − M1 X wi N Y j=1 i=1 < gij (xj )  2 (4) 1 Additionally, since F is a PDF total set then there exists M2 ∈ N, {fk (x)}k∈[M2 ] ⊂ F and {wij ∈ P 2  4M2 −1 }i∈[M1 ],j∈[N ] s.t. for all i ∈ [M1 ], j ∈ [N ] it holds that gij (x) − M < 2N , k=1 wijk fk (x) 1 from which it is trivially proven using a telescopic sum and the triangle inequality that: M1 X i=1 wi N Y gij (x) − M1 X wi i=1 j=1 M2 N X Y wijk fk (xj ) j=1 k=1 <  2 (5) 1 From eq. 4, eq. 5 the triangle inequality it holds that: M2 X g(x) − Ak1 ,...,kN N Y fkj (xj ) j=1 k1 ,...,kN =1 < 1 P 1 QN PM2 N where Ak1 ,...,kN = M i=1 wi j=1 wijkj which holds k1 ,...,kN =1 Ak1 ,...,kN = 1. Taking M = M2 , QN { j=1 fkj (xj )}k1 ∈[M2 ],...,kN ∈[M2 ] ⊂ F ⊗N and w = vec(A) completes the proof. Corollary 2. Let F be a PDF total set of PDFs over Rs , then the family of Generative ConvACs with mixture components from F can approximate any P DF over (Rs )N arbitrarily well, given arbitrarily many components. B TMMs with Sparsity Constraints Can Represent Gaussian Mixture Models As discussed in sec. 2, TMMs become tractable when a sparsity constraint is imposed on the priors tensor, i.e. most of the entries of the tensors are replaced with zeros. In this section, we demonstrate that under such a case, TMMs can represent Gaussian Mixture Models with diagonal covariance matrices, probably the most common type of mixture models. With the same notations as sec. 2, assume the number of mixing components of the TMM is M = N · K for some K ∈ N, let {N (x; µki , diag(σ 2ki ))}K,N be these components, and finally, assume the prior tensor has k,i the following structure: ( wk ∀i ∈ [N ], di =N ·(k−1)+i P (d1 , . . . , dN ) = 0 Otherwise then eq. 1 reduces to: P (X) = µ̃k = XK YN wk k=1 i=1 (µTk1 , . . . , µTkN )T N (x; µki , diag(σ 2ki )) = σ̃ 2k = XK wk N (x; µ̃k , diag(σ̃ 2k )) k=1 ((σ 2k1 )T , . . . , (σ 2kN )T )T which is equivalent to a diagonal GMM with mixing weights w ∈ 4K−1 (where 4K−1 is the K-dimensional 2 K simplex) and Gaussian mixture components with means {µ̃k }K k=1 and covariances {diag(σ̃ k )}k=1 . 12 C Background on Tensor Factorizations In this section we establish the minimal background in the field of tensor analysis required for following our work. A tensor is best thought of as a multi-dimensional array Ad1 ,...,dN ∈ R, where ∀i ∈ [N ], di ∈ [Mi ]. The number of indexing entries in the array, which are also called modes, is referred to as the order of the tensor. The number of values an index of a particular mode can take is referred to as the dimension of the mode. The tensor A ∈ RM1 ⊗...⊗MN mentioned above is thus of order N with dimension Mi in its i-th mode. For our purposes we typically assume that M1 = . . . = MN = M , and simply denote it as A ∈ (RM )⊗N . The fundamental operator in tensor analysis is the tensor product. The tensor product operator, denoted by ⊗, is a generalization of outer product of vectors (1-ordered vectors) to any pair of tensors. Specifically, let A and B be tensors of order P and Q respectively, then the tensor product A ⊗ B results in a tensor of order P + Q, defined by: (A ⊗ B)d1 ,...,dP +Q = Ad1 ,...,dP · BdP +1 ,...,dP +Q . The main concept from tensor analysis we use in our work is that of tensor decompositions. The most straightforward and common tensor decomposition format is the rank-1 decomposition, also known as a CANDECOMP/PARAFAC decomposition, or in short, a CP decomposition. The CP decomposition is a natural extension of low-rank matrix decomposition to general tensors, both built upon the concept of a linear combination of rank-1 elements. Similarly to matrices, tensors of the form v(1) ⊗ · · · ⊗ v(N ) , where v(i) ∈ RMi are non-zero vectors, are regarded as N -ordered rank-1 tensors, thus the rank-Z CP decomposition of a tensor A is naturally defined by: A= Z X az az,1 ⊗ · · · ⊗ az,N z=1 ⇒ Ad1 ,...,dN = Z X az z=1 N Y az,i di (6) i=1 Z where {az,i ∈ RMi }N,Z are the parameters of the decomposition. As mentioned above, i=1,z=1 and a ∈ R for N = 2 it is equivalent to low-order matrix factorization. It is simple to show that any tensor A can be represented by the CP decomposition for some Z, where the minimal such Z is known as its tensor rank. Another decomposition we will use in this paper is of a hierarchical nature and known as the Hierarchical Tucker decomposition [20], which we will refer to as HT decomposition. While the CP decomposition combines vectors into higher order tensors in a single step, the HT decomposition does that more gradually, combining vectors into matrices, these matrices into 4th ordered tensors and so on recursively in a hierarchically fashion. Specifically, the following describes the recursive formula of the HT decomposition4 for a tensor A ∈ (RM )⊗N where N = 2L , i.e. N is a power of two5 : r0 X φ1,j,γ = a1,j,γ a0,2j−1,α ⊗ a0,2j,α α α=1 ··· rl−1 X φl,j,γ = α=1 al,j,γ φl−1,2j−1,α ⊗ φl−1,2j,α α | {z } | {z } order 2l−1 order 2l−1 ··· rL−2 φL−1,j,γ = X α=1 aL−1,j,γ φL−2,2j−1,α ⊗ φL−2,2j,α α {z } | {z } | order N 4 order N 4 rL−1 A= X α=1 L−1,1,α aL ⊗ φL−1,2,α αφ | {z } | {z } order N 2 order (7) N 2 l,j,γ where the parameters of the decomposition are the vectors {a ∈Rrl−1 }l∈{0,...,L−1},j∈[N/2l ],γ∈[rl ] and the L rL−1 top level vector a ∈ R , and the scalars r0 , . . . , rL−1 ∈ N are referred to as the ranks of the decomposition. Similar to the CP decomposition, any tensor can be represented by an HT decomposition. Moreover, 4 More precisely, we use a special case of the canonical HT decomposition as presented in Hackbusch and Kühn [20]. In the terminology of the latter, the matrices Al,j,γ are diagonal and equal to diag(al,j,γ ) (using the notations from eq. 7). 5 The requirement for N to be a power of two is solely for simplifying the definition of the HT decomposition. More generally, instead of defining it through a complete binary tree describing the order of operations, the canonical decomposition can use any balanced binary tree. 13 any given CP decomposition can be converted to an HT decomposition by only a polynomial increase in the number of parameters. Finally, since we are dealing with generative models, the tensors we study are non-negative and sum to one, i.e. the vectorization of A (rearranging its entries to the shape of a vector), denoted by vec(A), is constrained to lie in the multi-dimensional simplex, denoted by: n o Xk+1 4k := x ∈ Rk+1 | xi = 1, ∀i ∈ [k + 1] : xi ≥ 0 (8) i=1 D Proof for the Depth Efficiency of Convolutional Arithmetic Circuits with Simplex Constraints In this section we prove that the depth efficiency property of ConvACs that was proved in Cohen et al. [9] applies also to the generative variant of ConvACs we have introduced in sec. 2. Our analysis relies on basic knowledge of tensor analysis and its relation to ConvACs, specifically, that the concept of “ranks” of each factorization scheme is equivalent to the number of channels in these networks. For completeness, we provide a short introduction to tensor analysis in app. C. The We prove the following theorem, which is the generative analog of theorem 1 from [9]: Theorem 1. Let Ay be a tensor of order N and dimension M in each mode, generated by the recursive formulas in eq. 7, under the simplex constraints introduced in sec. 2. Define r := min{r0 , M }, and consider the space of all possible configurations for the parameters of the decomposition – {al,j,γ ∈ 4rl−1 −1 }l,j,γ . N In this space, the generated tensor Ay will have CP-rank of at least r /2 almost everywhere (w.r.t. the product N measure of simplex spaces). Put differently, the configurations for which the CP-rank of Ay is less than r /2 form a set of measure zero. The exact same result holds if we constrain the composition to be “shared”, i.e. set al,j,γ ≡ al,γ and consider the space of {al,γ ∈ 4rl−1 −1 }l,γ configurations. The only differences between ConvACs and their generative counter-parts are the simplex constraints applied to the parameters of the models, which necessitate a careful treatment to the measure theoretical arguments of the original proof. More specifically, while the k-dimensional simplex 4k is a subset of the k + 1-dimensional space Rk+1 , it has a zero measure with respect to the Lebesgue measure over Rk+1 . The standard method to define a measure over 4k is by the Lebesgue measure over Rk of its projection to that space, i.e. let λ : Rk → R be the Lebesgue measure over Rk , p : Rk+1 → Rk , p(x) = (x1 , . . . , xk )T be a projection, and A ⊂ 4k be a subset of the simplex, then the latter’s measure is defined as λ(p(A)). Notice that p(4k ) has a positive measure, and moreover that p is invertible over the set p(4k ), and that its inverse is given by P p−1 (x1 , . . . , xk ) = (x1 , . . . , xk , 1 − ki=1 xi ). In our case, the parameter space is the cartesian product of several simplex spaces of different dimensions, for each of them the measure is defined as above, and the measure over their cartesian product is uniquely defined by the product measure. Though standard, the choice of the projection function p above could be seen as a limitation, however, the set of zero measure sets in 4k is identical for any reasonable choice of a projection π (e.g. all polynomial mappings). More specifically, for any projection π : Rk+1 → Rk that is invertible over π(4k ), π −1 is differentiable, and the Jacobian of π −1 is bounded over π(4k ), then a subset A ⊂ 4k is of measure zero w.r.t. the projection π iff it is of measure zero w.r.t. p (as defined above). This implies that if we sample the weights of the generative decomposition (eq. 7 with simplex constraints) by a continuous distribution, a property that holds with probability 1 under the standard parameterization (projection p), will hold with probability 1 under any reasonable parameterization. We now state and prove a lemma that will be needed for our proof of theorem 1. Lemma 1. Let M, N, K ∈ N, 1 ≤ r ≤ min{M, N } and a polynomial mapping A : RK → RM ×N (i.e. for every i ∈ [M ], j ∈ [N ] then Aij : Rk → R is a polynomial function). If there exists a point x ∈ RK s.t. rank (A(x)) ≥ r, then the set {x ∈ RK |rank (A(x)) < r} has zero measure. Proof. Remember that rank (A(x)) ≥ r iff there exits a non-zero r × r minor  of A(x), which is polynomial N in the entries of A(x), and so it is polynomial in x as well. Let c = M · be the number of minors in A, r r P denote the minors by {fi (x)}ci=1 , and define the polynomial function f (x) = ci=1 fi (x)2 . It thus holds that f (x) = 0 iff for all i ∈ [c] it holds that fi (x) = 0, i.e. f (x) = 0 iff rank (A(x)) < r. Now, f (x) is a polynomial in the entries of x, and so it either vanishes on a set of zero measure, or it is the zero polynomial (see Caron and Traynor [6] for proof). Since we assumed that there exists x ∈ RK s.t. rank(A(x)) ≥ r, the latter option is not possible. Following the work of Cohen et al. [9], our main proof relies on following notations and facts: 14 • We denote by [A] the matricization of an N -order tensor A (for simplicity, N is assumed to be even), where rows and columns correspond to odd and even modes, respectively. Specifically, if A ∈ RM1 ×···MN , the matrix [A] has M1 · M3 · . . . · MN −1 rows and M2 · M4 · . . . · MN columns, PN/2 rearranging the entries of the tensor such that Ad1 ,...,dN is stored in row index 1 + i=1 (d2i−1 − QN/2 PN/2 QN/2 1) j=i+1 M2j−1 and column index 1 + i=1 (d2i − 1) j=i+1 M2j . Additionally, the matricization is a linear operator, i.e. for all scalars α1 , α2 and tensors A1 , A2 with the order and dimensions in every mode, it holds that [α1 A1 + α2 A2 ] = α1 [A1 ] + α2 [A2 ]. • The relation between the Kronecker product (denoted by is given by [A ⊗ B] = [A] [B]. • For any two matrices A and B, it holds that rank (A ) and the tensor product (denoted by ⊗) B) = rank (A) · rank (B). • Let Z be the CP-rank of A, then it holds that rank ([A]) ≤ Z (see [9] for proof). Proof of theorem 1. Stemming from the above stated facts, to show that the CP-rank of Ay is at least r N is sufficient to examine its matricization [Ay ] and prove that rank ([Ay ]) ≥ r /2 . N/2 , it Notice from the construction of [Ay ], according to the recursive formula of the HT-decomposition, that N its entires are polynomial in the parameters of the decomposition, its dimensions are M /2 each and that N/2 N/2 1 ≤ r ≤ M . In accordance with the discussion on the measure of simplex spaces, for each vector parameter al,j,γ ∈ 4rl−1 −1 , we instead examine its projection ãl,j,γ = p(al,j,γ ) ∈ Rrl−1 −1 , and notice that p−1 (ãl,j,γ ) is a polynomial mapping6 w.r.t. ãl,j,γ . Thus, [Ay ] is a polynomial mapping w.r.t. the projected parameters {ãl,j,γ }l,j,γ , and using lemma 1 it is sufficient to show that there exists a set of parameters for N which rank ([Ay ]) ≥ r /2 . Denoting for convenience φL,1,1 := Ay and rL = 1, we will construct by induction over l = 1, ..., L a 2l set of parameters, {al,j,γ }l,j,γ , for which the ranks of the matrices {[φl,j,γ ]}j∈[N/2l ],γ∈[rl ] are at least r /2 , while enforcing the simplex constraints on the parameters. More so, we’ll construct these parameters s.t. al,j,γ = al,γ , thus proving both the ”unshared” and ”shared” cases. For the case l = 1 we have: φ1,j,γ = r0 X a1,j,γ a0,2j−1,α ⊗ a0,2j,α α α=1 and let and so a1,j,γ α = 1α≤r r and a0,j,α i = 1α=i for all i, j, γ and α ≤ M , and a0,j,α = 1i=1 for all i and α > M , i ( 1/r i=j∧i≤r [φ1,j,γ ]i,j = 0 Otherwise  which means rank [φ1,j,γ ] = r, while preserving the simplex constraints, which proves our inductive hypothesis for l = 1.   0 0 2l−1/2 Assume now that rank [φl−1,j ,γ ] ≥ r for all j 0 ∈ [N/2l−1 ] and γ 0 ∈ [rl−1 ]. For some specific choice of j ∈ [N/2l ] and γ ∈ [rl ] we have: rl−1 φl,j,γ = =⇒ [φl,j,γ ] = X al,j,γ φl−1,2j−1,α ⊗ φl−1,2j,α α α=1 rl−1 X l,j,γ l−1,2j−1,α aα [φ ] α=1 [φl−1,2j,α ] Denote Mα := [φl−1,2j−1,α ] [φl−1,2j,α ] for α = 1, ..., rl−1 . By our inductive assumption, and by the general property rank (A B) = rank (A) · rank (B), we have that the ranks of all matrices Mα are at least Prl−1 l,j,γ 2l−1/2 2l−1/2 2l r ·r = r /2 . Writing [φl,j,γ ] = α=1 aα · Mα , and noticing that {Mα } do not depend on 2l al,j,γ , we simply pick al,j,γ = 1α=1 , and thus φl,j,γ = M1 , which is of rank r /2 . This completes the proof α of the theorem. From the perspective of ConvACs with simplex constraints, theorem 1 leads to the following corollary: As we mentioned earlier, p is invertible only over p(4k ), for which its inverse is given by P p (x1 , . . . , xk ) = (x1 , . . . , xk , 1 − ki=1 xi ). However, to simplified the proof and notations, we use p−1 as defined here over the entire range Rk−1 , even where it does not serve as the inverse of p. 6 −1 15 7 Corollary 3. Assume the mixing components M = {fi (x) ∈ L2 (R2 ) ∩ L1 (Rs )}M i=1 are square integrable probability density functions, which form a linearly independent set. Consider a deep ConvAC model with simplex constraints of polynomial size whose parameters are drawn at random by some continuous distribution. Then, with probability 1, the distribution realized by this network requires an exponential size in order to be realized (or approximated w.r.t. the L2 distance) by the shallow ConvAC model with simplex constraints. The claim holds regardless of whether the parameters of the deep model are shared or not. Proof. Given a coefficient tensor A, the CP-rank of A is a lower bound on the number of channels (of its next to last layer) required to represent that tensor by the ConvAC following the CP factorization. Additionally, Q since the mixing components are linearly independent, their products { N i=1 fi (xi )|fi ∈ M} are linearly independent as well, which entails that any distribution representable by the generative variant of ConvAC with mixing components M has a unique coefficient tensor A. From theorem 1, the set of parameters of a deep ConvAC model (under the simplex constraints) with a coefficient tensor of a polynomial CP-rank – the requirement for a polynomially-sized shallow ConvAC model with simplex constraints realizing that same distribution exactly – forms a set of measure zero. It is left to prove, that not only is it impossible to exactly represent a distribution with an exponential coefficient tensor by a shallow model, it is also impossible to approximate it. This follows directly from lemma 7 in appendix B of Cohen et al. [9], as our case meets the requirement of that lemma. E Proof for the Optimality of Marginalized Bayes Predictor In this section we give short proofs for the claims from sec. 3, on the optimality of the marginalized Bayes predictor under missing-at-random (MAR) distribution, when the missingness mechanism is unknown, as well as the general case when we do not add additional assumptions. In addition, we will also present a counter example proving data imputation results lead to suboptimal classification performance. We begin by introducing several notations that augment the notations already introduced in the body of the article. Given a specific mask realization m ∈ {0, 1}s , we use the following notations to denote partial assignments to the random vector X . For the observed indices of X , i.e. the indices for which mi = 1, we denote a partial assignment by X \ m = xo , where xo ∈ Rdo is a vector of length do equal to the number of observed indices. Similarly, we denote by X ∩ m = xm a partial assignment to the missing indices according to m, where xm ∈ Rdm is a vector of length dm equal to the number of missing indices. As an example of the notation, for given realizations x ∈ Rs and m ∈ {0, 1}s , we defined in sec. 3 the event o(x, m), which using current notation is marked by the partial assignment X \ m = xo where xo matches the observed values of the vector x according to m. With the above notations in place, we move on to prove claim 1, which describes the general solution to the optimal prediction rule given both the data and missingness distributions, and without adding any additional assumptions. 7 It is important to note that most commonly used distribution functions are square integrable, e.g. most members of the exponential family such as the Gaussian distribution. 16 Proof of claim 1. Fix an arbitrary prediction rule h. We will show that L(h∗ ) ≤ L(h), where L is the expected 0-1 loss. 1 − L(h)=E(x,m,y)∼(X ,M,Y) [1h(x m)=y ] X XZ P(M=m, X =x, Y=y)1h(x = m)=y dx s m∈{0,1}s y∈[k] R X = XZ Z do m∈{0,1}s y∈[k] R Rdm P(M=m, X \m=xo , X ∩m=xm , Y=y)1h(x⊗m)=y dxo dxm X XZ 1h(x m)=y dxo =1 do m∈{0,1}s y∈[k] R Z P(M=m, X \m=xo , X ∩m=xm , Y=y)dxm X XZ 1h(x m)=y P(M=m, X \m=xo , Y=y)dxo Rdm =2 do m∈{0,1}s y∈[k] R =3 X Z do m∈{0,1}s R P(X \m=xo ) X 1h(x m)=y P(Y=y|X \m=xo ) y∈[k] P(M=m|X \m=xo , Y=y)dxo X Z X ≤4 P(X \m=xo ) 1h∗ (x do m∈{0,1}s R m)=y P(Y=y|X \m=xo ) y∈[k] P(M=m|X \m=xo , Y=y)dxo =1 − L(h∗ ) Where (1) is because the output of h(x m) is independent of the missing values, (2) by marginalization, (3) by conditional probability definition and (4) because by definition h∗ (x m) maximizes the expression P(Y=y|X \m=xo )P(M=m|X \m=xo , Y=y) w.r.t. the possible values of y for fixed vectors m and xo . Finally, by replacing integrals with sums, the proof holds exactly the same when instances (X ) are discrete. We now continue and prove corollary 1, a direct implication of claim 1 which shows that in the MAR setting, the missingness distribution can be ignored, and the optimal prediction rule is given by the marginalized Bayes predictor. Proof of corollary 1. Using the same notation as in the previous proof, and denoting by xo the partial vector containing the observed values of x m, the following holds: P(M=m|o(x, m), Y=y) := P(M=m|X \m=xo , Y=y) Z = P(M=m, X ∩ m=xm |X \m=xo , Y=y)dxm dm ZR = P(X ∩m=xm |X \m=xo , Y=y) Rdm · P(M=m|X ∩m=xm , X \m=xo , Y=y)dxm Z =1 P(X ∩m=xm |X \m=xo , Y=y) Rdm · P(M=m|X ∩m=xm , X \m=xo )dxm Z =2 P(X ∩m=xm |X \m=xo , Y=y) · P(M=m|X \m=xo )dxm Rdm Z =P(M=m|X \m=xo ) P(X ∩m=xm |X \m=xo , Y=y)dxm Rdm =P(M=m|o(x, m)) Where (1) is due to the independence assumption of the events Y = y and M = m conditioned on X = x, while noting that (X \ m = xo ) ∧ (X ∩ m = xm ) is a complete assignment of X . (2) is due to the MAR assumption, i.e. that for a given m and xo it holds for all xm ∈ Rdm : P(M=m|X \m=xo , X ∩m=xm ) = P(M=m|X \m=xo ) 17 X1 X2 Y Weight Probability ( = 10−4 ) 0 0 0 1− 16.665% 0 1 0 1 16.667% 1 0 0 1− 16.665% 1 1 0 1 16.667% 0 0 1 0 0.000% 0 1 1 1+ 16.668% 1 0 1 0 0.000% 1 1 1 1+ 16.668% Table 2: Data distribution over the space X × Y = {0, 1}2 × {0, 1} that serves as the example for the sub-optimality of classification through data-imputation (proof of claim 3). We have shown that P(M=m|o(x, m), Y = y) does not depend on y, and thus does not affect the optimal prediction rule in claim 1. It may therefore be dropped, and we obtain the marginalized Bayes predictor. Having proved that in the MAR setting, classification through marginalization leads to optimal performance, we now move on to show that the same is not true for classification through data-imputation. Though there are many methods to perform data-imputation, i.e. to complete missing values given the observed ones, all of these methods can be seen as the solution of the following optimization problem, or more typically its approximation: g(x m) = argmax x0 ∈Rs ∧∀i:mi =1→x0i =xi P(X = x0 ) Where g(x m) is the most likely completion of x m. When data-imputation is carried out for classification purposes, one is often interested in data-imputation conditioned on a given class Y = y, i.e.: g(x m; y) = argmax x0 ∈Rs ∧∀i:m 0 i =1→xi =xi P(X = x0 |Y = y) Given a classifier h : Rs → [K] and an instance x with missing values according to m, classification through data-imputation is simply the result of applying h on the output of g. When h is the optimal classifier for complete data, i.e. the Bayes predictor, we end up with one of the following prediction rules: Unconditional: h(x m) = argmax P(Y = y|X = g(x m)) m) = argmax P(Y = y|X = g(x m; y)) y Conditional: h(x y Claim 3. There exists a data distribution D and MAR missingness distribution Q s.t. the accuracy of classification through data-imputation is almost half the accuracy of the optimal marginalized Bayes predictor, with an absolute gap of more than 33 percentage points. Proof. For simplicity, we will give an example for a discrete distribution over the binary set X × Y = {0, 1}2 × {0, 1}. Let 1 >  > 0 be some small positive number, and we define D according to table 2, where each triplet (x1 , x2 , y) ∈ X ×Y is assigned a positive weight, which through normalization defines a distribution over X ×Y. The missingness distribution Q is defined s.t. PQ (M1 = 1, M2 = 0|X = x) = 1 for all x ∈ X , i.e. X1 is always observed and X2 is always missing, which is a trivial MAR distribution. Given the above data distribution D, we can easily calculate the exact accuracy of the optimal data-imputation classifier and the marginalized Bayes predictor under the missingness distribution Q, as well as the standard Bayes predictor under full-observability. First notice that whether we apply conditional or unconditional data-imputation, and whether X1 is equal to 0 or 1, the completion will always be X2 = 1 and the predicted class will always be Y = 1. Since the data-imputation classifiers always predict the same class Y = 1 regardless of their input, the probability of success is simply the probability P (Y = 1) = 1+ (for  = 10−4 it equals approximately 3 33.337%). Similarly, the marginalized Bayes predictor always predicts Y = 0 regardless of its input, and so (for  = 10−4 it equals approximately 66.663%), which is its probability of success is P (Y = 0) = 2− 3 almost double the accuracy achieved by the data-imputation classifier. Additionally, notice that the marginalized Bayes predictor achieves almost the same accuracy as the Bayes predictor under full-observability, which equals exactly 32 . 18 F Efficient Marginalization with Tensorial Mixture Models As discussed above, with generative models optimal classification under missing data (in the MAR setting) is oblivious to the specific missingness distribution. However, it requires tractable marginalization over missing values. In this section we show that TMMs bring forth extremely efficient marginalization, requiring only a single forward pass through the corresponding ConvAC. Recall from sec. 2 and 2.3 that a TMM classifier realizes the following form: XM YN P (x1 , . . . , xN |Y =y) = P (d1 , . . . , dN |Y =y) P (xi |di ; θdi ) d1 ,...,dN i=1 (9) Suppose now that only the local structures xi1 . . . xiV are observed, and we would like to marginalize over the rest. Integrating eq. 9 gives: XM YV P (d1 , . . . , dN |Y =y) P (xiv |div ; θdiv ) P (xi1 , . . . , xiV |Y =y) = d1 ,...,dN v=1 from which it is evident that the same network used to compute P (x1 , . . . , xN |Y =y), can be used to compute P (xi1 , . . . , xiV |Y =y) – all it requires is a slight adaptation of the representation layer. Namely, the latter would represent observed values through the usual likelihoods, whereas missing (marginalized) values would now be represented via constant ones: ( 1 , xi is missing (marginalized) rep(i, d) = P (xi |d; Θ) , xi is visible (not marginalized) More generally, to marginalize over individual coordinates of the local structure xi , it is sufficient to replace rep(i, d) by its respective marginalized mixing component. To conclude, with TMMs marginalizing over missing values is just as efficient as plain inference – requires only a single pass through the corresponding network. Accordingly, the marginalized Bayes predictor (eq. 3) is realized efficiently, and classification under missing data (in the MAR setting) is optimal (under generative assumption), regardless of the missingness distribution. G Extended Discussion on Generative Models Based on Neural Networks There are many generative models realized through neural networks, and convolutional networks in particular. Of these models, one of the most successful to date is the method of Generative Adversarial Networks [19], where a network is trained to generate instances from the data distribution, through a two-player mini-max game. While there are numerous applications for learning to generate data points, e.g. inpainting and superresolution, it cannot be used for computing the likelihood of the data. Other generative networks do offer inference, but only approximate. Variational Auto-Encoders [24] use a variational lower-bound on the likelihood function. GSNs [5], DPMs [37] and MPDBMs [18] are additional methods along this line. The latter is especially noteworthy for being a generative classifier that can approximate the marginal likelihoods conditioned on each class, and for being tested on classification under missing data. Some generative neural networks are capable of tractable inference, but not of tractable marginalization. Dinh et al. [15] suggest a method for designing neural networks that realize an invertible transformation from a simple distribution to the data distribution. Inverting the network brings forth tractable inference, yet partial integration of its density function is still intractable. Another popular method for tractable inference, central to both PixelRNN [39] and NADE [38], is the factorization of the probability distribution according Q to P(x1 , . . . , xd ) = di=1 P(xi |xi−1 , . . . , x1 ), and realization of P(xi |xi−1 , . . . , x1 ) as a neural network. Based on this construction, certain marginal distributions are indeed tractable to compute, but most are not. Orderless-NADE partially addresses this issue by using ensembles of models over different orderings of its input. However, it can only estimate the marginal distributions, and has no classifier analogue that can compute class-conditional marginal likelihoods, as required for classification under missing data. H Image Generation and Network Visualization Following the graphical model perspective of our models allows us to not only generate random instances from the distribution, but to also generate the most likely patches for each neuron in the network, effectively explaining its role in the classification process. We remind the reader that every neuron in the network corresponds to a possible assignment of a latent variable in the graphical model. By looking for the most likely assignments for each of its child nodes in the graphical tree model, we can generate a patch that describes that neuron. Unlike similar suggested methods to visualize neural networks [40], often relying on brute-force search or on solving some optimization problem to find the most likely image, our method emerges naturally from the probabilistic interpretation of our model. 19 Figure 5: Generated digits samples from the HT-TMM model trained on the MNIST dataset. Figure 6: Visualization of the HT-TMM model. Each of the images above visualize a different layer of the model and consists of several samples generated from latent variables at different spatial locations conditioned on randomly selected channels. The leftmost image shows samples taken from the 5th layer which consists of just a single latent variable with 512 channels. The center image shows samples taken from the 4th layer, which consists of 2 × 2 grid of latent variables with 256 channels each. The image is divided to 4 quadrants, each contains samples taken from the respective latent variable at that position. The rightmost image shows samples from the 3rd layer, which consists of 4 × 4 grid of latent variables with 128 channels, and the image is similarly spatial divided into different areas matching the latent variables of the layer. 20 In fig. 5, we can see conditional samples generates for each digit, while in fig. 6 we can see a visualization of the top-level layers of network, where each small patch matches a different neuron in the network. The common wisdom of how ConvNets work is by assuming that simple low-level features are composed together to create more and more complex features, where each subsequent layer denotes features of higher abstraction – the visualization of our network clearly demonstrate this hypothesis to be true for our case, showing small strokes iteratively being composed into complete digits. I Detailed Description of the Experiments Experiments are meaningful only if they could be reproduced by other proficient individuals. Providing sufficient details to enable others to replicate our results is the goal of this section. We hope to accomplish this by making our code public, as well as documenting our experiments to a sufficient degree allowing for their reproduction from scratch. Our complete implementation of the models presented in this paper, as well as our modifications to other open-source projects and scripts used in the process of conducting our experiments, are available at our Github repository: https://github.com/HUJI-Deep/Generative-ConvACs. We additionally wish to invite readers to contact the authors, if they deem the following details insufficient in their process to reproduce our results. I.1 Description of Methods In the following we give concise descriptions of each classification method we have used in our experiments. The results of the experiment on MP-DBM [18] were taken directly from the paper and were not conducted by us, hence we do not cover it in this section. We direct the reader to that article for exact details on how to reproduce their results. I.1.1 Robust Linear Classifier In [13], binary linear classifiers were trained by formulating their optimization as a quadric program under the constraint that some of its features could be deleted, i.e. their original value was changed to zero. While the original source code was never published, the authors have kindly agreed to share with us their code, which we used to reproduced their results, but on larger datasets. The algorithm has only a couple hyper-parameters, which were chosen by a grid-search through a cross-validation process. For details on the exact protocol for testing binary classifiers on missing data, please see sec. I.2.1. I.1.2 K-Nearest Neighbors K-Nearest Neighbors (KNN) is a classical machine learning algorithm used for both regression and classification tasks. Its underlying mechanism is finding the k nearest examples (called neighbors) from the training set, (x1 , y1 ), . . . , (xk , yk ) ∈ S, according to some metric function d(·, ·) : X × X → R+ , after which a summarizing function f is applied to the targets of the k nearest neighbors to produce the output y ∗ = f (y1 , . . . , yk ). When KNN is used for classification, f is typically the majority voting function, returning the class found in most of the k nearest neighbors. In our experiments we use KNN for classification under missing data, where the training set consists of complete examples with no missing data, but at classification time the inputs have missing values. Given an input with missing values x m and an example x0 from the training set, we use a modified Euclidean distance metric, where we compare the distance only against the non-missing coordinates of x, i.e. the metric is defined P 2 0 by d(x0 , x m) = i:mi =1 (xi − xi ) . Through a process of cross-validation we have chosen k = 5 for all of our experiments. Our implementation of KNN is based on the popular scikit-learn python library [32]. I.1.3 Convolutional Neural Networks The most widespread and successful discriminative method nowadays are Convolutional Neural Networks (ConvNets). Standard ConvNets are represented by a computational graph consisted of different kinds of nodes, called layers, with a convolutional-like operators applied to their inputs, followed by a non-linear point-wise activation function, e.g. max(0, x) known as ReLU. For our experiments on MNIST, both with and without missing data, we have used the LeNeT ConvNet architecture [25] that is bundled with Caffe [23], trained for 20,000 iterations using SGD with 0.9 momentum and 0.01 base learning rate, which remained constant for 10,000 iterations, followed by a linear decrease to 0.001 for another 5,000 iterations, followed by a linear decrease to 0 learning rate for the remaining 5,000 iterations. The model also used l2 -regularization (also known as weight decay), which was chosen through cross-validation for each experiment separately. No other modifications were made to the model or its training procedure. 21 For our experiments on NORB, we have used an ensemble of 3 ConvNets, each using the following architecture: 5×5 convolution with 128 output channels, 3×3 max pooling with stride 2, ReLU activation, 5×5 convolution with 128 output channels, ReLU activation, dropout layer with probability 0.5, 3×3 average pooling with stride 2, 5×5 convolution with 256 output channels, ReLU activation, dropout layer with probability 0.5, 3×3 average pooling with stride 2, fully-connected layer with 768 output channels, ReLU activation, dropout layer with probability 0.5, and ends with fully-connected layer with 5 output channels. The stereo images were represented as a two-channel input image when fed to the network. During training we have used data augmentation consisting of randomly scaling and rotation transforms. The networks were trained for 40,000 iterations using SGD with 0.99 momentum and 0.001 base learning rate, which remained constant for 30,000 iterations, followed by a linear decrease to 0.0001 for 6000 iterations, followed by a linear decrease to 0 learning rate for the remaining 4,000 iterations. The model also used 0.0001 weight decay for additional regularization. When ConvNets were trained on images containing missing values, we passed the network the original image with missing values zeroed out, and an additional binary image as a separate channel, containing 1 for missing values at the same spatial position, and 0 otherwise – this missing data format is sometimes known as flag data imputation. Other formats for representing missing values were tested (e.g. just using zeros for missing values), however, the above scheme performed significantly better than other formats. In our experiments, we assumed that the training set was complete and missing values were only present in the test set. In order to design ConvNets that are robust against specific missingness distributions, we have simulated missing values during training, sampling a different mask of missing values for each image in each mini-batch. As covered in sec. 5, the results of training ConvNets directly on simulated missingness distributions resulted in classifiers which were biased towards the specific distribution used in training, and performed worse on other distributions compared to ConvNets trained on the same distribution. In addition to training ConvNets directly on missing data, we have also used them as the classifier for testing different data imputation methods, as describe in the next section. I.1.4 Classification Through Data Imputation The most common method for handling missing data, while leveraging available discriminative classifiers, is through the application of data imputation – an algorithm for the completion of missing values – and then passing the results to a classifier trained on uncorrupted dataset. We have tested five different types of data imputation algorithms: • Zero data imputation: replacing every missing value by zero. • Mean data imputation: replacing every missing value by the mean value computed over the dataset. • Generative data imputation: training a generative model and using it to complete the missing values by finding the most likely instance that coincides with the observed values, i.e. solving the following g(x m) = argmax P (X = x0 ) x0 ∈Rs ∧∀i,mi =1→x0i =xi We have tested the following generative models: – Generative Stochastic Networks (GSN) [5]: We have used their original source code from https://github.com/yaoli/GSN, and trained their example model on MNIST for 1000 epochs. Whereas in the original article they have tested completing only the left or right side of a given image, we have modified their code to support general masks. Our modified implementation can be found at https://github.com/HUJI-Deep/GSN. – Non-linear Independent Components Estimation (NICE) [15]: We have used their original source code from https://github.com/laurent-dinh/nice, and trained it on MNIST using their example code without changes. Similarly to our modification to the GSN code, here too we have adapted their code to support general masks over the input. Additionally, their original inpainting code required 110,000 iterations, which we have reduced to just 8,000 iterations, since the effect on classification accuracy was marginal. For the NORB dataset, we have used their CIFAR10 example, with lower learning rate of 10−4 . Our modified code can be found at https://github.com/HUJI-Deep/nice. – Diffusion Probabilistic Models (DPM) [37]: We have user their original source code from https://github.com/Sohl-Dickstein/Diffusion-Probabilistic-Models, and trained it on MNIST using their example code without changes. Similarly to our modifications to GSN, we have add support for a general mask of missing values, but other than that kept the rest of the parameters for inpainting unchanged. For NORB we have used the same model as MNIST. We have tried using their CIFAR10 example for NORB, however, it produced exceptions during training. Our modified code can be found at https: //github.com/HUJI-Deep/Diffusion-Probabilistic-Models. 22 I.1.5 Tensorial Mixture Models For a complete theoretical description of our model please see the body of the article. Our models were implemented by performing all intermediate computations in log-space, using numerically aware operations. In practiced, that meant our models were realized by the SimNets architecture [7, 10], which consists of Similarity layers representing gaussian distributions, MEX layers representing weighted sums performed on log-space input and outputs, as well as standard pooling operations. The learned parameters of the MEX layers are called offsets, which represents the weights of the weighted sum, but saved in log-space. The parameters of the MEX layers can be optionally shared between spatial regions, or alternatively left with no parameter sharing at all. Additionally, when  used to implement our generative models, the offsets are normalized to have a soft-max (i.e., P log i exp(xi ) ) of zero. The network architectures we have tested in this article, consists of M different Gaussian mixture components with diagonal covariance matrices, over non-overlapping patches of the input of size 2 × 2, which were implemented by a similarity layer as specified by the SimNets architecture, but with an added gaussian normalization term. We first describe the architectures used for the MNIST dataset. For the CP-TMM model, we used M = 800, and following the similarity layer is a 1 × 1 MEX layer with no parameter sharing over spatial regions and 10 output channels. The model ends with a global sum pooling operation, followed by another 1 × 1 MEX layer with 10 outputs, one for each class. The HT-TMM model starts with the similarity layer with M = 32, followed by a sequence of four pairs of 1 × 1 MEX layer followed by 2 × 2 sum pooling layer, and after the pairs and additional 1 × 1 MEX layer lowering the outputs of the model to 10 outputs as the number of classes. The number of output channels for each MEX layer are as follows 64-128-256-512-10. All the MEX layers in this network do not use parameter sharing, except the first MEX layer, which uses a repeated sharing pattern of 2 × 2 offsets, that analogous to a 2 × 2 convolution layer with stride 2. Both models were trained with the losses described in sec. 2.3, using the Adam SGD variant for optimizing the parameters, with a base learning rate of 0.03, and β1 = β2 = 0.9. The models were trained for 25,000 iterations, where the learning rate was dropped by 0.1 after 20,000 iterations. For the NORB dataset, we have trained only the HT-TMM model with M = 128 for the similarity layer. The MEX layers use the same parameter sharing scheme as the one for MNIST, and the number of output channels for each MEX layer are as follows: 256-256-256-512-5. Training was identical to the MNIST models, with the exception of using 40,000 iterations instead of just 25,000. Additionally, we have used an ensemble of 4 models trained separately, each trained using a different generative loss weight (see below for more information). We have also used the same data augmentation methods (scaling and rotation) which were used in training the ConvNets for NORB used in this article. The standard L2 weight regularization (sometimes known as weight decay) did not P work well on our models, which lead us to adapt it to better fit to log-space weights, by minimizing λ i (exp (xi ))2 instead of P 2 λ||x||2 = λ i xi , where the parameter λ was chosen through cross-validation. Additionally, since even with large values of λ our model was still overfitting, we have added another form of regularization in the form of random marginalization layers. A random marginalization layer, is similar in concept to dropout, but instead of zeroing activations completely in random, it choses spatial locations at random, and then zero out the activations at those locations for all the channels. Under our model, zeroing all the activations in a layer at a specific location, is equivalent to marginalizing over all the inputs for the receptive field for that respective location. We have used random marginalization layers in between all our layers during training, where the probability for zeroing out activations was chosen through cross-validation for each layer separately. Though it might raise concern that random marginalization layers could lead to biased results toward the missingness distributions we have tested it on, in practice the addition of those layers only helped improve our results under cases where only few pixels where missing. Finally, we wish to discuss a few optimization tricks which had a minor effects compared to the above, but were nevertheless very useful in achieving slightly better results. First, instead of optimizing directly the objective defined by eq. 2, we add smoothing parameter β between the two terms, as follows: Θ∗ = argmin − Θ |S| X (i) (i) eNΘ (X ;Y ) log PK NΘ (X (i) ;y) y=1 e i=1 −β |S| X log i=1 K X eNΘ (X (i) ;y) y=1 setting β too low diminish the generative capabilities of our models, while setting it too high diminish the discriminative performance. Through cross-validation, we decided on the value β = 0.01 for the models trained on MNIST, while for NORB we have used a different value of β for each of the models, ranging in {0.01, 0.1, 0.5, 1}. Second, we found that performance increased if we normalized activations before applying the 1 × 1 MEX operations. Specifically, we calculate the soft-max over the channels for each spatial location 23 which we call the activation norm, and then subtract it from every respective activation. After applying the MEX operation, we add back the activation norm. Though might not be obvious at first, subtracting a constant from the input of a MEX operation and adding it to its output is equivalent does not change the mathematical operation. However, it does resolve the numerical issue of adding very large activations to very small offsets, which might result in a loss of precision. Finally, we are applying our model in different translations of the input and then average the class predictions. Since our model can marginalize over inputs, we do not need to crop the original image, and instead mask the unknown parts after translation as missing. Applying a similar trick to standard ConvNets on MNIST does not seem to improve their results. We believe this method is especially fit to our model, is because it does not have a natural treatment of overlapping patches like ConvNets do, and because it is able to marginalize over missing pixels easily, not limiting it just to crop translation as is typically done. I.2 Description of Experiments In this section we will give a detailed description of the protocol we have used during our experiments. I.2.1 Binary Digit Classification under Feature Deletion Missing Data This experiment focuses on the binary classification problem derived from MNIST, by limiting the number of classes to two different digits at a time. We use the same non-zero feature deletion distribution as suggested by Globerson and Roweis [17], i.e. for a given image we uniformly sample a set of N non-zero pixels from the image (if the image has less than N non-zero pixels then they are non-zero pixels are chosen), and replace their values with zeros. This type of missingness distribution falls under the MNAR type defined in sec.3. We test values of N in {0, 25, 50, 75, 100, 125, 150}. For a given value of N , we train a separate classifier on each digit pair classifier on a randomly picked subset of the dataset containing 300 images per digit (600 total). During training we use a fixed validation set with 1000 images per digit. After picking the best classifier according to the validation set, the classifier is tested against a test set with a 1000 images per digits with a randomly chosen missing values according to the value of N . This experiment is repeated 10 times for each digit pair, each time using a different subset for the training set, and a new corrupted test set. After conducting all the different experiments, all the accuracies are averaged for each value of N , which are reported in table 1. I.2.2 Multi-class Digit Classification under MAR Missing Data This experiment focuses on the complete multi-class digit classification of the MNIST dataset, in the presence of missing data according to different missingness distributions. Under this setting, only the test set contains missing values, whereas the training set does not. We test two kinds of missingness distributions, which both fall under the MAR type defined in sec.3. The first kind, which we call i.i.d. corruption, each pixel is missing with a fixed probability p. the second kind, which we call missing rectangles corruption, The positions of N rectangles of width W or chosen uniformly in the picture, where the rectangles can overlap one another. During the training stage, the models to be tested are not to be biased toward the specific missingness distributions we have chosen, and during the test stage, the same classifier is tested against all types of missingness distributions, and without supplying it with the parameters or type of the missingness distribution it is tested against. This rule prevent the use of ConvNets trained on simulated missingness distributions. To demonstrate that the latter lead to biased classifiers, we have conducted a separate experiment just for ConvNets, where the previous rule is ignored, and we train a separate ConvNet classifier on each type and parameter of the missingness distributions we have used. We then tested each of those ConvNets on all other missingness distributions, the results of which are in fig. 3, which confirmed our hypothesis. 24
9cs.NE
QMDP-Net: Deep Learning for Planning under Partial Observability Peter Karkus1,2 arXiv:1703.06692v3 [cs.AI] 3 Nov 2017 1 David Hsu1,2 Wee Sun Lee2 NUS Graduate School for Integrative Sciences and Engineering 2 School of Computing National University of Singapore {karkus, dyhsu, leews}@comp.nus.edu.sg Abstract This paper introduces the QMDP-net, a neural network architecture for planning under partial observability. The QMDP-net combines the strengths of model-free learning and model-based planning. It is a recurrent policy network, but it represents a policy for a parameterized set of tasks by connecting a model with a planning algorithm that solves the model, thus embedding the solution structure of planning in a network learning architecture. The QMDP-net is fully differentiable and allows for end-to-end training. We train a QMDPnet on different tasks so that it can generalize to new ones in the parameterized task set and “transfer” to other similar tasks beyond the set. In preliminary experiments, QMDP-net showed strong performance on several robotic tasks in simulation. Interestingly, while QMDP-net encodes the QMDP algorithm, it sometimes outperforms the QMDP algorithm in the experiments, as a result of end-to-end learning. 1 Introduction Decision-making under uncertainty is of fundamental importance, but it is computationally hard, especially under partial observability [24]. In a partially observable world, the agent cannot determine the state exactly based on the current observation; to plan optimal actions, it must integrate information over the past history of actions and observations. See Fig. 1 for an example. In the model-based approach, we may formulate the problem as a partially observable Markov decision process (POMDP). Solving POMDPs exactly is computationally intractable in the worst case [24]. Approximate POMDP algorithms have made dramatic progress on solving large-scale POMDPs [17, 25, 29, 32, 37]; however, manually constructing POMDP models or learning them from data remains difficult. In the model-free approach, we directly search for an optimal solution within a policy class. If we do not restrict the policy class, the difficulty is data and computational efficiency. We may choose a parameterized policy class. The effectiveness of policy search is then constrained by this a priori choice. Deep neural networks have brought unprecedented success in many domains [16, 21, 30] and provide a distinct new approach to decision-making under uncertainty. The deep Q-network (DQN), which consists of a convolutional neural network (CNN) together with a fully connected layer, has successfully tackled many Atari games with complex visual input [21]. Replacing the postconvolutional fully connected layer of DQN by a recurrent LSTM layer allows it to deal with partial observaiblity [10]. However, compared with planning, this approach fails to exploit the underlying sequential nature of decision-making. We introduce QMDP-net, a neural network architecture for planning under partial observability. QMDP-net combines the strengths of model-free learning and model-based planning. A QMDP-net is a recurrent policy network, but it represents a policy by connecting a POMDP model with an algorithm that solves the model, thus embedding the solution structure of planning in a network 31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA. (a) (b) (c) (d) Fig. 1: A robot learning to navigate in partially observable grid worlds. (a) The robot has a map. It has a belief over the initial state, but does not know the exact initial state. (b) Local observations are ambiguous and are insufficient to determine the exact state. (c, d) A policy trained on expert demonstrations in a set of randomly generated environments generalizes to a new environment. It also “transfers” to a much larger real-life environment, represented as a LIDAR map [12]. learning architecture. Specifically, our network uses QMDP [18], a simple, but fast approximate POMDP algorithm, though other more sophisticated POMDP algorithms could be used as well. A QMDP-net consists of two main network modules (Fig. 2). One represents a Bayesian filter, which integrates the history of an agent’s actions and observations into a belief, i.e. a probabilistic estimate of the agent’s state. The other represents the QMDP algorithm, which chooses the action given the current belief. Both modules are differentiable, allowing the entire network to be trained end-to-end. We train a QMDP-net on expert demonstrations in a set of randomly generated environments. The trained policy generalizes to new environments and also “transfers” to more complex environments (Fig. 1c–d). Preliminary experiments show that QMDP-net outperformed state-of-the-art network architectures on several robotic tasks in simulation. It successfully solved difficult POMDPs that require reasoning over many time steps, such as the well-known Hallway2 domain [18]. Interestingly, while QMDP-net encodes the QMDP algorithm, it sometimes outperformed the QMDP algorithm in our experiments, as a result of end-to-end learning. 2 2.1 Background Planning under Uncertainty A POMDP is formally defined as a tuple (S, A, O, T, Z, R), where S, A and O are the state, action, and observation space, respectively. The state-transition function T (s, a, s0 ) = P (s0 |s, a) defines the probability of the agent being in state s0 after taking action a in state s. The observation function Z(s, a, o) = p(o|s, a) defines the probability of receiving observation o after taking action a in state s. The reward function R(s, a) defines the immediate reward for taking action a in state s. In a partially observable world, the agent does not know its exact state. It maintains a belief, which is a probability distribution over S. The agent starts with an initial belief b0 and updates the belief bt at each time step t with a Bayesian filter: P bt (s0 ) = τ (bt−1 , at , ot ) = ηO(s0 , at , ot ) s∈S T (s, at , s0 )bt−1 (s), (1) where η is a normalizing constant. The belief bt recursively integrates information from the entire past history (a1 , o1 , a2 , o2 , . . . , at , ot ) for decision making. POMDP planning seeks a policy π that maximizes the value, i.e., the expected total discounted reward:  P∞ t Vπ (b0 ) = E (2) t=0 γ R(st , at+1 ) b0 , π , where st is the state at time t, at+1 = π(bt ) is the action that the policy π chooses at time t, and γ ∈ (0, 1) is a discount factor. 2.2 Related Work To learn policies for decision making in partially observable domains, one approach is to learn models [6, 19, 26] and solve the models through planning. An alternative is to learn policies directly [2, 5]. Model learning is usually not end-to-end. While policy learning can be end-to-end, it does not exploit model information for effective generalization. Our proposed approach combines model-based and 2 model-free learning by embedding a model and a planning algorithm in a recurrent neural network (RNN) that represents a policy and then training the network end-to-end. RNNs have been used earlier for learning in partially observable domains [4, 10, 11]. In particular, Hausknecht and Stone extended DQN [21], a convolutional neural network (CNN), by replacing its post-convolutional fully connected layer with a recurrent LSTM layer [10]. Similarly, Mirowski et al. [20] considered learning to navigate in partially observable 3-D mazes. The learned policy generalizes over different goals, but in a fixed environment. Instead of using the generic LSTM, our approach embeds algorithmic structure specific to sequential decision making in the network architecture and aims to learn a policy that generalizes to new environments. The idea of embedding specific computation structures in the neural network architecture has been gaining attention recently. Tamar et al. implemented value iteration in a neural network, called Value Iteration Network (VIN), to solve Markov decision processes (MDPs) in fully observable domains, where an agent knows its exact state and does not require filtering [34]. Okada et al. addressed a related problem of path integral optimal control, which allows for continuous states and actions [23]. Neither addresses the issue of partial observability, which drastically increases the computational complexity of decision making [24]. Haarnoja et al. [9] and Jonschkowski and Brock [15] developed end-to-end trainable Bayesian filters for probabilistic state estimation. Silver et al. introduced Predictron for value estimation in Markov reward processes [31]. They do not deal with decision making or planning. Both Shankar et al. [28] and Gupta et al. [8] addressed planning under partial observability. The former focuses on learning a model rather than a policy. The learned model is trained on a fixed environment and does not generalize to new ones. The latter proposes a network learning approach to robot navigation in an unknown environment, with a focus on mapping. Its network architecture contains a hierarchical extension of VIN for planning and thus does not deal with partial observability during planning. The QMDP-net extends the prior work on network architectures for MDP planning and for Bayesian filtering. It imposes the POMDP model and computation structure priors on the entire network architecture for planning under partial observability. 3 Overview We want to learn a policy that enables an agent to act effectively in a diverse set of partially observable stochastic environments. Consider, for example, the robot navigation domain in Fig. 1. The environments may correspond to different buildings. The robot agent does not observe its own location directly, but estimates it based on noisy readings from a laser range finder. It has access to building maps, but does not have models of its own dynamics and sensors. While the buildings may differ significantly in their layouts, the underlying reasoning required for effective navigation is similar in all buildings. After training the robot in a few buildings, we want to place the robot in a new building and have it navigate effectively to a specified goal. Formally, the agent learns a policy for a parameterized set of tasks in partially observable stochastic environments: WΘ = {W (θ) | θ ∈ Θ}, where Θ is the set of all parameter values. The parameter value θ captures a wide variety of task characteristics that vary within the set, including environments, goals, and agents. In our robot navigation example, θ encodes a map of the environment, a goal, and a belief over the robot’s initial state. We assume that all tasks in WΘ share the same state space, action space, and observation space. The agent does not have prior models of its own dynamics, sensors, or task objectives. After training on tasks for some subset of values in Θ, the agent learns a policy that solves W (θ) for any given θ ∈ Θ. A key issue is a general representation of a policy for WΘ , without knowing the specifics of WΘ or its parametrization. We introduce the QMDP-net, a recurrent policy network. A QMDP-net represents a policy by connecting a parameterized POMDP model with an approximate POMDP algorithm and embedding both in a single, differentiable neural network. Embedding the model allows the policy to generalize over WΘ effectively. Embedding the algorithm allows us to train the entire network end-to-end and learn a model that compensates for the limitations of the approximate algorithm. Let M (θ) = (S, A, O, fT (·|θ), fZ (·|θ), fR (·|θ)) be the embedded POMDP model, where S, A and O are the shared state space, action space, observation space designed manually for all tasks in WΘ and fT (·|·), fZ (·|·), fR (·|·) are the state-transition, observation, and reward functions to be learned from data. It may appear that a perfect answer to our learning problem would have 3 (a) (b) (c) QMDP planner QMDP planner QMDP planner QMDP planner Policy Bayesian filter Bayesian filter Bayesian filter Bayesian filter Fig. 2: QMDP-net architecture. (a) A policy maps a history of actions and observations to a new action. (b) A QMDP-net is an RNN that imposes structure priors for sequential decision making under partial observability. It embeds a Bayesian filter and the QMDP algorithm in the network. The hidden state of the RNN encodes the belief for POMDP planning. (c) A QMDP-net unfolded in time. fT (·|θ), fZ (·|θ), and fR (·|θ) represent the “true” underlying models of dynamics, observation, and reward for the task W (θ). This is true only if the embedded POMDP algorithm is exact, but not true in general. The agent may learn an alternative model to mitigate an approximate algorithm’s limitations and obtain an overall better policy. In this sense, while QMDP-net embeds a POMDP model in the network architecture, it aims to learn a good policy rather than a “correct” model. A QMDP-net consists of two modules (Fig. 2). One encodes a Bayesian filter, which performs state estimation by integrating the past history of agent actions and observations into a belief. The other encodes QMDP, a simple, but fast approximate POMDP planner [18]. QMDP chooses the agent’s actions by solving the corresponding fully observable Markov decision process (MDP) and performing one-step look-ahead search on the MDP values weighted by the belief. We evaluate the proposed network architecture in an imitation learning setting. We train on a set of expert trajectories with randomly chosen task parameter values in Θ and test with new parameter values. An expert trajectory consist of a sequence of demonstrated actions and observations (a1 , o1 , a2 , o2 , . . .) for some θ ∈ Θ. The agent does not access the ground-truth states or beliefs along the trajectory during the training. We define loss as the cross entropy between predicted and demonstrated action sequences and use RMSProp [35] for training. See Appendix C.7 for details. Our implementation in Tensorflow [1] is available online at http://github.com/AdaCompNUS/qmdp-net. 4 QMDP-Net We assume that all tasks in a parameterized set WΘ share the same underlying state space S, action space A, and observation space O. We want to learn a QMDP-net policy for WΘ , conditioned on the parameters θ ∈ Θ. A QMDP-net is a recurrent policy network. The inputs to a QMDP-net are the action at ∈ A and the observation ot ∈ O at time step t, as well as the task parameter θ ∈ Θ. The output is the action at+1 for time step t + 1. A QMDP-net encodes a parameterized POMDP model M (θ) = (S, A, O, T = fT (·|θ), Z = fZ (·|θ), R = fR (·|θ)) and the QMDP algorithm, which selects actions by solving the model approximately. We choose S, A, and O of M (θ) manually, based on prior knowledge on WΘ , specifically, prior knowledge on S, A, and O. In general, S 6= S, A 6= A, and O 6= O. The model states, actions, and observations may be abstractions of their real-world counterparts in the task. In our robot navigation example (Fig. 1), while the robot moves in a continuous space, we choose S to be a grid of finite size. We can do the same for A and O, in order to reduce representational and computational complexity. The transition function T , observation function Z, and reward function R of M (θ) are conditioned on θ, and are learned from data through end-to-end training. In this work, we assume that T is the same for all tasks in WΘ to simplify the network architecture. In other words, T does not depend on θ. End-to-end training is feasible, because a QMDP-net encodes both a model and the associated algorithm in a single, fully differentiable neural network. The main idea for embedding the algorithm in a neural network is to represent linear operations, such as matrix multiplication and summation, by convolutional layers and represent maximum operations by max-pooling layers. Below we provide some details on the QMDP-net’s architecture, which consists of two modules, a filter and a planner. 4 (a) Bayesian filter module (b) QMDP planner module Fig. 3: A QMDP-net consists of two modules. (a) The Bayesian filter module incorporates the current action at and observation ot into the belief. (b) The QMDP planner module selects the action according to the current belief bt . Filter module. The filter module (Fig. 3a) implements a Bayesian filter. It maps from a belief, action, and observation to a next belief, bt+1 = f (bt |at , ot ). The belief is updated in two steps. The first accounts for actions, the second for observations: P b0t (s) = s0 ∈S T (s, at , s0 )bt (s0 ), (3) bt+1 (s) = ηZ(s, ot )b0t (s), (4) where ot ∈ O is the observation received after taking action at ∈ A and η is a normalization factor. We implement the Bayesian filter by transforming Eq. (3) and Eq. (4) to layers of a neural network. For ease of discussion consider our N ×N grid navigation task (Fig. 1a–c). The agent does not know its own state and only observes neighboring cells. It has access to the task parameter θ that encodes the obstacles, goal, and a belief over initial states. Given the task, we choose M (θ) to have a N ×N state space. The belief, bt (s), is now an N ×N tensor. Eq. (3) is implemented as a convolutional layer with |A| convolutional filters. We denote the convolutional layer by fT . The kernel weights of fT encode the transition function T in M (θ). The output of the convolutional layer, b0t (s, a), is a N ×N ×|A| tensor. b0t (s, a) encodes the updated belief after taking each of the actions, a ∈ A. We need to select the belief corresponding to the last action taken by the agent, at . We can directly index b0t (s, a) by at if A = A. In general A 6= A, so we cannot use simple indexing. Instead, we will use “soft indexing”. First we encode actions in A to actions in A through a learned function fA . fA maps from at to an indexing vector wta , a distribution over actions in A. We then weight b0t (s, a) by wta along the appropriate dimension, i.e. P b0t (s) = a∈A b0t (s, a)wta . (5) Eq. (4) incorporates observations through an observation model Z(s, o). Now Z(s, o) is a N ×N ×|O| tensor that represents the probability of receiving observation o ∈ O in state s ∈ S. In our grid navigation task observations depend on the obstacle locations. We condition Z on the task parameter, Z(s, o) = fZ (s, o|θ) for θ ∈ Θ. The function fZ is a neural network, mapping from θ to Z(s, o). In this paper fZ is a CNN. Z(s, o) encodes observation probabilities for each of the observations, o ∈ O. We need the observation probabilities for the last observation ot . In general O 6= O and we cannot index Z(s, o) directly. Instead, we will use soft indexing again. We encode observations in O to observations in O through fO . fO is a function mapping from ot to an indexing vector, wto , a distribution over O. We then weight Z(s, o) by wto , i.e. P Z(s) = o∈O Z(s, o)wto . (6) Finally, we obtain the updated belief, bt+1 (s), by multiplying b0t (s) and Z(s) element-wise, and normalizing over states. In our setting the initial belief for the task W (θ) is encoded in θ. We initialize the belief in QMDP-net through an additional encoding function, b0 = fB (θ). 5 Planner module. The QMDP planner (Fig. 3b) performs value iteration at its core. Q values are computed by iteratively applying Bellman updates, P Qk+1 (s, a) = R(s, a) + γ s0 ∈S T (s, a, s0 )Vk (s0 ), (7) Vk (s) = maxa Qk (s, a). (8) Actions are then selected by weighting the Q values with the belief. We can implement value iteration using convolutional and max pooling layers [28, 34]. In our grid navigation task Q(s, a) is a N ×N ×|A| tensor. Eq. (8) is expressed by a max pooling layer, where Qk (s, a) is the input and Vk (s) is the output. Eq. (7) is a N ×N convolution with |A| convolutional filters, followed by an addition operation with R(s, a), the reward tensor. We denote the convolutional layer by fT0 . The kernel weights of fT0 encode the transition function T , similarly to fT in the filter. Rewards for a navigation task depend on the goal and obstacles. We condition rewards on the task parameter, R(s, a) = fR (s, a|θ). fR maps from θ to R(s, a). In this paper fR is a CNN. We implement K iterations of Bellman updates by stacking the layers representing Eq. (7) and Eq. (8) K times with tied weights. After K iterations we get QK (s, a), the approximate Q values for each state-action pair. We weight the Q values by the belief to obtain action values, P q(a) = s∈S QK (s, a)bt (s). (9) Finally, we choose the output action through a low-level policy function, fπ , mapping from q(a) to the action output, at+1 . QMDP-net naturally extends to higher dimensional discrete state spaces (e.g. our maze navigation task) where n-dimensional convolutions can be used [14]. While M (θ) is restricted to a discrete space, we can handle continuous tasks WΘ by simultaneously learning a discrete M (θ) for planning, and fA , fO , fB , fπ to map between states, actions and observations in WΘ and M (θ). 5 Experiments The main objective of the experiments is to understand the benefits of structure priors on learning neural-network policies. We create several alternative network architectures by gradually relaxing the structure priors and evaluate the architectures on simulated robot navigation and manipulation tasks. While these tasks are simpler than, for example, Atari games, in terms of visual perception, they are in fact very challenging, because of the sophisticated long-term reasoning required to handle partial observability and distant future rewards. Since the exact state of the robot is unknown, a successful policy must reason over many steps to gather information and improve state estimation through partial and noisy observations. It also must reason about the trade-off between the cost of information gathering and the reward in the distance future. 5.1 Experimental Setup We compare the QMDP-net with a number of related alternative architectures. Two are QMDP-net variants. Untied QMDP-net relaxes the constraints on the planning module by untying the weights representing the state-transition function over the different CNN layers. LSTM QMDP-net replaces the filter module with a generic LSTM module. The other two architectures do not embed POMDP structure priors at all. CNN+LSTM is a state-of-the-art deep CNN connected to an LSTM. It is similar to the DRQN architecture proposed for reinforcement learning under partially observability [10]. RNN is a basic recurrent neural network with a single fully-connected hidden layer. RNN contains no structure specific to planning under partial observability. Each experimental domain contains a parameterized set of tasks WΘ . The parameters θ encode an environment, a goal, and a belief over the robot’s initial state. To train a policy for WΘ , we generate random environments, goals, and initial beliefs. We construct ground-truth POMDP models for the generated data and apply the QMDP algorithm. If the QMDP algorithm successfully reaches the goal, we then retain the resulting sequence of action and observations (a1 , o1 , a2 , o2 , . . .) as an expert trajectory, together with the corresponding environment, goal, and initial belief. It is important to note that the ground-truth POMDPs are used only for generating expert trajectories and not for learning the QMDP-net. 6 For fair comparison, we train all networks using the same set of expert trajectories in each domain. We perform basic search over training parameters, the number of layers, and the number of hidden units for each network architecture. Below we briefly describe the experimental domains. See Appendix C for implementation details. Grid-world navigation. A robot navigates in an unknown building given a floor map and a goal. The robot is uncertain of its own location. It is equipped with a LIDAR that detects obstacles in its direct neighborhood. The world is uncertain: the robot may fail to execute desired actions, possibly because of wheel slippage, and the LIDAR may produce false readings. We implemented a simplified version of this task in a discrete n×n grid world (Fig. 1c). The task parameter θ is represented as an n×n image with three channels. The first channel encodes the obstacles in the environment, the second channel encodes the goal, and the last channel encodes the belief over the robot’s initial state. The robot’s state represents its position in the grid. It has five actions: moving in each of the four canonical directions or staying put. The LIDAR observations are compressed into four binary values corresponding to obstacles in the four neighboring cells. We consider both a deterministic and a stochastic variant of the domain. The stochastic variant adds action and observation uncertainties. The robot fails to execute the specified move action and stays in place with probability 0.2. The observations are faulty with probability 0.1 independently in each direction. We trained a policy using expert trajectories from 10, 000 random environments, 5 trajectories from each environment. We then tested on a separate set of 500 random environments. Maze navigation. A differential-drive robot navigates in a maze with the help of a map, but it does not know its pose (Fig. 1d). This domain is similar to the grid-world navigation, but it is significant more challenging. The robot’s state contains both its position and orientation. The robot cannot move freely because of kinematic constraints. It has four actions: move forward, turn left, turn right and stay put. The observations are relative to the robot’s current orientation, and the increased ambiguity makes it more difficult to localize the robot, especially when the initial state is highly uncertain. Finally, successful trajectories in mazes are typically much longer than those in randomly-generated grid worlds. Again we trained on expert trajectories in 10, 000 randomly generated mazes and tested them in 500 new ones. Fig. 4: Highly ambiguous observations in a maze. The four observations (in red) are the same, despite that the robot states are all different. (a) (b) 2-D object grasping. A robot gripper picks up novel objects from a table using a two-finger hand with noisy touch sensors at the finger tips. The gripper uses the fingers to perform compliant motions while maintaining contact with the object or to grasp the object. It knows the shape of the object to be grasped, maybe from an object Fig. 5: Object grasping using touch sensdatabase. However, it does not know its own pose relative ing. (a) An example [3]. (b) Simplified to the object and relies on the touch sensors to localize 2-D object grasping. Objects from the itself. We implemented a simplified 2-D variant of this training set (top) and the test set (bottom). task, modeled as a POMDP [13]. The task parameter θ is an image with three channels encoding the object shape, the grasp point, and a belief over the gripper’s initial pose. The gripper has four actions, each moving in a canonical direction unless it touches the object or the environment boundary. Each finger has 3 binary touch sensors at the tip, resulting in 64 distinct observations. We trained on expert demonstration on 20 different objects with 500 randomly sampled poses for each object. We then tested on 10 previously unseen objects in random poses. 5.2 Choosing QMDP-Net Components for a Task Given a new task WΘ , we need to choose an appropriate neural network representation for M (θ). More specifically, we need to choose S, A and O, and a representation for the functions fR , fT , fT0 , fZ , fO , fA , fB , fπ . This provides an opportunity to incorporate domain knowledge in a principled way. For example, if WΘ has a local and spatially invariant connectivity structure, we can choose convolutions with small kernels to represent fT , fR and fZ . 7 In our experiments we use S = N ×N for N ×N grid navigation, and S = N ×N ×4 for N ×N maze navigation where the robot has 4 possible orientations. We use |A| = |A| and |O| = |O| for all tasks except for the object grasping task, where |O| = 64 and |O| = 16. We represent fT , fR and fZ by CNN components with 3×3 and 5×5 kernels depending on the task. We enforce that fT and fZ are proper probability distributions by using softmax and sigmoid activations on the convolutional kernels, respectively. Finally, fO is a small fully connected component, fA is a one-hot encoding function, fπ is a single softmax layer, and fB is the identity function. We can adjust the amount of planning in a QMDP-net by setting K. A large K allows propagating information to more distant states without affecting the number of parameters to learn. However, it results in deeper networks that are computationally expensive to evaluate and more difficult to train. We used K = 20 . . . 116 depending on the problem size. We were able to transfer policies to larger environments by increasing K up to 450 when executing the policy. In our experiments the representation of the task parameter θ is isomorphic to the chosen state space S. While the architecture is not restricted to this setting, we rely on it to represent fT , fZ , fR by convolutions with small kernels. Experiments with a more general class of problems is an interesting direction for future work. 5.3 Results and Discussion The main results are reported in Table 1. Some additional results are reported in Appendix A. For each domain, we report the task success rate and the average number of time steps for task completion. Comparing the completion time is meaningful only when the success rates are similar. QMDP-net successfully learns policies that generalize to new environments. When evaluated on new environments, the QMDP-net has higher success rate and faster completion time than the alternatives in nearly all domains. To understand better the performance difference, we specifically compared the architectures in a fixed environment for navigation. Here only the initial state and the goal vary across the task instances, while the environment remains the same. See the results in the last row of Table 1. The QMDP-net and the alternatives have comparable performance. Even RNN performs very well. Why? In a fixed environment, a network may learn the features of an optimal policy directly, e.g., going straight towards the goal. In contrast, the QMDP-net learns a model for planning, i.e., generating a near-optimal policy for a given arbitrary environment. POMDP structure priors improve the performance of learning complex policies. Moving across Table 1 from left to right, we gradually relax the POMDP structure priors on the network architecture. As the structure priors weaken, so does the overall performance. However, strong priors sometimes over-constrain the network and result in degraded performance. For example, we found that tying the weights of fT in the filter and fT0 in the planner may lead to worse policies. While both fT and fT0 represent the same underlying transition dynamics, using different weights allows each to choose its own approximation and thus greater flexibility. We shed some light on this issue and visualize the learned POMDP model in Appendix B. QMDP-net learns “incorrect”, but useful models. Planning under partial observability is intractable in general, and we must rely on approximation algorithms. A QMDP-net encodes both a POMDP model and QMDP, an approximate POMDP algorithm that solves the model. We then train the network end-to-end. This provides the opportunity to learn an “incorrect”, but useful model that compensates the limitation of the approximation algorithm, in a way similar to reward shaping in reinforcement learning [22]. Indeed, our results show that the QMDP-net achieves higher success rate than QMDP in nearly all tasks. In particular, QMDP-net performs well on the well-known Hallway2 domain, which is designed to expose the weakness of QMDP resulting from its myopic planning horizon. The planning algorithm is the same for both the QMDP-net and QMDP, but the QMDP-net learns a more effective model from expert demonstrations. This is true even though QMDP generates the expert data for training. We note that the expert data contain only successful QMDP demonstrations. When both successful and unsuccessful QMDP demonstrations were used for training, the QMDP-net did not perform better than QMDP, as one would expect. QMDP-net policies learned in small environments transfer directly to larger environments. Learning a policy for large environments from scratch is often difficult. A more scalable approach 8 Table 1: Performance comparison of QMDP-net and alternative architectures for recurrent policy networks. SR is the success rate in percentage. Time is the average number of time steps for task completion. D-n and S-n denote deterministic and stochastic variants of a domain with environment size n×n. QMDP Domain QMDP-net Untied QMDP-net LSTM QMDP-net CNN +LSTM RNN SR Time SR Time SR Time SR Time SR Time SR Time Grid D-10 Grid D-18 Grid D-30 99.8 99.0 97.6 8.8 15.5 24.6 99.6 99.0 98.6 8.2 14.6 25.0 98.6 98.8 98.8 8.3 14.8 23.9 84.4 43.8 22.2 12.8 27.9 51.1 90.0 57.8 19.4 13.4 33.7 45.2 87.8 35.8 16.4 13.4 24.5 39.3 Grid S-18 98.1 23.9 98.8 23.9 95.9 24.0 23.8 55.6 41.4 65.9 34.0 64.1 Maze D-29 Maze S-19 63.2 63.1 54.1 50.5 98.0 93.9 56.5 60.4 95.4 98.7 62.5 57.1 9.8 18.9 57.2 79.0 9.2 19.2 41.4 80.8 9.8 19.6 47.0 82.1 Hallway2 37.3 28.2 82.9 64.4 69.6 104.4 82.8 89.7 77.8 99.5 68.0 108.8 Grasp 98.3 14.6 99.6 18.2 98.9 20.4 91.4 26.4 92.8 22.1 94.1 Intel Lab Freiburg 90.2 88.4 85.4 66.9 94.4 107.7 93.2 81.1 20.0 37.4 55.3 51.7 Fixed grid 98.8 17.4 98.6 99.8 17.0 17.6 97.0 19.7 98.4 25.7 - 19.9 98.0 19.8 would be to learn a policy in small environments and transfer it to large environments by repeating the reasoning process. To transfer a learned QMDP-net policy, we simply expand its planning module by adding more recurrent layers. Specifically, we trained a policy in randomly generated 30 × 30 grid worlds with K = 90. We then set K = 450 and applied the learned policy to several real-life environments, including Intel Lab (100×101) and Freiburg (139×57), using their LIDAR maps (Fig. 1c) from the Robotics Data Set Repository [12]. See the results for these two environments in Table 1. Additional results with different K settings and other buildings are available in Appendix A. 6 Conclusion A QMDP-net is a deep recurrent policy network that embeds POMDP structure priors for planning under partial observability. While generic neural networks learn a direct mapping from inputs to outputs, QMDP-net learns how to model and solve a planning task. The network is fully differentiable and allows for end-to-end training. Experiments on several simulated robotic tasks show that learned QMDP-net policies successfully generalize to new environments and transfer to larger environments as well. The POMDP structure priors and end-to-end training substantially improve the performance of learned policies. Interestingly, while a QMDP-net encodes the QMDP algorithm for planning, learned QMDP-net policies sometimes outperform QMDP. There are many exciting directions for future exploration. First, a major limitation of our current approach is the state space representation. The value iteration algorithm used in QMDP iterates through the entire state space and is well known to suffer from the “curse of dimensionality”. To alleviate this difficulty, the QMDP-net, through end-to-end training, may learn a much smaller abstract state space representation for planning. One may also incorporate hierarchical planning [8]. Second, QMDP makes strong approximations in order to reduce computational complexity. We want to explore the possibility of embedding more sophisticated POMDP algorithms in the network architecture. While these algorithms provide stronger planning performance, their algorithmic sophistication increases the difficulty of learning. Finally, we have so far restricted the work to imitation learning. It would be exciting to extend it to reinforcement learning. Based on earlier work [28, 34], this is indeed promising. Acknowledgments We thank Leslie Kaelbling and Tomás Lozano-Pérez for insightful discussions that helped to improve our understanding of the problem. The work is supported in part by Singapore Ministry of Education AcRF grant MOE2016-T2-2-068 and National University of Singapore AcRF grant R-252-000-587112. 9 References [1] M. Abadi, A. Agarwal, P. Barham, E. Brevdo, Z. Chen, C. Citro, G. S. Corrado, A. Davis, J. Dean, M. Devin, et al. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL http://tensorflow.org/. [2] J. A. Bagnell, S. Kakade, A. Y. Ng, and J. G. Schneider. Policy search by dynamic programming. In Advances in Neural Information Processing Systems, pages 831–838, 2003. [3] H. Bai, D. Hsu, W. S. Lee, and V. A. Ngo. Monte carlo value iteration for continuous-state POMDPs. In Algorithmic Foundations of Robotics IX, pages 175–191, 2010. [4] B. Bakker, V. Zhumatiy, G. Gruener, and J. Schmidhuber. A robot that reinforcement-learns to identify and memorize important previous observations. In International Conference on Intelligent Robots and Systems, pages 430–435, 2003. [5] J. Baxter and P. L. Bartlett. Infinite-horizon policy-gradient estimation. Journal of Artificial Intelligence Research, 15:319–350, 2001. [6] B. Boots, S. M. Siddiqi, and G. J. Gordon. Closing the learning-planning loop with predictive state representations. The International Journal of Robotics Research, 30(7):954–966, 2011. [7] K. Cho, B. Van Merriënboer, C. Gulcehre, D. Bahdanau, F. Bougares, H. Schwenk, and Y. Bengio. Learning phrase representations using RNN encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014. [8] S. Gupta, J. Davidson, S. Levine, R. Sukthankar, and J. Malik. Cognitive mapping and planning for visual navigation. arXiv preprint arXiv:1702.03920, 2017. [9] T. Haarnoja, A. Ajay, S. Levine, and P. Abbeel. Backprop kf: Learning discriminative deterministic state estimators. In Advances in Neural Information Processing Systems, pages 4376–4384, 2016. [10] M. J. Hausknecht and P. Stone. Deep recurrent Q-learning for partially observable MDPs. arXiv preprint, 2015. URL http://arxiv.org/abs/1507.06527. [11] S. Hochreiter and J. Schmidhuber. Long short-term memory. Neural Computation, 9(8):1735–1780, 1997. [12] A. Howard and N. Roy. The robotics data set repository (radish), 2003. URL http://radish. sourceforge.net/. [13] K. Hsiao, L. P. Kaelbling, and T. Lozano-Pérez. Grasping POMDPs. In International Conference on Robotics and Automation, pages 4685–4692, 2007. [14] S. Ji, W. Xu, M. Yang, and K. Yu. 3D convolutional neural networks for human action recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence, 35(1):221–231, 2013. [15] R. Jonschkowski and O. Brock. End-to-end learnable histogram filters. In Workshop on Deep Learning for Action and Interaction at NIPS, 2016. URL http://www.robotics.tu-berlin.de/fileadmin/ fg170/Publikationen_pdf/Jonschkowski-16-NIPS-WS.pdf. [16] A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems, pages 1097–1105, 2012. [17] H. Kurniawati, D. Hsu, and W. S. Lee. Sarsop: Efficient point-based POMDP planning by approximating optimally reachable belief spaces. In Robotics: Science and Systems, volume 2008, 2008. [18] M. L. Littman, A. R. Cassandra, and L. P. Kaelbling. Learning policies for partially observable environments: Scaling up. In International Conference on Machine Learning, pages 362–370, 1995. [19] M. L. Littman, R. S. Sutton, and S. Singh. Predictive representations of state. In Advances in Neural Information Processing Systems, pages 1555–1562, 2002. [20] P. Mirowski, R. Pascanu, F. Viola, H. Soyer, A. Ballard, A. Banino, M. Denil, R. Goroshin, L. Sifre, K. Kavukcuoglu, et al. Learning to navigate in complex environments. arXiv preprint arXiv:1611.03673, 2016. [21] V. Mnih, K. Kavukcuoglu, D. Silver, A. A. Rusu, J. Veness, M. G. Bellemare, A. Graves, M. Riedmiller, A. K. Fidjeland, G. Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015. 10 [22] A. Y. Ng, D. Harada, and S. Russell. Policy invariance under reward transformations: Theory and application to reward shaping. In International Conference on Machine Learning, pages 278–287, 1999. [23] M. Okada, L. Rigazio, and T. Aoshima. Path integral networks: End-to-end differentiable optimal control. arXiv preprint arXiv:1706.09597, 2017. [24] C. H. Papadimitriou and J. N. Tsitsiklis. The complexity of Markov decision processes. Mathematics of Operations Research, 12(3):441–450, 1987. [25] J. Pineau, G. J. Gordon, and S. Thrun. Applying metric-trees to belief-point POMDPs. In Advances in Neural Information Processing Systems, page None, 2003. [26] G. Shani, R. I. Brafman, and S. E. Shimony. Model-based online learning of POMDPs. In European Conference on Machine Learning, pages 353–364, 2005. [27] G. Shani, J. Pineau, and R. Kaplow. A survey of point-based POMDP solvers. Autonomous Agents and Multi-agent Systems, 27(1):1–51, 2013. [28] T. Shankar, S. K. Dwivedy, and P. Guha. Reinforcement learning via recurrent convolutional neural networks. In International Conference on Pattern Recognition, pages 2592–2597, 2016. [29] D. Silver and J. Veness. Monte-carlo planning in large POMDPs. In Advances in Neural Information Processing Systems, pages 2164–2172, 2010. [30] D. Silver, A. Huang, C. J. Maddison, A. Guez, L. Sifre, G. Van Den Driessche, J. Schrittwieser, I. Antonoglou, V. Panneershelvam, M. Lanctot, et al. Mastering the game of Go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016. [31] D. Silver, H. van Hasselt, M. Hessel, T. Schaul, A. Guez, T. Harley, G. Dulac-Arnold, D. Reichert, N. Rabinowitz, A. Barreto, et al. The predictron: End-to-end learning and planning. arXiv preprint, 2016. URL https://arxiv.org/abs/1612.08810. [32] M. T. Spaan and N. Vlassis. Perseus: Randomized point-based value iteration for POMDPs. Journal of Artificial Intelligence Research, 24:195–220, 2005. [33] C. Stachniss. Robotics 2D-laser dataset. URL http://www.ipb.uni-bonn.de/datasets/. [34] A. Tamar, S. Levine, P. Abbeel, Y. Wu, and G. Thomas. Value iteration networks. In Advances in Neural Information Processing Systems, pages 2146–2154, 2016. [35] T. Tieleman and G. Hinton. Lecture 6.5 - rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural networks for machine learning, pages 26–31, 2012. [36] S. Xingjian, Z. Chen, H. Wang, D.-Y. Yeung, W.-k. Wong, and W.-c. Woo. Convolutional LSTM network: A machine learning approach for precipitation nowcasting. In Advances in Neural Information Processing Systems, pages 802–810, 2015. [37] N. Ye, A. Somani, D. Hsu, and W. S. Lee. Despot: Online POMDP planning with regularization. Journal of Artificial Intelligence Research, 58:231–266, 2017. 11 A A.1 Supplementary Experiments Navigation on Large LIDAR Maps We provide results on additional environments for the LIDAR map navigation task. LIDAR maps are obtained from [33]. See Section C.5 for details. Intel corresponds to Intel Research Lab. Freiburg corresponds to Freiburg, Building 079. Belgioioso corresponds to Belgioioso Castle. MIT corresponds to the western wing of the MIT CSAIL building. We note the size of the grid size N xM for each environment. A QMDP-net policy is trained on the 30x30-D grid navigation domain on randomly generated environments using K = 90. We then execute the learned QMDP-net policy with different K settings, i.e. we add convolutional layers to the planner that share the same kernel weights. We report the task success rate and the average number of time steps for task completion. Table 2: Additional results for navigation on large LIDAR maps. QMDP Domain Intel 100×101 Freiburg 139×57 Belgioioso 151×35 MIT 41×83 SR Time QMDP-net K=450 SR Time 90.2 88.4 95.8 94.4 85.4 66.9 63.9 42.6 94.4 108.0 92.0 91.4 95.4 71.8 91.4 53.8 QMDP-net K=180 SR Time QMDP-net K=90 SR Time Untied QMDP-net SR Time 83.4 93.2 90.6 96.0 40.8 55.8 60.0 86.2 20.0 37.4 41.0 66.6 89.6 81.1 62.0 48.5 78.6 68.0 54.3 45.4 55.3 51.7 47.7 41.4 In the conventional setting, when value iteration is executed on a fully known MDP, increasing K improves the value function approximation and improves the policy in return for the increased computation. In a QMDP-net increasing K has two effects on the overall planning quality. Estimation accuracy of the latent values increases and reward information can propagate to more distant states. On the other hand the learned latent model does not necessarily fit the true underlying model, and it can be overfitted to the K setting during training. Therefore a too high K can degrade the overall performance. We found that Ktest = 2Ktrain significantly improved success rates in all our test cases. Further increasing Ktest = 5Ktrain was beneficial in the Intel and Belgioioso environments, but it slightly decreased success rates for the Freiburg and MIT environments. We compare QMDP-net to its untied variant, Untied QMDP-net. We cannot expand the layers of Untied QMDP-net during execution. In consequence, the performance is poor. Note that the other alternative architectures we considered are specific to the input size and thus they are not applicable. A.2 Learning “Incorrect” but Useful Models We demonstrate that an “incorrect” model can result in better policies when solved by the approximate QMDP algorithm. We compute QMDP policies on a POMDP with modified reward values, then evaluate the policies using the original rewards. We use the deterministic 29×29 maze navigation task where QMDP did poorly. We attempt to shape rewards manually. Our motivation is to break symmetry in the model, and to implicitly encourage information gathering and compensate for the one-step look-ahead approximation in QMDP. Modified 1. We increase the cost for the stay actions to 20 times of its original value. Modified 2. We increase the cost for the stay action to 50 times of its original value, and the cost for the turn right action to 10 times of its original value. Table 3: QMDP policies computed on an “incorrect” model and evaluated on the “correct” model. Variant SR Time Original reward Original Modified 1 Modified 2 63.2 65.0 93.0 54.1 58.1 71.4 1.09 1.71 4.96 Why does the “correct” model result in poor policies when solved by QMDP? At a given point the Q value for a set of possible states may be high for the turn left action and low for the turn right action; 12 while for another set of states it may be the opposite way around. In expectation, both next states have lower value than the current one, thus the policy chooses the stay action, the robot does not gather information and it is stuck in one place. Results demonstrate that planning on an “incorrect” model may improve the performance on the “correct” model. B Visualizing the Learned Model B.1 Value Function We plot the value function predicted by a QMDP-net for the 18 × 18 stochastic grid navigation task. We used K = 54 iterations in the QMDP-net. As one would expect, states close to the goal have high values. Fig. 6: Map of a test environment and the corresponding learned value function VK . B.2 Belief Propagation We plot the execution of a learned QMDP-net policy and the internal belief propagation on the 18 × 18 stochastic grid navigation task. The first row in Fig. 7 shows the environment including the goal (red) and the unobserved pose of the robot (blue). The second row shows ground-truth beliefs for reference. We do not access ground-truth beliefs during training except for the initial belief. The third row shows beliefs predicted by a QMDP-net. The last row shows the difference between the ground-truth and predicted beliefs. Fig. 7: Policy execution and belief propagation in the 18 × 18 stochastic grid navigation task. 13 The figure demonstrates that QMDP-net was able to learn a reasonable filter for state estimation in a noisy environment. In the depicted example the initial belief is uniform over approximately half of the state space (Step 0). Due to the highly uncertain initial belief and the observation noise the robot stays in place for two steps (Step 1 and 2). After two steps the state estimation is still highly uncertain, but it is mostly spread out right from the goal. Therefore, moving left is a reasonable choice (Step 3). After an additional stay action (Step 4) the belief distribution is small enough and the robot starts moving towards the goal (not shown). B.3 State-Transition Function We plot the learned and ground-truth state-transition functions. Columns of the table correspond to actions. The first row shows the ground-truth transition function. The second row shows fT , the learned state-transition function in the filter. The third row shows fT0 , the learned state-transition function in the planner. Fig. 8: Learned transition function T in the 18 × 18 stochastic grid navigation task. While both fT and fT0 represent the same underlying transition dynamics, the learned transition probabilities are different in the filter and planner. Different weights allows each module to choose its own approximation and thus provides greater flexibility. The actions in the model a ∈ A are learned abstractions of the agent’s actions a ∈ A. Indeed, in the planner the learned transition probabilities for action ai ∈ A do not match the transition probabilities of ai ∈ A. B.4 Reward Function Next plot the learned reward function R for each action a ∈ A. Fig. 9: Learned reward function R in the 18 × 18 stochastic grid navigation domain. While the learned rewards do not directly correspond to rewards in the underlying task, they are reasonable: obstacles are assigned negative rewards and the goal is assigned a positive reward. Note that learned reward values correspond to the reward after taking an action, therefore they should be interpreted together with the corresponding transition probabilities (third row of Fig. 8). 14 C C.1 Implementation Details Grid-World Navigation We implement the grid navigation task in randomly generated discrete N ×N grids where each cell has p = 0.25 probability of being an obstacle. The robot has 5 actions: move in the four canonical directions and stay put. Observations are four binary values corresponding to obstacles in the four neighboring cells. We consider a deterministic variant (denoted by -D) and a stochastic variant (denoted by -S). In the stochastic variant the robot fails to execute each action with probability Pt = 0.2, in which case it stays in place. The observations are faulty with probability Po = 0.1 independently in each direction. Since we receive observations from 4 directions, the probability of receiving the correct observation vector is only 0.94 = 0.656. The task parameter, θ, is an N ×N ×3 image that encodes information about the environment. The first channel encodes obstacles, 1 for obstacles, 0 for free space. The second channel encodes the goal, 1 for the goal, 0 otherwise. The third channel encodes the initial belief over robot states, each pixel value corresponds to the probability of the robot being in the corresponding state. We construct a ground-truth POMDP model to obtain expert trajectories for training. It is important to note that the learning agent has no access to the ground-truth POMDP models. In the ground-truth model the robot receives a reward of −0.1 for each step, +20 for reaching the goal, and −10 for bumping into an obstacle. We use QMDP to solve the POMDP model, and execute the QMDP policy to obtain expert trajectories. We use 10, 000 random grids for training. Initial and goal states are sampled from the free space uniformly. We exclude samples where there is no feasible path. The initial belief is uniform over a random fraction of the free space which includes the underlying initial state. More specifically, the number of non-zero values in the initial-belief are sampled from {1, 2, . . . Nf /2, Nf } where Nf is the number of free cells in the grid. For each grid we generate 5 expert trajectories with different initial state, initial belief and goal. Note that we do not access the true beliefs after the first step nor the underlying states along the trajectory. We test on a set of 500 environments generated separately in equal conditions. We declare failure after 10N steps without reaching the goal. Note that the expert policy is sub-optimal and it may fail to reach the goal. We exclude these samples from the training set but include them in the test set. We choose the structure of M (θ), the model in QMDP-net, to match the structure of the underlying task. The transition function in the filter fT and the planner fT0 are both 3×3 convolutions. While they both represent the same transition function we do not tie their weights. We apply a softmax function on the kernel matrix so its values sum to one. The reward function, fR , is a CNN with two convolutional layers. The first has 3×3 kernel, 150 filters, ReLU activation. The second has 1×1 kernel, 5 filters and linear activation. The observation model, fZ , is a similar two-layer CNN. The first convolution has a 3×3 kernel, 150 filters, linear activation. The second has 1×1 kernel, 17 filters and linear activation. The action mapping, fA , is a one-hot encoding function. The observation mapping, fO , is a fully connected network with one hidden layer with 17 units and tanh activation. It has 17 output units and softmax activation. The low-level policy function, fπ , is a single softmax layer. The state space mapping function, fB , is the identity function. Finally, we choose the number of iterations in the planner module, K = {30, 54, 90} for grids of size N = {10, 18, 30} respectively. The 3×3 convolutions in fT and fZ imply that T and O are spatially invariant and local. In the underlying task the locality assumption holds but spatial invariance does not: transitions depend on the arrangement of obstacles. Nevertheless, the additional flexibility in the model allows QMDP-net to learn high-quality policies, e.g. by shaping the rewards and the observation function. C.2 Maze Navigation In the maze navigation task a differential drive robot has to navigate to a given goal. We generate random mazes on N ×N grids using Kruskal’s algorithm. The state space has 3 dimensions where the third dimension represents 4 possible orientations of the robot. The goal configuration is invariant to the orientation. The robot now has 4 actions: move forward, turn left, turn right and stay put. The initial belief is chosen in a similar manner to the grid navigation case but in the 3-D space. The observations are identical to grid navigation but they are relative to the robot’s orientation, which significantly increases the difficulty of state estimation. The stochastic variant (denoted by -S) has 15 a motion and observation noise identical to the grid navigation. Training and test data is prepared identically as well. We use K = {76, 116} for mazes of size N = {19, 29} respectively. We use a model in QMDP-net with a 3-dimensional state space of size N ×N ×4 and an action space with 4 actions. The components of the network are chosen identically to the previous case, except that all CNN components operate on 3-D tensors of size N ×N ×4. While it would be possible to use 3-D convolutions, we treat the third dimension as channels of a 2-D image instead, and use conventional 2-D convolutions. If the output of the last convolutional layer is of size N ×N ×Nc for the grid navigation task, it is of size N ×N ×4Nc for the maze navigation task. When necessary, these tensors are transformed into a 4 dimensional form N ×N ×4×Nc and the max-pool or softmax activation is computed along the last dimension. C.3 Object Grasping We consider a 2-D implementation of the grasping task based on the POMDP model proposed by Hsiao et al. [13]. Hsiao et al. focused on the difficulty of planning with high uncertainty and solved manually designed POMDPs for single objects. We phrase the problem as a learning task where we have no access to a model and we do not know all objects in advance. In our setting the robot receives an image of the target object and a feasible grasp point, but it does not know its pose relative to the object. We aim to learn a policy on a set of object that generalizes to similar but unseen objects. The object and the gripper are represented in a discrete grid. The workspace is a 14×14 grid, and the gripper is a “U” shape in the grid. The gripper moves in the four canonical directions, unless it reaches the boundaries of the workspace or it is touching the object. in which case it stays in place. The gripper fails to move with probability 0.2. The gripper has two fingers with 3 touch sensors on each finger. The touch sensors indicate contact with the object or reaching the limits of the workspace. The sensors produce an incorrect reading with probability 0.1 independently for each sensor. In each trial an object is placed on the bottom of the workspace at a random location. The initial gripper pose is unknown; the belief over possible states is uniform over a random fraction of the upper half of the workspace. The local observations, ot , are readings from the touch sensors. The task parameter θ is an image with three channels. The first channel encodes the environment with an object; the second channel encodes the position of the target grasping point; the third channel encodes the initial belief over the gripper position. We have 30 artificial objects of different sizes up to 6×6 grid cells. Each object has at least one cell on its top that the gripper can grasp. For training we use 20 of the objects. We generate 500 expert trajectories for each object in random configuration. We test the learned policies on 10 new objects in 20 random configurations each. The expert trajectories are obtained by solving a ground-truth POMDP model by the QMDP algorithm. In the ground-truth POMDP the robot receives a reward of 1 for reaching the grasp point and 0 for every other state. In QMDP-net we choose a model with S = 14 × 14, |A| = 4 and |O| = 16. Note that the underlying task has |O| = 64 possible observations. The network components are chosen similarly to the grid navigation task, but the first convolution kernel in fZ is increased to 5×5 to account for more distant observations. We set the number of iterations K = 20. C.4 Hallway2 The Hallway2 navigation problem was proposed by Littman et al. [18] and has been used as a benchmark problem for POMDP planning [27]. It was specifically designed to expose the weakness of the QMDP algorithm resulting from its myopic planning horizon. While QMDP-net embeds the QMDP algorithm, through end-to-end training QMDP-net was able to learn a model that is significantly more effective given the QMDP algorithm. Hallway2 is a particular instance of the maze problem that involves more complex dynamics and high noise. For details we refer to the original problem definition [18]. We train a QMDP-net on random 8×8 grids generated similarly to the grid navigation case, but using transitions that match the Hallway2 POMDP model. We then execute the learned policy on a particularly difficult instance of this problem that embeds the Hallway2 layout in a 8×8 grid. The initial state is uniform over the full state space. In each trial the robot starts from a random underlying state. The trial is deemed unsuccessful after 251 steps. 16 C.5 Navigation on a Large LIDAR Map We obtain real-world building layouts using 2-D laser data from the Robotics Data Set Repository [12]. More specifically, we use SLAM maps preprocessed to gray-scale images available online [33]. We downscale the raw images to N xM and classify each pixel to be free or an obstacle by simple thresholding. The resulting maps are shown in Fig. 10. We execute policies in simulation where a grid is defined by the preprocessed map. The simulation employs the same dynamics as the grid navigation domain. The initial state and initial belief are chosen identically to the grid navigation case. Fig. 10: Preprocessed N ×M maps. A, Intel Research Lab, 100×101. B, Freiburg, building 079, 139×57. C, Belgioioso Castle, 151×35. D, western wing of the MIT CSAIL building, 41×83. A QMDP-net policy is trained on the 30x30-D grid navigation task on randomly generated environments. For training we set K = 90 in the QMDP-net. We then execute the learned policy on the LIDAR maps. To account for the larger grid size we increase the number of iterations to K = 450 when executing the policy. C.6 Architectures for Comparison We compare QMDP-net with two of its variants where we remove some of the POMDP priors embedded in the network (Untied QMDP-net, LSTM QMDP-net). We also compare with two generic network architectures that do not embed structural priors for decision making (CNN+LSTM, RNN). We also considered additional architectures for comparison, including networks with GRU [7] and ConvLSTM [36] cells. ConvLSTM is a variant of LSTM where the fully connected layers are replaced by convolutions. These architectures performed worse than CNN+LSTM for most of our task. Untied QMDP-net. We obtain Untied QMDP-net by untying the kernel weights in the convolutional layers that implement value iteration in the planner module of QMDP-net. We also remove the softmax activation on the kernel weights. This is equivalent to allowing a different transition model at each iteration of value iteration, and allowing transition probabilities that do not sum to one. In principle, Untied QMDP-net can represent the same policy as QMDP-net and it has some additional flexibility. However, Untied QMDP-net has more parameters to learn as K increases. The training difficulty increases with more parameters, especially on complex domains or when training with small amount of data. LSTM QMDP-net. In LSTM QMDP-net we replace the filter module of QMDP-net with a generic LSTM network but keep the value iteration implementation in the planner. The output of the LSTM component is a belief estimate which is input to the planner module of QMDP-net. We first process the task parameter input θ, an image encoding the environment and goal, by a CNN. We separately process the action at and observation ot input vectors by a two-layer fully connected component. These processed inputs are concatenated into a single vector which is the input of the LSTM layer. The size of the LSTM hidden state and output is chosen to match the number of states in the grid, e.g. N 2 for an N ×N grid. We initialize the hidden state of the LSTM using the appropriate channel of the input θ that encodes the initial belief. 17 CNN+LSTM. CNN+LSTM is a state-of-the-art deep convolutional network with LSTM cells. It is similar in structure to DRQN [10], which was used for learning to play partially observable Atari games in a reinforcement learning setting. Note that we train the networks in an imitation learning setting using the same set of expert trajectories, and not using reinforcement learning, so the comparison with QMDP-net is fair. The CNN+LSTM network has more structure to encode a decision making policy compared to a vanilla RNN, and it is also more tailored to our input representation. We process the image input, θ, by a CNN component and the vector input, at and ot , by a fully connected network component. The output of the CNN and the fully connected component are then combined into a single vector and fed to the LSTM layer. RNN. The considered RNN architecture is a vanilla recurrent neural network with 512 hidden units and tanh activation. At each step inputs are transformed into a single concatenated vector. The outputs are obtained by a fully connected layer with softmax activation. We performed hyperparameter search on the number of layers and hidden units, and adjusted learning rate and batch size for all alternative networks. In particular, we ran trials for the deterministic grid navigation task. For each architecture we chose the best parametrization found. We then used the same parametrization for all tasks. C.7 Training Technique We train all networks, QMDP-net and alternatives, in an imitation learning setting. The loss is defined as the cross-entropy between predicted and demonstrated actions along the expert trajectories. We do not receive supervision on the underlying ground-truth POMDP models. We train the networks with backpropagation through time on mini-batches of 100. The networks are implemented in Tensorflow [1]. We use RMSProp optimizer [35] with 0.9 decay rate and 0 momentum setting. The learning rate was set to 1 × 10−3 for QMDP-net and 1 × 10−4 for the alternative networks. We limit the number of backpropagation steps to 4 for QMDP-net and its untied variant; and to 6 for the other alternatives, which gave slightly better results. We used a combination of early stopping with patience and exponential learning rate decay of 0.9. In particular, we started to decrease the learning rate if the prediction error did not decrease for 30 consecutive epochs on a validation set, 10% of the training data. We performed 15 iterations of learning rate decay. We perform multiple rounds of the training method described above. In our partially observable domains predictions are increasingly difficult along a trajectory, as they require multiple steps of filtering, i.e. integrating information from a long sequence of observations. Therefore, for the first round of training we limit the number of steps along the expert trajectories, for training both QMDP-net and its alternatives. After convergence we perform a second round of training on the full length trajectories. Let Lr be the number of steps along the expert trajectories for training round r. We used two training rounds with L1 = 4 and L2 = 100 for training QMDP-net and its untied variant. For training the other alternative networks we used L1 = 6 and L2 = 100, which gave better results. We trained policies for the grid navigation task when the grid is fixed, only the initial state and goal vary. In this variant we found that a low Lr setting degrades the final performance for the alternative networks. We used a single training round with L1 = 100 for this task. 18
9cs.NE
Automated Identification and Classification of Stereochemistry: Chirality and Double Bond Stereoisomerism Ana L. Teixeira,*,†,‡ João P. Leal‡, § and Andre O. Falcao† † LaSIGE, Departamento de Informática, Faculdade de Ciências, Universidade de Lisboa, 1749-016 Lisboa, Portugal; ‡ Centro de Química e Bioquímica, Faculdade de Ciências, Universidade de Lisboa, 1749-016 Lisboa, Portugal; § Unidade de Ciências Químicas e Radiofarmacêuticas, Instituto Tecnológico e Nuclear, Instituto Superior Técnico, Universidade Técnica de Lisboa, 2686-953 Sacavém, Portugal. Abstract Stereoisomers have the same molecular formula and the same atom connectivity and their existence can be related to the presence of different three-dimensional (3D) arrangements. Stereoisomerism is of great importance in many different fields since the molecular properties and biological effects of the stereoisomers are often significantly different. Most drugs for example, are often composed of a single stereoisomer of a compound, and while one of them may have therapeutic effects on the body, another may be toxic. A challenging task is the automatic detection of stereoisomers using line input specifications such as SMILES or InChI since it requires information about group theory (to distinguish stereoisomers using mathematical information about its symmetry), topology and geometry of the molecule. There are several software packages that include modules to handle stereochemistry, especially the ones to name a chemical structure and/or view, edit and generate chemical structure diagrams. However, there is a lack of software capable of automatically analyzing a molecule represented as a graph and generate a classification of the type of isomerism present in a given atom or bond. Considering the importance of stereoisomerism when comparing chemical structures, this report describes a computer program for analyzing and processing steric information contained in a chemical structure represented as a molecular graph and providing as output a binary classification of the isomer type based on the recommended conventions. Due to the complexity of the underlying issue, specification of stereochemical information is currently limited to explicit stereochemistry and to the two most common types of stereochemistry caused by asymmetry around carbon atoms: chiral atom and double bond. Keywords: Chirality, Stereoisomers, Stereochemistry, Chiral Center, Geometric Isomerism, Enantiomers, Diastereomers, Double Bond Stereoisomerism, 2D coordinates * Corresponding author. E-mail address: [email protected] 1 1. Introduction One of the major tasks in cheminformatics is to represent chemical structures and to transfer the various types of representation into computer-readable formats [1]. The complexity of the chemical information and the difficulties representing and analyzing it constitute a considerable challenge in informatics. Molecules consist of atoms held together by covalent chemical bonds. Furthermore, molecules can be transformed into other molecules by the process of chemical reactions. Therefore, chemical information not only comprises text and numbers but also has to characterize chemical compounds with their special properties, geometries, interactions and reactions [1-4]. A particular issue which arises in the representation of chemical structures is to determinate how much of the above mentioned information to include [1, 2, 4]. The purpose of machine-readable structure representations is to mine the molecular information and make it suitable to perform common operations on molecules such as storage/retrieval, identity, substructure/superstructure relationships, similarity and multivariate relationships [2, 5]. Chemical structures are normally stored in a computer as molecular graphs. In a molecular graph (usually non-directed and labeled), the nodes correspond to the atoms and the edges to the bonds. Its vertices and edges are labeled with the kinds of the corresponding atoms or bond types, respectively [1, 2, 6]. The molecular graphs, for computer processing, are transformed (manually or automatically) into linear strings of characters (for example, SMILES [7] or InChI [8]) or into two-dimensional matrices (for example connection tables or adjacency matrices [9]) listing all of the atoms (nodes) with their mutual interconnections (bonds or edges) [1, 4, 6]. Figure 1 exemplifies different representations for a simple molecule, ethanol. Structure Molecular Representations Linear Notations SMILES InChI CCO InChI=1S/C2H6O/c1-2-3/h3H,2H2,1H3 2D matrices Connection Table (excluding hydrogen (H)) 3 2 0 0 0 0 0 0 0 0999 V2000 1.7321 -0.0000 0.0000 C 0.8660 -0.5000 0.0000 C 0.0000 -0.0000 0.0000 O 1 2 1 0 0 0 0 2 3 1 0 0 0 0 Adjacency Matrix (excluding hydrogen (H)) atom 1 2 3 1 6 1 0 2 1 6 1 3 0 1 8 Figure 1. Different representations for the molecule ethanol (C2H6O). In this context, a graph represents the topology of a molecule, i.e. the way the nodes (or atoms) are connected and is less suitable for modeling those properties that are determined by molecular geometry, conformation or stereochemistry. Thus a given graph may be drawn in many different ways and may not obviously correspond to a “standard” chemical. The complexity of chemical systems is considerably reduced once some aspects are neglected, 2 when they are modeled as graphs [1, 4, 6]. Comparing molecular graphs allows the distinction between structural isomers (compounds with the same molecular formula but nonisomorphic graph), moreover, typically it does not contain information about the threedimensional (3D) arrangement of the molecule [1, 4, 6, 9, 10]. Figure 2 exemplifies two different compounds, a) (R)-2-amino-3-(4-hydroxyphenyl) propanoic acid and b) (S)-2amino-3-(4-hydroxyphenyl) propanoic acid with identical connectivity (Figure 2 - c), i.e. a) and b) have the same topology, but different topography. a) b) c) Figure 2. 3-D representation of a) (R)-2-amino-3-(4-hydroxyphenyl) propanoic acid and b) (S)-2-amino-3-(4hydroxyphenyl) propanoic acid. c) molecular graph representation of 2-amino-3-(4-hydroxyphenyl) propanoic acid (excluding hydrogen atoms). The fact that molecules are 3D objects leads to situations where molecules with the same set of atoms and bonds can nonetheless be different as a result of their bonds having different arrangement in space (stereoisomers) [10-13]. Consequently, the configuration of a molecule defines the position of groups around one or more non-rotating bonds (as double bonds in the case of geometric isomerism) or around a chiral center. This inability of a double bond to rotate is known as hindered rotation, transpiring in the formation of the cis (Z) isomer and the trans (E) isomer. Such pairs of geometric isomers are called double-bond diastereomers. The spatial distances in diastereomeric pairs are not all identical which results in different chemical and physical properties between diastereomeric molecules [10, 12]. The term chirality refers to the handedness of an object that is not identical with its mirror image and for that reason it cannot be superimposed. The mirror-image configurations of the chiral molecule define a pair of enantiomers with identical chemical and physical properties, with the exception of their interactions with other stereoisomers and polarized light [10, 12]. Stereoisomerism is of great importance in many different fields since it often has dramatic consequences in molecular properties such as pharmacological activity, odor, environmental impact, physical properties, or chemical reactivity, particularly in the interaction of stereoisomers. For example, the effectiveness and toxicology of drugs depends on enantiomeric selectivity and purity [14, 15]. 3 There are several software packages that include modules to handle stereochemistry, especially the ones to name a chemical structure and/or view, edit and generate chemical structure diagrams such as Modular Chemical Descriptor Language (MCDL)[16], ChemBioDraw[17], Marvin[18], ACD/Chemsketch-[19], MOLGEN[20], among others. Another classical problem in chemoinformatics, related to this subject, is the enumeration of all possible chemical graphs for a certain structure. Several algorithms and commercially available software packages [21, 22] have been developed for the efficient enumeration of all stereoisomers of a chemical graph using different strategies[23] such as Corina[24], Stereoplex (module integrated in the software package Concord)[25], OMEGA[26], Molecular Operating Environment (MOE)[27], Catalyst[28], ChemAxon Calculator Plugins[29], FROG[30, 31], among others. Computer programs to assist organic synthesis planning have also integrated modules to recognize different stereoisomers, such as CHIRON[32] and LHASA[33]. Several authors have also integrated different stereo descriptors applied to quantitative structure-activity relationship (QSAR) problems [34-39]. The automatic detection of stereoisomers is a challenging task since it requires group theory (study the algebraic structures to distinguish stereoisomers using mathematical information about its symmetry), topology and geometry of a molecule [16]. Considering the importance of stereoisomers when comparing chemical structures, this report describes a computer program for analyzing and processing steric information contained in a chemical structure represented as a molecular graph. Most of the existing software packages are proprietary and/or commercial, and they do not allow batch processing of molecules encoded as line representations such as SMILES or InChI. This work arose from the need to have a computer program providing as output a binary classification of the isomer type according to CahnIngold-Prelog (CIP) system[40] using as input widely used line notations such as SMILES or InChI, as it will be explained below. Due to the complexity of the underlying issue, specification of stereochemical information is currently limited to explicit stereochemistry and to the two most common types, stereochemistry of a chiral carbon atom and stereochemistry of a double bond. 2. Identification and Specification of Chirality A simple chiral molecule has four unique chemical groups arranged around a tetrahedral carbon atom. Chiral carbon atoms are the most common source of molecular asymmetry and are found in many optically active biological compounds. If n asymmetric carbon atoms are present, then it is possible to generate 2n isomers (stereoisomers) [12]. Chiral configurations were previously designated as D and L by Fischer in 1891 (using D-glyceraldehyde as a reference) or recently as R and S according to the R-S notation defined by Cahn in 1964 [41, 42]. In order to establish the configuration, the four groups surrounding the central carbon atom (stereocenter) are ranked according to a priority sequence, determined by a number of sequence rules. The official systematic nomenclature to determine such rules was proposed in 1966 by Cahn, Ingold and Prelog (CIP rules) [40] and later extended[43]. The CIP rules play a double role: first, they allow determining whether the considered atom is really asymmetric, 4 and second they rank the ligands connected to the stereocenter producing a pre-defined priority. The CIP rules to define priorities to ligands can be simplified as follows [40, 43]: Rule 1. Considering the atoms directly attached to the stereocenter, the higher the atomic number the higher priority; Rule 2. If there are two or more atoms with the same atomic number, the method of determination is to perform a similar comparison of the atomic numbers of the next atoms in the ligands until a point of difference is found; Rule 3. If two atoms have the same atomic number but different mass number (isotopes), the atom with higher mass number comes first; Rule 4. Double or triple bonds are counted as if they were split into two or three single bonds, respectively; Rule 5. For compounds where only configurational differences between ligands are detected, the following rules apply: a. When two ligands differ only in that one has an atom of higher rank in a cis-position and the other in a trans-position, then preference is given to the former. Cis and trans double bonds rank higher than nonstereogenic double bonds (cis > trans > nonstereogenic) [44]. b. Chiral stereogenic units precede pseudoasymmetric stereogenic units and these precede nonstereogenic units. c. When considering stereogenic units, if two ligands have different descriptor pairs, then the one with the first like descriptor pair has priority over the one with a corresponding unlike descriptor pair. d. r precedes s (chirality of a pseudoasymmetric carbon). e. R precedes S. Rule 5 is used to compare combinations of chiral units, however, it can lead to ambiguity in the evaluation of pairs of ligands [45-47]. Although new methodologies (e.g [45-47]) have been purposed to overcome this ambiguity, this rule will not be considered in the present version. The lowest priority ligand determined using the CIP rules is then selected as the reference ligand and the molecule should be oriented pointing this group to the back. The line connecting the chiral centre and the lowest priority ligand determines the reference plane. If the path from the higher to the lower priority of the three other ligands goes in the clockwise (right) direction then the chiral centre is described as R (from the Latin rectus for right) otherwise as S (from the Latin sinister for left). As an example, considering 2-amino-3mercaptopropanoic acid (amino acid also known as cysteine with the chemical formula 5 HO2CCH(NH2)CH2SH) shown in Figure 3, the α-carbon (marked with an asterisk) is chiral, and thus this molecule has two mirror-image structures (a) and b)) [48]. mirror H 2 H H S O * clockwise rotation H N 1 H S H 3 H H H O 4 a) (R)-2-amino-3-mercaptopropanoic acid 2 O 3 H * O H H N 1 H H anti-clockwise rotation 4 b) (S)-2-amino-3-mercaptopropanoic acid Figure 3. The two enantiomers (mirror-image structures) of the compound 2-amino-3mercaptopropanoic acid (cysteine). The chiral carbon is marked with an asterisk and the priorities of the substituents indicated inside circles. a) (R)-2-amino-3-mercaptopropanoic acid: the sense of the rotation of the groups with highest priorities 1 to 3 is clockwise hence the R assignment. b) (S)-2-amino-3-mercaptopropanoic acid: the sense of the rotation of the groups with highest priorities 1 to 3 is anti-clockwise hence the S assignment. The representations of 2-amino-3-mercaptopropanoic acid enantiomers are shown in Figure 3 with the priorities of the substituents indicated. The priorities are assigned based on atomic number (Z) of the atoms that are directly attached to the stereocenter and in situations where two or more substituents have the same atomic number, one should proceed along the respective substituent chain until a point of difference is found: nitrogen (Z = 7) > carbon (Z = 6) - sulfur (Z = 16 second level) > carbon (Z = 6) - oxygen (Z = 8 second level) > hydrogen (Z = 1). Allowing hydrogen (lowest priority) to point away from the viewer, in the case of the structure represented in Figure 3 a) the sense of the rotation of the groups 1 to 3 is clockwise (to the right) hence the R assignment while in the case of the structure represented in Figure 3 b) the sense of the rotation of the groups 1 to 3 is anti-clockwise (to the left) hence the S assignment. Chirality can be expressed in the SMILES notation. Depending on the clockwise or anticlockwise ordering of the atoms around the stereocenter it can be identified as "@@" or "@", respectively. The sequence of the atoms in the SMILES solely depends on the order of writing, and it is independent of the priorities of the atoms, therefore there is not a direct correspondence with the R-S system [7, 49, 50]. For example, in the SMILES for (R)-2amino-2-fluoropropanoic acid N[C@](C)(F)C(=O)O (equivalent to F[C@@](N)(C(O)=O)C, C[C@@](N)(F)C(O)=O, among others) - looking from the atom N to the chiral center, the other ligands (methyl (CH3), fluorine (F) and carboxy (COOH)) appear in anti-clockwise order as it is displayed in Figure 4. 6 * Figure 4. The representation of the compound (R)-2-amino-2-fluoropropanoic acid using the SMILES N[C@](C)(F)C(=O)O. In this representation looking from the atom N to the chiral center (marked with an asterisk), the other substituents (methyl (CH3), fluorine (F) and carboxy (COOH)) appear in anti-clockwise order which does not have a direct correspondence with the R-S system since the priorities of the substituents define a clockwise sense of the rotation hence the R assignment. Chirality can also be expressed in the InChI (IUPAC International Chemical Identifier) notation. InChI is a string of characters capable of uniquely representing a molecule and is derived solely from a structural representation of that molecule, structured to be independent of the way that the structure was drawn. Every InChI starts with the string "InChI=" followed by the version number and by the letter S for standard InChIs. The remaining information is structured as a sequence of layers and sub-layers separated by the delimiter "/", with each layer providing one specific type of information (indicated by a prefix letter). In the case of tetrahedral stereochemistry (sub-layer of the stereochemical layer) the prefix letter is a "t" and its information is derived from 'in-out' wedge bond types or x, y, z coordinates. Only explicit stereo information is included and, as in SMILES, there is no simple relation between InChI and R/S configurations of stereocenters since it does not use CIP rules and calculates parities from its own canonical numbers of atoms. The parity is '+' if the canonical numbers of neighbors increase clockwise when observed from the atom that has the smallest canonical number and it is '-' for the inverse case [8]. For example, the InChI for (R)-2-amino-2-fluoropropanoic acid is InChI=1/C3H6FNO2/c13(4,5)2(6)7/h5H2,1H3,(H,6,7)/t3-/m0/s1/i1-12,2-12,3-12,4-19,5-14,6-16,7-16 (tetrahedral stereochemistry sub-layer is marked bold) looking from the ligand with the lowest canonical number, methyl (CH3) (canonical number: 1), to the chiral center (canonical number: 3), the other ligands (carboxy (COOH) (canonical number: 2), fluorine (F) (canonical number: 4) and nitrogen (N) (canonical number: 5)) appear in anti-clockwise order. 2.1 Algorithm to determine chirality The algorithm that determines the chirality of a chemical structure based on widely used linear notations as input such as SMILES or InChI was implemented in python (version 2.6) and uses OpenBabel-Pybel libraries (version 2.3.1) [51-53] which in turn use joelib2[54] for processing chemical structures. To determine the chirality according to the R-S notation several steps are needed, namely: (1) indentify the stereocenters, (2) number the atoms in the molecule skeleton, (3) assign the priority of each ligand according to the CIP rules, (4) map the ligands into the skeleton groups which results in a permutation and finally (5) determine the parity of the permutation which allows the classification of the stereocenter(s) in R or S. 7 The basic steps for describing a stereoisomer implemented in the algorithm are exemplified in Figure 5 for the compound (S)-1-amino-1-bromoethanol and detailed below. List of SMILES representing the same structure Canonical SMILES N[C@](Br)(O)C Br[C@](O)(N)C O[C@](Br)(C)N Br[C@](C)(O)N C[C@](Br)(N)O Br[C@](N)(C)O C[C@@](Br)(O)N Br[C@@](N)(O)C .... C[C@@](Br)(O)N Canonicalization Method Chiral center (@@) is clockwise (1) Numbering the atoms in the skeleton (canonical order) Assigning the priority to each group attached to the stereocenter (CIP rules) 3 1 2 0 0 Mapping the ligands into the skeleton groups (permutation) [CH3, Br, OH, NH2] 3 [Br, OH, NH2, CH3] 2 Determining the classification R-S 1 Initial sense of rotation (1), odd permutation (-1), (1)*(-1) = -1 => S Permutation = [1,2,3,0] [0,1,2,3] [CH3, Br, OH, NH2] [0,1,2,3] [Br, OH, NH2, CH3] Z=[35, 8, 7, 6] Odd Permutation (-1) (S)-1-amino-1bromoethanol Figure 5. Basic steps for classifying a stereoisomer of the compound 1-amino-1-bromoethanol using the described algorithm: the input notation is converted in a canonical SMILES, the initial sense of rotation is determined, at the stereocenter the atoms are then separated into the skeleton and its ligands and skeleton both are numbered independently in order to determine the permutation, finally the stereocenter can be classified as R or S combining the parity of the permutation and the initial sense of rotation. The process of determining chirality of a molecule can be detailed as follows: a. Identifying the chiral centers This computer program processes only molecules with explicit chirality, i.e. carbon atoms with four different groups attached which causes a lack of symmetry and is explicitly described in SMILES with @ or @@. The identification of a chiral center is based on the openbabel's boolean function IsChiral. After identifying the presence of one or more chiral centers, one must classify these chiral centers as clockwise or anti-clockwise. For that purpose, the arbitrary numbering of the atoms has to be canonicalized. The representation of a chemical structure by a linear notation is neither unambiguous (since often more than one structure can be produced from one representation) nor unique (since often several representations can be derived for a structure). A molecule may be, in principle, denoted with n! (n = number of atoms) different SMILES with different numbering of the atoms. The advantage of canonicalization is that it will represent a molecule in a unique order of appearance in the structure dealing with the possibility of symmetry equivalent stereocenters. It is important to note that these canonical SMILES are usually not transferable between implementations because they use different canonicalization algorithms. In this case, the canonicalization method in use is the one implemented by openbabel which is based on the widely used Morgan algorithm[55] but with various improvements [51, 52]. The main part of the Morgan algorithm is the iterative calculation of connectivity indices to enable differentiation of the atoms. At this point, a chiral center is classified as clockwise (1) if the canonical SMILES contains "@@" or anti-clockwise (-1) if the canonical SMILES contains 8 "@". For example, the compound (S)-1-amino-1-bromoethanol can be represented by the canonical SMILES C[C@@](Br)(O)N, therefore the chiral center has a clockwise (“@@”) sense of rotation and is classified as 1 (Figure 5). b. Numbering the atoms in the molecule skeleton Since the atom numbering in canonical SMILES represents the order of appearance in the structure, it can be used to number the atoms in the molecule skeleton attached to the stereocenter starting from the lowest to the highest number and renumbering them to [0, 1, 2, 3]. For the example described in Figure 5, the canonical order (C[C@@](Br)(O)N) determines that 0 corresponds to the group CH3, 1 corresponds to the group Br, 2 corresponds to the group OH and 3 corresponds to the group NH2. c. Assigning the priority to each group attached to the stereocenter The ligands attached to the stereocenter have to be numbered independently from step b and according to the CIP rules. In order to establish the priority sequence, one must look at the atomic number of the atoms that are bonded directly to the stereocenter, arranging them in decreasing order of atomic number or, optionally, atomic mass to take into account isotopes. If two or more atoms bonded directly to the stereocenter have the same atomic number, then look for the first point of difference in the branch by moving out one atom (level) at a time, again comparing atomic numbers/atomic mass. This recursive method also takes into account double or triple bonds (fourth CIP rule), since higher bond orders have a smaller number of hydrogen atoms and vice-versa. For the example described in Figure 5, the group with highest priority is Br since its atomic number is 35, followed by O since its atomic number is 8, N since its atomic number is 7, and finally C since its atomic number is 6. d. Mapping the ligands into the skeleton groups (permutation) The four ligands can be arranged around the stereocenter according to their priority (0-3) in 24 different ways. The 24 permutations of different priorities of the ligands can be grouped into two classes because of the symmetry of a tetrahedron: even and odd. Interchanging ligands starting with the initial order determined in b, until they are in descending order of priority according to the CIP rules determined in c, leads to the classification of the stereoisomer depending on the number of permutations. The permutation representation allows the comparison of the skeleton numbering and the sequence of the ligands. e. Determining the classification R-S using the parity of the permutation In order to determine the parity of the permutation, i.e., whether a given permutation is even (even number of 2 ligands swaps) or odd (odd number of 2 ligands swaps), one of the most efficient methods is to write the permutation as a product of disjoint cycles. A cycle is a permutation which maps a finite subset {x1, x2, ..., xn} by x1->x2->...->xn->x1 and will be 9 denoted (x1 x2 ... xn). For example, a cycle of length 2 is called a transposition and it represents a permutation that swaps two elements and leaves everything else fixed. The cycles of length 1 can be omitted from the cycle list, since they represent a ligand which does not move [56, 57]. A general procedure to calculate the disjoint cycles starts with an element and follows its correspondences under the permutation until it goes back to the starting element again. Until all the elements have been visited, this procedure should be repeated. The permutation is odd if this factorization contains an odd number of even-length cycles, for the remaining situations the permutation is even. In the case of determining the chirality of a molecule (permutation with length 4) the followed approach classifies even permutations as 1 and odd permutations as -1. According to the classification into clockwise of anti-clockwise determined in step a and the parity of the permutation it is now possible to classify the molecule in one of the two classes: R or S. For that purpose one must multiply the indexes of the initial sense of rotation and the parity of the permutation, if the result is 1 the stereocenter is classified as R, otherwise if the result is -1 the stereocenter is classified as S. For the example described in Figure 5, the initial atom order ([CH3, Br, OH, NH2]) go through 3 modifications to be ordered according to the CIP rules ([Br, OH, NH2, CH3]): 0->1->2->3. This permutation can be factorized as (0123) and since it is 1 cycle (odd number of cycles) of 4 elements (even length), the permutation is odd (-1). The initial sense of rotation is 1, multiplied by an odd permutation (-1) obtains -1 and the stereocenter is classified as S. 2.2 Detailed example of the steps of execution of the chirality classification program In order to analyze in a more detailed way the execution of the developed program, another example, R-2-amino-3-mercaptopropanoic acid (already described in Figure 3 and represented again in Figure 6), will be described together with the program’s outcomes in each step. H 11 III II I * Figure 6. The compound R-2-amino-3-mercaptopropanoic acid. The chiral carbon is marked with an asterisk (canonical number, 2) and the canonical numbers of each atom are indicated near each atom symbol. To apply outward exploration of groups, starting from the chiral atom, the atoms are divided in levels, which are indicated in the figure with colored shells: I) level 1, marked with a blue shell, containing the atoms with the 10 canonical numbers 1, 3, 4 and 7; II) level 2, marked with a green shell, containing the atoms with the canonical numbers 5, 6, 8, 9, 10, 12 and 13; III) level 3, marked with a orange shell, containing the atoms with the canonical numbers 11 and 14. The atomic numbers (Z) of the atoms represented in the figure are: sulfur (S) (Z= 16), oxygen (O) (Z = 8), nitrogen (N) (Z = 7), carbon (C) (Z = 6), hydrogen (H) (Z = 1). The canonicalization of this structure generates the following SMILES, N[C@H](C(=O)O)CS, which indicates that this molecule has a chiral center (‘@’) with an anti-clockwise (-1) sense of rotation. Figure 6 represents the structure of R-2-amino-3mercaptopropanoic acid, with the atoms numbered according to the canonical order. Thus, a simple 5-steps process is followed to determine its chiral orientation: 1. A recursive process is used to retrieve the atomic numbers of each atom directly attached to the stereocenter and each branch is traversed recursively. Four lists are created, each of them starting with the atomic number (Z) of the atom directly attached to stereocenter (N (index = 1, Z = 7), H (index = 3, Z = 1), C (index 4, Z = 6), C (index 7, Z = 6)), followed by lists representing a sequential topological distance to the stereocenter (levels) with two-atoms tuples (canonical indexes) indicating the connectivity of each branch: [7, [(1, 9), (1, 10)] [1] [6, [(4, 5), (4, 6)], [(6, 11)]] [6, [(7, 12), (7, 13), (7, 8)], [(8, 14)]] 2. The atoms of each branch are sorted in descending order of their topological distances to the stereocenter (levels) and inside each level in descending order according the atomic numbers. Each branch is represented by a tuple and the connectivity tuples are replaced by lists of atomic numbers (ordered in descending order) of the atoms in each level and the last position of each tuple represents the branch number according to the canonical order (from 0 to 3): ([[7], [1, 1]], 0) ([[1]], 1) ([[6], [8, 8], [1]], 2) ([[6], [16, 1, 1], [1]], 3) 3. The lists are then compared between themselves to retrieve their priority order, as per the CIP rules. This involves solely comparing each list in the four tuples to the others to sort the branches according to their atom content: ([[7], [1, 1]], 0) ([[6], [16, 1, 1], [1]], 3) ([[6], [8, 8], [1]], 2) ([[1]], 1) 11 4. The permutation resulting from the last step, coupled with the canonical order of the branches (last digit of the tuple) can be used to compare the canonical order with the priority order according to the CIP rules using its parity: Permutation: [0, 3, 2, 1], which can be represented as product of disjoint cycles as follows: (13), this factorization contains and odd number (1 cycle) of even-length (2) cycles, consequently the parity of this permutation is odd (- 1). 5. Finally, it is possible to determine the classification in R-S using the initial sense of rotation and the parity of the permutation: Anti-clockwise sense of rotation (-1) * odd permutation (-1) = 1, which corresponds to an R stereocenter. The development of this computer program was guided and tested by calculating chirality to a set of 210 molecules with this type of stereochemistry. The worst-case time complexity of an algorithm gives an idea of the number of operations needed to solve it given any input of size n [58]. In the case of the given computer program, the most complex step is the recursive search for the ligands attached to each stereocenter, in the worst-case scenario for each stereocenter it goes through all atoms in the molecule. The complexity for the worst-case scenario (using the big O notation) of the given step, based on well-established algorithms and their known complexity [59], is O(C*A*log(A)), where C is the number of chiral atoms and A is the number of atoms in the molecule. 3. Identification and Specification of Double Bond Stereoisomerism The geometrical (cis-trans) stereoisomerism arises when substituents are arranged differently in space due to restricted rotation of a double bond in a molecule [10, 12]. The carbon-carbon double bond is formed between two sp2 hybridized carbons, and consists of two occupied molecular orbitals, sigma and pi. Rotation of the end groups of a double bond relative to each other destroys the p-orbital overlap that creates the pi orbital or bond. The pi bond is an high energy bond and therefore, induces a resistance to rotation which stabilizes the planar configuration [14, 15]. In order to be considered a stereo bond, the substituents on either end of the double bond have to be different. To each substituent on a double bond is assigned a priority based on the Cahn-Ingold-Prelog (CIP) priority rules [40, 43] described above and then classified according to the latest IUPAC recommendation [60], the E-Z convention [10, 12]. This convention defines that the substituents with higher priority on each side of the double bond define the reference frame. If the two substituents of higher priority are on opposite sides of the double bond (trans arrangement), then the E (from the German entgegen for opposite) configuration is assigned to the bond. If the two groups of higher priority are on the same side of the double bond (cis arrangement), then the Z (from the German zusammen for together) configuration is assigned to it [10, 12]. As an example, considering the two isomers of 2-chloro-2-butene shown in Figure 9, the stereochemistry of this alkene can be determined by comparing the relative positions of the highest priority groups on the double bond carbons. 12 high priority Z=1 Z =17 H Cl H 3C Z= 6 Z=1 high priority CH 3 Z =6 a) (E)-2-chloro-2-butene H high priority H 3C Z =6 Z =6 CH 3 Cl Z = 17 high priority b) (Z)-2-chloro-2-butene Figure 7. The two stereoisomers of the compound 2-chloro-2-butene. The atomic number and priority of the substituents is indicated. a) (E)-2-chloro-2-butene: the substituents of higher priority are on opposite sides of the double bond hence the E assignment. b) (Z)-2-chloro-2-butene: the substituents of higher priority are on the same side of the double bond hence the Z assignment. Following the procedure to determine the E/Z configuration of the two stereoisomers, the first step consists in determining the higher priority substituent on each end of the double bond based on its atomic number (Z) and which are indicated in the Figure 7: chlorine (Z = 17) > carbon (Z = 6) and carbon (Z = 6) > hydrogen (Z = 1). Starting with the left hand structure (Figure 7 - a)) on the left end of the double bond, the two atoms attached to the double bond are carbon and hydrogen, by the CIP priority rules, carbon has higher priority while on the right end of the double bond, the atoms attached to the double bond are carbon and chlorine, by the CIP priority rules, chlorine has higher priority. The higher priority groups are "down" and "up" respectively, therefore the substituents of higher priority are on opposite sides of the double bond, then the E configuration is assigned to the double bond. In the right hand structure (Figure 7 b)), the substituents of higher priority are on the same side ("down") of the double bond, then the Z configuration is assigned to the double bond. Stereoisomerism can be expressed in the SMILES notation. The configuration of the atoms around double bonds is specified by the characters forward slash ("/") and back slash ("\"). These symbols represent the relative direction of the bond between two atoms, i.e., bonds that point above or below the carbon that forms the double bond. For example, the SMILES F/C=C/Br means that the fluorine (F) atom is below the first carbon, and the bromine (Br) atom is above the second carbon, leading to the interpretation of an E (trans) configuration. The interpretation of each directional bond is relative to the carbon atom that forms the double bond, so the sense of the symbol changes according to the order of writing, for example the compound (E)-1,2-difluoroethene may be written as F/C=C/F or C(\F)=C/F. The sequence of the atoms in the SMILES solely depends on the order of writing, and it is independent of the priorities of the atoms, therefore there is not a direct correspondence with the E/Z convention [7, 49, 50]. Stereoisomerism can also be expressed in the InChI (IUPAC International Chemical Identifier) notation presented above. The specific case of double bond stereoisomerism is encoded in the "/b" sub-layer of the stereochemical layer and its information is derived from 13 the 2D (x, y) coordinates. Only explicit stereo information is included and as in SMILES, there is no simple relation between InChI and E/Z configurations since it does not represent CIP rules [8]. 3.1 Algorithm to determine double bond stereoisomerism The computer program that determines the double bond stereoisomerism (E/Z) of a chemical structure based on widely used linear notations as input such as SMILES or InChI was implemented in python (version 2.6) and uses OpenBabel-Pybel libraries (version 2.3.1) [5153] which in turn use joelib2 [54] for processing chemical structures. To determine the double bond stereoisomerism according to the E/Z notation several steps are needed, namely: indentify a double bond between two carbon atoms, verify if the substituents on either end of the double bond are different, and assign the priority of each substituent on either end of the double bond according to the CIP rules. As final step in the procedure, compare the 2D coordinates of the substituents on either end of the double bond in order to determine if the substituents of higher priority are on the same or opposite sides of the double bond which allows the classification in Z or E, respectively. The basic steps for describing a stereoisomer implemented in the algorithm are exemplified in Figure 8 for the compound (Z)-2-fluoro-3-methylpent-2-ene and detailed below. List of SMILES representing the same structure C/C(F)=C(C)/CC CC/C(=C(\F)/C)/C F\C(C)=C(/CC)C ..... Canonical SMILES Identifying a double bond and verifying if the substituents on each end of the double bond are different F 1 Assigning the priority to each group attached to the double bond (CIP rules) F CC/C(=C(\F)/C)/C 1 y’ = -0.866 y’ = 0.866 F 2 1 double bond Left side: [CH2-CH3, CH3] Right side: [F, CH3] Determining the classification E-Z Higher priority groups are UP: (1) = (1) => Z y’= -1.732 y’=-9.999*10-5 2 Canonicalization Method Comparing y’ coordinates of the substituents after rotating the molecule Left side: Z = [6, 1] Right side: Z = [9, 6] Left side: y’(Z=6)>y’(Z=1) Right side: y’(Z=9) > y’(Z=6) (Z)-2-fluoro-3methylpent-2-ene Figure 8. Basic steps for classifying a stereoisomer of the compound 2-fluoro-3-methylpent-2-ene using the described algorithm: the input notation is converted in a canonical SMILES, the presence of a double bond and the substituents on each end of the double bond are verified, the priority of the substituents attached to each end of the double bond is determined according to the CIP rules, finally the double bond can be classified as E or Z comparing the y coordinates of the substituents of higher priority after rotating the molecule. In this case, the highest-priority groups on each side of the double bond are on the same side of the double bond. Fluorine is the highest priority group on the right side of the double bond, and ethyl is the highest-priority group on the left side of the molecule. This molecule can be classified as Z and the proper name is (Z)-2-fluoro-3-methylpent-2ene. 14 The process of determining double bond stereoisomerism of a molecule can be detailed as follows: a. Identifying double bonds between two carbon atoms and verifying whether the substituents on either end of the double bond are different This computer program processes only molecules with double bond(s) between carbon atoms. The identification of a double bond is based on openbabel's boolean functions IsDouble and aromatic bonds are excluded using the function IsAromatic. The identification of the atoms forming the double bond is based on openbabel's boolean function IsCarbon. After identifying the presence of one or more double bonds between two carbon atoms, one must verify if the substituents on either end of the double bond are different. For that purpose, the arbitrary numbering of the atoms has to be canonicalized, as mentioned above. The canonicalization method in use is the one implemented by openbabel which is based in the widely used Morgan algorithm[55] but with various improvements [51, 52]. For example, the compound (Z)-2-fluoro-3-methylpent-2-ene can be represented by the canonical SMILES CC/C(=C(\F)/C)/C, and the structure has 1 double bond (=) with different substituents on either end of the double bond: one end has the substituents CH2-CH3 and CH3 and the other end has the substituents F and CH3 (Figure 8). b. Assigning the priority to each substituent attached to each end of the double bond The substituents attached to each end of the double bond have to be numbered according to the CIP rules (detailed above) in order to determine the higher priority group. To establish the priority sequence, one must look at the atomic number of the atoms that are bonded directly to each carbon forming the double bond, arranging them in order of decreasing atomic number or, optionally, atomic mass to take into account isotopes. If two or more atoms bonded directly to the carbon atom forming the double bond have the same atomic number, then look for the first point of difference in the branch by moving out one atom (level) at a time, again comparing atomic numbers/atomic mass. This recursive method also takes into account double or triple bonds (fourth CIP rule), since higher bond orders have a smaller number of hydrogen atoms and vice-versa. For the example described in Figure 8, on one end of the double bond the group with higher priority is the CH2 since the atomic number of carbon is 6, and on the other side the group with higher priority is the fluorine (F) since its atomic number is 9. c. Compare the 2D coordinates of the substituents on either end of the double bond Having determined which two ligands, attached to the atoms connected by a double bond, are to be compared (higher priority), one has to calculate their relative location in relation to each other. For that purpose, one can use cartesian (x, y) structure coordinates generated from any type of molecular data structures with connectivity information. Open Babel [51, 52], version 2.3, has support for 2D coordinate generation based on the code used in the MCDL chemical 15 structure editor [16, 61, 62]. The MCDL computer program aims to layout the molecular structure in 2D such that all bond lengths are equal. The success rate for aesthetically ideal structure layout is high, and many difficult classes of organic molecules can be depicted with confidence. Sometimes these 2D projection images have distorted (non-optimal) bond lengths and angles of structural fragments. The crucial danger, however, while processing geometrical stereoisomers comes from the fact that the reference plane can be chosen arbitrarily, and therefore, there exist different possible ways of displaying the molecule in the 2D plane. In order to find out the position of each substituent in relation to each other the 2D coordinates can be used, but since the orientation of the molecule is different in each case, one should rotate the molecule in the plane in relation to fixed axes [63, 64]. For that purpose, the first step should be the determination of the angle of rotation relative to having the double bond in an horizontal position (Equation 1). The calculation of the angle of rotation ( ) is based on the arc tangent function of the slope of the line formed by the double bond in relation to the horizontal line, that is determined using the coordinates of the two carbon atoms forming the double bond ((x0, y0), (x1, y1)). = (1) A vertical line has an undefined slope and therefore this case will be determined using another procedure, explained below. To rotate the molecule anti-clockwise around the origin by is equivalent to replacing every point with coordinates (x,y) by the point with coordinates (x',y'), where: ′ = ′ − ⇔ = = − + (2) Similarly, for a clockwise rotation around the origin by : ′ = ′ − ⇔ = =− + + (3) It is also possible to use the equation (2) for clockwise rotation using the opposite angle (- ). If the slope of the line formed by the double bond is negative, the molecule should be rotated anti-clockwise and therefore one should use equation (2). If the slope of the line formed by the double bond is positive, the molecule should be rotated clockwise and therefore one should use equation (3) or (2) with = − . Using the rotated coordinates (x', y') is now possible to determine the substituents position in relation to each other, comparing the y' coordinates. The substituent with higher y' is up (the value 1 is assigned) while the substituent with lower y' is down (the value -1 is assigned). For the molecules with vertical orientation (undefined slope) the procedure can be simplified to the comparison of the un-rotated x coordinates. The substituent with higher x is up (the value 1 is assigned) while the substituent with lower x is down (the value -1 is assigned). 16 Comparing the y' coordinates of the substituents on each side of the double bond for the rotated structure represented in Figure 8, leads to the conclusion that the substituents of higher priority have higher y' and therefore both are classified as 1. d. Determining the classification E-Z using the 2D coordinates According to the comparison of 2D coordinates of the substituents on either end of the double bond determined in c and comparing the two sides of the double bond, if the two groups with the higher priorities are on the same side of the double bond ((-1)(-1) or (1)(1)), that is described as a Z-double bond (the value 1 is assigned) otherwise if the two groups with the higher priorities are on opposite sides of the double bond ((-1)(1) or (1)(-1)), that is described as a E-double bond (the value -1 is assigned). For the example described in Figure 8, the substituents of higher priority were both classified as 1, hence the double bond is described as Z. 3.2 Detailed example of the steps of execution of the double bond stereoisomerism classification program In order to analyze in a more detailed way the execution of the developed program, another example, (Z)-1-bromo-3-(chloromethyl)-6-methyl-4-propylhept-3-ene (Figure 9), will be described together with the program’s outcomes in each step. III II I * Figure 9. The compound (Z)-1-bromo-3-(chloromethyl)-6-methyl-4-propylhept-3-ene (CCC/C(=C(\CCBr)/CCl)/CC(C)C). The double bond is marked with an asterisk (between the carbon atoms with canonical numbers 4 and 5) and the canonical numbers of each atom are indicated near each atom symbol. The hydrogen atoms were made implicit for readability purposes (canonical numbers between 15 and 36). To apply outward exploration of groups, starting from the carbon atoms forming the double bond, the atoms are divided in levels, which are indicated in the figure with colored shells: I) level 1, marked with a blue shell, containing the atoms with the canonical numbers 3, 6, 11 and 9; II) level 2, marked with a green shell, containing the atoms with the canonical numbers 2, 7, 10 and 12 and the non-represented hydrogen atoms 20, 17 21, 22, 23, 26, 27, 28 and 29; III) level 3, marked with a orange shell, containing the atoms with the canonical numbers 1, 8, 13 and 14 and the non-represented hydrogen atoms 18, 19, 24, 25 and 30; IV) level 4, not represented in the figure, containing the non-represented hydrogen atoms 15, 16, 17, 31, 32, 33, 34, 35 and 36. The atomic numbers (Z) of the atoms represented in the figure are: bromine (Br) (Z = 35), chlorine (Cl) (Z = 17), carbon (C) (Z = 6), hydrogen (H) (Z = 1). The canonicalization of this structure generates the following SMILES, CCC/C(=C(\CCBr)/CCl)/CC(C)C. Figure 9 represents the structure of (Z)-1-bromo-3(chloromethyl)-6-methyl-4-propylhept-3-ene with implicit hydrogen atoms for readability purposes (canonical numbers between 15 and 36) and the represented atoms numbered according to the canonical order. Thus, a simple 6-steps process is followed to determine its double bond stereosiomerism: 1. After identifying that the compound has at least one double bond (that is not aromatic) using openbabel, it is converted to a 2D MDL MOLFile using openbabel or Marvin molconverter to make available 2D coordinates of its atoms (Figure 10). a) OpenBabel10291214122D 36 35 0 0 0 0 0 -4.0000 -0.0000 -4.5000 -0.8660 -4.0000 -1.7321 -3.0000 -1.7321 -2.5000 -2.5981 -3.0000 -3.4641 -4.0000 -3.4641 -4.8660 -3.9641 -1.5000 -2.5981 -0.6340 -3.0981 -2.5000 -0.8660 -1.5000 -0.8660 -1.5000 0.1340 -0.5000 -0.8660 -4.0000 1.0000 -4.8660 0.5000 -3.0000 -0.0000 -5.3660 -1.3660 -5.3660 -0.3660 -4.0000 -2.7321 -4.8660 -2.2321 -3.0000 -4.4641 -2.1340 -3.9641 -4.0000 -4.4641 -4.5000 -2.5981 -1.5000 -3.5981 -1.0000 -1.7321 -2.5000 0.1340 -3.3660 -0.3660 -1.5000 -1.8660 -1.0000 1.0000 -0.5000 0.1340 -2.3660 0.6340 0.3660 -1.3660 -0.5000 -1.8660 0.0000 0.0000 0 0 0999 V2000 0.0000 C 0 0 0.0000 C 0 0 0.0000 C 0 0 0.0000 C 0 0 0.0000 C 0 0 0.0000 C 0 0 0.0000 C 0 0 0.0000 Br 0 0 0.0000 C 0 0 0.0000 Cl 0 0 0.0000 C 0 0 0.0000 C 0 0 0.0000 C 0 0 0.0000 C 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 0.0000 H 0 0 b) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 2 2 2 3 3 3 4 4 5 5 6 6 6 7 7 7 9 9 9 11 11 11 12 12 12 13 13 13 14 14 14 M 2 15 16 17 3 18 19 4 20 21 5 11 6 9 7 22 23 8 24 25 10 26 27 12 28 29 13 14 30 31 32 33 34 35 36 END 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Figure 10. 2D MDL MOLFile for the compound (Z)-1-bromo-3-(chloromethyl)-6-methyl-4-propylhept-3ene generated by openbabel: a) 2D coordinates of the atoms in the molecule; b) connection table of the atoms in the molecule and corresponding type of bonds. 2. A recursive process is used to retrieve the atomic numbers of each atom directly attached to each end of the double bond and each branch is traversed recursively. Four lists are created (two starting from each carbon of the double bond), each of them starting with the atomic number (Z) of the atom directly attached to the carbon atoms forming the double bond (all carbons (C) (indexes = 3, 11, 6, 9 , Z = 6), followed by lists representing a sequential topological distance to the carbon atom forming the double bond (levels) with two-atoms tuples (canonical indexes) indicating the connectivity of each branch: 18 Branches starting from the carbon of the double bond with canonical number 4: [6, [(3, 20), (3, 2), (3, 21)], [(2, 1), (2, 18), (2, 19)], [(1, 17), (1, 15), (1, 16)]] [6, [(11, 12), (11, 28), (11, 29)], [(12, 13), (12, 14), (12, 30)], [(13, 33), (13, 31), (13, 32), (14, 34), (14, 35), (14, 36)]] Branches starting from the carbon of the double bond with canonical number 5: [6, [(6, 23), (6, 22), (6, 7)], [(7, 25), (7, 24), (7, 8)]] [6, [(9, 10), (9, 27), (9, 26)]] 3. The atoms of each branch are sorted in descending order of their topological distances to the carbon of the double bond (levels) and inside each level in descending order according the atomic numbers. Each branch is represented by a tuple and the connectivity tuples are replaced by lists of atomic numbers (ordered in descending order) of the atoms in each level and the last position of each tuple represents the branch number on each side of the double bond, according to the canonical order (0 or 1): Branches starting from the carbon of the double bond with canonical number 4: ([[6], [6, 1, 1], [6, 1, 1], [1, 1, 1]], 0) ([[6], [6, 1, 1], [6, 6, 1], [1, 1, 1, 1, 1, 1]], 1) Branches starting from the carbon of the double bond with canonical number 5: ([[6], [6, 1, 1], [35, 1, 1]], 0) ([[6], [17, 1, 1]], 1) 4. The lists on each side of the double bond are then compared between themselves, if they are equal then the branches are the same and there is no double bond stereoisomerism, else the procedure continues to retrieve their priority order, as per the CIP rules. This involves solely comparing each list in the two tuples on each side of the double bond to the others to sort the branches according to their atom content: Branches starting from the carbon of the double bond with canonical number 4: ([[6], [6, 1, 1], [6, 6, 1], [1, 1, 1, 1, 1, 1]], 1) ([[6], [6, 1, 1], [6, 1, 1], [1, 1, 1]], 0) Branches starting from the carbon of the double bond with canonical number 5: ([[6], [17, 1, 1]], 1) ([[6], [6, 1, 1], [35, 1, 1]], 0) 5. The first branch of each list (two sides of the double bond) is the higher priority one, now it is needed to determinate their location in relation to each other. For that purpose several sub-steps are needed: 19 a. Calculate the slope of the double bond (using the carbon atoms (x, y) coordinates: Carbon with canonical number 4: (x, y) = (-3.0, -1.732) Carbon with canonical number 5: (x, y) = (-2.5, -2.598) Slope of the double bond: -1.732 b. Calculate the angle of rotation in radians (θ) based on the slope of the double bond: θ = -1.0472 c. The slope of the double bond is negative, thus the molecule should be rotated anti-clockwise. Using the coordinates (x, y) of each group directly attached to the carbon atoms forming the double bond, calculate the rotated coordinates. The y rotated coordinates (y’) should be used to compare the position of the branches in each side of the double bond. The first branch on each side of the double bond is the higher priority one. Branches starting from the carbon of the double bond with canonical number 4: atom 11 (x, y) = (-2.5, -0.866)  y’ (atom 11) = 1.732 atom 3 (x, y) = (-4.0, -1.732)  y’ (atom 3) = 2.598 The y’ coordinate of the first atom (canonical number 11) is lower than the y’ coordinate of the second (canonical number 3), therefore the higher priority group is down and the value -1 is assigned. Branches starting from the carbon of the double bond with canonical number 5: atom 9 (x, y) = (-1.5, -2.598) y’ (atom 9) = -5.000 * 10-5 atom 6 (x, y) = (-3.0, -3.464)  y’ (atom 6) = 0.866 The y’ coordinate of the first atom (canonical number 9) is lower than the y’ coordinate of the second (canonical number 6), therefore the higher priority group is down and the value -1 is assigned. 6. Finally, it is possible to determine the classification in E-Z based on the relative position of the high priority substituents directly attached to each side of the double bond: branch of higher priority connected to the carbon 4 is down (-1) * branch of higher priority connected to the carbon 5 is down (-1) = 1, which corresponds to a Z-double bond (1). 20 The worst-case time complexity of an algorithm gives an idea of the number of operations needed to solve it given any input of size n [58]. In the case of the given computer program, the most complex algorithm is the recursive search for the ligands attached to each double bond, in the worst-case scenario for each double bond it goes through all atoms in the molecule. The complexity for the worst-case scenario (using the big O notation) of the given algorithm, based on well-established algorithms and their known complexity [59], is O(D*A*log(A)), where D is the number of double bonds and A is the number of atoms in the molecule. The development of this computer program was guided and tested by calculating stereoisomerism around double bonds to a set of 220 molecules with this type of stereochemistry. For this set, there were 2 failures in the correct stereoisomerism classification: (E,E,Z)-1,5,9-Cyclododecatriene and [16]Annulene. It was further verified that for the first compound ((E,E,Z)-1,5,9-Cyclododecatriene) the problem was in the openbabel’s canonicalization, since stereochemical information is lost during this process as shown in Figure 11. The exact same problem was found for another 1,5,9-Cyclododecatriene stereoisomer, the (E,E,E)-1,5,9-Cyclododecatriene, its original SMILES C1=C/CC/C=C/CC/C=C/CC/1 is canonicalized in C1CC=CCCC=CCCC=C1, nevertheless the output classification is correct, because the coordinates thus allow. Openbabel’s implementation of the canonical algorithm was tested using more than 5 millions of molecules in the eMolecules [65] catalog (which does not contain the stereoisomers of 1,5,9Cyclododecatriene) and it produced less than 0.001% errors, thus this implementation performance can be considered good [51]. H H H H H H (E) H (Z) H H H H H H H H H (?) H (E) H H H H H H H a) C1=C/CC/C=C/CC/C=C\CC/1 H H Canonicalization H H H (?) H (?) H H H H H H b) C1CC=CCCC=CCCC=C1 Figure 11. Canonicalization of the SMILES for the compound (E,E,Z)-1,5,9-Cyclododecatriene using openbabel: a) represents the molecular structure using the original SMILES; b) represents the molecular structure using the canonical SMILES. For the compound [16]Annulene the problem is different, the 2D coordinates of the hydrogen atoms are not correct whereas, many of them have exactly the same location in the plane causing an incorrect classification of E-Z stereoisomerism. The same SMILES was used to generate the 2D coordinates using a command line tool, molconverter, provided by another software package, Marvin Beans[18], and the obtained coordinates allow a correct 21 classification of the E-Z stereoisomerism. Therefore, it was included an optional parameter in the program that allows the user to select the implementation that will generate the 2D coordinates: openbabel or molconverter - Marvin Beans. 4. Web Tool With the developed algorithm, a public and free Web tool (Chirality and Double Bond Stereoisomerism Calculator) has been implemented. The objective was to produce an application simple to use with easily readable results that would allow the determination of chirality and double bond stereoisomerism for a list of molecules. The user can input a list of molecules using their common name, SMILES string, or InChI identifier. The common name is resolved using the Chemical Identifier Resolver (http://cactus.nci.nih.gov/chemical/structure), directly called by the application. The output produced consists in the identifiers of the molecule, a graphical representation of the molecule with the canonical numeration of atoms (generated using openbabel) and the algorithm output: the position of the stereocenters or double bonds with stereosiomerism and its classification according to the CIP rules (Figure 12). Figure 12. Chirality and Double Bond Stereoisomerism Calculator (http://nams.lasige.di.fc.ul.pt/tools.php) example, showing the output for running a sample list of molecules. 22 This Web tool was mainly developed in the PHP programming language. The application communicates with a Python script that uses openbabel for converting the different representations of the molecule and determining the chirality and double bond stereoisomerism of each structure according with the described algorithm. The Chirality and Double Bond at http://nams.lasige.di.fc.ul.pt/tools.php Stereoisomerism Calculator is available 5. Summary This section provides a brief summary of the full report with an emphasis on the report’s major findings, recommendations, and conclusions.  The algorithm described in this report deals with the automatic detection and classification of stereoisomers: stereochemistry of a chiral carbon atom and stereochemistry of a double bond.  The purpose of this work was to provide a binary classification of the isomer type according to CIP rules while using as input widely used line notations such as SMILES or InChI, in order to be able to compare molecules taking this point into account.  Most of the existing software packages are proprietary and/or commercial, and they do not allow batch processing of molecules encoded as line representations such as SMILES or InChI. Therefore it was not possible to perform a comparative study in terms of efficiency and complexity.  The algorithm was successfully tested on a sample of 3000 compounds of which 210 contain explicit information concerning chirality and 220 have explicit information about double bond stereoisomerism. The issues found were described and addressed.  Future developments in the algorithm intend to include the detection and classification of other types of stereochemistry and the fifth CIP rule. Acknowledgements ALT gratefully acknowledges Fundação para a Ciência e a Tecnologia for a doctoral grant (SFRH/BD/64487/2009). 23 Bibliography 1. Gasteiger J (2003): Handbook of Chemoinformatics: From Data to Knowledge. Weinheim: Wiley-VCH. 2. Bajorath J, Ed. (2004): Chemoinformatics: Concepts, Methods, and Tools for Drug Discovery. Totawa, NJ: Humana Press. 3. Balaban AT (1991): Enumeration of isomers. In Chemical Graph Theory: Introduction and Fundamentals. Edited by Bonchev D, Rouvray DH. New York: Abacus Press-Gordon and Breach; 177−234 4. Gasteiger J, Engel T (2003): Chemoinformatics: a textbook. Wiley-VCH. 5. Leach AR, Gillet VJ (2007): An Introduction to Chemoinformatics. Springer. 6. Bonchev D, Rouvray DH (1991): Chemical Graph Theory: Introduction and Fundamentals. Abacus Press. 7. Weininger D (1988): SMILES, a Chemical Language and Information System .1. Introduction to Methodology and Encoding Rules. Journal of Chemical Information and Computer Sciences, 28:31–36. 8. McNaught A (2006): The IUPAC International Chemical Identifier:InChl. Chemistry International (IUPAC), 28. 9. Hemmer MC (2007): Dealing with Chemical Information. In Expert Systems in Chemistry Research. Edited by Hemmer MC: CRC Press; 61-118 10. Mislow K, Siegel J (1984): Stereoisomerism and local chirality. Journal of the American Chemical Society, 106:3319-3328. 11. Balaban AT (1997): From Chemical Topology to Three-Dimensional Geometry. Plenum Press. 12. Nasipuri D (1994): Stereochemistry of Organic Compounds: Principles and Applications. Wiley Eastern. 13. Gugisch R, Rücker C (2009): Unified Generation of Conformations, Conformers, and Stereoisomers: A Discrete Mathematics-Based Approach. MATCH Commun Math Comput Chem, 61:117-148. 14. Islam MR, Mahdi JG, Bowen ID (1997): Pharmacological importance of stereochemical resolution of enantiomeric drugs. Drug safety : an international journal of medical toxicology and drug experience, 17:149-165. 15. Foye WO, Lemke TL, Williams DA (2007): Foye's Principles of Medicinal Chemistry. Lippincott Williams & Wilkins. 16. Gakh A, Burnett M, Trepalin S, Yarkov A (2011): Modular Chemical Descriptor Language (MCDL): Stereochemical modules. Journal of Cheminformatics, 3:5. 17. Mills N (2006): ChemDraw Ultra 10.0 CambridgeSoft, 100 CambridgePark Drive, Cambridge, MA 02140. www.cambridgesoft.com. Journal of the American Chemical Society, 128:13649-13650. 18. ChemAxon Marvin Beans [http://www.chemaxon.com/marvin/sketch/index.php] 19. ACD/Labs ACD/ChemSketch Freeware [http://www.acdlabs.com/resources/freeware/chemsketch/] 20. Benecke C, Grund R, Hohberger R, Kerber A, Laue R, Wieland T (1995): MOLGEN, a generator of connectivity isomers and stereoisomers for molecular structure elucidation. Analytica Chimica Acta, 314:141-147. 21. Chen IJ, Foloppe N (2008): Conformational Sampling of Druglike Molecules with MOE and Catalyst: Implications for Pharmacophore Modeling and Virtual Screening. Journal of Chemical Information and Modeling, 48:1773-1791. 22. Ebejer J-P, Morris GM, Deane CM (2012): Freely Available Conformer Generation Methods: How Good Are They? Journal of Chemical Information and Modeling, 52:1146-1158. 23. Gray NAB, Gray NAB (1986): Computer-assisted structure elucidation. New York [etc.]: John Wiley. 24. Sadowski J, Gasteiger J, Klebe G (1994): Comparison of Automatic Three-Dimensional Model Builders Using 639 X-Ray Structures. J Chem Inf Comput Sci:1000−1008. 25. Pearlman R (1987): Rapid Generation of High Quality Approximate 3-dimension Molecular Structures. Chem Des Auto News, 2. 26. Hawkins PCD, Skillman AG, Warren GL, Ellingson BA, Stahl MT (2010): Conformer Generation with OMEGA: Algorithm and Validation Using High Quality Structures from the Protein Databank and Cambridge Structural Database. Journal of Chemical Information and Modeling, 50:572-584. 27. Chemical Computing Group MOE [ http://www.chemcomp.com] 28. Accelrys Inc. Catalyst [http://www.accelrys.com] 29. ChemAxon Stereoisomers [http://www.chemaxon.com/products/calculator-plugins/stereoisomer/] 24 30. Leite TB, Gomes D, Miteva MA, Chomilier J, Villoutreix BO, Tufféry P (2007): Frog: a FRee Online druG 3D conformation generator. Nucleic Acids Research, 35:W568-W572. 31. Miteva MA, Guyon F, Tufféry P (2010): Frog2: Efficient 3D conformation ensemble generator for small compounds. Nucleic Acids Research, 38:W622-W627. 32. Hanessian S, Franco J, Gagnon G, Laramee D, Larouche B (1990): Computer-Assisted Analysis and Perception of Stereochemical Features in Organic Molecules Using the CHIRON Program. J Chem Inf Comput Sci, 30:413-425. 33. Mata P, Lobo AM, Marshall C, Johnson AP (1994): Implementation of the Cahn-Ingold-Prelog System for Stereochemical Perception in the LHASA Program. J Chem Inf Comput Sci, 34:491-504. 34. Zhang Q-Y, Aires-de-Sousa J (2006): Physicochemical Stereodescriptors of Atomic Chiral Centers. Journal of Chemical Information and Modeling, 46:2278-2287. 35. Kovatcheva A, Golbraikh A, Oloff S, Feng J, Zheng W, Tropsha A (2005): QSAR Modeling of Datasets with Enantioselective Compounds using Chirality Sensitive Molecular Descriptors. SAR and QSAR in Environmental Research, 16:93-102. 36. Schultz HP, Schultz EB, Schultz TP (1995): Topological Organic Chemistry. 9. Graph Theory and Molecular Topological Indices of Stereoisomeric Organic Compounds. Journal of Chemical Information and Computer Sciences, 35:864-870. 37. Natarajan R, Basak SC, Neumann TS (2007): Novel Approach for the Numerical Characterization of Molecular Chirality. Journal of Chemical Information and Modeling, 47:771-775. 38. Golbraikh A, Bonchev D, Tropsha A (2001): Novel Chirality Descriptors Derived from Molecular Topology. Journal of Chemical Information and Computer Sciences, 41:147-158. 39. Aires-de-Sousa J, Gasteiger J (2001): New Description of Molecular Chirality and Its Application to the Prediction of the Preferred Enantiomer in Stereoselective Reactions. Journal of Chemical Information and Computer Sciences, 41:369-375. 40. Cahn RS, Ingold C, Prelog V (1966): Specification of Molecular Chirality. Angewandte Chemie International Edition in English, 5:385-415. 41. Cahn RS (1964): An introduction to the sequence rule: A system for the specification of absolute configuration. Journal of Chemical Education, 41:116. 42. Fischer E (1891): Ueber die Configuration des Traubenzuckers und seiner Isomeren. Berichte der deutschen chemischen Gesellschaft, 24:1836-1845. 43. Prelog V, Helmchen G (1982): Basic Principles of the CIP-System and Proposals for a Revision. Angewandte Chemie International Edition in English, 21:567-583. 44. Mata P, Lobo AM, Marshall C, Johnson AP (1993): The CIP Sequence Rules: Analysis and Proposal for a Revision. Tetrahedron Asymmetry, 4. 45. Mata P, Lobo AM (2005): The Cahn, Ingold and Prelog System: eliminating ambiguity in the comparison of diastereomorphic and enantiomorphic ligands. Tetrahedron: Asymmetry, 16:2215-2223. 46. Custer RH Mathematical Statements about the Revised CIP-System. Match, 21:3-31. 47. Hirschmann H, Hanson KR (1974): Prochiral and pseudoasymmetric centers: Implications of recent definitions. Tetrahedron, 30:3649-3656. 48. Lide DR (2010): CRC Handbook of Chemistry and Physics. 90th (CD-ROM Version) edn. Boca Raton, FL: CRC Press/Taylor and Francis. 49. Weininger D, Weininger A, Weininger JL (1989): SMILES 2. Algorithm for generation of unique SMILES notation. Journal of Chemical Information and Computer Sciences, 29:97–101. 50. James CA, Weininger D, Delany J (2011): Daylight Theory Manual - version 4.9. In Book Daylight Theory Manual - version 4.9 (Editor ed.^eds.). City: Daylight Chemical Information Systems, Inc. 51. O'Boyle N, Banck M, James C, Morley C, Vandermeersch T, Hutchison G (2011): Open Babel: An open chemical toolbox. Journal of Cheminformatics, 3:33. 52. Open Babel: The Open Source Chemistry Toolbox, Version 2.3.0; 2011. [http://www.openbabel.org]. 53. O'Boyle NM, Morley C, Hutchison GR (2008): Pybel: a Python wrapper for the OpenBabel cheminformatics toolkit. Chem Cent J, 2. 54. Guha R, Howard MT, Hutchison GR, Murray-Rust P, Rzepa H, Steinbeck C, Wegner JK, Willighagen EL (2006): The Blue Obelisk-Interoperability in Chemical Informatics. J Chem Inf Model, 46:991–998. 25 55. Morgan HL (1965): The Generation of a Unique Machine Description for Chemical Structures-A Technique Developed at Chemical Abstracts Service. Journal of Chemical Documentation, 5:107-113. 56. Weisstein EW Permutation Cycle [http://mathworld.wolfram.com/PermutationCycle.html ] 57. Greenleaf FP (2008): Algebra I: Section 5. Permutation Groups [http://www.cims.nyu.edu/~naor/homepage%20files/permutation.pdf] 58. Papadimitrou CH (2003): Computational Complexity. In Book Computational Complexity (Editor ed.^eds.), 4th edition. pp. 260-265. City: John Wiley and Sons:260-265. 59. Cormen TH, Leiserson CE, Rivest RL, Stein C (2009): Introduction to Algorithms, Third Edition. MIT Press. 60. Panico R, Powell WH, Richer JC (1993): A Guide to IUPAC Nomenclature of Organic Compounds. IUPAC/Blackwell Science. 61. Trepalin S, Yarkov A, Pletnev I, Gakh A (2006): A Java Chemical Structure Editor Supporting the Modular Chemical Descriptor Language (MCDL). Molecules, 11:219-231. 62. Gakh AA, Burnett MN (2001): Modular Chemical Descriptor Language (MCDL): Composition, Connectivity, and Supplementary Modules. Journal of Chemical Information and Computer Sciences, 41:1494-1499. 63. Baker A (2002): Matrix Groups: An Introduction to Lie Group Theory. Springer. 64. Weisstein EW (2012): Rotation Matrix [http://mathworld.wolfram.com/RotationMatrix.html ] 65. eMolecules; eMolecules, Inc. [http://www.emolecules.com/]. 26
5cs.CE
Dr.sc.comp. Vilnis Liepiņš Email: [email protected] Extended Fourier analysis of signals Abstract. This summary of the doctoral thesis [8] is created to emphasize the close connection of the proposed spectral analysis method with the Discrete Fourier Transform (DFT), the most extensively studied and frequently used approach in the history of signal processing. It is shown that in a typical application case, where uniform data readings are transformed to the same number of uniformly spaced frequencies, the results of the classical DFT and proposed approach coincide. The difference in performance appears when the length of the DFT is selected greater than the length of the data. The DFT solves the unknown data problem by padding readings with zeros up to the length of the DFT, while the proposed Extended DFT (EDFT) deals with this situation in a different way, it uses the Fourier integral transform as a target and optimizes the transform basis in the extended frequency range without putting such restrictions on the time domain. Consequently, the Inverse DFT (IDFT) applied to the result of EDFT returns not only known readings, but also the extrapolated data, where classical DFT is able to give back just zeros, and higher resolution are achieved at frequencies where the data has been successfully extended. It has been demonstrated that EDFT able to process data with missing readings or gaps inside or even nonuniformly distributed data. Thus, EDFT significantly extends the usability of the DFT based methods, where previously these approaches have been considered as not applicable [10-43]. The EDFT founds the solution in an iterative way and requires repeated calculations to get the adaptive basis, and this makes it numerical complexity much higher compared to DFT. This disadvantage was a serious problem in the 1990s, when the method has been proposed. Fortunately, since then the power of computers has increased so much that nowadays EDFT application could be considered as a real alternative. 1 Introduction A Fourier transform is a powerful tool for signal analysis and representation of a real or complexvalued function of time x(t) (hereinafter referred to as the signal) in the frequency domain F ( )    x(t )e  jt dt , (1.1)   1 F ( ) e jt d . (1.2)  2  The Fourier transforms orthogonality property provide a basis for the signal selective frequency analysis x(t ) =  e j 0t  jt e dt  2 (  0 ) , (2)  where , 0 are cyclic frequencies and (-0) is the Dirac delta function. Unfortunately, the Fourier transforms calculation according to (1.1) requiring knowledge of the signal x(t) as well as performing of integration operation in the infinite time interval. Therefore, for practical evaluation of (1.1) numerically, the signal observation period and the interval of integration is always limited by some finite value , -/2≤t≤/2. The same applies to the Fourier analysis of the signal x(t) sampled versions - nonuniformly sampled signal x(tk) or uniformly sampled signal x(kT), k=-,…,-1,0,1,…,+. Only a finite length sequence x(tk) or x(kT), k=0,1,2,…,K-1, are subject of Fourier analysis, where K is a discrete sequence length, T is sampling period, and the signal observation period is equal to =tK-1-t0 or =KT. To avoid aliasing and satisfy the Nyquist limit, uniform sampling of continuous time signals should be performed with the sampling period T≤/, where  is the upper cyclic frequency of a signal x(t). Although nonuniform sampling has no such a strict limitation on the mean sampling period Ts=/K, in the subsequent analysis, we suppose that both sequences, x(tk) and x(kT), are derived from a band-limited in  signal x(t). Let's write the basic expressions of classical and extended Fourier analysis of continuous time signal x(t) and its sampled versions x(tk) and x(kT). The extended summary of the doctoral thesis in Computer Science 1 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] 2 Problem formulation “The formulation of a problem is often more essential than its solution which may be merely a matter of mathematical or experimental skill.” Albert Einstein 2.1 Basic expressions of classical Fourier analysis The classical Fourier analysis dealing with the following finite time Fourier transforms F ( )  /2  x(t )e  j t dt , (3.1a) F ( ) =  x (t k )e  jtk , (3.1b) F ( ) =  x(kT )e  jkT , (3.1c)  / 2 K 1 k 0 K 1 k 0  1 x (t ) = F ( ) e jt d , (3.2)  2  where (3.2) is the inverse Fourier transform obtained from (1.2) for a band-limited in  signal. Transforms (3.1b) and (3.1c) are known as Discrete Time Fourier Transforms (DTFT) of the nonuniformly and uniformly sampled signals. The reconstructed signal x(t) outside the observation period  vanishes quickly reaching values close to zeros. The signal amplitude spectrum is the Fourier transform (3.1) divided by the observation period , 1 (4) S  ( ) = F ( ) .  The frequency resolution of the classical Fourier analysis is inversely proportional to the observation period , thus, the longer interval of signal analysis, the higher resolution is achieved. Obviously, one can get the formula (3.1a) by truncation of infinite integration limits in (1.1) and the DTFT (3.1a) and (3.1b) as a result of replacement of infinite sums by finite ones. This mean, the classical Fourier analysis supposed that the signal outside  is zeros. In other words, the Fourier transform calculation by formulas (3.1) is well justified if applied to time-limited within  signals. On the other hand, a band-limited in  signal cannot be also time-limited and obviously have nonzero values outside . Generally, the Fourier analysis results obtained by using the exponential basis tend to the Fourier transform, if , while in any finite  there may exist another transform basis providing a more accurate estimation of (1.1). 2.2 Basic expressions of extended Fourier analysis The idea of extended Fourier analysis is finding the transform basis, applicable for a band-limited signals registered in the finite time interval  and providing the results as close as possible in terms of the L2-norm (or the Euclidean norm) to the Fourier transform (1.1) defined in the infinite time interval. The formulas for proposed extended Fourier analysis could be written as F ( ) = /2  x(t ) ( , t )dt , (5.1a) F ( ) =  x(t k ) ( , t k ) , (5.1b)  / 2 K 1 k 0 The extended summary of the doctoral thesis in Computer Science 2 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] K 1 F ( ) =  x(kT ) ( , kT ) , (5.1c) k 0  1 F ( )e jt d , (5.2)  2   where in general case the transform basis (,t), (,tk) and (,kT) are not equal to the classical ones (3.1). Note that the inverse Fourier transform (5.2) still holds the exponential basis. To ensure that the results of transforms (5.1) are close to the result of the Fourier transform (1.1) for the signal x(t), the following minimum least squares expression will be composed and solved x (t ) = 2 F ( )  F ( )  min . (6) Unfortunately, as already stated above, the calculation of F() for a band-limited signal cannot be performed directly. So, in order to compose (6), we should find an adequate substitution. Let's recall that a complex exponent at cyclic frequency 0 and with a complex amplitude S(0) is defined in the infinite time interval as x( 0 , t )  S ( 0 )e j 0t ,  t   . (7) The Fourier transform of a signal (7) can be expressed by the Dirac delta function (2)   x( 0 , t ) e jt dt  2S ( 0 ) (   0 ) . (8)  Now, we will use (7) as a signal model with known amplitude spectrum S(0) for frequencies in The range -≤0≤ and, in the expression (6), substitute F() by the Fourier transform of the signal model (8) and the signals x(t), x(tk) and x(kT) in (5.1) by the signal models (7), correspondingly. Finally, the integral least square error estimators for all the three signal cases get the form   = 2S ( 0 ) (   0 )    =  S ( 2 0 ) e j 0t  ( ,t )dt d 0 , K 1   2S (0 ) (  0 )   S (0 )e j0 kT  ( , kT ) d0 .  (9a)  / 2 2S (0 ) (  0 )   S (0 )e j0tk  ( , t k ) d0 ,   = /2 2 (9b) k 0 K 1 2 (9c) k 0 The solutions of (9) for a definite signal model (7) provide the basis (,t), (,tk) and (,kT) for the extended Fourier transforms (5.1). To control how close the selected signal model amplitudes S(0) are to the signals x(t), x(tk) and x(kT) amplitude spectrum, we will find the formulas for estimate signal amplitude spectrum Sα() in the extended Fourier basis (,t), (,tk) and (,kT). The formula (8) is showing the connection between the signal model Fourier transform and its amplitude spectrum, from where S(0) could be expressed as signal model Fourier transform divided by 2(-0). Taking (8) into account, Sα() is calculated as the transforms (5.1) divided by the estimate of 2(-0) in the extended Fourier basis, which is determined from (9) in the case =0 and 0=, /2 S ( ) =  x(t ) ( , t )dt  e  ( , t )dt  / 2 /2 , (10a) jt  / 2 The extended summary of the doctoral thesis in Computer Science 3 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] K 1 S ( ) =  x(t k 0 K 1 e ) ( , t k ) j t k k 0 K 1 S ( ) = k  ( , tk ) ,  x(kT ) ( , kT ) k 0 K 1 e jkT  ( , kT ) (10b) , (10c) k 0 and showing that the amplitude spectrum on the frequency  is estimated as ratio of the signal extended Fourier transform to the transform of exponent with a unit amplitude in the same basis. This is true also for the classical Fourier transform. For example, after substituting exponential basis  ( , t ) = e  jt in (10a), the denominator becomes equal to  as in formula (4) for the classical Fourier analysis. The values of the denominator in formulas (10) are in inverse ratio to the frequency resolution of the extended Fourier transform. Before finding the extended basis functions for arbitrary S(0), it is reasonable to consider a simple signal model having a rectangular form, S(0)=1 for -≤0≤ and zeros outside. Then the estimators (9) reduce to  =    = /2 e  j 0t 2  ( ,t )dt d0 , K 1   2 (   0 )   e j 0 kT  ( , kT ) d 0 . - (11a)  / 2 2 (   0 )   e j 0tk  ( , t k ) d 0 , -  = 2 (  0 )  2 (11b) k 0 K 1 2 (11c) k 0 The solution of (11) allows establishing relationship between the classical and extended Fourier analysis. 3 Problem solution In this section the integral least square error estimators (9) and (11) are solved and subsequent analysis of the obtained results is performed to find out only those solutions that can lead to practically realizable algorithms. 3.1 Extended Fourier transform of continuous time signals The solution of (11a) for continuous time signal x(t) is found as a partial derivation  = 0,  / 2    / 2 , and leads to the linear integral equation  ( , ) sin (t   )   ( ,t )dt  e  j .  (t   )  / 2 /2  (12) Step by step solution of (12) is given in [4]. Finally, the basis (,t) are obtained by applying a specific function system - a prolate spheroidal wave functions k(t), k=0,1,2,... , [1] and are written as series expansion  B ( )  ( , t )   k  k (t ) . (13) k k =0 The extended summary of the doctoral thesis in Computer Science 4 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] The extended Fourier Transform of continuous time signal x(t) are given by  F ( )   Bk ( )a k , -      , (14.1) x (t )   k (t )a k , -   t   , (14.2) k =0  k =0  S ( )  B k 0   k ( )a k B k ( ) 2 , (14.3) k 0 / 2 / 2     k  k  (  j ) .  k  / 2  k   2   / 2 The extended Fourier transform in accordance with (14.1) requesting a calculation of infinite sums, this mean, an infinite quantity of mathematical operations, therefore it's impossible for real where a k = 1  x ( ) k ( )d ,  k =   k2 (t )dt and B k ( ) = K world applications. Theoretically, the value of the denominator B k ( ) 2 in the amplitude k 0 spectrum formula (14.3) tends to infinite for K, and the extended Fourier transform (14.1) provide a super-resolution - an ability to determine the Fourier transform for the sum of sinusoids or complex exponents, if frequencies of them differ by arbitrary small finite value. 3.2 Extended Discrete Time Fourier Transform In this subsection the minimum least square error estimators (9b,c) and (11b,c) are solved and the extended Fourier transforms for uniformly and nonuniformly sampled complex-valued signals are obtained. The proposed approaches have been developed in articles [5] and [6], where the derivations for real-valued discrete signals are given. The following notations are used in the matrix equations: • superscripts X-1,XT,X*,XH denote inverse, transpose, complex conjugate and complex conjugate (Hermitian) transpose of the matrix X; • ./ represents element-by-element division of two matrices with the same size; • sum(X) means addition of all matrix X elements; • diag(X) forms the row vector by extracting the main diagonal elements from quadratic matrix X or it puts the elements of vector X on the main diagonal to form a diagonal matrix. 3.2.1 A particular solution for discrete time signals The solutions of (11b,c) can be obtained similarly to (11a) as partial derivatives of   = 0 and = 0 , l=0,1,2,...K-1, and leads to the systems of linear equations  ( , tl )  ( , lT ) K 1 sin (t k  tl )   ( ,tk )  e  jtl , (15a)   ( t  t ) k 0 k l sin  (k  l )T   ( , kT )  e  jlT .  (k  l )T k 0 K 1  The solution of (15) in the matrix form is expressed as A  R 1E , where A (Kx1) and E (Kx1) are the extended Fourier and the exponential basis. The extended summary of the doctoral thesis in Computer Science (15b) (16) 5 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] The formulas of Extended Discrete Time Fourier Transform (EDTFT) for signal model S(0)=1, -≤0≤, are derived by substituting of transformation basis (16) into expressions (5) and (10) F ( )  xR 1E ,      , (17.1) 1 x (t )  xR Et ,    t  , (17.2) xR 1E S ( ) = H 1 . (17.3) E R E  The matrices for nonuniformly sampled signal x(tk) are composed as follows sin (tk  tl ) sin (t  tl ) x(1xK) – x(tk), E (Kx1) - e  jtl , R (KxK) - rl ,k  , Et (Kx1) - el  .  ( t  tl )  (tk  tl ) Uniformly sampled sequence x(kT) could be considered as a special case of nonuniform sampling at time moments tk=kT, k=0,1,2,…,K-1, then the matrices in (16, 17) are formed as sin (k  l )T sin (t  lT ) x(1xK) - x(kT), E (Kx1) - e  jlT , R (KxK) - rl ,k  , Et (Kx1) - el  .  (k  l )T  (t  lT ) In particular, if sampling of signal x(kT) is done with Nyquist rate, T=/, the matrix R becomes a unit matrix I and the formula (17.1) coincide with classical DTFT (3.1c), but the formula (17.3) reduces to the well known relationship between discrete signal Fourier transform and its amplitude spectrum F ( )  F ( )  xE , (18.1) 1 S ( )  xE . (18.2) K Whereas for nonuniformly sampled signal x(tk) the matrix RI, even if mean sampling period Ts=/ and formulas (17) give the results that are close to uniform case and superior to those obtained by the classical nonuniform DTFT (3.1b). The resolution by frequency in both sampling cases equals to 1/KT, which is a normal frequency resolution. While for oversampled signals, T(or Ts)</, the EDTFT approach can provide a high frequency resolution and improved spectral estimation quality. Unfortunate an achievement of such results is limited by finite precision in the mathematical calculations and by restrictions on frequency range in the process H 1 of signal sampling. The theoretical value of the denominator in (17.3) E R E  K and the frequency resolution should increase proportionally to the number of samples in the signal observation period . In the border-case, if the number of samples within  is increasing infinity, K, and the discrete time signal tends to the continuous time signal x(t), the EDTFT (17.1) gives the same result as (14.1). 3.2.2 Generalized solution for discrete time signals Now, we will consider the solution of the minimum least square error estimators (9b,c) for arbitrary selected signal model S(0). The derivation formulas for both estimators are similar to the ones given in the previous section. For example, a partial derivation of (9b) by basis  functions = 0, for l  0,1,2,..., K  1, provides the least square solution  ( , tl )  K 1   2  S (  )  (    )  S (0 )e j0tk  ( , t k )  S * (0 )e  j0tl d0  0 ,   0 0   k 0  Equation (19) can be rewritten as  K 1    2 j 0 ( t k  t l ) 2   S (0 ) e d0  ( , t k )  2  S (0 ) e  j0tl  (  0 )d0 .    k 0     The extended summary of the doctoral thesis in Computer Science (19) (20) 6 Dr.sc.comp. Vilnis Liepiņš Email: [email protected]  The filtering feature of the Dirac delta function  f ( x) ( x  x )dx  f ( x ) 0 0 applied to the right  part of (20) gives the final form of the system of linear equations  K 1   1 2 2  S (0 ) e j0 (tk tl ) d0  ( , t k )  S ( ) e  jtl ,    k  0  2     K 1   1 2 2  S (0 ) e j0 ( k l )T d0  ( , kT )  S ( ) e  jlT ,    k 0  2   where S ( ) 2 (21a) (21b) is the signal model power at 0=. The system of linear equations (21b) is applicable for uniformly sampled signal x(kT) and can be derived from (9c) in a similar way as (21a). The EDTFT basis A (Kx1) - (,tk) or (,kT) are found as a solution of (21) 2 A  = S ( ) R 1E . (22) Substituting of basis (22) into expressions (5) and (10), yields the formulas for calculation of the EDTFT in the general case: 2 F ( )  xA  S ( ) xR 1E ,  Ω    , 1 x (t ) = xR E t ,    t  , (23.1) (23.2) 2 S ( ) = x S ( ) R 1E xA xR 1E   EH A EH S ( ) 2 R 1E EH R 1E (23.3) The elements of the matrices R (KxK) and Et (Kx1) in the formulas (22, 23) are expressed by integrals:  1 2 rl ,k  S (0 ) e j0 ( tk tl ) d0 , (24.1a)  2  rl ,k  el  1 2 1 2   S ( ) 0    S ( ) 2 2 e j0 ( k l )T d0 , e j ( t tl ) d , (24.1b) (24.2a)   1 2 S ( ) e j (t lT ) d , (24.2b)  2  for nonuniformly (a) and uniformly (b) sampled signal cases, respectively. If the signal and its 2 2 model power spectra are close, S (0 )  S (0 ) , then (24.1) is also an estimate of the el  autocorrelation function of the sequence x. The inverse transform (23.2) calculated on time moments t=tk or t=kT, k=0,1,2,…,K-1, returns back the input sequence x undistorted, as the elements of matrices Et become equal to R. Case signal model S(0)=1 the formulas (22) and (23) reduce to (16) and (17). 2 The frequency resolution of the EDTFT is in inverse ration to S ( ) E H R 1E and varied in the frequency range -≤≤. 3.3.3 Iterative EDTFT algorithm Calculation of the EDTFT by formulas (23) requires knowledge of the signal model spectrum which generally is not known. At the same time, the amplitude spectrum obtained in the previous section by the formula (17.3) can be used as a source of such information. This suggests the The extended summary of the doctoral thesis in Computer Science 7 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] following iterative algorithm [5], where the signal model spectrum S(0) tends to the signal spectrum Sα(): Iteration 1: Calculate S a(1) ( ) (17.3) applying default signal model - S(0)=1. Iteration 2: Calculate S a( 2 ) ( ) (23.3) by using the signal model - S a(1) (0 ) . Iteration 3: Calculate S a( 3) ( ) (23.3) by using the signal model - S a( 2) (0 ) . … Iteration I: Calculate S a( i ) ( ) (23.3) by using the signal model - S a( i 1) (0 ) . The iterations are repeated until the given maximum iteration number is reached or the power 2 2 spectrum does not alter from iteration to iteration - S a(i ) ( )  S a(i 1) ( ) . The EDTFT output Fα() (23.1) is calculated for the last performed iteration I. By default the signal model S(0)=1 is used as input for the EDTFT algorithm. However, additional information about the signal to be analyzed can be applied to create a more realistic signal model for the EDTFT input and to reduce the number of iterations required to reach the stopping iteration criteria. 4 Extended DFT algorithm EDTFT considered in the previous section is a function of the continuous frequency (-≤≤), while describing below EDFT algorithm calculate EDTFT on a discrete frequency set -n for n=0,1,2,…,N-1. The number of frequency points NK and it should be selected sufficiently great to substitute the integrals (24.1) used for calculation of the matrix R (KxK) in the expressions (22, 23) by the finite sums  1  N 1 2 j ( t  t ) 2 rl ,k  S (  ) e d   S (n ) e j ( t t ) , (25.1)  0 0  2  N n 0 0 k l n k l  1  N 1 2 j 0 ( k  l ) T 2 S (  ) e d   S (n ) e jn ( k l )T , (25.2)  0 0  2  N n 0 l,k=0,1,2,…,K-1. The matrices composed of (25.1) and (25.2), r0, 0 (0) r0,1 (t1  t0 ) r0, 2 (t2  t0 ) ... r0,K 1 (t K 1  t0 )    r (t  t ) r1,1 (0) r1, 2 (t2  t1 ) ... r1,K 1 (t K 1  t1 )   1,0 0 1 r2,1 (t1  t2 ) r2, 2 (0) ... r2,K 1 (t K 1  t2 ) , R   r2,0 (t0  t2 ) (26.1)   ... ... ... ... ...   rK 1,0 (t0  t K 1 ) rK 1,1 (t1  t K 1 ) rK 1, 2 (t2  t K 1 ) ...  r ( 0 ) K 1, K 1   r0 ,0 (0) r0,1 (T ) r0, 2 (2T ) ... r0,K 1 ( K  1)T    r1,0 (T ) r1,1 (0) r1, 2 (T ) ... r1,K 1 ( K  2)T   r2,0 (2T ) r2 ,1 (T ) r2 , 2 (0) ... r2,K 1 ( K  3)T  , (26.2) R   ... ... ... ... ...   rK 1,0  ( K  1)T  rK 1,1  ( K  2)T  rK 1, 2  ( K  3)T  ...  r ( 0 ) K 1, K 1   rl , k  possess Hermitian symmetry, rl ,k  rk ,l , but (26.2) for a uniformly sampled signal has also a Toeplitz structure. The matrix elements rl,k represents the autocorrelation function and can be 2 calculated by applying the IDFT to the signal model power spectrum S (n ) . The frequency * /=2fu=fN in (25), where fu is the signal upper frequency and fN is the Nyquist rate of a bandlimited signal, and it is assumed to be normalized (equal to 1) in DFT calculations. The choice of the frequencies {n}={2fn} depends on the number of frequencies needed for accurate The extended summary of the doctoral thesis in Computer Science 8 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] estimation of (25) as well as for detailed signal spectrum representation, and the limitations on the total amount of computation. Eventually, the uniform set of frequencies in range [-;] is preferable in most application cases. The EDFT may be expressed by the iterative algorithm 1 R ( i )  EW ( i ) E H , (27.1) N (27.2) F( i )  xA ( i )  x(R (i ) ) 1 EW ( i ) , x(R ( i ) ) 1 E. , (27.3) diag (E H (R (i ) ) 1 E) W (i1)  diag (| S(i ) |2 ) , (27.4) for iteration number i=1,2,3,…I, wherein (27.1) is the sum (25) in matrix form. The matrix E (KxN) has elements e  j 2f n tk or e  j 2f n kT case sampling of x done uniformly. By default the diagonal weight matrix W(i) (NxN) for the first iteration is a unit matrix, W(1)=I. If the other diagonal matrix is used as input for the EDFT algorithm then it must have at least K nonzero elements. For the next iterations W(i) is filled with power spectrum values calculated by (27.4). There could be additional criteria for stopping the iterations before the maximum number of iterations I is reached, for example, the iterations could be interrupted, if the relative change in the power spectrum sum, |sum(W(i))-sum(W(i-1))|/sum(W(2)) for i>1, is smaller than a given threshold. The IDFT may be applied to output F of the each iteration and returns back original K-samples of uniform or nonuniform sequence 1 x  FE H . (28) N Since the length of the frequency set NK, then (28) can be modified to obtain an extrapolated sequence xα (1xN) - xα(tm) or xα(mT), m=0,1,2,…,N-1, 1 x  FE HN , (29) N where exponents matrix EN (NxN) has elements e  j 2f ntm or e  j 2f nmT case of uniform xα. Reconstructed by the formula (29) sequence is the original sequence plus forward and backward extrapolation of x to length N and/or interpolation if there are gaps inside of x. The maximum frequency resolution is limited by the length N of frequency set, not by the length K of sequence as in the application of classical DFT. It means, the EDFT is able to increase the frequency resolution N/K times in comparison with the classical DFT. This can be verified by comparing S(i )  the diagonal elements of the product of IDFT and DFT basis, diag ( 1 H E E) , which are equal to N 1 H 1 E A)  F. / S  1 , corresponding to N N the IDFT and EDFT basis A (27.2). At the same time there is a restriction on the frequency resolution sum(F./S)=NK, which is satisfied by iteration, and in order to achieve a high resolution at certain frequencies, the EDFT must decrease the resolution on other frequencies. The deviation |sum(F./S)-NK| also could be used as an additional criteria for stopping of iterations, because indicates the possible inaccuracy in the obtained results, mainly caused by the finite precision in calculations. If this happens, the result of the previous EDFT iteration should be considered as a final one. In a border-case N=K, the iterative algorithm output does not depend on weight matrix W and the optimal EDFT basis is found in a non-iterative way (as a result of the first iteration). K/N at all frequencies, with the relationship, 0  diag ( The extended summary of the doctoral thesis in Computer Science 9 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] 5 EDFT and other nonparametric approaches In the previous sections, starting with the Fourier integral (1) and using its orthogonality property (2), by establishing and solving the minimum least square error estimators (9), the Extended DFT is obtained analytically. In the next, a comparison with known nonparametric approaches - Capon filter, Generalized (Weighted) Least Squares (GWLS) solution and HighResolution Discrete Fourier Transform (HRDFT) introduced by Sacchi, Ulrych and Walker in 1998 are done, and the ways and opportunities of derivation of an iterative EDFT algorithm based on these methods are analyzed briefly. 5.1 Capon filter approach The Capon filter known also as Minimum Variance spectral estimate (see [3, 10, 11, 24]) can be viewed as the output of a bank of filters with each filter centered at one of the analysis frequencies K 1 y ( nT )   x( n  k )T h ( kT )  ~ xh , n  0,1,2,... . (30) k 0 x  x(nT ), x(n  1)T , x(n  2)T ,..., x(n  K  1)T  is the filter input In the matrix notation ~ signal and h =[h (0),h (T),h (2T),...,h ((K-1)T)]T is the filter coefficients. Here the subscript ω indicate a dependence on the filter’s center frequency. The Capon filter is designed to minimize the variance on the filter output 2  y2   y (nT )   yH (nT ) y (nT )   hH ~x H ~xh  hH  ~x H ~x h  hH R xh , (31)         subject to the constraint that its frequency response at the frequency of interest ω has unity gain K 1 H ( )   h (kT )e  jkT  ET h  1 , (32.1) H ( )   h* (kT )e jkT  hH E*  1 , (32.2) k 0 K 1 k 0 . denotes the expectation operator and the matrix E (Kx1) has elements e  jkT . The where   constraints (32.1) and (32.2) must be satisfied by filter (30) and Hermitian transpose filter yH (nT )  hH ~ x H , correspondingly. The matrix R x   ~ xH ~ x (KxK) is the sample autocorrelation matrix and it can be composed of the values of the signal autocorrelation function. For example, so called biased estimate is calculated by 1 K l 1 rxx (lT )  (33)  x(k  l )T x* (kT ), l  0,1,2,..., K  1 K k 0 * and, taking into account that rxx (lT )  rxx (lT ) , the sample autocorrelation matrix is filled as   r0,0 (0) r0,1 (T ) r0, 2 (2T )   r1,0 (T ) r1,1 (0) r1, 2 (T )  r2,1 (T ) r2, 2 (0) R x   r2, 0 ( 2T )  ... ... ...  rK 1,0 ( K  1)T  rK 1,1 ( K  2)T  rK 1, 2 ( K  3)T   ... r0,K 1  ( K  1)T  ... r1,K 1  ( K  2)T  ... r2,K 1  ( K  3)T  .  ... ...   ... rK 1,K 1 (0)  (34) Mathematically, the Capon filter coefficients can be obtained by minimizing the variance (31) under the constraints given by (32.1) and (32.2) J  hH R xh   (ET h  1)   (hH E*  1)  min , (35) The extended summary of the doctoral thesis in Computer Science 10 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] J J  0 and  0 have to be fulfilled h hH to determine the minimum of (35). Both requirements lead to the same solution R 1E* h  T x 1  * (36) E R x E and, traditionally, the Capon power spectrum is computed as 1 PCapon ( )  hH R xh  T 1 * . (37) E R x E In order to obtain an iterative EDFT algorithm from the original Capon filter approach, the sample autocorrelation matrix Rx (34) has to be substituted by RT=E*WET. The matrix RT (KxK) can also be obtained as a transpose of the EDFT matrix R defined by (26). The elements of quadratic diagonal matrix W (NxN) represent an estimate of power at time moment nT=0, determined from one sample at output of each Capon filter 2 T 1 * ~ x R E 2 2 y (0)  ~ xh  T T 1 * , (38) E R E where the filter input sequence ~ x (30) is related to the EDFT input sequence x as ~ ~ ) , k=0,-1,-2,..,-(K-1), for uniformly or x (kT )  x( K  k  1)T  or x (t )  x (t where , are Lagrange multipliers. The conditions     k K  k 1 nonuniformly sampled sequence cases, respectively. Eventually, an iterative algorithm can be formed as follows R T ( i )  E* W ( i ) ET , ~x R T (i ) 1 E* . (i ) S Capon  , 1 diag ET R T ( i )  E* (i ) W ( i 1)  diag (| S Capon |2 ) ,   (39.1) (39.2) (39.3) with the initial condition for W =I and the iteration number i=1,2,3,…I. The estimate of the 2 power spectrum | S Capon | coincides with the results of the EDFT, while the phase spectrum, definitely, is different. It should be noted that the calculation of the Capon filter output power by (37) is theoretically well justified, whereas the derivation of (39) requires ad hoc assumptions and substitutions, and actually is a measurement of power obtained from just a one sample at the output of the filter. This leads to conclusion that the approach (39) is simply a filter-bank interpretation of the EDFT, similarly to the DFT which can also be considered as a bank of filters. In addition, an iterative algorithm derived on the basis of Capon filter cannot reveal all the EDFT capacity, such as the ability to estimate DFT (27.2) and restore the signal (28, 29). (1) 5.2 GWLS solution The Generalized (Weighted) Least Squares approach (see [3, 15, 18, 34]) in the spectral analysis could be based on the following data model xT  E* SGWLS ( )  e Q , (40) with eQ denoting the noise and interference (signals at frequencies other than ω) component, and E* SGWLS ( ) representing the signal component on the frequency of interest with unknown complex amplitude SGWLS(ω). The GWLS minimizes [xT  E* SGWLS ( )]H Q 1[xT  E* SGWLS ( )] , (41) which is solved by The extended summary of the doctoral thesis in Computer Science 11 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] ET Q 1xT SGWLS ( )  T 1 * , (42) E Q E where Q (KxK) is the covariance matrix of the data model component eQ. There are two special cases of GWLS called Weighted Least Squares (WLS) and ordinary Least Squares (LS). WLS occur when all the off-diagonal entries of Q are 0, while LS solution is obtained from the GWLS under the assumption that eQ at (40) is a white noise, hence Q=I. The problem of GWLS estimator is that, in general, the covariance matrix Q is not known, and must be estimated from the data along with the SGWLS(ω). The initial estimate (the 1st iteration) could be equal to LS solution, it is (42) with Q=I. Next, to ensure that the GWLS solution works in an iterative way as EDFT do, the covariance matrix should be calculated as 2 Q=RT=E*WET under the assumption W  diag ( SGWLS ( ) ) . In result, GWLS solution (42) coincides with the EDTFT formula (23.3) SGWLS ( )    R  ET R T ET 1 T 1 xT E*  xR 1E  S ( ) EH R 1E (43) and, as shown in the Section 3.3.3, can be successfully used to update of the amplitude spectrum iteratively. Although substitution of a noise matrix by RT would be easy done, it is not supported by GWLS data model (40), from where the matrix Q represents the data model component eQ * only and the signal component E SGWLS ( ) must be excluded from it, whereas the matrix RT is * calculated for the entire signal xT, including eQ and E SGWLS ( ) . Furthermore, the derivation of EDFT shows that the signal is restored by applying IDFT to the Extended Fourier transform (28), not as an inverse of the amplitude spectrum (27.3), which is a scaled version of (27.2) by a 1 frequency dependent weight factor, xT  E*F  E*S . Using an estimate SGWLS()=Sα() in the N data model (40) leads to a predetermined split of overall energy at the frequency ω in between both components, where the noise part eQ may be expressed as a difference of EDFT outputs Fα() and Sα(). The conclusion reached is that making the derivation of the Extended DFT algorithm possible, invalidates GWLS minimization expression (41) which require separation of both data model components. 5.3 High-Resolution DFT The third method considered here is High-Resolution DFT proposed by Sacchi, Ulrych and Walker in [9]. The authors presented an iterative nonparametric approach of spectral estimation, which minimizes the cost function deduced from Bayes’ theorem and, as well as Extended DFT, makes it possible to obtain high-resolution Fourier spectrum. The HRDFT algorithm can be reduced to the following iterative procedure: 1 R (i )  EW ( i ) E H , (44.1) N (i ) FHRDFT  x(R ( i ) ) 1 EW (i ) , (44.2) 2  1 (i )   W  diag FHRDFT  , (44.3) N    for iteration number i=1,2,3,…I and with the initial condition W(1)=I. The IDFT (28) applied for any iteration output (44.2), return back the sequence x undistorted. The main difference between approaches is that the HRDFT algorithm lack of formula to ( i 1) The extended summary of the doctoral thesis in Computer Science 12 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] estimate of amplitude spectrum (27.3). Instead, as input for the next iteration, it uses the Fourier spectrum estimated in the previous iteration. Thus, the results of HRDFT differ from output of EDFT significantly. HRDFT iterates to the solution where the signal is approximated by K frequencies while the power on other N-K frequencies becomes negligible. Each valuable frequency is resolved with maximum resolution restricted by the length of HRDFT. Also, it still obeys the same limit on the sum of resolutions by frequency (KN) as DFT and EDFT. The authors [39] investigated algorithms having different from (44.3) weights for adaptation of the correlation matrix (44.1), although only the amplitude spectrum (10) derived accordingly to the minimum least squares expression (9) and calculated by (27.4) fits perfectly to an iterative update of the matrix R and returns results that are closest to the Fourier transform in the L2-norm sense. 6 Computer simulations The EDFT algorithm is validated on the data which are similar to those that have been used in [5, 7, 8]. The true spectrum of the first test signal consists of a band-limited noise (flat) in the frequency range [-0.5...-0.25] Hz, a rectangular pulse in the range [0...0.25] Hz and two unit power complex exponents at frequencies 0.35 Hz and 0.3985 Hz. These three components represent random, transient pulse and deterministic parts of a composite signal with the upper frequency fu=0.5 Hz. Uniform and nonuniform sequences of the length K=64 samples are derived by simulating 10-bit Analog-to-Digital Converter (ADC). Sampling and mean sampling periods of both sequences are equal to 1 second, T=Ts=1s. Sampling time points for the nonuniform sequence are generated as, tk=kT+k, k=0,1,2,...,K-1, where {k} are uniformly distributed random values in the range [0...0.8s]. Thus, the true spectrum of sequences consists of three non-overlapping in frequency domain components and ADC added floor noise (-60dB), and it is symbolized by red color lines in the Figures 1-4. The plots in Figures 1 and 2 show the performance of EDFT (black lines) for uniform and nonuniform sequences and allows to compare it with the classical DFT (blue lines). The number of frequencies (the length of DFT) is chosen equal to N=1000, which gives spectral estimates with DFT frequency bin spacing 2fu/N=0.001 Hz. Which means that the range [-0.5...0.5[ Hz is uniformly covered by frequencies and used for the calculations in (25, 27) and for the signal representation in the frequency domain (spectral plots). Figures 1a and 2a display the power spectra of EDFT calculated as 10log(|S|2) in a non-iterative way. The input matrix W in this case is composed of values of the true spectrum (red line in the plots), therefore there is no need for further iterations. Non-iterative estimate is very close to the EDFT 15th iteration depicted in Figures 1b and 2b, where the matrix W=I is used in the input, and confirms the correctness of the iterative algorithm. The Figure 1c (2c) shows the Power Spectral Density (PSD) calculated by the EDFT as 10log(|F|2/N) and proves the expectations, that PSD estimate on a complex exponent should increase in a value in comparison with the classical DFT, if the proposed method achieves a high resolution around this frequency. Figure 1d and 2d plotting the relative frequency resolution for the EDFT 15th iteration calculated 1 1 F. / S (1d) or F. / S (2d) in respect to the DFT for which, in accordance with as 2 f uTK 2 f uTs K (18), it is simply equal to 1 at all frequencies. The value 2fuT=2fuTs=1 and this means that the signal is processed in one Nyquist zone. The DFT is showing a normal frequency resolution, whereas the EDFT have ability to increase the resolution (in plot appears values >1) around the powerful signal components and decrease the resolution (in plot appears values <1) at frequencies where the signal have weak power components. The EDFT is called as a high-resolution method and that is true, but with the following remark The extended summary of the doctoral thesis in Computer Science 13 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] it still keeps the same 'summary' resolution as the traditional DFT or, in other words, squares under black and blue curves in Figure 1d (2d) are equal. The maximum frequency resolution is limited by value of division N/K. For example, if K=64 and N=1000, then the EDFT can potentially improve the frequency resolution 1000/6416 times. The peak resolution is achieved on a deterministic signal part - at frequency 0.35 Hz. The resolution on 0.3985 Hz exponent does not reach maximum value because of its frequency is not on EDFT grid (0.001 Hz) and the estimate splits between two adjacent frequency bins, which is known artifact of the DFT analysis. Figure 1. Uniform complex-value sequence - the estimate of: (a) Power spectrum - True (red), DFT (blue) and non-iterative EDFT (black), (b) Power spectrum - True (red), DFT (blue) and EDFT (15th iteration, black), (c) Power Spectral Density - True (red), DFT (blue) and EDFT (15th iteration, black), (d) Relative frequency resolution - DFT (blue) and EDFT (15th iteration, black). The extended summary of the doctoral thesis in Computer Science 14 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] Figure 2. Nonuniform complex-value sequence - the estimate of: (a) Power spectrum - True (red), DFT (blue) and non-iterative EDFT (black), (b) Power spectrum - True (red), DFT (blue) and EDFT (15th iteration, black), (c) Power Spectral Density - True (red), DFT (blue) and EDFT (15th iteration, black), (d) Relative frequency resolution - DFT (blue) and EDFT (15th iteration, black). Pulse signal ([0...0.25] Hz) is processed by EDFT with about the same resolution as DFT (~1). The relative resolution of random component ([-0.5...-0.25] Hz) fluctuates around 1, while in the regions where just ADC noise can be found, EDFT decreases the frequency resolution bellow the normal. The simulation showed that EDFT can successfully estimate random, transient and deterministic signal spectra and provide results superior to those produced by traditional DFT. EDFT estimates in Figures 1 and 2 are close to each other and proves that the proposed approach The extended summary of the doctoral thesis in Computer Science 15 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] can handle uniform and nonuniform sequences with the same quality, while the efficiency of classical DFT gets worse in case of nonuniform data. Figure 3 explains the difference in performance between uniform and nonuniform inputs, where the spectra of uniform and nonuniform sequences are analyzed in the extended frequency range, [-1...1[ Hz. The number of frequency points and the upper frequency are increased two times, N=2000 and fu=1 Hz. This means that the step by frequency remains the same as in the previous plots. The true spectrum of sequences at frequencies above 0.5 Hz consists only of floor noise (60dB) added by ADC. The actual result depicted in Figure 3a shows periodicity of the DFT and EDFT spectral estimates, which cannot be avoided for uniform sequences. In contrast, EDFT applied to the nonuniform sequence returns correct power spectrum in Figure 3b. Relative resolution of the nonuniform DFT in Figure 3c is calculated as 1/(2fuTs)=0.5 and it is half the normal resolution because of analysis is performed in two Nyquist zones. Nevertheless, squares under blue and black plots in Figure 3c are equal to one's depicted in Figure 2d. The maximum increase in the frequency resolution 2000/6431 times is achieved on a complex exponent at frequency 0.35 Hz by the EDFT. The EDFT also increases resolution in half to process transient and random signal components with the normal frequency resolution equal to 1, as it is indicated by the red dotted lines in Figure 3c. Hence the conclusion that EDFT can handle nonuniformly Figure 3. The estimates obtained in the extended frequency range: (a) Power spectrum of uniform sequence – True (red), DFT (blue) and EDFT (black), (b) Power spectrum of nonuniform sequence - True (red), DFT (blue) and EDFT (black), (c) Relative frequency resolution of nonuniform sequence- DFT (blue) and EDFT (black). The extended summary of the doctoral thesis in Computer Science 16 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] sampled signals in multiple Nyquist zones only if the overall spectrum of band-limited signal components does not exceed one Nyquist zone. Since the spectrum of uniform sequence (red color line in Figure 1) does not cover the entire Nyquist zone the EDFT should be able to handle it with mean sampling period Ts greater than T but less than 2T. The increase of Ts is achieved by skipping samples from the uniform sequence randomly. The resulting sequence could be considered as nonuniformly sampled because the distance between adjacent readings become unequal. The power spectra in Figure 4 show an example of the impact of sample skipping on the performance of DFT and EDFT. Input sequences are modeled by removing 16 and 24 samples randomly from the uniform 64-point data, and leads to increase Ts=64/48T=1,33s and Ts=64/40T=1,6s, respectively. The length and rule of DFT frequency selection preserved the same as in Figure 1. The simulation shows that DFT fails to process sequences with missing samples, while EDFT is still applicable (Fig.4.b) if one Nyquist zone limit on the total signal component spectrum is satisfied, otherwise the estimate becomes worse (Fig.4.c). Note that the result depends not only on the amount of skipped samples, but also on their distribution within the sequence. The most sensitive to missing samples are transient signals which require dense sampling within their location, whereas deterministic signals appear more resistant, especially if the frequencies of discrete components lie on the EDFT grid. It is expected that the considerably greater increase of mean sampling period Ts can be achieved for pure deterministic signals [7]. Figure 4. The power spectrum - True (red), DFT (blue) and EDFT (black), of the sequence without losses (a) and with randomly skipped (b) 16 and (c) 24 samples. The extended summary of the doctoral thesis in Computer Science 17 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] Let's validate above expectations for signal consisting only of sinusoids in a white noise and generate a real-value sequence of the length K=64 samples as a sum of four sine waves with predefined amplitudes 0.5, 1, 2 and 3, having arbitrary initial phases and randomly selected frequencies on the EDFT grid (0.001 Hz). Moreover, the signal sampling is also performed on the grid with T=1 second lag by choosing 64 time points within NT=1000 second interval on a random basis, and results in about a 16-fold increase of the average sampling period, Ts=NT/K=15,675s. Finally, a white Gaussian noise with SNR=20 dB is added and nonuniform Figure 5. Real-value sequence (a) - 64 nonuniform samples, SNR 20 dB, Amplitude spectrum (b) - True values (red cycles) and estimates by DFT (blue), EDFT (black), Relative frequency resolution (c) by DFT (blue line) and EDFT (black), Original (blue cycles) and interpolated sequence by Inverse EDFT - 1000 uniform samples. The extended summary of the doctoral thesis in Computer Science 18 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] real-value sequence illustrated in Figure 5a. The true frequencies and amplitudes (red cycles) as well as the amplitude estimates of DFT (blue line) and EDFT (back line) are depicted in the Figure 5b and showed that DFT cannot recognize weaker power sinusoids while the Extended DFT picks up all of them and estimates their amplitudes and phases precisely. The performance difference is explained in the Figure 5c by comparison of the resolution of both DFTs with respect to the normal frequency resolution (equal to one). The relative resolution of the DFT (blue line) is calculated as 1/(2fuTs)=K/N=0.064 and it is considerably less than it is required for successful signal processing. This causes aliasing and leakage effects, because the spectrum of the sequence spreading in almost 16 Nyquist zones and N-K samples at the input of the DFT could be considered as zeroed by the rectangular windows. The relative resolution of the EDFT (black line) is calculated as 1 1 F. / S  F. / S and it increases N/K times reaching the 2 f uTs K N value close to one at frequencies of sinusoids. Thus, signal processing with just a normal frequency resolution allows EDFT not only to estimate parameters of the signal components correctly, but also IDFT applied to its output returns a sequence of length N consisting of the original K and N-K interpolated samples (see Figure 5d). It should be noted that only a deterministic part of the signal is interpolated by EDFT, whereas a white Gaussian noise stays localized in time around the sampling points (blue cycles). Figure 6. The power spectrum obtained for Marple&Kay data set by (a) DFT, (b) EDFT, (c) HRDFT. The extended summary of the doctoral thesis in Computer Science 19 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] The next sequence used in the computer simulations is well-known Marple&Kay data set taken from [3]. It is 64-point real sample sequence of a process consisting of two unit power sine waves with frequencies of 0.2 and 0.21 Hz, a third one with a power of 0.1 (20 dB down) at 0.1 Hz and a colored noise in the frequency range [0.2…0.5] Hz (see red color lines in Figure 6). The signal upper frequency is fu=0.5 Hz and the length of the DFT is selected N=1000. Only 500 positive frequencies are displayed, because Marple&Kay sequence is a real-valued and negative frequencies, if they are depicted, gives a symmetrical pattern to zero frequency. The Figure 5 shows the power spectra of the DFT, EDFT and HRDFT approaches in a single picture, while separately, these plots have been presented in [5] and [9]. The performance of other well-known spectral analysis methods for Marple&Kay data set could be found in [3], including Minimum Variance approach, named in the Section 5.1 as a traditional Capon filter (37). The simulation results in the Figure 6a,b demonstrate that the classical DFT and EDFT are able to evaluate not only the spectrum of sinusoids, but also the shape of continuous spectrum of other signal components, whereas HRDFT on Figure 6c is suitable mostly for the estimation of a line spectrum. The plot in Figure 6a shows that due to limited frequency resolution the classical DFT cannot resolve sine waves at the frequencies 0.2 and 0.21. Although the first EDFT iteration coincides with DFT, in the further iterations EDFT is able to increase the frequency resolution around the powerful signal components and all three sine waves are clearly distinguished after the 15th iteration in the Figure 6b. Figure 7. Marple&Kay sequence (blue) and extrapolated data (black) by inverse (a) DFT, (b) EDFT, (c) HRDFT. The extended summary of the doctoral thesis in Computer Science 20 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] All the three DFTs have one common feature - the ability to get back 64 samples of Marple&Kay data set by applying IDFT to the output of each of these methods. Since the length of the DFT is chosen equal to 1000, the inverse transform (29) returns 1000-64 additional samples, which are plotted in Figure 7 (black). The samples 65, 66, 67,... are considered as a forward extrapolation, but samples 1000, 999, 998,... as a backward extrapolation of known 64-sample sequence (blue). Of course, the Marple&Kay sequence outside of giving data set is unknown, and plots on Figure 6 are just a three possible versions of its extrapolation. The classical DFT (Fig.7a) suggests that Marple&Kay sequence outside of given 64 samples will be zeros, HRDFT (Fig.7c) shows that the extrapolated data even will increase in power, while EDFT (Fig.7b) expects that the sequence beyond will have approximately the same power, which only gradually decreases in time. Figure 8. White Gaussian noise (blue) and extrapolated data (black) by inverse (a) DFT, (b) EDFT, (c) HRDFT. At the end of the computer modeling, we check extrapolated sequences obtained at the output of IDFT if Marple&Kay input data are replaced by the same size white Gaussian noise (Figure 8). According to the theory the PSD of white Gaussian noise should be constant (flat) across the entire frequency range and the readings in a such sequence are uncorrelated random variables, therefore they cannot be extrapolated. In practice, because of finite length sequences and pseudorandom generators used in the simulations, the above expectations are satisfied only approximately. The classical DFT, as the case Marple&Kay data illustrated in Figure 7a, yields zeros outside of given 64-point sequence also in Figure 8a, that this time is perfectly consistent The extended summary of the doctoral thesis in Computer Science 21 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] with the theory. Extrapolate by the EDFT (Fig.8b) vanish quickly, and this still agrees with the theory, if practical considerations are taken into account. The HRDFT (Fig.8c) in contrary to DFT and EDFT extends the white Gaussian noise up to a length of 1000 samples showing a strong correlation in the input sequence and this is very unlikely to be true. Any approach that claims that it is a high frequency resolution method in accordance with the Uncertainty Principle must make certain assumptions about the data outside of the observation period even if by itself it is not able to recover the signal. The advantage of the proposed method over similar ones is that EDFT based on a solution that satisfies the minimum least squares criteria (6), making it an accurate, reliable and stable. Run MATLAB program EDFT_FIG.m available on file exchange (see link below) to recreate the computer simulations presented in this section. 7 EDFT in MATLAB code The EDFT package consisting of programs written in a simple MATLAB code and created to demonstrate the Extended DFT capabilities described in the previous sections. Each function contains commented (%) help text section where its syntax, algorithm, usage and features are described. The programs NEDFT.m and the inverse transform INEDFT.m can be applied for uniform or nonuniform input/output data and frequency sets. function [F,S,Stopit]=nedft(X,tk,fn,I,W) % NEDFT - Nonuniform Extended Discrete Fourier Transform. % % SYNTAX % a. Mandatory inputs/outputs % F=nedft(X,tk,fn) % Function NEDFT returns discrete Fourier transform F of input sequence X sampled at arbitrary % selected time moments tk: X(tk) >>> F(fn), where frequencies fn, in general, also may selected % arbitrary. If fn is less than X, input sequences X and tk will be truncated. % b. Mandatory and optional inputs/outputs % [F,S,Stopit]=nedft(X,tk,fn,I,W) % I Optional input parameter I can be used for limiting maximum number of iterations. If I is not % specified in input arguments, default value for I is set by parameter 'Miteration', that is, % nedft(X,tk,fn)=nedft(X,tk,fn,Miteration). To complete iteration process faster, the value for % 'Miteration' should be decreased. % W Input weight vector W, if specified, override the default values W=ones(size(fn)). W must have % at least length(X) nonzero elements. % S The second output argument S represents the Amplitude spectrum. Peak values of abs(S) can be % used for estimate amplitudes of sinusoids in the input sequence X. % Stopit is an informative output parameter. The first row of Stopit showing the number of performed iteration, % the second row indicate breaking of iteration reason and may have the following values: % 0- Maximum number of iteration performed. % 1- Sum of outputs division sum(F./S) is not equal to K*N within Relative deviation 'Rdeviat'. % the calculations is interrupted because of results could be inaccurate. If this occur in the first % NEDFT iteration, then outputs F and S are zeros. % 2- Relative threshold 'Rthresh' reached. To complete iteration process faster, the value for % 'Rthresh' should be increased. % ALGORITHM % Input: % X- input sequence % E- complex exponents matrix (Fourier transform basis) - E=exp(-i*2*pi*tk.'*fn); % I- (optional) number of maximum iteration. % W- (optional) weight vector W. If not specified, W = ones(1,size(fn)) used for the first iteration. % Output F and S for each NEDFT iteration are calculated by following formulas: % 1. R=E*diag(W/N)*E'; % 2. F=W.*(X*inv(R)*E); % S=(X*inv(R)*E)./diag(E'*inv(R)*E).'; % 3. W=S.*conj(S); - the weight vector W for the next iteration. % A special case: if length(X) is equal to length(fn), the NEDFT output do not depend on selected weight % vector W and is calculated in non-iterative way. % Tips for selection of mandatory NEDFT inputs X(tk) and fn: % 1. Input sequence X(tk) for NEDFT can be sampled uniformly or nonuniformly. Uniform sampling % can be considered as a special case of nonuniform sampling, where tk=[0,1,...,K-1]*T and T is The extended summary of the doctoral thesis in Computer Science 22 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] % sampling period. Nonuniform sampling can be realized in many different ways, like as: % - uniform sampling with randomly missed samples (known as sparse data); % - uniform sampling with missed data segments (known as gapped data); % - uniform sampling with jitters: tk=([0,1,...,K-1] + jitter*rand(1,K))*Ts, where value for jitters is selected % in range [0...1[ and Ts is the mean sampling period; % - additive nonuniform sampling: tk=tk-1 + (1+jitter*(rand-0.5))*Ts, k=1,...K-1, t0=0; % - signal dependent sampling, e.g., level-crossing sampling, etc... . % 2. Frequencies for fn can be selected arbitrary. This mean, that user can choose not only the length % of NEDFT (number of frequencies in fn), but also the way how to distribute frequencies along the % frequency axis. On other hand, to get adequate sequence X representation, frequencies fn should % be selected to cover overall range, where the input sequence X spectrum is supposed to be found, % otherwise, in result of NEDFT, all components having spectra outside fn will be incorporated. % Note that fn should contain negative frequencies too, and for a real value X(tk) analysis each positive % frequency in fn should have corresponding negative one. % 3. Frequencies for vector fn can be added in any order. Therefore it is possible to combine different % frequency sets in one or just add individual frequencies of interest to fn, e.g., fn=[fn1 fn2 f1 f2], where % fn1 and fn2 are different frequency sets, f1,f2 - specific frequencies. NEDFT outputs will be calculated % accordingly- F(fn)=[F(fn1) F(fn2) F(f1) F(f2)], S(Fn)=[S(Fn1) S(fn2) S(f1) S(f2)]. % FEATURES % 1. NEDFT output F(fn) is the discrete Fourier transform of sequence X(tk). % The Power Spectral Density function of nonuniform sequence X(tk) can be estimated by the following % formula: abs(F).^2/(N*Ts), Ts - mean sampling period. % 2. In general, the function Y=inedft(F,fn,tn) (see attached program) is used to calculate the reconstructed % sequence Y(tn). If frequencies fn are selected on the same grid as used by FFT algorithm, then ifft(F) % can be applied to get uniformly re-sampled and extrapolated to length(fn) version of input sequence X(tk). % 3. NEDFT output S(fn) estimate amplitudes and phases of sinusoidal components in sequence X(tk). % 4. NEDFT can increase frequency resolution length(fn)/length(X) times. Division of outputs 1/(Ts*(F./S)) % demonstrate the frequency resolution of NEDFT. The following is true for any NEDFT iteration: % 0<F./S<=length(fn), % sum(F./S)=length(fn)*length(X). % 5. If input arguments are matrices, the NEDFT operation is applied to each column. % % See also FFT, IFFT, FFTSHIFT, EDFT, INEDFT. %======================= Set default parameters for NEDFT ============================ Miteration=30; % Limit for maximum number of iteration (Stopit 0). Rdeviat=0.0005; % Value for relative deviation (Stopit 1). Rthresh=0.0001; % Value for relative threshold (Stopit 2). %======================= Check NEDFT input arguments ============================== if nargin<3,error('Not enough input arguments. See help nedft.'),end if sum(any(isinf(X)))sum(any(isnan(X))), error('Input argument X contain Inf or NaN. See help nedft.'), end if size(X,1)==1, % Check size of input sequence X. trf=0; else X=X.'; tk=tk.'; fn=fn.'; trf=1; end [L K]=size(X); % K - length of input sequence X. if size(tk,1)~=L | size(tk,2)~=K, error('Size of input arguments X and tk must be equal. See help nedft.'), end if size(fn,1)~=L, error('Incorrect size of input argument fn. See Help nedft.'), end N=size(fn,2); % N - length of DFT. if N<K, % Truncate sequence X if N<K. X=X(:,1:N); tk=tk(:,1:N); K=N; end if nargin<4, % Set value for maximum number of iterations. I=Miteration; % Default value for I. else if isempty(I),I=Miteration;end, I=floor(I(1)); % Check input argument I. end if nargin>4, % Check of input argument W. if trf==1,W=W.';end if (size(W,2)~=N)|(size(W,1)~=L),error('Incorrect size of input argument W. See help nedft.'), end W=W.*conj(W); if any(find(sum(W>0)<K)), error('Too many zeros in input argument W. See help edft.'), end else W=ones(L,N); % Default values for W. end %======================= Check for a special cases ============================== if K==N, I=1; W=ones(L,K); end % If K=N, perform just one NEDFT iteration. %======================= Set default values for NEDFT output arguments =============== F=zeros(L,N); S=zeros(L,N); % Fill zeros in output matrices F and S. Stopit=[I*ones(1,L); zeros(1,L)]; % Stopit 0: Set values for default Stopit. %======================= Calculate NEDFT for each X column l ====================== for l=1:L, E=exp(-i*2*pi*tk(l,:).'*fn(l,:)); % Calculate the complex exponents matrix E. The extended summary of the doctoral thesis in Computer Science 23 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] for it=1:I, % Start iterations... % Calculate the correlation matrix R by using a loop structure. for n=1:K, for k=n:K, R(k,n)=sum(W(l,:).*conj(E(n,:)).*E(k,:))/N; if n~=k, R(n,k)=conj(R(k,n)); else R(n,n)=real(R(n,n)); end end end % Calculate the correlation matrix R by using vectorized form and RE=R\E (an alternative approach). % R=E*diag(W(l,:)/N)*E'; % RE=R\E; % Calculate RE=inv(R)*E and ERE=diag(E'*inv(R)*E).'=sum(conj(E).*RE). RE=inv(R)*E; ERE=sum(conj(E).*RE); % Stopit 1: Break iterations if sum(F./S) is not equal to N*K. if abs(ERE*W(l,:).'/N/K-1)>Rdeviat, Stopit(:,l)=[it-1; 1]; break, end % Calculate outputs for iteration (it): N-point NEDFT (F) and Amplitude Spectrum (S). F(l,:)=X(l,:)*RE; S(l,:)=F(l,:)./ERE; F(l,:)=F(l,:).*W(l,:); % Calculate weight (W) for the next iteration. W(l,:)=S(l,:).*conj(S(l,:)); % Stopit 2: Break iterations if relative threshold reached. SW(it)=sum(W(l,:)); if it>1, thit=abs(SW(it-1)-SW(it))/SW(1); if thit<=Rthresh, Stopit(:,l)=[it; 2]; break, end end end % ... end iterations. end %======================= Adjust size of NEDFT output ============================== if trf==1,F=F.';S=S.';end % Adjust size of NEDFT outputs. function Y=inedft(F,fn,tn) %INEDFT Inverse Nonuniform Extended Discrete Fourier Transform. % % Y=inedft(F,fn,tn) is the inverse discrete Fourier transform of vector % F estimated by NEDFT function at arbitrary frequency set fn: % F(fn) -> Y(tn), % where time moments tn for reconstructed sequence Y can be uniformly or % nonuniformly spaced in time. In the special case of uniform vectors fn and % tn, the INEDFT function can be replaced by well known MATLAB function IFFT. % % If input arguments are matrices, the INEDFT operation is applied to each column. % % See also IFFT, EDFT, NEDFT. %======================= Check INEDFT input arguments =========================== if nargin<3,error('Not enough input arguments. See help inedft.'),end % Checking size of input arguments. if size(F,1)==1, trf=1;F=F.'; tn=tn.'; else trf=0;fn=fn.'; end [N L]=size(F); if size(fn,2)~=N, error('Sizes of input arguments F and fn must be equal. See help inedft.'), end if size(tn,2)~=L, error('Incorrect size of input argument tn. See help inedft.'), end %======================= Calculate INEDFT for each X column l ====================== for l=1:L E=exp(i*2*pi*tn(:,l)*fn(l,:)); Y(:,l)=E*F(:,l)/N; end %======================= Adjust size of INEDFT output ============================= if trf==1,Y=Y.';end From the viewpoint of calculation complexity is reasonable to use the same frequency grid as Fast Fourier Transform (FFT.m in MATLAB library). This allows to apply the FFT algorithm in EDFT calculations, which considerably reduce computation time, because each FFT The extended summary of the doctoral thesis in Computer Science 24 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] requiring a number of operations proportional to Nlog(N) rather than N2 [2]. EDFT.m program is designed as a faster realization of Extended DFT, where the algorithm described in [7] is implemented. The code is applicable for uniformly sampled signals or data with gaps in it. The inverse transform to EDFT.m is MATLAB library program IFFT.m. function [F,S,Stopit]=edft(X,N,I,W) % EDFT - Extended Discrete Fourier Transform. % % Function EDFT produce discrete N-point Fourier transform F and amplitude spectrum S of the % data vector X. Data X may contain NaN (Not-a-Number). % % SYNTAX % [F,S,Stopit]=edft(X,N) for N>length(X) calculate F and S iteratively (see an ALGORITHM below). % If data X do not contain NaN and N<=length(X) or N is not specified, EDFT return the % same results as fast Fourier transform: F=fft(X,N) or F=fft(X) and S=F/N. % [F,S,Stopit]=edft(X,N,I) performs edft(X,N) with limit I for maximum number of iterations. % Default value for I is set by parameter 'Miteration', that is, edft(X,N)=edft(X,N,Miteration). % To complete iteration process faster, the value for 'Miteration' should be decreased. % [F,S,Stopit]=edft(X,N,I,W) execute edft(X,N,I) with initial conditions defined by weight vector W. % Default values for W are ones(size(F)). W must have at least length(X) nonzero elements. % Stopit is an informative (optional) output parameter. The first row of Stopit showing the number of % performed iteration, the second row indicate breaking of iteration reason and may have % the following values: % 0 - Maximum number of iteration performed. If length(X)<=N, only one EDFT iteration is % performed (I=1). % 1 - Sum of outputs division sum(F./S) is not equal to K*N within Relative deviation % 'Rdeviat'. The calculations were interrupted because of results could be inaccurate. % If this occur in the first EDFT iteration, then outputs F and S are zeros. % 2 - Relative threshold 'Rthresh' reached. To complete iteration process faster, the value % for 'Rthresh' should be increased. % ALGORITHM % Input: % X - input data. % N - length of discrete Fourier transform. % I - (optional) number of maximum iteration. If not specified, I=30. % W - (optional) weight vector W. If not specified, W = ones(1,N); used for the first iteration. % E - Fourier transform basis matrix: E=exp(-i*2*pi*(0:length(X)-1)'*(0:N-1)/N); % If part of unknown data in X are replaced by NaN then the time vector (0:length(X)-1) is % changed to exclude time moments where NaN inserted. % Output F and S for each EDFT iteration are calculated by following formulas: % 1. R=E*diag(W/N)*E'; % EDFT using function ifft to calculate R faster. % 2. F=W.*(X*inv(R)*E); % S=(X*inv(R)*E)./diag(E'*inv(R)*E).'; % Levinson-Durbin recursion used for inverse of toeplitz R. % Function fft applied to speed up matrix multiplications. % 3. W=S.*conj(S); W used as input to the next EDFT iteration. % A special case: if length(X) is equal to N, the EDFT output do not depend on selected weight % vector W and is calculated in non-iterative way. % FEATURES % 1. EDFT output F is the N-point Fourier transform of data X. % The Power Spectral Density (PSD) function can be calculated by the following formula: % abs(F).^2/(N*T), T - sampling period. % 2. EDFT can extrapolate input data X to length N. That is, if apply EDFT for N>length(X), % get the results: F=edft(X,N)=edft(Y)=fft(Y); Y=ifft(F), where Y is input X plus non-zero % forward and backward extrapolation of X to length N. % 3. EDFT output S estimate amplitudes and phases of sinusoidal components in input data X. % 4. EDFT can increase frequency resolution N/length(X) times. Division of outputs 1/(T*F./S) % demonstrate the frequency resolution of EDFT. The following is true for any EDFT iteration: % 0<F./S<=N, % sum(F./S)=N*length(X). % 5. EDFT input data X may contain NaN. NaN indicates unavailable data or missing samples % or data segments in X. EDFT Outputs F and S are calculated by applying slower algorithm % then in case of X without NaN. % 6. If X is a matrix, the EDFT operation is applied to each column. % % See also FFT, IFFT, FFTSHIFT. %======================= Set default parameters for EDFT ============================ Miteration=30; % Limit for maximum number of iteration (Stopit 0). Rdeviat=0.0005; % Value for relative deviation (Stopit 1). Rthresh=0.0001; % Value for relative threshold (Stopit 2). The extended summary of the doctoral thesis in Computer Science 25 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] %======================= Check EDFT input arguments ============================== if nargin==0, error('Not enough input arguments. See help edft.'), end % Check input argument X. if sum(any(isinf(X))), error('Input argument X contain Inf. See help edft.'), end if size(X,1)==1, X=X.';trf=1; % X is row vector else trf=0; % X is 2 dim array end [K L]=size(X); % K - length of input data X if nargin>1, % Checking input argument N. if isempty(N),N=K;end N=floor(N(1)); if N<K, X=X(1:N,:);K=N; end % Truncate X if has more than N points else N=K; end % Checking X on NaNs: Xnan=~isnan(X); % Xnan - indicate samples as '1' , NaN as '0' if N==1, KK=Xnan; else KK=sum(Xnan); % KK - length of input data X without NaN end if nargin<3, % Checking input argument I. I=Miteration; % Set default value for I. else if isempty(I),I=Miteration;end I=floor(I(1)); end if nargin<4, % Checking of input argument W. W=ones(N,L); % Set default values for W else if trf==1,W=W.';end if (size(W,1)~=N)|(size(W,2)~=L), error('Incorrect size of input argument W. See help edft.'), end W=W.*conj(W); if any(find(sum(W>0)<KK)), error('Too many zeros in input argument W. See help edft.'), end end %======================= Set default values for EDFT output arguments =============== F=zeros(N,L);S=zeros(N,L); % Fill with zeros output matrices F,S. Stopit=[I*ones(1,L);zeros(1,L)]; % Set default value for Stopit. %======================= Calculate EDFT for each X column l ====================== for l=1:L, %======================= Check for a special cases ============================= if KK(l)==N|KK(l)==0, % If length(X)=N or X(:,l) has all NaNs then F(:,l)=fft(X(:,l),N); % EDFT output (F,S) equals to FFT. S(:,l)=F(:,l)/N; Stopit(:,l)=[1; 0]; elseif K==1&N~=1, % Special case, the length(X)=1, F(:,l)=fft(X(:,l),N).'; % EDFT output (F,S) equals to FFT. S(:,l)=F(:,l)/N; Stopit(:,l)=[1; 0]; elseif isempty(find(X(:,l)))&KK(l)>0, % If input X(:,l) has all zeros or zeros&NaN Stopit(:,l)=[1; 0]; % then EDFT output (F,S) is zeros. %======================= Basic EDFT algorithm started =========================== elseif KK(l)==K, % Input X(:,l) does not contain NaN %======================= Apply FASTER algorithm ============================== for it=1:I, % Start iterations... r=ifft(W(:,l)); % Calculate correlation vector (r). % Perform inverse of correlation matrix: Levinson-Durbin recursion. a=-r(2)/r(1); V=r(1)-r(2)*conj(r(2))/r(1); for n=1:K-2, alfa=[1 a.']*r(n+2:-1:2); rho=-alfa/V; V=V+rho*conj(alfa); a=[a+rho*conj(flipud(a));rho]; end a=[1;a]; % Inverse by Matlab backslash operator (an alternative approach). % a=[1; toeplitz(conj(r(1:K-1)))\(-r(2:K))]; % V=a.'*conj(r(1:K)); % Calculate ERE=diag(E'*inv(R)*E) and XR=X*inv(R). XR=zeros(K,1);RE=zeros(K,1);rc=a; for k=1:K/2, The extended summary of the doctoral thesis in Computer Science 26 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] k0=K-k+1; k1=2:K-2*k+1; k2=k+1:K-k; k3=k:K-k+1; RE(1)=RE(1)+2*rc(k); RE(k0-k+1)=RE(k0-k+1)+2*rc(k0); RE(k1)=RE(k1)+4*rc(k2); XR(k)=XR(k)+rc(k3)'*X(k3,l); XR(k0)=XR(k0)+(flipud(rc(k3))).'*X(k3,l); XR(k2)=XR(k2)+rc(k2)*X(k,l)+flipud(conj(rc(k2)))*X(k0,l); rc(k2)=rc(k2-1)+conj(a(k+1))*a(k2)-a(k0)*flipud(conj(a(k2+1))); end if round(K/2)>K/2, RE(1)=RE(1)+rc(k+1); XR(k+1)=XR(k+1)+X(k+1,l)*rc(k+1); end ERE=real(fft(RE,N)); W(:,l)=W(:,l)/real(V); % Stopit 1: Break iterations if sum(F./S) is not equal to N*K or NaN. stit=abs(ERE.'*W(:,l)/N/K-1); if (stit>Rdeviat)|isnan(stit), Stopit(:,l)=[it-1; 1]; break, end % Calculate outputs for iteration (it): N-point EDFT (F) and Amplitude Spectrum (S). F(:,l)=fft(XR,N); S(:,l)=F(:,l)./ERE; F(:,l)=F(:,l).*W(:,l); % Calculate weight (W) for the next iteration. W(:,l)=S(:,l).*conj(S(:,l)); % Stopit 2: Break iterations if relative threshold reached. SW(it)=sum(W(:,l)); if it>1, thit=abs(SW(it-1)-SW(it))/SW(1); if thit<=Rthresh, Stopit(:,l)=[it; 2]; break, end end end % ... end iterations. %======================= End of FASTER algorithm ============================== else % Input X(:,l) contains NaN %======================= Apply SLOWER algorithm ============================== INVR=zeros(K);ER=zeros(K,1); X(find(~Xnan(:,l)),l)=zeros(K-KK(l),1); % Replace NaN by 0 in X t=find(Xnan(:,l)); % Sample numbers vector (t) for it=1:I, % Start iterations... % Calculate correlation matrix (R) by applying ifft and inverse of R. RT=ifft(W(:,l)); R=toeplitz(RT(1:K)); INVR(t,t)=inv(R(t,t)); % Inverse of R % INVR(t,t)=R(t,t)\eye(KK); % Inverse by Matlab backslash operator % INVR(t,t)=pinv(R(t,t)); % Pseudo-inverse if R is nearly singular ER(1)=trace(INVR); for k=1:K-1 ER(k+1,1)=sum(diag(INVR,k)+conj(diag(INVR,-k))); end % Calculate ERE=diag(E'*inv(R)*E).' by applying fft.. ERE=real(fft(ER,N)); % Stopit 1: Break iterations if sum(F./S) is not equal to N*KK or NaN. stit=abs(ERE.'*W(:,l)/N/KK(l)-1); if (stit>Rdeviat)|isnan(stit), Stopit(:,l)=[it-1; 1]; break, end % Calculate outputs for iteration (it): N-point EDFT (F) and Amplitude Spectrum (S). F(:,l)=fft(conj(INVR)*X(:,l),N); S(:,l)=F(:,l)./ERE; F(:,l)=F(:,l).*W(:,l); % Calculate weight (W) for the next iteration. W(:,l)=S(:,l).*conj(S(:,l)); % Stopit 2: Break iterations if relative threshold reached. SW(it)=sum(W(:,l)); if it>1, thit=abs(SW(it-1)-SW(it))/SW(1); if thit<=Rthresh,Stopit(:,l)=[it; 2];break,end end end % ... end iterations. %======================= End of SLOWER algorithm ============================== end end %======================= Adjust size of EDFT output ============================== if trf==1,F=F.';S=S.';end The extended summary of the doctoral thesis in Computer Science 27 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] The next program demonstrates the applicability of the Extended DFT in 2-dimensional signal processing. The EDFT2.m program is based on the MATLAB library program FFT2.m where FFT.m calls are simply replaced by EDFT.m. The inverse transform to EDFT2.m is the MATLAB library program IFFT2.m. function f = EDFT2(x, mrows, ncols) % EDFT2 Two-dimensional Extended Discrete Fourier Transform. % EDFT2(X) returns the two-dimensional Fourier transform of matrix X. % Before run EDFT2 unknown data (if any) inside of X should be replaced % by NaN (Not-a-Number). % If X is a vector, the result will have the same orientation. % EDFT2(X,MROWS,NCOLS) performing size MROWS-by-NCOLS Fourier transform % without padding of matrix X with zeros. % % See also EDFT, IFFT2. % % EDFT2 is created on basis of MATLAB program FFT2 (J.N. Little 12/18/1985) if nargin==0, error('Not enough input arguments. See help edft2.'), end % No input [m, n] = size(x); % Basic algorithm. if (nargin == 1) & (m > 1) & (n > 1) % f = fft(fft(x).').'; f = edft(edft(x).').'; return; end % Padding for vector input. if nargin < 3, ncols = n; end if nargin < 2, mrows = m; end mpad = mrows; npad = ncols; if m == 1 & mpad > m, x(2, 1) = 0; m = 2; end if n == 1 & npad > n, x(1, 2) = 0; n = 2; end if m == 1, mpad = npad; npad = 1; end % For row vector. % Transform. %f = fft(x, mpad); %if m > 1 & n > 1, f = fft(f.', npad).'; end f = edft(x, mpad); if m > 1 & n > 1, f = edft(f.', npad).'; end The first version of EDFT (file GDFT.m) was submitted to file-exchange server on 10/7/1997 as MATLAB 4.1 code. The renewed code version uploaded on 8/5/2006 and available online http://www.mathworks.com/matlabcentral/fileexchange/11020-extended-dft. Please note that programs have not been tested on the latest MATLAB versions and therefore have opportunities to performance improvements (see for example [25, 28]). 8 References [1] D. Slepian, H.O. Pollak. Prolate Spheroidal Wave Functions, Fourier Analysis and Uncertainty - I. Bell System Technical Journal, Vol.40 No.1, pp.43-63, 1961. [2] James W. Cooley, John W. Tukey. An algorithm for the machine calculation of complex Fourier series. Math. Comput., Vol.19, pp.297–301, 1965. [3] S.M. Kay, S.L. Marple. Spectrum analysis - a modern perspective. Proc. IEEE, Vol.69, No.11, 1981. [4] V. Liepin’sh. A method for spectral analysis of band-limited signals, Automatic Control and Computer Sciences. Vol.27, No.5, pp.56-63, 1993. [5] V. Liepin’sh. A method for spectrum evaluation applicable to analysis of periodically and nonregularly digitized signals. Automatic Control and Computer Sciences, Vol.27, No.6, pp.57-64, 1993. [6] V. Liepin’sh. A spectral estimation method of nonuniformly sampled band-limited signals. Automatic Control and Computer Sciences, Vol.28 , No.2, pp.66-73, 1994. [7] V. Liepin’sh. An algorithm for evaluation a discrete Fourier transform for incomplete data. Automatic Control and Computer Sciences, Vol.30, No.3, pp.27-40, 1996. The extended summary of the doctoral thesis in Computer Science 28 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] [8] Vilnis Liepins. High-resolution spectral analysis by using basis function adaptation approach. Doctoral Thesis for Scientific Degree of Dr.sc.comp. /in Latvian/, University of Latvia, 1997. Abstract available on http://hdl.handle.net/10068/330816 . [9] M.D. Sacchi, T.J. Ulrych, C. Walker. Interpolation and extrapolation using a highresolution discrete Fourier transform. IEEE Trans. on Signal Processing, Vol.46, No.1, pp.3138, 1998. [10] Modris Greitans. Multiband signal processing by using nonuniform sampling and iterative updating of autocorrelation matrix. Proceedings of the 2001 International Conference on Sampling Theory and Application, May 13-17, 2001, Orlando, Florida, USA, pp.85-89. [11] Modris Greitans. Spectral analysis based on signal dependent transformation. The 2005 International Workshop on Spectral Methods and Multirate Signal Processing, (SMMSP 2005), June 20-22, 2005, Riga, Latvia. [12] Jayme Garcia Arnal Barbedo, Amauri Lopes, Patrick J. Wolfe. High Time-Resolution Estimation of Multiple Fundamental Frequencies. Proceedings of the 8th International Conference on Music Information Retrieval, ISMIR 2007, Sept.23-27, Vienna, Austria, pp.399-402. [13] David Dolenc, Barbara Romanowicz, Paul McGill, William Wilcock. Observations of infragravity waves at the ocean-bottom broadband seismic stations Endeavour (KEBB) and Explorer (KXBB). Geochemistry, Geophysics, Geosystems, Vol.9, Issue 5, May 2008. [14] Quanming Zhang, Huijin Liu, Hongkun Chen, Qionglin Li, Zhenhuan Zhang. A Precise and Adaptive Algorithm for Interharmonics Measurement Based on Iterative DFT. IEEE Trans on Power Delivery, Vol.23, Issue 4, pp.1728-1735, Oct.2008. [15] Petre Stoica, Jian Li, Hao He. Spectral Analysis of nonuniformly Sampled Data: A New Approach Versus the Periodogram. IEEE Trans on Signal Processing, Vol.57, Issue 3, pp.843858, March 2009. [16] Eric Greenwood, Fredric H. Schmitz. Separation of Main and Tail Rotor Noise Sources from Ground-Based Acoustic Measurements Using Time-Domain De-Dopplerization. 35th European Rotorcraft Forum 2009, Sept.22-25, Hamburg, Germany. [17] Jayme Garcia Arnal Barbedo, Amauri Lopes, Patrick J. Wolfe. Empirical Methods to Determine the Number of Sources in Single-Channel Musical Signals. IEEE Transactions on Audio, Speech and Language Processing, Vol.17, Issue 7, pp.1435-1444, Sept.2009. [18] Tarik Yardibi, Jean Li, Petre Stoica, Ming Xue, Arthur B. Baggeroer. Source localization and sensing: A nonparametric iterative adaptive approach based on weighted least squares. IEEE Transactions on Aerospace and Electronic Systems, Vol.46, pp.425-443, Jan.2010. [19] M. Caciotta, S. Giarnetti, F. Leccese, Z. Leonowicz. Comparison between DFT, adaptive window DFT and EDFT for power quality frequency spectrum analysis. Modern Electric Power Systems (MEPS), 2010 Proceedings of the International Symposium, Sept.20-22, 2010, Wroclaw, pp.1-5. [20] Li Li, Yan Zheng, Wang Xing-zhi. Inter-harmonic Analysis Using IGG and Extended Fourier. Proceedings of the Chinese Society of Universities for Electric Power System and its Automation, 22(3), 2010. [21] Erik Gudmundson, Andreas Jakobsson, Jörgen Jensen, Peter Stoica. An Iterative Adaptive Approach for Blood Velocity Estimation Using Ultrasound. EUSIPCO 2010, Aug 23-27, Aalborg, Denmark, pp.348-352. [22] Modris Greitans, Rolands Shavelis. Reconstruction of sequences of arbitrary shaped pulses from its low pass or band pass approximations using spectrum extrapolation. EUSIPCO 2010, Aug. 23-27, Aalborg, Denmark, pp.1607-1611. [23] Juggrapong Treetrong. Fault Detection of Electric Motors Based on Frequency and Time- The extended summary of the doctoral thesis in Computer Science 29 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] Frequency Analysis using Extended DFT. International Journal of Control and Automation, Vol.4, No.1, March 2011. [24] Jesper Rindom Jensen, Mads Græsbøll Christensen, Søren Holdt Jensen. A Single Snapshot Optimal Filtering Method for Fundamental Frequency Estimation. 36th International Conference on Acoustics, Speech and Signal Processing (ICASSP), Prague, Czech Republic, May 22-27, 2011, pp. 4272-4275. [25] Ming Xue, Luzhou Xu, Jian Li. IAA spectral estimation: fast implementation using the Gohberg-Semencul factorization. ICASSP 2011, May 22-27, Prague, Czech Republic, pp.3251-3261. [26] Bonifatius Wilhelmus Tilma. Supervisor: M.K. Smit; Co-promotor: E.A.J.M. Bente. Integrated tunable quantum-dot laser for optical coherence tomography in the 1.7µm wavelength region. Eindhoven, Technische Universiteit Eindhoven, Diss., Jun.2011. [27] Elmar Mair, Michael Fleps, Michael Suppa, and Darius Burschka. Spatio-temporal initialization for IMU to camera registration. In Proceedings of the IEEE International Conference on Robotics and Biomimetics (ROBIO), Dec.2011, pp.557-564. [28] George-Othan Glentis, Andreas Jakobsson. Superfast Approximative Implementation of the IAA Spectral Estimate. IEEE Transactions on Signal Processing, Vol.60, Issue 1, Jan.2012, pp.472-478. [29] B. W. Tilma, Yuqing Jiao, J. Kotani, B. Smalbrugge, H. P. M. M. Ambrosius, P. J. Thijs, X. J. M. Leijtens, R. Notzel, M. K. Smit, E. A. J. M. Bente. Integrated Tunable Quantum-Dot Laser for Optical Coherence Tomography in the 1.7 mm Wavelength Region. IEEE Journal of Quantum Electronics, Vol.48, No.2, Feb.2012, pp. 87-98. [30] T. Odstrcil, M. Odstrcil, O. Grover1, V. Svoboda1, I. Ďuran1, and J. Mlynář. Low cost alternative of high speed visible light camera for tokamak experiments. Review of Scientific Instruments. Oct.2012, Vol.83, Issue 10. [31] Elmar Mair. Co-promotor: Gregory Donald Hager. Efficient and Robust Pose Estimation Based on Inertial and Visual Sensing. Munchen, Technische Universitat Munchen, Diss., 2012. [32] Akash K Singh. Quantum-Dot Laser OCT. International Journal of Engineering Research and Applications (IJERA), Vol.2, Issue 6, Nov.- Dec.2012, pp.340-371. [33] Elliot Briggs, OFDM Physical Layer Architecture and Real-Time Multi-Path Fading Channel Emulation for the 3GPP Long Term Evolution Downlink. PhD Thesis. Texas Tech University, Dec. 2012. [34] Kwadwo S. Agyepong. Fang-Han Hsu, Edward R. Dougherty and Erchin Serpedin. Spectral Analysis on Time-Course Expression Data: Detecting Periodic Genes Using a RealValued Iterative Adaptive Approach. Advances in Bioinformatics, Vol.2013. [35] Matthew James Kelley. Terahertz time domain spectroscopy of amino acids and sugars. Dissertation (Ph.D.), California Institute of Technology, March 2013. [36] Vsevolod Kharyton, Ronnie Bladh. Using Tiptiming and Strain Gauge Data for the Estimation of Consumed Life in a Compressor Blisk Subjected to Stall-Induced Loading. ASME Turbo Expo 2014: Turbine Technical Conference and Exposition, Vol.7B, June 16–20, 2014, Düsseldorf, Germany. [37] Hui Wang, Cancan Liu, Bing Zhu, Juanjuan Cai & Yutian Wang. Multi-pitch estimation based on correlation and spectrum analysis. ICCT, Future Communication Technology, 2014. [38] D. Krause, W. B. Hussein, M. A. Hussein, T. Becker. Ultrasonic sensor for predicting sugar concentration using multivariate calibration. Ultrasonics, 54(6), 1703-1712, Aug.2014. [39] Petre Stoica, Dave Zachariah, Jian Li. Weighted SPICE: A Unifying Approach for Hyperparameter-Free Sparse Estimation, Digital Signal Processing, Vol.33, pp.1-12, Oct.2014. The extended summary of the doctoral thesis in Computer Science 30 Dr.sc.comp. Vilnis Liepiņš Email: [email protected] [40] D.T. Michel, A.K. Davis, W. Armstrong, R. Bahr, R. Epstein, V.N. Goncharov, M. Hohenberger, I.V. Igumenshchev, R.Jungquist, D.D. Meyerhofer, P.B. Radha, T.C. Sangster, C. Sorce and D.H. Froula. Measurements of the ablationfront trajectory and low-mode nonuniformity in direct-drive implosions using x-ray self-emission shadowgraphy. High Power Laser Science and Engineering, Vol.3, E19, July 2015. [41] Jan Kober, Zdenek Prevorovsky, Milan Chlada. In situ calibration of acoustic emission transducers by time reversal method. Sensors and Actuators A: Physical, Vol.240, pp.50–56, April 2016. [42] Stephanie Tsuei, Mark B. Milam. Trajectory generation for constrained differentially flat systems with time and frequency domain objectives. IEEE 55th Conference on Decision and Control (CDC), pp.4172-4177, Dec.2016. [43] L.Luzi, A.Stevens, H.Yang, M.D.Browning. Resolution Versus Error for Computational Electron Microscopy. Microscopy and Microanalysis, 23(S1), pp.88-89, August 2017. The extended summary of the doctoral thesis in Computer Science 31
8cs.DS
Ramanujan Graphs in Polynomial Time arXiv:1604.03544v1 [cs.DS] 12 Apr 2016 Michael B. Cohen M.I.T. [email protected] April 13, 2016 Abstract The recent work [MSS15a] by Marcus, Spielman and Srivastava proves the existence of bipartite Ramanujan (multi)graphs of all degrees and all sizes. However, that paper did not provide a polynomial time algorithm to actually compute such graphs. Here, we provide a polynomial time algorithm to compute certain expected characteristic polynomials related to this construction. This leads to a deterministic polynomial time algorithm to compute bipartite Ramanujan (multi)graphs of all degrees and all sizes. Note: after writing this paper, the author became aware that others have independently produced this result, but does not know any specifics. 1 Introduction Bipartite Ramanujan graphs can be defined as undirected bipartite graphs with constant degree d such √ that all eigenvalues of the adjacency matrix, except the trivial ±d, have absolute value at most 2 d − 1. It is known that this is the smallest bound for which an infinite family–that is, a set of such graphs of degree d containing graphs of arbitrarily large size–can exist (originally due to Alon and Boppana). Explicit algebraic constructions, naturally providing polynomial time algorithms, of such graphs of certain particular degrees and sizes have been known since the 1980s. However, until recently it was not known whether infinite families of bipartite Ramanujan graphs existed for all degrees. Recent papers [MSS13a, MSS15a, HPS15], however, have proved the existence of these graphs for all degrees using a powerful new tool known as “interlacing families.” They proceed by bounding the roots of the expected characteristic polynomials of the adjacency matrices of certain random graphs, then showing that at least one specific graph must satisfy the same bound. This interlacing family method naturally provides an algorithm to find such a graph. Unfortunately, the steps of this natural algorithm involve computing certain partially specified expected characteristic polynomials. There were no known polynomial time algorithms to compute these, so none of these papers provided a polynomial time algorithm to compute Ramanujan graphs. In this paper, for [MSS15a] specifically, we provide a polynomial time algorithm to explicitly compute the needed polynomials by reducing to the computation of a certain symbolic determinant. This provides a polynomial time algorithm to compute the graphs from that paper. It inherits the mild caveat of [MSS15a] that the resulting graph may have repeated edges, producing what could be more properly called Ramanujan multigraphs. Additionally, it is still subject to the limitations of the interlacing polynomial method, which does not seem to easily allow producing non-bipartite Ramanujan graphs. Furthermore, this new algorithm does not seem likely to be helpful for [MSS13a] and some other uses of interlacing 1 families, such as the solution of the Kadison-Singer problem [MSS13b]. This is because it is an explicit algorithm for computing the polynomials in the interlacing family, which is known, in the cases of those results, to be #P-hard. 2 Interlacing Families The construction of [MSS15a] and the construction of this paper are heavily based on the notion of an interlacing family. We will use a slightly more general definition than is used in that paper, and the specific interlacing family will also be slightly different. Definition 1. An interlacing family is a rooted tree with a polynomial pk (x) assigned to each node k, such that: 1. All of the polynomials are monic, real-rooted and of the same degree. 2. For any non-leaf node k, pk is a positive linear combination of the polynomials assigned to the children of k. 3. If two nodes k and k ′ have the same parent, pk and pk′ have a common interlacing. That is, the (j + 1)st root of pk is not less than the jth root of pk′ or vice versa. For convenience, we will refer to tree nodes in the interlacing family as “nodes” and vertices of the graph as “vertices”. The relevance of interlacing families stems from the following key lemma (a rephrasing of Lemma 4.2 from [MSS13a]). Lemma 2.1. Let the real-rooted polynomials pi (x) all have the same leading term with each pair of polynomials having a common interlacing, and let p(x) be a positive linear combination of the pi . Then at least one of the pi (x) must have max root less than or equal to the max root of p(x). This allows one to obtain both existential and computational results from interlacing families: Lemma 2.2. For any interlacing family with root r, there is a leaf node l such that pl has max root less than or equal to that of pr . Proof. For any non-leaf node k, k must have a child i such that the max root of pi is less than or equal to the max root of pk , by Lemma 2.1. We can then consider the following process: begin with k = r. As long as k is not a leaf, replace k with the child i of k such that pi has minimum max root. Once k is a leaf, terminate and return k. The max root of the current node k is monotonically decreasing as this process progresses, so this always returns a leaf node with max root less than or equal to that of pr . Now we consider a computational version of this statement. We define a computational representation as a polynomial-time algorithm to exactly compute the coefficients of each polynomial pk (expressed as rational numbers, with a polynomially bounded number of bits), plus a polynomial time algorithm to list all children of a node. √ First, we will need an algorithm to test whether the max root of a polynomial is at most q, for some integer q. Lemma 2.3. Let p be a real-rooted polynomial with explicitly given rational coefficients, and q be √ an integer. Then one can test whether the max root of p is ≤ q in polynomial time. 2 √ Proof. We compute the polynomial p′ (x) = p(x + q); we can compute the coefficients of this √ √ explicitly in the form a + b q (i.e. work over Q[ q]), where a and b are rational numbers. p then √ has max root ≤ q if and only if p′ has max root ≤ 0 (that is, all of its roots are non-positive). Since p′ is real-rooted (as p is real-rooted), this occurs if and only if all coefficients of p are nonnegative: ′ the “if” direction follows from the fact that nonnegative coefficients imply Q that p (x) > 0 for all ′ x > 0, while the “only if” direction follows from the factorization p (x) = roots y (x − y). Finally, √ it remains to be able to determine whether a + b q ≥ 0 for rational numbers a and b. Here, if a √ and b have the same sign this is immediate. If a and b have opposite signs, then a + b q ≥ 0 if and √ only if a ≥ −b q. Squaring both sides, we see that this in turn is true if and only if a2 ≥ b2 q when a is positive, or a2 ≤ b2 q if a is negative. Lemma 2.4. For any interlacing family root r, with polynomially bounded depth and a computa√ tional representation, and where pr has max root at most q for some integer q, then there is a √ polynomial time algorithm to report a leaf l such that pl has max root ≤ q. Proof. The proof is essentially the same. Again, we track a “current” node k, which is initialized √ to r; we will maintain the invariant that the max root of pk is at most q. As long as k is not a leaf, we list its children i, and compute pi for each. Next, we test whether each of these pi has max √ root ≤ q using Lemma 2.3. By Lemma 2.1, at least one of these children must have max root at √ most q; we then set k to this child, maintaining the invariant. Once k is a leaf, we terminate and return it. The total number of iterations is at most the depth of the tree. 3 The Matching Interlacing Family Our aim is to use an interlacing family to find a bipartite Ramanujan graph of degree d on n vertices. Here, we are interested in obtaining a graph whose adjacency matrix has bounded max nontrivial eigenvalue–we crucially use the fact that the eigenvalues of the adjacency matrix of a bipartite graph √ d − 1, the are symmetric around 0, and thus if the maximum nontrivial eigenvalue is at most 2 √ minimum is at least −2 d − 1 and the graph is Ramanujan. To get this out of an interlacing family, we would like the leaves of that family to correspond to the characteristic polynomials, divided by the factors from the trivial eigenvalues, of the adjacency matrices of d-regular bipartite graphs on n vertices. We will construct such an interlacing family, which we will call the Matching Interlacing Family. This family is slightly different from the one presented in [MSS15a], since that one has an exponentially deep tree and so is not directly suitable for algorithmic use. To get this, we will look at the combination of d perfect bipartite matchings. We index the vertices of the graph so that vertices 1 through n2 are on one side of the bipartition and vertices n 2 + 1 through n are on the other. Then we define a partially specified matching as a bipartite matching that matches vertices 1 through t, for some 0 ≤ t < n2 , and does not match any vertices from t + 1 through n2 . Then we will define a node in our family as corresponding to a sequence of r bipartite matchings, for r ≤ d, such that all except the last are complete and the last is either a complete bipartite matching or a partially specified matching. The children of a node are those that add the next unmatched vertex to the partially specified matching, or begin a new partially specified matching (matching vertex 1) if the last matching is complete. The leaves are sequences of d perfect matchings, which combine to a d-regular bipartite graph on n vertices. 3 For each node in the interlacing family, we furthermore view it as corresponding to a probability distribution over d-regular bipartite graphs on n vertices. This is simply uniformly randomly completing the partially specified matching if present, then adding d−r uniformly random complete bipartite matchings. It may be immediately seen that the probability distribution assigned to a node is the average of the distributions assigned to its children, and the root is the combination of d random bipartite graphs. Finally, we define the polynomial assigned to a node as the expected characteristic polynomial, over the distribution of graphs associated with the node, of the adjacency matrix, divided by the factors from the trivial eigenvalues (x + d)(x − d). Lemma 3.1. The Matching Interlacing Family is an interlacing family. The proof of this lemma depends on several results from [MSS15a]: Lemma 3.2 (The second part of Lemma 2.2 from [MSS15a]). Two monic real-rooted polynomials of the same degree, p1 and p2 , have a common interlacing if and only if all convex combinations of p1 and p2 are real-rooted. Theorem 3.1 (Theorem 3.3 from [MSS15a]). Let Ai be arbitrary deterministic symmetric d × d matrices, and let Sij be independent random swap matrices (that is, Sij swaps two indices sij and tij with some probability αij , and is the identity with probability 1 − αij ). Then the expected characteristic polynomial of the random matrix    T Ni Ni X Y Y  Sij  Ai  Sij  i j=1 j=1 is real-rooted. Lemma 3.3 Q(Lemma 3.5 from [MSS15a]). A uniformly random permutation matrix P can be expressed as N j=1 Sj , where Sj are independent random swap matrices (in the same sense as in Theorem 3.1). Proof of Lemma 3.1. Since the distribution associated with a non-leaf node is the average of the distribution of its children, it immediately follows that the polynomial associated with a nonleaf node is the average (which is, in particular, a positive linear combination) of the polynomials associated with its children. All of the characteristic polynomials are of n×n matrices, so they all are all monic polynomials of the same degree. It remains to show that the polynomials are real-rooted and that any two siblings: that is, the same sequences of matchings followed by partially specified matchings differing only in the assignment of the last matched vertex, are assigned polynomials with a common interlacing. To do this, we first note that interlacing and real-rootedness is not affected by dividing out the terms from the trivial eigenvalues, since that always removes the same real roots from all polynomials. Therefore, we just need to show that the expected characteristic polynomials themselves are real-rooted and interlacing for siblings. We note that we can write the random adjacency matrix for a node k as ! d r−1 X X k k T k k T Pi M PiT + Pr M (Pr ) + Pi M (Pi ) i=r+2 i=1 where M is an arbitrary bipartite matching, Pik for i < r are deterministic permutation matrices that permute it into the already-selected complete matchings, Prk is a partially random permutation 4 providing the matched edges and the remaining random edges, and Pi for i > r are uniformly random permutations. We may apply Lemma 3.3 to express Prk as a product of independent random swaps times a deterministic matrix and Pi for i > r as a product of independent random swaps. This puts it in the form needed to apply Theorem 3.1, implying that this expected characteristic polynomial is real-rooted. To get the interlacing, we note that for any sibling node k′ , we may express its random adjacency matrix as ! d r−1 X X k k T T k k T Pi M PiT + SPr M (Pr ) S + Pi M (Pi ) i=r+2 i=1 where S is a deterministic swap matrix that simply swaps the two different partners of the last matched node in the siblings. Any convex combination with the sibling then can be expressed as an expected characteristic polynomial of the same form, except with S now a random swap matrix with some probability. We can then apply Lemma 3.3 and Theorem 3.1 in the same manner as before, showing that any convex combination of the expected characteristic polynomials for two siblings is real-rooted. Finally, by Lemma 3.2, this means the two siblings have a common interlacing. Furthermore, the root node of the Matching Interlacing Family is the expected characteristic polynomial of the combination of d uniformly random complete bipartite matchings on n vertices, √ divided by the trivial factors. It is proved in [MSS15a] that this has max root bounded by 2 d − 1. Therefore, Lemma 2.4, applied to this interlacing family, would produce a bipartite Ramanujan graph. However, this requires a computational representation. Using an explicit representation of the matchings to index the nodes, the ability to efficiently list the children is immediate. What remains is to give a polynomial-time algorithm to compute the needed expected characteristic polynomial (the naive algorithm, simply summing over all possible assignments, is far from being polynomial time). 4 Simplifying the Problem Fortunately, we can substantially simplify the polynomial computation problem here. First, consider an arbitrary c-regular bipartite graph G, and let G′ be G plus a uniformly random bipartite matching. Now, we note that Theorem 4.10 of [MSS15a] (proved via [MSS15b]) gives a formula for the expected characteristic polynomial of the adjacency matrix of of G′ in terms of the characteristic polynomial of G itself. Furthermore, for any fixed degree, this formula is linear –it expresses the coefficients of the expected characteristic polynomial of G′ as linear combinations of the coefficients of the characteristic polynomial of G–and directly allows computation in polynomial time. By linearity of expectation, even if G itself is a random graph, as long as it has known constant degree the expected characteristic polynomial of G′ can be computed from the expected characteristic polynomial of G. This means that to compute the expected characteristic polynomial of the distribution of graphs associated with a node of the Matching Interlacing Family, it suffices to be able to do it in the case where the partially specified matching is the last one. We can always simply take the expected characteristic polynomial for the graph consisting of the first r matchings only, then linearly transform this to account for the d − r remaining uniformly random matchings. This amounts to taking the expected characteristic polynomial of a bipartite graph (the complete matchings plus the edges already selected in the partially specified matching) plus a random bipartite matching precisely covering some given subset of the vertices (which will be the unmatched 5 vertices from the partially specified matching). This is the expected characteristic polynomial of a random matrix of the form   0 (A + PB ) (A + PB )T 0 where A is a fixed matrix and PB is a random permutation on some sub-block B (with rows and columns corresponding to unmatched vertices on both sides), and zero outside the block. Next, we note that one can perform the quadrature argument from [MSS15a]. We perform orthogonal changes of basis to the rows and columns of A + PB (which always preserves the characteristic polynomial of interest) that keep the block structure of B, but transform the all-ones vector within the block to a basis vector. This isolates the non-mean-zero part of the permutation matrix, as in [MSS15a]’s quadrature. We may fold that part into A, asking for the expected characteristic polynomial of   0 ( + P̂B̂ ) ( + P̂B̂ )T 0 where  is the change of variables applied to A + E[PB ], and P̂B̂ is the change of variables applied to PB − E[PB ] (noting that E[PB ] is precisely the part of PB aligned with the all-ones vector on the block). We define B̂ as the containing the directions from B orthogonal to the all-ones vector. B̂ is (l − 1)-dimensional if B was l-dimensional. Note that P̂B̂ are not actually permutation matrices in that block, but the result of a change of variables of a permutation matrix (minus its all-ones component) in the original basis. More specifically, consider the unit basis vectors ei in the original block B. If we project off their component in the direction of the all-ones vector, then apply √ the change of variables, we get a regular simplex of l vectors êi , with all pairs at distance exactly 2 centered at the origin, in Rl−1 . P̂B̂ is then a linear transformation that randomly permutes the êi (while acting as the identity outside the block B̂). Now, we have the main quadrature result: Theorem 4.1. Let M be an arbitrary n × n symmetric matrix, and let P̂B̂ be a random matrix that randomly permutes the vertices of an l − 1-dimensional regular simplex, centered at 0, within an l − 1-dimensional block B̂, while acting as the identity outside B̂. Then the expected characteristic polynomial of ! 0 P̂B̂ M+ P̂B̂T 0 is equal to the expected characteristic polynomial of   0 QB̂ M+ QTB̂ 0 where QB̂ is a Haar-random (i.e. uniformly random) orthogonal matrix on the block B̂. This implies that we can instead ask for the expected characteristic polynomial of   0 ( + QB̂ ) ( + QB̂ )T 0 Finally, we note that this is a symmetric block-off-diagonal matrix, allowing us to apply the following lemma: 6 Lemma 4.1. Given a square matrix M , let p be the characteristic polynomial of the block-offdiagonal matrix   0 M N= MT 0 and p′ be the characteristic polynomial of M T M . Then p(x) = p′ (x2 ). Proof. This follows from the fact that the eigenvalues of N can be placed in correspondence to √ those of M T M : an eigenvalue of y in M T M corresponds to two eigenvalues ± y in N . That in √ √ turn means that each factor (x − y) of p′ becomes a factor (x + y)(x − y) = (x2 − y) in p. That means that our characteristic polynomial could be obtained by taking the characteristic polynomial of ( + QB̂ )T ( + QB̂ ) and replacing x with x2 . Since this is again a linear map on the coefficients, the expected characteristic polynomial of the block off-diagonal matrix can also be obtained by applying this transformation to the expected characteristic polynomial of ( + QB̂ )T ( + QB̂ ). Computing expected characteristic polynomials for matrices of that form is therefore sufficient. 5 Computing the Expected Characteristic Polynomial The (n/2− k)th coefficient of the characteristic polynomial of an (n/2)× (n/2) matrix Z T Z is equal to (−1)n/2−k times the sum of squares of all k × k minors of Z. For Z =  + QB̂ , we can express this sum as X det(( + QB̂ )U,V )2 U,V s.t. |U |=|V |=k where U and V are subsets of rows and columns, respectively, and MU,V is the submatrix of M containing the rows in U and the columns in V . By the multilinearity of the determinant, we may write X det(( + QB̂ )U,V ) = sign(U, V, U ′ , V ′ ) det(ÂU ′ ,V ′ ) det((QB̂ )U \U ′ ,V \V ′ ) U ′ ⊆U,V ′ ⊆V,|U ′ |=|V ′ | where sign(U, V, U ′ , V ′ ) is ±1 depending on the sets. We may then look at the expected value of the square of this determinant: EQB̂ [det(( + QB̂ )U,V )2 ] = X U ′ ⊆U,V ′ ⊆V,|U ′ |=|V ′ |, U ′′ ⊆U,V ′′ ⊆V,|U ′′ |=|V ′′ | sign(U, V, U ′ , V ′ ) sign(U, V, U ′′ , V ′′ ) det(ÂU ′ ,V ′ ) det(ÂU ′′ ,V ′′ ) EQB̂ [det((QB̂ )U \U ′ ,V \V ′ ) det((QB̂ )U \U ′′ ,V \V ′′ )] ! Luckily, whenever U ′ 6= U ′′ or V ′ 6= V ′′ , at least one row or column of (QB̂ )U \U ′ ,V \V ′ or (QB̂ )U \U ′′ ,V \V ′′ is a symmetric random variable conditioned on the other one, and so EQB̂ [det((QB̂ )U \U ′ ,V \V ′ ) det((QB̂ )U \U ′′ ,V \V ′′ )] = 0 We can then write the expected value as EQB̂ [det(( + QB̂ )U,V )2 ] = X EQB̂ [det((QB̂ )U \U ′ ,V \V ′ )2 ] det(ÂU ′ ,V ′ )2 U ′ ⊆U,V ′ ⊆V,|U ′ |=|V ′ | 7 We define fB̂ (U, V, U ′ , V ′ ) = EQB̂ [det((QB̂ )U \U ′ ,V \V ′ )2 ]. If U \ U ′ or V \ V ′ is not contained within the block B̂, (QB̂ )U \U ′ ,V \V ′ includes a zero row or column, so fB̂ (U, V, U ′ , V ) = 0 Otherwise, fB̂ (U, V, U ′ , V ′ ) =  1 ˆl |U | − |U ′ |  by a symmetry argument (where ˆl is the dimension of the block B̂). The expected value of the sum of the squares of all of the k × k minors is then   X X  f (U, U ′ , V, V ′ ) det(ÂU ′ ,V ′ )2  B̂ U,V s.t. |U |=|V |=k U ′ ⊆U,V ′ ⊆V,|U ′ |=|V ′ | Switching the order of summation, we can write it as  X X  U ′ ,V ′ s.t. |U ′ |=|V ′ | U,V s.t. U ′ ⊆U,V ′ ⊆V,|U |=|V |=k But now we can note that X fB̂ (U, U ′ , V, V ′ ) =  fB̂ (U, U ′ , V, V ′ ) det(ÂU ′ ,V ′ )2 ˆ c (V ′ ) r (U ′ )ˆ l − OB̂ l − OB̂ U,V s.t. U ′ ⊆U,V ′ ⊆V,|U |=|V |=k k − |U ′ |  k − |U ′ |  ˆl k − |U ′ | r (U ′ ) gives the number of rows in U ′ contained in B̂ where ˆl is the dimension of the block B̂, OB̂ c (V ′ ) is analogous with columns. This follows simply follows from counting the number of and OB̂ choices of U and V for which fB̂ (U, U ′ , V, V ′ ) is nonzero (precisely those U and V that make U \ U ′ and V \ V ′ fully contained in the block B̂), combined with the value of f when it is nonzero. We define ˆ  ˆ  l−p l−q k − k′ k − k′ g(ˆl, k, k′ , p, q) =  ˆ  l k − k′ We may then write the expected sum of the squares of the k × k minors as   X k ′ ,p,q   g(ˆl, k, k′ , p, q)   X U ′ ,V ′ s.t. |U ′ |=|V ′ |=k ′ , O r (U ′ )=p,O c (V ′ )=q B̂ B̂ 8   det(ÂU ′ ,V ′ )2   That is, we can compute the coefficients of our expected characteristic polynomial as linear functions in the values     Ck′ ,p,q =   X U ′ ,V ′ s.t. |U ′ |=|V ′ |=k ′ , O r (U ′ )=p,O c (V ′ )=q B̂ B̂   det(ÂU ′ ,V ′ )2   r and O c , It remains to be able to compute these values. Note that without the constraints of OB̂ B̂ this would just be a sum of squared minors of a particular size, which correspond to the coefficients of the characteristic polynomial of ÂT Â. When B̂ covers the entire matrix, they must simply be equal to k′ , so the expected characteristic polynomial can therefore be computed using only the characteristic polynomial of ÂT  itself. That makes sense as that is a special case of a finite free convolution from [MSS15b]. This does not work when B̂ does not cover the whole matrix. However, we can introduce a trivariate determinant polynomial, extending the standard characteristic polynomial P (λ, tr , tc ) = det(ÂT ((I − DrB̂ ) + tr DrB̂ )Â((I − DcB̂ ) + tc DcB̂ ) + λI) where DrB̂ is the diagonal matrix with ones in the rows in B̂ and zeroes in the others, and DcB̂ ′ the same for the columns in B̂. The coefficient of this trivariate polynomial on λ(n/2−k ) tpr tqc now provides precisely the value Ck′ ,p,q that we are looking for. One way to see this is to note that that for fixed tr , tc , it is det(ĀT Ā + λI), where Ā is  with √ √ ′ the rows in B̂ multiplied by tr and the columns in B multiplied by tc . The λ(n/2−k ) coefficient of that polynomial is the sum of the squares of the k′ × k′ minors of Ā. The extra multiplications √ √ by tr and tc multiply the contribution of a minor with p rows and q columns overlapping the ′ block by by tpr and tqc . Thus each such minor has its contribution overall scaled by λ(n/2−k ) tpr tqc . Furthermore, as there are only a constant number of variables and the matrix is only constant degree in each, we can simply evaluate the determinant of this symbolically in polynomial time. This gives us polynomial time computation of the needed expected characteristic polynomials and therefore, by Lemma 2.4, the Ramanujan graphs. 6 Acknowledgements The author thanks Jonathan Kelner, Daniel Spielman, and Nikhil Srivastava for helpful discussions. This work was supported by National Science Foundation award 1111109. References [HPS15] Chris Hall, Doron Puder, and William F Sawin. Ramanujan coverings of graphs. arXiv preprint arXiv:1506.02335, 2015. [MSS13a] A. Marcus, D. A. Spielman, and N. Srivastava. Interlacing families i: Bipartite ramanujan graphs of all degrees. In Foundations of Computer Science (FOCS), 2013 IEEE 54th Annual Symposium on, pages 529–537, Oct 2013. [MSS13b] Adam Marcus, Daniel A Spielman, and Nikhil Srivastava. Interlacing families ii: Mixed characteristic polynomials and the kadison-singer problem. arXiv preprint arXiv:1306.3969, 2013. 9 [MSS15a] A. W. Marcus, D. A. Spielman, and N. Srivastava. Interlacing families iv: Bipartite ramanujan graphs of all sizes. In Foundations of Computer Science (FOCS), 2015 IEEE 56th Annual Symposium on, pages 1358–1377, Oct 2015. [MSS15b] Adam Marcus, Daniel A Spielman, and Nikhil Srivastava. Finite free convolutions of polynomials. arXiv preprint arXiv:1504.00350, 2015. A Quadrature argument Theorem 4.1. Let M be an arbitrary n × n symmetric matrix, and let P̂B̂ be a random matrix that randomly permutes the vertices of an l − 1-dimensional regular simplex, centered at 0, within an l − 1-dimensional block B̂, while acting as the identity outside B̂. Then the expected characteristic polynomial of ! 0 P̂B̂ M+ P̂B̂T 0 is equal to the expected characteristic polynomial of   0 QB̂ M+ QTB̂ 0 where QB̂ is a Haar-random (i.e. uniformly random) orthogonal matrix on the block B̂. We will work up to the proof of this theorem, using results from [MSS15a]. Now we consider a random matrix P̂ijk which randomly permutes three vectors, êi , êj , and êk , forming a standard simplex, while leaving all vectors orthogonal to êj − êi and êk − êi unaffected. Similarly, we look at Qijk which is a random rotation on the two-dimensional subspace spanned by êj − êi and êk − êi . [MSS15a] gives us a very useful result about these matrices: Lemma A.1 (Corollary 4.6 of [MSS15a]). For any fixed symmetric matrices A, B, the expected T is equal to that of A + Q BQT . characteristic polynomial of A + P̂ijk B P̂ijk ijk ijk That in turn implies Lemma A.2. Let X be the random matrix 0 P̂B̂T P̂B̂ 0 ! . (0) and let Qijk be any orthogonal matrix acting within the span of êj − êi and êk − êi (in the upper n/2 × n/2 block of the n × n matrix). Then for any fixed matrix M , the expected characteristic (0) (0) polynomial (over X) of (Qijk )T M Qijk + X is equal to that of M + X. (0) (0) Proof. We first note that the expected characteristic polynomial of (Qijk )T M Qijk + X is equal to that of (taking the expectation over X and Pijk ) (0) (0) T (Qijk )T M Qijk + P̂ijk X P̂ijk since the extra Pijk leaves the probability distribution of X unchanged. Now, applying Lemma A.1, this is the same as the expected characteristic polynomial of (0) (0) (Qijk )T M Qijk + Qijk XQTijk 10 Using invariance of the characteristic polynomial under conjugation, this is the same as the expected characteristic polynomial of (0) (0) M + Qijk Qijk XQTijk (Qijk )T which has the same distribution as M + Qijk XQTijk Finally, applying Lemma A.1 again, we get the expected characteristic polynomial of T M + P̂ijk X P̂ijk which has the same probability distribution as M + X, as desired. Now we pull in another result from [MSS15a]: (0) Lemma A.3 (Lemma 4.7 of [MSS15a]). Matrices of the form of Qijk –that is, orthogonal transformations affecting only the plane spanned by some three vertices of our simplex êi , êj , and êk – generate the group of all orthogonal transformations within B̂. In other words, any orthogonal matrix in B̂ can be expressed as a product of a finite number of matrices of this type. Putting this together we get Lemma A.4. For any orthogonal matrix Q(0) on the block B̂, the expected characteristic polynomial of M + Q(0) X(Q(0) )T is equal to the expected characteristic polynomial of M + X Proof. First, use the invariance of the characteristic polynomial under conjugation to express this as the expected characteristic polynomial of (Q(0) )T M Q(0) (0) Then applying Lemma A.3 expresses Q(0) as a product of matrices of the type of Qijk . However, Lemma A.2 says that conjugating M by any of these matrices does not affect the expected characteristic polynomial; thus, iterating it implies that conjugating M by any product of these matrices does not affect it, so the expected characteristic polynomial is that that of M + X, as desired. Finally, we may prove Theorem 4.1: Proof of Theorem 4.1. The probability distribution of   0 QB̂ QTB̂ 0 is the same as    T QB̂ 0 QB̂ 0 X 0 I 0 I since multiplying by QB̂ will turn any fixed orthogonal matrix into a random orthogonal matrix. But by Lemma A.4, for any fixed value of QB̂ ,   T QB̂ 0 QB̂ 0 M+ X 0 I 0 I  11 has the same expected characteristic polynomial (randomizing over only X) as M + X. Thus this must still be true for random QB̂ , implying that  0 QB̂ M+ QTB̂ 0  has the same expected characteristic polynomial as M + X, as desired. 12
8cs.DS
1 Distributed Fictitious Play for Optimal Behavior of Multi-Agent Systems with Incomplete Information arXiv:1602.02066v1 [cs.GT] 5 Feb 2016 Ceyhun Eksin and Alejandro Ribeiro Abstract—A multi-agent system operates in an uncertain environment about which agents have different and time varying beliefs that, as time progresses, converge to a common belief. A global utility function that depends on the realized state of the environment and actions of all the agents determines the system’s optimal behavior. We define the asymptotically optimal action profile as an equilibrium of the potential game defined by considering the expected utility with respect to the asymptotic belief. At finite time, however, agents have not entirely congruous beliefs about the state of the environment and may select conflicting actions. This paper proposes a variation of the fictitious play algorithm which is proven to converge to equilibrium actions if the state beliefs converge to a common distribution at a rate that is at least linear. In conventional fictitious play, agents build beliefs on others’ future behavior by computing histograms of past actions and best respond to their expected payoffs integrated with respect to these histograms. In the variations developed here histograms are built using knowledge of actions taken by nearby nodes and best responses are further integrated with respect to the local beliefs on the state of the environment. We exemplify the use of the algorithm in coordination and target covering games. I. I NTRODUCTION Our model of a multi-agent autonomous system encompasses an underlying environment, knowledge about the state of the environment that the agents acquire, and a state dependent global objective that agents affect through their individual actions. The optimal action profile maximizes this global objective for the realized environment’s state with the optimal action of an agent given by the corresponding action in the profile. The problem addressed in this paper is the determination of suitable actions when the probability distributions that agents have on the state of the environment are possibly different. These not entirely congruous beliefs result in mismatches between the action profiles that different agents deem to be optimal. As a consequence, when a given agent chooses an action to execute, it is important for it to reason about what the beliefs of other agents may be and what are the consequent actions that other agents may take. We propose a solution based on the construction of empirical histograms of past actions and the use of best responses to the utility expectation with respect to these histograms and the state belief. This algorithmic behavior is shown to be asymptotically optimal in the sense that if agents move Work supported by the NSF award CAREER CCF-0952867 and the AFOSR MURI FA9550-10-1-0567. C. Eksin is with the School of Electrical and Computer Engineering and School of Biology at the Georgia Institute of Technology, Atlanta, GA 30332. A. Ribeiro is with the Department of Electrical and Systems Engineering, University of Pennsylvania, Philadelphia, PA 19104. Email: [email protected]. towards a common belief, the actions they select are optimal with respect to the corresponding expected utility. While the determination of optimal behavior in multiagent systems can be considered from different perspectives, the categorization between systems with complete and incomplete information is most germane to this paper [1]. In systems of complete information the environment is either perfectly known or all agents have identical beliefs. In either case, agents can compute the optimal action profile, and determine and execute their corresponding optimal action. This local computation of global solutions is neither scalable nor robust but it can be used as an abstract definition of optimal behavior. This abstraction renders the problem equivalent to the development of distributed methodologies to solve optimization problems [2]–[5], or, more generically, to the determination of Nash equilibria of multiplayer games [6]–[11]. When information is incomplete, the fact that agents have different beliefs implies that they may end up choosing competing actions even if they are intent on cooperating. In a sense, agents are competing against uncertainty, but the manifestation of that competition is in the form of conflicting interests arising from cooperating agents. In this inherent competition Bayesian Nash equilibria are the intrinsic mathematical formulation of optimal behavior [12], [13]. However, determination of these equilibria is computationally intractable except for games with simple beliefs and utilities [14], [15]. If determination of Bayesian equilibria is intractable, the development of approximate methods is necessary. In fact, determining game equilibria is also challenging in games of complete information. This has motivated the development of iterative methods to learn regular – as opposed to Bayesian – equilibrium actions [11], [16]. Of relevance to this paper is the fictitious play algorithm in which agents build beliefs on others’ future behavior by computing histograms of past actions and best respond to their expected payoffs integrated with respect to these histograms [17]. When information is complete, fictitious play converges to equilibria of zero sum [16], some other specific games with two players [18], and multiplayer games with aligned interests as determined by a potential function [6]. Recent variations of fictitious play have been developed to expand the class of games for which equilibria can be computed [9], [19] and to guarantee convergence to equilibria with specific properties [8], [20], [21]. Recently, a variant of the fictitious play that operates in a distributed setting where agents observe relevant information from agents that are adjacent in a network is shown to converge in potential games [7]. 2 In this paper, we consider a network of agents with aligned interests. Agents have different and time varying beliefs on the state of the environment that, as time progresses, converge to a common belief. The asymptotic optimal behavior is therefore formulated as the Nash equilibria of the potential game defined by the expected utility with respect to the asymptotic belief. The goal is to design a distributed mechanism that converges to a Nash equilibrium of this asymptotic game (Section II). The solutions that we propose are variations of the fictitious play algorithm that take into account the distributed nature of the multi-agent system and the fact that the state of the environment is not perfectly known. In a game of incomplete information, expected payoff computation in fictitious play consists of integrating the payoff with respect to both the local belief on the state of the environment and the local beliefs on the behavior of other agents. In a networked setting only local past histories can be available and agents need to reason about the behavior of non-neighboring agents based on past observations of its neighbors only. In potential games with symmetric payoffs, which are known to admit consensus Nash equilibria, we let agents share their actions with their neighbors, construct empirical histograms of the actions taken by neighbors, and best respond assuming that all agents follow the average population empirical distribution (Section III). This mechanism is shown to converge to a consensus Nash equilibrium when the convergence of individual beliefs on the state of the environment is at least of linear order (Theorem 1). When the potential game is not necessarily symmetric, agents share their empirical beliefs on the behavior of other agents with neighbors in addition to their own actions. Agents keep histograms on the behavior of others by averaging the histograms of neighbors with their own (Section IV). Convergence to a Nash equilibrium follows under the same linear convergence assumption for the beliefs on the state of the environment (Theorem 2). We numerically analyze the transient and asymptotic equilibrium properties of the algorithms in the beauty contest and the target covering games (Section V). In the beauty contest game, a team of robots tradeoffs between moving toward a target direction and moving in coordination with each other. In the target covering game, a team of robots coordinates to cover a given set of targets and receive payoffs from covering a target that is inversely proportional to the distance to their positions. We observe that Nash equilibrium strategies are successfully determined in both cases. Notation: For any finite set X, we use 4(X) to denote the space of probability distributions over X. For a generic vector x ∈ X n , xi denotes the ith element and x−i denotes the vector of elements of x except the ith element, that is, x−i = (x1 , . . . , xi−1 , xi+1 , . . . , xn ). We use k · k to denote the Euclidean norm of a space. 1n denotes a n × 1 column vector of all ones. II. O PTIMAL BEHAVIOR OF MULTI - AGENT SYSTEMS WITH INCOMPLETE INFORMATION We consider a group of n agents i ∈ N := {1, . . . , n} that play a stage game over a discrete time index t with simultaneous moves and incomplete information. The important features of this game are the actions ait that agents take at time t, an underlying unknown state of the world θ, local utility functions ui (a, θ) that determine the payoffs that different agents receive when the group plays the joint action a := {a1 , . . . , an } and the state of the world is θ, and time varying local beliefs µit that assign probabilities to different realizations of the state of the world. We assume that the state of the world is chosen by nature from a space Θ and that actions are chosen from a common, finite, and time invariant set so that we have ait ∈ A := {1, . . . , m} for all times t and agents i. Local payoffs are then formally defined as functions ui : An × Θ → R. To emphasize the global dependence of local payoffs we write payoff values as ui (a, θ) = ui (ai , a−i , θ) where, we recall, a−i := {aj }j6=i collects the actions of all agents except i. We assume that the utility values ui (a, θ) are finite for all actions a and state realizations θ. The beliefs µit ∈ 4(Θ) are probability distributions on the space Θ. In general, we allow agent i to maintain a mixed strategy σi ∈ 4(A) defined as a probability distribution on the action space A such that σi (ai ) is the probability that i plays action ai ∈ A. The joint mixed strategy profile σ := {σ1 , . . . , σn } ∈ 4n (A) is defined as the product distribution of all individual strategies and the mixed strategy of all agents except i is written as σ−i := {σj }j6=i ∈ 4n−1 (A). The utility associated with the joint mixed strategy profile σ is then given by X ui (σ, θ) = ui (σi , σ−i , θ) = ui (a, θ)σ(a). (1) a∈An We further assume that there exists a global potential function u : An × θ 7→ R taking values u(a, θ) such that for all pairs of action profiles a = {ai , a−i } and a0 = {a0i , a−i }, state realizations θ ∈ Θ, and agents i, the local payoffs satisfy ui (ai , a−i , θ) − ui (a0i , a−i , θ) = u(ai , a−i , θ) − u(a0i , a−i , θ). (2) The existence of the potential function u is a statement of aligned interests because for a given θ the joint action that maximizes u is a pure Nash equilibrium strategy of the game defined by the ui utilities [6]. The motivation for considering a potential game is to model a system in which agents play to achieve the game equilibrium in a distributed manner and end up finding the action a that would be selected by a central coordination agent that maximizes the global payoff u. We emphasize, however, that the game may have other equilibria that are not optimal. The fundamental problem addressed in this paper is that the state of the world θ is unknown to the agents and that different agents have different beliefs µit on the state of the world. As a consequence, payoffs ui (a, θ) cannot be evaluated but estimated and, moreover, estimates of different 3 agents are different. To explain the implications of this latter observation consider the opposite situation in which the agents aggregate their individual beliefs in a common belief µ. In that case, the payoff estimate Z ui (σ; µ) := ui (σ, θ) dµ, (3) θ∈Θ can be evaluated by all agents if we assume that the payoff functions ui are known globally. Assuming global knowledge of payoffs is not always reasonable and it is desirable to devise mechanisms where agents operate without access to the payoff functions of other agents; see, e.g., [7]. Still, an important implication of considering the payoffs in (3) is that optimal behavior is characterized by Nash equilibria. Specifically, for the game defined by the utilities in (3), a Nash equilibrium at time t is a strategy profile σ ∗ such that no agent has an interest to deviate unilaterally given the common ∗ } such that for all belief µ. I.e., a strategy σ ∗ = {σi∗ , σ−i agents i it holds ∗ ∗ ui (σi∗ , σ−i ; µ) ≥ ui (σi , σ−i ; µ), (4) for all other possible strategies σi . Given the existence of the potential function u as stated in (2), the Nash equilibrium in (4) with the aggregate belief µ is a proxy R for the maximization of the global payoff u(a; µ) := θ∈Θ u(a, θ) dµ. In that sense, it represents the best action that the agents could collectively take if they all had access to common information. For future reference we use Γ(µ) to represent the game with players N , action space A and payoffs ui (a; µ), Γ(µ) := {N , An , ui (a; µ)} . (5) The game Γ(µ) is said to have complete information. When agents have different beliefs, the equilibrium strategies of (4) cannot be used as a target behavior because agents lack the ability to determine if a strategy σi that they may choose satisfies (4) or not. Indeed, while the complete information game serves as an omniscient reference, agents can only evaluate their expected payoffs with respect to their local beliefs µit , Z ui (σ; µit ) = ui (σi , σ−i ; µit ) = ui (σi , σ−i , θ) dµit . θ∈Θ (6) Comparing (3) and (6) we see that the fundamental problem of having different beliefs µit at different agents is that i lacks information needed to evaluate the expected payoff uj (σ; µjt ) of agent j and, for that reason, the game is said to have incomplete information. A way to circumvent this i lack of information is for agent i to keep a belief νjt on the strategy profile of player j. If we group these beliefs to i i define the joint belief ν−it := {νjt }j6=i that agent i has on the actions of others, it follows that agent i can evaluate the payoff he can expect of different strategies σi as Z i i ui (σi , ν−it ; µit ) = ui (σi , ν−it , θ) dµit . (7) θ∈Θ It is then natural to suggest that agent i should choose the strategy σi that maximizes the expected payoff in (7). Such strategy can always be chosen to be an individual action that i is termed the best response to the beliefs ν−it on the actions of others and the belief µit on the state of the world, i ait ∈ argmax ui (ai , ν−it ; µit ). (8) ai ∈A For future reference we also define the corresponding best expected utility that agent i expects to obtain at time t by playing the best response action in (8), i i vi (ν−it ; µit ) := max ui (ai , ν−it ; µit ). ai ∈A (9) i We emphasize that vi (ν−it ; µit ) is not the utility actually attained by agent i at time t. That utility depends on the actual state of the world and the actions actually taken by others and is explicitly given by ui (ait , a−it , θ). In this paper we consider agents that select best response actions as in (8) and focus on designing decentralized mechi on the actions of others anisms to construct the beliefs νjt so that the actions ait attain desirable properties. In particular, we assume that there is an underlying state learning process so that the local beliefs µit on the state of the world converge to a common belief µ in terms of total variation. I.e., we suppose that lim TV(µit , µ) = 0 for all i ∈ N , t→∞ (10) where the total variation distance TV(µit , µ) := supB∈B(Θ) |µit (B) − µ(B)| between distributions µit and µ is defined as the maximum absolute difference between the respective probabilities assigned to elements B of the Borel set B(Θ) of the space Θ. The desirable property that we ask of the process that i builds the beliefs νjt on the actions of others is that the actions ait approach one of the Nash equilibrium strategies defined by (4) as the distributions µit converge to the common distribution µ. The learning process that we propose i for the beliefs νjt is based on building empirical histograms of past plays as we explain in sections III and IV. We will show in sections III-A and IV-A that this procedure yields best responses that approach a Nash equilibrium as long as the convergence of µit to µ is sufficiently fast. We pursue this developments after a pertinent remark. Remark 1 The game of incomplete information defined by the payoffs in (6) has equilibria that do not necessarily coincide with the equilibria of the complete information game Γ(µ). It is easy to think that the best response ait in (8) yields the best possible utility ui for agent i. In fact, it is possible for agent i to do better by reasoning that other agents are also playing best response to their beliefs. Strategies that yield an equilibrium point of this strategic reasoning are defined as the Bayesian Nash equilibria of the incomplete information game – see [13], [15] for a formal definition. We utilize the best responses in (8) because determining Bayesian Nash equilibria requires global knowledge of payoffs and information structures. 4 a4t 4 a7t indicator Ψ(ait ) this empirical distribution is written as  n  t−1 1X 1 X ¯ ft := Ψ(ais ) . (12) n i=1 t − 1 s=1 a3t 7 3 ¯ti , µit fˆ a8t θ 8 1 6 2 a6t a2t 5 a5t Fig. 1. Distributed fictitious play with observation of neighbors’ actions. Agents form beliefs on the strategies of others by keeping a histogram of the average empirical distribution using the observations of actions of their ¯i of the average empirical neighbors. E.g., Agent 1 updates an estimate fˆ t distribution by observing the actions a2t−1 , a3t−1 , a4t−1 , a5t−1 played by agents 2, 3, 4, and 5 at time t − 1 [cf. (16)]. It then selects the best response in (8) which assumes all other agents are playing with respect to i = fˆ ¯i given its belief µit on the state θ. the mixed strategy νjt t III. D ISTRIBUTED FICTITIOUS PLAY IN SYMMETRIC POTENTIAL GAMES We begin by considering the particular case of symmetric potential games to illustrate concepts, methods, and proof techniques. In a symmetric game, agents’ payoffs are permutation invariant in that we have ui (ai , aj , a−i\j , θ) = uj (aj , ai , a−j\i , θ) for all pairs of agents i and j. It follows from this assumption that the game admits at least one consensus Nash equilibrium strategy and that, as a consequence, we can utilize a variation of fictitious play [6], [17] in which agents form beliefs on the actions of others by keeping a histogram of actions they have seen taken by other agents in past plays. Formally, let fit ∈ Rm×1 denote the empirical histogram of actions taken by i until time t and define the vector indicator function Ψ(ait ) = [Ψ1 (ait ), . . . , Ψm (ait )] : A → {0, 1}m such that the kth component is Ψk (ait ) = 1 if and only if ait = k and Ψk (ait ) = 0 otherwise. Given the definition of the vector indicator function Ψ(ait ) it follows that the empirical distribution fit of actions taken by i up until time t > 1 is j∈Ni In the distributed fictitious play algorithm considered here, agent i has access to the state belief µit and the estimate on the average empirical distribution fˆ¯ti in (13). Agent i proceeds to select the best response action ait that maximizes its expected payoff [cf. (8)] assuming that all other agents play with respect to the estimated average empirical distribution. I.e., the action played by agent i is computed as per (8) with i νjt = fˆ¯ti for all j 6= i. Observe that computation of the histograms in (11) - (13) does not require keeping the history of past plays ais for s < t. Indeed, the empirical distribution fit in (11) can be expressed recursively as  1 fit+1 = fit + Ψ(ait ) − fit , (14) t Likewise, we can also write the population’s empirical distribution f¯t in (12) recursively as  n  1 1X f¯t+1 = f¯t + Ψ(ajt ) − f¯t , (15) t n j=1 ¯i and the same rearrangement permits writing the estimate fˆ t that i keeps of the population’s empirical distribution as the recursion   1 1 X i fˆ¯t+1 = fˆ¯ti + Ψ(ajt ) − fˆ¯ti . (16) t |Ni | j∈Ni t−1 1 X fit := Ψ(ais ). t − 1 s=1 In conventional fictitious play, agents play best responses to the composite empirical distribution in (12). Here, however, we assume that agents are part of a connected network G with node set N and edge set E. Agent i can only interact with neighboring agents j ∈ Ni := {j ∈ N : (j, i) ∈ E}. At time t, the actions of neighboring agents j ∈ Ni become known to agent i either through explicit communication or implicit observation. In this setting, agent i cannot keep track of the empirical distribution in (12) because it only observes its neighbors’ actions aNi t := {ajt : j ∈ Ni } – see Fig. 1. What is possible for agent i to compute is an estimate of (12) utilizing the information it has available. This estimate is built by averaging the plays of neighbors so that if we write i’s estimate of f¯t as fˆ¯ti it follows that for t ≥ 2 it holds   t−1 1 X 1 X i ˆ ¯ Ψ(ajs ) . (13) ft = |Ni | t − 1 s=1 (11) The expression in (11) is simply a vector arrangement of the average number of times that each of the m possible plays k ∈ {1, . . . , m} has been chosen by i. Since the game, being symmetric, admits at least one symmetric Nash equilibrium, the histogram of the empirical play of the population as a whole is also of interest. Using the definition of the vector In all three cases the recursions are valid for t ≥ 1 and we have to make fi1 = f¯1 = fˆ¯1i = 0 for the recursions in (14) - (16) to be equivalent to (11) - (13). However, subsequent convergence analyses rely on (14) - (16) and allow for arbitrary initial distributions fˆ¯1i . This is important because, in general, agent i may have side information on the actions aj1 that other agents are to chose at time t = 1. We can now summarize the behavior of agent i as follows: 5 (i) At time t update the state’s belief to µit . (ii) Play i the best response action ait in (8) with νjt = fˆ¯ti for all j 6= i, (iii) Learn the actions ait of neighbors, either through ¯i as per (16) observation or communication, and update fˆ t+1 ˆ i ¯ – with the empirical histogram f1 initialized to an arbitrary distribution. We show in the following that when all agents follow this behavior, their strategies converge to a consensus Nash equilibrium of the symmetric potential game Γ(µ) [cf. (5)]. A. Convergence Game equilibria are not unique in general. Consider then the stage game Γ(µ) with a given common belief µ on the state of the world θ. The the set of Nash equilibria of the game Γ(µ) contains all the strategies that satisfy (4), ∗ K(µ) = {σ ∗ : ui (σ ∗ ; µ) ≥ ui (σi , σ−i ; µ), for all i, σi }. (17) In the distributed fictitious play process described by (8) and (16) agents assume that all other agents select actions from the same distribution. Therefore, it is reasonable to expect convergence not to an arbitrary equilibrium but to a consensus equilibrium in which all agents play the same strategy. Define then the set of consensus equilibria of the game Γ(µ) as the subset of the Nash equilibria set K(µ) defined in (17) for which all agents play according to the same strategy, C(µ) = {σ ∗ = {σ1∗ , . . . , σn∗ } ∈ K(µ) : σ1∗ = . . . = σn∗ }. (18) We emphasize that not all potential games admit consensus Nash equilibria, but the symmetric potential games considered in this section do have a nonempty set of consensus Nash equilibria; see e.g., [7]. We prove here that the best response actions in (8) are eventually drawn from a consensus equilibrium strategy if ¯i are updated according to the local empirical histograms fˆ t+1 (16) and the local state beliefs µit converge to the common belief µ in the sense stated in (10). In the proof of this result we make use of the following assumptions on the network topology and the state learning process. Assumption 1 The network G(N , E) is strongly connected. Assumption 2 For all agents i ∈ N , the local beliefs µit converge to a common belief µ at a rate faster than log t/t,   log t . (19) TV (µit , µ) = O t Assumption 1 is a simple connectivity requirement to ensure that the actions taken by any node eventually become known to all other agents. Assumption 2 requires that agents reach the common belief µ fast enough. This assumption is fundamental to subsequent proofs but is not difficult to satisfy – see Remark 2. We note that the common belief µ is an arbitrary belief on the state θ to which all agents converge but is not necessarily the optimal Bayesian aggregate of the information that different agents acquire about the state of the world. Validity of these two assumptions guarantees convergence of the best response actions in (8) as we formally state next. Theorem 1 Consider a symmetric potential game Γ(µ) and the distributed fictitious play updates where at each stage i ¯i for agents best respond as in (8) with local beliefs νjt = fˆ t all j 6= i formed using (16) and belief µit . If Assumptions 1 and 2 are satisfied and the initial estimated average beliefs are the same for all agents, i.e., if fˆ¯1i = fˆ¯1j for all i ∈ N and j ∈ N , then the average empirical distribution f¯t ∈ 4(A) converges to a strategy that is an element σi∗ ∈ 4(A) of a strategy profile σ ∗ ∈ 4n (A) that belongs to the set of consensus Nash equilibria C(µ) of the symmetric potential game Γ(µ). I.e., lim kf¯t − σi∗ k = 0 t→∞ (20) where σi∗ ∈ σ ∗ , σ ∗ ∈ C(µ), and k · k denotes the L2 norm on the Euclidean space. Proof: See Appendix B. Since in a consensus Nash equilibrium all agents play according to the same strategy, σi∗ = σj∗ for all i and j, Theorem 1 also means that the n-tuple of the population’s average empirical distribution f¯t is a consensus Nash equilibrium strategy profile σ ∗ ∈ C(µ). Notice that this result is not equivalent to showing that each agent’s empirical frequency fit is a consensus Nash equilibrium strategy. However, i’s model of other agents fˆ¯ti converges to the average empirical distribution f¯t . In particular, we have kfˆ¯ti − f¯t k = O(log t/t) by Lemma 5. Hence, agents do learn to best respond to the consensus equilibrium strategy f¯t . In order for agent i’s individual empirical frequency fit to converge to the consensus Nash equilibrium strategy f¯t , the utility function should be such that agents are not indifferent between two actions when they best respond in (8) to the equilibrium strategies of others as we show next. Corollary 1 In a distributed fictitious play with action shari ing, if the potential function u(·) is such that for νjt = f¯t for all j 6= i the maximizing action is unique asymptotically, that is, there exists a∗ ∈ A such that i i lim u(a∗ , ν−it ; µ) − u(a, ν−it ; µ) ≥  t→∞ (21) for  > 0 and for all a ∈ A \ a∗ then each agent learns to play according to an empirical frequency that is in equilibrium with others’ empirical frequencies for any symmetric potential game Γ(µ), that is, lim kfit − f¯t k = 0. t→∞ (22) Proof: See Appendix C. The condition in (21) says that there exists a single distinct action a∗ that strictly maximizes the expected utility asymptotically when other agents follow f¯t . We obtain the result 6 in (22) by leveraging the fact that asymptotically agents’ ¯i converge to estimates of the average empirical distribution fˆ t f¯t and there exists a finite time after which action a∗ will be chosen. The result above implies that agents eventually play according to a consensus Nash equilibrium action. Note that the responses of agents during the distributed fictitious play depend on both the state learning process and the process of agents forming their estimates on the average empirical distribution. The results in this section reveal that these two processes can be designed independently as long as both processes converge at a fast enough rate. We make use of this separation in the next section to design a distributed fictitious play process that converges to an equilibrium strategy of any potential game. Remark 2 The log t/t convergence rate in Assumption 2 is satisfied by various distributed learning methods including averaging, e.g., [22], [23]; decentralized estimation, e.g., [5], [24]–[28]; social learning models, e.g., [29], [30]; and Bayesian learning, e.g., [31]–[34]. In the way of illustration, averaging models have agent i sharing its previous belief on the state with its neighbors and updating its belief by a weighted averaging of observed distributions that follow the recursion X µit (θ) = wij µjt−1 (θ), (23) j∈Ni for some set of doubly stochastic weights wij . Convergence to a common distribution follows an exponential rate O(ct ) if all the information available to agents are private observations at time t = 1 [23], [35]. In Bayesian learning we can do away with communication altogether and assume that agents keep acquiring private information on θ that they incorporate in the local beliefs µit using Bayes’ law. If the local signals are informative, all agents converge to an atomic belief with all probability in the true state of the world. Linear – meaning O(1/t) – rates of convergence can be achieved with mild assumptions on the rate of novel information [31]. Bayesian updates utilizing neighbors’ beliefs are also possible, if computationally cumbersome, and also achieves O(1/t) convergence with mild assumptions [32]–[34]. IV. D ISTRIBUTED F ICTITIOUS P LAY IN G ENERIC P OTENTIAL G AMES For generic potential games we consider a distributed fictitious play process in which agents communicate the histograms they keep on the other agents with their neighbors. i I.e., Agent i shares its entire belief ν−it with its neighbors at each time step in addition to its action ait . When compared to the distributed fictitious play with action observations, the additional information communicated allows agents to keep distinct beliefs on other agents as we explain in the following. Agent i can keep track of the individual empirical histograms of its neighbors {fjt }j∈Ni by (14) using observations of the actions of its neighbors {ajt }j∈Ni , that is, i νjt+1 = fjt+1 for j ∈ Ni . Otherwise, agent i can keep an estimate of the empirical histogram of its non-neighbors j ∈ / Ni by averaging the estimates of its neighbors on the k non-neighboring agent j {νjt }k∈Ni . I.e. the estimate of agent i on j ∈ / Ni is given by X i i k νjt+1 = wjk νjt (24) k∈N i wjk P i where > 0 if and only if k ∈ Ni and k∈N wjk = 1. Note that in this belief formation, agent i keeps a separate belief on each individual and has the correct estimate of the empirical frequency of its neighbors. Besides the difference in belief updates the distributed fictitious play is identical to the behavior described in Section III. To summarize, at time t agent i updates its belief on the state µit , plays with respect to the best response action i ait in (8) with beliefs ν−it , observe actions and beliefs of j i for j 6= i by neighbors {ajt , ν−jt }j∈Ni , and update νjt+1 (14) if j ∈ Ni or by (24) if j ∈ / Ni . In the following, we show the convergence of the empirical frequencies to a Nash equilibrium strategy for any potential game when agents follow the behavior described above. A. Convergence Next, we present the main result of the paper that shows that the best responses in the distributed fictitious play with histogram sharing converge to a Nash equilibrium strategy (17) of any potential game Γ(µ) given the same assumptions on network connectivity and on convergence of the state learning process as in Theorem 1. Theorem 2 Consider a potential game Γ(µ) and the distributed fictitious play updates where at each stage agents i best respond as in (8) with local beliefs ν−it formed using (14) if j ∈ Ni or using (24) if j ∈ / Ni , and state belief µit . If Assumptions 1 and 2 are satisfied then the empirical frequencies of agents ft := {fjt }j∈N ∈ 4n (A) defined in (11) converge to a Nash equilibrium strategy of the potential game with common state of the world beliefs µ, that is, min kft − σ ∗ k → 0 σ ∗ ∈K(µ) (25) where K(µ) is the set of Nash equilibria of the game Γ(µ) (17). Proof: See Appendix D. The above result implies that when agents share their beliefs on others’ histograms and based on this information keep an estimate of the empirical distribution of each agent, their responses converge to a Nash equilibrium of the potential game as long as their beliefs on the state reach consensus at a belief µ fast enough. Theorem 2 generalizes Theorem 1 to the class of potential games given that agents in addition to their actions communicate their beliefs on others with their neighbors. V. S IMULATIONS We explore the effects of the network connectivity, the state learning process and the payoff structure on the per- 7 3 3 2.5 2.5 2 2 1.5 1.5 1 1 0.5 0.5 0 -0.2 0 0.2 0.4 0.6 0.8 0 -0.2 1 0 0.2 (a) 0.4 0.6 0.8 1 (b) 140 140 120 120 100 100 Action values Action values Fig. 2. Position of robots over time for the geometric (a) and small world networks (b). Initial positions and network is illustrated with gray lines. Robots’ actions are best responses to their estimates of the state and of the centroid empirical distribution for the payoff in (27). Robots recursively compute their estimates of the state by sharing their estimates of θ with each other and averaging their observations. Their estimates on the centroid empirical distribution is recursively computed using (16). Agents align their movement at the direction 95◦ while the target direction is θ = 90◦ . 80 60 80 60 40 40 20 20 0 0 50 100 150 0 0 50 100 150 Time Time (a) (b) Fig. 3. Distributed fictitious play actions of robots over time for the geometric (a) and small world networks (b). Solid lines correspond to each robots’ actions over time. The dotted dashed line is equal to value of the state of the world θ = 90◦ and the dashed line is the optimal estimate of the state given all of the signals which is equal to 96.1◦ . Agents reach consensus in the movement direction 95◦ faster in the small-world network than the geometric network. formance of the algorithm in two games named the beauty contest game, and the target covering game. function  ui (a, θ) = −λ(ai −θ) −(1−λ) ai − 2 1 X aj n−1 2 (27) j6=i A. Beauty contest game A network of n = 50 autonomous robots want to move in coordination and at the same time follow a target direction θ = [0◦ , 180◦ ] in a two dimensional topology. Each robot receives an initial noisy signal related to the target direction θ, πi (θ) = θ + i (26) where i is drawn from a zero mean normal distribution with standard deviation equal to 20◦ . Actions of robots determine their direction of movement and belong to the same space as θ but are discretized in increments of 5◦ , i.e., A = (0◦ , 5◦ , 10◦ , . . . , 180◦ ). The estimation and coordination payoff of robot i is given by the following utility where λ ∈ (0, 1) gauges the relative importance of estimation and coordination. The game is a symmetric potential game and hence admits a consensus equilibrium for any common belief on θ [14]. In the following numerical setup, we choose θ to be equal to 90◦ . We assume that all robots start with a common prior on the centroid empirical distribution in which they believe that each action is drawn with equal probability. They follow the distributed fictitious play updates with action sharing described in Section III. State learning process is chosen as the averaging model in which robots update their beliefs on the state θ using (23) with initial beliefs formed based on the initial private signal with signal generating function in (26). In Figs. 2 and 3, we plot robots’ positions and their actions, 8 1 5 5 3 2 4 Action values 0.5 0 3 -0.5 2 -1 4 1 -1 -0.5 0 0.5 1 1 0 50 100 Time (a) (b) Fig. 4. Locations (a) and actions (b) of robots over time for the star network. There are n = 5 robots and targets. In (a), the initial positions of the robots are marked with squares. The robots’ final positions at the end of 100 steps are marked with a diamond. The positions of the targets are indicated by ‘×’. Robots follow the histogram sharing distributed fictitious play presented in Section IV. The stars in (a) represent the position of the robots at each step of the algorithm. The solid lines in (b) correspond to the actions of robots over time. All targets are covered by a single robot before 100 steps. respectively. In Fig. 2, we assume that robot i moves with a displacement of 0.01 meters in the chosen direction ait at stage t. Figs. 2(a) and 3(a) correspond to the behavior in a geometric network when robots are placed on a 1 meter × 1 meter square randomly and connecting pairs with distance less than 0.3 meter between them. Figs. 2(b) and 3(b) correspond to the behavior in a small-world network when the edges of the geometric network are rewired with random nodes with probability 0.2. The geometric network illustrated in Fig. 2(a) has a diameter of ∆g = 5 with an average length among users equal to 2.51 . The small world network illustrated in Fig. 2(b) has a diameter of ∆r = 4 with an average length among users equal to 2. We observe that the agents reach consensus at the action 95◦ in both networks but the convergence is faster in the small-world network (39 steps) than the geometric network (78 steps). We further investigate the effect of the network structure in convergence time by considering 50 realizations of the geometric network and 50 small-world networks generated from the realized geometric networks with rewire probability of 0.2. The average diameter of the realized geometric networks was 5.1 and the average diameter of the realized small-world networks was 4.1. The mean of the average length of the realized geometric networks was 2.27 while the same value was 1.96 for the realized small-world networks. We considered a maximum of 500 iterations for each network. Among 50 realizations of the geometric network, the distributed fictitious play behavior failed to reach consensus in action within 500 steps in 18 realizations while for smallworld networks the number of failures was 5. The average time to convergence among the 50 realizations was 228 steps for the geometric network whereas the convergence took 100 steps for the small-world network on average. In addition, 1 Diameter is the longest shortest path among all pairs of nodes in the network. The average length is the average number of steps along the shortest path for all pairs of nodes in the network. convergence time for the small-world network is observed to be shorter than the corresponding geometric network in all of the runs except one. B. Target covering game n autonomous robots want to cover n targets. The position of a target k ∈ T := {1, . . . , n} on the two dimensional space is denoted by θk ∈ R2 and are not known by the robots. Robot i starts from an initial location xi ∈ R2 and makes noisy observations sik0 of the location of target k coming from normal distribution with mean θk and standard deviation equal to σI where I is the 2 × 2 identity matrix and σ > 0 for all k ∈ T . At each stage robots choose one of the targets, that is, A = T and receives a payoff from covering that target that is inversely proportional to its distance from the target if no other robot is covering it, that is, the payoff of robot i from covering target k ∈ (1, . . . , n) ai = k is given by   X ui (ai = k, a−i , θ) = 1  1 (aj = k) = 0 h(xi , θk ) j6=i (28) where 1(·) is the indicator function and h(·) is a reward function inversely proportional to the distance between the target and the robot’s initial position xi , e.g., kxi − θk k−2 . The first term in the multiplication above is one if no one else chooses target k otherwise it is zero. The second term in the multiplication decreases with growing distance between robot i’s initial position xi and the target k’s position θk . When all of the robots start from the same location, that is, xi = x for all i ∈ N , the game with payoffs above can be shown to be a potential game by using the definition of potential games in (2). Furthermore, the game is symmetric. In this setup, we would like each robot to assign itself to 9 4.5 4 3.5 global utility values a single target different from the rest of the robots, that is, we are interested in convergence to a pure strategy Nash equilibrium in which each robot picks a single action similar to the target assignment games considered in [20]. Observe that the target covering game can not have a pure consensus equilibrium strategy. To see this, assume that all robots cover the same target then they all receive a payoff of zero. Any robot that deviates to another target receives a positive payoff. Therefore, there cannot be a pure consensus strategy equilibrium. As a result, instead of the action sharing scheme, we consider the histogram sharing distributed fictitious play by which it is possible but not guaranteed that the robots converge to a pure strategy Nash equilibrium. In the numerical setup, we consider n = 5 robots with the payoffs in (28) and n targets. The locations of targets are respectively given as follows θ1 = (−1, −1), θ2 = (1, 1), θ3 = (−1, 1), θ4 = (1, −1), θ5 = (0, 1). We consider the case that the initial positions of robots are different from each other with the reward function h(xi , θk ) = kxi −θk k−2 . Specifically, the initial positions of the robots equal to x1 = (−0.1, −0.1), x2 = (0.1, 0.1), x3 = (−0.1, 0.1), x4 = (0.1, −0.1), and x5 = (0, 0.1). Robots make noisy observations sikt for all k ∈ T after each step. The observations have the same distribution as sik0 with σ = 0.2 meters. We assume that the robots update their beliefs on the positions of targets using the Bayes’ rule based on the observations. Figs. 4(a)-(b) shows the movement of robots and actions of robots over time, respectively, for the star network. We assume that robots move by a distance of 0.02 meters along the estimated direction of the target they choose at each step of the distributed fictitious play. The estimated direction is a straight line from the current position to the estimated position of the chosen target. I.e., the robots make observations and decisions in every 0.02 meters. Finally, we assume that the robot covers the target if it is 0.05 meters away from a target and no other robot covers it. In figs. 4(a)-(b), we observe that each robot comes to 0.05 meters neighborhood of a target within 100 steps. Furthermore, the robots cover all of the targets, that is, they converge to a pure Nash equilibrium. Next, we compare the distributed fictitious play algorithm to the centralized (optimal) algorithm. In the centralized algorithm, at the beginning of each step agents aggregate their signals and then take the action to maximize the expected global objective defined as the sum of the utilities of all (28). Since there exists multiple equilibria in the complete information target coverage game, it is not guaranteed that the distributed fictitious play algorithm converges to the optimal equilibrium at each run. For this purpose, we considered 50 runs of the algorithm where in each run signals are generated from different seeds. We assume that the algorithm has converged when each target is covered by a robot within 0.05 meters from the target. In Fig. 5, we plot the evolution of the global utility with respect to time for the distributed fictitious play algorithm runs with the best and the worst final payoff, and for the centralized algorithm. The best final configuration overlaps with the final centralized solution which is given by 3 2.5 2 1.5 1 Worst Best Central 0.5 0 0 50 100 150 200 250 Time Fig. 5. Comparison of the distributed fictitious play algorithm with the centralized optimal solution. Best and worst correspond to the runs with the highest and lowest global utility in the distributed fictitious play algorithm. The algorithm converges to the global optimal point in 40 runs out of a total of 50 runs. a = [1, 2, 3, 4, 5] resulting in a global objective value of 4.25. The worst final configuration is given by a = [1, 5, 3, 4, 2] resulting in a global objective value of 4.20. VI. C ONCLUSION This paper considered the optimal behavior of multi-agent systems with uncertainty on the state of the world. The fundamental problem of interest was to have a model of optimal agent behavior given a global objective that depends on the state and actions of all the agents when agents have different beliefs on the state. We posed the setup as a potential game with the global objective as the common utility of the multi-agent system and set the optimal behavior as a Nash equilibrium strategy of the game when agents have common beliefs on the state of the environment. We presented a class of distributed algorithms based on the fictitious play algorithm in which agents reach an agreement on their state beliefs asymptotically through an exogenous process, build beliefs on the behavior of others based on information from neighbors and best respond to their expected utility given their beliefs on the state and others. We considered two information exchange scenarios for the algorithm where in the first scenario agents communicated their actions. For this scenario we showed that when the agents keep track of the population’s average empirical frequency of actions as a belief on the behavior of every other individual, their behavior converges to a consensus Nash equilibrium of any symmetric potential game with common beliefs on the state. In the second scenario we considered agents exchanging their entire beliefs on others in addition to their actions. For this scenario we proposed averaging of the observed histograms as a model for keeping beliefs on the behavior of others and showed that their empirical frequency converges to a Nash equilibrium of any potential game. We exemplified the algorithm in a coordination game – a symmetric potential game – and a target covering game – a potential game. In these examples, we observed that the diameter of the network is influential in convergence rate where the shorter the diameter is, the faster the convergence is. 10 A PPENDIX A D EFINITIONS AND INTERMEDIATE CONVERGENCE following holds #{1 ≤ t ≤ T : f¯tn ∈ / C (µ)} =0 (33) T →∞ T then limt→∞ d(f¯tn , C(µ)) = 0 where d(·, ·) is the distance defined in (29). lim RESULTS We define notions that relate closeness of a strategy to the set of consensus Nash equilibria of the game Γ(µ). The distance of a strategy σ ∈ 4n (A) from the set of consensus Nash equilibria C(µ) is given by d(σ, C(µ)) = min kσ − gk. g∈C(µ) (29) The set of consensus strategies that are  away from the consensus Nash equilibrium set (18) is the -consensus Nash equilibrium strategy set, that is, Proof : By Lemma 7 in [7], (33) implies that for a given δ > 0 there exists an  > 0 such that #{1 ≤ t ≤ T : f¯tn ∈ / Bδ (C(µ))} =0 (34) lim T →∞ T Using above equation, the result follows by Lemma 1 in [36]. ∗ C (µ) = {σ ∗ ∈ 4n (A) : ui (σ ∗ ; µ) ≥ ui (σi , σ−i ; µ) − , for all σi ∈ 4(A), for all i, σ1 = σ2 = · · · = σn } (30) for  > 0. We define the δ-consensus neighborhood of C(µ) as  Bδ (C(µ)) = σ ∈ 4n (A) : d(σ, C(µ)) < δ, σ1 = σ2 = · · · = σn . Lemma 1 If the processes gt ∈ 4n (A) and ht ∈ 4n (A) are such that kg−it − h−it k = O(log t/t) for all i ∈ N and the state learning process for all i ∈ N generates estimate beliefs {{µit }∞ t=0 }i∈N that satisfy Assumption 2, then for a potential payoff u in (2) the following is true for the expected utility of best response behavior v(·) in (9), log t ). t T 1 X βt =0 T →∞ T t t=1 lim (31) Note that the δ consensus neighborhood is defined as the set of consensus strategies that are close to the set C(µ). We can similarly define the  Nash equilibrium set K (µ) and δ neighborhood of K(µ) in (17) as Bδ (K(µ)) by removing the agreement constraint on the equilibrium strategies [7]. The following intermediate results can be found in Appendix B in [7]. They are stated here for completeness. kv(g−it ; µit ) − v(h−it ; µ)k = O( Lemma 4 For the potential game with function u(·) in (2) and expected best response utility v(·) (9), consider a sequence of distributions ft ∈ 4n (A) for t = 1, 2, . . . and a common Pn belief on the state µ ∈ 4(Θ). Define the process βt := i=1 v(f−it ; µ) − u(fit , f−it ; µ) for t = 1, 2, . . . . If (32) Proof: The proof is detailed in Lemma 4 in [7]. The proof follows by first making the observation that the expected utility defined in (1) for the potential function is Lipschitz continuous, and second using the definition of the Lipschitz continuity to bound the difference between the best response expected utilities in (9) for g−it , µit and h−it , µ by the distance between g−it , µit and h−it , µ multiplied by the Lipschitz constant. PT Lemma 2 If t=1 αtt < ∞ for all T > 0, kαt − βt k = PT O( logt t ) and βt+1 ≥ 0 then t=1 βtt < ∞ as T → ∞. Proof: Refer to the proof of Lemma 5 in [7]. (35) then limt→∞ d(ft , K(µ)) = 0 where ft = {f1t , . . . , fnt }. Proof: By Lemma 6 in [7], the condition (35) implies that for all  > 0 #{1 ≤ t ≤ T : ft ∈ / K (µ)} lim = 0. (36) T →∞ T By Lemma 7 in [7], (36) implies that for all δ > 0 the following is true #{1 ≤ t ≤ T : ft ∈ / Bδ (K(µ))} =0 (37) T The above convergence result yields desired convergence result by Lemma 1 in [36]. lim T →∞ A PPENDIX B P ROOF OF T HEOREM 1 Before we prove the theorem, we present an intermediate result that shows the convergence rate of the belief of agent ¯i to the i on the population’s average empirical distribution fˆ t true average empirical distribution of the population f¯ti . Lemma 5 Consider the distributed fictitious play in which the centroid empirical distribution of the population f¯t evolves according to (15) and agents update their estimates on the empirical play of the population fˆ¯ti according to (16). If the network satisfies Assumption 1 and the initial beliefs are the same for all agents, i.e., fˆ¯1i = f¯1 for all i ∈ N , then fˆ¯ti converges in norm to f¯t at the rate O(log t/t), that is, kfˆ¯ti − f¯t k = O( logt t ) Proof: See Appendix A in [7] for a proof. Lemma 3 Denote the n-tuple of the average empirical distribution with f¯tn := {f¯t , . . . , f¯t }. If for any  > 0 the Observe that the above result is true irrespective of the game that the agents are playing and uncertainty in the state. 11 The proof leverages on the fact that the change in the centroid empirical distribution is at most 1/t by the recursion in (15). Then by averaging observed actions of neighbors in a strongly connected network the beliefs of agent i on the centroid empirical distribution evolves faster than the change in the centroid empirical distribution. Proof Theorem 1: Given the recursion for the average empirical distribution in (15), we can write the expected utility for the potential function u(·) when all agents follow the centroid empirical distribution f¯t+1 and have identical beliefs µ as follows ! ! n 1 1X n n n ¯ ¯ ¯ Ψ(ait ) − ft ; µ (38) u(ft+1 ; µ) = u ft + t n i=1 where f¯tn := {f¯t , . . . , f¯t } ∈ 4n (A) is the n-tuple of the average population empirical distribution. Define average Pthe n best response strategy at time t Ψ̄(at ) := n1 i=1 Ψ(ait ). By the multi-linearity of the expected utility, we expand the above expected utility as follows [36] n u(f¯t+1 ; µ) = u(f¯tn ; µ)+ n δ 1X u(Ψ̄(at ), f¯tn−1 ; µ) − u(f¯t , f¯tn−1 ; µ) + 2 t i=1 t (39) where the first order terms of the expansion are explicitly written and the remaining higher order terms are collected to the term δ/t2 . We substitute in the above equality (41) for the corresponding term in (39) to get the following n u(f¯t+1 ; µ) = u(f¯tn ; µ)+ n 1X δ u(Ψ(ait ), f¯tn−1 ; µ) − u(f¯t , f¯tn−1 ; µ) + 2 . t i=1 t (42) We can upper bound the right hand side by adding |δ|/t2 to the left hand side. |δ| n u(f¯t+1 ; µ) − u(f¯tn ; µ) + 2 ≥ t n 1X u(Ψ(ait ), f¯tn−1 ; µ) − u(f¯t , f¯tn−1 ; µ) (43) t i=1 i Define Lit := vi (ν−it ; µit ) − u(Ψ(ait ), f¯tn−1 ; µ) where ˆ i ¯ = ft for j 6= i. Note that since agents have identical payoffs, we can drop the subindex of the expected utility of agent i when it best responds to the strategy profile of others vi (·) defined P in Section II to write it as v(·). Now we add n and subtract i=1 Lit /t to both sides of the above equation to get the following inequality, i νjt |δ| n u(f¯t+1 ; µ) − u(f¯tn ; µ) + 2 t n 1X i + v(ν−it ; µit ) − u(Ψ(ait ), f¯tn−1 ; µ) t i=1 n ≥ Consider the total utility term in (39) where agent i is playing with respect to the average best response strategy at time t + 1 Ψ̄(at ) and remaining agents use the average Pn empirical distribution f¯tn−1 , i=1 u(Ψ̄(at ), f¯tn−1 ; µ). By the definition of the average best response strategy, we write the term in consideration as ! n n n X X X  1 u Ψ̄(at ), f¯tn−1 ; µ = u Ψ(ait ), f¯tn−1 ; µ . n i=1 i=1 i=1 (40) The following equality can be shown by using the multilinearity of expectation and permutation invariance of the utility [7], n X i=1 u(Ψ̄(at ), f¯tn−1 ; µ) = n X u(Ψ(ait ), f¯tn−1 ; µ). (41) i=1 The above equality means that the total expected utility when agents play with the average best response strategy at time t Ψ̄(at ) against the average empirical distribution f¯tn−1 at time t is equal to the total expected utility when agents best respond to the average population empirical distribution at time t. 1X i v(ν−it ; µit ) − u(f¯t , f¯tn−1 ; µ). t i=1 (44) Summing the inequalities above from time t = 1 to time t = T , we get u(f¯Tn+1 ; µ) − u(f¯1n ; µ) + T +1 X t=1 ≥ T +1 X t=1 n 1X t T +1 n |δ| X X Lit + t2 t t=1 i=1 i v(ν−it ; µit ) − u(f¯t , f¯tn−1 ; µ). (45) i=1 Next we define the following term that corresponds to the inside summation on the right hand side of the above inequality, αt := n X i v(ν−it ; µit ) − u(f¯t , f¯tn−1 ; µ). (46) i=1 The term αt captures the total difference between expected utility when agents best respond to their beliefs on the i ¯i and average population empirical distribution νjt = fˆ t their beliefs on θ µit , and when they follow the current centroid empirical distribution f¯t with common beliefs on the state µ. Note that by Lemma 5 and Assumption 2 the i conditions of Lemma 1 are satisfied, that is, kv(ν−it ; µit ) − n−1 ¯ ¯ u(ft , ft ; µ)k = O(log t/t). By the assumption that utility value is finite and Lemma 1, the left hand side of (45) is 12 finite. That is, there exists a B̄ > 0 such that B̄ ≥ T +1 X t=1 αt . t (47) for all T > 0. Next, we define the following term βt := n X v(f¯tn−1 ; µ) − u(f¯t , f¯tn−1 ; µ) (48) i=1 that captures the difference in expected payoffs when agents best respond to the centroid empirical distribution f¯tn−1 for others given the common asymptotic belief µ, and when everyone follows the current centroid empirical distribution f¯t with common beliefs on the state µ. When we consider the difference between αt and βt , the following equality is true by Lemma 1, kαt − βt k = k n X i v(ν−it ; µit ) − v(f¯tn−1 ; µ)k = O( i=1 log t ). t (49) Further βt ≥ 0. Hence, the conditions of Lemma 2 are satisfied which implies that the following holds T X βt t=1 t < ∞. (50) From the above equation it follows by the Kronecker’s Lemma that [37, Thm. 2.5.5] T 1X βt = 0. T →∞ T t=1 lim (51) The above convergence result implies that by Lemma 6 in [7], for any  > 0, the number of centroid empirical frequencies away from the  consensus NE is finite for any time T , that is, / C (µ)} #{1 ≤ t ≤ T : f¯tn ∈ lim = 0. (52) T →∞ T The relation above implies that the distance between the empirical frequencies and the set of symmetric NE diminishes by Lemma 3, that is, lim d(f¯tn , C(µ)) = 0. t→∞ (53) where d(·, ·) is the distance defined in (29). The result in (20) follows from above. A PPENDIX C P ROOF OF C OROLLARY 1 Denote the n − 1 tuple of the average empirical distribution f¯t by f¯tn−1 . By the Lipschitz continuity of the multilinear utility expectation we have that ku(ai , f¯tn−1 ; µ)− i i u(ai , ν−it ; µit )k ≤ Kk(f¯tn−1 , µ) − (ν−it , µit )k for all ai ˆ i i where νjt = f¯t for all j 6= i and K ≥ 0 is the Lipschitz constant. By Lemma 5 and Assumption 2, we have i k(f¯tn−1 , µ) − (ν−it , µit )k = O(log t/t). Then using (21), we have for all a ∈ A \ a∗ i i u(a∗ , ν−it ; µit ) − u(a, ν−it ; µit ) ≥  − δt (54) i for νjt = fˆ¯ti for all j 6= i, δt ≥ 0 and δt = O(log t/t). Therefore, there exists a finite time T > 0 such that −δt > 0 for all t > T . This means that a∗ is the best response action of i after time T . Then the empirical frequency of i ∈ N fit converges to Ψ(a∗ ) which implies (22). A PPENDIX D P ROOF OF T HEOREM 2 Before we prove the theorem, we first analyze the convergence rate of the histogram sharing presented in Section IV i i where we defined νjt = fjt if j ∈ Ni or νjt is given by (24) if j ∈ / Ni . i i (l). Define the matrix by νjt Denote the lth element of νjt that captures population’s estimate on j’s empirical distribu1 n T tion, F̂jt := [νjt , . . . , νjt ] ∈ Rn×m . The lth column of F̂jt represents the population’s estimate on j’s lth local action 1 n denoted by F̂jt (l) := [νjt (l), . . . , νjt (l)]T ∈ Rn×1 . Observe that j’s estimate of the frequency of its own j action l is correct, that is, νjt (l) = fjt (l). Define the n×1 vector xjlt ∈ R where its jth element is equal to the empirical frequency of agent j taking action l ∈ A, that is, xjlt (j) = fjt (l), and its other elements are zero. Further define the weighted adjacency matrix for belief update on the frequency of agent j’s lth action Wjl ∈ Rn×n with i i is for all i and k. We remind that wjk Wjl (i, k) = wjk the weight that i uses to mix agent j ∈ Ni ’s belief on agent k∈ / Ni ’s empirical distribution in (24). Also note that there are m weight matrices Wjl each corresponding to one action l ∈ A. The matrix Wjl is row stochastic, that is, the sum of row of Wjl is equal to one for each row by P elements i w = 1 and we have that Wjl (i, j) = 1 for k∈Ni Sjk j ∈ Ni i. The latter condition on Wjl is by the fact that if j ∈ Ni , j sends its action to its neighbor i and hence i νjt = fjt . Given these definitions we can write a linear recursion for population’s estimate of j’s empirical frequency of its lth action F̂jt+1 (l) = Wjl (F̂jt (l) + xjlt+1 − xjlt ). (55) Note that if the above linear system converges to the true empirical frequency of fjt (l) in all of its elements then it implies that all agents learned its true value. Next, we analyze the linear update in (55) and show the convergence of the belief of agent i on the population’s i empirical distribution ν−it to the true average empirical distribution of the rest of the population f−it at rate O(log t/t). Lemma 6 Consider the distributed fictitious play in which the empirical distribution of agent j fjt evolves according to (14) and agent i updates its estimate on the empirical play i of the population ν−it according (14) if j ∈ Ni or using (24) if j ∈ / Ni . If the network satisfies Assumption 1 and i the initial beliefs are the same for all agents, i.e., νj1 = fj1 i for all i ∈ N , then νjt converges in norm to fjt at the rate i O(log t/t), that is, kνjt − fjt k = O( logt t ) for all j ∈ N . 13 Proof: We consider the difference between the population’s estimate of the empirical frequency of j taking action l ∈ A and j’s true empirical distribution fjt (l)1 by subtracting fjt+1 (l)1 from both sides of (55) to get (59) as F̂jt+1 (l)−fjt+1 (l)1 = Wjl (F̂jt (l)+xjlt+1 −xjlt )−fjt+1 (l)1. (56) Since Wjl is row stochastic, we can move the last term on the right hand side inside the matrix multiplication, for t = 1, 2, . . . . The second equality follows by writing the first equality for {ys }s=1,...,t and iteratively substituting each i term. Note that by the assumption νj1 = fj1 , y1 = 0. So when we consider the norm of yt+1 , kyt+1 k, we are left with yt+1 = Wjl (yt + δ t ) = t X Wjls+1 δ t−s + Wjlt y1 (63) s=0 t t X X F̂jt+1 (l)−fjt+1 (l)1 = Wjl (F̂jt (l)+xjlt+1 −xjlt −fjt+1 (l)1). kyt+1 k = k Wjls+1 δ t−s k ≤ kWjls+1 δ t−s k (64) (57) s=0 s=0 We can equivalently express fjt+1 (l) = fjt (l) + xjlt+1 (j) − T xjlt (j) by the definition of the vector xjlt . Substituting this Now use the decomposition Wjl = W jl + 1ej in the above expression for the fjt+1 (l) on the right hand side of the above line to get equation we have t X  kyt+1 k ≤ k(W jl + 1eTj )s+1 δ t−s k (65) F̂jt+1 (l)−fjt+1 (l)1 = Wjl F̂jt (l) + xjlt+1 − xjlt s=0  − (fjt (l) + xjlt+1 (j) − xjlt (j))1 . (58) Since W jl 1 = 0, eTj W jl = 0 and 1eTj = (1eTj )s for any s s = 1, 2, . . . , we have Wjls = W jl +1eTj . Then we can upper Let yt := F̂jt (l) − fjt (l)1, then bound kyt+1 k by using the triangle inequality as follows yt+1 = Wjl (yt + xjlt+1 − xjlt − (xjlt+1 (j) − xjlt (j))1). (59) Let δ t := xjlt+1 − xjlt − (xjlt+1 (j) − xjlt (j))1. Next, we provide an upper bound for kδ t k by using the triangle inequality and observing the fact that recursion for fictitious play in (14) can change only the jth element of the vector xjlt by 1/t, that is, xjlt+1 (j) − xjlt (j) = 1t (Ψ(ajt )(l) − fjt (l)), as follows kδ t k = kxjlt+1 − xjlt − (xjlt+1 (j) − xjlt (j))1k ≤ kxjlt+1 − xjlt k + kxjlt+1 (j)1 − xjlt (j)1k n+1 1 1 n = O( ). ≤ + = t t t t kyt+1 k ≤ t X s+1 kW jl δ t−s k + k(1eTj )s+1 δ t−s k Further note δ t (j) = 0 for any t = 1, 2, . . . by the definition of xjlt+1 and xjlt , and therefore eTj δ t = 0, which means the second term on the right hand side of the inequality is zero, that is, t X s+1 kW jl δ t−s k. kyt+1 k ≤ (67) (60) (61) (62) Now consider the row stochastic matrix Wjl . Its largest eigenvalue is λ1 = 1 and its right eigenvector is equal to column vector of ones 1 by the Perron-Frobenius theorem [38, Ch. 2.2]. The left eigenvector associated with the eigenvalue λ1 is given by eTj . This is easy to see when we interpret Wjl as representing a Markov chain where state j is an absorbing state and there is a positive transition probability from any other state to state j. Note that once a state i that is a neighbor of j is reached, the transition to state j is with probability 1 due to the update rule. Because the graph G is strongly connected, / Nj there exists a path to a node S for any i ∈ k ∈ Nj j. As a result the absorbing state j is reached with positive probability which implies the stationary distribution of the Markov chain is given by ej , that is, with probability 1 the state is j. Moreover, limt→∞ Wjlt → 1eTj . Now define the matrix W jl = Wjl − 1eTj . By the fact that the limiting power sequence of the matrix is 1eTj , t limt→∞ W jl → 0. By its construction the sum of the row elements of W jl is zero for any row, that is, W jl 1 = 0n×1 . Further note that the jth row of W jl is all zeros as well as all the rows k such that j ∈ Nk . By using the definition of δ t , we can equivalently write (66) s=0 s=0 Furthermore, the spectral radius of W jl is strictly less than t 1, that is, λ̄1 := ρ(W jl ) < 1 because limt→∞ W jl = 0 [39, Thm. 1.10]. As a result, we have kyt+1 k ≤ t X s+1 kW jl δ t−s k ≤ s=0 t X ρ(W jl )s+1 kδ t−s k (68) s=0 Note that by (62), Pt we have kδ t−s k = n + 1/t − s. Define δavg (t) := 1t s=1 n+1 s . By Chebychev’s sum inequality [40] (p. 43-44), we have kyt+1 k ≤ δavg (t) t X λ̄s+1 1 (69) 1 − λ̄t+1 δavg (t) 1 )≤ 1 − λ̄1 1 − λ̄1 (70) s=0 = δavg (t)(λ̄1 Pt Noting that δavg (t) := 1t s=1 n+1 = O( logt t ), we have s log t kyt+1 k = kF̂jt (l) − fjt (l)1k = O( t ) for any l ∈ A. i Consequently, kνjt − fjt k = O( logt t ). Similar to Lemma 5 the above result is true irrespective of the game that the agents are playing. The result leverages on the fact that the change in the empirical distribution of agent j is at most 1/t by the recursion in (14) and the belief updates of i on j’s empirical frequency evolves faster than the change in agent j’s empirical distribution. We continue with the proof of the Theorem. 14 Proof of Theorem 2: Proof follows the same proof outline in Theorem 1. Start by exploiting the multi-linearity of the expected utility when all individuals play with respect to their empirical distributions [36], that is, Lemma 2 are satisfied which implies that u(ft+1 ; µ) = u(ft ; µ) n δ 1X u(Ψ(ait ), f−it ; µ) − u(fit , f−it ; µ) + 2 . + t i=1 t (71) for any T > 0. As a result the time average of the above sum converges to zero by Kronecker’s Lemma [37, Thm. 2.5.5], that is, for some δ > 0 which we collect higher order terms. We move the first term of the RHS to the left and add |δ|/t2 to the left hand side and get rid of the last term on the right hand side, u(ft+1 ; µ) − u(ft ; µ) + |δ| ≥ t2 n 1X u(Ψ(ait ), f−it ; µ) − u(fit , f−it ; µ). t i=1 n |δ| 1 X Lit u(ft+1 ; µ) − u(ft ; µ) + 2 + t t i=1 n (73) Now we sum up the terms above from time t = 1 to T , u(fT +1 ; µ) − u(f1 ; µ) + T +1 X t=1 ≥ T +1 X t=1 n 1X t T +1 n |δ| X 1 X + Lit t2 t i=1 t=1 i v(ν−it ; µit ) − u(fit , f−it ; µ). (74) i=1 Consider the left hand side of the above equation. The utility and therefore the expected utility is bounded. The third term is summable. By Lemma 6 and Assumption 2, the conditions of Lemma 1 are satisfied. Lemma 1 yields that the last term on the left hand side of (74) is summable. Hence, the left hand side of (74) is bounded. Pn i Define αt := i=1 v(ν−it ; µit ) − u(fit , f−it ; µ). Using the definition of αt and the boundedness of the left hand side of the above equation, it follows from (74) that there exists some bounded parameter 0 < B̄ < ∞ such that B̄ > ∞ X αt t=1 t . (75) Pn Define βt := i=1 v(f−it ; µ) − u(fit , f−it ; µ) and consider the difference between αt+1 and βt+1 kαt − βt k = k n X i v(ν−it ; µit ) − v(f−it ; µ)k t=1 t <∞ T 1 X βt = 0. T →∞ T t t=1 lim (77) (78) We remark that βt captures the difference in expected payoffs when agent i best responds to others’ empirical distribution f−it given the common asymptotic belief µ, and when agent i follows its own empirical distribution fit with common beliefs on the state µ. The convergence in (25) follows from the above equation by Lemma 4. (72) i Now Pn define Lit := v(ν−it ; µit ) − u(Ψ(ait ), f−it ; µ). Add i=1 Lit /t to both sides of the above equation to get 1X i v(ν−it ; µit ) − u(fit , f−it ; µ). ≥ t i=1 T X βt (76) i=1 Lemma 1 implies that the above equality is equal to kαt − βt k = O(log t/t). By noting that βt ≥ 0, the conditions of R EFERENCES [1] Y. Shoham and K. Leyton-Brown, Multiagent systems: Algorithmic, game-theoretic, and logical foundations. Cambridge University Press, 2008, vol. 1. [2] C. Eksin and A. Ribeiro, “Distributed network optimization with heuristic rational agents,” IEEE Trans. Signal Process., vol. 60, no. 10, pp. 5396–5411, October 2012. [3] A. Nedic and A. Ozdaglar, “Distributed subgradient methods for multiagent optimization,” IEEE Trans. Autom. Control, vol. 54, no. 1, 2009. [4] J. Tsitsiklis, D. Bertsekas, and M. Athans, “Distributed asynchronous deterministic and stochastic gradient optimization algorithms,” IEEE Trans. Autom. Control, vol. 31, no. 9, pp. 803–812, 1986. [5] J. Chen and A. Sayed, “Diffusion adaptation strategies for distributed optimization and learning over networks,” Signal Processing, IEEE Transactions on, vol. 60, no. 8, pp. 4289–4305, 2012. [6] D. Monderer and L. Shapley, “Fictitious play property for games with identical interests,” Journal of economic theory, vol. 68, no. 1, pp. 258–265, 1996. [7] B. Swenson, S. Kar, and J. Xavier, “Empirical centroid fictitious play: An approach for distributed learning in multi-agent games,” IEEE Trans. Signal Process., vol. PP, no. 99, p. 1, 2015. [8] J. Marden, G. Arslan, and J. Shamma, “Joint strategy fictitious play with inertia for potential games,” IEEE Trans. Automatic Control, vol. 54, no. 2, pp. 208–220, 2009. [9] J. Shamma and G. Arslan, “Dynamic fictitious play, dynamic gradient play, and distributed convergence to nash equilibria,” IEEE Trans. Automatic Control, vol. 50, no. 3, pp. 312–327, 2005. [10] S. Hart, “Adaptive heuristics,” Econometrica, vol. 73, no. 5, pp. 1401– 1430, 2005. [11] H. Young, Strategic learning and its limits. Oxford University Press, 2004. [12] J. Harsanyi, “Games with incomplete information played by bayesian players - part ii. bayesian equilibrium points.” Management Science, vol. 14, no. 5, pp. 320–334, 1968. [13] C. Eksin, P. Molavi, A. Ribeiro, and A. Jadbabaie, “Learning in networks with incomplete information:asymptotic analysis and tractable implementation of rational behavior,” IEEE Signal Process. Mag., vol. 30, no. 3, pp. 30–42, May 2013. [14] ——, “Bayesian quadratic network game filters,” IEEE Trans. Signal Process., vol. 62, no. 9, pp. 2250 – 2264, May 2014. [15] E. Dekel, D. Fudenberg, and D. Levine, “Learning to play bayesian games,” Games and Economic Behavior, vol. 46, no. 2, pp. 282–303, 2004. [16] D. Fudenberg and D. Levine, The Theory of Learning in Games, 1st ed. Cambridge, MA: MIT Press, 1998. [17] G. W. Brown, “Iterative solution of games by fictitious play,” Activity analysis of production and allocation, vol. 13, no. 1, pp. 374–376, 1951. [18] D. Fudenberg and D. Kreps, “Learning mixed equilibria,” Games and Economic Behavior, vol. 5, no. 3, pp. 320–367, 1993. 15 [19] D. Fudenberg and S. Takahashi, “Heterogeneous beliefs and local information in stochastic fictitious play,” Games and Economic Behavior, vol. 71, no. 1, pp. 100–120, 2011. [20] G. Arslan, J. Marden, and J. Shamma, “Autonomous vehicle-target assignment: A game-theoretical formulation,” Journal of Dynamic Systems, Measurement, and Control, vol. 129, no. 5, pp. 584–596, 2007. [21] J. Marden and J. Shamma, “Revisiting log-linear learning: Asynchrony, completeness and a payoff-based implementation,” Games and Economic Behavior, vol. 75, no. 2, pp. 788–808, 2012. [22] A. Jadbabaie, J. Lin, and A. Morse, “Coordination of groups of mobile autonomous agents using nearest neighbor rules,” IEEE Trans. Autom. Control, vol. 48, no. 6, pp. 988–1001, 2003. [23] A. Kashyap, T. Basar, and R. Srikant, “Quantized consensus,” Automatica, vol. 43, no. 7, pp. 1192–1203, 2007. [24] I. Schizas, A. Ribeiro, and G. Giannakis, “Consensus in ad hoc wsns with noisy links - part i: distributed estimation of deterministic signals,” IEEE Trans. Signal Process., vol. 56, no. 1, pp. 1650–1666, January 2008. [25] S. Stankovic, M. Stankovic, and D. Stipanovic, “Decentralized parameter estimation by consensus based stochastic approximation,” in Proc. of the 46th IEEE Conference on Decision and Control (CDC), New Orleans, LA, USA, Dec. 2007, pp. 1535–1540. [26] R. Olfati-Saber, “Distributed kalman filtering for sensor networks,” in 46th IEEE Conference on Decision and Control, 2007. IEEE, 2007, pp. 5492–5498. [27] R. Olfati-Saber, E. Franco, E. Frazzoli, and J. S. Shamma, “Belief consensus and distributed hypothesis testing in sensor networks,” in Networked Embedded Sensing and Control. Springer Berlin Heidelberg, 2006, pp. 169–182. [28] S. Kar, J. M. Moura, and K. Ramanan, “Distributed parameter estimation in sensor networks: Nonlinear observation models and imperfect communication,” IEEE Tran. Information Theory, vol. 58, no. 6, pp. 3575–3605, 2012. [29] S. Shahrampour, A. Rakhlin, and A. Jadbabaie, “Distributed detection: Finite-time analysis and impact of network topology,” 2014. [30] A. Jadbabaie, P. Molavi, and A. Tahbaz-Salehi, “Information heterogeneity and the speed of learning in social networks,” Columbia Business School Research Paper, pp. 13–28, 2013. [31] X. Vives, “Learning from others: a welfare analysis.” Games Econ. Behav., vol. 20, no. 2, pp. 177–200, 1997. [32] D. Gale and S. Kariv, “Bayesian learning in social networks,” Games Econ. Behav., vol. 45, no. 2, pp. 329–346, 2003. [33] P. Djuric and Y. Wang, “Distributed bayesian learning in multiagent systems,” IEEE Signal Process. Mag., vol. 29, pp. 65–76, March, 2012. [34] M. Mueller-Frank, “A general framework for rational learning in social networks,” The Theoretical Economics, vol. 8, pp. 1–40, 2013. [35] A. Nedic, A. Olshevsky, A. Ozdaglar, and J. Tsitsiklis, “On distributed averaging algorithms and quantization effects,” IEEE Trans. Autom. Control, vol. 54, no. 11, 2009. [36] D. Monderer and L. Shapley, “Fictitious play property for games with identical interests,” Journal of economic theory, vol. 68, no. 1, pp. 258–265, 1996. [37] R. Durrett, Probability: Theory and Examples, 3rd ed. Cambridge Series in Statistical and Probabilistic Mathematics, 2005. [38] A. E. Brouwer and W. H. Haemers, Spectra of graphs. Springer, 2011. [39] R. S. Varga, Matrix iterative analysis. Springer Science & Business, 2009, vol. 27. [40] G. H. Hardy, J. E. Littlewood, and G. Polya, Inequalities, Cambridge Mathematical Library. Cambridge University Press, 1988.
3cs.SY
arXiv:1406.2540v1 [math.AC] 10 Jun 2014 EXAMPLES OF NON-COMMUTATIVE CREPANT RESOLUTIONS OF COHEN MACAULAY NORMAL DOMAINS TONY J. PUTHENPURAKAL Abstract. Let A be a Cohen-Macaulay normal domain. A non commutative crepant resolution (NCCR) of A is an A-algebra Γ of the form Γ = EndA (M ), where M is a reflexive A-module, Γ is maximal Cohen-Macaulay as an Amodule and gldim(Γ)P = dim AP for all primes P of A. We give bountiful examples of equi-characteristic Cohen-Macaulay normal local domains and mixed characteristic Cohen-Macaulay normal local domains having NCCR. We also give plentiful examples of affine Cohen-Macaulay normal domains having NCCR. 1. introduction Let A be a Cohen-Macaulay normal domain. Van den Bergh [14] defined a non-commutative crepant resolution of A (henceforth NCCR) to be an A-algebra Γ of the form Γ = EndA (M ), where M is a reflexive A-module, Γ is maximal Cohen-Macaulay as an A-module and gldim(Γ)P = dim AP for all primes P of A. We should remark that Van den Bergh only defined this for Gorenstein normal domains as this has applications in algebraic geometry. However there are many algebraic reasons for consider this generalization, see [4]. For a nice survey on this topic see [10]. In general, it is subtle to construct NCCR’s. In this paper we give bountiful examples of Cohen-Macaulay normal domains having a NCCR. 1.1. Mixed Characteristic case: We now outline in brief our construction. Recall f ∈ Z[X1 , . . . , Xn ] has content 1 if 1 belongs to the ideal generated by the coefficients of f . We say f is Q-smooth if Q[X1 , . . . , Xn ]/(f ) is a regular ring. For a prime p we say f is smooth mod-p if Zp [X1 , . . . , Xn ]/(f ) is a regular ring. It is well-known that if f is Q-smooth then is smooth mod-p for infinitely many primes p. Our result is: Theorem 1.2. Let (A, m) be an excellent normal Cohen-Macaulay local domain of mixed characteristic with perfect residue field k = A/m of characteristic p > 0. Assume A has a NCCR and that dim A ≥ 2. Also assume that A has a canonical module. Let f ∈ Z[X1 , . . . , Xn ] be of content 1. Also assume that f is Q-smooth Date: February 11, 2018. 1991 Mathematics Subject Classification. 14B05, 14A22, 14E15, 13C14, 16E10 . Key words and phrases. non-commutative crepant resolutions, normal domains, Hensel rings. 1 2 TONY J. PUTHENPURAKAL and is smooth mod-p. Set T = A[X1 , . . . , Xn ]/(f ) and let n be a maximal ideal of T containing mT . Set A(f ) = Tn . Then (i) A(f ) is flat over A with regular fiber. In particular if A is Gorenstein then so is A(f ). (ii) A(f ) is an excellent normal Cohen-Macaulay local domain of mixed characterisitic with perfect residue field. (iii) A(f ) has a NCCR. Furthermore if Γ = HomA (M, M ) is a NCCR of A then Λ = Γ ⊗A A(f ) is a NCCR of A(f ). 1.3. Two dimensional rings of finite representation type have a NCCR. (see [9, Theorem-6]). For examples of two dimensional mixed characteristic rings of finite representation type see [12]. Using the above recipe we can construct plentiful examples of Cohen-Macaulay local domain of mixed characteristic having NCCR’s. If k is algebraically closed then it can be easily shown that if A(f ) ∼ = A(g) as n A-algebra’s then the hypersurfaces defined by f and g in A (k) are birational 1.4. Equi-characteristic case (local): Let (A, m) be an excellent equi-characteristic Cohen-Macaulay local domain with perfect residue field k. Assume A contains k, dim A ≥ 2 and that it has a canonical module. Let f ∈ k[X1 , . . . , Xn ] be smooth, i.e., k[X1 , . . . , Xn ]/(f ) is a regular ring. We show Theorem 1.5. (with hypotheses as in 1.4) Assume A has a NCCR. Set T = A[X1 , . . . , Xn ]/(f ). Let n be a maximal ideal of T containing mT . Set A(f ) = Tn . Then (i) A(f ) is flat over A with regular fiber. In particular if A is Gorenstein then so is A(f ). (ii) A(f ) is an equi-characteristic excellent normal Cohen-Macaulay local domain with perfect residue field. (iii) A(f ) has a NCCR. Furthermore if Γ = HomA (M, M ) is a NCCR of A then Λ = Γ ⊗A A(f ) is a NCCR of A(f ). 1.6. In both Theorems it is clear that M ⊗A A(f ) is reflexive and Λ is maximal Cohen-Macaulay as a A(f )-module. To prove finiteness of global dimension of Λ we may complete A(f ) (see [13, 1.4]). The essential point is to prove the following result: Theorem 1.7. Let (A, m) → (B, n) be a flat local homomorphism of Henselian local rings with fiber F = B/mB regular local. Assume the residue fields k = A/m and l = B/n are perfect. Let M be a finitely generated A-module such that Γ = HomA (M, M ) has finite global dimension. Then gldim Γ ⊗A B ≤ gldim Γ + dim F. CREPANT 3 1.8. Equi-characteristic case (global): Let k be a perfect field. Let A be an affine k-algebra. Assume A is a Cohen-Macaulay normal domain of dimension d ≥ 2. Suppose A has a NCCR Γ = HomA (M, M ). Let f ∈ k[X1 , X2 , . . . , Xn ] be a polynomial such that its homogenization fe defines a smooth hypersurface in Pn (k) (here k is the algebraic closure of k). We show Theorem 1.9. (with hypotheses as in 1.8) Let T (f ) = A[X1 , . . . , Xn ]/(f ). Then (i) T (f ) is a Cohen-Macaulay normal domain. If A is Gorenstein then so is T (f ). (ii) Γ ⊗A T (f ) is a NCCR of T (f ). Let K be the quotient field of A. It is easily shown that if T (f ) ∼ = T (g) as n A-algebra’s then V (f ) is isomorphic to V (g) in the affine space A (K). Thus there are lot of examples of non-isomorphic rings A(f ) having NCCR. 1.10. The main technical tool in this paper is a notion we call absolutely indecomposable modules over a Hensel local ring. Let (A, m) be a Henselian local ring of dimension d ≥ 0 and residue field k. As A is Henselian, the category of finitely generated A-modules is Krull-Schmidt, i.e., any finitely generated Amodule is uniquely a finite direct sum of indecomposable A-modules. Let M be a finitely generated A-module and let rad EndA (M ) be the radical of EndA (M ). Recall that a module E is indecomposable if and only if EndA (E) is local; equivalently EndA (E)/ rad EndA (E) is a division ring. We say E is absolutely indecomposable if EndA (E)/ rad EndA (E) ∼ = k. If M = M1a1 ⊕ · · · ⊕ Mnan with Mi absolutely indecomposable then EndA (M )/ rad EndA (M ) is a direct product of matrix rings over k. This enables us to keep track of EndA (M ) ⊗ B when B is flat over A. The main technical result of this paper is: Theorem 1.11. Let (A, m) be a Henselian local ring with perfect residue field k. Let M be a finitely generated A-module. Then there exists a finite flat extension of the form R = A[X]/(φ(X)) where φ(X) is monic and φ(X) is irreducible in k[X] such that the R-module M ⊗A R is a finite direct sum of absolutely indecomposable R-modules. Furthermore gldim EndA (M ) = gldim EndR (M ⊗A R). We now describe in brief the contents of this paper. In section two we discuss some preliminaries that we need. In section three we introduce the notion of absolutely indecomposable modules. We prove Theorem 1.11 in section 4. In section five we give a description of EndA (E)/ rad EndA (E). We prove Theorem 1.7 in section 6. In section seven we prove Theorems 1.2 and 1.5. Finally in section eight we prove Theorem 1.9. 4 TONY J. PUTHENPURAKAL 2. preliminaries In this paper all commutative rings considered are Noetherian. Commutative rings will be denoted as A, B etc. All non-commutative rings considered will be an A-algebra for some commutative Noetherian ring A, furthermore they will be finitely generated as an A-module. Thus all non-commutative rings in this paper will be both left and right Noetherian. Non-commutative rings will be denoted as Γ, Λ etc. Also all modules in this paper are left modules and they will be finitely generated. In this section we collect some preliminaries which we need. I think that all the results here are already known. I include proofs of some of them as I do not have a reference. 2.1. Suppose Γ is a ring finitely generated over A. Let r = rad Γ. If A is local with maximal ideal m then Γ/r is semisimple and r ⊇ mΓ ⊇ rn for some n ≥ 1. [7, 20.6]. The following is well-known. Proposition 2.2. Let (A, m) be local and let M be an A-module. Set Γ = EndA (M ) and let r = rad Γ. Then (1) HomA (M, mM ) is a two sided ideal in Γ. (2) HomA (M, mM ) ⊆ r. (3) mΓ ⊆ HomA (M, mM ). An easy consequence of the above result is Proposition 2.3. Let f : (A, m) → (B, n) be a flat local map. Let M be an Amodule. Set Γ = EndA (M ) and let r = rad Γ. Set Λ = Γ ⊗A B. Then r ⊗ B is a two sided ideal contained in rad Λ. Proof. Put q = r ⊗ B. Clearly q is a two sided ideal of Λ. If we prove qn ⊆ rad Λ for some n then we are done for Λ/ rad Λ is semisimple. By 2.1 we have that rn ⊆ mΓ for some n ≥ 1. Let φ1 ⊗b1 , φ2 ⊗b2 , · · · , φn ⊗bn ∈ q. Set ψ = φ1 ⊗ b1 ◦ φ2 ⊗ b2 ◦ · · · ◦ φn ⊗ bn , = (φ1 ◦ φ2 ◦ · · · ◦ φn ) ⊗ (b1 b2 · · · bn ) Thus ψ = φ ⊗ b for some φ ∈ rn and b ∈ B. As rn ⊆ mΓ we get that φ(M ) ⊆ mM . So ψ(M ⊗ B) ⊆ m(M ⊗ B). It follows that ψ ∈ HomB (M ⊗ B, n(M ⊗ B)) ⊆ rad Λ (by 2.2). It follows that qn ⊆ rad Λ.  A natural question is when r ⊗ B = rad Λ? We prove Lemma 2.4. Let φ : (A, m) → (B, n) be a flat local map with mB = n. Assume k = A/m is perfect. Let M be an A-module. Set Γ = EndA (M ) and let r = rad Γ. Set Λ = Γ ⊗A B. Then r ⊗ B = rad Λ. CREPANT 5 Proof. By 2.3 we have that r ⊗ B ⊆ rad Λ. It suffices to show that (Γ/r) ⊗ B is semisimple. By 2.1 we have that Γ/r is semisimple. So Γ/r = Mn1 (Ξ1 ) × · · · × Mnr (Ξr ) where Ξ1 , . . . , Ξr are division algebras over k. Also note that k ⊆ Z(Γ/r), the center of Γ/r. It follows that k ⊆ Z(Ξi ) for each i = 1, . . . , r. It suffices to show that Mn (Ξ) ⊗ B is semisimple where Ξ is a division algebra finite dimensional over k and k ⊆ F = Z(Ξ). Set l = B/n. As k is perfect F is separable over k and so F ⊗k l = K1 × · · · × Ks where Ki are finite field extensions of l. Notice Mn (Ξ) ⊗A B = Mn (Ξ) ⊗k k ⊗A B = Mn (Ξ) ⊗k l = Mn (Ξ) ⊗F F ⊗k l = Mn (Ξ) ⊗F (K1 × K2 × · · · × Ks ) = (Mn (Ξ) ⊗F K1 ) × (Mn (Ξ) ⊗F K2 ) × · · · (Mn (Ξ) ⊗F Ks ). It suffices to show that Mn (Ξ) ⊗F K is semisimple where K is an extension of F . We first note that by [7, 15.1], the ring Υ = Ξ ⊗F K is a simple ring. Also note that K = 1 ⊗ K is a subring of Υ. As Ξ is finite dimensional over F we get that Υ is finite dimensional as a K-vector space. In particular Υ is Artinian. Thus by [7, 3.1] Υ is a semisimple ring. Finally notice that as Ξ is finite dimensional over F , the natural ring homomorphism Mn (Ξ) ⊗F K → Mn (Ξ ⊗F K) is an isomorphism, see [7, 7.4]. The result follows.  An easy consequence of the above result is the following: Corollary 2.5. (with hypotheses as in 2.4) gldim Γ = gldim Λ. Proof. For a left Γ module M let projdimΓ M denote its projective dimension. By an argument similar to [13, 1.1] we can show projdimΓ M = projdimΛ M ⊗A B By [13, 1.3] we have that gldim Γ = projdim Γ/r (here we consider r as a left Γ-ideal. Similarly gldim Λ = projdim Λ/ rad Λ. By 2.4 we have that Λ Γ ⊗A B = . r rad Λ The result follows.  6 TONY J. PUTHENPURAKAL 3. absolutely indecomposable modules Let (A, m) be a Henselian local ring of dimension d ≥ 0 and residue field k. Let M be an A-module and let rad EndA (M ) be the radical of EndA (M ). Recall that a module E is indecomposable if and only if EndA (E) is local; equivalently EndA (E)/ rad EndA (E) is a division ring. We say E is absolutely indecomposable if EndA (E)/ rad EndA (E) ∼ = k. We need the following: Definition 3.1. Suppose (A, m) is a Henselian local ring of dimension d ≥ 0 and residue field k. Let K ⊇ k be a field. Then F (A, K) is the collection of Henselian local rings (B, n) such that (1) there is a flat local map φ : A → B. (2) mB = n. (3) B/n ∼ = K over k. Note that by [1, App. Théoréme 1, Corollaire] there exists a local ring B (notb ∈ F (A, K). necessarily Henselian) satisfying (1), (2) and (3). Clearly B The word ”absolutely indecomposable” is well chosen thanks to the following result. Theorem 3.2. Let (A, m) be a Henselian local ring with perfect residue field k. Let M be an A-module. The following are equivalent: (i) M is absolutely indecomposable. (ii) M ⊗A B is absolutely indecomposable for every B ∈ F (A, K) for any extension field K of k. (iii) M ⊗A B is indecomposable for every B ∈ F (A, K) for any extension field K of k. (iv) M ⊗A B is indecomposable for some B ∈ F (A, K) with K algebraically closed. Proof. Set EndA (M ) = Γ and r = rad Γ. For B ∈ F (A, K) set Λ = Γ ⊗ B and q = r ⊗ B. (i) =⇒ (ii). We have the exact sequence 0 → r → Γ → k. Tensoring with B yields (*) 0 → q → Λ → K → 0. By 2.4 we have that q = rad Λ. It follows that M ⊗ B is absolutely indecomposable. (ii) =⇒ (iii). Clear. (iii) =⇒ (iv). Clear. (iv) =⇒ (i). Notice Λ/ rad Λ is a divison algebra which is finite over K. As K is algebraically closed we get that Λ/ rad Λ = K. As M ⊗ B is indecomposable we have that M is also indecomposable. Say Γ/r = Ξ where Ξ is a divison ring. Say dimk Ξ = r. By 2.4 we have that q = rad Λ. CREPANT 7 It follows that Ξ ⊗k K = K. Computing dimensions as vector space over K we get that r = 1. So Ξ = k. Thus M is absolutely indecomposable.  4. Proof of Theorem 1.11 In this section we give a proof of Theorem 1.11. The essential ingredient is a construction which we now describe: 4.1. Let (A, m) be a Henselian local ring with perfect residue field k. Let k be the algebraic closure of k. Let Ck = {E | E is a finite extension of k, and E ⊆ k}. Order Ck with the inclusion as partial order. Note that Ck is a directed set, for if E, F ∈ Ck then the composite field EF ∈ Ck and clearly EF ⊇ E and EF ⊇ F . We prove Theorem 4.2. (with hypotheses as in 4.1) There exists a direct system of local rings {(AE , mE ) | E ∈ Ck } such that ∼ E over (1) AE is a finite flat extension with mAE = mE . Furthermore AE /mE = k. (2) AE is Henselian. (3) For any F, E ∈ Ck with F ⊆ E the maps in the direct system θFE : AF → AE is flat and local with mF AE = mE . The ring T = limE∈Ck AE will have nice properties which enables us to prove Theorem 1.11. 4.3. Construction-1.1: For every E ∈ Ck we construct a ring AE as follows. As k is perfect, E is a separable extension of k. So by primitive element theorem E = k(αE ) for some αE ∈ E. Let pE (X) = pE,αE (X) = Irr(αE , k), be the unique monic minimal polynomial of αE over k. Let fE (X) = fE,αE (X) be a monic polynomial in A[X] such that fE (X) = pE (X). Set AE = A[X] . (fE (X)) Our construction of course depends on choice of αE and the choice of fE (X). We will simply fix one choice of αE and fE (X). We prove: Proposition 4.4. (with hypotheses as in 4.3) (i) AE is a finite flat extension of A. (ii) AE has a unique maximal ideal mE . Furthermore (a) mAE = mE . 8 TONY J. PUTHENPURAKAL (b) AE /mE ∼ = E. E (iii) A is a Henselian local ring. Proof. (i) This is clear. (ii) Notice AE /mAE = k[X]/(pE (X)) ∼ = E. It follows that mAE is a maximal ideal of AE . Also as AE is a finite extension of A any maximal ideal n of AE will contain m. It follows that mE = mAE is the unique maximal ideal of AE . Clearly (a), (b) hold. (iii). Let S be a finite AE -algebra. Then note that S is a finite A-algebra. As A is Henselian we get that S is a product of local rings. Thus AE is Henselian.  4.5. Construction-1.2: Let k ⊆ F ⊆ E be a tower of fields. We construct a ring homomorphism θFE : AF → AE as follows: Notice αF ∈ E. It follows that PF (Y ) = (Y − αF )h(Y ) for some polynomial h(Y ) ∈ E[Y ]. As F is separable over k, the roots of PF (Y ) are all distinct. It follows that (Y − αF , h(Y )) = 1. The ring AE is Henselian. So there exists ξ ∈ AE and g(Y ) ∈ AE [Y ] such that ξ = αF , g(Y ) = h(Y ) and fF (Y ) = (Y − ξ)g(Y ). Claim-1: If ξ ′ ∈ AE such that fF (ξ ′ ) = 0 and ξ ′ = αF then ξ ′ = ξ. Note that 0 = fF (ξ ′ ) = (ξ ′ − ξ)g(ξ ′ ). As h(αF ) 6= 0 we get that g(ξ ′ ) is a unit in AE . So ξ ′ = ξ. Notation: Denote ξ as ξFE . Define θFE : AF → AE , a → a for all a ∈ A, X → ξFE We prove: Proposition 4.6. (with hypotheses as in 4.5) (i) (ii) (iii) (iv) θFE is a homomorphism of A-algebra’s. θFE is a local map and mF AE = mE . AE is a flat AF -module (via θFE ). If k ⊆ F ⊆ E ⊆ L is a tower of fields then we have a commutative diagram AF ❈ ❈❈ L ❈❈θF E ❈❈ θF ❈!  E / AL A L θE Proof. (i) This is clear since θFE (a) = a for each a ∈ A. (ii). As θFE fixes A we get that θFE (mF ) = θFE (mAF ) ⊆ mAE = mE . Thus θFE is local. CREPANT 9 Also note that mF AE = mAF AE = mAE = mE . (iii). Suppose dimF E = r and dimk F = s. Then dimk E = rs. Notice AE /mF AE = E it follows that AE is generated as an AF module by r-elements; say {e1 , . . . , er }. Similarly AF is generated as an A-module by s elements; say {f1 , . . . , fs }. It follows that AE is generated over A by {ei fj | 1 ≤ i ≤ r, 1 ≤ j ≤ s}. However AE is a free A-module of rank dimk E = rs. It follows that {ei fj }i,j is a basis of the A-module AE . Claim: {e1 , e2 , . . . , er } is a basis of AE over AF . We already have that AE is generated as an AF module by {e1 , e2 , . . . , er }. Suppose β1 e1 + β2 e2 + · · · + βr er = 0 for some βi ∈ AF . Write βi = s X γij fj for some γij ∈ A. j=1 It follows that X γij ei fj = 0 i,j As {ei fj }i,j is a basis of the A-module AE we get that γij = 0 for all i, j. It follows that βi = 0 for all i. Thus {e1 , e2 , . . . , er } is a basis of AE over AF . (iv). Note fF (Y ) = (Y − ξFE )g(Y ) in AE [Y ]. Applying θFE and noting that it fixes A we get fF (Y ) = (Y − θFE (ξFE ))θ(g(Y )) in AL [Y ]. Notice θFE (ξFE ) = αF . So by uniqueness we get ξFL = θFE (ξFE ). The result follows.  As a consequence we get Proof of Theorem 4.2. This follows from 4.4 and 4.6.  4.7. Construction-1.3: Set T = lim AE , E∈Ck and let θE : E → T be the maps such that for any F ⊆ E in Ck we have θE ◦θFE = θF . For F ∈ Ck set CF = {E | E is a finite extension of F }. Then clearly CF is cofinal in Ck . Thus we have T = lim AE . E∈CF We have the following properties of T . Theorem 4.8. (with hypotheses as in 4.7) (i) T is a Noetherian ring. 10 TONY J. PUTHENPURAKAL (ii) (iii) (iv) (v) T is a flat A-module. T is a flat AF -module for any F ∈ Ck . The map θE is injective for any E ∈ Ck . S S By (iv) we may write T = E∈Ck AE . Set mT = E∈Ck mE . Then mT is the unique maximal ideal of T . (vi) mT = mT . (vii) T /mT ∼ = k. (viii) T is a Henselian ring. Proof. (i). As AF → AE is flat whenever F ⊆ E and mF AE = mE we get that T is Noetherian, see [3, Chap.0, (10.3.13)]. (ii). Let N be any A-module. Notice for any i ≥ 1 we have A E TorA i (T, N ) = Tori ( lim A , N ), E∈Ck E = lim TorA i (A , N ) E∈Ck = 0. Thus T is a flat as an A-module. (iii). This is similar to (ii). (iv). This follows since each map θFE in the direct limit is injective. (v). It is clear that mT is an ideal in T . Suppose ξ ∈ / mT . Then ξ ∈ / mE for some E T E. This implies that ξ is a unit in A . So ξ is a unit in T . Thus m is the unique maximal ideal of T . (vi). Clearly mT ⊆ mT . Let ξ ∈ mT . Then ξ ∈ mE for some E ∈ Ck . But E m = mAE . It follows that ξ ∈ mT . Thus mT = mT . (vii). The inclusion θE : AE → T is flat local map of A-algebras and so induces an inclusion of fields θE : E → T /mT over k. It follows that L = T /mT contains k. Let ξ ∈ L. Let ξ ∈ T be its pre-image. Say ξ ∈ AE . Then notice the map θE maps ξ + mE to ξ. It follows that L = k. (viii). Let f (Y ) ∈ T [Y ] be a monic polynomial such that its residue class f (Y ) modulo mT T [Y ] has a factorization f = g ′ h′ with monic polynomials g ′ , h′ ∈ T /mT [Y ] and (g ′ , h′ ) = 1. By (v) there exists E ∈ Ck such that f (Y ) ∈ AE [Y ]. We may assume that all coefficients of g ′ , h′ ∈ F for some F ∈ Ck . Set K = EF . Then note that f ∈ AK [Y ] and modulo mK K[Y ] we have a factorization f = g ′ h′ . As AK is Henselian we have that there exists monic polynomials g, h ∈ AK [Y ] with  f = gh and g = g ′ and h = h′ . Now note that g, h ∈ T [Y ]. The significance of T is that certain crucial properties descend to a finite extension E of k. Lemma 4.9. (with hypotheses as above) CREPANT 11 (1) Let M be a T -module. Then there exists E ∈ Ck and an AE -module N such that M = N ⊗AE T . (2) Let N1 , N2 be AE -modules for some E ∈ Ck . Suppose there is a T -linear map f : N1 ⊗AE T → N2 ⊗AE T . Then there exists K ∈ Ck with K ⊇ E and an AK -linear map g : N1 ⊗AE AK → N2 ⊗AE AK such that f = g ⊗T . Furthermore if f is an isomorphism then so is g. φ → F0 → M → 0 be a finite presentation of M . Say φ = (aij ). Proof. (1) Let F1 − Then by 4.8-(v) there exists E ∈ Ck such that all aij ∈ AE . Consider a presentation φ → G0 → N → 0 of AE -module N . Clearly N ⊗AE T ∼ G1 − = M. ∼ (2). Notice HomT (N1 ⊗AE T, N2 ⊗AE T ) = HomAE (N1 , N2 ) ⊗AE T . Thus f = f1 ⊗ ξ1 + · · · + fs ⊗ ξs , for some fi ∈ HomAE (N1 , N2 ) and ξi ∈ T. Then by 4.8-(v) there exists F ∈ Ck such that all ξi ∈ AF . Let K = EF . Set g = f1 ⊗ ξ1 + · · · + fs ⊗ ξs ∈ HomAE (N1 , N2 ) ⊗AE AK . Clearly g ⊗ T = f . Let U, V be the kernel and cokernel of g. If f is an isomorphism then U ⊗AK T = V ⊗AK T = 0. By 4.8-(iii) we have that T is a faithfully flat extension of AK . It follows that U = V = 0. Thus g is an isomorphism.  We now give Proof of Theorem 1.11. We make the construction as in 4.2. Let M ⊗A T = Lr11 ⊗ · · · ⊕ Lrmm where L1 , · · · , Lm are indecomposable T -modules. By 4.9 it follows that there exists E ∈ Ck and AE -modules Ni with Ni ⊗ T = Li for i = 1, . . . , m. By 3.2 it follows that Ni are absolutely indecomposable. Notice ! s M r E ∼ N i ⊗AE T. M ⊗A T = (M ⊗A A ) ⊗AE T = i i=1 By 4.9 there exists K ∈ Ck with K ⊇ E such that ! s M Niri ⊗AE AK = M ⊗AK AK = (M ⊗A AE ) ⊗AE AK ∼ = i=1 s M i=1 Niri ⊗AE AK ! . By 3.2 the AK -modules Ni ⊗AE AK are absolutely indecomposable. We take R = AK . Note that R has the required form by 4.3. By 2.5 we get that gldim EndA (M ) = gldim EndR (M ⊗A R).  The following result will be useful later. Lemma 4.10. Let φ : (A, m) → (B, n) be a flat local map of Henselian rings. Assume the residue fields k, l of A and B are perfect. Let M be an A module. Then 12 TONY J. PUTHENPURAKAL there exists a commutative diagram of flat local maps of Henselian rings A η φ′ φ  B / A′ δ  / B′ such that (1) (2) (3) (4) (A′ , m′ ) is a finite flat extension of A with mA′ = m′ . M ⊗ A′ is a direct sum of absolutely indecomposable A′ -modules. (B ′ , n′ ) is a finite flat extension of B with nB ′ = n′ . If the fiber F of φ is regular local then so is the fiber F ′ of φ′ . Proof. (1) and (2): Let A′ = A[X]/(f (X)) be as in Theorem 1.11. e = B ⊗ A′ . Then clearly B e is a flat extension of A′ . Furthermore B e is (3). Set B e a flat extension of B. Also B is a finite extension of B. As B is Henselian we get e is a direct product of local rings say B e = B1 × · · · × Bs . We note that as k that B is perfect we get that e ⊗B B/n ∼ B = K1 × · · · × Km = k[X]/(f (X)) ⊗k l ∼ where K1 , · · · , Km are finite field extensions of l. We now note that B1 is localizae at a maximal ideal. As l is perfect we get that B1 is a finite separable tion of B extension of B. So nB is the maximal ideal of B1 , see [15, 2.5]. Set B ′ = B1 . (4). We note that δ induces a flat map δ : B/mB → B ′ /mB ′ . We note that as mA′ = m′ we get that mB ′ = m′ B ′ . Thus δ : F → F ′ is a flat map. As nB ′ = n′ we get that the fiber of δ is a field. So if F is regular then so is F ′ , see [11, 23.7].  5. A description of EndA (E)/ rad EndA (E) In this section (A, m) is a Henselian ring and E is a finitely generated A-module. Assume E = E1a1 ⊕ · · · ⊕ Esas where E1 , E2 , · · · , Es are mutually non-isomorphic indecomposable A-modules. We prove Theorem 5.1. (with hypotheses as above)     EndA (Es ) EndA (E1 ) EndA (E) ∼ × · · · × M as = M a1 rad EndA (E) rad EndA (E1 ) rad EndA (Es ) (here for a ring Γ, we denote by Mn (Γ) the ring of n × n matrices over Γ. 5.2. Let M, N be two A-modules. Then note that we have an isomorphism of rings " # EndA (M ) HomA (N, M ) ∼ EndA (M ⊕ N ) = HomA (M, N ) EndA (N ) Clearly Theorem 5.1 follows from the following: CREPANT 13 Theorem 5.3. Let M, N be two A-modules and let M = M1a1 ⊕ · · · ⊕ Msas and N = N1b1 ⊕ · · · ⊕ Nrbr with Mi , Nj indecomposable. Assume Mi ≇ Nj for all i, j. Also assume Mi ≇ Mj for i 6= j and Ni ≇ Nj for i 6= j. Then " # rad EndA (M ) HomA (N, M ) rad EndA (M ⊕ N ) = HomA (M, N ) rad EndA (N ) We need the following Lemma 5.4. (with hypotheses as in 5.3) Let f ∈ HomA (M, N ) and let g ∈ HomA (N, M ). Then g ◦ f ∈ rad EndA (M ) and f ◦ g ∈ rad EndA (N ). Proof. We induct on s, the number of factors of M . We first prove when s = 1. So M = M1a1 . It suffices to prove the result when N is indecomposable. If N = D1 ⊕ D2 and assume the result is known for D1 and D2 . Let f : M → N and g : N → M . Write f = (f1 , f2 ) and g = g1 + g2 where fi : M → Di and gi : Di → M for i = 1, 2. Then g ◦ f = g1 ◦ f1 + g2 ◦ f2 . By our assumption, gi ◦ fi ∈ rad End(M ). So g ◦ f ∈ rad End(M ). We first consider the case when a1 = 1. So let f : M1 → N and let g : N → M1 . If g ◦ f ∈ / rad End(M1 ) then it is invertible as M1 is indecomposable. It follows that ∼ M1 = N (see the proof in [8, Chapter X, Lemma 7.6]) This is a contradiction. Now assume a1 ≥ 2. Let f : M1a1 → N and let g : N → M1a1 . Write f = f1 + · · · + fa1 and g = [g1 , · · · , ga1 ]tr where fi : M1 → N and gi : N → M1 for all i. Then notice g ◦ f = [gi fj ]. By the previous case we get that gi fj ∈ rad End(M1 ). It follows that g ◦ f ∈ Ma1 (rad End(M1 )) = rad(Ma1 (End(M1 ))) = rad End(M1a1 ). (for the first equality above see [7, p. 61].) Assume the result for s = c. We prove it when s = c + 1. Let M = M1a1 ⊕ ac+1 ac+1 · · · ⊕ Mcac ⊕ Mc+1 . Set D = M1a1 ⊕ · · · ⊕ Mcac . Then M = D ⊕ Mc+1 . Let tr f : M → N and g : N → M . Write f = [f1 , f2 ] and g = [g1 , g2 ] where f1 : D → N ac+1 ac+1 and f2 : Mc+1 → N and g1 : N → D and g2 : N → Mc+1 . Then " # g1 ◦ f1 g1 ◦ f2 g◦f = g2 ◦ f1 g2 ◦ f2 a c+1 By induction hypotheses we have g1 ◦f1 ∈ rad End(D) and g2 ◦f2 ∈ rad End(Mc+1 ). Set # # " " 0 g1 ◦ f2 g1 ◦ f1 0 and ξ2 = ξ1 = 0 0 0 0 " # " # 0 0 0 0 ξ3 = and ξ4 = g2 ◦ f1 0 0 g2 ◦ f2 As g ◦ f = ξ1 + ξ2 + ξ3 + ξ4 it suffices to show that ξi ∈ rad End(M ) for each i. 14 TONY J. PUTHENPURAKAL Let φ = [φij ] ∈ End(M ). Then notice " 1 − φ11 ◦ g1 ◦ f1 1 − φξ1 = −φ21 ◦ g1 ◦ f1 0 1 # Notice φ11 ◦ g1 ◦ f1 rad End(D). So 1 − φ11 ◦ g1 ◦ f1 is invertible in End(D). It follows that 1 − φξ1 is invertible. So ξ1 ∈ rad End(M ). Similarly ξ4 ∈ rad End(M ). We now prove ξ2 ∈ rad End(M ). Set θ = g1 ◦ f2 . Notice " 1 −φ11 ◦ θ 1 − φξ2 = 0 1 − φ21 ◦ θ # a a c+1 c+1 → D. So by induction hypotheses and θ : Mc+1 Also note that φ21 : D → Mc+1 ac+1 we have that φ21 ◦ θ ∈ rad End(Mc+1 ). It follows that 1 − φξ2 is invertible in End(M ). So ξ2 ∈ rad(End(M )). Similarly ξ3 ∈ rad End(M ).  We now give Proof of Theorem 5.3. Set " # rad EndA (M ) HomA (N, M ) q= HomA (M, N ) rad EndA (N ) We first prove that q is a two sided ideal contained in rad End(M ⊕ N ). Let ξ = [ξij ] ∈ q. Let φ = [φij ] ∈ End(M ). Then " φ11 ξ11 + φ12 ξ21 φ◦ξ = φ21 ξ11 + φ22 ξ21 φ11 ξ12 + φ12 ξ22 φ21 ξ12 + φ22 ξ22 # By Lemma 5.4 we have that φ12 ξ21 ∈ rad End(M ) and φ21 ξ12 ∈ rad End(N ). It follows that φ ◦ ξ ∈ q. Similarly ξ ◦ φ ∈ q. Therefore q is an ideal in End(M ⊕ N ). We now show that q ⊆ rad End(M ⊕ N ). Let ξ = [ξij ] ∈ q. Set " ξ11 ξ1 = 0 " 0 ξ3 = ξ21 # 0 0 # 0 0 " # " # 0 ξ12 and ξ2 = 0 0 0 0 and ξ4 = 0 ξ22 As ξ = ξ1 + ξ2 + ξ3 + ξ4 . It suffices to show that each ξi ∈ rad End(M ⊕ N ). This is similar to the proof in 5.4. As End(M ⊕ N )/q is semi-simple and q ⊆ rad End(M ⊕ N ) it follows that q = rad End(M ⊕ N )  CREPANT 15 6. Proof of Theorem 1.7 In this section we give give a proof of Theorem 1.7. We restate it for the convenience of the reader. Theorem 6.1. Let (A, m) → (B, n) be a flat local homomorphism of Henselian local rings with fiber F = B/mB regular local. Assume the residue fields k = A/m and l = B/n are perfect. Let M be a finitely generated A-module such that Γ = HomA (M, M ) has finite global dimension. Then gldim Γ ⊗A B ≤ gldim Γ + dim F. Proof. We first consider the case M = M1a1 ⊕ · · · ⊕ Msas where Mi are distinct absolutely indecomposable A-modules. Set r = rad Γ and q = rad(Γ ⊗ B). By 2.3 we get that r ⊗ B ⊆ q. Let x1 , . . . xc ∈ n be such that their images in F minimally generate the maximal ideal of F . By 2.1 we get that (x)(Γ ⊗ B) ⊆ q. By Theorem 5.1 we get that Γ/r is a direct product of matrix rings over k. Therefore (Γ/r) ⊗ B is a direct product of matrix rings over F . It follows that q = r ⊗ B + (x)(Γ ⊗ B). By [11, p. 177], x is a B-regular sequence. Also note that x ∈ Z(Γ ⊗ B) the center of Γ ⊗ B. Let K = K(x, B) be the Koszul complex of B with respect to x. As Γ/r ⊗ B is a direct product of matrix rings over F we get that   Γ ⊗B C = K ⊗B r is also acyclic with zeroth homology group (Γ ⊗ B)/q. We now note that projdim Ci = projdim Γ/r ⊗ B for each module in the complex C. Also note that projdim Γ/r ⊗ B ≤ projdim Γ/r = gldim Γ, here the second equality holds since Γ is semi-perfect with radical r. It follows that projdim(Γ ⊗ B)/q ≤ c + gldim Γ. We note that Γ ⊗ B is semi-perfect with radical q. So gldim Γ ⊗ B = projdim(Γ ⊗ B)/q ≤ c + gldim Γ. Thus we have proved the result in this case. Now we consider the general case. By 4.10 there exists a commutative diagram of flat local maps of Henselian rings A η φ′ φ  B / A′ δ  / B′ such that (1) (A′ , m′ ) is a finite flat extension of A with mA′ = m′ . (2) M ⊗ A′ is a direct sum of absolutely indecomposable A′ -modules. (3) (B ′ , n′ ) is a finite flat extension of B with nB ′ = n′ . 16 TONY J. PUTHENPURAKAL (4) The fiber F ′ of φ′ is also regular. Notice dim F ′ = dim F = c. Let t = gldim Γ. By 2.5 we have that gldim Γ ⊗A A′ = gldim Γ = t. By our previous case we have that gldim(Γ ⊗A A′ ) ⊗A′ B ′ ≤ t + c. We now note that (Γ ⊗A A′ ) ⊗A′ B ′ ∼ = (Γ ⊗A B) ⊗B B ′ . = Γ ⊗A B ′ ∼ By 2.5 we get that gldim Γ ⊗A B = gldim(Γ ⊗A B) ⊗B B ′ ≤ t + c.  7. Proof of Theorems 1.2 and 1.5 We first give Proof of Theorem 1.2. We first note that if L is a field of characteristic 0 or p, the ring L[X1 , . . . , Xn ]/(f ) is regular. (i) By [11, p. 177] we get that T is a flat extension of A. So the map φ : A → A(f ) is flat and local. Also note the fiber of φ is k[X1 , . . . , Xn ]/(f ) localized at a maximal ideal. In particular it is regular local. Thus A(f ) is Cohen-Macaulay. Furthermore A(f ) is Gorenstein if A is. (ii) Clearly A(f ) is excellent. The residue field of A(f ) is the residue field of k[X1 , . . . , Xn ]/(f ) localized at a maximal ideal. In particular it is a finite extension of k and so it is perfect. It is also clear that A(f ) is of mixed characteristic. As A(f ) is local, to prove that it is a normal domain it suffices to prove it is normal. As A(f ) is Cohen-Macaulay clearly it satisfies S2 . Also as A(f ) is catenary it suffices to show that A(f )P is regular for every prime ideal P of height one. Let P be a prime ideal in A(f ) of height one. Let q = P ∩ A. Note that we have a flat local map ψ : Aq → A(f )P . Let F be the fiber of ψ. We now note that 1 = ht P = dim A(f )P = dim A + dim F = ht q + dim F. Thus ht q ≤ 1. Case 1: ht q = 0. So q = 0. Let K be the quotient field of A. Then Aq = K. Also F is a localization of K[X1 , . . . , Xn ]/(f ) and so is regular. It follows that A(f )P is regular in this case. Case 2: ht q = 1. This implies that dim F = 0. Let κ(q) be the the residue field of Aq . Then note that F is κ(q)[X1 , . . . , Xn ]/(f ) localized at a minimal prime. We note that κ(q) is either of characteristic zero or p. As observed earlier κ(q)[X1 , . . . , Xn ]/(f ) is a regular ring. So F is a field. As A is normal, Aq is regular. It follows that A(f )P is regular. CREPANT 17 Thus A(f ) satisfies R1 . So A(f ) is normal. As A(f ) is local we get that A(f ) is a normal domain. (iii) Set B = A(f ). Let Γ = EndA (M ) be a NCCR of A. It is clear that M ⊗A B is a reflexive A-module and that Λ = Γ ⊗ B is maximal Cohen-Macaulay as an B-module. We also note that B has a canonical module, [2, 3.3.14] Thus it suffices to prove gldim Λ = dim B, [5, 2.17]. By 2.5 we may complete B. Thus it suffices b = dim B. By [11, 22.4]the map φ : A → B extends to a flat to prove gldim Λ ⊗ B b b b map φ : A → B. Also note that b ⊗ b B. b b = (Γ ⊗A A) Λ ⊗B B A By Theorem 1.7 we get that b + dim B b − dim A b b ≤ gldim Γ ⊗A A gldim Λ ⊗B B = gldim Γ + dim B − dim A = dim B Thus gldim Λ ≤ dim B, by 2.4. As Λ is maximal Cohen-Macaulay we always have gldim Λ ≥ dim B, see [10, F.1]. Thus gldim Λ = dim B. It follows that Λ is a NCCR for B.  7.1. A proof of Theorem 1.5 can be given along the same lines as above. The only thing to note that for any prime q in A the residue field κ(q) of Aq contains k. So κ(q)[X1 , . . . , Xn ]/(f ) is a regular ring. 8. Proof of Theorem 1.9 In this section we give Proof of Theorem 1.9. (i) Let K be the quotient field of A. We first prove that f is irreducible in K[X1 , . . . , Xn ]. Let K be the algebraic closure of K. As k ⊆ K we get that k ⊆ K. As fe is smooth in Pn (k) we get that fe and its partial q derivatives n do not have a common zero in P . Therefore (X0 , X1 , . . . , Xn ) = (fe, J(fe)) in q k[X0 , . . . , Xn ]. It follows that (X0 , X1 , . . . , Xn ) = (fe, J(fe)) in K[X0 , . . . , Xn ]. Therefore fe is irreducible in K[X0 , X1 , . . . , Xn ]. It follows that f is irreducible inK[X1 , . . . , Xn ] and hence it is irreducible in K[X1 , . . . , Xn ]. Claim 1: T (f ) is a domain. We assert that (f )K[X1 , . . . , Xn ] ∩ A[X1 , . . . , Xn ] = (f )A[X1 , . . . , Xn ]. If this assertion is proved then T (f ) will be a subring of k[X1 , . . . , Xn ]/(f ) and so a domain. Let ξ ∈ (f )K[X1 , . . . , Xn ] ∩ A[X1 , . . . , Xn ]. Then ξ = f g for some g ∈ K[X1 , . . . , Xn ]. Clearing denominators of g we get that there exists a ∈ A and w ∈ A[X1 , . . . , Xn ] such that ξa = f w. We prove that a divides all the coefficients of w. Let P be a height one prime in A. Then AP is a DVR, so in particular a 18 TONY J. PUTHENPURAKAL UFD. Let R = AP [X1 , . . . , Xn−1 ] and let L be the quotient field of R. We may assume that Xn appears as a term in f . So f ∈ / L. Note L is also the quotient field of K[X1 , . . . , Xn−1 ]. Note that by Gauss Lemma, f is irreducible in L[Xn ] as the content of f is one. So again by Gauss Lemma we get that f is irreducible in R[Xn ] = AP [X1 , . . . , Xn ]. It follows that if c is a coefficient of w then (c/a)P ∈ AP . But A is a normal domain. So \ Aq = A. ht q=1 It follows that c/a ∈ A. Thus ξ ∈ (f )A[X1 , . . . , Xn ]. By [11, p. 177], f is a non-zero divisor of A[X1 , . . . , Xn ] and T (f ) is a flat extension of A. Also note that dim T (f ) = dim A + n − 1. Let n be a maximal ideal of T (f ). Claim-2 n ∩ A is a maximal ideal of A. Clearly T (f ) is an affine ring. Also by Claim-1 we have that T (f ) is a domain. Thus ht n = dim T (f ) = dim A + n − 1. Let P = n ∩ A. We have a flat map ψ : AP → T (f )n . Let F be the fiber of ψ. Then note that F is a localization of κ(P )[X1 , . . . , Xn ]/(f ). As the content of f is one we get that f is a non-zero divisor in κ(P )[X1 , . . . , Xn ]. So dim F ≤ n − 1. By the dimension formula for flat extensions it follows that ht P ≥ dim A. So P is a maximal ideal of A. Claim 3: T (f ) is Cohen-Macaulay. Also if A is Gorenstein then so is T (f ). We first note that k[X1 , . . . , Xn ]/(f ) is a regular ring. Let n be a maximal ideal of T (f ). Then by Claim 2 we get that m = n ∩ A is a maximal ideal of A. We have a flat extension ψ : Am → T (f )n . Note that κ(m) = A/m is a finite extension of k. As k is perfect we get that D = κ(m)[X1 , . . . , Xn ]/(f ) is regular. The fiber F of ψ is a localization of D and so is regular. Thus T (f )n is Cohen-Macaulay and is Gorenstein if A is. The assertion that T (f ) is normal follows exactly as in the argument in the proof of Theorem 1.2. (ii) Let Γ = EndA (M ) be a NCCR of A. Clearly M ⊗ T (f ) is a reflexive T (f )-module. Furthermore Λ = Γ ⊗A T (f ) is maximal Cohen-Macaulay as a T (f )module. The ring T (f ) has a canonical module [6, 18.21]. So it suffices to prove that gldim Γn = dim T (f )n for all maximal ideals n of T (f ). We note that n∩A = m a maximal ideal of A (by claim 2). Also as A and T (f ) are affine domains over k we get that the residue fields of m and n are finite extensions of k and so perfect. The proof of the assertion gldim Γn = dim T (f )n follows exactly as in the case of Theorem 1.2.  References [1] N. Bourbaki, Algebré commutative. ix: Anneaux locaux réguliers complets, Masson, Paris, 1983. CREPANT 19 [2] W. Bruns and J. Herzog, Cohen-Macaulay rings, Revised Edition, vol. 39, Cambridge studies in advanced mathematics, Cambridge University Press, Cambridge, 1997. [3] A. Grothendieck and J. A. Dieudonné, Éléments de géométrie algébrique, Chap. III(part1), Inst. Hautes Etudes Sci. Publ. Math. 24, 1965. [4] O. Iyama and M. Wemyss, On the noncommutative Bondal-Orlov conjecture, J. Reine Angew. Math. 683 (2013), 119-128. [5] O. Iyama and M. Wemyss, Maximal Modifications and Auslander-Reiten Duality for Nonisolated Singularities Invent. Math(to appear), eprint: arXiv:1007.1296v4 [6] S. Iyengar et. al, Twenty-four hours of local cohomology, Graduate Studies in Mathematics, 87. American Mathematical Society, Providence, RI, 2007. xviii+282 pp. [7] T. Y. Lam, A first course in noncommutative rings, Second edition. Graduate Texts in Mathematics, 131. Springer-Verlag, New York, 2001. [8] S. Lang, Algebra, Revised third edition. Graduate Texts in Mathematics, 211. Springer-Verlag, New York, 2002. [9] G. J. Leuschke, Endomorphism rings of finite global dimension, Canad. J. Math. 59 (2007), no. 2, 332-342. [10] G. J. Leuschke, Non-commutative crepant resolutions: scenes from categorical geometry, Progress in commutative algebra 1, 293-361, de Gruyter, Berlin, 2012. [11] H. Matsumura, Commutative ring theory, Translated from the Japanese by M. Reid. Second edition. Cambridge Studies in Advanced Mathematics, 8. Cambridge University Press, Cambridge, 1989. [12] T. J. Puthenpurakal, On two dimensional mixed characteristic rings of finite Cohen Macaulay type, Preprint: arXiv:1404.6939 [13] M. Ramras, Maximal orders over regular local rings of dimension two, Trans. Amer. Math. Soc. 142 1969 457-479. [14] M. van den Bergh, Non-commutative crepant resolutions, The legacy of Niels Henrik Abel, 749-770, Springer, Berlin, 2004. [15] R. Wiegand, Local rings of finite Cohen-Macaulay type, J. Algebra 203 (1998), no. 1, 156-168. Department of Mathematics, IIT Bombay, Powai, Mumbai 400 076 E-mail address: [email protected]
0math.AC
A model of reward-modulated motor learning with parallel cortical and basal ganglia pathways Ryan Pyle1 ,∗ and Robert Rosenbaum1,2,∗ 1: Department of Applied and Computational Mathematics and Statistics, University of Notre Dame, Notre Dame, Indiana, USA. 2:Interdisciplinary Center for Network Science and Applications, University of Notre Dame, Notre Dame, Indiana, USA. arXiv:1803.03304v1 [q-bio.NC] 8 Mar 2018 * [email protected], [email protected] Acknowledgments This work was supported by National Science Foundation grants DMS-1517828, DMS-1654268, and DBI-1707400. The authors thank Jonathan Rubin, Robert Turner, and Robert Mendez for helpful discussions. Abstract Many recent studies of the motor system are divided into two distinct approaches: Those that investigate how motor responses are encoded in cortical neurons’ firing rate dynamics and those that study the learning rules by which mammals and songbirds develop reliable motor responses. Computationally, the first approach is encapsulated by reservoir computing models, which can learn intricate motor tasks and produce internal dynamics strikingly similar to those of motor cortical neurons, but rely on biologically unrealistic learning rules. The more realistic learning rules developed by the second approach are often derived for simplified, discrete tasks in contrast to the intricate dynamics that characterize real motor responses. We bridge these two approaches to develop a biologically realistic learning rule for reservoir computing. Our algorithm learns simulated motor tasks on which previous reservoir computing algorithms fail, and reproduces experimental findings including those that relate motor learning to Parkinson’s disease and its treatment. 1 Introduction Even simple motor tasks require the generation intricate, dynamical patterns of muscle activations. Understanding how the brain generates this motor output is a central problem in neuroscience that can inform the development of brain-machine interfaces, treatments for motor diseases, and control algorithms for robotics. Recent work is largely divided into addressing two distinct questions: How are motor responses encoded and how are they learned? From the coding perspective, it has been shown that the firing rates of cortical neurons exhibit dynamics that do not always code for specific stimulus or movement parameters [15]. A prevailing theory poses that these firing rate patterns are part of an underlying dynamical system that serves as a high-dimensional “reservoir” of dynamics from which motor output signals are distilled [42, 44]. This notion is formalized by reservoir computing models, in which a chaotic, recurrent neural network serves as a reservoir of firing rate dynamics and synaptic readout weights are trained to produce target time series [44, 30, 26, 45, 29, 47]. Reservoir computing models can learn to generate intricate dynamical responses and they produce firing rate patterns that are similar to those of cortical neurons [48, 31, 28, 21, 16, 7]. However, most reservoir computing models rely on biologically unrealistic, fully supervised learning rules. Specifically, they must learn from a teacher signal that can already generate the target output. Many motor tasks are not learned in environments in which such a teacher signal is available. Instead, motor learning is at least partly realized through reward-modulated, reinforcement learning [25]. Another body of studies is committed to understanding how reinforcement learning is implemented in the motor systems of mammals and songbirds [25, 12, 37, 27, 5, 18]. The basal ganglia and their homolog in songbirds play a critical role in reinforcement learning of motor tasks through dopamine-modulated plasticity at corticostriatal synapses. This notion inspired the development of a reward-modulated learning rule for reservoir computing [22]. However, we found that this learning rule fails to converge on many simulated motor tasks. We propose that the shortcomings of previous reservoir computing models can be resolved by a closer inspection of the literature on biological motor learning. A large body of evidence across multiple species supports a theory of learning in which dopamine-modulated plasticity in the basal ganglia or its homologs is responsible for early learning and this pathway gradually trains a parallel cortical pathway that takes over as tasks become well learned or “automatized” [8, 13, 11, 39, 4, 36, 2, 6, 50, 17, 38]. This model of motor learning has only been tested computationally in discrete choice tasks [4] that do not capture the intricate, dynamical nature of motor responses. Inspired by this theory of automaticity from parallel neural pathways, we derived a new architecture and learning rule for reservoir computing. In this model, a reward-modulated pathway is responsible for early learning and serves as a teacher signal for a parallel pathway that takes over the production of motor output as the task becomes well-learned. This algorithm is applicable to a large class of motor learning tasks to which fully supervised learning models cannot be applied and it outperforms previous reward-modulated models. We additionally show that our model reproduces experimental and clinical findings that relate Parkinson’s disease and its treatment to motor learning [4, 6, 50]. Hence, incorporating contemporary biological theories of motor learning improves the effectiveness and clinical relevance of reservoir computing models. In summary, we bridge previous work on motor coding and motor learning to derive a new framework for reservoir computing that is more computationally effective and biologically realistic 2 than previous models. Results We first review two previous learning rules for reservoir computing, then introduce a new, biologically inspired learning rule that combines their strengths. FORCE learning One of the most powerful and widely used reservoir computing algorithms is first-order reduced and controlled error or FORCE [45], which is able to rapidly and accurately learn to generate complex, dynamical outputs. The architecture for FORCE is schematized in Fig. 1A. The reservoir is composed of a recurrently connected population of “rate-model” neurons. The output of the reservoir is trained to produce a target time series by modifying a set of readout weights, and the output affects the reservoir through a feedback loop. The reservoir dynamics are defined by τ dr = −r + tanh(Jr + Qz) +  dt (1) Here, r(t) is a vector representing the activity of units within the reservoir, τ is a time constant,  is a small noise term, z = Wr is the reservoir output, J is the recurrent connectivity matrix, Q the feedback weights and W the readout weights. A feedforward input term is also commonly included [45], but we do not use one here. When the spectral radius of J is sufficiently large, the intrinsic dynamics of r(t) become rich and chaotic [43]. The goal of FORCE is to utilize these rich dynamics by modifying readout weights, W , in such a way that the output, z(t), matches a desired target function, f (t). The most commonly used learning algorithm for FORCE, recursive least squares (RLS), is defined by dW = −erT P dt (2) e(t) = z(t) − f(t) (3) τw where is the error vector and τw is the learning time scale. The matrix, P , is a running estimate of the inverse of the correlation matrix of rates, r (see Materials and Methods). FORCE excels at generating a target time series by harvesting reservoir dynamics, but is incomplete as a model of motor learning. As a fully supervised learning rule, FORCE must have access to the correct output to determine its error (see the presence of f in Eq. (3)). Since the correct output must already be generated to compute the error, FORCE can only learn target functions that are already known explicitly and can be generated. Many motor learning tasks require the generation of an unknown target using a lower-dimensional error signal [25]. We consider examples of such tasks below. A potential solution for these issues is provided by appealing to biological motor learning, which is controlled at least in part by dopamine-modulated reinforcement learning in the basal ganglia [50, 5, 25]. 3 A FORCE recurrent net RMHL B recurrent net output Fully supervised plasticity Reward-modulated plasticity Unsupervised plasticity C SUPERTREX recurrent net output exploratory noise output exploratory noise Figure 1: Network diagrams for three reservoir computing algorithms. A) In FORCE learning, readout weights are trained to match a target using a fully supervised error signal. Output is fed back to the reservoir. B) RMHL is similar to FORCE, but learning is driven by a rewardmodulated plasticity and exploratory noise. C) SUPERTREX combines elements of FORCE and RMHL. The exploratory pathway (green) is driven by noise, and acts similarly to RMHL. The mastery pathway (purple) is analogous to FORCE, but uses the output of the exploratory pathway in place of the fully supervised signal used by FORCE. The sum of both pathways provides the total output. Reward modulated Hebbian learning Reward-modulated Hebbian learning (RMHL) [23] is a reinforcement learning rule for reservoir computing in which reward is indicated by a one-dimensional error signal using a plasticity rule inspired by dopamine-dependent Hebbian plasticity observed in the basal ganglia. RMHL uses the same reservoir dynamics (Eq. (1)) and the same basic architecture as FORCE (Fig. 1B), but the learning rule is fundamentally different. The original RMHL algorithm [23] used a binary error signal, despite potentially poorer performance than other options, to demonstrate that the algorithm could learn with minimal information. We implement a modified version of RMHL with an error signal, e(z(t), t), that can be any timedependent, non-negative function of the output, z, which the algorithm will seek to minimize. Equivalently, e is proportional to the negative of reward. In contrast to the fully supervised error signal, e, used in FORCE learning, e is scalar (onedimensional) even when z is a higher-dimensional vector. Moreover, e can quantify any notion of “error” or “cost” associated with the output, z, and does not assume that a target output is known or even that there exists a unique target output. This allows RMHL to be applied to a large class of learning tasks to which FORCE cannot be applied, as we demonstrate below. To decrease error, RMHL makes random perturbations to the reservoir output as a form of exploration. Specifically, the output, z, is given by z = W r + Ψ(e)η where η(t) is exploratory noise and Ψ is a sublinear function that serves to damp runaway oscillations during learning. The learning rule is then given by dW = Φ(ê)ẑrT dt where x̂ denotes a high-pass filtered version of x, which represents recent changes in x. Here, Φ is a sublinear function that controls when to update the weights. We assume that Ψ is an increasing τw 4 function and Φ an odd function with Ψ(0) = Φ(0) = 0. This assures that exploration and learning are effectively quenched when the error is consistently near zero. Intuitively, the learning rule can be understood as follows: If a random perturbation from η has recently decreased e, this perturbation is then incorporated into W . SUPERTREX: A new learning algorithm for reservoir computing Unfortunately, on many tasks, the weights trained by RMHL fail to converge to an accurate solution, as we show below. RMHL models dopamine-modulated learning in the basal ganglia, but does not account for experimental evidence for the eventual independence of well-learned tasks on the activity of the basal ganglia: It has been proposed that the basal ganglia are responsible for early learning, but train a parallel cortical pathway that gradually takes over the generation of output as tasks become well-learned and “automatized” [39, 4, 5, 50, 20]. This could explain why some neurons in the basal ganglia are active during early learning and exploration, but inactive as the task becomes well-learned [14, 34, 39, 40, 4, 49, 5, 20]. It could also explain why patients or animals with basal ganglia lesions can perform previously learned tasks well, but suffer impairments at learning new tasks [35, 36, 50]. This idea is also consistent with many findings suggesting that the basal ganglia homolog in song birds is responsible for early learning and exploration of novel song production, but not for the vocalization of well-learned songs [10, 27, 3, 2, 17]. The FORCE and RMHL algorithms could be seen as analogous to the individual pathways in this theory of motor learning: RMHL learns through reward-modulated exploration analogous to the basal ganglia, while FORCE models cortical pathways that learn from the output produced by the basal ganglia pathway. Inspired by this analogy, we next introduce a new algorithm, Supervised Learning Trained by Rewarded Exploration (SUPERTREX), that combines the strengths RMHL and FORCE to overcome the limitations of each. The architecture of SUPERTREX (Fig. 1C) is different than the architectures of FORCE and RMHL: There are now two distinct sets of weights from the reservoir to the outputs, and each is trained with a separate learning rule. The “exploratory pathway” learns via an RMHL-like, reinforcement learning algorithm, requiring only a one-dimensional metric of performance rather than an explicit error signal. The “mastery pathway” learns through a FORCE-like algorithm. The key idea is that the activity of the exploratory pathway can act as a target for the mastery pathway to learn, replacing the supervised error signal required by FORCE. Hence, SUPERTREX does not need the explicit supervisory error signal that FORCE does. Importantly, the convergence issues we have found with RMHL are not problematic for SUPERTREX because weights in the RMHL-like exploratory pathway do not need to converge to a correct solution because weights in the mastery pathway converge instead. SUPERTREX uses the same reservoir dynamics (Eqs. (1)), but the outputs are determined by z1 = W1 r + Ψ(e)η z2 = W2 r z = z1 + z2 . Here, z1 is the output from the exploratory pathway, z2 from the mastery pathway, and z is the 5 total output. The learning rules are defined by dW1 = Φ(ê)ẑ rT dt dW2 τw2 = (z − z2 )rT P. dt τw1 Intuitively, the first learning rule works like RMHL to quickly minimize the total error, as it uses the error of the total output, z. However, it only controls the z1 component of z, resulting in z1 + z2 ≈ f. Error between the z2 component and f is therefore just z1 , which replaces the error in the second learning rule since z − z2 = z1 . As z2 approaches f, learning in the exploratory pathway causes z1 to approach 0 in order to keep the total z correct. Note that the learning rule for W1 is local in the sense that it only involves values of the presynaptic and postsynaptic variables in addition to the error signal, e. The learning rule for W2 would be local if it were not for the computation of P , which is biologically unrealistic. However, P can be replaced by the identity matrix to make the learning rules for SUPERTREX purely local. This slows down learning, but is otherwise not detrimental (see [24] and the disrupted learning example below). In summary, RMHL-like learning in the exploratory pathway uses a one-dimensional error signal, e, to track the target while FORCE-like learning in the mastery pathway uses the exploratory pathway as a teacher signal until it learns the output and takes over. This models current theories of biological motor learning in which early learning is dominated by dopamine-dependent plasticity in the basal ganglia, which gradually trains parallel cortical pathways as the task becomes welllearned. We next test SUPERTREX on three increasingly difficult motor tasks, comparing the performance of SUPERTREX to that of FORCE and RMHL. Task 1: Generating a known target output We first consider a task in which the goal is to draw a parameterized curve of a butterfly by directly controlling the coordinates of a pen (Fig. 2A). Specifically, the target is given by f (t) = (x(t), x(t)) where x(t) and y(t) parameterize the x- and y-coordinates of a pen that successfully traces out the butterfly. The reservoir output, z(t), controls the coordinates of the pen, so the goal is to train the weights so that z(t) closely match the target, f (t). The learning algorithms are first allowed to learn for ten repetitions of the task. As a diagnostic, weights are then frozen for a further five repetitions. This provides a way to check the accuracy of the final solution, demonstrating whether or not the algorithm has converged to an accurate solution. During this testing phase, feedback to the system comes from the true solution [46]. Specifically, Qz is replaced by Qf in Eq. (1). This avoids a drift in the phase of the solution that otherwise occurs when weights are frozen (see Discussion). Additionally, for SUPERTREX, the exploratory pathway was shut off during these last five repetitions (z1 set to zero) to test how well the mastery pathway converged. This simple task is well suited to FORCE, which requires a known target, f , in order to compute the fully supervised error signal, e=z−f 6 Learning x=z1 Distance from Target B y=z2 Task 1 A Testing FORCE RMHL SUPERTREX 0.1 0.01 0.001 1s x(t) Cii ||W|| FORCE Ci Output y(t) Target Dii y(t) ||W|| RMHL x(t) Di y(t) x(t) Eii ||W|| SUPERTREX Ei Mastery Exploratory Figure 2: Performance of three learning algorithms on Task 1. A) Task 1 is to draw a butterfly curve by directly controlling the x- and y-coordinates of a pen. Specifically, the outputs of the reservoir is z(t) = (x(t), y(t)) where x(t) and y(t) are the Cartesian coordinates of the pen. B) Euclidean distance of pen from target for FORCE (orange), RMHL (green), and SUPERTREX (purple). Learning was halted by freezing weights and exploration after ten periods, so the remaining five periods represent a testing phase. Ci) Target butterfly curve (red) versus the butterfly drawn by FORCE (blue) during the testing phase. Cii) Target (red) and actual (blue) outputs, 1 x(t) and y(t), and the norm of the weight matrix, k(W W T ) 2 k2 , produced by FORCE. Di-ii) Same as C, but for RMHL. Di-ii) Same as C, but for SUPERTREX and the norm of each matrix, W1 (exploratory; green) and W2 (mastery; purple) are plotted separately. Vertical gray bar indicates the time at which weights were frozen. 7 FORCE was able to quickly find the correct solution to the task and maintained the correct result even after weights were frozen (Fig. 2B,C). Another measure of convergence is the activity of weight matrix, W , which quickly converged then stabilized (Fig. 2Cii, bottom). Error also remained low after learning was disabled (Fig. 2B). In summary, as expected, FORCE learned this task quickly and accurately. To apply RMHL and SUPERTREX to this task, we set e = kz − f k2 where k · k is the Euclidean norm, i.e. the distance of the pen from its target. This error contains strictly less information than the fully supervised error used by FORCE. RMHL performed well during learning, but the performance after weights were frozen (Fig. 2B,D) along with the cyclical changes in kW k during learning (Fig. 2Dii) demonstrate that the RMHL algorithm never actually converged. Instead, RMHL relied on rapid changes in W to mimic the correct output at each time point without truly learning it. SUPERTREX performed well on this task. During learning SUPERTREX performed slightly worse than FORCE and similar to RMHL (Fig. 2B,E). Unlike RMHL, though, SUPERTREX continued to track the target after learning was disabled, and performed similarly to FORCE during that phase (Fig. 2B). This, combined with the apparent convergence of kW k during learning (Fig. 2Eii, purple and green curves converge), indicates that the SUPERTREX algorithm did converge - albeit more slowly than FORCE. Interestingly, SUPERTREX produced less error during the testing phase than during learning (Fig. 2B). This is because exploration introduces random errors during learning, but exploration was turned off during testing so that output was produced only by the well-trained mastery pathway. This is comparable to findings in song birds in which natural or artificial suppression of neural activity in brain areas homologous to the basal ganglia reduce exploratory song variability and vocal errors [27]. An interesting illustration of how SUPERTREX works is provided by suddenly changing the target from a butterfly to a circle during learning (Fig. 3). The relative contributions from the exploratory pathway and the mastery pathway show that the exploratory pathway initially tracks the new target (Fig. 3B). Since the exploratory pathway is equivalent to RMHL, we know from above that the pathway is only mimicking the output through rapid weight changes. Over time, the mastery pathway learns from the activity of the exploratory pathway and begins taking over the generation of the output. This “handoff” from the exploratory to the mastery pathway produces a damped oscillation around the target (Fig. 3B). Task 2: Generating an unknown target from a scalar error signal Task 1 is a simple introductory task to compare the three learning algorithms, but it is also unrealistic in some ways that play towards FORCE’s strengths. Specifically, the task involves producing an output, z, to match a known target, f , and error is compute in terms of the difference between z and f . In many tasks, motor output has indirect effects on the environment and the target and error are given in terms of these indirect effects. For example, consider a human or robot performing a drawing task. Motor output does not control the position of the pen directly, but instead controls the angles of the arm joints, which are nonlinearly related to pen position. On 8 A B change target change target exploratory mastery y(t) y(t) x(t) x(t) total output target 1s 1ms Figure 3: The dynamics of SUPERTREX with an abruptly changed target. A) Target (red) and actual (blue) output. Same as Task 1, but the target was changed from a butterfly to a circle after ten periods. B) Detail around the time of change. Same colors as (a), with addition of exploratory (green) and mastery (purple) components of the output. Note that exploratory + mastery = total output. the other hand, error might be evaluated in terms of the distance of the pen from its target. Task 2 models this scenario. The goal in Task 2 is to draw the same butterfly from Task 1, parameterized by the same target coordinates f (t) = (x(t), y(t)). However, the reservoir output controls the angles of two arm joints (Fig. 4A), z(t) = (θ1 (t), θ2 (t)). We assume that the subject does not have access to the target angles that draw the butterfly. Instead, they only have access to the target pen coordinates, f , and its distance to the actual pen coordinates, which are related to the angles through a nonlinear function, h(θ1 , θ2 ) = (x, y). FORCE cannot be applied directly to this task since the fully supervised error required for FORCE would need to be computed in terms of target angles instead of target pen position. RMHL and SUPERTREX can be applied to this task since they only require a signal that provides enough information to determine whether error recently increased or decreased. In particular, this is accomplished by setting e = kh(z) − f k2 where h(z) = (x, y) is the pen position. Once again, the task is divided into 10 learning cycles and 5 test cycles, with learning algorithms and the exploratory pathway of SUPERTREX disabled during the test cycles. Since the target angles, z(t), are unknown, feedback during testing cannot be replaced by the target as was done for Task 1. Instead, it is provided by the output from five previous periods. RMHL performed poorly on this task. It eventually mimicked the target (Fig. 4B), but once again failed to converge (Fig. 4B,C). SUPERTREX was able to track the target, and continue to produce it even after weight changes ceased (Fig. 4B,D). Hence, the combination of FORCE-like learning and RMHL-like learning implemented by SUPERTREX is able to learn a task that neither FORCE nor RMHL can learn on their own. 9 B Task 1 z 2 =θ 2 z1=θ1 Learning 1 Distance from Target A 0.01 1s Cii ||W|| θ 2 (t) θ1(t) Output RMHL Ci RMHL SUPERTREX 0.1 Target Testing θ 2 (t) θ1(t) Dii ||W|| SUPERTREX Di Mastery Exploratory Figure 4: Performance of RMHL and SUPERTREX on Task 2. A) Task 2 is to draw the same butterfly (red) as in Task 1, but the reservoir output now controls the arm joint angles, z1 (t) = θ1 (t) and z2 (t) = θ2 (t). Error is still computed in terms of pen coordinates. FORCE is not applicable to this task. B) Euclidean distance of pen from target for RMHL (green) and SUPERTREX (purple). Learning was halted by freezing weights after ten periods, so the remaining five periods represent a testing phase. C-D) Same as Fig. 2D-E except that angles, θ1 (t) and θ2 (t) are plotted in place of pen coordinates. 10 z 3 =θ 3 Learning B Distance A Task 3 z 2 =θ 2 0.1 0.01 RMHL SUPERTREX Cost 0.01 z1=θ1 0.001 0.0001 1s 10 -5 D SUPERTREX Target Output RMHL C Testing 1 Figure 5: Performance of RMHL and SUPERTREX on Task 3. A) Task 3 is to draw the same butterfly (red) as in Tasks 1 and 2, but the reservoir output now controls three arm joint angles, z1 (t) = θ1 (t), z2 (t) = θ2 (t), and z3 (t) = θ3 (t) with a different cost function associated to moving each joint. Error is computed in terms of pen coordinates and cost of moving joints. FORCE is not applicable to this task. B) Euclidean distance of pen from target (top) and cost (bottom; C(θ10 , θ20 , θ30 )) for RMHL (green) and SUPERTREX (purple). C,D) Same as Di and Ei in Fig. 2. Task 3: Learning and optimizing a task with multiple candidate solutions While FORCE cannot be applied to Task 2 as it is currently defined, it could be applied if the inverse of h were explicitly computed off-line to provide the target angles, (θ1 , θ2 ) = h−1 (f ), from which to compute a fully supervised error signal. This approach assumes that the subject knows the inverse of h and therefore does not easily extend to learning tasks in which h is difficult or impossible to invert. We now consider a task in which the error is not an invertible function of the motor output. Specifically, we consider an arm with three joints (Fig. 5A) and a cost function, C(θ10 , θ20 , θ30 ), that penalizes the movement of some joints more than others. Here, θj0 is the time-derivative of θj . The penalties are larger for the angles controlling larger arm lengths, so the cost is lowest for the wrist joint, θ3 , and largest for the shoulder joint, θ1 . For this task, there are infinitely many candidate solutions that successfully draw the butterfly, differing by the cost of joint movement. This turns our learning task into an optimization problem. Using FORCE for this task does not make sense, as it would require prior, explicit knowledge of the desired time series of joint angles. Essentially, it would require that the optimization problem had already been solved offline. RMHL and SUPERTREX can be applied to this problem by setting e = kh(z) − f k2 + C. In this context, RMHL and SUPERTREX works as greedy search algorithm that make local changes to the angular output to reduce error and cost. Note, however, that the solution they find may not be globally optimal. 11 We applied RMHL and SUPERTREX to this task using the same protocol for the learning and testing phases that we used for Task 2. RMHL performed poorly on this task (Fig. 5B,C), which is not surprising considering its poor performance on Task 2. SUPERTREX performed much better than RMHL: It was able to track the target, and continue to produce it even after weights were frozen (Fig. 5B,D). In summary, SUPERTREX can solve motor learning tasks in which there are multiple “correct” solutions with different costs. Disrupted learning as a model of Parkinson’s disease The design of SUPERTREX was motivated in part by observations about the role of the basal ganglia in motor learning and Parkinson’s disease (PD). PD is caused by the death of dopamine producing neurons in the basal ganglia, resulting in motor impairment. A common treatment for PD is a lesion of basal ganglia output afferents. Such lesions alleviate PD symptoms and impair performance on new learning tasks more than well-learned tasks [36, 50]. These and other findings have inspired a theory of motor learning in which the basal ganglia are responsible for early learning, but not the performance of well-learned tasks and associations [50, 20]. SUPERTREX is consistent with this theory if the exploratory pathway is interpreted as a basal ganglia pathway and the mastery pathway the cortical pathway. To test this model, we next performed an experiment in SUPERTREX that mimics the effects of PD and its treatment with basal ganglia lesion. The handoff of learning from the exploratory to mastery pathway occurs extremely quickly in SUPERTREX due to the powerful, but biologically unrealistic RLS learning rule used in the mastery pathway (see, e.g., Fig. 3). To make SUPERTREX more biologically plausible for this experiment, we replaced the RLS learning rule with a least-mean-squares (LMS) rule by replacing P in Eq. (2) with the identity matrix [24]. This modified rule is more realistic because it avoids the complicated computation of the matrix, P , it makes the learning rules local, and it causes the mastery pathway to learn more slowly, which slows the handoff from the exploratory pathway. We applied this modified SUPERTREX algorithm to Task 1. For 100 trials, learning proceeded normally. SUPERTREX learned the target more slowly than in Fig. 2 and with a slight degradation in performance due to the use of LMS instead of RLS learning in the mastery pathway (Fig. 6, early and late learning). This phase models normal learning before the onset of PD. By the end of this phase (Fig. 6, late learning), the task has become “well-learned” in the sense that output is generated by the mastery pathway instead of the exploratory pathway. For the next five trials, we corrupted the error signal to model the effects of PD. Since e models the error or cost of motor output, it is negatively related to dopamine release. Specifically, ê ∝ Dmax − D where D quantifies dopamine release and Dmax is the maximum possible value of D. Hence, PD-induced dopamine depletion is modeled by artificially increasing ê, which we achieve by setting e = kf − zk2 + p where p(t) increases over time. Here, p = 0 corresponds to a healthy subject and, as p increases, SUPERTREX falsely evaluates more of its actions as being in error or costly. Even though the mastery pathway had taken over motor output before the error signal of the exploratory pathway was corrupted, the perceived increase in error caused the exploratory pathway to take over during the corrupted learning phase because the contribution of the exploratory pathway increases with error. The mismatch between actual error and perceived error during the corrupted 12 Distance from Target A 0.6 late learning corrupted learning post-lesion 0.1 1s y(t) x(t) 0.01 B early learning C Figure 6: SUPERTREX with a corrupted error signal models Parkinson’s disease and its treatment. A) Euclidean distance of pen from its target for a modified version of SUPERTREX on Task 1. Learning proceeded normally for 100 trials. First five trials (early learning) and last five trials (late learning) are shown. The error signal was corrupted over the following five trials (corrupted learning) and the exploratory pathway was lesioned for the last five trials (post-lesion). B) Target (red) and actual (blue) outputs. C) Target butterfly (red) versus drawn curve during each of the plotted groups of five trials. learning phase results in highly inaccurate motor output (Fig. 6, corrupted learning phase). These results model the motor impairments associated with PD. Indeed, PD symptoms are believed to be caused, at least in part, by aberrant learning in the basal ganglia [50, 5]. In the last five trials, we disabled the exploratory pathway, modeling basal ganglia lesion, and the feedback term, Qz, was replaced by Qf in Eq. (1) (see Discussion). SUPERTREX recovered nearly correct output during this last stage (Fig. 6, post-lesion phase) because the output had been stored in the mastery pathway before learning in the exploratory pathway was corrupted. Interestingly, correct motor output was recoverable in the mastery pathway despite the fact that learning continued to be transferred from the incorrect exploratory pathway to the mastery pathway during the corrupted learning stage. Hence, this transfer did not corrupt the stored “correct” motor output in the mastery pathway. This is explained by noting that incorrectly rewarded exploration caused weight perturbations to the mastery pathway during corrupted learning to be effectively random. Random perturbations to the high-dimensional weight matrix are approximately orthogonal to the task-relevant dimensions of the weights, and therefore have an approximately mean-zero effect on task performance. This is the same mechanism that allows FORCE and other algorithms to learn a new task without severely affecting performance on previously learned tasks [45]. Discussion We presented a novel, reward-modulated method of reservoir computing, SUPERTREX, that performs nearly as well as fully supervised methods. This is desirable as there are a broad class or problems where traditional supervised methods are not applicable, such as Tasks 2 and 3 that 13 we considered. Moreover, humans can learn motor tasks from reinforcement signals alone [25]. In place of a supervised error signal, SUPERTREX bootstraps from a dopamine-like, scalar error signal to a full error signal using rewarded exploration. This serves as an approximate target solution which is then transferred to a more traditional reservoir learning algorithm. This transfer of learned behavior to a mastery pathway, along with continued rewarded exploration, automatically creates a balanced system where the total output is correct, but the composition shifts over time from exploration to mastery. SUPERTREX performed similarly to FORCE on tasks where both were applicable, but also worked well on tasks where FORCE was not applicable. SUPERTREX also outperformed RMHL, a previously developed reward-modulated algorithm, on all tasks we considered. SUPERTREX models the complementary roles of cortical and basal ganglia pathways in motor learning. Under this interpretation, dopamine concentrations play the role of the reward signal, and the basal ganglia is the site of the RMHL-like, exploratory learning. Direct intracortical connections would then learn from Hebbian plasticity in the mastery pathway. Consistent with this interpretation, SUPERTREX produces inaccurate motor output when the reward signal is corrupted, modeling dopamine depletion in PD, but recovers the generation of well-learned output when the exploratory pathway is removed, modeling basal ganglia lesions used to treat PD. Hence SUPERTREX provides a model for understanding the role of motor learning in PD and its treatments. As models of motor learning, reward-modulated algorithms like SUPERTREX and RMHL assume no knowledge of the relationship between motor output and error. In contrast, fully supervised algorithms like FORCE require perfect perfect knowledge of this relationship. In reality, we learn through some combination of supervisory and reward-modulated error signals [25]. To account for this, SUPERTREX could potentially be extended to incorporate both one-dimensional reward and higher-dimensional sensory feedback. The FORCE-like learning algorithm used for the mastery pathway of SUPERTREX is biologistically unrealstic in some ways. The presence of the matrix, P , causes the rule to be non-local. However, we showed that SUPERTREX still works when P is removed to implement a local, LMS learning rule (Fig. 6). Indeed, one can replace the FORCE-like learning rule used in the mastery pathway of SUPERTREX with any supervised learning rule. Hence, SUPERTREX provides a way to produce a reward-modulated learning rule for reservoir computing from any supervised learning rule. This opens the way for an implementation of SUPERTREX with spiking neural networks using existing learning rules [30, 9, 1, 41]. SUPERTREX does not address some remaining challenges present in reservoir computing. One of these issues is that reservoir computing algorithms such as FORCE or SUPERTREX excel at encouraging reservoir neurons to produce target frequencies (leading to a correct power spectrum), but are not as effecitive at getting the phase correct. Indeed, a frequent failure in reservoir computing algorithms is that they tend to “drift” in phase when weights are frozen. We resolved this issue in our testing phase and our post-lesion model by replacing feedback, Qz, with correct output (either Qf or the feedback from previous learning trials). This feedback works as a “clock” to keep the system in-phase, but this is a somewhat artificial solution. This difficulty could potentially be overcome by sensory feedback signals or a pattern generating circuit to keep time [32, 51]. As with most other reservoir computing algorithms, SUPERTREX implements online learning 14 in which a local error signal is provided and used at every time step. This is partly by design - SUPERTREX learns extremely (even unrealistically) quickly as weights are updated at a high frequency. This learning is slowed by some extent by switching to the more realistic LMS learning rule (as in Fig. 6). For some biological learning tasks, however, error signals are temporally sparse or reflect temporally non-local information. Trial-based learning rules for reservoir computing [19, 33] are applicable in the presence of sparse or non-local rewards. At least one of these algorithms learns very slowly, requiring thousands of trials [33], which may be an inevitable consequence of learning from sparse rewards. In reality, biological motor learning likely makes use of both online and sparse feedback. An extension of SUPERTREX that accounts for both types of feedback could be more versatile and realistic. SUPERTREX is conceptually an extension of SPEED [4], which has a similar framework for categorization and other discrete tasks. SPEED learns to map discrete inputs to discrete outputs, such as in catagorization tasks. While the architecture and learning rule are similar to SUPERTREX, SPEED cannot produce continuous, dynamical outptut and requires a seperate pathway for each possible input-output pairing. In summary, SUPERTREX incorporates contemporary biological theories of motor learning and automaticity to produce a framework for reservoir computing that is more effective than its predecessors. Moreover, SUPERTREX offers a computational formalization of widely supported theories of motor learning and reproduces several experimental and clinical findings. Hence, SUPERTEX establishes a two-way exchange in which the study of biological motor learning advances the study of reservoir computing algorithms and vice versa. Methods Simulation and Reservoir Parameters All simulations were performed using a forward euler method, with dt = 0.2ms. Each task period or “trial” was 104 ms long and all simulations except those in Fig. 6 had 15 trials. Fig. 6 had 110 trials. The reservoir equation used in all algorithms was τ dr = −r + tanh(Jr + Qz) + αη dt where η was uniformly drawn from [−1, 1], τ =10, and α = 2.5 × 10−2 during training and α = 0 during testing. Reservoir size was set to N = 1000 neurons, with connection probability p = 0.1. Connection strengths were normally distributed with mean 0 and variance λ2 /(pN ) with λ = 1.5. Initial readout weights for RMHL and SUPERTREX exploratory pathway were drawn uniformly between −1 and 1, while weights for FORCE and the SUPERTREX mastery pathway were initialized at 0. Initial voltages were set uniformly between −0.5 and 0.5, while initial rates were the hyperbolic tangent of initial voltages. Displayed outputs and errors were low pass filtered according to dM SE(t) = −M SE(t) + M SE(t) τM SE dt dz(t) τbar = −z(t) + z(t) dt 15 where τM SE = 1000, τbar = 10, and x represents √ a low pass filtered version of the variable x. The plotted “distance from target” was computed as M SE where M SE(t) is the squared distance of the pen from its target. FORCE Reservoir output was z = W r and the learning rule is dW = −[z − f ]rT P dt with τw = 0.02. The matrix P is a running estimate of the inverse of the correlation matrix of rates r, initialized to 1 P (0) = I γ and updated according to dP P r rT P τp =− dt 1 + rT P r where τP = dt, γ = 10 is a constant and I is the identity matrix. The matrix P is only updated every 10 time steps in order to save on computing time. τw RMHL For RMHL, outputs were given by z = W r + Ψ(e)η and the learning rule was dW = Φ(ê)(ẑ)rT dt where τw = 0.02, η is uniformly distributed noise on [−1, 1], and the high-pass filtered version, x̂, of variable x was computed as dx τ = −x + x dt x̂ = x − x. τw SUPERTREX Updates to P were identical to the method used in FORCE above. Relevant other changes are z1 = W1 r + Ψ(e)η z2 = W2 r z = z1 + z2 for η uniformly drawn from [−1, 1]. For the learning algorithm, dW1 = Φ(ê)ẑrT dt dW2 τw = −kz1 rT P dt τw 16 with τw remaining 0.02 and constant learning rate k which varies per task. Finally, an extra condition was imposed on updates to P , W2 . Both updates were multiplied by (−0.5 ∗ tanh(5 × 105 ∗ (e − (1.5 × 10−3 ))) + 0.05), which acts as a soft threshold around e = 1.5 × 10−3 . Effectively, for errors larger than this the mastery pathway would not activate. Performance was similar, but slightly slower, without this thresholding. Tasks In all tasks, the target was to draw a butterfly, given by a polar curve x(t) = r(t) cos(t) and y(t) = r(t) sin(t) where r(t) =c[9 − sin(qt) + 2 sin(3qt)+ 2 sin(5qt) − sin(7qt) + 3 cos(2qt) − 2 cos(4qt)] and c = 1/ maxt [r(t)] is a normalizing constant. For a single repetition, t went from 0 to 104 ms, 2π and q = 10 4 scales the system such that qt goes from 0 to 2π over the duration. In task 2, the task is instead to draw a butterfly by controlling two angles, representing radians from y axis, and radians from the first joint. The arm is positioned at (0,-2), and each arm segment has fixed length of 1.8. h(z) is therefore   1.8 sin(z1 π) + 1.8 sin((z1 + z2 )π) h(z) = −2 + 1.8 cos(z1 π) + 1.8 cos((z1 + z2 )π) In task 3, now there are three angles to control. The arm is positioned at (0,-2), and each arm segment has fixed length. The first segment has length 1.8, the next 1.2, and the final .6. h(z) is therefore   1.8 sin(z1 π) + 1.2 sin((z1 + z2 )π) + .6 sin((z1 + z2 + z3 )π) h(z) = −2 + 1.8 cos(z1 π) + 1.2 cos((z1 + z2 )π) + .6 cos((z1 + z2 + z3 )π) √ √ In the first task, Ψ(x) = 0.025 × 4 10x and Φ(x) = −5 4 x for both RMHL and SUPERTREX. √ When testing for swapping targets, Ψ(x) = 0.1×(−5x)0.3 and Φ(x) = 2.5× 4 x. For SUPERTREX, learning rate k was 0.5. √ For the second task, SUPERTREX learning rate k was still 0.5, Ψ(x) = 0.01 × 5 10x, and √ Φ(x) = 5 × 4 x. √ For the third task, SUPERTREX learning rate was k = 0.9, Ψ(x) = .025 × 4 10x, and Φ(x) = √ 5 × 4 x. The error metric was changed slightly, to e = ||h(z) − f||2 + α|zˆ1 | + β|zˆ2 | + γ|zˆ3 | for α = 0.1, β = 0.05, γ = 0. This implemented an additional cost for moving joints; highest for the longest arm segment, and 0 for the smallest arm segment. For the corrupted learning example, LMS learning was used, which is obtained by setting P = I. The learning rate was changed to k = 0.003. Other parameter values were the same as in the first task. The perturbation, p(t), increased linearly from 0 to 0.1 over the corrupted learning timeframe. 17 References [1] L F Abbott, Brian Depasquale, and Raoul-martin Memmesheimer. Building Functional Networks of Spiking Model Neurons. Nat. Neurosci., 19(3):1–16, 2016. [2] Aaron S Andalman and Michale S Fee. A basal ganglia-forebrain circuit in the songbird biases motor output to avoid vocal errors. Proc. Natl. Acad. Sci. U. S. A., 106(30):12518–23, jul 2009. [3] Dmitriy Aronov, AS Andalman, and MS Fee. A specialized forebrain circuit for vocal babbling in the juvenile songbird. Science (80-. )., 320(May):630–635, 2008. [4] F Gregory Ashby, John M Ennis, and Brian J Spiering. A neurobiological theory of automaticity in perceptual categorization. Psychol. Rev., 114(3):632–56, jul 2007. [5] F Gregory Ashby, Benjamin O Turner, and Jon C Horvitz. Cortical and basal ganglia contributions to habit learning and automaticity. Trends Cogn. Sci., 14(5):208–15, may 2010. [6] F Gregory Ashby, Benjamin O Turner, and Jon C Horvitz. Cortical and basal ganglia contributions to habit learning and automaticity. Trends Cog. Sci., 14(5):208–215, 2010. [7] Omri Barak. Recurrent neural networks as versatile tools of neuroscience research. Curr. Opin. Neurobiol., 46:1–6, 2017. [8] S W Bottjer, E a Miesner, and a P Arnold. Forebrain lesions disrupt development but not maintenance of song in passerine birds. Science (80-. )., 224(4651):901–903, 1984. [9] Ralph Bourdoukan and Sophie Deneve. Enforcing balance allows local supervised learning in spiking recurrent networks. In Advances in Neural Information Processing Systems, pages 982–990, 2015. [10] Michael S Brainard. Contributions of the anterior forebrain pathway to vocal plasticity. Annals of the New York Academy of Sciences, 1016(1):377–394, 2004. [11] MS Brainard and AJ Doupe. Interruption of a basal gangliaforebrain circuit prevents plasticity of learned vocalizations. Nature, 404(April), 2000. [12] MS Brainard and AJ Doupe. What songbirds teach us about learning. Nature, 417(May):351– 358, 2002. [13] R M Carelli, M Wolske, and M O West. Loss of lever press-related firing of rat striatal forelimb neurons after repeated sessions in a lever pressing task. J. Neurosci., 17(5):1804–1814, 1997. [14] Regina M Carelli, Martin Wolske, and Mark O West. Loss of lever press-related firing of rat striatal forelimb neurons after repeated sessions in a lever pressing task. Journal of Neuroscience, 17(5):1804–1814, 1997. [15] Mark M Churchland, John P Cunningham, Matthew T Kaufman, Justin D Foster, Paul Nuyujukian, Stephen I Ryu, and Krishna V Shenoy. Neural population dynamics during reaching. Nature, 487(7405):51–6, jul 2012. 18 [16] Pierre Enel, Emmanuel Procyk, René Quilodran, and Peter Ford Dominey. Reservoir Computing Properties of Neural Dynamics in Prefrontal Cortex. PLOS Comput. Biol., 12(6):e1004967, 2016. [17] M S Fee and J H Goldberg. A hypothesis for basal ganglia-dependent reinforcement learning in the songbird. Neuroscience, 198:152–70, dec 2011. [18] Michale S Fee. The role of efference copy in striatal learning. Curr. Opin. Neurobiol., 25:194– 200, apr 2014. [19] Ila R Fiete and H Sebastian Seung. Gradient learning in spiking neural networks by dynamic perturbation of conductances. Physical review letters, 97(4):048104, 2006. [20] Sébastien Hélie, Erick J Paul, and F Gregory Ashby. A neurocomputational account of cognitive deficits in Parkinson’s disease. Neuropsychologia, 50(9):2290–302, jul 2012. [21] Guillaume Hennequin, Tim P Vogels, and Wulfram Gerstner. Optimal control of transient dynamics in balanced networks supports generation of complex movements. Neuron, 82(6):1394– 406, jun 2014. [22] Gregor M Hoerzer, Robert Legenstein, and Wolfgang Maass. Emergence of complex computational structures from chaotic neural networks through reward-modulated hebbian learning. Cereb. Cort., 24(3):677–690, 2012. [23] Gregor M Hoerzer, Robert Legenstein, and Wolfgang Maass. Emergence of complex computational structures from chaotic neural networks through reward-modulated Hebbian learning. Cereb. Cortex, 24(3):677–90, mar 2012. [24] Gregor M Hoerzer, Robert Legenstein, and Wolfgang Maass. Emergence of complex computational structures from chaotic neural networks through reward-modulated Hebbian learning. Cereb. Cortex, 24(3):677–90, mar 2014. [25] Jun Izawa and Reza Shadmehr. Learning from sensory and reward prediction errors during motor adaptation. PLoS Comput. Biol., 7(3):1–11, 2011. [26] Herbert Jaeger and Harald Haas. Harnessing nonlinearity: predicting chaotic systems and saving energy in wireless communication. Science, 304(5667):78–80, apr 2004. [27] Mimi H Kao, Allison J Doupe, and Michael S Brainard. Contributions of an avian basal ganglia–forebrain circuit to real-time modulation of song. Nature, 433(7026):638–643, 2005. [28] Rodrigo Laje and Dean V Buonomano. Robust timing and motor patterns by taming chaos in recurrent neural networks. Nat. Neurosci., 16(7):925–33, jul 2013. [29] Mantas Lukoševičius, Herbert Jaeger, and Benjamin Schrauwen. Reservoir Computing Trends. KI - Künstliche Intelligenz, 26(4):365–371, may 2012. [30] Wolfgang Maass, Thomas Natschläger, and Henry Markram. Real-time computing without stable states: a new framework for neural computation based on perturbations. Neural Comput., 14(11):2531–60, nov 2002. 19 [31] Valerio Mante, David Sussillo, Krishna V Shenoy, and William T Newsome. Context-dependent computation by recurrent dynamics in prefrontal cortex. Nature, 503(7474):78–84, nov 2013. [32] Eve Marder and Dirk Bucher. Central pattern generators and the control of rhythmic movements. Curr Biol, 11(23):R986–R996, 2001. [33] Thomas Miconi. Biologically plausible learning in recurrent neural networks reproduces neural dynamics observed during cognitive tasks. E-Life, 6, 2017. [34] Shigehiro Miyachi, Okihide Hikosaka, and Xiaofeng Lu. Differential activation of monkey striatal neurons in the early and late stages of procedural learning. Exp Brain Res, 146(1):122– 126, 2002. [35] Shigehiro Miyachi, Okihide Hikosaka, Kae Miyashita, Zoltán Kárádi, and Miya Kato Rand. Differential roles of monkey striatum in learning of sequential hand movement. Experimental brain research, 115(1):1–5, 1997. [36] J a Obeso, M Jahanshahi, L Alvarez, R Macias, I Pedroso, L Wilkinson, N Pavon, B Day, S Pinto, M C Rodrı́guez-Oroz, J Tejeiro, J Artieda, P Talelli, O Swayne, R Rodrı́guez, K Bhatia, M Rodriguez-Diaz, G Lopez, J Guridi, and J C Rothwell. What can man do without basal ganglia motor output? The effect of combined unilateral subthalamotomy and pallidotomy in a patient with Parkinson’s disease. Exp. Neurol., 220(2):283–92, dec 2009. [37] Bence P Olveczky, Aaron S Andalman, and Michale S Fee. Vocal experimentation in the juvenile songbird requires a basal ganglia circuit. PLoS Biol., 3(5):e153, may 2005. [38] Bence P Ölveczky, Timothy M Otchy, Jesse H Goldberg, Dmitriy Aronov, and Michale S Fee. Changes in the neural control of a complex motor sequence during learning. J. Neurophysiol., 106(1):386–97, jul 2011. [39] Anitha Pasupathy and Earl K Miller. Different time courses of learning-related activity in the prefrontal cortex and striatum. Nature, 433(7028):873–876, 2005. [40] Russell A Poldrack, Fred W Sabb, Karin Foerde, Sabrina M Tom, Robert F Asarnow, Susan Y Bookheimer, and Barbara J Knowlton. The neural correlates of motor skill automaticity. Journal of Neuroscience, 25(22):5356–5364, 2005. [41] Ryan Pyle and Robert Rosenbaum. Spatiotemporal dynamics and reliable computations in recurrent spiking neural networks. Physical Review Letters, 118(1):018103, 2017. [42] Krishna V Shenoy, Maneesh Sahani, and Mark M Churchland. Cortical control of arm movements: a dynamical systems perspective. Annu. Rev. Neurosci., 36:337–59, jul 2013. [43] H. Sompolinsky, a. Crisanti, and H. J. Sommers. Chaos in random neural networks. Phys. Rev. Lett., 61(3):259–262, 1988. [44] David Sussillo. Neural circuits as computational dynamical systems. Curr. Opin. Neurobiol., 25:156–163, 2014. [45] David Sussillo and L F Abbott. Generating coherent patterns of activity from chaotic neural networks. Neuron, 63(4):544–57, aug 2009. 20 [46] David Sussillo and Larry F Abbott. Generating coherent patterns of activity from chaotic neural networks. Neuron, 63(4):544–557, 2009. [47] David Sussillo and Omri Barak. Opening the black box: low-dimensional dynamics in highdimensional recurrent neural networks. Neural Computation, 25(3):626–649, 2013. [48] David Sussillo, Mark M Churchland, Matthew T Kaufman, and Krishna V Shenoy. A neural network that finds naturalistic solutions for the production of muscle activity. Nat. Neurosci., 18(7), 2013. [49] C. C. Tang, D. H. Root, D. C. Duke, Y. Zhu, K. Teixeria, S. Ma, D. J. Barker, and M. O. West. Decreased Firing of Striatal Neurons Related to Licking during Acquisition and Overtraining of a Licking Task. J. Neurosci., 29(44):13952–13961, 2009. [50] Robert S Turner and Michel Desmurget. Basal ganglia contributions to motor control: a vigorous tutor. Curr. Opin. Neurobiol., 20(6):704–16, dec 2010. [51] Rafael Yuste, Jason N MacLean, Jeffrey Smith, and Anders Lansner. The cortex as a central pattern generator. Nat Rev Neurosci, 6(6):477, 2005. 21
9cs.NE
Exact Distance Oracles Using Hopsets Siddharth Gupta∗ Adrian Kosowski† Laurent Viennot† arXiv:1803.06977v1 [cs.DS] 19 Mar 2018 Abstract For fixed h ≥ 2, we consider the task of adding to a graph G a set of weighted shortcut edges on the same vertex set, such that the length of a shortest h-hop path between any pair of vertices in the augmented graph is exactly the same as the original distance between these vertices in G. A set of shortcut edges with this property is called an exact h-hopset and may be applied in processing distance queries on graph G. In particular, a 2-hopset directly corresponds to a distributed distance oracle known as a hub labeling. In this work, we explore centralized distance oracles based on 3-hopsets and display their advantages in several practical scenarios. In particular, for graphs of constant highway dimension, and more generally for graphs of constant skeleton dimension, we show that 3-hopsets require exponentially fewer shortcuts per node than any previously described distance oracle while incurring only a quadratic increase in the query decoding time, and actually offer a speedup when compared to simple oracles based on a direct application of 2-hopsets. Finally, we consider the problem of computing minimum-size h-hopset (for any h ≥ 2) for a given graph G, showing a polylogarithmic-factor approximation for the case of unique shortest path graphs. When h = 3, for a given bound on the space used by the distance oracle, we provide a construction of hopsets achieving polylog approximation both for space and query time compared to the optimal 3-hopset oracle given the space bound. 1 Introduction An exact h-hopset for a weighted graph G is a weighted edge set, whose addition to the graph guarantees that every pair of vertices has a path between them with at most h edges (hops) and whose length is exactly the length of shortest path between the vertices. The concept of a hopset was first explicitly described by Cohen [20] in its approximate setting, in which the length of h-hop path between a pair of vertices in the hopset should approximate the length of the shortest path in G. Hopsets wer introduced in the context of parallel computation of approximate shortest paths. In this paper, we study hopsets in their exact version, with the general objective of optimizing exact shortest path queries. Data structure which allow for querying distance between any pair of vertices of a graph have been intensively studied under the name of distance oracles. The efficiency of an exact distance oracle is typically measured by the interplay between the space requirement of the representation of the data structure and its decoding time. It is a well-established empirical fact that many real-world networks admit efficient (i.e., low-space and fast) distance oracles [6, 23]. A key example here concerns transportation networks, and specifically road networks, which are empirically known [33, 32, 5] to be augmentable by carefully tailored sets of shortcut edges, allowing for shortest-path computation. These sets of shortcuts may be hopsets (as is the case for the hub-labeling approach which effectively implements a 2-hopset), but may also be considered ∗ † Department of Computer Science, University of California, Irvine Inria Paris 1 Distance oracle 2-hopset (hubs): 3-hopset: Treewidth t Size Time n · O(t log n) n · O(t log log n) O(t + log log n) O(t2 log2 log n) Skeleton dimension k Size Time n · O(k log n) n · O(k log k log log n) O(k log n) 1 O(k log2 k log2 log n) 2 Table 1: Comparison of distance oracles based on 2-hopsets (hub labeling [20, 28, 36]) and 3-hopsets (this paper). Size represents the number of shortcut edges in the hopset, i.e., the number of O(log n)-bitsize words when measuring oracle size. The main results concern skeleton dimension and are stated in simplified form, assuming unique shortest path graphs with average edge length at most O(poly log n), with expected query times given for both types of oracles. in some related (and frequently more involved) framework, such as contraction hierarchies [31] or transit-node routing [11]. An interesting theoretical insight due to Abraham et al. [4, 2, 5] provides theoretical bounds on the number of shortcuts required in all of the above-mentioned frameworks. They introduce a parameter describing the structure of shortest paths within ball neighborhoods of a graph, called highway dimension h̃, and express the number of shortcuts that need to be added for each node so as to achieve shortest-path queries in a graph of n nodes with weighted diameter D as a polynomial of h̃, log n, and log D; this approach has been extended in subsequent work [3, 36]. The value of h̃ is known to be small in practice (e.g., typically h̃ < 100 for continental-sized road networks [2]), and does indeed appear to be inherently linked to the size of the required shortcut sets. In fact, empirical tests have suggested that the (average) number of necessary shortcuts per node is in fact very close to h̃, laying open the question of whether the additional dependence of the number of shortcuts on logarithmic factors in n and D may be an artifact of the theoretical analysis of the oracles, which for each node require a separate shortcut for every “scale” of distance. In this work, we provide strong evidence that the dependence of the number of shortcuts on such logarithmic factors in n and D is indeed not essential, and we design a simple distance oracle based on a 3-hopset in which the number of shortcuts per node depends only on h̃, log log n, and the logarithm of the average edge length. This result is in fact shown in the framework of a strictly broader class of graphs, namely, graphs with a bounded value of a parameter known as skeleton dimension k (k ≤ h̃), describing the width of the shortest-path tree of a node after pruning all branches at a constant fraction of their depth. We also show a similar result for 3hopsets in graphs of treewidth t, obtaining a distance oracle in which the number of shortcuts per node is a function of t and log log n. (For the case of bounded treewidth, different constructions with comparable performance were previously known, cf. [15]). The space and time-bounds of oracles based on 3-hopsets are presented in Table 1, and compared with the corresponding parameters of oracles based on 2-hopsets. For the case of constant skeleton dimension or constant treewidth, we remark that using a 3-hopset instead of a 2-hopset reduces the number of shortcuts per node from O(log n) to O(log log n) while achieving a query time of O(log2 log n). 1.1 Results and Organization of the Paper The rest of the paper is organized as follows. In Section 2, we introduce the necessary notions related to h-hopset and give a general approach for how a h-hopset can be used as a distance oracle, focusing on the special case of h = 3. As a warmup to the main results, in Section 3, we 1 The query time of a simple 2-hopset data structure is O(k log n). In a centralized setting, it can be reduced to O(k log log n) by application in combination of a 2-hopset with a given O(log n)-factor approximation of the distance, which can be provided by an auxiliary fast approximate distance oracle (e.g. [17]). 2 show how to construct efficient h-hopsets for bounded treewidth graphs. We also consider the query time for 3-hopsets for weighted trees and, more generally, for bounded treewidth graphs. Then, in Section 4, we provide the first of our main results, using 3-hopsets to obtain improved (smaller) distance oracles in USP graphs with bounded skeleton dimension. In the second part of the paper, we consider LP-based approximation algorithms for constructing 3-hopsets in unique shortest path graphs. A unique shortest path graph (USP) is a graph such that, given any two nodes u and v, there is a unique shortest path Puv between them. In practice, this common assumption can be made without loss of generality, as one can perturb the input to ensure uniqueness; however such a perturbation may significantly change the size of the required distance oracle. Our construction builds on and significantly extends the LP-formulation of 2-hopsets and the framework of prehub labelings introduced in [9]. In Section 5, we provide a ILP formulation for the problem of finding a h-hopset of minimal size. For the case of USP graphs, we then show how this ILP formulation is related to its LP relaxation, namely, that the problem has an at most polylogarithmic integrality gap. We extend the same approach to provide an algorihtm which constructs 3-hopsets which are ready to use as distance oracles in USP graphs, with (approximate) optimality guarantees on size and query time of the oracle. Our work is presented in the context of weighted undirected graphs, but all results can easily be extended to weighted directed graphs. 1.2 Other Related Work Hopsets. Exact hopsets were implicitly constructed in the context of single-source shortest paths parallel computation [42, 35, 19, 39]. Such works study the work versus time trade-offs of such computation. Cohen [20] explicitly introduced the notion of (h, ǫ)-hopset of G as set H of weighted edges such that paths of h hops at most in G ∪ H have length within (1 + ǫ) of the corresponding shortest path in G. The parameter h is called the hopbound. For any graph G ′ and ǫ, ǫ′ > 0, she proposed a construction of (O(poly log n), ǫ)-hopset of G with size O(n1+ǫ ). More recently, Elkin et al. [25] proposed the construction of (O(ǫ−1 log κ)log κ , ǫ)-hopset with O(n1+1/κ log n log κ) edges for any ǫ > 0 and integral κ ≥ 1. Abboud et al. [1] recently showed the optimiality of the Elkin et al. [25] result. In particular, they showed that for any δ > 0 and 1+ 1 −δ integer k, any hopset of size less than n 2k+1 −1 must have hop bound h = Ω(ck /ǫk+1 ), where ck is a constant depending only on k. As far as we know, exact hopsets (with ǫ = 0) have not been explicitly studied. However, they are related to the following well studied notion. Hopsets vs. TC-spanners. In directed graphs, a hopset can be seen as a special case of an h-transitive-closure spanner (h-TC-spanner), i.e., an unweighted directed graph with the same transitive closure as a given unweighted directed graph G, having hop diameter at most h. Hopsets and TC-spanners are a fundamental graph-theoretic objects and are widely used in various settings from distance oracles to pre-processing for range queries in sequential or parallel setting or even in property testing. The concept of adding transitive arcs to a digraph in order to reduce its diameter was introduced by Thorup [40] in the context of parallel processing. Bhattacharyya et al. [12] define a h-transitive-closure spanner (h-TC-spanner for short) of an unweighted digraph G as a digraph H with same transitive closure as G and diameter at most h. They note that this is a central concept in a long line of work around pre-processing a tree for range queries [7, 16, 41]. A TC-spanner can also be defined as a spanner (for the classical spanner definition [37]) of the transitive closure of a graph that has bounded diameter. We will see that an exact h-hopset defines a h-TC-spanner but that the converse is not necessarily true. Bhattacharyya et al. [12] 3 proposed a construction of h-TC-spanner of size O(n log nλh (n)) for H-minor-free graphs (where λh denotes the hth-row inverse Ackermann function, cf. Section 3). Exact Distance Oracles. A long line of research studies the interplay between data structure space and query decoding time. A lot of attention has been given to distance oracles for planar graphs [24, 10, 18, 14, 26, 22, 30], and it has recently been shown that a distance oracle with O(n1.5 ) space and O(log n) query-time is possible [30]. In the context of weighted directed graphs with treewidth t, Chaudhuri and Zaroliagis [15] propose a distance oracle using O(t2 nλh (n)) space and O(t3 h + λh (n)) query time for integral h > 1 where λh is the hth-row inverse Ackermann function (as defined in Subsection 3). In the context of unweighted graphs with treewidth t, Farzan and Kamali [27] obtain distance oracles with O(t3 log3 t) query time using optimal space (within low order terms). This construction heavily relies on the unweighted setting as exhaustive look-up tables are constructed for handling graphs with polylogarithmic size. Distance Labelings and 2-Hopsets. The distance labeling problem is a special case of a distributed distance oracle, and consists of assigning labels to the nodes of a graph such that the distance between two nodes s and t can be computed from the labels of s and t (see, e.g., [28]). The notion of 2-hopset studied in this work coincides with the special case of two-hop distance labeling (also called hub-labeling), where labels are constructed from hub sets: in hub-labeling, a small hub set S(u) ⊆ V (G) is assigned to each node of a graph G such that or any pair u, v of nodes, the intersection of hub sets S(u) ∩ S(v) contains a node on a shortest u − v path. Such a construction is proposed by Gavoille et al. [28] and applies to graphs of treewidth t with labels of O(t log n) size and allows to answer distance queries in O(t log n) time; the hub sets have a hierarchical structure, which allows for an improvement of query time to O(t log log n) time by a binary search over levels. Hub labelings are the best currently known distance labelings for sparse graphs, achieving sublinear node label size [8, 29], and may also be used to provide a 2-additive-approximation for distance labeling in general graphs using sublinear-space labels [29]. In graphs of bounded highway dimension, hub labels were among the first identified distance oracles to provide label size and query time polynomial in the highway dimension and polylogarithmic in other graph parameters [5]. This result was then extended to the more general class of graphs with bounded skeleton dimension [36]. Hub sets with near to optimal size can be constructed in polynomial time. A greedy setcovertype O(log n)-approximation algorithm (with respect to average size of a hub set) was proposed by Cohen et al. [21]. For the case of USP graphs, this approximation ratio was improved by Angelidakis et al. [9] to the logarithm of the graph hop-diameter, i.e., the maximum number of hops of a shortest path in G. 2 2.1 Preliminaries Definitions We are given a weighted undirected graph G = (V, E, ω) where ω : E → R+ associates a weight with each edge of G. For a positive integer parameter h and a pair u, v ∈ V , the h-limited distance between u and v, denoted dhG (u, v), is defined as the length of the shortest uv path that contains at most h edges (aka hops). The usual shortest path distance can be defined as n−1 (u, v). For the sake of brevity, we often let uv denote the pair {u, v} representing dG (u, v) = dG an edge from u to v. 4 Definition 1. An (exact) h-hopset for a weighted graph G is a set of edges H such that dhG∪H (u, v) = dG (u, v) for all u, v in V (G) where G ∪ H = (V, E ∪ H, w′ ) is the graph augmented with edges of the hopset with weights w′ (u, v) = dG (u, v) for uv ∈ H and w′ (u, v) = w(u, v) for uv ∈ E \ H. The parameter h is called the hopbound of the hopset. Edges from set H are called shortcuts in G. By convention, we will assume that all self-loops at nodes of V are included in H. Thus, G ∪ H is a graph whose h-th power in the (min, +) algebra on n × n matrices of edge weights corresponds to the transitive closure of the weight matrix of graph G. Equivalently, a h-hopset can be defined as a set H of edges such that for any pair s, t, there exists a path P of h edges at most from s to t in G ∪ H and a shortest path Q from s to t in G such that all nodes of P belong to Q and appear in the same order. Note that a h-hopset is completely specified by its set H of edges as the associated weights are deduced from distances in the graph. 2.2 Using a Hopset as a Distance Oracle Hopsets may be used to answer shortest-path queries in a graph G = (V, E). In general, given a hopset H, the naïve way to approach a query for dG (u, v) for a given node pair u, v is to perform a bidirectional Dijkstra search in graph G ∪ H from this node pair, limited to a maximum of ⌈h/2⌉ hops distance from each of these nodes. We have, in particular for any pair u, v ∈ V : ⌈h/2⌉ ⌊h/2⌋ dG (u, v) = min(dG∪H (u, w) + dG∪H (v, w)). w∈V Different optimizations of this technique are possible. In this paper, we focus only on the time complexity of the case of h = 3, where we perform the following optimization of query execution. We represent set H as the union of two (not necessarily disjoint) sets of shortcuts, H = H1 ∪ H2 , where an edge belongs to H1 if it is used as the first or third (last) hop on a shortest path in G ∪ H, and it belongs to G ∪ H2 if it is used as the second hop on such a path. By convention, we assume that self-loops at nodes are added to H1 , thus e.g. a 3-hop path between a pair of adjacent nodes in G is constructed by taking a self-loop from H1 , the correct edge from G ⊆ G ∪ H2 , and another self-loop from H1 . (Note that we never directly use edges of G as first or last hops in the hopset; if such an edge is required for correctness of construction, it should be explicitly added to set H1 .) We further apply an ~ 1 , such that, for orientation to the shortcuts in H1 , constructing a corresponding set of arcs H ~ ~ 1, any node pair u, v ∈ V , there exist x, y ∈ V such that (u, x) ∈ H1 , {x, y} ∈ H2 , (v, y) ∈ H and: dG (u, v) = dG (u, x) + dG (x, y) + dG (v, y). ~ 1 | ≤ 2|H1 |, since each shortcut from H1 corresponds to at most a pair We note that |H1 | ≤ |H ~ ~ 1 }| represent the of symmetric arcs in H1 . For a node w ∈ V , let N1 (w) = |{x ∈ V : (w, x) ∈ H ~ 1 ). To perform shortest path queries on G, we now out-neighborhood of v in the graph (V, H store for each node w the lists ((x, dG (w, x)) : x ∈ N1 (w)). We also store a hash map, mapping all node pairs {x, y} ∈ H2 to the length of the respective link, dG (x, y). Now, we answer the distance query for a node pair u, v ∈ G as follows: dG (u, v) = min x∈N1 (u),y∈N1 (v):{x,y}∈H2 (dG (u, x) + dG (x, y) + dG (v, y)). Using the given data structures, the query is then processed using |N1 (u)| · |N1 (v)| hashmap look-ups, one for each pair (x, y) ∈ N1 (u) × N1 (v), i.e., in time Tuv = O(|N1 (u)| · |N1 (v)|). Time Tuv is simply referred to as the query time for the considered node pair in the 3-hopset oracle 5 H. Assuming uniform query density all node pairs, the uniform-average query time T (H)  over 2 1 P = O(|H1 |2 /n2 ). Thus, in the uniform is given as: T (H) ≡ Euv Tuv = O n2 u∈V |N1 (u)| density setting (which we refer to in Section 5 only), the average time of processing a query is proportional to the square of the average degree of a node with respect to edge set H1 . The size of set H2 affects only the size of the data structure required by the distance oracle, which is given as at most S = O(|E| + |H1 | + |H2 |) edges, with each edge represented using O(log n) bits. In the 3-hopset distance oracles described in the following sections, we will confine ourselves ~ 1 of H1 will follow to describing shortcut sets H1 and H2 , noting that the correct orientation H naturally from the details of the provided constructions. 3 Warmup: Bounded Treewidth Graphs As a warm-up, we provide a h-hopset construction for bounded treewidth graphs and use it to design a distance oracle in the case h = 3. We first consider the case of (weighted) trees. The construction of h-hopsets for trees is classical. It is implicit in [7, 16], explicit for unweighted trees in [13] and directed trees in [41]. We provide a short construction which fine-grains the dependence of the hopset size on h (e.g., replacing 2h by h with respect to the asymptotic analysis in [7]). The construction is based on the following lemma for splitting the tree into smaller sub-trees. Lemma 1. Given a tree T with n nodes and a value p > 1, there exists a set P of 2p nodes at most such that each connected component of T \ P contains less than n/p nodes and is connected to at most two nodes in P . Set P can be computed in linear time through a bottom-up traversal of the tree. Proof. Start with P ′ = ∅ and root T at some arbitrary node r. As long as the connected component of T \ P ′ containing root r has n/p nodes or more, add to P ′ a node u from this component such that the subtree T (u) rooted as u has size n/p or more while |T (v)| < n/p for all descendants v of u. This results in a set P ′ of at most p nodes such that the connected components of T \ P have size less than n/p. Define P ′′ as the set of lowest common ancestors of any two nodes u, v ∈ P ′ . The size of P ′′ is at most p − 1 since its nodes correspond to the internal nodes with two children ore more in the minimal sub-tree containing P which has at most p leaves. Let P = P ′ ∪ P ′′ be the union of P and P ′ . For any connected component T ′ of T \ P , there exist at most two nodes in P that are connected to nodes of T ′ in T : at most one is connected to the root r ′ of T ′ (T ′ is considered as a sub-tree of T ) and at most one has its parent in T ′ (if there were two such nodes, their lowest common ancestor would be in P and not in T ′ , contradicting the connectivity of T ′ ). h-hopset construction for trees. A 1-hopset in a tree T is obtained by adding all pairs as edges with appropriate weight. For h > 1, we recursively define a h-hopset of T as follows. Select n a set P of 2p nodes at most with p = λh−2 (n) according to Lemma 1. (The number λh−2 (n) is suitably chosen according to the (h − 2)-row inverse Ackerman function defined next.) When h = 2, we add an edge from each node u of T to each node in P . When h > 2, we consider the forest T ′ induced by nodes in P : it has node set P and edges xy such that y is the closest ancestor of x in T that belongs to P . The weight of such an edge is defined as w′ (x, y) = dT (x, y). We then add a (h − 2)-hopset of T ′ to the construction. Additionally, we add one or two edges per node not in P : for each connected component C of T \ P , add an edge ux for each node u ∈ C and each x ∈ P connected to C. Note that Lemma 1 ensures that there are at most two such 6 nodes x for a given component C. In both cases (h ≥ 2), we construct recursively a h-hopset of each sub-tree induced by a connected component C of T \ P . In the special case of h = 3, the (h − 2)-hopsets contribute to H2 while all edges connecting to a node in some selected set P contribute to H1 according to the H = H1 ∪ H2 convention introduced in the Preliminaries. Notation: Ackermann function. To analyze the construction, following [7], we introduce the following variants of the Ackermann function:    A(0, j) = 2j, for j ≥ 0  B(0, j) = j 2 , for j ≥ 0 A(i, 0) = 1, for i ≥ 1 and B(i, 0) = 2, for i ≥ 1   A(i, j) = A(i − 1, A(i, j − 1)), for i, j ≥ 1; B(i, j) = B(i − 1, B(i, j − 1)), for i, j ≥ 1. The kth-row inverse Ackermann function λk (.) is defined by λ2i (n) = min{j | A(i, j) ≥ n} and √ λ2i+1 (n) = min{j | B(i, j) ≥ n} for i ≥ 0. Equivalently, we have λ0 (n) = n2 , λ1 (n) = n and λk (n) = λ∗k−2 (n) where we define for any function f : f (0) (n) = n, f (i) (n) = f (f (i−1) (n)) for i > 0, and f ∗ (n) = min{j | f (j) ≤ 1}. Note that λ2 (n) = log n, λ3 (n) = log log n, λ4 (n) = log∗ n and λ5 (n) = 21 log∗ n. The inverse Ackermann function is defined as α(n) = min{j | A(j, j) ≥ n}. Note that we have λ2α(n) (n) = α(n). We are now ready to state the parameters of the designed hopset. Proposition 1. For any integer h > 1 and weighted tree T with n nodes, a h-hopset H of T with O(nλh (n)) edges can be computed in O(nλh (n)) time. A linear size 2(α(n) + 1)-hopset can be computed in O(nα(n)) time. In the case h = 3, the constructed hopset allows to obtain a distance oracle using space of O(n log log n) edges of O(log n) bits and having query time O(log2 log n). Correctness. The correctness of the constructed h-hopset H comes from the fact two nodes u, v in two different connected components of T \ P both have an hopset edge to a node in P on the path Puv from u to v according to Lemma 1. Let x and y denote the nodes in P ∩ Puv that are linked to u and v respectively (ux, vy ∈ H). For h > 2, the h − 2-hopset added in the construction implies that a path of h − 2 hops at most links x to y in T ∪ H and we thus have dhT ∪H (u, v) = dT (u, v). For h = 2, we also have vx ∈ H (and uy ∈ H), and x ∈ Puv implies d2T ∪H (u, v) = dT (u, v). Analysis. We claim that the resulting h-hopset has O(nλh (n)) edges for h > 1. Recall that n a 1-hopset has Θ(n2 ) edges. Note that the choice of p = λh−2 (n) in our construction implies that connected components created by Lemma 1 have size λh−2 (n) at most. The components (j) created in a recursive call with recursion depth j will have size λh−2 (n). The number of recursion (j) levels is thus min{j | λh−2 (n) ≤ 1} = λh (n). We now show that O(n) edges are added to the construction at each recursion level. For h = 2, we have p = O(1) and the number of edges √ added at each recursion level is thus at most O(n). For h = 3, we have p = λ1n(n) = n and the h − 2-hopset constructed on 2p nodes at most has O(n) edges. For h > 3, we proceed by induction on h: we assume that the (h − 2)-hopset constructed for a tree with 2p nodes at most n has O(2pλh−2 (2p)) edges that is O(n) edges for p = λh−2 (n) (note that λh−2 is non-decreasing for any h > 0). Query time for 3-hopsets. For the special case of h = 3, we have λ3 (n) = log log n, and the size required to represent the 3-hop data structure is S = O(n log log n) edges. Moreover, following the convention H = H1 ∪ H2 introduced in the Preliminaries, we note that in the 7 adopted construction degH1 (v) = O(log log n) for all v ∈ V . A bound of O(log2 log n) query time follows the above analysis. Linear size hopset. We can obtain a linear size 2(α(n) + 1)-hopset by splitting T into subn . Two nodes in a connected component trees of size α(n) at most using Lemma 1 with p = α(n) of T \ P are thus obviouly linked by a path of length α(n) at most in T . Similary as before, we link every node to the (at most 2) nodes in P connected to its component and add a 2α(n)-hopset for the forest induced by nodes in P . We thus obtain a 2(α(n) + 1)-hopset with n λ2α(n) (n)) = O(n) edges. O(n + α(n) Lower bound. We note that the O(nλh (n)) hopset size is indeed tight for some trees. If P is a path with nodes from 1 to n, any h-hopset can be seen as a covering of intervals in [1, n] where [i, j] denotes the interval i, i + 1, . . . , j of integers. More precisely, a set I of intervals h-covers [1, n] when every interval [i, j] ⊆ [1, n] is the union of at most h intervals in I [7]. We can easily obtain a h-covering from any h-hopset H of the path P by associating each edge uv of P ∪ H to the interval [u, v]. A lower bound of Ω(nλh (n)) for the size of a h-covering of [1, n] is proved in [7]. Treewidth definition. Recall that a graph G has treewidth t if there exists a tree T whose nodes are subsets of V (G) called bags such that: |X| ≤ t + 1 for all X ∈ V (T ); for all edges uv ∈ E(G), there exists a bag X ∈ V (T ) containing both u and v (u, v ∈ X); and for all nodes u ∈ V (G), the bags containing u form a sub-tree of T . Without loss of generality, we assume that each bag contains exactly t + 1 nodes, and that two neighboring bags share exactly t nodes (the decomposition is standard). This implies |V (T )| ≤ n as each bag brings one new node. Note that removing a non-leaf bag separates the graph into several connected components. We consider that all edges of T have weight 1. For convenience, we assume that T is root at some bag R and define for each node u ∈ V (G) the root bag of u as the bag Ru ∈ V (T ) containing u which is closest to the root. h-hopset construction for bounded treewidth graphs. Consider a graph G with treewidth t and an associated tree T . The general idea is to follow the construction of a h-hopset of T with slight modifications. Similarly to the tree case, we select a set P of 2p bags at most with n/t ′ ′ p = λh−2 (n/t) according to Lemma 1. We then construct a (h − 2)-hopset HT of the forest T induced by bags in P according to the tree construction. For each edge XY in HT ′ , we add an edge xy to the graph hopset for all x ∈ X and y ∈ Y . Such edges are called tree-hopset edges. Now for each node u such that its root bag Ru falls in a connected component of T \ P , we consider the (at most 2) bags Y ∈ P that are connected to that component and add an edge uy to the graph hopset for all y ∈ Y . Such edges are called separator edges. We then recurse on n′ each component of T \ P until we reach subtrees of size n′ ≤ t. We then pursue with p = λh−2 (n′ ) and so on recursively until reaching components of size 1 at most. Finally, for each node u, we add an edge ux to the graph hopset for all x ∈ Ru . Such edges are called bag edges. To construct n and a 2α(n)-hopset of T ′ . For each tree a linear size hopset, we use a single step with p = α(n) edge XY inside components of T \ P we add an edge xy to the construction for all x ∈ X and y ∈ Y such that x ∈ / Y and y ∈ / X. Such edges are also considered as tree-hopset edges. Theorem 1. For all h > 1, any graph with treewidth t has a h-hopset with O(tnλh (n)) edges and a 2(α(n) + 1)-hopset with O(t2 n) edges. 8 Correctness of construction. Let H denote the hopset constructed for a graph G with treewidth t and associated tree T . Consider a shortest path Q = u0 , . . . , uk for some integer k ≥ 1. First consider the case where a bag X of T contains both u0 and uk . We can assume without loss of generality than Ru0 is an ancestor of Ruk . As Ruk lies on the path from X to Ru0 , it must contain u0 and edge uk u0 is in H according to the last step of the above construction. Now suppose that no bag contains both u0 and uk . Consider the first recursion call where splitting a subtree with a set P of bags separates Ru0 and Ruk . Consider the path from Ru0 to Ruk in T . Let X (resp. Y ) be the first (resp. last) bag in P on that path. Either u0 is in X or H contains separator edges from u0 to all nodes in X. Similarly, either uk is in Y or H contains a separator edge from uk to all nodes in Y . The (h − 2)-hopset considered during that recursion call contains a path P ′ of h′ ≤ h − 2 hops from X to Y . If two consecutive bags contain u0 and uk respectively, then H contains edge u0 uk as a tree-hopset edge. Otherwise, let X ′ (resp. Y’) be the first bag in P ′ not containing u0 (resp. uk ). By treewidth definition, there exists bags X1 , . . . , Xk ∈ V (T ) containing edges u0 u1 , . . . , uk−1 uk respectively (i.e., Xi contains ui−1 and ui for all i ∈ {1, . . . , k}). The shortest path Q corresponds to a walk in T from X1 to X2 , then to X3 and so on. All bags on the path (in T ) from Xi to Xi+1 must contain ui . As that walk must go through X ′ , we can define the highest index i0 > 0 such that ui0 ∈ X ′ . Similarly, we can define the smallest index j0 >= i0 such that uj0 ∈ Y ′ . Our construction H then contains separator edges u0 ui0 and uk uj0 . When i0 = j0 , H contains a path of 2 hops at most with same length as Q. If two consecutive bags of P ′ contain ui0 and uj0 respectively, then H contains a tree-hopset edge ui0 uj0 . Otherwise, we can similarly define indexes i1 , . . . , ih′′ and j1 , . . . , jh′′′ with i0 < i1 < · · · < ih′′ < jh′′′ < · · · < j1 < j0 and h′′ + h′′′ + 1 ≤ h′ ≤ h − 2. Our construction H then contains tree-hopset edges ui0 ui1 , . . . uih′′ −1 uih′′ , uih′′ ujh′′′ , ujh′′′ −1 ujh′′′ , . . . , uj0 uj1 . In all cases, H contains a path of h hops at most and same length as Q. Analysis. In the first recursion levels, a subtree of size n′ is split into subtrees smaller than tλh−2 (n′ /t) ≤ tλh−2 (n′ ). At recursion depth λ∗h−2 (n) = λh (n), we thus obtain subtrees of size t at most. Deeper recursion calls are similar to the tree case. The total number of recursion levels is thus λh (n)+λh (t) = O(λh (n)). When processing a subtree of size n′ , we build a (h−2)-hopset for a forest of 2p bags at most using O(2pλh−2 (2p)) edges according to Proposition 1. For n′ > t, n′ /t 2 n′ ′ we use p = λh−2 (n′ /t) and thus produce O(t t ) = O(tn) tree-hopset edges at most. For n ≤ t, ′ n ′ we use p = λh−2 (n′ ) . However, for a given bag X, there are at most n ≤ t nodes not in X among the other n′ − 1 bags. We thus produce at most t tree-hopset edges per bag. In both cases, each recursion level thus brings O(tn) tree-hopset edges as well as O(tn) separator edges. There are tn bag edges at most in total. We can thus obtain a h-hopset with O(tnλh (n)) edges for any graph of treewidth t. In the linear size construction, we use a single step using a 2α(n)-hopset n λ2α(n) (n)) = O(n) edges. We thus have O(t2 n + tn) tree-hopset edges and for T ′ with O( α(n) O(tn) separator edges. Query time for 3-hopsets. For the special case of h = 3, we have λ3 (n) = log log n, and the size required to represent the 3-hop data structure is S = O(tn log log n) edges. Following the convention H = H1 ∪ H2 , we classify tree-hopset edges in H2 while both separator edges and bag edges are classified in H1 . For any v ∈ V , we thus have degH1 (v) = O(t log log n). The following bound on the query time follows. Theorem 2. Any graph with treewidth t admits a 3-hopset distance oracle represented on O(tn log log n) edges of O(log n) bits, with a query time of O(t2 log2 log n). 9 4 Bounded Skeleton Dimension In this Section we consider graphs with unique shortest paths (USP), only. A formal definition of the notion of skeleton dimension relies on the concept of the geometric realization of a graph, e of G can be seen as the “continuous” graph where each cf. [36]. The geometric realization G edge is seen as infinitely many vertices of degree two with infinitely small edges, such that for e at distance tdG (u, v) from u on edge uv. We any uv ∈ E(G) and t ∈ [0, 1], there is a node in G define the reach of v ∈ V (Te) as Reach Te (v) := maxx∈V (Te) dTe (v, x). We then define the skeleton T ∗ of T as the subtree of Te induced by nodes with reach at least half their distance from the root. More precisely, T ∗ is the subtree of Te induced by {v ∈ V (Te) | Reach Te (v) ≥ 21 dTe (u, v)}. The width of a tree T with root u is defined as the maximum number of nodes (points) in Te at a given distance from its root. More precisely, the width of T is Width(T ) = maxr>0 | Cut r (Te)| where Cut r (Te) is the set of nodes v ∈ V (Te) with dTe (u, v) = r. The skeleton dimension k of a graph G is now defined as the maximum width of the skeleton of a shortest path tree, that is k = maxu∈V (G) Width(Tu∗ ), where Tu denotes the shortest path tree of u obtained as the union of shortest paths from u to all v ∈ V (G). For the definition of the related concept of highway dimension we refer the reader to [5]. e of a graph G has highway dimension h̃, then G We note that if the geometric realization G has skeleton dimension k ≤ h̃; hence, in all subsequent asymptotic analyses, upper bounds expressed in terms of skeleton dimension can be replaced by analogous bounds in terms of highway dimension. 4.1 Construction of the 3-Hopset We denote by Lmax the maximum length of an edge in graph G. The construction of the 3hopset H is obtained by taking a union of sets of shortcuts, each of which covers sets of node pairs within a given distance range. The first shortcut set H ′ covers all node pairs u, v ∈ V with dG (u, v) ≤ D ′ , for some choice of distance bound D ′ , whereas each of the subsequent shortcut sets H (D) covers nodes at a distance in an exponential increasing distance range, dG (u, v) ∈ [D, D 1+ǫ ], where ǫ := 2 log1 k is suitably chosen. We then put: 2 H = H′ ∪ [ H (D ′ i(1+ǫ) ) . i=1,2,... Construction of set H ′ . We note that a construction of 2-hopsets for graphs of skeleton dimension k was performed in [36]. As a direct corollary of [36][Lem. 2, Cor. 1,2], given a distance bound D ′ , there exists a randomized polynomial-time construction of a set of shortcuts H ′ for graph G with the property that for any pair of nodes u, v ∈ V with dG (u, v) ≤ D ′ , we have d2G∪H ′ = dG (u, v), such that |H ′ | = O(nk log D ′ ), and moreover for all u ∈ V , we have E degH ′ (u) = O(k log D ′ ) and degH ′ (u) = O(k log D ′ log log n + log n). We use set H ′ directly for the value D ′ := L4max k6 log12 n, considering H ′ as a 3-hopset for node pairs u, v ∈ V with dG (u, v) ≤ D ′ . We have: |H ′ | = O(nk(log log n + log Lmax + log k)), and for all u ∈ V : E degH ′ (u) = O(k(log log n + log Lmax + log k)), degH ′ (u) = O(k log log n(log log n + log Lmax + log k) + log n). 10 We remark that, without loss of generality, in asymptotic analysis one may assume that Lmax ≤ kL, where L is the average edge length in G, noting that edges longer than kL can be subdivided into edges of length at most kL by inserting additional vertices, increasing the number of nodes of the graph only by a multiplicative constant. Thus, in the above bounds, we can replace (log log n + log Lmax + log k) by (log log n + log L + log k). Construction of set H (D) . We now proceed to construct a 3-hopset for node pairs u, v with dG (u, v) ∈ [D, D 1+ǫ ]. The construction of set H (D) is randomized and completely determined by assignment of real values ρ(u) ∈ [0, 1] to each node u ∈ V , uniformly and independently at random. We condition all subsequent considerations on the event that all values ρ are distinct, |ρ(V )| = |V |, which holds with probability 1. (D) (D) Now, hopset H (D) is defined as H (D) := H1 ∪ H2 , where following our usual notation, (D) (D) H1 is the set of first and last hops, and H2 is the set of middle hops. Set of first and last hops. For u ∈ V , let R(D) (u) be the set of nodes which lie on a shortest path of length at least D which has one of its endpoints at u, and which have minimum value of ρ among all vertices on this path at distance in [D/4, D/2] from u: n o [ R(D) (u) = argminr∈Puv ,dG (u,r)∈[D/4,D/2] ρ(r) . v∈V :dG (u,v)≥D (D) We now put: H1 := {ur : u ∈ V, r ∈ R(u)}. (D) Set of middle hops. We put in H2 links between all pairs of nodes which have a small value of ρ, satisfy the natural upper bound of D 1+ǫ on distance between them, and have sufficiently large reach, i.e., the shortest path between them can be extended by at least D/4: ) ( [ (D) R(D) (u) ∧ dG (q, r) ≤ D 1+ǫ − D/2 ∧ (∃v∈V r ∈ Pqv ∧ dG (r, v) ≥ D/4) . H2 := qr : q, r ∈ u∈V The validity of H as a 3-hopset is immediate to verify from the construction. 4.2 Bound on 3-Hopset Size and Oracle Time Lemma 2. Fix u ∈ V and D > 0. We have: |R(D) (u)| ≤ k. Proof. By the fact that the size of the cut of the skeleton tree for node u at distance D/2 from u is upper-bounded by the skeleton dimension k, we have that the set of paths P := {Πv : v ∈ V ∧ dG (u, v) ≥ D}, where Πv := {w ∈ Puv : dG (u, w) ∈ [D/4, D/2]}, has at least at most k distinct paths, |P| ≤ k. The bound on the size of set |R(D) (u)| now follows directly from its definition. From the above Lemma, it follows that for any u ∈ V we have degH (D) (u) ≤ k, thus summing 1 over the O(log log(nLmax )/ log(1 + ǫ)) = O(log log(nLmax ) log k) levels of the construction, we successively obtain: degH1 (u) ≤ degH ′ (u) + k · O(log log(nLmax ) log k) = O(k log log n log k(log log n + log L) + log n), E degH1 (u) ≤ E degH ′ (u) + k · O(log log(nLmax ) log k) = O(k log k(log log n + log L)), ′ |H1 | ≤ |H | + nk · O(log log(nLmax ) log k) = O(nk log k(log log n + log L)). We now proceed to bound the size of the set H2 of middle hopsets. 11 (1) (2) (3) Lemma 3. Fix D ≥ D ′ . With probability 1 − O(1/n2 ), it holds that for all u ∈ V , for all r ∈ R(D) (u), we have ρ(r) ≤ Lmax /D. Proof. As noted in the proof of Lemma 2, to be included in R(D) (u), a node r must be the minimum element along one of the at most k possible paths Πv . Each such path includes all nodes on the path Puv at distance in the range [D/4, D/2] from u, where we recall that D ≥ D ′ = CL4max k6 log12 n > CLmax ln2 n, for some sufficiently large choice of constant C > 0. It follows that each path Πv contains |Πv | ≥ max{ln2 n, 8LCD } nodes. Now, taking note of max the independence of the choice of random variables (ρ(w) : w ∈ Πv ), we have by a simple concentration bound that Pr[min ρ(Πv ) > Lmax /D] ≤ O(1/n4 ), for a suitable choice of constant C. By taking a union bound over all paths Πv in P, and then another union bound over all u ∈ V , the claim follows. We now proceed under the assumption that the event from the claim of the Lemma holds. We now consider an arbitrary node q ∈ R(D) (u) for some u ∈ V , and look at degH (D) (q). We (D) (D) now have that if qr ∈ H2 , then by the definition of H2 conditions jointly hold: 2 and the above Lemma, the following • ρ(r) ≤ Lmax /D • r ∈ {w ∈ V : ∃v∈V D 1+ǫ ≥ dG (q, v) ≥ dG (q, w) + D/4 ∧ Pqw ⊆ Pgv } =: W (q). We note that W (q) is the subset of the vertex set of the shortest path tree of node q, pruned to contain only those paths which have reach at least D/4 at depth less than D 1+ǫ . This tree has depth bounded by D 1+ǫ , and width bounded by a generalized skeleton dimension parameter −ǫ /4. Following [36][Section 6], k denoted as kα (following [36]), with parameter α = DD/4 α 1+ǫ = D can be easily expressed using skeleton dimension k as: ǫ kα ≤ k⌈log2 (1+1/α)⌉ < k1+log2 (4D ) = k3 D ǫ log2 k . We then have |W (q)| ≤ D 1+ǫ kα < k 3 D 1+ǫ(1+log2 k) . Moreover, by an easy concentration bound, we have that for all q ∈ V , |{r ∈ W (q) : ρ(r) ≤ Lmax /D}| = O(log n) + 2LDmax |W (q)|, with probability 1 − O(1/n2 ). It follows that with probability 1 − O(1/n2 ), we have for all q ∈ S (D) (u): u∈V R degH (D) (q) ≤ O(log n) + 2 2Lmax |W (q)| ≤ O(log n + Lmax k3 D ǫ log2 k ). D Noting that with probability 1 − O(1/n2 ): [ | R(D) (u)| ≤ |{w ∈ V : ρ(w) ≤ Lmax /D| ≤ O(log n + nLmax /D) u∈V we finally obtain that with probability 1 − O(1/n2 ): (D) |H2 | ≤ O(log n + nLmax /D)O(log n + Lmax k3 D ǫ log2 k ) = O(log2 n + nL2max k3 D ǫ log2 k−1 ) ≤ O(nL2max k3 D −1/2 ) ≤ O(nD ′−1/4 ) ≤ O(n/ log3 n), where in the last two transformations we used the fact that ǫ = 2 log1 k and that D ≥ D ′ ≥ 2 L4max k6 log12 n. Using a union bound and summing over all levels of the construction, we eventually obtain that with probability 1 − O(1/n): |H2 | ≤ O(n/ log2 n). 12 (4) Thus, the set of middle links is sparse and does not contribute to the asymptotic size of the overall representation of the 3-hopset. Overall, considering a randomized construction which rejects random choices of ρ for which any of the considered w.h.p. events fail, by combining Eq. (1)–(4) with the hopset-based distance oracle framework described in the Preliminaries, we obtain the following Theorem. Theorem 3. For a unique shortest path graph with skeleton dimension k and average link length L ≥ 1, there exists a randomized construction of a 3-hopset distance oracle of size |H| = O(nk log k(log log n+log L)), which for an arbitary queried node pair performs distance queries in expected time O(k2 log2 k(log2 log n+log2 L)) (where the expectation is taken over the randomized construction of the oracle), and in time O(k 2 log2 k log2 log n(log2 log n + log2 L) + log2 n) with certainty. In particular, for graphs with constant-length edges and small skeleton dimension (k = O(log n)), the 3-hopset has size |H| = O(nk log k log log n), with expected time of any query given as O(k2 log2 k log2 log n). 5 LP-based Approximation Algorithm In this Section, we propose an Integer Linear Programming (ILP) formulation for h-hopsets with a minimum number of edges, which we then relax to a LP formulation. Whereas both formulations are applicable to the general case, we prove relations between them only for USP graphs. 5.1 ILP and LP Formulations A necessary and sufficient condition for H to be a h-hopset for G is that for every pair of vertices s, t there exists a path Pst = (s = v0 , v1 , . . . , vlst = t) in G ∪ H such that lst ≤ h and in graph G there exists some shortest s − t path passing through all of the vertices v0 , . . . , vlst , in the given order. For a fixed pair s, t, we consider the directed graph H st with vertex set V × {0, . . . , h} ≡ Vh (by convention, elements of Vh will be denoted compactly as vi , where v ∈ V , i ∈ {0, . . . , h}) and with an arc set defined as follows. For i ∈ {0, . . . , h − 1}, we add arc (ui , vi+1 ) to H st if and only if {u, v} ∈ G ∪ H and u, v lie on some shortest s − t path in the given order, i.e., if dG (s, u) + dG (u, v) + dG (v, t) = dG (s, t). In particular, all arcs of the form (ui , ui+1 ), for u ∈ V , belong to H st . Now, we have that H is a h-hopset for G if and only if there exists a path from s0 to th in H st . This is equivalent to saying that for all s, t ∈ V , the flow value from s0 to th is at least 1 in H st . Given graph G, we thus have the following ILP formulation for the minimum h-hopset problem, using indicator variables xuv for G ∪ H (given as 1 if {u, v} ∈ G ∪ H and 0 otherwise) and variables fusti vj , representing the flow value along arc (ui , vj ) in H st : X Minimize: xuv (5) u6=v,{u,v}∈E / 13 Subject to: X ui fvstj ui xuv ∈ {0, 1} (6) ( xuv , if j = i + 1 and dG (s, u) + dG (u, v) + dG (v, t) = dG (s, t), 0 ≤ fusti vj ≤ 0, otherwise. (7)   for vj ∈ Vh \ {s0 , th } 0, X st , (8) − fui vj = +1, for vj = s0   ui −1, for vj = th where indices s, t, u, v traverse V and indices i, j traverse {0, . . . , h}. To obtain an LP relaxation of the above problem, we replace the integral condition xuv ∈ {0, 1} by the fractional one xuv ∈ {0, 1}. We look at the connection between the integral and fractional forms for the special case of unique shortest path graphs. We remark that the above formulation can be seen as a generalization of the LP and ILP statement of Angelidakis et al. [9] proposed for the special case of 2-hop labeling. In the case of 2-hop labeling, Angelidakis P et al. do not rely on an explicit flow formulation but use a single constraint of the simpler form w∈P st min{xsw , xwt } ≥ 1, where P st represents the set of nodes on some shortest s − t path in G. However, the analysis of the integrality gap does not carry over from the case of h = 2 to h > 2, i.e., as soon as there exist internal shortcuts which have neither s nor t as one of their endpoints. 5.2 Bounding Integrality Gap for Unique Shortest Path Graphs We analyze the integrality gap of the above LP formulation for the case of unique shortest path (USP) graphs, i.e., graphs in which each pair of nodes s, t ∈ V is connected by a unique shortest path P st in G. We will occasionally identify P st with its set of nodes, and we will introduce a linear order on its vertices, writing for u, v ∈ P st that u <st v if dG (s, u) < dG (s, v); we will denote the order simply as “<” when the path P st is clear from the context. Observe that in the LP formulation, we may have fusti vj 6= 0 only if u <st v and j = i + 1. Thus, fixing s, t ∈ V , the flow f st = (fusti vj : ui , vj ∈ Vh ) is non-zero between vertices of {P st } × {0, 1, . . . , h} only, and the flow is oriented towards t on this path. st LP = P Let (xuv , fui vj ) be a fixed solution to the LP problem in a USP graph, with cost COST ′′ for G x . We will show how to use this set to construct a valid hopset H uv u6=v,{u,v}∈E / (thus, equivalently, also solving the ILP formulation). We first apply a randomized rounding procedure following the classical scheme of Raghavan and Thomson [38]. We define the family of independent random variables (x′ui vi+1 : u, v ∈ V, i ∈ {0, . . . , h}), with x′ui vi+1 ∈ {0, 1}. For u 6= v, {u, v} ∈ / E we put Pr[x′ui vi+1 = 1] = min{Cxuv , 1}, where C ≥ 1 is a suitably chosen probability amplification parameter (we put C = 8h ln n). We will assume, without affecting the validity or cost of the solution, that xuv = x′ui vi+1 = 1, when u = v or {u, v} ∈ E. We denote H ′ = {{u, v} : u, v ∈ V ∧ u 6= v ∧ {u, v} ∈ / E ∧ ∃i∈{0,...,h−1} x′ui vi+1 = 1}. Let π : V → {1, . . . , n} be a bijection (informally, a permutation) picked uniformly at random. We define the set of shortcuts S({u, v}) associated with each pair {u, v} ∈ H ′ as the set of all pairs of nodes on path P uv , one of which is a prefix minimum on this path with respect to π, and the other of which is a suffix minimum with respect to π:   ∗ ∗ ∗ ∗ uv ∗ ∗ S({u, v}) := {u , v } : u , v ∈ P ∧ π(u ) = min uv ∗ π(z) ∧ π(v ) = min uv ∗ π(z) . uv uv z∈P 14 ,z≤ u z∈P ,z≥ v The obtained solution is given as the set of all such shortcuts: [ H ′′ := S({u, v}). {u,v}∈H ′ Proposition 2. With probability 1 − O(1/n), set H ′′ is a hopset for G of size O(h2 log3 n · COSTLP ). The rest of the section is devoted to the proof of Proposition 2. 5.2.1 Size of Hopset H ” Proposition 3. We have |H ′′ | = O(h2 log3 n · COSTLP ), with probability 1 − O(1/n). Proof. We first remark that for any i ∈ {0, . . . , h − 1}, we have by a standard application of a multiplicative Chernoff bound that the following bound holds with probability 1 − O(1/n2 ): X X x′ui vi+1 ≤ 2C xui vi+1 = O(h log n · COSTLP ) u6=v,{u,v}∈E / u6=v,{u,v}∈E / It follows by a union bound over i ∈ {0, . . . , h − 1} that |H ′ | = O(h2 log n · COSTLP ), with probability 1 − O(1/n). We now proceed to bound the size of each set S({u, v}), for {u, v} ∈ H ′ . This is given precisely by the product of the size of the set of prefix minima and suffix minima of permutation π on path P uv . Denoting the random variable describing the number of prefix minima on a path as X st := |{u∗ ∈ P st : π(u∗ ) = minz∈P st ,z≤st u∗ }|, we have: |S({u, v})| = X uv · X vu . It is well-known the number of prefix minima has expectation EX uv = ln |P uv | + O(1) ≤ ln n+O(1) and that the distribution of X uv is concentrated around its expectation; in particular, we have by a simple multiplicative Chernoff bound that Pr[X uv ≤ 4 ln n] ≥ 1 − n−3 . Applying a union bound over all {u, v}, we have: Pr[∀{u,v}∈H ′ |S({u, v})| ≤ 16 ln2 n] ≥ 1 − n−1 . Overall, we thus have that |H ′′ | = O(h2 log n · COSTLP · log2 n) = O(h2 log3 n · COSTLP ), with probability 1 − O(1/n). 5.2.2 Correctness of Hopset H ” For fixed s, t ∈ V , the choice of x′ui vi+1 is performed iteratively over i, as a random process. Each step i = 0, 1, . . . , h − 1 of this process determines the vertex v (i+1)st ∈ P st , given inductively as: v (i+1)st = max{v ∈ P st : ∃u∈P st u ≤ v (i)st ∧ x′ui vi+1 = 1}, (<st ) where we denote v (0)st := s. First of all, observe that we have the following sufficient condition for the validity of a h-hopset for the pair s, t. Lemma 4. If v (h)st = t, then there exists a s − t path in G ∪ H ′′ with at most h hops whose vertices form an increasing subsequence on P st according to the order “<st ”. 15 Proof. For i ∈ {0, . . . , h − 1}, denote by u(i+1)st the vertex u used in the definition of v (i+1)st , i.e.: u(i+1)st = max{u ∈ P st : x′ (i+1)st = 1}. ui vi+1 (<st ) Note that u(i+1)st ≤ v (i)st ≤ v (i+1)st . For some l ≤ h, let (φ0 , . . . , φl ) ⊆ (0, . . . , h), with φ0 = 0 and φl = h, denote a minimal subsequence of indices such that u(φi )st ≤ v (φi−1 )st ≤ u(φi+1 )st ≤ (φi+1 )st (φi )st v is a subpath of P st by the v (φi )st , for all i ∈ {1, . . . , l − 1}. Note that each path P u unique shortest path condition, and consider the minimum vertex z (i)st according to permutation π on this subpath: z (i)st := arg min{π(z) : z ∈ P st ∧u(φi+1 )st ≤ z ≤ v (φi )st }. Note that z (0)st = s, z (l)st = t, and for all i ∈ {0, . . . , l − 1}, we have: u(φi+1 )st ≤ z (i)st ≤ v (φi )st ≤ u(φi+2 )st ≤ z (i+1)st ≤ v (φi+1 )st . We have {u(φi+1 )st , v (φi+1 )st } ∈ H ′ , and moreover z (i)st is a prefix minimum with respect to (φi+1 )st (φi+1 )st (φi+1 )st v π on P u (for the subpath P u v (φi )st ), whereas z (i+1)st is a prefix maximum (φi+1 )st (φi+1 )st (φi+2 )st v with respect to π on P u (for the subpath P u v (φi+1 )st ). It follows from the definition of H ′′ that {z (i)st , z (i+1)st } ∈ H ′′ . Recalling that z (i)st ≤st z (i+1)st , z (0)st = s and z (l)st = t for some l ≤ h, the claim follows from the existence of the path (z (0)st , z (1)st , . . . , z (l)st . The rest of the proof of correctness is devoted to showing that the event “v (h)st = t” holds with high probability. We have the following claim. Lemma 5.  Pr  X xuv > u,v∈P st : u≤v(i)st , v>v(i+1)st  1  < n−4 . 2h Proof. Denote the probability from the claim by p. Conditioned on the choice of v (1)st , . . . , v (i)st , at the beginning of step i, let w be the right-most (largest) vertex on path P st such that X xuv > u,v∈P st : u≤v(i)st , v>w 1 . 2h Directly by the definition of v (i+1)st , we have: h i p = Pr[v (i+1)st ≤ w] = Pr ∀u,v∈P st : u≤v(i)st , v>w x′ui vi+1 = 0 = ≤ Y  (1 − Cxuv ) ≤ exp − u,v∈P st : u≤v(i)st , v>w X u,v∈P st : u≤v(i)st , v>w Y max{0, 1 − Cxuv } u,v∈P st : u≤v(i)st , v>w  Cxuv  < e−C/2h = n−4 . We now consider the graph H st inferred from the (not necessarily integral) solution to the (i)st LP, given on vertex set V as the set of edges uv, such that fuv > 0 for some i. Each step i = 0, 1, . . . , h − 1 of the considered process of random choice determines the following s0 − th -flow F (i+1)st on an edge-weighted version of graph H st , described by its flow (i+1)st value fuj vj+1 on each arc (uj , vj+1 ) of H st as follows. F (i+1)st is set as a maximum s0 − th flow (with ties broken deterministically in an arbitrary manner) in an edge-weighting of H st such (i)st that the capacity of arc (uj , vj+1 ) is fuj vj+1 , for all arcs of H st , except for arcs (ui , vi+1 ) with 16 (0)st v > v (i+1)st , whose capacity is set to 0. By convention, we denote fuj vj+1 := fustj vj+1 , i.e., as the flow value on the considered arc in the optimal solution to the LP. Denote by |F (i)st | the value of flow F (i)st . The following claim holds. Lemma 6. Pr[|F (i+1)st | ≥ |F (i)st | − 1 2h ] ≥ 1 − n−4 . (i+1)st Proof. We note that for any u, v ∈ P st such that u > v (i)st we have fui vi+1 = 0, since in the P (i)st i-th step of the considered process, the in-capacity of vertex ui is given as w∈P st fwi−1 ui = 0 by the definition of the (i − 1)-st step of the process. (i)st Moreover, for any arc (uj , vj+1 ) of H st , the values fuj vj+1 are clearly non-increasing with i, thus in particular: fu(i)st ≤ fu(i−1)st ≤ . . . ≤ fu(0)st ≤ xuv . j vj+1 j vj+1 j vj+1 Combining the two above observations, by comparing the size of any two cuts in graph H st for its weightings in successive steps and taking into account the above observations, we obtain the following expression which is used to lower-bound |F (i+1)st |: X X |F (i)st | − |F (i+1)st | ≤ fu(i)st = fu(i)st i vi+1 i vi+1 u,v∈P st : u≤v(i)st , v>v(i+1)st u,v∈P st : v>v(i+1)st ≤ X xuv u,v∈P st : u≤v(i)st , v>v(i+1)st Thus, applying Lemma 5 we obtain the claim. Lemma 7. Pr[v (h)st = t] ≥ 1 − n−3 . Proof. First note that if v (h)st 6= t, then v (h)st < t, and it follows that |F (h)st | = 0 because all the capacities of arcs entering node th are equal to 0 by definition in the graph in which flow F (h)st is considered. Now, observe that using Lemma 6 and applying a union bound over i, we obtain: Pr[|F (h)st | ≥ h (0)st ] ≥ 1 − hn−4 ≥ 1 − n−3 . Observe next that F (0)st ≥ 1 by the constraints of the LP F − 2h solution, hence |F (h)st | is strictly positive with probability at least 1 − n−3 . Applying a union bound over all pairs s, t ∈ V , we obtain Pr[∀s,t∈V v (h)st = t] ≥ 1 − n−1 . The correctness of the scheme with probability 1 − n−1 follows directly from Lemma 4. We remark that the above Proposition implies that the h-hopset problem can be efficiently approximated by finding an optimal fractional LP solution and constructing set H ′′ . Theorem 4. There exists a randomized polynomial-time O(poly log n)-approximation algorithm for the h-hopset problem in unique shortest path graphs, for any h ≤ O(poly log n). 5.3 Approximating Average Query Time for 3-Hopsets In order to design an efficient distance oracle based on 3-hopsets, we follow the framework described in the preliminaries and use an LP-rounding technique to obtain sets H1 ∪ H2 =: H. The obtained claim relies on the notion of uniform-average query time introduced in the Preliminaries. Theorem 5. For any feasible bound S, let HOP T,S be a 3-hopset for a unique shortest path graph, which satisfies the given bound on the number of edges |HOP T,S | ≤ S and such that the uniformaverage query time T (HOP T,S ) is minimized. Then, there exists a randomized polynomial-time algorithm which finds a 3-hopset H with |H ′′ | ≤ O(log3 n)S and T (H ′′ ) ≤ O(log4 n)T (HOP T,S ). 17 Proof. In this case, for the ILP statement we associate with each edge uv a binary indicator (1) variable xuv ∈ {0, 1} stating if uv ∈ H1 , and a second indicator variable xuv ∈ {0, 1}, with (1) xuv ≥ xuv , stating if uv ∈ H1 ∪ H2 . The problem of minimizing the query time of the oracle with size bound S for uniform node-pair query frequencies is now given as (compare with (5)– (8)): Minimize: X x(1) uv (9) u6=v,{u,v}∈E / Subject to: X u6=v,{u,v}∈E / xuv ≤ S 0 ≤ fusti vj X ui fvstj ui − X ui fusti vj (10)  (1)  xuv , if 2 6= j = i + 1 and dG (s, u) + dG (u, v) + dG (v, t) = dG (s, t), ≤ xuv , if 2 = j = i + 1 and dG (s, u) + dG (u, v) + dG (v, t) = dG (s, t),   0, otherwise. (11)   for vj ∈ Vh \ {s0 , th } 0, , (12) = +1, for vj = s0   −1, for vj = th (1) and its LP relaxation on variables xuv , xuv takes the form of the constraint: 0 ≤ x(1) uv ≤ xuv ≤ 1, where as usual indices s, t, u, v traverse V and indices i, j traverse {0, 1, 2, 3}. The construction of the integral hopset H ′′ based on the LP solution takes place as in the previous Subsection (for the case of h = 3), with the exception that for the first and last (1) (third) hop, variables xuv should be used in place of xuv in the construction. By an analogue of Proposition 3, we have |H ′′ | = O(S log3 n), with high probability. We consider the natural decomposition H ′′ := H1′′ ∪ H2′′ according to the number of the used hop along the path, and obtain by a similar (straightforward) concentration analysis that for all u ∈ V : X x(1) degH1′′ (u) ≤ O(log2 n) uv . v∈V and so, computing the sum of degrees over all u: |H1′′ | ≤ O(log2 n) X x(1) uv . v∈V Noting that the sum on the right-hand side is precisely the minimization criterion in the LP formulation (9), we obtain the claim of the theorem. We remark that the above Theorem can be directly generalized to a notion of average query time for non-uniform query densities, in which the goal is to minimize expected query time in a model in which each node v ∈ V is assigned its relative frequency fv ∈ [0, 1], and a node pair uv is queried with frequency fu fv . 18 References [1] Amir Abboud, Greg Bodwin, and Seth Pettie. A hierarchy of lower bounds for sublinear additive spanners. In Klein [34], pages 568–576. [2] Ittai Abraham, Daniel Delling, Amos Fiat, Andrew Goldberg, and Renato Werneck. Highway dimension and provably efficient shortest path algorithms. Technical report, September 2013. [3] Ittai Abraham, Daniel Delling, Amos Fiat, Andrew V. Goldberg, and Renato F. Werneck. VC-dimension and shortest path algorithms. In ICALP, volume 6755 of Lecture Notes in Computer Science, pages 690–699. Springer, 2011. [4] Ittai Abraham, Daniel Delling, Amos Fiat, Andrew V. Goldberg, and Renato F. Werneck. Highway dimension and provably efficient shortest path algorithms. J. ACM, 63(5):41:1– 41:26, 2016. [5] Ittai Abraham, Amos Fiat, Andrew V. Goldberg, and Renato F. Werneck. Highway dimension, shortest paths, and provably efficient algorithms. In Moses Charikar, editor, Proceedings of the Twenty-First Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2010, Austin, Texas, USA, January 17-19, 2010, pages 782–793. SIAM, 2010. [6] Takuya Akiba, Yoichi Iwata, and Yuichi Yoshida. Dynamic and historical shortest-path distance queries on large evolving networks by pruned landmark labeling. In Chin-Wan Chung, Andrei Z. Broder, Kyuseok Shim, and Torsten Suel, editors, 23rd International World Wide Web Conference, WWW ’14, Seoul, Republic of Korea, April 7-11, 2014, pages 237–248. ACM, 2014. [7] Noga Alon and Baruch Schieber. Optimal preprocessing for answering on-line product queries. Technical Report 71/87, Tel Aviv University, 1987. [8] Stephen Alstrup, Søren Dahlgaard, Mathias Bæk Tejs Knudsen, and Ely Porat. Sublinear distance labeling. In Piotr Sankowski and Christos D. Zaroliagis, editors, 24th Annual European Symposium on Algorithms, ESA 2016, August 22-24, 2016, Aarhus, Denmark, volume 57 of LIPIcs, pages 5:1–5:15. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2016. [9] Haris Angelidakis, Yury Makarychev, and Vsevolod Oparin. Algorithmic and hardness results for the hub labeling problem. In Philip N. Klein, editor, Proceedings of the TwentyEighth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2017, Barcelona, Spain, Hotel Porta Fira, January 16-19, pages 1442–1461. SIAM, 2017. [10] Srinivasa Rao Arikati, Danny Z. Chen, L. Paul Chew, Gautam Das, Michiel H. M. Smid, and Christos D. Zaroliagis. Planar spanners and approximate shortest path queries among obstacles in the plane. In Josep Díaz and Maria J. Serna, editors, Algorithms - ESA ’96, Fourth Annual European Symposium, Barcelona, Spain, September 25-27, 1996, Proceedings, volume 1136 of Lecture Notes in Computer Science, pages 514–528. Springer, 1996. [11] H. Bast, Stefan Funke, and Domagoj Matijevic. Ultrafast shortest-path queries via transit nodes. In Camil Demetrescu, Andrew V. Goldberg, and David S. Johnson, editors, The Shortest Path Problem, Proceedings of a DIMACS Workshop, Piscataway, New Jersey, USA, November 13-14, 2006, volume 74 of DIMACS Series in Discrete Mathematics and Theoretical Computer Science, pages 175–192. DIMACS/AMS, 2006. 19 [12] Arnab Bhattacharyya, Elena Grigorescu, Kyomin Jung, Sofya Raskhodnikova, and David P. Woodruff. Transitive-closure spanners. SIAM J. Comput., 41(6):1380–1425, 2012. [13] Hans L. Bodlaender, Gerard Tel, and Nicola Santoro. Trade-offs in non-reversing diameter. Nord. J. Comput., 1(1):111–134, 1994. [14] Sergio Cabello. Many distances in planar graphs. Algorithmica, 62(1-2):361–381, 2012. [15] Shiva Chaudhuri and Christos D. Zaroliagis. Shortest paths in digraphs of small treewidth. part I: sequential algorithms. Algorithmica, 27(3):212–226, 2000. [16] Bernard Chazelle. Computing on a free tree via complexity-preserving mappings. Algorithmica, 2:337–361, 1987. [17] Shiri Chechik. Approximate distance oracles with constant query time. In David B. Shmoys, editor, Symposium on Theory of Computing, STOC 2014, New York, NY, USA, May 31 June 03, 2014, pages 654–663. ACM, 2014. [18] Danny Z. Chen and Jinhui Xu. Shortest path queries in planar graphs. In F. Frances Yao and Eugene M. Luks, editors, Proceedings of the Thirty-Second Annual ACM Symposium on Theory of Computing, May 21-23, 2000, Portland, OR, USA, pages 469–478. ACM, 2000. [19] Edith Cohen. Using selective path-doubling for parallel shortest-path computations. J. Algorithms, 22(1):30–56, 1997. [20] Edith Cohen. Polylog-time and near-linear work approximation scheme for undirected shortest paths. J. ACM, 47(1):132–166, 2000. [21] Edith Cohen, Eran Halperin, Haim Kaplan, and Uri Zwick. Reachability and distance queries via 2-hop labels. SIAM J. Comput., 32(5):1338–1355, May 2003. [22] Vincent Cohen-Addad, Søren Dahlgaard, and Christian Wulff-Nilsen. Fast and compact exact distance oracle for planar graphs. In Chris Umans, editor, 58th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2017, Berkeley, CA, USA, October 15-17, 2017, pages 962–973. IEEE Computer Society, 2017. [23] Daniel Delling, Andrew V. Goldberg, Thomas Pajor, and Renato F. Werneck. Robust distance queries on massive networks. In Andreas S. Schulz and Dorothea Wagner, editors, Algorithms - ESA 2014 - 22th Annual European Symposium, Wroclaw, Poland, September 8-10, 2014. Proceedings, volume 8737 of Lecture Notes in Computer Science, pages 321–333. Springer, 2014. [24] Hristo Djidjev. On-line algorithms for shortest path problems on planar digraphs. In Fabrizio d’Amore, Paolo Giulio Franciosa, and Alberto Marchetti-Spaccamela, editors, Graph-Theoretic Concepts in Computer Science, 22nd International Workshop, WG ’96, Cadenabbia (Como), Italy, June 12-14, 1996, Proceedings, volume 1197 of Lecture Notes in Computer Science, pages 151–165. Springer, 1996. [25] Michael Elkin and Ofer Neiman. Hopsets with constant hopbound, and applications to approximate shortest paths. In Irit Dinur, editor, IEEE 57th Annual Symposium on Foundations of Computer Science, FOCS 2016, 9-11 October 2016, Hyatt Regency, New Brunswick, New Jersey, USA, pages 128–137. IEEE Computer Society, 2016. [26] Jittat Fakcharoenphol and Satish Rao. Planar graphs, negative weight edges, shortest paths, and near linear time. J. Comput. Syst. Sci., 72(5):868–889, 2006. 20 [27] Arash Farzan and Shahin Kamali. Compact navigation and distance oracles for graphs with small treewidth. Algorithmica, 69(1):92–116, 2014. [28] Cyril Gavoille, David Peleg, Stéphane Pérennes, and Ran Raz. Distance labeling in graphs. J. Algorithms, 53(1):85–112, October 2004. [29] Pawel Gawrychowski, Adrian Kosowski, and Przemyslaw Uznanski. Sublinear-space distance labeling using hubs. In Cyril Gavoille and David Ilcinkas, editors, Distributed Computing - 30th International Symposium, DISC 2016, Paris, France, September 27-29, 2016. Proceedings, volume 9888 of Lecture Notes in Computer Science, pages 230–242. Springer, 2016. [30] Pawel Gawrychowski, Shay Mozes, Oren Weimann, and Christian Wulff-Nilsen. Better tradeoffs for exact distance oracles in planar graphs. In Artur Czumaj, editor, Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2018, New Orleans, LA, USA, January 7-10, 2018, pages 515–529. SIAM, 2018. [31] Robert Geisberger, Peter Sanders, Dominik Schultes, and Daniel Delling. Contraction hierarchies: Faster and simpler hierarchical routing in road networks. In Catherine C. McGeoch, editor, Experimental Algorithms, 7th International Workshop, WEA 2008, Provincetown, MA, USA, May 30-June 1, 2008, Proceedings, volume 5038 of Lecture Notes in Computer Science, pages 319–333. Springer, 2008. [32] Andrew V. Goldberg, Haim Kaplan, and Renato F. Werneck. Reach for A*: Efficient point-to-point shortest path algorithms. In ALENEX, pages 129–143. SIAM, 2006. [33] Ronald J. Gutman. Reach-based routing: A new approach to shortest path algorithms optimized for road networks. In ALENEX/ANALCO, pages 100–111. SIAM, 2004. [34] Philip N. Klein, editor. Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2017, Barcelona, Spain, Hotel Porta Fira, January 16-19. SIAM, 2017. [35] Philip N. Klein and Sairam Subramanian. A randomized parallel algorithm for single-source shortest paths. J. Algorithms, 25(2):205–220, 1997. [36] Adrian Kosowski and Laurent Viennot. Beyond highway dimension: Small distance labels using tree skeletons. In Klein [34], pages 1462–1478. [37] David Peleg and Alejandro A. Schäffer. Graph spanners. Journal of Graph Theory, 13(1):99– 116, 1989. [38] Prabhakar Raghavan and Clark D. Thompson. Randomized rounding: a technique for provably good algorithms and algorithmic proofs. Combinatorica, 7(4):365–374, 1987. [39] Hanmao Shi and Thomas H. Spencer. Time-work tradeoffs of the single-source shortest paths problem. J. Algorithms, 30(1):19–32, 1999. [40] Mikkel Thorup. Shortcutting planar digraphs. Combinatorics, Probability & Computing, 4:287–315, 1995. [41] Mikkel Thorup. Parallel shortcutting of rooted trees. J. Algorithms, 23(1):139–159, 1997. [42] Jeffrey D. Ullman and Mihalis Yannakakis. High-probability parallel transitive closure algorithms. In SPAA, pages 200–209, 1990. 21
8cs.DS
Network Filtering for Big Data: Triangulated Maximally Filtered Graph Guido Previde Massara1 , T. Di Matteo2 Tomaso Aste1,3 1 arXiv:1505.02445v2 [cs.DS] 25 Aug 2015 3 Department of Computer Science, University College London, Gower Street, London, WC1E 6BT, UK 2 Department of Mathematics, King’s College London, The Strand, London, WC2R 2LS, UK Systemic Risk Centre, London School of Economics and Political Sciences, London, WC2A2AE, UK (Dated: 16/07/15) We propose a network-filtering method, the Triangulated Maximally Filtered Graph (TMFG), that provides an approximate solution to the Weighted Maximal Planar Graph problem. The underlying idea of TMFG consists in building a triangulation that maximizes a score function associated with the amount of information retained by the network. TMFG uses as weights any arbitrary similarity measure to arrange data into a meaningful network structure that can be used for clustering, community detection and modeling. The method is fast, adaptable and scalable to very large datasets, it allows online updating and learning as new data can be inserted and deleted with combinations of local and non-local moves. TMFG permits readjustments of the network in consequence of changes in the strength of the similarity measure. The method is based on local topological moves and can therefore take advantage of parallel and GPUs computing. We discuss how this network-filtering method can be used intuitively and efficiently for big data studies and its significance from an information-theoretic perspective. Keywords: TMFG, Big Data, Network Filtering, PMFG, Planarization algorithms, Correlation Network, Markov Random Fields, Weighted Maximal Planar Graph (WMPG) I. INTRODUCTION We are witnessing interesting times rich of information, readily available for us all. Using, understanding and filtering such information has become a major activity across science, industry and society at large. Our society has become a global information processing system where news propagate and impact on individuals and the economy at increasingly fast rates with increasingly large effects. It is therefore important to have tools that can analyse this information while it is generated and that can provide ways to reduce complexity and dimensionality while keeping the integrity of the dataset. Information content and flow are often associated with large degrees of redundancy both in time (repeating and scaling patterns) and across different variables (similarity, dependency and causality). Redundancy is often used to convey strength to the meaning or, more simply, it is the signal of recurring patterns with high statistical significance and therefore important. In this paper we propose to use such redundancy to build an informationbased network that retains the relevant part of the data-interdependency structure. The structure of this network is a representation of the information in the dataset and such information can be efficiently analysed by using network-theoretic tools. The idea of using redundancy – mostly correlation coefficients – to filter information in complex datasets by building sparse networks retaining relevant edges only has been very actively studied in the literature mostly by means of two approaches: i) the minimum spanning tree (MST) [1, 2]; ii) the planar maximally filtered graph (PMFG) [3–5]. The common idea underneath these two approaches is to filter a dense matrix of weights by retaining the largest and most significant possible subgraph while imposing global constraints on the topology of the resulting network. In particular, in the MST approach edges with the largest weights (e.g. correlations) are retained while constraining the subgraph to be globally a (spanning) tree. Similarly, in the PMFG construction the largest weights (e.g. largest correlation coefficients) are retained while constraining the subgraph to be globally a planar graph (see [2–4]). Both the MST and 2 the PMFG are particular cases of simplicial complexes; our proposed method can be extended to more general simplicial complexes with different constraints (for instance on the topological genus, or on the size of the largest complete subgraph – or clique). The PMFG is a greedy solution of the Weighted Maximum Planar Graph (WMPG) problem: given a complete edge-weighted graph find a planar subgraph which is maximal (i.e. no edge can be added without destroying planarity) and such that the sum of the edge weights is maximum. The problem is known to be NP-complete (see [6] for a proof and [7] for a review), but algorithms providing sub-optimal solutions are known. For instance, an approximation algorithm with a guaranteed performance ratio of 83 for complete graphs is discussed in [8]. The PMFG has a richer information content than the MST with a larger number of edges (the PMFG has 3p−6 edges, while the MST has p−1, where p is the number of vertices) and contains of 3- and 4-cliques. However, the network is still sparse, filtering 3p − 6 edges out of p(p − 1)/2 of the complete graph Kp which is associated with the original dense matrix of weights. Planar filtered graphs are powerful tools to study complex datasets. It has been shown in [9] that by making use of the 3-clique structure of the PMFG a clustering structure can be extracted allowing dimensionality reduction that keeps both local information and global hierarchy in a deterministic manner without the use of any prior information. Applications of Planar filtered graphs to financial data-sets can meaningfully identify industrial activities and structural market changes [10, 11]. Planar filtered graphs can be used to diversify financial risk by building a welldiversified portfolio that effectively reduces risk by investing in stocks that occupy peripheral regions of the graph [12]. Planarity ensures easy visualization of the network with the possibility to draw the network without edge-crossing. Another appealing advantage of planar filtered networks concerns graphical modeling (e.g. Markov Random Fields [13]) where planarity (which limits the treewidth of the junction tree of the filtered graph) grants that some exact inference algorithms can be performed in an efficient fashion (see [14, 15]). However, the algorithm so far proposed to construct the PMFG is computationally costly and cannot be applied to large datasets. There is therefore scope to search for novel algorithms that can construct planar filtered graphs in a computationally efficient way. In the present paper we indeed introduce a computationally efficient algorithm, the TMFG, that produces planar filtered graphs by optimizing an objective function (which we shall call “score function”) by using local topological moves called T1 and T2 [16], the ‘Alexander move’ A [17], in conjunction with a ‘vertex-swap’ operator S. The TMFG algorithm has also the advantage of allowing ‘online’ updates of the planar graphs. Furthermore, the TMFG can be naturally applied to multipoint dependency measures associated with the 3- and 4-clique structure. When only T2 and S operators are used the algorithm produces triangulated (or chordal) graphs together with their structure of cliques and separators. Chordal graphs have appealing properties: on the one side they are very well suited to modelling with Markov Random Fields (MRF) since they have a closed-form solution for the Maximum Likelihood Estimate (see [18, 19]) of the joint probability, on the other side chordal graphs are perfect graphs and as such are known to have polynomial time solutions for problems that are otherwise harder (e.g. graph coloring problem, maximum clique problem, and maximum independent set problem, see [20]). Graphical models with a chordal underlying graph have a particularly useful representation of the joint probability distribution and a closed form solution for the Maximum Likelihood Estimate (MLE). In the case of Gaussian graphical models the structure of the graph represents partial correlations between variables and the non-zero entries of the concentration matrix (the inverse of the covariance matrix also called precision matrix [18, 21, 22]) coincide with the edges of the graph. Additionally, the algorithm has the advantage that it is not restricted to planar topologies allowing higher-genus hyperbolic embeddings to be explored [16, 23–25]. Finally, given its local nature, the algorithm is ideally suited for parallelisation and GPU computing. This paper is organized as follows. In section II we discuss some facts about Planar Maximally Filtered Graphs describing two algorithms used to generate such graphs; in section III we 3 introduce the TMFG algorithm and we highlight some characteristics of the algorithm that are relevant to applications with high-dimensional, frequently-updated datasets; in section IV we offer some information-theoretic perspectives on the selection of a particular score function; finally in section V we apply TMFG to several weight distributions showing that it is computationally faster than PMFG achieving comparable or better results. II. PLANAR MAXIMALLY FILTERED GRAPHS Algorithms for the extraction of planar subgraphs from dense networks are relevant in several domains such as, for instance: i) the analysis of financial data – where nodes generally represent financial assets (such as stock prices, spreads, liabilities, risk or liquidity indicators etc.) and the edges represent correlations or other measures of dependence between them (see [3, 4, 12, 26]); ii) facilities layout – where nodes represent the facilities and the edges the affinities between them (see [27–29] for a survey); iii) integrated circuit design – where nodes are the electrical elements and connections are the physical connections (see [30]); iv) systems biology – where nodes can represent proteins and edges protein interactions in a metabolic network (see [31]); v) social systems – where nodes represent social agents (e.g. individuals, companies, groups) and edges represent social interaction (see [32] for a detailed overview). In some domains – such as facility layout or integrated circuit design – the constraint of planarity is a direct consequence of the two dimensional planar geometry of the problem, while in other domains, network planarity is a way to constraint the complexity of the graph reducing the degree of interwovenness [3]. Planarity is also desirable because many NP-hard problems have efficient polynomial-time solutions, or better approximations, for planar graphs (vertex coloring, edge coloring, independent vertex set, multicommodity flows, see [33] for an introduction). Let us here briefly review two known algorithms that have been used to construct planar filtered networks from a matrix of weights: • PMFG [4]; • Deltahedron heuristics and subsequent improvement [7, 28, 29]. These algorithms provide estimates for optimal solutions to the Maximum Weighted Planar Graph problem. Let us here recall that, given a complete edge-weighted graph G(V, E), with vertex set V and edge set E, the Maximum Weighted Planar Graph problem requires to build a planar subgraph G0 (V, E 0 ), with E 0 ⊂ E such that adding another edge e ∈ E \ E 0 would cause G(V, E 0 ∪ e) to be non planar and such that the sum of the weights is maximum (see [29] and [7] for a detailed description of the problems and a survey). A. Planar Maximally Filtered Graph The PMFG algorithm [3] searches for the maximum weighted planar subgraph by adding edges one by one (see [5]). The resulting matrix is sparse, with 3(p − 2) edges. The algorithm starts by sorting by weighting all the edges of a dense matrix of weights in non increasing order and tries to insert every edge in the PMFG in that order. Edges that violate the planarity constraint are discarded. The most computationally intense part of the algorithm is the planarity test, which is performed every time an edge insertion is attempted. It results that the PMFG construction performs an order of p2 (O(p2 )) planarity tests on any dense p×p matrix of weights W . Assuming that the complexity for a planarity test in O(p) (see [34, 35]) the computational complexity of the whole algorithm results in a O(p3 ) [9]. 4 v1 v1 T2 v4 T2−1 v2 v3 v2 v3 FIG. 1: T2 move: addition of one vertex within a triangular face [16, 23, 24, 38, 39]. Its inverse, T2−1 , removes a vertex from inside a three-clique (in this case the clique {v1 , v2 , v3 }). B. Deltahedron heuristic The deltahedron heuristic [28, 29] searches for approximate solutions of the WMPG problem starting from a tetrahedron, K4 , which is planar. Then, at each step a vertex is added into a triangular face and three edges are added connecting the newly inserted vertex to the vertices of the triangular face. This vertex insertion in a triangular face is called T2 move (see Fig.1 and [16, 23, 24, 38, 39]). It is easy to see that the T2 operator acts without breaking planarity ensuring that the final network is planar. The triangular face is chosen in order to maximise the sum of the newly connected edges, while the vertices to be inserted are extracted from a pre-sorted list. The vertex list can be sorted according to two functions of the edge weights incident to the vertex, yielding two possible variants of the deltahedron heuristic:(i) the sum of the incident edge-weights or (ii) the maximum incident edge-weight. Different weightings lead to different ordering for the vertices and different results. The deltahedron heuristic algorithm is not “greedy”, for edge-insertion protocol, since the choice of the ordering of the vertices is done once at the beginning and there is no subsequent attempt at optimising the order of the vertices taking into account the local configuration and there is no known performance guarantee. However the algorithm is considerably faster than the PMFG, since every T2 move keeps the planarity of the graph and therefore there is no need to test for planarity at each stage. An important feature of the graphs produced by T2 moves is that they are chordal graphs: every cycle of length greater than 4 has a chord, an edge not belonging to the cycle that joins two non-adjacent vertices. Chordal graphs are perfect graphs and as such there are polynomial time algorithms for solving generally hard problems such as finding a maximum clique, graph coloring, and maximum independent set. In [7, 40] the deltahedron heuristic is improved by keeping a data structure of the most effective ways of inserting a vertex inside the faces (Green and Al-Hakim heuristic – the GH-heuristic henceforth), essentially keeping a cache of the best and next-to-best options for inserting any of the remaining vertices. The cache is updated as the algorithm progresses. Optionally Osman et al. [7] allow for a parameter that governs the“greediness” of the algorithm. In section III we will introduce a modified version of the GH-heuristic algorithm. 5 v1 v1 v6 v5 v4 v2 v3 v2 v3 FIG. 2: Addition of three vertices in Leung’s extension of the deltahedron heuristic. v1 v1 T1 v2 v4 v3 v2 v4 v3 FIG. 3: T1 move: rewiring of a shared edge between neighboring triangular faces. C. Local topological moves: T1 , T2 , A, & S With the deltahedron heuristic we have already introduced the T2 move that, as shown in Fig.1, inserts vertex v4 into the triangular face {v1 , v2 , v3 } spliting it into three triangular faces {v1 , v2 , v4 }, {v1 , v4 , v3 }, and {v4 , v2 , v3 }. In the following we will call face a three-clique that does not contain any vertex in the given embedding, reserving the word triangle for a generic cycle of length 3. We see that, after the T2 move, {v1 , v2 , v3 } is no longer a face but rather a 3-clique. In an extension of the deltahedron heuristic method, suggested by Leung [41], vertex insertion can happen either one vertex at a time (the T2 move, as in Fig.1) or three vertices at a time as in Fig.2. This corresponds to the insertion of an octahedron within a triangular face [25]; clearly this is different from the T2 move that instead corresponds to the insertion of a tetrahedron. However, such a move can be obtained by combining T2 with another local move, called T1 [16, 23, 24, 38], consisting in switching neighbors among two adjacent triangles, as shown in Fig.3. In general, any local topological change of a surface triangulation that preserves embedding and results in a triangulation can be realized through the combination of the two elementary moves T1 and T2 [17]. However it should be pointed out that the application of T1 could cause the graph to become no longer chordal. For instance, the Leung extension (Fig.2) can be produced via two T2 and one T1 , as demonstrated in Fig.4. 6 v1 v1 T2 v5 v4 v4 v2 v3 v2 v3 v1 v1 T2 T1 v5 v4 v4 v5 v6 v6 v2 v3 v2 v3 FIG. 4: Demonstration that the Leung’s extension in Fig.2 can be generated by using two T2 and one T1 moves. v1 v1 A v2 v4 v2 v5 v4 −1 A v3 v3 FIG. 5: A move: insertion of a vertex inside a plaquette made of two neighbouring triangular faces. Another move that we will use to build planar graphs is the A move as described in Fig.5. Also in this case the move can be produced combining T1 and T2 and leads to non-chordal graphs. Finally, we will use the ‘swap’ operator, S, that re-labels sub sets of vertices of a graph as shown in Fig.6, where it is acting on the vertices of a 4-simplex. This operation is trivial when the weights are identical, but will in general affect aggregate functions of the weights in a nontrivial way. The peculiarity of this operator is that it doesn’t have to operate locally and it keeps topology unchanged preserving therefore planarity. In the following section we shall see how T2 , T1 , A and S moves can be used to generate planar filtered graphs as well as higher genus, non-planar, filtered graphs. 7 v1 v1 S v4 v3 v2 v3 v4 v2 FIG. 6: S move: relabelling of the vertices of a 4-simplex. Note that the topology of the graph is unchanged. III. TRIANGULATED MAXIMALLY FILTERED GRAPH A. TMFG construction TMFG algorithm starts from a clique of order 4 (K4 ) and adds vertices by using the local move T2 . The novelty is that, at each step, the algorithm optimizes a score function (e.g. the sum of the weights of the edges). Similarly to the GH-heuristics, the method does not rely on any particular ordering of the vertices but, at every step, it calculates the score that would be obtained by adding any of the remaining vertices inside any feasible face. T2 is applied to the vertex and face pair that leads to the maximum increase in score. A naive implementation would require to evaluate the gain function for every pair consisting of a feasible vertex and a feasible face, thus resulting in an O(p2 ) calculations at every step and therefore O(p3 ) overall computational complexity. However, it is possible to maintain and update incrementally a cache with the information about the best possible pairing updating only the records affected by a move. Assuming the maximum requires O(p) calculations for p vertices, the overall number of calculations for the score functions is O(p2 ). This results in much faster computational times with respect to the P M F G. Differently from [7] we use a slightly different data structure to keep track of the vertices to insert into the feasible faces. We also keep track of the triangles that are no longer faces because this is relevant for subsequent modelling (see section IV). Let us first focus on T2 moves only. After every application of T2 the cache is updated: some scores that were previously achievable are no longer feasible, while others become feasible and the corresponding score is calculated. More formally, we define a score function S(vh , {va , vb , vc }) that quantifies the gain achievable by adding vertex vh inside the triangle {va , vb , vc }. For instance, for a given, dense, matrix of weights W , the gain function can be the sum of the weights of the edges that will be added by inserting vh in face {va , vb , vc }: S(vh , {va , vb , vc }) = W (vh , va ) + W (vh , vb ) + W (vh , vc ). In the next session we discuss an information theoretic interpretation of the score function. The cache is a structure made up of two vectors (M axGain and BestV ertex) indexed by the faces in the planar graph present up to that point. Let us consider a given stage of the construction with m triangular faces ti , i ∈ {1, 2, · · · , m} and k remaining uninserted vertices v ∈ {v1 · · · vk }. The M axGain vector contains the value of the maximum gain over all remaining vertices for all triangular faces:  MaxGain =  max v∈{v1 ···vk } S(v, t1 ), max v∈{v1 ···vk } S(v, t2 ), . . . max v∈{v1 ···vk } S(v, tm ) . (1) 8 The BestV ertex vector contains inside the list of vertices that attains the maximum gain for the specific triangular face: ! BestVertex = arg max S(v, t1 ), arg max S(v, t2 ), . . . , arg max S(v, tm ) v∈{v1 ···vk } v∈{v1 ···vk } (2) v∈{v1 ···vk } When a vertex (say vertex vh ) is added to a certain triangular face (say face tj ) the two cache vectors must be updated by removing vertex vh from the list of remaining vertices, removing face tj and adding three new faces. It is worth noting that tj becomes a clique separator of the graph [22]. The TMFG pseudocode is shown in Algorithm 1. For simplicity we have not given details of the application of the moves T1 , A and the swap operator S. The TMFG generated by using T2 only is a 4-clique tree. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 input : A dense p × p square matrix W with positive weights (e.g. a matrix of squared correlation coefficients) output: A sparse matrix, P, a filtered version of W fulfilling the planarity constraint C1 ← Tetrahedron, {v1 , v2 , v3 , v4 }, with highest overall total score ; // Assign the four triangular faces in C1 to the array T T ← {{v1 , v2 , v3 } , {v1 , v2 , v4 } , {v1 , v3 , v4 } , {v2 , v3 , v4 }}; // Put the p − 4 vertices not belonging to C1 in the array V V ← {v5 , · · · , vp }; // Create an empty list of Separators S←∅; // Assign the first tetrahedron to the list of cliques C ← C1 ; P ← W(C1 , C1 ); Calculate M axGain for T and V as in Eq.(1) ; Calculate BestV ertex for T and V as in Eq. (2) ; // Insert p − 4 vertices via T2 while V is not empty do Find the ti ∈ T and vi ∈ V that achieve the maximum in M axGain; Insert vi into ti // this creates three new triangles ta , tb , tc V ← V \ vi ; T ← (T \ {ti }) ∪ {ta , tb , tc }; Si ← {ti }; S ← S ∪ Si ; Ci ← {ti , ta , tb , tc }; C ← C ∪ Ci ; P ← P + W(Ci , Ci ) − W(Si , Si ); Update M axGain and BestV ertex to reflect the changes in T and V; end return P; Algorithm 1: TMFG algorithm The TMFG algorithm can be extended to include T1 and A moves as well. In this case, the moves are local, internal to the plaquette made by two joint triangles (i.e. {v1 , v2 , v3 } and {v2 , v3 , v4 } in Fig.3). The gain function for a T1 move is associated to the removal of an edge (i.e. (v1 , v3 ) in Fig.3) and the simultaneous addition of another edge (i.e. (v2 , v4 ) in Fig.3). Similarly the gain for a move of type A (as shown in Fig.5) results from the removal of one edge and the insertion of a new vertex and four new edges. The use of T1 and A moves generally improve gain; however, we have verified that the algorithm with T2 only produces very similar results. Furthermore, planar filtered graph with T1 or A moves are no longer clique trees but 9 rather bubble-trees [9] which are in general no longer chordal. For instance see Fig.4 where the application of T1 creates a non-chordal graph: the cycle v1 − v2 − v6 − v5 − v1 has length grater than 3 without internal chords. This can have some implications for dependency modeling, as we shall discuss in Section IV. In the following we will therefore consider separately the two cases of TMFG constructed with and without T1 and A. In many cases the application of the swap operator S results in higher overall gains. This operator has the advantage of leaving the overall topology unchanged but its use should be regulated by few local or heuristic criteria to avoid an increase in the complexity of the algorithm due to the increasing number of possible combinations. The case that we have implemented requires the evaluation of all the possible combinations of the four vertices involved in the execution of a T2 operation. This requires some further changes to the cache vectors, but – being applied locally – it does not increase the overall computational complexity that remains O(p2 ). The TMFG algorithm is not greedy with respect to edge insertion in the sense that the best possible move is chosen from a subset of all the feasible edge insertions that preserve planarity. Nonetheless, we shall see that TMFG performs as well as – or better than – the PMFG for a large class of weight matrices, including squared correlation coefficient matrices from empirical time series which are relevant for modeling [42]. B. Dynamical adaptability Due to the local nature of the operators, T1 , T2 , T2−1 , A, A−1 and (local) S, used to construct the TMFG one can continuously modify the network allowing ‘online’ adaptability while new data are generated. This is of practical importance because in real, big data, applications information is changing dynamically with new data continuously fed causing changes in the matrix of weights that require modifications of the filtered graph. Further, creation of new nodes is required when new elements/variables become relevant in the system. Conversely, elements/variables can eventually become irrelevant and the corresponding vertices should be eliminated from the graph. The implementation of these moves requires keeping a cache matrix of gains continuously updated and dynamically checking for moves that improve total gains. C. Parallelization and big data The local nature of TMFG construction and dynamical adaptation through T1 , T2 , T2−1 , A, A−1 and (local) S, moves make it ideal for parallelization. There are several possibilities for parallelization and it is beyond the purpose of the present work to implement a parallel algorithm for TMFG. Let us however discuss briefly a possible parallel implementation of the TMFG. One of the main features of planar triangulations is that three-cliques uniquely divide the network into two ‘inside’ and ‘outside’ subgraphs within a nested hierarchical structure [43]. This means that, given a seed structure of three-cliques, each clique can develop its inside subgraph independently. A processor can be assigned to each seed clique and calculations can be performed locally. Given that each separating clique divides roughly the graph into two parts one can compute the TMFG in O(p) using O(log p) processors. Another issue related to big data is the size of the score vectors. It is clear from the construction that the size of the cache grows linearly with the dimension of the problem and that triangles in the basis can be assigned to different processors, allowing parallel updates of the cache. 10 D. Memory usage In the case of pair-wise dependence (such as correlation) both the deltahedron heuristic and the PMFG require to compute in advance the entire correlation matrix, while the TMFG does not use the full information from the correlation matrix and could calculate only the correlations necessary for the incremental update of the gain vectors. This is an advantage already for correlation measures, in the (numerous) cases where the number of observations (q) is less than the number of variables (p): in fact it could require much less memory (approximately p × q) to store the time series of the observations and calculate the correlations on-demand, rather than calculating and storing a large correlation matrix (approximately p×(p−1) ). This fact is even 2 more relevant for multi-point dependencies (e.g. partial correlation, mutual information, ...): in these cases the TMFG would still require only to store the time series in memory and would require the calculation of the relevant gain functions only, while other methods would require the storage of large amounts of data (e.g. order of p3 for a three-points dependency measure). IV. MODELING WITH TMFG: INFORMATION THEORETIC PERSPECTIVE In complex systems, such as financial markets, a large number of interdependent variables are typically involved. The TMFG is a way of filtering the structure of interrelation between the variables reducing it to a network of most relevant interactions. Modeling the system statistically consists in identifying the joint probability distribution that best describes the observed collective behavior of the variables. Specifically, given a set of observations {x1 (1), ..., x1 (q)}, {x2 (1), ..., x2 (q)}, ... {xp (1), ..., xp (q)} of p random variables X = {X1 , X2 , ..., Xp }, one aims to estimate a joint probability distribution function Q(X) that is the best representation of the ‘true’ multivariate probability distribution function P (X) from which the set of observations are drawn. Clearly, P (X) is unknown and the only information available are the observations {x1 (1), ..., x1 (q)}, {x2 (1), ..., x2 (q)}, ... {xp (1), ..., xp (q)} from which Q(X) must be estimated. Information filtering graphs can be used to compute Q(X). The main advantage is that these graphs are locally low dimensional (e.g. the largest clique is K4 when planarity is enforced) which makes sampling tractable also with limited amount of data [42]. Further, the TMFG constructed from T2 moves results in a tree made of 4-cliques separated by 3-cliques (called separators in the following). This is a particular case of a triangulated or chordal or decomposable graph [22]. From the theory of graphical models (see [18]) we know that the probability distribution function associated to a decomposable graph – such as the TMFG – admits the representation: Q c∈Cliques φc (Xc ) Q(X) = Q . (3) s∈Separators φs (Xs ) Where φc (Xc ) and φs (Xs ) are the marginal probabilities of the sub sets of variables associated respectively with the 4-clique Xc and separator Xs . Eq.3 reduces the p-dimensional problem of estimating the joint probability distribution function Q(X) to the estimation of a set of 3- and 4-dimensional local marginal probabilities φs (Xs ) and φc (Xc ). Such a dimensionally reduction helps greatly in the estimation of the joint probability. The open question is now to measure how well the, unknown, true joint distribution P (X) is represented by the model estimation Q(X) factorized over the TMFG. To this end we can measure the dissimilarity between the two probability density functions which is given by the Kullback-Leibler divergence [44]:   X P (X) DKL (P k Q) = P (X) log ; (4) Q(X) X 11 For simplicity we are considering discrete variables, a similar treatment can be developed for continuous variables. The goal is to construct the TMFG that minimizes such a distance. By substituting Eq.3 into Eq.4 we obtain X DKL (P k Q) = P (X) log (P (X)) (5) X X − X φc (Xc ) log (φc (Xc )) c∈Cliques Xc X + X φs (Xs ) log (φs (Xs )) . s∈Separators Xs From a information theoretic perspective the first term in Eq.5 (with a minus sign), X H=− P (X) log (P (X)) , (6) X quantifies the total amount of uncertainty in the system, measuring the number of bytes (if base-2 logarithms are used) necessary to define a state. The other two terms in Eq.5: X X X X φs (Xs ) log (φs (Xs )) (7) φc (Xc ) log (φc (Xc )) + Hm = − c∈Cliques Xc s∈Separators Xs also quantify an uncertainty, but in this case, associated with the model of the system. In other words, by adopting the TMFG structure of interactions, Hm measures the number of bytes necessary to define the state of the system when only the interrelations among variables associated with edges in the TMFG are considered. An algorithm to construct the TMFG with the aim of minimizing DKL (P k Q) can be implemented by choosing at every stage the move that minimally increases Hm consistently with all other constraints. In particular, considering the TMFG construction via T2 moves, the contribution to DKL (P k Q) from the insertion of a vertex v added inside an existing triangular face t generating a 4-clique u is: X X S(v, t) = φu (Xu ) log (φu (Xu )) − φt (Xt ) log (φt (Xt )) . (8) Xu Xt From an information theoretic perspective −S is the amount of uncertainty introduced in the model by including a variable v, the TMFG structure should be constructed in a way to minimize such uncertainty. In [42] the case for normal multivariate distributions is discussed in details. V. EXAMPLES OF TMFG CONSTRUCTION AND COMPARISON WITH PMFG A vast literature has demonstrated that PMFG can be used to retrieve meaningful information about the structure of interdependency in complex datasets [4, 9–12], it is therefore natural to compare the performances of the TMFG with the ones of the PMFG. Let us first look at the scaling of execution times for TMFG and PMFG algorithms as function of the size p of the weight matrix W ; results are reported in Fig.7 (seconds on a 2.6 GHz Intel Core i7 R ). We observe that TMFG execution times scale with the matrix dimension size p approximately as O(p2 ) while PMFG scales approximately as O(p3 ). The 2-parameters best polynomial fits give respectively: TT M F G ∼ 2 · 10−7 · p2 + 6 · 10−4 p and TP M F G ∼ 2 · 10−6 · p3 + 3 · 10−5 p2 . Overall we can see that execution times are several orders of magnitude faster for TMFG than PMFG. We have then compared the total retained edge weight for the following four variants of the TMFG construction: 12 TMFG T2 PMFG execution time (sec) 10 2 10 1 10 0 10 -1 10 -2 100 1000 10000 Size p FIG. 7: Demonstration that TMFG is faster and scalable with respect to the PMFG. Comparison between execution times for TMFG and PMFG for different values of p ranging between 50 and 10000. Lines are the 2-parameters best polynomial fits (see text). 1. TMFG: the base version of the algorithm. It uses only T2 operators. This version of the algorithm produces chordal graphs. 2. TMFG-T1: uses T2 followed by an optimisation stage where a number of T1 moves are performed after every insertion of a new vertex. 3. TMFG-S: a variant of the basic algorithm with T2 followed by local optimization with S. 4. TMFG-A: a variant of the algorithm with T2 followed by local optimization with T1 and A. We have tested 9 types of random weight matrices W with different weight distributions: 1. Beta distribution with shape parameters α = 0.5 and β = 3. This distribution is heavily skewed and is characterised by very low density on the right side of the interval [0, 1]. 2. Beta distribution with shape parameters α = 3 and β = 0.5. This distribution is skewed in the opposite direction and has a high density near the right extreme of the interval [0, 1]. 3. Pareto distribution with power law exponent equal to 1. This distribution has a fat tail. 4. Pareto distribution with power law exponent equal to 2. This distribution has still a fat tail, but thinner than the previous one. 13 Weight matrix coefficients distribution Beta(0.5,3) Beta(3, 0.5) Pareto(1) Pareto(2) Random Matrix (20 factors) Random Matrix (50 factors) Random Matrix (100 factors) Uniform Real correlation matrix TMFG/ PMFG TMFG-T1/ PMFG TMFG-S/ PMFG TMFG-A/ PMFG TMFG (Time)/ PMFG (Time) 95.42% 104.70% 99.97% 97.94% 102.23% 96.24% 104.73% 99.97% 98.00% 102.63% 95.72% 104.77% 99.97% 98.02% 102.57% 99.89% 104.80% 99.97% 98.32% 103.77% 0.16% 0.14% 0.17% 0.17% 0.22% 100.30% 100.82% 100.64% 102.54% 0.21% 98.46% 99.14% 98.86% 101.42 % 0.21% 116.27% 100.11% 116.29% 100.17% 116.34% 100.24% 116.89% 100.42% 0.15% 0.15% TABLE I: Average relative performances (ratio between sum of edge weights) of the TMFG algorithm with respect to the PMFG. Four TMFG variants and nine different weight distributions. Note that TMFG and TMFG-S are chordal graphs. 5. Random matrix of correlations of 400 time series generated by simulating 20 normally distributed common factors. 6. Random matrix of correlations of 400 time series generated by simulating 50 common factors. This matrix shows less structure than the one generated using 20 factors. 7. Random matrix of correlations of 400 time series generated by simulating 100 common factors. This matrix shows less structure than the two above. 8. Uniform distribution over [0, 1]. 9. Square of a real correlation matrix coefficients computed from daily log-returns of 342 US stocks, across a period of 15 years (form Jan 1997 to Jul 2012) (see [10]). All matrices are symmetric and have size p = 400 except the real correlation data that have sizes p = 342. For all the weight matrices (excepting for the real correlation matrix) we have compared results for 100 samples. For the real correlation matrices we generated matrices by random sampling the starting point of 100 time windows of length 1000 data points over a period of 4500 points in total. Table I reports the average relative performance, defined as the ration between the sum of the edge weight in the the four variants of TMFG with respect to the sum of the edge weight in the PMFG. It shows that the PMFG is usually more effective when the density of high weights is low, while the TMFG is more effective when the density of high weights is higher or limited. This result is to be expected since the PMFG is less constrained than the TMFG in picking up isolated high-weight edges one at a time, while the TMFG is more efficient in selecting subsets of edges with a high total sum. For the random matrices of correlation we see that the TMFG performs better than the PMFG in filtering the more structured matrix generated using 20 factors. In the real case we see that the TMFG is marginally better than the PMFG. We conclude that TMFG is in general performing comparably well, and sometimes better than the PMFG.We observe that the TMFG tends to improve relative performance as the size of the matrix increases (see Table II). When other moves are used TMFG improves performances with best performances obtained by the TMFG-A variant. 14 TMFG Weight matrix size /PMFG p 88.68% 50 90.49% 100 92.14% 150 93.73% 300 96.36% 500 98.83% 700 98.93% 850 100.33% 1000 101.34% 1200 TMFG-T1 /PMFG TMFG-S /PMFG TMFG-A /PMFG 88.82% 93.13% 93.77% 95.6% 96.79% 100.49% 99.95% 100.56% 102.16% 89.35% 92.31% 90.44% 94.63% 96.6% 98.92% 99.99% 100.71% 101.16% 95.93% 98.14% 95.26% 100.06% 100.98% 103.58% 103.83% 105.39% 105.24% TABLE II: Example of relative increase in performance of the TMFG algorithm with respect to PMFG when dimensionality p increases. The underlying distribution is a Beta(0.5, 3). VI. CONCLUSIONS We have described a new family of algorithms, TMFG, to retrieve approximate solutions to the Maximal Planar Graph problem, which have the following desirable characteristics: 1. TMFG is faster than PMFG with execution times increase as the square of the weight matrix size p, while PMFG increases with the third power of p. 2. TMFG constructed with T2 and S only produces chordal graphs. This opens the door to the use of Markov Random Fields as a modelling tool. The fact that the maximum dimension of cliques is controlled by the topology entails that efficient inference algorithms can be used. 3. From TMFG construction the structure of cliques and separators is automatically retrieved. 4. The local nature of the TMFG construction allows one to model dependence using genuinely multivariate score functions over the clique elements such as Mutual Information, Total Correlation, Partial Correlation, Likelihood functions etc. (as opposed to bivariate functions such as correlation). 5. TMFG does not require preliminary calculation and sorting of all the values of the score function. In cases when the distribution is based on 3 or more variables this constraint is severe. 6. In cases where p  q the memory footprint of the algorithm can be reduced by keeping the p × q data points in memory and calculating the dependence function on-demand, instead of the p2 values of a correlation matrix or the pd values of a d−variate dependence function. 7. The use of local and non-local operators (T1 , T2 , A, S) allows one to change the topology of the network in an easy and controlled way as the network evolves. 8. The geometric formulation of the algorithm allows one to consider generalisation higher genus to simplicial complexes structures. 9. The limited treewidth of the filtered network makes it amenable to efficient (and often exact) inference [19]. Future developments of the TMFG method are in the direction of building networks with a richer structure beyond and also below planarity while keeping a controlled complexity. We 15 intend to apply this filtered networks to sparse modeling with application to physical, financial and biological systems. We intend to develop applications of this filtered network construction and efficient inference and use this tool to identify large scale features of financial networks in different regimes and to apply the inference algorithms to a number of problems in financial risk management, such as risk aggregation and allocation, simulation, stress testing and incorporation of non-homogeneous sources of information (such as asset prices, macroeconomic variables, and also expert opinion) into a risk management framework. Acknowledgements The authors acknowledge very useful discussions with Simone Severini. TA acknowledges support of the UK Economic and Social Research Council (ESRC) in funding the Systemic Risk Centre [ES/K002309/1]. TDM wishes to thank the COST Action TD1210 for partially supporting this work. GPM thanks Alun Wyn-jones for reviewing previous drafts. The authors thank Wolfram Barfuß for many useful discussions and suggestions. [1] R. C. Prim. Shortest connection networks and some generalizations. BellSystem Technical Journal, 36:1389–1401, 1957. [2] R. N. Mantegna. Hierarchical structure in financial markets. Eur. Phys. J. B, 11:193–197, 1999. [3] T Aste, T Di Matteo, and ST Hyde. Complex networks on hyperbolic surfaces. Physica A: Statistical Mechanics and its Applications, 346(1):20–26, 2005. [4] M. Tumminello, T. Aste, T. Di Matteo, and R. N. Mantegna. A tool for filtering information in complex systems. Proceedings of the National Academy of Sciences of the United States of America, 102(30):10421–10426, 2005. [5] T. Aste. An algorithm to compute maximally filtered planar graphs. http://www.mathworks.com/ matlabcentral/fileexchange/27360. Last accessed 25/08/2015. [6] John Winston Giffin. Graph theoretic techniques for facilities layout. PhD thesis, University of Canterbury, 1984. [7] Ibrahim H. Osman, Baydaa Al-Ayoubi, and Musbah Barake. A greedy random adaptive search procedure for the weighted maximal planar graph problem. Computers and Industrial Engineering, 45(4):635–651, 2003. [8] Gruia Cǎlinescu, Cristina G. Fernandes, Howard Karloff, and Alexander Zelikovsky. A new approximation algorithm for finding heavy planar subgraphs. Algorithmica (New York), 36(2):179–205, 2003. [9] W.-M. Song, T. Di Matteo, and T. Aste. Hierarchical information clustering by means of topologically embedded graphs. PLoS ONE, 7:e31929, 2012. [10] Nicolo Musmeci, Tomaso Aste, and Tiziana Di Matteo. Relation between financial market structure and the real economy: Comparison between clustering methods. PLoS ONE 10:e0126998, 2015 [11] Nicoló Musmeci, Tomaso Aste, and Tiziana Di Matteo. Risk diversification: a study of persistence with a filtered correlation-network approach. Journal of Network Theory in Finance 1 11722, 2015. [12] F Pozzi, T Di Matteo, and T Aste. Spread of risk across financial markets: better to invest in the peripheries. Scientific Reports, 3:1665, 2013. [13] Ross Kindermann, James Laurie Snell, et al. Markov random fields and their applications, volume 1. American Mathematical Society Providence, RI, 1980. [14] Amir Globerson Tommi Jaakkola. Approximate inference using planar graph decomposition. In Advances in Neural Information Processing Systems 19: Proceedings of the 2006 Conference, volume 19, page 473. MIT Press, 2007. [15] Francis R Bach and Michael I Jordan. Thin junction trees. In Advances in Neural Information Processing Systems, pages 569–576, 2001. [16] Tomaso Aste, Ruggero Gramatica, and T Di Matteo. Exploring complex networks via topological embedding on surfaces. Phys. Rev. E, 86(3):036109, 2012. [17] J. W. Alexander. The combinatorial theory of complexes. Ann. of Math., 31:294–322, 1930. [18] Steffen L Lauritzen. Graphical models. Oxford University Press, 1996. [19] Martin J Wainwright and Michael I Jordan. Graphical models, exponential families, and variational inference. Foundations and Trends R in Machine Learning, 1(1-2):1–305, 2008. 16 [20] Martin Grötschel, László Lovász, and Alexander Schrijver. Geometric algorithms and combinatorial optimization. 1988. [21] Mathias Drton, Bernd Sturmfels, and Seth Sullivant. Lectures on Algebraic Statistics, volume 39 of Oberwolfach Seminars. Springer, 2009. [22] Steffen L Lauritzen, TP Speed, and K Vijayan. Decomposable graphs and hypergraphs. Journal of the Australian Mathematical Society (Series A), 36(01):12–29, 1984. [23] T. Aste and D. Sherrington. Glass transition in self organizing cellular patterns. J. Phys. A: Math. Gen., 32:7049–56, 1999. [24] Tomaso Aste, Ruggero Gramatica, and T. Di Matteo. Random and frozen states in complex triangulations. Philosophical Magazine, 92:246–254, 2012. [25] Won-Min Song, T Di Matteo, and T Aste. Building complex networks with platonic solids. Phys. Rev. E, 85(4):046115, 2012. [26] Pawel Fiedor. Networks in financial markets based on the mutual information rate. Physical Review E, 89(5):052801, 2014. [27] LR Foulds and DF Robinson. A strategy for solving the plant layout problem. Operational Research Quarterly, pages 845–855, 1976. [28] LR Foulds and David F Robinson. Graph theoretic heuristics for the plant layout problem. The International Journal of Production Research, 16(1):27–37, 1978. [29] Annegret Liebers. Planarizing graphs—a survey and annotated bibliography. Journal of Graph Algorithms and Applications, 5(1):74 p.–74 p., 2001. [30] Thomas Lengauer. Combinatorial algorithms for integrated circuit layout. John Wiley & Sons, Inc., New York, NY, USA, 1990. [31] Won-Min Song, Tomaso Aste, and T Di Matteo. Correlation-based biological networks. In Microelectronics, MEMS, and Nanotechnology, pages 680212–680212. International Society for Optics and Photonics, 2007. [32] David Easley and Jon Kleinberg. Networks, crowds, and markets: Reasoning about a highly connected world. Cambridge University Press, 2010. [33] Takao Nishizeki and Norishige Chiba. Planar graphs: Theory and algorithms. Elsevier, 1988. [34] John Hopcroft and Robert Tarjan. Efficient planarity testing. Journal of the ACM (JACM), 21(4):549–568, 1974. [35] John M Boyer and Wendy Myrvold. Simplified o(n) planarity algorithms. 2001. [36] G. L. Nemhauser, L. a. Wolsey, and M. L. Fisher. An analysis of approximations for maximizing submodular set functions-I. Mathematical Programming, 14:265–294, 1978. [37] Andreas Krause and Daniel Golovin. Submodular function maximization. Tractability: Practical Approaches to Hard Problems, 3:19, 2012. [38] B. Dubertret, T. Aste, H. M. Ohlenbusch, and N. Rivier. Two-dimensional froths and the dynamics of biological tissues. Phys. Rev. E, 58(5):6368–6378, Nov 1998. [39] J. S. Andrade Jr., H. J. Herrmann, R. F. S. Andrade, and L. R. da Silva. Apollonian networks: Simultaneously scale-free, small world, euclidean, space-filling and with matching graphs. Phys. Rev. Lett., 94:018702, 2005. e-print: cond-mat/0406295. [40] RH Green and LAR Al-Hakim. A heuristic for facilities layout planning. Omega, 13(5):469–474, 1985. [41] Janny Leung. A new graph-theoretic heuristic for facility layout. Management Science, 38(4):594– 605, 1992. [42] Wolfram Barfuss, Guido Previde Massara, Tiziana Di Matteo, and Tomaso Aste. Local-global sparse covaraince inversion. to be submitted, 2015. [43] W.-M. Song, T. Di Matteo, and T. Aste. Nested hierarchies in planar graphs. Discrete Applied Mathematics, 159:2135–2146, 2011. [44] S. Kullback and R. A. Leibler. On information and sufficiency. Ann. Math. Statist., 22(1):79–86, 03 1951.
8cs.DS
SUBMITTED TO IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. XX, NO. XX, FEB 2018 1 Video Person Re-identification by Temporal Residual Learning arXiv:1802.07918v1 [cs.CV] 22 Feb 2018 Ju Dai∗ , Pingping Zhang∗ , Huchuan Lu, Senior Member, IEEE, and Hongyu Wang, Member, IEEE Abstract—In this paper, we propose a novel feature learning framework for video person re-identification (re-ID). The proposed framework largely aims to exploit the adequate temporal information of video sequences and tackle the poor spatial alignment of moving pedestrians. More specifically, for exploiting the temporal information, we design a temporal residual learning (TRL) module to simultaneously extract the generic and specific features of consecutive frames. The TRL module is equipped with two bi-directional LSTM (BiLSTM), which are respectively responsible to describe a moving person in different aspects, providing complementary information for better feature representations. To deal with the poor spatial alignment in video reID datasets, we propose a spatial-temporal transformer network (ST2 N) module. Transformation parameters in the ST2 N module are learned by leveraging the high-level semantic information of the current frame as well as the temporal context knowledge from other frames. The proposed ST2 N module with less learnable parameters allows effective person alignments under significant appearance changes. Extensive experimental results on the largescale MARS, PRID2011, ILIDS-VID and SDU-VID datasets demonstrate that the proposed method achieves consistently superior performance and outperforms most of the very recent state-of-the-art methods. Index Terms—Person re-identification, spatial-temporal transformation, temporal residual learning. G Fig. 1. Visual samples of the same person at different times under different camera views. From left to right are the images at different times. From top to down are the sequences under varied surveillance cameras. The same pedestrian in video sequences can have large pose variations, out-of-focus, arbitrary scales and rather cluttered backgrounds. Copyright (c) 2018 IEEE. Personal use of this material is permitted. However, permission to use this material for any other purposes must be obtained from the IEEE by sending an email to [email protected]. All the authors are with School of Information and Communication Engineering, Faculty of Electronic Information and Electrical Engineering, Dalian University of Technology, Dalian, 116024, P.R. China. ∗ J. Dai and PP. Zhang have equal contribution for this work. The corresponding author is Prof. Huchuan Lu. Email: [email protected]; [email protected]; [email protected]; [email protected]. This work is supported in part by the National Natural Science Foundation of China (NNSFC), No. 61502070, No. 61528101 and No. 61472060. PP. Zhang is currently visiting the University of Adelaide, supported by the China Scholarship Council (CSC) program. combining them under a deep convolutional neural network (CNN) based framework [21]–[30]. Because the video setting is more close to the practical scenario, researchers have shifted their attention to the video re-ID [31]–[37]. The advantages of video re-ID are located in several aspects. First, videos are the first-hand materials captured by surveillance cameras and pedestrian tracklets can be automatically detected by existing detectors. Second, compared to the static image reID, videos contain more information, e.g., temporal cues, pose variations and multi-view observations. In addition, videos can provide more training samples for a tracklet sequence, usually consisting of multiple images. More importantly, the ubiquitous videos offer society far-reaching benefits in terms of security and law enforcement. Therefore, we attempt to tackle the video setting in this paper. Video re-ID also faces several severe challenges. Samples in static image re-ID are usually captured under well-controlled visual conditions or even framed by professional photographers. However, as video acquisition is much less constrained, the image qualities of video frames tend to be rather low and I. I NTRODUCTION IVEN an image/tracklet taken from one camera, person re-identification (re-ID) is the process of matching the person from images/tracklets of interest in another view. In recent years, the computer vision field has witnessed the increasing attention in person re-ID. A large mount of person re-ID approaches have emerged, due to its widely potential applications, such as criminal spotting [1], pedestrian searching [2] and cross-camera tracking [3]. Currently, the prominent progresses of person re-ID are achieved in the static image setting, which only uses the single images and spatial information. Most of existing works in this setting focus on designing robust feature representation [4]– [12], learning discriminative distance metric [11], [13]–[20] or SUBMITTED TO IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. XX, NO. XX, FEB 2018 pedestrians also exhibit a large range of pose variations, which can be observed from the Fig. 1. In particular, pedestrians in videos are usually moving, resulting in serious out-of-focus, blurring and scale variations. Furthermore, the automatically detected pedestrian tracklets by existing pedestrian detectors may fail with cluttered backgrounds and poor alignments, which exacerbate the re-ID problems with more difficulties. Therefore, the following issues in video re-ID need to be carefully considered: 1) how to construct appropriate person representations, so that they can effectively incorporate temporal information available in videos? 2) How to effectively harness the temporal dependency to keep better pedestrian alignments, so that sample noises and cluttered backgrounds can be alleviated and less influenced? To deal with the first issue, recent works in video re-ID have tended to utilize the recurrent neural networks (RNNs), which take consecutive frames as inputs and adaptively incorporate temporal information [32]–[34], [38], [39]. These methods first extract the frame-wise features with deep CNNs. Then the extracted features are fed into several RNNs to capture the temporal structure information. Finally, the average or max temporal pooling procedure is conducted on the outputs of the RNNs to aggregate the features. However, the average pooling operation only considers the generic features of pedestrian sequences, the specific features of samples in a sequence are neglected. While the max pooling operation concentrates on finding the local salient features, a lot of useful information may be abandoned. A key innovation of this work is that a new technical solution to fully leverage the temporal information is provided. Specifically, we propose a temporal residual learning (TRL) module which is equipped with two bi-directional LSTMs (BiLSTMs) [40] to simultaneously learn the generic and specific features of a video sequence. The generic features indicate the common temporal structure of a video, which is captured by averaging the outputs of the first BiLSTM. The specific features extracted by the second BiLSTM, characterizes the deviations and properties in specific sample frames. The joint features can provide complementary information for person descriptions and promote the representation power of a video. In addition, the two BiLSTMs in our framework make the generic and the specific information flow forward and backward in a flexible manner, allowing the underlying temporal information interaction to be fully exploited. To alleviate sample noises and poor alignments appeared in videos, we propose to take advantage of the spatial transformer network (STN) [41]. The STN is a learnable module which can explicitly allow spatial manipulations of data within CNNs. The STN has achieved impressive performance on fine-grained recognition [41], [42], face recognition [43], [44] and imagelevel person re-ID [45], [46]. The main difficulty in applying the STN to video tasks is how to ensure the spatial transformation is continuous. In fact, consecutive frames of videos are very similar without significant changes and fluctuations. This fact indicates that the spatial transformation in videos should also vary smoothly according to time in order to preserve the temporal continuity. To address this problem, we extend the STN method and propose a novel spatial-temporal transformer network (ST2 N). The ST2 N includes a recurrent structure 2 in temporal dimension to automatically learn the optimal spatial transformation parameters in consecutive frames. The ST2 N also utilizes a BiLSTM, that can leverage knowledge of consecutive frames to ensure accurate spatial alignments. In summary, our main contributions are three-folds: • We propose a new temporal information learning method, i.e., the TRL module, to jointly learn the generic and specific features of a video sequence. The complementary features can promote the representation capability of conventional RNN based temporal pooling methods. • We extend the classical STN method and propose the ST2 N module to leverage the context knowledge of consecutive frames. The ST2 N module is very useful to ensure smooth person alignments in videos. • By unifying the proposed modules, our proposed video re-ID method achieves a new state-of-the-art accuracy on the large-scale MARS dataset [33] and impressive results on other three datasets, including the PRID2011 [47], ILIDS-VID [48] and SDU-VID [49]. The rest of this paper is organized as follows. In Section II, we give an overview of the video based re-ID and spatial transformer network. Then we introduce the proposed learning approach in Section III. In Section IV, we evaluate and analyze the proposed method by extensive experiments and comparisons with other methods. Finally, we provide the conclusion and future work in Section V. II. R ELATED W ORK Video based re-ID. In recent years, video based re-ID has drawn increasing attention due to its numerous applications. Existing video re-ID methods can be roughly categorized into two classes: hand-crafted feature based methods [49], [51]– [56] and deep learning based methods [31]–[36]. A majority of conventional algorithms develop their solutions from two aspects: extracting reliable feature representations [49], [51], [52], [55], [56] or learning robust distance metrics [53], [54]. For instance, Wang et al. [52] select the discriminative video fragments from noisy sequences by estimating the flow energy profile (FEP). The fragments are represented by the HOG3D feature [57] and the average color histogram. In [49], the periodicity of a walking person is exploited to generate spatial-temporal body-action units, which are then represented by Fisher vectors. Cho et al. [55] conduct the multi-shot matching by efficiently estimating the target poses. You et al [54] propose the top-push distance learning model (TPDL) [54], which integrates a top-push constrain for matching video features of persons. Recently, with the remarkable success in various vision applications, deep learning techniques have also been applied in video re-ID. In particular, Niall et al. [31] and Wang et al. [32] exploit the siamese network architecture for re-ID, where the convolutional layer, the recurrent layer, and the temporal pooling layer are jointly trained to act as a feature extractor. The difference is that the former takes advantage of RNNs to capture the temporal information based on the fixedlayer CNN features, while the later leverages the feature maps at all levels of a CNN and models the temporal information SUBMITTED TO IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. XX, NO. XX, FEB 2018 3 TRL fT Bi-LSTM f2 f1 Residual Computation Convs Incep-1 Incep-2 T*56*56*192 Incep-3 GAP T*14*14*832 1 1 2 2 T*1024 1 Bi-LSTM T*1024 1 1 2 2 T T 1*1024 F C 2 T T ST2N 1*1024 T Bi-LSTM 1 F C 1 2 2 T T Training Loss CNN Bi-drectional LSTM Bilinear sampler Grid generator Concatination Element wise minus Incep-1 Incep-2 Residual Computation Bi-LSTM Localization network T*56*56*192 Incep-3 GAP 1 1 2 2 Bi-LSTM T*1024 1 T*1024 1 1 2 2 T T 1*1024 2 T T Element wise add T 1*1024 Testing Output F C Fig. 2. The overall architecture of the proposed model. The model consists of two streams, i.e., the main stream (upper) and the alignment stream (lower). The framework first takes a pedestrian sequence as input and extract deep features by using the GoogLeNet [50]. For each stream, the first BiLSTM and Temporal Pooling unit are utilized to generate the generic features of the input sequence. The Residual Computation part calculates the difference between the generic features and the outputs of the first BiLSTM. The residues are further processed by the second BiLSTM and Temporal Pooling to produce the specific features. The generic and specific features of the two streams are weighted as the final sequence representation. In addition, the localization network in the ST2 N module takes the outputs of Incep-2 as inputs to predict the spatial transformation parameters for producing the aligned outputs. by convolutional gated recurrent units (GRUs). In addition, since the quality of each sample cannot be guaranteed and poor images will hurt the accuracy, Liu et al. [39] propose to learn the quality of each sample automatically. Quality scores and features of all samples are aggregated to get the final feature representation. Zhou et al. [34] propose the temporal attention model (TAM) to focus on discriminative frames. The TAM is jointly learned with the spatial recurrent model (SRM) to integrate the surrounding information at different spatial locations for better similarity evaluation. Xu et al. [35] present an attentive spatial-temporal pooling network (ASTPN) to select key regions or frames from the sequences for the feature representation learning. In a nutshell, existing frameworks directly aggregate the frame-level features by conducting the average, max or attention temporal pooling. However, the average temporal pooling only summarizes the generic features, the max temporal pooling focuses on the local salient regions and the attention temporal pooling concerns the informative frames. The specific characteristics of samples in video sequences are not explored, which may lead to a suboptimal video representation for video re-ID. To take advantage of the temporal information and appearance speciality of pedestrians, we propose the TRL module to simultaneously extract the generic and specific features of samples within a video. Spatial transformer network. To capture more spatial invariant within deep networks, Jaderberg et al. [41] propose the spatial transformer module, which can automatically learn the optimal transformation parameters. The spatial transformer module is differentiable and can be inserted into existing convolutional architectures, giving neural networks the ability to actively transform the spatial feature maps. The resulting network improves the feature invariance to translation, scale, rotation and more generic warping. Hence, the STN has been widely applied in fine-grained image recognition, e.g., face recognition [43], [44] and static image re-ID [45], [46]. In [42], Sønderby et al. extend the STN with RNNs in the spatial dimension for digit sequence recognition within a image. Our proposed method shares the similar idea with [42], but we infuse the RNNs into the STN in the temporal dimension. The resulting ST2 N allows the learned transformation parameters to be smooth changes within consecutive frames. Although efforts in [45], [46] also take advantage of the STN to perform the pedestrian alignment, our model differers them in two aspects. First, their methods are developed for static image reID, while our proposed module is designed to address video setting. Second, there is no need to consider the temporal context information for static image re-ID in [45], [46]. For the video setting, we need to control the transformation parameters in temporal dimension. III. T HE P ROPOSED A PPROACH In this section, we first describe the overall architecture of our framework. Then we give the details of spatial-temporal transformer network module. After that, we elaborate the temporal residual learning in detail. At last, we describe the inference process of our proposed model. A. Overview of Network Architecture The overall architecture of our proposed model is illustrated in Fig.2. The GoogleNet [50] is selected as the base network, however, other convolutional networks are also feasible. The model consists of two streams: the main stream (upper) and the alignment stream (lower), which process the original input sequences and the aligned sequences, respectively. The two streams have the same architecture and share the same frontend (Convs in Fig.2). From the Inception-1 layers to the end, the two streams do not share parameters. The main reason of this design is that the main stream and the alignment stream focus on different features of the sequences. Making the parameters of two streams unshare can ensure the adaptiveness. In detail, each frame of a pedestrian sequence is first fed into the GoogLeNet to extract multi-level convolutional features. As pointed out in [46], feature maps in high-level SUBMITTED TO IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. XX, NO. XX, FEB 2018 layers can encode the attention region and semantic cues. Inspired by this fact, we utilize the high-level feature maps (the outputs of the Inception-2 layers in the main stream, size = T × 14 × 14 × 832) as inputs of the ST2 N module. The ST2 N predicts the transformation parameters by leveraging the spatial information of the current frame and the temporal context knowledge from consecutive frames. The grid generator of the ST2 N uses the predicted transformation parameters to construct a sampling grid. The sampling grid is a set of points, where the low-level feature maps (the outputs of Convs, T × 56 × 56 × 192) should be sampled to produce the aligned outputs. The bilinear sampler takes the outputs of Convs and the sampling grid as inputs to produce the transformed feature maps (T × 56 × 56 × 192). Then, we extract the feature vectors of video frames on the original feature maps and the transformed feature maps via the global average pooling (GAP). We name the extracted features as the original sequence descriptors (OSD) and the aligned sequence descriptors (ASD). Either the OSD or the ASD is sent into the following TRL module to get the video features. We take the aligned pedestrian sequence as an example to demonstrate the processing procedure of the TRL module. First, we feed the ASD to the first BiLSTM of the TRL module. The outputs of the first BiLSTM are aggregated by a temporal poling unit. The aggregated results act as the generic features. Then, the differences between the generic features and the outputs of the first BiLSTM are formulated as the specific residuals. The specific residuals are fed into the second BiLSTM, the outputs of which are summarized by the second temporal pooling. The aggregated results are the specific features of the aligned sequence. The final representations of the aligned sequences are obtained by fusing the generic features and the specific features. B. Spatial-Temporal Transformer Network Module The proposed ST2 N module (shown in Fig. 2) consists of three parts: the localization network, the grid generator and the bilinear sampler. The localization network includes a shallow CNN to aggregate high-level features, a BiLSTM to capture temporal context information and a fully connected layer to predict the transformation parameters. In detail, for the shallow CNN, we use the structure of Conv(k = 1 × 1, s = 1, n = 512) + BN + ReLU + M axP ooling(k = 2 × 2, s = 2) + Conv(k = 1×1, s = 1, n = 512)+BN +ReLU +GAP . For the BiLSTM, we follow previous works [32], [42], and set the hidden unit size and dropout rate to 256 and 0.5, respectively. The number of neural units in the fully connected layer is set to 4 for adapting the transformation parameters. Formally, we describe the proposed spatial-temporal transformer process as follows. Given an input frame It at time t, we first extract its high-level feature maps Xt (the outputs of Inception-2 layers in the main stream). Then the shallow CNN aggregates the feature maps as ct = φcnn (Xt ), (1) where ct is the aggregated feature and φcnn (·) denotes the shallow CNN of the localization network. By taking the aggrew gated feature ct and the bi-directional contexts (hft−1 , hbw t+1 ) 4 of previous frames and next frames, the BiLSTM captures the bi-directional temporal context of the current frame as w w hft w = φflstm (ct , hft−1 ) (2) bw bw hbw t = φlstm (ct , ht+1 ) (3) w φflstm (·) where and φbw lstm (·) are the forward and backward processes of the BiLSTM. After that, we use the fully connected layer to predict the transformation parameters θt , which is conditioned on the temporal context information (hft w , hbw t ). The transformation parameters can be expressed as θt = φf c (hft w , hbw t ). (4) In addition, because pedestrians almost stand vertically in videos, the scale and translation transformations are enough to ensure person alignments. Thus, we only consider the scale and and translation transformers, and perform the spatial transformation by the following affine matrix:  x  st 0 τtx θt = , (5) 0 syt τtx where sxt , syt , τtx and τty are the scale and and translation parameters along the width and height directions, respectively. Similar to the STN [41], in our ST2 N we also utilize the predicted transformation parameters θt to construct a sampling grid Gt . The bilinear sampler takes the input feature maps Yt and the sampling grid Gt as inputs, and produce the spatial transformed features Ŷt , which is sampled from the inputs Yt at the grid points. Formally, we extract the spatial transformed features Ŷt from the input maps Yt (the outputs of the Convs in Fig. 2) by Ŷt = ST (Yt , θt ), (6) where ST is the spatial transformer. Note that, our proposed ST2 N model essentially searches an target region and adaptively extracts the corresponding features based on the w spatial-temporal information. φflstm and φbw lstm provide the bi2 directional information for the ST N. It can not only preserve the temporal continuity, but also allow the smooth and robust spatial transformation between consecutive frames. We apply the spatial transformation operation on the high-level feature maps Yt instead of the input image It to reduce computation efforts greatly. Based on the ST2 N, we extract the features of the original pedestrian sequence and the aligned pedestrian sequence. The resulting OSD and ASD will be sent into the temporal residual learning module to extract complementary features to represent pedestrian sequences. C. Temporal Residual Learning The relationship of consecutive frames provides important hints for person recognition. Existing re-ID methods mainly introduce the forward RNNs and temporal pooling methods to capture temporal structure information. However, the plain forward RNNs have several obvious drawbacks that may hamper the performance of video re-ID. First, the forward RNNs merely summarize the information of previous inputs. Thus, the outputs of forward RNNs may be biased towards the later time-steps, making the later frames more dominant than SUBMITTED TO IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. XX, NO. XX, FEB 2018 the earlier ones. Second, the average or max temporal pooling used with forward RNNs only focuses on generic features or local salient parts of a sequence, which may neglect the valuable and specific information of samples in videos. To address aforementioned drawbacks, we propose the temporal residual learning (TRL) module. The TRL module can simultaneously learn the generic and specific features of pedestrian sequences. Specifically, the TRL module contains two BiLSTMs. Each of the BiLSTMs is followed by an average temporal pooling layer. The employed BiLSTM inherently has forward connections and backward connections, allowing information flow backward and forward over the temporal dimension. Thus, it is reasonable to use the BiLSTM to extract the temporal structures of both the original sequences and the aligned sequences. In addition, the aligned sequences can provide complimentary information for the original sequences. Therefore, the enhanced sequence features have better representation capability and robustness. We take the aligned video sequence as an example to demonstrate the implementation details of the TRL module. Assume the aligned video sequence A contains T frames, A A A i.e., IA = [IA 1 , I2 , ..., IT ], and It is the image at the t-th time step (t = 1, 2, ..., T ). Each frame IA t has a corresponding ASD, ftA = f (IA t ), extracted from the alignment stream. For the notional simplicity, we subsequently drop the superscript A and consider each ASD independently. By feeding the descriptors f1 , f2 , ..., fT into the first BiLSTM, we get the bidirectional temporal features, which can be expressed as: lstm1f w gt gtlstm1bw = lstm1 fw ψlstm1 (ft , ht−1 f w ), (7) = bw bw ψlstm1 (ft , hlstm1 ), t+1 (8) fw bw where ψlstm1 (·) and ψlstm1 (·) represent the forward and backward processes of the first BiLSTM in the TRL module, lstm1 respectively. ht−1 f w is the hidden state of the forward LSTM, which contains the context information of previous bw frames. hlstm1 is the hidden state of the backward LSTM, t+1 that captures the context information of future frames. We concatenate the bi-directional features as the temporal features of the t-th frame: h i lstm1f w gtlstm1 = gt ; gtlstm1bw , (9) Then the above features are aggregated by the temporal pooling layer to extract the generic representation of a pedestrian sequence, which can be formulated as: lstm1 ḡA = T 1 X lstm1 g . T t t (10) lstm1 Most existing methods use the ḡA to perform the supervise learning for video re-ID. However, the average temporal pooling procedure on the overall features only concerns the generic features of a video sequence, the specific features are not explicitly highlighted. Therefore, we introduce another BiLSTM to model the specific features. The input to the second BiLSTM is the difference between the generic feature ḡlstm1 and the bi-directional feature gtlstm1 at the t-th frame. 5 The detailed processing procedure of the second BiLSTM can be expressed as follows: lstm2f w gt lstm2f w fw = ψlstm2 (ḡlstm1 − gtlstm1 , ht−1 ), (11) bw bw ). gtlstm2bw = ψlstm2 (ḡlstm1 − gtlstm1 , hlstm2 t+1 (12) We note that the feature residues ḡlstm1 − gtlstm1 capture the characteristics of independent features. They contain the specific features of each sample in a sequence. We also aggregate the specific features to obtain the characteristic representation of the video sequence by lstm2 ḡA T 1 X lstm2 g . = T t t (13) Therefore, the final representation of a sequence is acquired by weighting the generic and specific features: lstm1 lstm2 gA = αḡA + (1 − α)ḡA (14) where α is a trade-off parameter to balance the importance of the generic features and the specific features. In the following experiments, we set α = 0.5 to give the two kind of features the equal importance. The above procedure can also be conducted on the original O O video sequence IO = [IO 1 , I2 , ..., IT ], the resulting features can be expressed as: lstm1 lstm2 gO = αḡO + (1 − α)ḡO . (15) From the above derivation, one can see that our proposed TRL forces the temporal module not only perceive the generic features of the overall sequence, but also exploit the specific features of independent frames. The resulting representation makes full use of the temporal structure cues, which has more representation power in contrast to only using temporal pooling methods. We note that the BiLSTMs used in the two streams do not share the weights though we use the same symbols (lstm1 and lstm2) to represent them. D. Overall Feature Representation and Inference In the training phase, we employ the softmax cross-entropy loss to supervise the feature learning of the main stream and the alignment stream. In the testing phase, for a new video sequence, we follow the feature fusion strategy in [46] to perform the identification matching. More specifically, given the features gO and gA , extracted from the original video sequence and the aligned video sequence, respectively. The overall sequence representation can be expressed as:   g = β|gO |2 , (1 − β)|gA |2 (16) where | · | denotes the L2-norm, β is a hyperparameter and controls the importance of each term. In this paper, we set β = 0.5 to emphasize equal importance between the main stream and the alignment stream. In the experiments, we will show that the two streams can provide complementary information and promote each other to achieve better performance. SUBMITTED TO IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. XX, NO. XX, FEB 2018 IV. E XPERIMENTS In this section, we thoroughly evaluate the proposed framework on several public video re-ID datasets. We first analyze the importance of each component of the proposed model. To validate the effectiveness and superiority of our method, we then make extensive comparisons with other state-of-theart video re-ID methods. At last, we conduct cross-dataset experiments to evaluate the generalization of the proposed model, and perform hyperparameter analysis to demonstrate its insensitivity. A. Datasets We conduct experiments on four widely used video re-ID datasets, including the MARS [33], PRID 2011 [47], ILIDSVID [48] and SDU-VID [49] datasets. Here we give a brief description of these datasets. MARS. The MARS dataset [33] is a large-scale video dataset for person re-ID. It is captured from six near-synchronized cameras on the Tsinghua campus. As an extension of Market1501 [58] dataset, MARS contains 1,261 different identities forming a total number of 20,478 tracklets. These tracklets are automatically collected via the DPM [59] detector and GMMCP [60] tracker. Each identity is captured by at least 2 cameras and has 13.2 tracklets on average. Among all the tracklets, there exist 3,278 distracted tracklets due to the false detection and association, making the dataset very challenging to achieve high performance. Following previous works, in this work we also divide this dataset into 625 persons for training and the rest for testing. PRID 2011. The PRID 2011 dataset [47] is collected in several uncrowded outdoor scenes with relatively simple backgrounds and rare occlusions. Image frames of this dataset are captured by two static non-overlapping surveillance cameras. One camera view has 385 identities while the other has 749 identities. This dataset has an overlap of 200 pedestrians appeared in both views. Each person sequence has a variable length from 5 to 675 frames and with an average number of 100. To guarantee the effective length of image sequences, we select 178 identities with the sequence number more than 27 frames, following the work in [48]. ILIDS-VID. The ILIDS-VID dataset [48] is captured at an airport arrival hall under a multi-camera CCTV network. The dataset consists of 300 distinct individuals observed in two non-overlapping views, forming 600 pedestrian sequences. Each person has 23 to 192 images and the average number per person is 73. It is very challenging because of the large clothing similarities among pedestrians, lighting and viewpoint variations across views as well as cluttered backgrounds and random occlusions. SDU-VID. The SDU-VID dataset [49] is collected by two non-overlapping camera views in outdoor scenes. The dataset contains 600 pedestrian sequences for 300 different identities. Each sequence has a variable length from 16 to 346 image frames and the average number is 130. There are more image 6 frames in each pedestrian sequence comparing with the ILIDSVID and PRID 2011. The SDU-VID is also a challenging dataset due to the cluttered backgrounds, occlusions and viewpoint variations. B. Experimental Setup Evaluation settings. To evaluate the performance, we employ the cumulative matching characteristics (CMC) curves [61] and the mean average precision (mAP) [58] as the evaluation criterions. For the MARS dataset, we utilize the protocol in [33] and divide the MARS dataset into two subsets with 625 persons for training and the rest for testing. While for the PRID 2011, ILIDS-VID and SDU-VID datasets, we adopt the protocol in [48]. Each of the three datasets is randomly split into the training subset and testing subset by half, with non-overlapping identities. During testing, we regard the pedestrians in the first camera as the probes while the second camera as the galleries. The performances of three datasets are evaluated by the CMC score for 10 trials with different train/test splits. The average results of 10 splits are reported. Network parameter settings. We perform all the experiments on the Tensorflow platform [62]. Most of the network parameter settings can be found in Fig. 2. The GoogLeNet [50] pre-trained on the ImageNet dataset is selected as the CNN feature extractor. During training, we uniformly resize the input image to 224 × 224 × 3. The number of the neural units in the two temporal BiLSTMs are set to 512. For each sequence, we randomly choose 10 consecutive frames for training and the mini-batch size is 12. For the the convolutional and fully connected layers, the weights are initialized by the Gaussian distribution with mean 0 and variance 0.01. While for the weights of the BiLSTMs, we initialize them by the orthogonal initialization method [63]. To prevent the exploding gradients, we clip all gradients to make sure them lie in the interval [−5, 5]. The standard Adam algorithm [64] is utilized to optimize the proposed framework. Training strategy. Because we introduce the ST2 N for the spatial alignment, which deeply interacts with the feature extraction part, the training strategy of the proposed framework needs to be carefully designed. In other words, the effective learning of complementary features should be conditioned under well pre-trained ST2 N. Thus, we train the proposed framework in a stage-wise fashion: 1) pre-training the ST2 N module on the large-scale MARS dataset. In detail, we pretrain the Convs and the ST2 N module with frame-level supervision information. The image-level feature vectors after the GAP are utilized to predict the identities of pedestrians in a sequence. In this stage, we use the learning rate = 2 × 10−4 and max iteration = 10,000; 2) updating the whole network for complementary feature learning. After pre-training the ST2 N module, we use the learned parameters to initialize the whole network. Then the Convs, ST2 N and TRL module are jointly optimized under the sequence-level supervision. In this stage, we use the decreased learning rate = 2 × 10−5 , and max iteration = 10,000, 8,000, 8,000, 5,000 on the MARS, PRID 2011, ILIDS-VID, SDU-VID datasets, respectively. Both the SUBMITTED TO IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. XX, NO. XX, FEB 2018 7 TABLE I Q UANTITATIVE COMPARISON OF DIFFERENT SETTINGS ON THE MARS DATASET IN TERMS OF CMC SCORES (%) AT RANK 1, 5, 20 AND M AP. T HE BEST RESULTS ARE SHOWN IN BOLDFACE . Model Setting G + LST Mg G + BiLST Mg G + BiLST Ms G + BiLST Mg + BiLST Ms G + BiLST Mg + ST N G + BiLST Ms + ST N G + BiLST Mg + BiLST Ms + ST N G + BiLST Mg + ST 2 N G + BiLST Ms + ST 2 N G + BiLST Mg + BiLST Ms + ST 2 N Rank-1 69.9 74.0 73.6 76.7 75.9 74.6 77.3 78.3 76.7 79.3 Rank-5 84.7 87.8 87.4 88.7 88.9 87.9 90.2 91.0 89.4 91.1 Rank-20 88.9 91.2 90.8 91.9 92.1 92.7 94.0 94.1 93.9 96.0 mAP 47.4 57.8 56.9 61.1 63.5 62.7 65.6 65.4 63.4 66.8 frame-level supervision and the sequence-level supervision are optimized by the softmax cross-entropy loss. C. Ablation Analysis In this subsection, we perform in-depth studies on the MARS dataset to validate the contribution of each component of the proposed model. Table. I summarizes the ablation results of our model with the same training hyperparamters described in previous subsections. The first four rows are conducted on the original videos, and the last six rows are conducted on both the original videos and the aligned videos. “G” refers to the GoogLeNet, that extracts the convolutional features for each frame in a pedestrian sequence. “LST M ” is a single direction LSTM and is employed to extract the temporal features. “BiLST M ” used in this paper intends to use the bi-direction information to extract the complementary features. “ST N ” is the classical spatial transformer network, which predicts the spatial transformation parameters on single images. While “ST 2 N ” is the proposed spatial-temporal transformer module to predict parameters conditioned on extra temporal context information. The “g” and “s” stand for the generic and specific features, respectively. Effectiveness of the bi-directional LSTM structure. From the first two rows of Table. I, one can observe that the “G + BiLST Mg ” shows a performance advantage of 4.1%, 3.1%, 2.3% and 10.4% in terms of the CMC scores at rank1, 5, 20 and mAP over the “G + LST Mg ”. This indicates that compared to the conventional single directional structure, the bi-directional information flow helps the isolated frame to interact with other frames. The BiLSTMg have better ability to capture the temporal information of pedestrian sequences. Therefore, in following experiments we employ BiLSTMg as the base structure for extracting temporal information. Effectiveness of the STN and ST2 N. Comparing the results of the 2-7 rows in Table. I, we can see that performing spatial alignments with spatial transformers can consistently improve the matching performance. In particular, the models with the STN outperform the plain models with a large margin (about 5% improvement) in term of the mAP metric. From the results of the 8-10 rows, we can see that our proposed ST2 N further boosts the matching performance about 2.0%, 1.0%, 2.0% and 1.5% in terms of the CMC scores at rank-1, 5, 20 and mAP. The results validate the effectiveness of incorporating t=1 t = 10 t = 20 t = 30 t = 40 Fig. 3. Visualization examples of transformed feature maps. From left to right are the frames at t = 1, t = 10, t = 20, t = 30 and t = 40, respectively. The first two rows are the images and corresponding feature maps of original sequences. The last two rows are the images and corresponding feature maps of aligned sequences. Our ST2 N can partially remove cluttered backgrounds. the temporal context information for spatial transformation in practical video applications. In addition, to clarify the effectiveness of the ST2 N module, we visualize the aligned images and transformed feature maps of a randomly selected pedestrian video in Fig. 3. This figure convincingly shows that the proposed ST2 N module helps to align images with smooth spatial variations. The transformed feature maps can help to improve the target attention regions and alleviate some cluttered backgrounds. Effectiveness of the generic and specific features in TRL. In the TRL module, the extracted generic and specific features essentially capture different characteristics of pedestrians. To verify the complementary behaviors, we also perform featurelevel experiments. As shown in the 2-9 rows of Table. I, only using one kind of features, the models have already achieved very impressive results. The models with only generic features consistently outperform the ones with only specific features. This may explains why most of previous works only use the generic features can achieve remarkable performance in video re-ID. Though the specific features are inferior to the generic features, the combined features achieve higher performance (about 2% improvement) in all compared metrics. The three group experiments convincingly demonstrate the effectiveness and superiority of the proposed TRL module. Complementarity of two streams. In our proposed model, the main stream is utilized to address the original video sequences, while the aligned stream deals with the aligned video sequences. To verify the effectiveness of each stream, SUBMITTED TO IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. XX, NO. XX, FEB 2018 TABLE II C OMPARISON WITH OTHER STATE - OF - THE - ART METHODS ON M ARS DATASET IN TERMS OF CMC SCORES (%) AT RANK 1, 5, 20 AND M AP. T HE BEST RESULTS ARE SHOWN IN BOLDFACE . Methods ASTPN [35] CAR [36] CNN+XQDA [33] CNN+TAM+SRM [34] MSCAN [27] QAN [39] TriNet [29] Baseline (G + BiLST Mg ) Ours Ours+KISSME Ours+XQDA Rank-1 44.0 55.5 65.0 70.6 71.8 73.7 79.8 74.0 79.3 80.3 80.5 Rank-5 70.0 70.2 81.1 90.0 86.6 84.9 91.4 87.8 91.1 91.0 91.8 Rank-20 81.0 80.2 88.9 97.6 93.1 91.6 91.2 96.0 95.5 96.0 mAP 45.6 50.7 56.1 51.7 67.7 57.8 66.8 67.1 69.1 we perform additional experiments on the MARS, PRID 2011, ILIDS-VID and SDU-VID datasets. The performances of the main stream, the alignment stream and the complete model are shown in Fig. 4. It can be seen that the alignment stream achieves comparable performance to the main stream, and the fusion of the two streams achieves better than the individual streams on the four video datasets. Specifically, the fusion results achieve 79.3%, 87.8%, 57.7% and 97.7% of CMC matching rate at rank-1 on the four datasets, which are higher than the main steam by around 3.4%, 4.3% , 5.6% and 1.7%, respectively. The performance gains of the complete model are much larger than the alignment stream. The consistent improvements indicate that the two streams can provide complementary information for each other. When taking them together, the model achieves best results in all evaluation metrics. D. Comparison with State-of-the-art Methods To demonstrate the superiority of our approach, we compare the proposed video re-ID model with several state-of-the-art methods on the large-scale MARS dataset and three small datasets, i.e., PRID 2011, ILIDS-VID and SDU-VID. Results on the large-scale dataset. On the MARS dataset, we compare our method with seven state-of-the-art methods, including the ASTPN [35], CAR [36], CNN+XQDA [33], CNN+TAM+SRM [34], MSCAN [27], QAN [39] and TriNet [29]. The detailed results are summarized in Table. II. As can be seen, our baseline model achieves the rank-1 accuracy of 74.0% and mAP of 57.8%, which performs better than most of the existing state-of-the-art methods except for the TriNet [29]. Our proposed model with Euclidean distance achieves rank-1 accuracy of 79.3% and mAP of 66.8%. The results outperform the state-of-the-art method QAN [39] by a large margin. The improvements are 5.6% and 15.1% in terms of the rank-1 and mAP, respectively. The TriNet [29] is currently one of the optimal metric learning methods and our model can obtain competitive performance. The results motivate us to employ distance metric learning to further improve the performance. When our method combined with KISSME [15], we arrive at 80.3% rank-1 accuracy and 67.1% mAP, with nearly 1.0% and 0.3% relative accuracy gains. The proposed model with XQDA [11] achieves the optimal 8 results with 80.5%, 91.8%, 96.0% and 69.1% for the CMC scores at rank-1, 5, 20 and mAP, which outperforms all of compared methods. These results confirm the superiority and effectiveness of the proposed model on the large-scale automatically detected MARS dataset. Results on three small datasets. In addition, we also conduct experiments on three small video re-ID datasets. On these datasets, we compare with twenty state-of-the-art methods, including VR [48], DVR [52], DVDL [65], STFV3D [49], AFDA [51], LFDA [17], STFV3D+KISSME [66], PaMM [55], TDL [54], SIIDL [53], RFA [38], RNN [31], RNN+OF [31], RCN+KISSME [32], CNN+BRNN [37], ASTPN [35], CNN+XQDA [33], CNN+SRM+TAM [34], CAR [36] and QAN [39]. Among the compared approaches, the first ten approaches use hand-crafted features and the left are deep learning based models. The comparison results of the CMC scores at rank-1, 5, 20 are reported in Table. III. Results in Table. III demonstrate the significant superiority of the proposed model over existing state-of-the-art methods on the SDU-VID dataset. Specially, our model achieves the rank-1 accuracy of 97.7%, and can fully distinguish different queries at rank-5. It surpasses the previous best approach CAR [36] by 8.4% and 4.7% in terms of rank-1 and rank-5, respectively. For the PRID 2011 dataset, the proposed approach obtains 87.8% and 97.4% at rank-1 and rank-5, respectively. Other than the QAN [39] model, our model achieves the best performance in contrast to all compared methods. On the more challenging ILIDS-VID dataset, the advantage of our method is less obvious than on the MARS and SDU-VID datasets. But we obtain very comparable results with the CAR [36] and the RNN+OF [31]. The QAN model can still achieves the best performance on the ILIDS-VID dataset. The reason may be that training samples in the ILIDS-VID dataset are very limited, only consisting of 150 persons with 300 training sequences. In addition, the dataset contains large variations, cluttered backgrounds and low-resolution images. Those factors make it challenge to discriminate different pedestrians of the dataset. The QAN [39] model takes fully advantages of the labeled information by utilizing both image-level and sequence-level supervision information to train. The results give us an evidence that it is a suitable practice to include image-level supervision when very limited labeled videos are available. It is interesting to note that the performance margins between the hand-crafted features and the deep features are not very large, which means that hand-crafted features are befitting for small datasets. In addition, it is not difficult to observe from Table. III that the proposed model obviously outperforms the baseline model by a large margin. Our TRL module improves the rank-1 accuracy by 13.6%, 5.0% and 6.3% on the PRID2011, ILIDSVID and SDU-VID datasets, respectively. Moreover, we arrive at a new state-of-the-art performance on the SDU-VID dataset, win the second performance on the PRID 2011 datastet and achieve the competitive results on the challenge ILIDS-VID dataset. These results clearly prove that the proposed model has obvious superiority and shows its effectiveness on small datasets as well. SUBMITTED TO IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. XX, NO. XX, FEB 2018 100 100 100 95 95 90 90 90 85 85 9 100 99 75 80 75 70 97 Matching Rate (%) 80 Matching Rate (%) Matching Rate (%) Matching Rate (%) 98 80 70 60 50 96 95 94 93 70 73.7% Alignment stream 75.9% Main stream 79.3% Fusion 65 60 40 80.0% Alignment stream 83.5% Main stream 87.8% Fusion 65 4 6 8 10 12 14 16 18 20 2 4 6 Rank 8 10 12 14 16 18 90 2 20 4 6 8 10 12 14 16 18 20 2 4 Rank Rank (a) MARS 96.1% Alignment stream 96.0% Main stream 97.7% Fusion 91 30 60 2 92 48.7% Alignment stream 52.1% Main stream 57.7% Fusion (b) PRID 2011 6 8 10 12 14 16 18 20 Rank (c) ILIDS-VID (d)SDU Fig. 4. Results of the main stream, the alignment stream and the fusion of them on the (a) MARS, (b) PRID 2011, (c) ILIDS-VID and (d) SDU-VID datasets. The CMC scores at different rank are reported. Consistent improvements of the fusion results on all datasets can be observed. TABLE III C OMPARISON OF THE PROPOSED ALGORITHM AND OTHER STATE - OF - THE - ART METHODS ON THE PRID 2011 AND ILIDS-VID DATASETS . T HE CMC SCORES (%) AT RANK 1, 5, 20 ARE REPORTED . T HE BEST THREE RESULTS ARE SHOWN IN BOLDFACE . Classes Methods Traditional . DL-based VR [48] DVR [52] DVDL [65] STFV3D [49] AFDA [51] LFDA [17] STFV3D+KISSME [66] PaMM [55] TDL [54] SIIDL [53] Rank-1 37.6 40.0 40.6 42.1 43.0 43.7 64.1 56.5 56.7 76.7 RFA [38] RNN [31] RNN+OF [31] RCN+KISSME [32] CNN+BRNN [37] ASTPN [35] CNN+XQDA [33] CNN+SRM+TAM [34] CAR [36] QAN [39] Baseline (G + BiLST Mg ) Ours 58.2 65.0 70.0 69.0 72.8 77.0 77.3 79.4 83.3 90.3 74.2 87.8 PRID 2011 Rank-5 Rank-20 63.9 89.4 71.7 92.2 69.7 85.6 71.9 91.6 72.7 91.9 72.8 90.9 87.3 92.0 85.7 97.77 80.0 93.6 95.6 98.9 85.8 90.0 90.0 88.4 92.0 95.0 93.5 94.4 93.3 98.2 93.3 97.4 97.9 97.0 97.0 96.4 97.6 99.0 99.3 99.3 96.7 100 98.9 99.3 Rank-1 34.5 39.5 25.9 37.0 37.5 32.9 44.3 30.3 56.3 48.7 49.3 50.0 58.0 46.1 55.3 62.0 53.0 55.2 60.2 68.0 52.7 57.7 ILIDS-VID Rank-5 Rank-20 56.7 77.5 61.1 81.8 48.2 68.9 64.3 86.9 62.7 81.8 68.5 92.6 71.7 91.7 56.3 82.7 87.6 98.3 81.1 97.3 76.8 76.0 84.0 76.8 85.0 86.0 81.4 86.5 85.1 86.8 80.7 81.7 90.0 94.0 96.0 95.6 95.1 98.0 95.1 97.0 94.2 97.4 93.9 94.1 Rank-1 62.0 73.3 - SDU-VID Rank-5 81.3 92.7 - Rank-20 92.7 96.0 - 75.0 85.6 89.3 91.3 97.7 86.7 97.0 95.3 98.7 100.0 90.8 99.6 98.5 99.3 100.0 TABLE IV R ESULTS OF CROSS - DATASET EXPERIMENTS . T HE FIRST COLLUM REPRESENTS THE TRAINING DATASETS AND THE FIRST ROW INDICATES THE TESTING DATASETS . T HE CMC SCORES (%) AT RANK -1, 5, 20 ARE REPORTED . Datasets MARS PRID 2011 ILIDS-VID SDU-VID Rank-1 35.2 29.5 23.1 PRID 2011 Rank-5 Rank-20 69.6 89.3 59.4 82.2 54.9 78.6 Rank-1 18.1 8.9 7.6 E. Cross-dataset Generalization In practice, different datasets are usually collected under different visual conditions. Models trained with one dataset can perform badly on a different dataset, which means that dataset bias is inevitable. Hence, it is important to design models that can generalize well to new environments. Crossdataset testing is an effective way to evaluate the potential ability of a system. To better understand the generalization performance of our model, we also perform cross-dataset experiments. More specifically, we conduct two kinds of experiments. The first one is training on the large-scale MARS dataset and testing on the three small datasets. The second is ILIDS-VID Rank-5 Rank-20 30.8 59.3 22.8 48.8 15.9 41.4 Rank-1 89.4 39.7 45.4 - SDU-VID Rank-5 97.6 68.4 76.3 - Rank-20 100.0 88.7 93.6 - training on one of the three small datasets, while testing on the other two datasets. Experimental results are listed in Table. IV. The results in Table. IV reveal that when training on the large-scale MARS dataset, the proposed model can get better generalization performance. In particular, we achieve 89.5%, 97.6% and 100.0% of the CMC scores at rank-1, 5 and 20 on the SDU-VID dataset. The results are better than current stateof-the-art methods, which can be observed from Table. III. However, the CMC scores for the PRID 2011 and the ILIDSVID dataset is less fascinating. The rank-1 scores for the two datasets are 30.2% and 18.1%, respectively. The main reason may be that sample distributions of the PRID 2011 and ILIDS- SUBMITTED TO IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. XX, NO. XX, FEB 2018 rank-1 rank-5 rank-10 rank-20 mAP 100 Matching rate (%) 90 80 70 60 50 40 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 Different values of α 0.8 0.9 1 (a) rank-1 rank-5 rank-10 rank-20 mAP 100 Matching rate (%) 90 10 The parameter α balances the importance between the generic and specific features of pedestrian sequences. When α = 0, it means that we merely consider the specific features. α = 1 indicates that we only utilize the generic features to describe pedestrians. Fig. 5 (a) demonstrates that when we take both terms into consideration, we achieve better performance. The parameter β controls the significance of the main stream and the alignment stream. It can be observed from Fig. 5 (b) that both the main stream and the alignment stream are important and can complement each other. It can be also noticed that the matching rates have relative small fluctuations when α and β varies. The results indicates that the proposed algorithm does not rely on parameter tuning to obtain outstanding performance. However, when we choose α = 0.5 and β = 0.5, we can get the highest results. Therefore, in experiments, we set α = β = 0.5 to emphasize equal importance for any of the balance terms in the proposed model. V. C ONCLUSION 80 70 60 50 40 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Different values of β (b) Fig. 5. Parameter sensitivity analysis on the MARS dataset. (a) CMC matching rates v.s. different values of α. (b) CMC matching rates v.s. different values of β. VID datasets are very different from the MARS, while the pedestrians in the SDU-VID dataset are relative simple and have similar appearances to the MARS. When the model is trained on one of the three small datasets, the matching rates for the other two datasets decline nearly by half. Specifically, when we train the model on the PRID 2011 dataset, we achieve 8.9% rank-1 accuracy for the ILIDS-VID and 39.7% for the SDU dataset. If the challenging ILIDS-VID dataset is selected as the training dataset, our model reports 29.5% and 45.4% rank-1 score for the PRID 2011 and the SDU dataset, respectively. When training on the SDU-VID, the CMC scores for the PRID 2011 and the ILIDS-VID are the lowest. Those results demonstrate that the dataset biases do have affects on the matching rates. Our model has certain generalization for the cross-dataset testing, but need to be further optimized to improve the generalization performance. F. Trade-off Parameter Analysis There are two trade-off parameters in our approach: α and β. We conduct empirical analysis on the MARS dataset to analyze the parameter sensitivity based on the person re-ID accuracy . When analyzing one parameter, we keep the other one fixed. We report the CMC scores at rank-1, 5, 10, 20 as well as the mAP with α and β varying in the range of [0, 0.1, ..., 1]. Experimental results are illustrated in Fig. 5. In this work, we focus on the problems of unconstrained video person re-ID, where video sequences contain severe challenges, like out-of-focus target and cluttered backgrounds. To address these key challenges, we propose a novel spatialtemporal transformer network (ST2 N), which leverages temporal information to keep smooth spatial alignments between consecutive frames. In addition, to fully take advantage of the extra temporal information, we propose an innovative temporal residual learning (TRL) module to learn the generic as well as the specific features of pedestrian sequences. The TRL module incorporates bi-directional LSTM structures to allow temporal information not only propagate from front to back but also in the reverse direction. Extensive experimental results on the MARS, PRID 2011, ILIDS-VID and SDU-VID datasets demonstrate the effectiveness and superiority of the proposed method over other state-of-the-art methods. R EFERENCES [1] S. Gong, M. Cristani, S. Yan, and C. C. Loy, Eds., Person ReIdentification, ser. Advances in Computer Vision and Pattern Recognition. Springer, 2014. [2] C. C. Loy, T. Xiang, and S. Gong, “Multi-camera activity correlation analysis,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2009. [3] X. Wang, “Intelligent multi-camera video surveillance: A review,” Pattern Recognition Letter, vol. 34, no. 1, pp. 3–19, 2013. [4] D. Gray and H. Tao, “Viewpoint invariant pedestrian recognition with an ensemble of localized features,” in Proceedings of European Conference on Computer Vision, 2008. [5] M. Farenzena, L. Bazzani, A. Perina, V. Murino, and M. Cristani, “Person re-identification by symmetry-driven accumulation of local features,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2010. [6] B. Ma, Y. Su, and F. Jurie, “Bicov: a novel image representation for person re-identification and face verification,” in Proceedings of British Machine Vision Conference, 2012. [7] I. Kviatkovsky, A. Adam, and E. Rivlin, “Color invariants for person reidentification,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 35, no. 7, pp. 1622–1634, 2013. [8] B. Ma, Y. Su, and F. Jurie, “Covariance descriptor based on bio-inspired features for person re-identification and face verification,” Image and Vision Computing, vol. 32, no. 6, pp. 379–390, 2014. [9] Y. Yang, J. Yang, J. Yan, S. Liao, D. Yi, and S. Z. Li, “Salient color names for person re-identification,” in Proceedings of European Conference on Computer Vision, 2014. SUBMITTED TO IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. XX, NO. XX, FEB 2018 [10] M. Tetsu, O. Takahiro, S. Einoshin, and S. Yoichi, “Hierarchical gaussian descriptor for person re-identification,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2016. [11] S. Liao, Y. Hu, X. Zhu, and S. Z. Li, “Person re-identification by local maximal occurrence representation and metric learning,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2015. [12] J. Dai, Y. Zhang, H. Lu, and H. Wang, “Cross-view semantic projection learning for person re-identification,” Pattern Recognition, 2017. [13] W. Zheng, S. Gong, and T. Xiang, “Person re-identification by probabilistic relative distance comparison,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2011. [14] A. Mignon and F. Jurie, “Pcca: A new approach for distance learning from sparse pairwise constraints,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2012. [15] M. Köstinger, M. Hirzer, P. Wohlhart, P. M. Roth, and H. Bischof, “Large scale metric learning from equivalence constraints,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2012. [16] Z. Li, S. Chang, F. Liang, T. S. Huang, L. Cao, and J. R. Smith, “Learning locally-adaptive decision functions for person verification,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2013. [17] S. Pedagadi, J. Orwell, S. A. Velastin, and B. A. Boghossian, “Local fisher discriminant analysis for pedestrian re-identification,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2013. [18] S. Paisitkriangkrai, C. Shen, and A. van den Hengel, “Learning to rank in person re-identification with metric ensembles,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2015. [19] Y. Zhang, B. Li, and H. L. A. I. X. Ruan, “Sample-specific svm learning for person re-identification,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2016. [20] L. Zhang, T. Xiang, and S. Gong, “Learning a discriminative null space for person re-identification,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2016. [21] W. Li, R. Zhao, T. Xiao, and X. Wang, “Deepreid: Deep filter pairing neural network for person re-identification,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2014. [22] J. Hu, J. Lu, and Y. Tan, “Deep transfer metric learning,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2015. [23] S. Ding, L. Lin, G. Wang, and H. Chao, “Deep feature learning with relative distance comparison for person re-identification,” Pattern Recognition, vol. 48, no. 10, pp. 2993–3003, 2015. [24] X. Tong, L. Hongsheng, O. Wanli, and W. Xiaogang, “Learning deep feature representations with domain guided dropout for person reidentification,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2016. [25] C. De, G. Yihong, Z. Sanping, W. Jinjun, and Z. Nanning, “Person re-identification by multi-channel parts-based cnn with improved triplet loss function,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2016. [26] S. Zhou, J. Wang, J. Wang, Y. Gong, and N. Zheng, “Point to set similarity based deep feature learning for person re-identification,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2017. [27] D. Li, X. Chen, Z. Zhang, and K. Huang, “Learning deep contextaware features over body and latent parts for person re-identification,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2017. [28] S. Z. Chen, C. C. Guo, and J. H. Lai, “Deep ranking for person reidentification via joint representation learning,” IEEE Transactions on Image Processing, vol. 25, no. 5, pp. 2353–2367, 2016. [29] A. Hermans, L. Beyer, and B. Leibe, “In defense of the triplet loss for person re-identification,” arXiv:1703.07737, 2017. [30] H. Zhao, M. Tian, S. Sun, J. Shao, J. Yan, S. Yi, X. Wang, and X. Tang, “Spindle net: Person re-identification with human body region guided feature decomposition and fusion,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2017. [31] M. Niall, M. del Rincon Jesus, and M. Paul, “Recurrent convolutional network for video-based person re-identification,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2016. [32] L. Wu, C. Shen, and A. van den Hengel, “Deep recurrent convolutional networks for video-based person re-identification: An end-to-end approach.” [33] L. Z. ands Zhi Bie, Y. Sun, J. Wang, C. Su, S. Wang, and Q. Tian, “Mars: A video benchmark for large-scale person re-identification,” in Proceedings of European Conference on Computer Vision, 2016. 11 [34] Z. Zhou, Y. Huang, W. Wang, L. Wang, and T. Tan, “See the forest for the trees: Joint spatial and temporal recurrent neural networks for videobased person re-identification,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2017. [35] S. Xu, Y. Cheng, K. Gu, Y. Yang, S. Chang, and P. Zhou, “Jointly attentive spatial-temporal pooling networks for video-based person reidentification,” in Proceedings of IEEE International Conference on Computer Vision, 2017. [36] W. Zhang, S. Hu, and K. Liu, “Learning compact appearance representation for video-based person re-identification,” arXiv:1702.06294. [37] W. Zhang, X. Yu, and X. He, “Learning bidirectional temporal cues for video-based person re-identification,” IEEE Transactions on Circuits and Systems for Video Technology, 2017. [38] Y. Yan, B. Ni, Z. Song, C. Ma, Y. Yan, and X. Yang, “Person re-identification via recurrent feature aggregation,” in Proceedings of European Conference on Computer Vision, 2016. [39] Y. Liu, J. Yan, and W. Ouyang, “Quality aware network for set to set recognition,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2017. [40] M. Schuster and K. K. Paliwal, Bidirectional recurrent neural networks. IEEE Press, 1997. [41] M. Jaderberg, K. Simonyan, A. Zisserman, and k. kavukcuoglu, “Spatial transformer networks,” in Advances in Neural Information Processing Systems. [42] S. K. Sønderby, C. K. Sønderby, L. Maaløe, and O. Winther, “Recurrent spatial transformer networks,” arXiv:1509.05329, 2015. [43] W. Wu, M. Kan, X. Liu, Y. Yang, S. Shan, and X. Chen, “Recursive spatial transformer (rest) for alignment-free face recognition,” in Proceedings of IEEE International Conference on Computer Vision, 2017. [44] Y. Zhong, J. Chen, and B. Huang, “Toward end-to-end face recognition through alignment learning,” IEEE Signal Processing Letters, vol. 24, no. 8, pp. 1213–1217, 2017. [45] D. Li, X. Chen, Z. Zhang, and K. Huang, “Learning deep contextaware features over body and latent parts for person re-identification,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2017. [46] Z. Zheng, L. Zheng, and Y. Yang, “Pedestrian alignment network for large-scale person re-identification,” arXiv:1707.00408, 2017. [47] M. Hirzer, C. Beleznai, P. M. Roth, and H. Bischof, “Person reidentification by descriptive and discriminative classification,” 2011. [48] T. Wang, S. Gong, X. Zhu, and S. Wang, “Person re-identification by video ranking,” in Proceedings of European Conference on Computer Vision, 2014. [49] K. Liu, B. Ma, W. Zhang, and R. Huang, “A spatio-temporal appearance representation for viceo-based pedestrian re-identification,” in Proceedings of IEEE International Conference on Computer Vision, 2015. [50] C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich, “Going deeper with convolutions,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2015. [51] Y. Li, Z. Wu, S. Karanam, and R. J. Radke, “Multi-shot human reidentification using adaptive fisher discriminant analysis,” in Proceedings of British Machine Vision Conference, 2015. [52] T. Wang, S. Gong, X. Zhu, and S. Wang, “Person re-identification by discriminative selection in video ranking,” IEEE Transactions on Pattern Analysis and Machine Intelligence, pp. 2501–2514, 2016. [53] X. Zhu, X. Jing, F. Wu, and H. Feng, “Video-based person reidentification by simultaneously learning intra-video and inter-video distance metrics,” in Proceedings of International Joint Conference on Artificial Intelligence, 2016. [54] J. You, A. Wu, X. Li, and W.-S. Zheng, “Top-push video-based person re-identification,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2016. [55] Y. K. J. Cho Y J, “Improving person re-identification via pose-aware multi-shot matching,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2016. [56] X. Ma, X. Zhu, S. Gong, X. Xie, J. Hu, K. M. Lam, and Y. Zhong, “Person re-identification by unsupervised video matching,” Pattern Recognition, vol. 65, no. C, pp. 197–210, 2017. [57] A. Kl?ser, M. Marszalek, and C. Schmid, “A spatio-temporal descriptor based on 3d-gradients,” in Proceedings of British Machine Vision Conference, 2008. [58] L. Zheng, L. Shen, L. Tian, S. Wang, J. Wang, and Q. Tian, “Scalable person re-identification: A benchmark,” in Proceedings of IEEE International Conference on Computer Vision, 2015. SUBMITTED TO IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. XX, NO. XX, FEB 2018 [59] P. F. Felzenszwalb, R. B. Girshick, D. A. McAllester, and D. Ramanan, “Object detection with discriminatively trained part-based models,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 32, no. 9, pp. 1627–1645, 2010. [60] A. Dehghan, S. M. Assari, and M. Shah, “GMMCP tracker: Globally optimal generalized maximum multi clique problem for multiple object tracking,” in Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2015. [61] R. M. Bolle, J. H. Connell, S. Pankanti, N. K. Ratha, and A. W. Senior, “The relation between the roc curve and the cmc,” in Automatic Identification Advanced Technologies, Fourth IEEE Workshop on, 2005. [62] “TensorFlow: Large-scale machine learning on heterogeneous systems.” [Online]. Available: http://tensorflow.org/ [63] M. Henaff, A. Szlam, and Y. LeCun, “Recurrent orthogonal networks and long-memory tasks,” arXiv preprint arXiv:1602.06662, 2016. [64] D. P. Kingma and J. Ba, “Adam: A method for stochastic optimization,” Computer Science, 2014. [65] S. Karanam, Y. Li, and R. J. Radke, “Person re-identification with discriminatively trained viewpoint invariant dictionaries,” in Proceedings of IEEE International Conference on Computer Vision, 2015. [66] W. Zhang, B. Ma, K. Liu, and R. Huang, “Video-based pedestrian re-identification by adaptive spatio-temporal appearance model,” IEEE Transactions on Image Processing, vol. 26, no. 4, pp. 2042–2054, 2017. PLACE PHOTO HERE PLACE PHOTO HERE Ju Dai received her B.S. degree and M.Sc. degree in Electronic Engineering, China University Of Geosciences (CUG), Wuhan, in 2011 and 2014, respectively. She is currently a Ph.D, candidate in the School of Information and Communication Engineering, Dalian University of Technology (DUT). Her research interest is in person re-identification. Pingping Zhang received his B.E. degree in mathematics and applied mathematics, Henan Normal University (HNU), Xinxiang, China, in 2012. He is currently a Ph.D. candidate in the School of Information and Communication Engineering, Dalian University of Technology (DUT), Dalian, China. His research interests are in deep learning, saliency detection, object tracking and semantic segmentation. Huchuan Lu (SM’12) received the M.Sc. degree in signal and information processing, PhD degree in system engineering, Dalian University of Technology (DUT), China, in 1998 and 2008 respectively. PLACE He has been a faculty since 1998 and a profesPHOTO sor since 2012 in the School of Information and HERE Communication Engineering of DUT. His research interests are in the areas of computer vision and pattern recognition. In recent years, he focus on visual tracking, saliency detection and semantic segmentation. Now, he serves as an associate editor of the IEEE Transactions On Systems, Man, and Cybernetics: Part B. 12 Hongyu Wang (M’98) received the B.S. degree from Jilin University of Technology, Changchun, China, in 1990 and the M.S. degree from the Graduate School of Chinese Academy of Sciences, BeiPLACE jing, China, in 1993, both in electronic engineering. PHOTO He received the Ph.D. degree in precision instruHERE ment and optoelectronics engineering from Tianjin University, Tianjin, China, in 1997. He is currently a Professor with Dalian University of Technology, Dalian, China. His research interests include algorithmic, optimization, and performance issues in wireless ad hoc, mesh, and sensor networks.
1cs.CV
arXiv:1701.05209v2 [cs.IT] 8 Dec 2017 A NEW FAMILY OF ONE-COINCIDENCE SETS OF SEQUENCES WITH DISPERSED ELEMENTS FOR FREQUENCY HOPPING CDMA SYSTEMS LENNY FUKSHANSKY AND AHMAD A. SHAAR Abstract. We present a new family of one-coincidence sequence sets suitable for frequency hopping code division multiple access (FH-CDMA) systems with dispersed (low density) sequence elements. These sets are derived from one-coincidence prime sequence sets, such that for each one-coincidence prime sequence set there is a new one-coincidence set comprised of sequences with dispersed sequence elements, required in some circumstances, for FH-CDMA systems. Getting rid of crowdedness of sequence elements is achieved by doubling the size of the sequence element alphabet. In addition, this doubling process eases control over the distance between adjacent sequence elements. Properties of the new sets are discussed. 1. Introduction In the early 1980s a survey of one-coincidence multilevel sequence sets for FHCDMA had been presented in [5]. Each multilevel sequence is used to specify which frequency will be used, by any pair of users (or a single radar), for transmission (reception) at any given time. At the same time, this hopping sequence should be designed in a way that insures minimum mutual interference between different users of the channel. This interference can be measured by the Hamming cross-correlation between different sequences used by different pair of users. Let {F1 , . . . , Fq } be a set of frequencies. For L ≤ q, let X = (X0 , . . . , XL−1 ) and Y = (Y0 , . . . , YL−1 ) be two hopping frequency sequences with Xi , Yi ∈ {F1 , . . . , Fq } for all 0 ≤ i ≤ L − 1. The periodic Hamming cross-correlation between the pair of sequences X and Y is defined as in [4]: (1) HXY (τ ) = L−1 X h(Xi , Yi+τ ), i=0 for all 0 ≤ τ < L, where the subcript i + τ in the sum above is taken modulo L and  0 if a 6= b h(a, b) = 1 if a = b Equation (1) represents the number of coincidences (hits) between sequences X and Y for relative time delay τ . A one-coincidence sequence set is a set of non-repeating elements for which the peak of the Hamming cross-correlation function equals one for any pair of sequences belonging to the set, i.e. the maximum number of hits between any pair of sequences 2010 Mathematics Subject Classification. Primary 94A12, 94A15, 94.10; Secondary 11B50. Key words and phrases. frequency hopping, Hamming correlation property, one-coincidence sequence sets with dispersed sequence elements. 1 2 LENNY FUKSHANSKY AND AHMAD A. SHAAR from the set is one for any relative shift τ . The one-coincidence sequences discussed and constructed in [5] possess the following properties: (1) All of the sequences are of the same length. (2) Length L of each sequence is close to the size q of the alphabet used: extremely crowded sequences. (3) All of the sequences are non-repeating, that is, each frequency is used at most once within the sequence period. This property facilitates a simple synchronization scheme. (4) The maximum number of hits between any pair of sequences for any time shift τ equals one. Using crowded sequences presents a certain advantage, since in that case the system needs a smaller band of frequencies, providing frequency space for other friendly systems. On the other hand, there is also a disadvantage, because it means heavy mutual interference between friendly systems. Doubling the size of the alphabet gives the chance of less crowded environments and allows for larger distances between hopped frequencies. To quote [1]: “In the frequency-hopping spread spectrum systems, it is desirable for the transmitter to hop to a frequency far from the previous one, that is, any adjacent frequencies in any sequences are spaced far apart.” This property can improve the receiver’s resistance to various interferences. Therefore, one-coincidence sequences with the property that the distance between any adjacent symbols in any sequence is greater than a specified amount are considered in [1]. The construction presented in [1] has a small drawback: it is easy to discover all sequences of the other pairs of users from only one sequence. This could jeopardize the main objective of frequency hopping systems. Bluetooth systems use adaptive frequency-hopping (AFH) spread spectrum to improve resistance to radio frequency interference by avoiding crowded frequencies in the hopping sequence [3]. This can be carried out through assigning hopping patterns to users, which have no fading frequencies. This assigning process is much easier by selecting sequences from our non-crowded sequence sets of large size. This note is organized as follows. In Section 2 we present the construction of a new one-coincidence sequence sets with elements distributed in a non-crowded manner on the axis of positive integers, as derived from prime sequence sets [5], such that for each prime sequence set there is a new one-coincidence set comprised of sequences with dispersed element distribution, suitable for frequency hopping systems. This construction is clarified through examples. In Section 3 we discuss the properties of these sequence sets. We finish in Section 4 with a short summary of the main results and a question for further research. One novel feature of our construction is that it combines binary operations on Z with mod p binary operations on Fp . To the best of our knowledge, such a combination has not previously been used in the design of digital sequences. The proofs of the properties of our sequence sets, detailed in Section 3 explore the interplay between these operations. We believe that this idea may have further applications in the analysis of digital sequences with interesting properties. ONE-COINCIDENCE SEQUENCES FOR FREQUENCY HOPPING 3 2. HMC sequence set construction and examples We construct here a new family of sequence sets, which we call HMC after the Harvey Mudd College, acknowledging the support it provided to the second author. Let p ≥ 3 be a prime and Fp be the corresponding prime field, equal to {0, 1, . . . , p − 1} as a set with addition +p and multiplication ·p operations modulo p; in particular, we will distinguish between a + b (usual sum) and a +p b (sum mod p), as well as ab (usual product) and a ·p b (product mod p). Then for each k ∈ Fp , define a prime sequence Sk = {0, k, 2 ·p k, . . . , (p − 1) ·p k} , which is just a permutation of a fixed ordering of Fp , given by mod p-multiplication by k. Now we define the HMC sequence Hk = {0 + k, k + 2 ·p k, 2 ·p k + 3 ·p k, . . . , (p − 1) ·p k + 0} , where multiplication is again mod p, but addition is not; in other words, the j-th element of the sequence Hk is the sum of j-th and (j +1)-st elements of Sk viewed as integers for every 1 ≤ j ≤ p−1, while the p-th element of Hk remains (p−1)·p k. We present examples of this simple construction when p = 7 in Table 1 (the sequence set S0 , . . . , S6 ) and Table 2 (the sequence set H1 , . . . , H6 ). Table 1. Set of prime sequences for p = 7 j ∈ F7 Sequence Sequence Sequence Sequence Sequence Sequence Sequence S0 S1 S2 S3 S4 S5 S6 = 0 ·7 j = 1 ·7 j = 2 ·7 j = 3 ·7 j = 4 ·7 j = 5 ·7 j = 6 ·7 j 0 0 0 0 0 0 0 0 1 0 1 2 3 4 5 6 2 0 2 4 6 1 3 5 3 0 3 6 2 5 1 4 4 0 4 1 5 2 6 3 5 0 5 3 1 6 4 2 6 0 6 5 4 3 2 1 Table 2. Set of HMC sequences for p = 7 with minimum distance d between consecutive elements Sequence Sequence Sequence Sequence Sequence Sequence H1 H2 H3 H4 H5 H6 1 2 3 4 5 6 3 6 9 5 8 11 5 10 8 6 4 9 7 7 7 7 7 7 9 4 6 8 10 5 11 8 5 9 6 3 6 5 4 3 2 1 d=2 d=3 d=1 d=1 d=3 d=2 To design a sequence set with required minimum distance dreq between any two consecutive elements in each of its sequences, we can simply drop all sequences of consecutive minimal distance less than the required distance dreq . Alternatively, 4 LENNY FUKSHANSKY AND AHMAD A. SHAAR we may want to drop sequences which contain “bad” frequencies. This dropping process will be easy if sequence sets are big. We should remark that “bad” frequencies are only bad for certain pairs (locations), hence a given sequence which contains a bad frequency for a specific user may not be bad for another user. Then the sequence assignment coordinator can swap sequences between users; if this is not possible, then the sequence can be dropped. This will have a minor effect on the set, especially if the original set of sequences was large. The example presented in Tables 1 and 2 is suitable for clarifying the construction, however we need a larger example to demonstrate the idea of dropping “bad” sequences. Prime sequence set for p = 19 is shown in Table 3, and the corresponding HMC sequence set, with dispersed elements, is shown in Table 4. Table 3. The set of prime sequences Si , 1 ≤ i ≤ 18 for p = 19 S1 = S2 = S3 = S4 = S5 = S6 = S7 = S8 = S9 = S10 = S11 = S12 = S13 = S14 = S15 = S16 = S17 = S18 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 4 6 8 10 12 14 16 18 1 3 5 7 9 11 13 15 17 3 6 9 12 15 18 2 5 8 11 14 17 1 4 7 10 13 16 4 8 12 16 1 5 9 13 17 2 6 10 14 18 3 7 11 15 5 10 15 1 6 11 16 2 7 12 17 3 8 13 18 4 9 14 6 12 18 5 11 17 4 10 16 3 9 15 2 8 14 1 7 13 7 14 2 9 16 4 11 18 6 13 1 8 15 3 10 17 5 12 8 16 5 13 2 10 18 7 15 4 12 1 9 17 6 14 3 11 9 18 8 17 7 16 6 15 5 14 4 13 3 12 2 11 1 10 10 1 11 2 12 3 13 4 14 5 15 6 16 7 17 8 18 9 11 3 14 6 17 9 1 12 4 15 7 18 10 2 13 5 16 8 12 5 17 10 3 15 8 1 13 6 18 11 4 16 9 2 14 7 13 7 1 14 8 2 15 9 3 16 10 4 17 11 5 18 12 6 14 9 4 18 13 8 3 17 12 7 2 16 11 6 1 15 10 5 15 11 7 3 18 14 10 6 2 17 13 9 5 1 16 12 8 4 16 13 10 7 4 1 17 14 11 8 5 2 18 15 12 9 6 3 Say, now we wanted to design a sequence set with required minimum distance dreq = 3. Examining the minimum consecutive distance of each of the 18 onecoincidence sequences of Table 4, we find four sequences of minimum consecutive distance less than 3: H1 , H9 , H10 , and H18 . Dropping these four sequences, we obtain a set of fourteen sequences each of length 19 and of adjacent distance at least 3. Table 5 presents this set. 3. Properties of HMC sequences We now discuss some interesting properties of the sequences Hk that we constructed above over a field Fp for a fixed prime p. It is clear that the length of each such sequence is p and there are at most p − 1 sequences in the set. Notice also 17 15 13 11 9 7 5 3 1 18 16 14 12 10 8 6 4 2 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 ONE-COINCIDENCE SEQUENCES FOR FREQUENCY HOPPING 5 Table 4. The set of HMC sequences Hi , 1 ≤ i ≤ 18 for p = 19 with minimum distance d between consecutive elements H1 = H2 = H3 = H4 = H5 = H6 = H7 = H8 = H9 = H10 = H11 = H12 = H13 = H14 = H15 = H16 = H17 = H18 = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 6 9 12 15 18 21 24 27 11 14 17 20 23 26 29 32 35 5 10 15 20 25 30 16 21 26 12 17 22 8 13 18 23 28 33 7 14 21 28 16 23 11 18 25 13 20 27 15 22 10 17 24 31 9 18 27 17 7 16 25 15 24 14 23 13 22 31 21 11 20 29 11 22 33 6 17 28 20 12 23 15 26 18 10 21 32 5 16 27 13 26 20 14 27 21 15 28 22 16 10 23 17 11 24 18 12 25 15 30 7 22 18 14 29 25 21 17 13 9 24 20 16 31 8 23 17 34 13 30 9 26 24 22 20 18 16 14 12 29 8 25 4 21 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 21 4 25 8 29 12 14 16 18 20 22 24 26 9 30 13 34 17 23 8 31 16 20 24 9 13 17 21 25 29 14 18 22 7 30 15 25 12 18 24 11 17 23 10 16 22 28 15 21 27 14 20 26 13 27 16 5 32 21 10 18 26 15 23 12 20 28 17 5 33 22 11 29 20 11 21 31 22 13 23 14 24 15 25 16 7 17 27 18 9 31 24 17 10 22 15 27 20 13 25 18 11 21 16 28 21 14 7 33 28 23 18 13 8 22 17 12 26 21 16 30 25 20 15 10 5 35 32 29 26 23 20 17 14 11 27 24 21 18 15 12 9 6 3 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 d d d d d d d d d d d d d d d d d d = = = = = = = = = = = = = = = = = = 2 4 6 8 9 7 5 3 1 1 3 5 7 9 8 6 4 2 32 29 26 23 20 17 14 24 21 18 15 12 9 6 17 16 15 14 13 12 11 8 7 6 5 4 3 2 d d d d d d d d d d d d d d = = = = = = = = = = = = = = 4 6 8 9 7 5 3 3 5 7 9 8 6 4 Table 5. Set of 14 HMC sequences of period 19 and adjacent distance ≥ 3 H2 = H3 = H4 = H5 = H6 = H7 = H8 = H11 = H12 = H13 = H14 = H15 = H16 = H17 = 2 3 4 5 6 7 8 11 12 13 14 15 16 17 6 9 12 15 18 21 24 14 17 20 23 26 29 32 10 15 20 25 30 16 21 17 22 8 13 18 23 28 14 21 28 16 23 11 18 20 27 15 22 10 17 24 18 27 17 7 16 25 15 23 13 22 31 21 11 20 22 33 6 17 28 20 12 26 18 10 21 32 5 16 26 20 14 27 21 15 28 10 23 17 11 24 18 12 30 7 22 18 14 29 25 13 9 24 20 16 31 8 34 13 30 9 26 24 22 16 14 12 29 8 25 4 19 19 19 19 19 19 19 19 19 19 19 19 19 19 4 25 8 29 12 14 16 22 24 26 9 30 13 34 8 31 16 20 24 9 13 25 29 14 18 22 7 30 12 18 24 11 17 23 10 28 15 21 27 14 20 26 16 5 32 21 10 18 26 12 20 28 17 5 33 22 20 11 21 31 22 13 23 15 25 16 7 17 27 18 24 17 10 22 15 27 20 18 11 21 16 28 21 14 28 23 18 13 8 22 17 21 16 30 25 20 15 10 that, since each prime sequence Sk is uniquely indexed by k ∈ Fp , the set of these sequences can be identified with the additive group Z/pZ. The basic properties of our operations that we will use throughout are, for any integers a, b, c, d, k, (2) (a + b) ·p k = a ·p k +p b ·p k ≡ a ·p k + b ·p k (mod p), and (3) (a + b) ·p k + (c + d) ·p k = (a ·p k +p b ·p k) + (c ·p k +p d ·p k). Lemma 3.1. The elements of a sequence Hk are all distinct. Proof. Suppose not, then for some integers 0 ≤ i 6= j ≤ p − 1 we have i ·p k + (i +p 1) ·p k = j ·p k + (j +p 1) ·p k. Then the same equality must also hold for addition mod p, and so we have an equation in the field Fp : (2 ·p i +p 1) ·p k = (2 ·p j +p 1) ·p k, meaning that 2i + 1 = 2j + 1 modulo p. This means that, viewed as an integer, (2i + 1) − (2j + 1) is divisible by p, i.e. p | 2(i − j). Since p > 2, this means p | i − j, however 0 < i − j ≤ p − 1, which is a contradiction.  Lemma 3.2. Each sequence Hk consists of p integers from the set {1, . . . , 2p − 3}. 6 LENNY FUKSHANSKY AND AHMAD A. SHAAR Proof. Let a be an element of Hk for some k ≥ 1, then a = i ·p k + (i +p 1) ·p k for some 0 ≤ i ≤ p − 1, 1 ≤ k ≤ p − 1, where again multiplication is mod p and addition is not. Since i ·p k, (i +p 1) ·p k are distinct elements of Fp , a ≤ (p − 1) + (p − 2) = 2p − 3. The conclusion now follows, since elements of Hk are distinct and there are p of them.  Lemma 3.3. Let t ∈ Z be such that p = 2t + 1. If we write Hk = {a1 , a2 , . . . , at+1 , . . . , a2t , ap }, then at+1 = p, ap = p − a1 and for all 2 ≤ i < t, ap−(i−1) = 2p − ai . Proof. We number elements of Sk from 0 to p − 1 and elements of Hk from 1 to p. First notice that for any 1 ≤ j ≤ p, j ·p k + (p − j) ·p k = p, i.e. the j-th and (p − j)-th elements of the prime sequence Sk add up to p, while the 0-the element of Sk is 0. Then notice that for any 2 ≤ i < t, ai + ap−(i−1) = ((i − 1) ·p k + i ·p k) + ((p − i) ·p k + (p − i + 1) ·p k) = ((i − 1) ·p k + (p − (i − 1)) ·p k) + (i ·p k + (p − i) ·p k) = = p + p = 2p. In particular, 2p = at+1 + ap−(t+1−1) = at+1 + a2t+1−t = 2at+1 , meaning that at+1 = p. On the other hand, by (2) ap = (p − 1) ·p k = p ·p k −p k = p − k = p − a1 .  Lemma 3.4. Let l 6= k, then for any 0 ≤ τ < p, HHk ,Hl (τ ) ≤ 1. Proof. Suppose that for some 0 ≤ τ < p, (4) i ·p k + (i +p 1) ·p k = (i +p τ ) ·p l + (i +p τ +p 1) ·p l. Reducing modulo p, we obtain an equation in the field Fp : i ·p k +p (i +p 1) ·p k = (i +p τ ) ·p l +p (i +p τ +p 1) ·p l, which can then be written as (5) 2 ·p i ·p (k −p l) = 2 ·p τ ·p l +p (l −p k). Equation (5) has precisely one solution in i, namely i = τ ·p l ·p (k −p l)−1 −p 2−1 , which means that (4) has at most one solution, and so HHk ,Hl (τ ) ≤ 1 for any 0 ≤ τ < p.  Lemma 3.5. Let 1 ≤ k ≤ p − 1, and write Hk = {a1 , . . . , ap }, Hp−k = {b1 , . . . , bp }. Then for each 1 ≤ i ≤ p, ai = bp−i+1 . This implies that these two sequences are time-reverse of each other. Further, if we write H1 , . . . , Hp−1 as rows of a (p−1)×p table, then the (p − i)-th column of this table is the reverse of the i-th column. ONE-COINCIDENCE SEQUENCES FOR FREQUENCY HOPPING 7 Proof. Applying equations (2) and (3), we see that bp−i+1 = (p − i) ·p (p − k) + (p − i + 1) ·p (p − k) = (p ·p p −p p ·p k −p i ·p p +p i ·p k) + (p ·p p −p p ·p k −p i ·p p +p i ·p k +p p −p k) = i ·p k + (i − 1) ·p k = ai . The implications readily follow.  Lemma 3.6. Let us write d(Hk ) for the minimum distance between consecutive elements of Hk , and let p = 2t + 1, as above. Then (1) d(H1 ) = d(Hp−1 ) = 2, (2) d(Ht ) = d(Ht+1 ) = 1. Proof. The fact that d(H1 ) = d(Hp−1 ) and d(Ht ) = d(Ht+1 ) follows from Lemma 3.5. Now notice that for 1 ≤ j ≤ p−1, j-th element of H1 is of the form aj = (j −1)+j = 2j − 1 and ap = p − 1. Hence any two consecutive elements of H1 are at least two apart, and a1 , a2 are precisely two apart, i.e. d(H1 ) = 2. To prove that d(Ht ) = 1, we show that the distance between at and at+1 is 1. Notice that at = (t − 1) ·p t + t ·p t, at+1 = (t + 1) ·p t + t ·p t. Now observe that (t + 1) ·p t −p (t − 1) ·p t = ((t + 1) −p (t − 1)) ·p t = 2 ·p t = −1, since p = 2t + 1. This means that p | (t + 1) ·p t − (t − 1) ·p t + 1, but |(t + 1) ·p t − (t − 1) ·p t + 1| ≤ (p − 1) − 1 + 1 < p, hence we must have (t + 1) ·p t − (t − 1) ·p t + 1 = 0. This implies that at+1 = at − 1, and so we are done.  4. Conclusion In this note, we presented a new family of one-coincidence sequence sets with dispersed elements, one for each prime number. These sets are derived from onecoincidence prime sequence sets, such that for each one-coincidence prime sequence set there is a new one-coincidence set comprised of sequences with dispersed sequence elements, required in some circumstances, for FH-CDMA systems [2]. Each sequence belonging to any constructed set has controlled minimum distance between its adjacent elements. The out-of-phase Hamming auto-correlation function of each sequence belonging to the set is zero. The Hamming cross-correlation between any pair of sequences belonging to any sequence set is at most one. Illustrative examples were presented. Properties of the presented one-coincidence sequence sets are listed and proved. The approach adopted in this note can be considered as parallel to the approach of [1]: both aim to solve the problem of the small distance between adjacent elements, where [1] does it by making the sequence length smaller than the size of the 8 LENNY FUKSHANSKY AND AHMAD A. SHAAR sequence elements alphabet set, while we reduce sequence set size. Our approach ensures existence of a one-coincidence sequence set for each prime number, while the approach of [1] does not guarantee the existence of what they call “generator sequence” for each prime number. As a question for future research, it would be interesting to understand the relation between the required minimum consecutive distance dreq of a one-coincidence sequence set, length of sequences, and the sequence set size. For instance, in our example in Table 4 we started with a set of 18 sequences of length 19, and in order to have dreq = 3 we had to drop 4 sequences, hence obtaining a set of 14 sequences in Table 5. Thus one can ask how big can a one-coincidence set of sequences of prescribed length and dreq be? Acknowledgments: First author was partially supported by the NSA grant H98230-1510051 and by the Simons Foundation grant #519058. Second author’s research at Harvey Mudd College was co-funded by IIE, Mr. Mahesh Kotecha, and Mrs. Mitzi Perdue: for their support he is very grateful. He also acknowledges useful discussions with Prof. R. Olson and Prof. A. Aswad. References [1] L. Bin. One-coincidence sequences with specified distance between adjacent symbols for frequency-hopping multiple access. IEEE Transactions on Communications, 45(4):408–410, 1997. [2] S. Geirhofera, J. Z. Sunb, L. Tonga, and B. M. Sadlerc. Cognitive frequency hopping based on interference prediction: Theory and experimental results. Mobile Computing and Communications Review, 13(2), 2009. [3] C. Hodgdon. Adaptive frequency hopping for reduced interference between bluetooth and wireless LAN. Ericsson Technology Licensing, 2003. [4] A. Lempel and H. Greenberger. Families of sequences with optimal Hamming correlation properties. IEEE Transactions on Information Theory, 20(1):90–94, 1974. [5] A. A. Shaar and P. A. Davies. A survey of one-coincidence sequences for frequency-hopped spread-spectrum systems. IEE Proceedings F - Communications, Radar and Signal Processing, 131(7):719–724, 1984. Department of Mathematics, 850 Columbia Avenue, Claremont McKenna College, Claremont, CA 91711 E-mail address: [email protected] Department of Engineering, Harvey Mudd College, Claremont, CA 91711 E-mail address: [email protected]
7cs.IT
The Higher-Order Prover Leo-III⋆ Alexander Steen1 and Christoph Benzmüller2,1 1 arXiv:1802.02732v1 [cs.AI] 8 Feb 2018 2 Freie Universität Berlin, Institute of Computer Science, Berlin, Germany University of Luxembourg, Computer Science and Communications, Luxembourg {a.steen,c.benzmueller}@fu-berlin.de Abstract. The automated theorem prover Leo-III for classical higherorder logic with Henkin semantics and choice is presented. Leo-III is based on extensional higher-order paramodulation and accepts every common TPTP dialect (FOF, TFF, THF), including their recent extensions to rank-1 polymorphism (TF1, TH1). In addition, the prover natively supports almost every normal higher-order modal logic. Leo-III cooperates with first-order reasoning tools using translations to (polymorphic) many-sorted first-order logic and produces verifiable proof certificates. The prover is evaluated on heterogeneous benchmark sets. 1 Introduction Leo-III is an automated theorem prover (ATP) for classical higher-order logic (HOL) with Henkin semantics and choice.3 It is the successor of the well-known LEO-II prover [1], whose development significantly influenced the build-up of the TPTP THF infrastructure [2]. Leo-III exemplarily utilizes and instantiates the associated LeoPARD system platform [3] for higher-order (HO) deduction systems implemented in Scala. In the tradition of the cooperative nature of the LEO prover family, Leo-III collaborates during proof search with external theorem provers, in particular, with first-order (FO) ATPs such as E [4]. Unlike LEO-II, which translated proof obligations into untyped FO languages, Leo-III, by default, translates its HO clauses to (polymorphic or monomorphic) many-sorted FO formulas. The prover thus exploits the comparably novel support for types in FO theorem provers for reducing clutter caused by the translation. Leo-III supports all common TPTP [5,2] dialects (CNF, FOF, TFF, THF) as well as the polymorphic variants TF1 and TH0 [6,7]. The prover returns results according to the standardized SZS ontology and additionally produces a TSTPcompatible (refutation) proof certificate, if a proof could be found. Furthermore, Leo-III natively supports reasoning for almost every normal HO modal logic, including logics K, D, T, S4 and S5 with constant domain or varying domain quantifiers [8]. These hybrid logic competencies make Leo-III, up to the author’s knowledge, the most widely applicable ATP available to date. ⋆ 3 The work is supported by the German National Research Foundation (DFG) under grant BE 2501/11-1 (LEO-III). Leo-III is freely available (BSD license) at http://github.com/leoprover/Leo-III. The most current release of Leo-III (version 1.2) comes with several novel features, including specialized calculus rules for function synthesis, injective functions and equality-based simplification. Regarding reasoning strength, Leo-III 1.2 can compete with the best current state-of-the-art HO ATP systems. This paper outlines the base calculus of Leo-III and highlights the novel features of version 1.2. As a pioneering contribution this also includes Leo-III’s native support for reasoning in HO modal logics (which, of course, includes propositional and FO modal logics). Finally, an evaluation of Leo-III is presented for all monomorphic and polymorphic problems from the TPTP problem library and for all modal logic problems from the QMLTP library [9]. Related ATP systems. These include TPS, Satallax, cocATP and agsyHOL. Also, some interactive proof assistants such as Isabelle/HOL can be used for automated reasoning in HOL. More weakly related systems include the various recent attempts to lift FO ATPs to the HO domain, e.g. Zipperposition. Higher-Order Logic. HOL as addressed here has been proposed by Church, and further studied by Henkin, Andrews and others, cf. [10,11] and the references therein. It provides lambda-notation, as an elegant and useful means to denote unnamed functions, predicates and sets (by their characteristic functions). In the remainder a notion of HOL with Henkin semantics and choice is assumed. 2 Higher-Order Paramodulation Leo-III extends a complete, paramodulation based calculus for HOL with practically motivated, heuristic inference rules, cf. Fig. 1. They are grouped as follows: Clause normalization. Leo-III employs definitional clausification to reduce the number of generated clauses. Moreover, miniscoping is employed prior to clausification. The remaining rules are straight-forward. Primary inferences. The primary inference rules of Leo-III are paramodulation (Para), equality factoring (EqFac) and primitive substitution (PS) as displayed in Fig. 1. The first two introduce unification constraints that are encoded as negative literals. Note that these rules are unordered and produce numerous redundant clauses. Leo-III uses several heuristics to restrict the number of inferences, including a HO term ordering. While these restrictions sacrifice completeness in general, recent evaluations confirm practicality of this approach (cf. evaluation in §4); complete search may be retained though. PS instantiates free variables at top-level with approximations of predicate formulas using so-called general bindings GB C τ . Unification. Unification in Leo-III uses a variant of Huet’s pre-unification rules. Negative equality literals are interpreted as unification constraints and are attempted to be solved eagerly by unification. In contrast to LEO-II, Leo-III uses pattern unification whenever possible. In order to ensure termination, the pre-unification search is limited to a configurable depth. Extensionality rules. Dedicated extensionality rules are used in order to eliminate the need for extensionality axioms in the search space. The rules are similar to those of LEO-II [1]. Primary inferences C ∨ [l ≃ r]tt D ∨ [s ≃ t]α C ∨ D ∨ [s[r]π ≃ t]α ∨ [s|π ≃ l]ff (Para) C ∨ [Xτi →o tiτi ]α C ∨ [l ≃ r]α ∨ [s ≃ t]α C ∨ [l ≃ r]α ∨ [l ≃ s]ff ∨ [r ≃ t]ff {¬,∨}∪{Π τ, =τ |τ ∈T } p ∈ GB τi →o  C ∨ [Xτi →o tiτi ]α {X/p} Further rules (EqFac) (PS) (Choice): E is a choice operator or a free variable; X is a fresh variable. (INJ): sk is a fresh constant symbol of appropriate type. C ∨ [s[E t]]α [t X]ff ∨ [t (ǫ t)]tt (Choice) 1≤j≤n [f X ≃ f Y ]tt ∨ [X ≃ Y ]ff [sk (f X) ≃ X]tt (INJ) 1≤j≤n ff C := C ′ ∨ [Fτj →τ s1,j ≃ t1τ ]ff ∨ · · · ∨ [F sm,j ≃ tm τ ] n o   Vn V j k,j C F/λXτjj . ǫZτ . m −→ Z = tk j=1 X = s k=1 (FS) Fig. 1. Examples of Leo-III’s calculus rules. Technical preliminaries: s ≃ t denotes an equation of HOL terms, where ≃ is assumed to be symmetric. A literal ℓ is a signed equation, written [s ≃ t]α where α ∈ {tt, ff} is the polarity of ℓ. Literals of form [so ]α are a shorthand for [so ≃ ⊤]α . A clause C is a multiset of literals, denoting its disjunction. For brevity, if C, D are clauses and ℓ is a literal, C ∨ ℓ and C ∨ D denote the multi-union C ∪ {ℓ} and C ∪ D, respectively. s|π is the subterm of s at position π, and s[r]π denotes the term that is created by replacing the subterm of s at position π by r. Clause contraction. Additionally to standard simplification routines, Leo-III implements are variety of (equational) simplification procedures, including subsumption, destructive equality resolution, heuristic rewriting and contextual unit cutting (simplify-reflect). Defined Equalities. Leo-III scans for common definitions of equality predicates and heuristically instantiates (or replaces) them with primitive equality. Choice. Leo-III is designed for HOL with choice (ǫτ(τ →o)→τ being a choice operator for type τ ). Rule Choice instantiates choice predicates for subterms that represent either concrete choice operator applications (if E ≡ ǫ) or potential applications of choice (if E is a free variable to the clause). Function synthesis. If plain unification fails for a set of unification constraints, Leo-III may try to synthesise function specifications by rule FS using special choice instances that simulate suitable if-then-else terms. In general, this rule tremendously increases the search space. However, it also enables Leo-III to solve some hard problems (with TPTP rating 1.0). Also, Leo-III supports improved reasoning with injective functions by postulating the existence of left-inverses, cf. rule INJ. Heuristic instantiation. Prior to clause normalization, Leo-III might instantiate universally quantified variables. This include exhaustive instantiation of finite types as well as partial instantiation for otherwise interesting types. 3 Modal Logic Reasoning Modal logics have many relevant applications in computer science, artificial intelligence, mathematics and computational linguistics. They also play an important role in many areas of philosophy, including ontology, ethics, philosophy of mind and philosophy of science. Many challenging applications, as recently explored in metaphysics, require FO or HO modal logics (HOMLs). The development of ATPs for these logics, however, is still in its infancy. Leo-III is addressing this gap. In addition to its role as a classical reasoner, it is the first ATP that natively supports a very wide range of normal HOMLs. To achieve this, Leo-III internally implements the shallow semantical embeddings approach [12]. The key idea in this approach is to provide and exploit faithful mappings for HOML input problems to HOL. An example is as follows: A The user inputs a HOML problem in a suitably adapted TPTP syntax, e.g. thf(1,conjecture,( ! [P:$i>$o,F:$i>$i, X:$i]: (? [G:$i>$i]: (($dia @ ($box @ (P @ (F @ X)))) => ($box @ (P @ (G @ X))))))). which encodes ∀Pι→o ∀Fι→ι ∀Xι ∃Gι→ι (♦P (F (X)) ⇒ P (G(X))), with $box and $dia representing the (mono-)modal operators. This example formula (an instance of a corollary of Becker’s postulate) is valid in S5. B In the header of the input file the user specifies the logic of interest, say modal-logic S5 with rigid constants, constant domain quantifiers and a global consequence relation. For this purpose the TPTP language has been suitably extended:4 thf(simple_s5, logic, ($modal := [ $constants := $rigid, $quantification := $constant, $consequence := $global, $modalities := $modal_system_S5 ])). C When being called with this input file, Leo-III parses and analyses it, automatically selects and unfolds the corresponding definitions of the semantical embedding approach [12,13], adds appropriate axioms and then starts reasoning in (meta-logic) HOL. That is, Leo-III faithfully reduces the HOML input problem, by exploiting the Kripke-style semantics for HOML, to a corresponding problem representation in HOL, which it then processes. Subsequently, it returns SZS compliant result information and, if successful, also a proof object. Leo-III’s proof for the above problem is verified by GDV [5] in 356 s. As of version 1.2, Leo-III supports (but is not limited to) FO and HO extensions of the well known modal logic cube. When taking the different parameter combinations into account (constant/cumulative/varying domain semantics, rigid/non-rigid constants, local/global consequence relation, etc.) this amounts to more than 120 supported HOMLs.5 The exact number of supported logics is in fact much higher, since Leo-III also supports multi-modal logics. In principle, 4 5 Cf. http://www.cs.miami.edu/~ tptp/TPTP/Proposals/LogicSpecification.html for the latest TPTP language proposal for modal logics as implemented in Leo-III. Cf. [13, §2.2]; we refer to the literature [8] for more details on HOML. also user-defined combinations of rigid and non-rigid constants, etc. are possible. Related provers are in contrast limited to propositional logics or support a small range of FO modal logics only [14,15,16]. In the restricted logic settings of the related systems, the embedding approach used by Leo-III is still competitive; cf. evaluation below. 4 Evaluation In order to quantify the performance of Leo-III, an evaluation based on various benchmarks was conducted. Three benchmark data sets were used: – TPTP TH0 (2463 problems) is the set of all monomorphic HOL (TH0) problems from the TPTP library v7.0.0 [5] that are annotated as theorems. The TPTP problem library is a de-facto standard for the evaluation of ATP systems. The TPTP THF problems in particular fostered the development of current HO ATPs, including LEO-II and Satallax. – TPTP TH1 (442 problems) is the subset of all 666 polymorphic HOL (TH1) problems from TPTP v7.0.0 that are annotated as theorems and do not contain arithmetic. The problems mainly consist of HOL Light core exports and Sledgehammer translations of various Isabelle theories. – QMLTP (580 problems) is the subset of all mono-modal benchmarks from the QMLTP library 1.1 [9]. The QMLTP library only contains propositional and FO modal logic problems. Since each problem may have a different validity status for each semantics of modal logic, all problems (and not only those marked as theorem) are selected. The total number of tested problems thus is 580 (raw problems) × 5 (logics) × 3 (domain conditions). QMLTP assumes rigid constant symbols and a local consequence relation. The evaluation measurements were taken on the StarExec cluster in which each compute node is a 64 bit Red Hat Linux (kernel 3.10.0) machine featuring 2.40 GHz Intel Xeon quad-core processors and a main memory of 128 GB. For each problem, every prover was given a CPU time resource limit of 240 s. The following theorem provers were employed in one or more of the conducted experiments: Isabelle/HOL 2016 (TH0/TH1) [17], Satallax 3.0 (TH0) [18], Satallax 3.2 (TH0), LEO-II 1.7.0 (TH0), Leo-III 1.2 (TH0/TH1/QMLTP), Zipperposition 1.1 (TH0) and MleanCoP 1.3 [19] (QMLTP). The experiment results are discussed next: TPTP TH0. Table 1 (a) displays each system’s performance on the TPTP TH0 data set. For each system the absolute number (Abs.) and relative share (Rel.) of solved problems is displayed. Solved here means that a system is able to establish the SZS status Theorem and also emits a proof certificate that substantiates this claim. All results of the system, whether successful or not, are counted and categorized as THM (Theorem), CAX (ContradictoryAxioms), GUP (GaveUp) and TMO (TimeOut) for the respective SZS status of the returned result. Additionally, the average and sum of all CPU times and wall clock (WC) times over all solved problems is presented. Table 1. Detailed result of the benchmark measurements (a) TPTP TH0 data set (2463 problems) Systems Solved Abs. Rel. Satallax 3.2 2140 86.89 Leo-III 2053 83.39 Satallax 3.0 1972 80.06 1788 72.63 LEO-II Zipperpin 1318 53.51 0.00 Isabelle/HOL 0 THM 2140 2045 2028 1789 1318 2022 SZS Results CAX GUP TMO 0 2 321 8 15 394 0 2 433 0 43 603 0 360 785 0 1 440 Avg. Time [s] Σ Time [s] CPU WC CPU WC 12.26 12.31 26238 26339 15.39 5.61 31490 11508 17.83 17.89 36149 36289 5.84 5.96 10452 10661 2.60 2.73 3421 3592 46.46 33.44 93933 67610 (b) TPTP TH1 data set (442 problems) Systems Solved SZS Results Abs. Rel. THM CAX GUP TMO Leo-III 185 41.86 183 2 8 249 0.00 237 0 23 182 Isabelle/HOL 0 Avg. Time [s] Σ Time [s] CPU WC CPU WC 49.18 24.93 9099 4613 93.53 81.44 22404 19300 Leo-III successfully solves 2053 of 2463 problems (roughly 83.39 %) from the TPTP TH0 data set. This is 735 (35.8 %) more than Zipperposition, 264 (12.86 %) more than LEO-II and 81 (3.95 %) more than Satallax 3.0. The only ATP system that solves more problems is the most recent version of Satallax (3.2) that successfully solves 2140 problems which is approximately 4.24 % more than Leo-III. Isabelle currently does not emit proof certificates (hence zero solutions). Even if results without explicit proofs were counted, Leo-III would still have a slightly higher number of solved problems than Satallax 3.0 and Isabelle/HOL with 25 (1.22 %) and 31 (1.51 %) additional solutions, respectively. Leo-III, Satallax (3.2), Zipperposition and LEO-II produce 18, 17, 15 and 3 unique solutions, respectively. Evidently, Leo-III currently produces more unique solutions than any other ATP system in this setting. Leo-III solves nine previously unsolved problems and three problems that can currently not solved by any other system.6 Satallax, LEO-II and Zipperposition show only small differences between their individual CPU and WC time on average and sum. A more precise measure for a system’s utilization of multiple cores is the so-called core usage. It is given by the average of the ratios of used CPU time to used wall clock time over all solved problems. The core usage of Leo-III for the TPTP TH0 data set is roughly 2.52. This means that, on average, two to three CPU cores are used during proof search by Leo-III. Satallax (3.2), LEO-II and Zipperposition show a quite opposite behavior with core usages of 0.64, 0.56 and 0.47, respectively. TPTP TH1. Currently, there exist only few ATP systems that are capable of reasoning within polymorphic HOL as specified by TPTP TH1. The only excep6 This information is extracted from the TPTP problem rating information that is attached to each problem. The exact, previously unsolved, problems are NLP004^7, SET013^7, SEU558^1, SEU683^1, SEV143^5, SYO037^1, SYO062^4.004, SYO065^4.001 and SYO066^4.004. The other three problems that can currently not be solved by any other ATP system are MSC007^1.003.004, SEU938^5 and SEV106^5. # solved problems Fig. 2. Comparison of Leo-III and MleanCoP on the QMLTP data set (580 problems) 400 Leo-III MleanCoP 300 200 100 D /v ar y D /c um ul D /c on st T /v ar y T /c um ul T /c on s S4 t /v ar S4 y /c um S4 ul /c on s S5 t /v ar S5 y /c um S5 ul /c on st 0 tions are HOL(y)Hammer and Isabelle/HOL that schedule proof tactics within HOL Light and Isabelle/HOL, respectively. Unfortunately, only Isabelle/HOL has been available for instrumentation in a reasonably recent and stable version. Table 1 (b) displays the measurement results for the TPTP TH1 data set. When disregarding proof certificates, Isabelle/HOL finds 237 theorems (53.62 %) which is roughly 28.1 % more than the number of solutions founds by Leo-III. Leo-III and Isabelle/HOL produce 35 and 69 unique solutions, respectively. QMLTP. For each semantical setting supported by MleanCoP, which is the strongest FO modal logic prover available to date [16], the number of theorems found by both Leo-III and MleanCoP in the QMLTP data set is presented in Fig. 2. Leo-III is fairly competitive to MleanCoP (weaker by maximal 14.05 %, minimal 2.95 % and 8.90 % on average) for all D and T variants. For all S4 variants, the gap between both systems increases (weaker by maximal 20.00 %, minimal 13.66 % and 16.18 % on average). For S5 variants, Leo-III is very effective (stronger by 1.36 % on average) and it is ahead of MleanCoP for S5/const and S5/cumul (which coincide). This is due to the encoding of the S5 accessibility relation in Leo-III 1.2 as the universal relation between possible worlds as opposed to its prior encoding (cf. [16,13]) as an equivalence relation. Leo-III contributes 199 solutions to previously unsolved problems. For HOML there exist no competitor systems we could compare Leo-III with. 5 Summary Leo-III is a state-of-the-art higher-order reasoning system offering many relevant features and capabilities. Due to its wide range of natively supported classical and non-classical logics, which includes polymorphic HO logic and numerous FO and HO modal logics, the system has many topical applications in computer science, AI, maths and philosophy. Additionally, an evaluation on heterogenous benchmark sets shows that Leo-III is also one of the most effective HO ATP systems to date. Leo-III complies with existing TPTP/TSTP standards, gives detailed proof certificates and it plays a pivotal role in the ongoing extension of the TPTP library and infrastructure to support modal logic reasoning. References 1. Benzmüller, C., Sultana, N., Paulson, L.C., Theiß, F.: The higher-order prover LEO-II. Journal of Automated Reasoning 55(4) (2015) 389–404 2. Sutcliffe, G., Benzmüller, C.: Automated reasoning in higher-order logic using the TPTP THF infrastructure. Journal of Formalized Reasoning 3(1) (2010) 1–27 3. Wisniewski, M., Steen, A., Benzmüller, C.: LeoPARD - A generic platform for the implementation of higher-order reasoners. In Kerber, M., et al., eds.: Intelligent Computer Mathematics. Volume 9150 of LNCS., Springer (2015) 325–330 4. Schulz, S.: E - a brainiac theorem prover. AI Commun. 15(2,3) (August 2002) 111–126 5. Sutcliffe, G.: The TPTP problem library and associated infrastructure - from CNF to TH0, TPTP v6.4.0. J. Autom. Reasoning 59(4) (2017) 483–502 6. Blanchette, J.C., Paskevich, A.: TFF1: the TPTP typed first-order form with rank-1 polymorphism. In Bonacina, M.P., ed.: Automated Deduction – CADE-24. Volume 7898 of LNCS., Springer (2013) 414–420 7. Kaliszyk, C., Sutcliffe, G., Rabe, F.: TH1: the TPTP typed higher-order form with rank-1 polymorphism. In Fontaine, P., et al., eds.: 5th PAAR Workshop. Volume 1635 of CEUR Workshop Proceedings., CEUR-WS.org (2016) 41–55 8. Blackburn, P., van Benthem, J.F., Wolter, F.: Handbook of modal logic. Volume 3. Elsevier (2006) 9. Raths, T., Otten, J.: The QMLTP Problem Library for First-Order Modal Logics. In Gramlich, B., et al., eds.: IJCAR 2012. Volume 7364 of LNCS., Springer (2012) 454–461 10. Andrews, P.: Church’s type theory. In Zalta, E.N., ed.: The Stanford Encyclopedia of Philosophy. Metaphysics Research Lab, Stanford University (2014) 11. Benzmüller, C., Miller, D.: Automation of higher-order logic. In Gabbay, D.M., Siekmann, J.H., Woods, J., eds.: Handbook of the History of Logic, Volume 9 — Computational Logic. North Holland, Elsevier (2014) 215–254 12. Benzmüller, C., Paulson, L.: Multimodal and intuitionistic logics in simple type theory. The Logic Journal of the IGPL 18(6) (2010) 881–892 13. Gleißner, T., Steen, A., Benzmüller, C.: Theorem provers for every normal modal logic. In Eiter, T., Sands, D., eds.: LPAR-21. Volume 46 of EPiC Series in Computing., Maun, Botswana, EasyChair (2017) 14–30 14. Hustadt, U., Schmidt, R.A.: Mspass: Modal reasoning by translation and first-order resolution. In: TABLEAUX. Volume 1847., Springer (2000) 67–71 15. Tishkovsky, D., Schmidt, R.A., Khodadadi, M.: The tableau prover generator MetTeL2. In: European Workshop on Logics in AI, Springer (2012) 492–495 16. Benzmüller, C., Otten, J., Raths, T.: Implementing and evaluating provers for first-order modal logics. In Raedt, L.D., et al., eds.: ECAI 2012. Volume 242 of Frontiers in AI and Applications., Montpellier, France, IOS Press (2012) 163–168 17. Nipkow, T., Paulson, L.C., Wenzel, M.: Isabelle/HOL: A Proof Assistant for Higher-Order Logic. Lecture Notes in Computer Science. Springer (2002) 18. Brown, C.E.: Satallax: An automatic higher-order prover. In: Automated Reasoning. Volume 7364 of LNCS. Springer Berlin Heidelberg (2012) 111–117 19. Otten, J.: Mleancop: A connection prover for first-order modal logic. In: International Joint Conference on Automated Reasoning, Springer (2014) 269–276 A Reasoning in HOML with Leo-III: Corollary of Becker’s Postulate This appendix will be removed from the final version of the paper. We included it here as potentially useful additional information for interested reviewers. Problem statement The original problem statement formulated in modal THF syntax is given by: thf(simple_s5,logic,( $modal := [ $constants := $rigid, $quantification := $constant, $consequence := $global, $modalities := $modal_system_S5 ] )). thf(1,conjecture,( ! [P: ( $i > $o ),F: ( $i > $i ),X: $i] : ? [Q: ( $i > $i )] : ( ( $dia @ ( $box @ ( P @ ( F @ X ) ) ) ) => ( $box @ ( P @ ( Q @ X ) ) ) ) )). Internal problem representation Internally, Leo-III faithfully maps the problem into in classical HOL (THF). The TPTP representation of this internally generated problem is as follows: % ------------------------------------------------------------------------% modal definitions % ------------------------------------------------------------------------% declare type for possible worlds thf(mworld_type,type,( mworld: $tType )). % define valid operator thf(mvalid_type,type,( mvalid: ( mworld > $o ) > $o )). thf(mvalid_def,definition, ( mvalid = ( ˆ [S: ( mworld > $o )] : ! [W: mworld] : ( S @ W ) ) )). % define nullary, unary and binary connectives which are no quantifiers thf(mimplies_type,type,( mimplies: ( mworld > $o ) > ( mworld > $o ) > mworld > $o )). thf(mimplies,definition, ( mimplies = ( ˆ [A: ( mworld > $o ),B: ( mworld > $o ),W: mworld] : ( ( A @ W ) => ( B @ W ) ) ) )). thf(mdia_type,type,( mdia: ( mworld > $o ) > mworld > $o )). thf(mdia_def,definition, ( mdia = ( ˆ [A: ( mworld > $o ),W: mworld] : ? [V: mworld] : ( A @ V ) ) )). thf(mbox_type,type,( mbox: ( mworld > $o ) > mworld > $o )). thf(mbox_def,definition, ( mbox = ( ˆ [A: ( mworld > $o ),W: mworld] : ! [V: mworld] : ( A @ V ) ) )). % define exists quantifiers thf(mexists_const_type__o__d_i_t__d_i_c_,type,( mexists_const__o__d_i_t__d_i_c_: ( ( $i > $i ) > mworld > $o ) > mworld > $o ) ). thf(mexists_const__o__d_i_t__d_i_c_,definition, ( mexists_const__o__d_i_t__d_i_c_ = ( ˆ [A: ( ( $i > $i ) > mworld > $o ),W: mworld] : ? [X: ( $i > $i )] : ( A @ X @ W ) ) )). % define for all quantifiers thf(mforall_const_type__d_i,type,( mforall_const__d_i: ( $i > mworld > $o ) > mworld > $o )). thf(mforall_const__d_i,definition, ( mforall_const__d_i = ( ˆ [A: ( $i > mworld > $o ),W: mworld] : ! [X: $i] : ( A @ X @ W ) ) )). thf(mforall_const_type__o__d_i_t__o_mworld_t__d_o_c__c_,type,( mforall_const__o__d_i_t__o_mworld_t__d_o_c__c_: ( ( $i > mworld > $o ) > mworld > $o ) > mworld > $o )). thf(mforall_const__o__d_i_t__o_mworld_t__d_o_c__c_,definition, ( mforall_const__o__d_i_t__o_mworld_t__d_o_c__c_ = ( ˆ [A: ( ( $i > mworld > $o ) > mworld > $o ),W: mworld] : ! [X: ( $i > mworld > $o )] : ( A @ X @ W ) ) )). thf(mforall_const_type__o__d_i_t__d_i_c_,type,( mforall_const__o__d_i_t__d_i_c_: ( ( $i > $i ) > mworld > $o ) > mworld > $o ) ). thf(mforall_const__o__d_i_t__d_i_c_,definition, ( mforall_const__o__d_i_t__d_i_c_ = ( ˆ [A: ( ( $i > $i ) > mworld > $o ),W: mworld] : ! [X: ( $i > $i )] : ( A @ X @ W ) ) )). % ------------------------------------------------------------------------% transformed problem % ------------------------------------------------------------------------thf(1,conjecture, ( mvalid @ ( mforall_const__o__d_i_t__o_mworld_t__d_o_c__c_ @ ˆ [P: ( $i > mworld > $o )] : ( mforall_const__o__d_i_t__d_i_c_ @ ˆ [F: ( $i > $i )] : ( mforall_const__d_i @ ˆ [X: $i] : ( mexists_const__o__d_i_t__d_i_c_ @ ˆ [Q: ( $i > $i )] : ( mimplies @ ( mdia @ ( mbox @ ( P @ ( F @ X ) ) ) ) @ ( mbox @ ( P @ ( Q @ X ) ) ) ) ) ) ) ) )). Leo-III’s proof output Leo-III proves the problem in approx. 3 s. The exact output of Leo-III, including the generated proof certificate, is given in the following. The proof can be verified by GDV with Isabelle/HOL as HO ATP back end in 356 s. % [INFO] Input problem is modal. Running modal-to-HOL transformation from semantics specification contained in the problem file ... % [INFO] Running in sequential loop mode. % [INFO] Parsing finished. Scanning for conjecture ... % [INFO] Found a conjecture and 0 axioms. Running axiom selection ... % [INFO] Axiom selection finished. Selected 0 axioms (removed 0 axioms). % [INFO] Type checking passed. Searching for refutation ... % Time passed: 3010ms % Effective reasoning time: 688ms % Solved by strategy<name(default),share(1.0),primSubst(1),sos(false),unifierCount (1),uniDepth(8),boolExt(true),choice(true),renaming(true),funcspec(false), domConstr(0),specialInstances(-1),restrictUniAttempts(true)> % Axioms used in derivation (0): % No. of inferences in proof: 9 % No. of processed clauses: 2 % No. of generated clauses: 1 % No. of forward subsumed clauses: 0 % No. of backward subsumed clauses: 0 % No. of ground rewrite rules in store: 0 % No. of non-ground rewrite rules in store: 2 % No. of positive (non-rewrite) units in store: 0 % No. of negative (non-rewrite) units in store: 0 % No. of choice functions detected: 0 % No. of choice instantiations: 0 % SZS status Theorem for becker.p : 3010 ms resp. 688 ms w/o parsing % SZS output start CNFRefutation for becker.p thf(mworld_type,type,( mworld: $tType )). thf(mvalid_type,type,( mvalid: ( mworld > $o ) > $o )). thf(mvalid_def,definition, ( mvalid = ( ˆ [A: ( mworld > $o )] : ! [B: mworld] : ( A @ B ) ) )). thf(mimplies_type,type,( mimplies: ( mworld > $o ) > ( mworld > $o ) > mworld > $o )). thf(mimplies_def,definition, ( mimplies = ( ˆ [A: ( mworld > $o ),B: ( mworld > $o ),C: mworld] : ( ( A @ C ) => ( B @ C ) ) ) )). thf(mdia_type,type,( mdia: ( mworld > $o ) > mworld > $o )). thf(mdia_def,definition, ( mdia = ( ˆ [A: ( mworld > $o ),B: mworld] : ? [C: mworld] : ( A @ C ) ) )). thf(mbox_type,type,( mbox: ( mworld > $o ) > mworld > $o )). thf(mbox_def,definition, ( mbox = ( ˆ [A: ( mworld > $o ),B: mworld] : ! [C: mworld] : ( A @ C ) ) )). thf(mexists_const__o__d_i_t__d_i_c__type,type,( mexists_const__o__d_i_t__d_i_c_: ( ( $i>$i ) > mworld > $o ) > mworld > $o )). thf(mexists_const__o__d_i_t__d_i_c__def,definition, ( mexists_const__o__d_i_t__d_i_c_ = ( ˆ [A: ( ( $i > $i ) > mworld > $o ),B: mworld] : ? [C: ( $i > $i )] : ( A @ C @ B ) ) )). thf(mforall_const__d_i_type,type,( mforall_const__d_i: ( $i > mworld > $o ) > mworld > $o )). thf(mforall_const__d_i_def,definition, ( mforall_const__d_i = ( ˆ [A: ( $i > mworld > $o ),B: mworld] : ! [C: $i] : ( A @ C @ B ) ) )). thf(mforall_const__o__d_i_t__o_mworld_t__d_o_c__c__type,type,( mforall_const__o__d_i_t__o_mworld_t__d_o_c__c_: ( ( $i > mworld > $o ) > mworld > $o ) > mworld > $o )). thf(mforall_const__o__d_i_t__o_mworld_t__d_o_c__c__def,definition, ( mforall_const__o__d_i_t__o_mworld_t__d_o_c__c_ = ( ˆ [A: ( ( $i > mworld > $o ) > mworld > $o ),B: mworld] : ! [C: ( $i > mworld > $o )] : ( A @ C @ B ) ) )). thf(mforall_const__o__d_i_t__d_i_c__type,type,( mforall_const__o__d_i_t__d_i_c_: ( ( $i>$i ) > mworld > $o ) > mworld > $o )). thf(mforall_const__o__d_i_t__d_i_c__def,definition, ( mforall_const__o__d_i_t__d_i_c_ = ( ˆ [A: ( ( $i > $i ) > mworld > $o ),B: mworld] : ! [C: ( $i > $i )] : ( A @ C @ B ) ) )). thf(sk1_type,type,( sk1: $i > mworld > $o )). thf(sk2_type,type,( sk2: $i > $i )). thf(sk3_type,type,( sk3: $i )). thf(sk4_type,type,( sk4: ( $i > $i ) > mworld )). thf(1,conjecture, ( mvalid @ ( mforall_const__o__d_i_t__o_mworld_t__d_o_c__c_ @ ˆ [A: ( $i > mworld > $o )] : ( mforall_const__o__d_i_t__d_i_c_ @ ˆ [B: ( $i > $i )] : ( mforall_const__d_i @ ˆ [C: $i] : ( mexists_const__o__d_i_t__d_i_c_ @ ˆ [D: ( $i > $i )] : ( mimplies @ ( mdia @ ( mbox @ ( A @ ( B @ C ) ) ) ) @ ( mbox @ ( A @ ( D @ C ) ) ) ) ) ) ) ) ), file(’becker.p’,1)). thf(2,negated_conjecture,( ˜ ( mvalid @ ( mforall_const__o__d_i_t__o_mworld_t__d_o_c__c_ @ ˆ [A: ( $i > mworld > $o )] : ( mforall_const__o__d_i_t__d_i_c_ @ ˆ [B: ( $i > $i )] : ( mforall_const__d_i @ ˆ [C: $i] : ( mexists_const__o__d_i_t__d_i_c_ @ ˆ [D: ( $i > $i )] : ( mimplies @ ( mdia @ ( mbox @ ( A @ ( B @ C ) ) ) ) @ ( mbox @ ( A @ ( D @ C ) ) ) ) ) ) ) ) ) ), inference(neg_conjecture,[status(cth)],[1])). thf(3,plain,( ˜ ( ! [A: ( $i > mworld > $o ),B: ( $i > $i ),C: $i] : ? [D: ( $i > $i )] : ( ! [E: mworld] : ( A @ ( B @ C ) @ E ) => ! [E: mworld] : ( A @ ( D @ C ) @ E ) ) ) ), inference(defexp_and_simp_and_etaexpand,[status(thm)],[2,mvalid_def, mforall_const__o__d_i_t__o_mworld_t__d_o_c__c__def, mforall_const__o__d_i_t__d_i_c__def,mforall_const__d_i_def, mexists_const__o__d_i_t__d_i_c__def,mimplies_def,mdia_def,mbox_def])). thf(4,plain,( ˜ ( ! [A: ( $i > mworld > $o ),B: ( $i > $i ),C: $i] : ( ! [D: mworld] : ( A @ ( B @ C ) @ D ) => ? [D: ( $i > $i )] : ! [E: mworld] : ( A @ ( D @ C ) @ E ) ) ) ), inference(miniscope,[status(thm)],[3])). thf(6,plain,( ! [A: mworld] : ( sk1 @ ( sk2 @ sk3 ) @ A ) ), inference(cnf,[status(esa)],[4])). thf(5,plain,( ! [A: ( $i > $i )] : ˜ ( sk1 @ ( A @ sk3 ) @ ( sk4 @ A ) ) ), inference(cnf,[status(esa)],[4])). thf(7,plain,( ! [A: ( $i > $i )] : ˜ ( sk1 @ ( A @ sk3 ) @ ( sk4 @ A ) ) ), inference(simp,[status(thm)],[5])). thf(8,plain,( ! [B: ( $i > $i ),A: mworld] : ( ( sk1 @ ( sk2 @ sk3 ) @ A ) != ( sk1 @ ( B @ sk3 ) @ ( sk4 @ B ) ) ) ), inference(paramod_ordered,[status(thm)],[6,7])). thf(9,plain,( $false ), inference(pre_uni,[status(thm)],[8:[bind(A,$thf(sk4 @ ˆ [C: $i] : ( sk2 @ sk3 ))),bind(B,$thf(ˆ [C: $i] : ( sk2 @ sk3 )))]])). % SZS output end CNFRefutation for becker.p
2cs.AI
New Frameworks for Offline and Streaming Coreset Constructions arXiv:1612.00889v1 [cs.DS] 2 Dec 2016 Vladimir Braverman ∗ Dan Feldman† Harry Lang‡ Abstract Let P be a set (called points), Q be a set (called queries) and a function f : P ×Q → [0, ∞) (called cost). For an error P parameter  > 0, a set S ⊆ P with P a weight function w : P → [0, ∞) is an ε-coreset if s∈S w(s)f (s, q) approximates p∈P f (p, q) up to a multiplicative factor of 1 ± ε for every given query q ∈ Q. Coresets are used to solve fundamental problems in machine learning of streaming and distributed data. We construct coresets for the k-means clustering of n input points, both in an arbitrary metric space and d-dimensional Euclidean space. For Euclidean space, we present the first coreset whose size is simultaneously independent of both d and n. In particular, this is the first coreset of size o(n) for a stream of n sparse points in a d ≥ n dimensional space (e.g. adjacency matrices of graphs). We also provide the first generalizations of such coresets for handling outliers. For arbitrary metric spaces, we improve the dependence on k to k log k and present a matching lower bound. For M -estimator clustering (special cases include the well-known k-median and k-means clustering), we introduce a new technique for converting an offline coreset construction to the streaming setting. Our method yields streaming coreset algorithms requiring the storage of O(S + k log n) points, where S is the size of the offline coreset. In comparison, the previous state-of-the-art was the merge-and-reduce technique that required O(S log2a+1 n) points, where a is the exponent in the offline construction’s dependence on −1 . For example, combining our offline and streaming results, we produce a streaming metric k-means coreset algorithm using O(−2 k log k log n) points of storage. The previous state-of-the-art required O(−4 k log k log6 n) points. ∗ Department of Computer Science, Johns Hopkins University. This material is based upon work supported in part by the National Science Foundation under Grant No. 1447639, by the Google Faculty Award and by DARPA grant N660001-1-2-4014. Its contents are solely the responsibility of the authors and do not represent the official view of DARPA or the Department of Defense. † Department of Computer Science, University of Haifa ‡ Department of Mathematics, Johns Hopkins University. This material is based upon work supported by the Franco-American Fulbright Commission. 1 Introduction In the algorithmic field of computer science, we usually have an optimization problem at hand and a state-of-the-art or a straight-forward exhaustive search algorithm that solves it. The challenge is then to suggest a new algorithm with a better running time, storage or other feature. A different and less traditional approach is to use data reduction, which is a compression of the input data in some sense, and to run the (possibly inefficient) existing algorithm on the compressed data. In this case, the problem of solving the problem at hand reduced to the computing a problem-dependent compression such that: 1. an existing algorithm that solves the optimization problem on the original (complete) data, will yield a good approximate solution for the original data when applied on the compressed data. 2. The time and space needed for constructing the compression and running the optimization algorithm on the coreset will be better than simply solving the problem on the complete data. There are many approaches for obtaining such a provable data reduction for different problems and from different fields, such as using uniform sampling, random projections (i.e., the Johnson-Lindenstrauss Lemma), compressed sensing, sketches or PCA. In this paper we focus on a specific type of a reduced data set, called coreset (or coreset) that was originated in computational geometry, but now applied in other fields such as computer vision and machine learning. Our paper is organized into basic sections: results for maintaining coresets over data streams (Section 3) and results for offline coresets (Sections 46). We briefly introduce both of these topics the remainder of this section. Many of our results, along with comparison to prior works, are summarized in Table 1 in Section 2. In the Appendix A (Section 7) we summarize the merge-and-reduce technique that is used in previous approaches [Che09a, HPM04, HPK07, AMR+ 12, FL11]. In the Appendix B (Section 8) we provide an alternative framework that generalizes our main result (Theorem 3.1), applying to a wide-array of constructions although giving a weaker bound. 1.1 Streaming Results In the streaming model of computation, the input arrives sequentially. This differs from the standard model where the algorithm is given free access to the entire input. Given a memory that is linear in the size of the input, these models are evidently equivalent; therefore the goal of a streaming algorithm is to perform the computation using a sublinear amount of memory. Our stream consists of n elements p1 , . . . , pn . In the streaming model (or more specifically the insertion-only streaming model, since points that arrive will never be deleted), we attempt to compute our solution using o(n) memory. Sometimes the algorithm will be allowed to pass over the stream multiple times, resulting in another parameter called the number of passes. All of our algorithms use polylog(n) memory and require only a single pass. 1 Prior to the current work, the merge-and-reduce technique due to Har-Peled and Mazumdar [HPM04] and Bentley and Sax [BS80] was used to maintain a coreset on an insertion-only stream. For a summary of this technique, see Section 7 in the Appendix. In this paper we introduce an alternative technique that reduces the multiplicative overhead from log2a+1 n to log n (here, a is the offline construction’s dependence on 1/). While our method is not as general as merge-and-reduce (it requires that the function in question satisfies more than just the “merge” and “reduce” properties, defined in Section 7), it is general enough to apply to all M -estimators. For the special case of our coreset offline construction for M -estimators (introduced in Section 6), we use a more tailored method that causes this to be log n additive overhead. Therefore our streaming space complexity matches our offline space complexity, both of which improve upon the state-of-the-art. The offline coreset construction of [FL11] has the following structure: first, a bicriterion approximation is computed. Second, points are sampled according a distribution that depends only on the distances between points of the input and their assigned bicriterion centers. This suggests a two-pass streaming algorithm (which we later combine into a single pass): in the first pass, construct a bicriterion using an algorithm such as [BMO+ 11]. In the second pass, sample according to the bicriterion found in the first pass. This provides a two-pass algorithm for a coreset using O(−2 k log k log n)-space. Our contribution is showing how these two passes can be combined into a single-pass. Using the algorithm of [BMO+ 11] to output O(k log n) centers at any time, we show that this is sufficient to carry out the sampling (originally in the second pass) in parallel without re-reading the stream. Our main lemma (Lemma 3.7) shows that the bicriterion, rather than just providing “central” points to concentrate the sampling, actually can be thought of as a proof of the importance of points for the coreset (technically, a bound on the “sensitivity” that we define at the beginning of Section 3). Moreover, the importance of points is non-increasing as the stream progresses, so we can maintain a sample in the streaming setting without using any additional space. 1.2 Offline Results The name coreset was suggested by Agarwal, Har-Peled, and Varadarajan in [AHPV04] as a small subset S of points for a given input set P , such that any shape from a given family that covers S will also cover P , after expanding the shape by a factor of (1 + ε). In particular, the smallest shape that covers S will be a good approximation for the smallest shape that covers P . For approximating different cost functions, e.g. the sum of distances to a given shape, we expect that the total weight of the sample will be similar to the number n of input points. Hence, in their seminal work [HPM04], Har-Peled and Mazumdar used multiplicative weights for each point in S, such that the weighted sum of distances from S to a given shape from the family will approximate its sum of distances from the original data. In [HPM04] each shape in the family was actually a set of k points, and the application was the classic k-means problem. In this paper, we are given an input set P (called points), a family (set) Q of items, called queries and a function f : P → [0, ∞) that is called a cost function. A coreset is then a subset S of P , that is associated with a non-negative weight function u : S → [0, ∞) such 2 P that, for every given query q ∈ Q, the sum of original costs p∈P f (p, q) is approximated by P the weighted sum p∈S u(p)f (p, q) of costs in S up to a multiplicative factor, i.e., X X X (1 − ε) f (p, q) ≤ u(p)f (p, q) ≤ (1 + ε) f (p, q) p∈P p∈S p∈P While our framework is general we demonstrate it on the k-means problem and its variant. There are at least three reasons for this: (i) This is a fundamental problem in both computer science and machine learning, (ii) This is probably the most common clustering technique that used in practice, (iii) Many other clustering and non-clustering problems can be reduced to k-means; e.g. Mixture of Gaussians, Bregman Clustering, or DP-means [FFK11, LBK15, BLK15]. In this context we suggest offline coreset constructions for k-clustering queries, that can be constructed in a streaming fashion using our streaming approach, and are: • of size linear in k (for d > log k) and arbitrary metric space of dimension d. Current coresets that are subset of the input have size at least cubic in k [LS10]. This is by reducing the total sensitivity to O(1) without introducing negative weights that might be conditioned on the queries as in [FL11]. • of size independent of d for the Euclidean case of k-means (squared distances). This is particular useful for sparse input set of points where d ≥ n, such as in adjacency matrices of graphs, document-term, or image-object matrices. Recent coreset for sparse k-means of [BF15] is of size exponential in 1/ε and thus turn to O(n) when used when the merge-and-reduce tree (where ε is replaced by O(ε/ log(n)). The result of [FSS13] for k-means is exponential in k/ε and fails with constant probability, so also cannot be used with streaming. Another result of [FSS13] suggests a coreset type set for kmeans of size O(k/ε) but which is based on projections that loss the sparsity of the data. Similar sparsity loss occurs with other projection-type compression methods e.g. in [CEM+ 15]. Nevertheless, we use the technique in [FSS13] to bound the dimension of the k-means problem by O(k/ε). • of size independent of d for the Euclidean case, and non-squared distances, using weak coresets. These coresets can be used to approximates the optimal solution, but not every set of k centers. Unlike the weak coresets in [FL11, FMS07], we can use any existing heuristic on these coresets, as explained in Section 6.1. • Robust to outliers. This is since the general pseudo-metric definition we used (inspired by [FS12], support m-estimators which is a tool for handling outliers [Tyl87]. Unlike in [FS12] our coresets are linear (and not exponential) in k, and also independent of n (and not logarithmic in n). 2 Related Work The following table summarizes previous work along with our current results. By far, the most widely-studied problems in this class have been the k-median and k-means func3 tions. In general, the extension to arbitrary M -estimators is non-trivial; the first such result was [FS12]. Our approach naturally lends itself to this extension. M -estimators are highly important for noisy data or data with outliers. As one example, Huber’s estimator is widely used in the statistics community [HHR11, Hub81]. It was written that “this estimator is so satisfactory that it has been recommended for almost all situations” [Zha11]. Our results work not only for Huber’s estimator but for all M -estimators, such as the Cauchy and Tukey biweight functions which are also well-used functions. Note that in the below table, Õ notation is used to write in terms of d, , k, and log n (therefore hiding factors of log log n but not log n). Problem Offline Size Streaming Size −d Euclidean k-means O(k log n) O(k−d logd+2 n) Euclidean k-means O(k 3 −(d+1) ) O(k 3 −(d+1) logd+2 n) Euclidean k-means O(dk 2 −2 log n) O(dk 2 −2 log8 n) Euclidean k-means O(dk log k−4 ) O(dk log k−4 log5 n) Õ((d/)O(d) k log n) Õ((d/)O(d) k logO(d) n) Euclidean k-means −2 −2 Euclidean k-means O( k log k min(k/, d)) O( k log k min( k , d) + k log n) Metric k-means O(−2 k 2 log2 n) O(−2 k 2 log8 n) Metric k-means O(−4 k log k log n) O(−4 k log k log6 n) −2 Metric k-means O( k log k log n) O(−2 k log k log n) Õ(dk 2 −2 log n) Euclidean k-median O(dk 2 −2 log8 n) Euclidean k-median O(k−d log n) O(k−d logd+2 n) Euclidean k-median O(k 2 −d ) O(k 2 −(d) logd+1 n) Euclidean k-median O(d−2 k log k) O(d−2 k log k log3 n) Euclidean k-median O(d−2 k log k) O(d−2 k log k + k log n) 2 Metric k-median O(k 2 −2 log n) O(k 2 −2 log8 n) Metric k-median O(−2 k log k log n) O(−2 k log k log4 n) Metric k-median O(−2 k log k log n) O(−2 k log k log n) 2 Euclidean M -estimator O(−2 k O(k) d2 log n) O(−2 k O(k) d2 log5 n) Euclidean M -estimator O(d−2 k log k) O(d−2 k log k + k log n) Metric M -estimator O(−2 k O(k) log4 n) O(−2 k O(k) log7 n) −2 Metric M -estimator O( k log k log n) O(−2 k log k log n) Paper [HPM04] [HPK07] [Che09a] [FL11] [AMR+ 12] ** [Che09b] [FL11] ** [Che09a] [HPM04] [HPK07] [FL11] ** [Che09a] [FL11] ** [FS12] ** [FS12] ** Table 1: Summary of Related Work Framework. A generic framework for coreset construction was suggested in [FL11]. The main technique is a reduction from coreset to ε-approximations, that can be computed using non-uniform sampling. The distribution of the sampling is based on the importance of each point (in some well defined sense), and the size of the coreset depends on the sum of these importance levels. This term of importance appeared in the literature as leverage score (in the context of low-rank approximation, see [PKB14] and references therein), or, for the case of k-clustering, sensitivity [LS10]. The proof of many previous coreset constructions were 4 significantly simplified by using this framework, and maybe more importantly, the size of these coresets was sometimes significantly reduced; see [FL11] for references. Many of these coresets size can be further improve by our improved framework, as explained below. The size of the coreset in [FL11] depends quadratically on the sum of sensitivities, called total sensitivity [LS10]. In this paper, we reduce the size of the coreset that are constructed by this framework to be only near-linear (t log t) in the total sensitivity t. In addition, we generalize and significantly simplify the notation and results from this framework. k-means. In the k-means problem we wish to compute a set k of centers (points) in some metric space, such that the sum of squared distances to the input points is minimized, where each input point is assigned to its nearest center. The corresponding coreset is a positively weighted subset of points that approximates this cost to every given set of k centers. First deterministic coresets of size exponential in d were first suggested by HarPeled and Mazumdar in [HPM04]. The first coreset construction of size polynomial in d was suggested by Ke-Chen in [Che09a] using several sets of uniform sampling. The state-of-the-art is the result of Schulman and Langberg [LS10] who suggested a coreset of size O(d2 k 3 /ε2 ) for k-means in the Euclidean case based on non-uniform sampling. The distribution is similar to the distribution in [FMS07] over the input points, however in [FMS07] the goal was to have weaker version coresets that can be used to solve the optimal solution, but are of size independent of d. Some kind of coreset for k-means of size near-linear in k was suggested in [FL11]. However, unlike the definition of this paper, the multiplicative weights of some of the points in this coreset were (i) negative, and (ii) depends on the query, i.e., instead of a weight w(p) > 0 for an input point p, as in this paper, the weight is w(p, C) ∈ R where C is the set of queries. While exhaustive search was suggested to compute a PTAS for the coreset, it is not clear how to compute existing algorithms or heuristics (what is actually done in practice) on such a coreset. On the contrary, generalizing an existing approximation algorithm for the k-means problem to handle positively weights is easy, and public implementations are not hard to find (e.g. in Matlab and Python). k-mean for handling outliers. Coresets for k-means and its variants that handle outliers via m-estimators were suggested in [FS12], and also inspired our paper. The size of these coresets is exponential in k and also depend on logn. For comparison, we suggest similar coreset of size near-linear in k, and independent of n. PTAS for handling exactly m-outliers was suggested in [Che08] but with no coreset or streaming version. Streaming. The metric results of [Che09a, FL11] and Euclidean results of [Che09a, HPM04, HPK07, FL11] that rely on merge-and-reduce have already been mentioned. A summary of these results appears in the tables below. For the specific case of Euclidean space, a more diverse set of stronger results is known. In particular, coreset constructions are known that do not begin with a bicriterion solution, and whose streaming variant does not rely on merge-and-reduce [AMR+ 12]. With the additional assumption in Euclidean 5 space that the points lie on a discrete grid {1, . . . , ∆}d , alternative techniques are known for k-means and other problems, even when the stream allows the deletion of points [FS05]. 3 Streaming Algorithm We present a streaming algorithm for constructing a coreset for metric k-means clustering that requires the storage of O(−2 k log n) points. The previous state-of-the-art [FL11] required the storage of O(−4 k log k log6 n) points. In this section we assume the correctness of our offline algorithm, which is proven in Section 6. More generally, our technique works for M -estimators, a general class of clustering objectives that includes the well-known k-median and k-means functions as special cases. Other special cases include the Cauchy functions, the Tukey functions, and the Lp norms. Our method combines a streaming bicriterion algorithm [BMO+ 11] and a batch coreset construction [FL11] to create a streaming coreset algorithm. The space requirements are combined addivitely, therefore ensuring no overhead. The streaming algorithm of [BMO+ 11] provides a bicriterion solution using O(k log n) space. Our new offline construction of Section 6 requires O(−2 k log k log n) space. Therefore our main theorem yields a streaming algorithm that combines these spaces additively, therefore requiring O(−2 k log k log n) space while maintaining a coreset for k-means clustering. The previous state-of-the-art framework that works for the metric variant (other methods are known to improve upon this for the special case of Euclidean space) was the mergeand-reduce technique [BS80] that yields a streaming algorithm requiring O(−4 k log k log6 n) space, incurring an overhead of Θ(log5 n) over the offline coreset size. In comparison, our framework incurs no overhead. The additional improvement in our space is due the improved offline construction given in Sections 5-7. We now state our main theorem. The result is stated in full generality: the k-median clustering in a ρ-metric space (see Definition 6.1). Note that metric k-means clustering corresponds to setting ρ = 2. Also, the probability of success 1 − δ typically has one of two meanings: that the construction succeeds at the end of the stream (a weaker result), or that the construction succeeds at every intermediate point of the stream (a stronger result). Our theorem gives the stronger result, maintaining a valid coreset at every point of the stream. Theorem 3.1 (Main Theorem). There exists an insertion-only streaming algorithm that maintains a (k, )-coreset for k-median clustering in a ρ-metric space, requires the storage of O(ρ2 −2 k log(ρk) log(n) log(1/δ)) points, has poly(k, log n, ρ, , log(1/δ)) worst-case update time, and succeeds at every point of the stream with probability 1 − δ. Our method can be applied to the coreset constructions of [HPM04, HPK07, Che09a, FL11] with a multiplicative overhead of O(log n). Our second theorem is a more generally applicable technique; it applies to all constructions that first compute a bicriterion solution and then sample points according to the bicriterion solution. The constructions of [HPM04, HPK07, Che09a, FL11] follow this outline, and we are unaware of any constructions which do 6 not. The theorem yields immediate corollaries as well as reducing certain streaming coreset problems to that of constructing an offline coreset. Theorem 3.2. Given an offline algorithm that constructs a (k, )-coreset consisting of S = S(n, k, , δ) points with probability 1 − δ by sampling points based on a bicriterion solution, there exists a streaming algorithm requiring the storage of O(S log n) points that maintains a (k, )-coreset on an insertion-only stream. Proof Sketch. The known offline coreset constructions start with a bicriterion solution of O(k) points. We modify the algorithm of [BMO+ 11] to output O(k log n) centers; this is trivial since the final step of the algorithm of [BMO+ 11] is to take the O(k log n) centers stored in memory and reduce them to exactly k centers to provide a solution. Our first modification to the original algorithm is thus to simply remove this final step, but we must also keep a datastructure storing log(1/) intermediate states of these O(k log n) centers. See Section 8 for a precise description of our modification and the sampling method, applied to the construction of [FL11] as an example (but equally applicable to [HPM04, HPK07, Che09a]). As the high-level idea, since the bicriterion given to the offline construction consists of O(k log n) centers instead of exactly k, the number of additional points taken in the coreset increases by a factor of O(log n). Two important corollaries include: 1. Using the result of [FL11], we obtain a streaming algorithm that maintains a (k, )coreset with negative weights for metric k-median requiring the storage of O(−2 k log n) points. 2. Given a O(k · poly(, log n, log(1/δ))) point (k, )-coreset, we would obtain a streaming algorithm that maintains a (k, )-coreset (with only positive weights) for metric kmedian requiring the storage of O(k · poly(, log n, log(1/δ))) points. This differs from Theorem 3.1 in that the dependence on k is linear instead of O(k log k). 3.1 Definitions We begin by defining a ρ-metric space, which is defined in full as Definition 6.1. Briefly, let X be a set. If D : X × X → [0, ∞) is a symmetric function such that for every x, z ∈ X we have that D(x, z) ≤ ρ(D(x, y) + D(y, z)) for every y ∈ X, when we call (X, D) a ρ-metric space. Note that this is a weakening of the triangle inequality, and at ρ = 1 we recover the definition of a metric space. All M -estimators can be re-cast for a certain constant value of ρ, and k-means is obtained with ρ = 2. This generality is therefore useful and working in this language allows us to naturally generalize our results to any M -estimator. The k-median problem is, given an input set P and an integer k ≥ 1, to find a set C of k points that minimizes: X min D(p, c) p∈P c∈C 7 We use OPTk (P ) to denote this minimal value. As this is NP-Hard to compute, we settle for an approximation. The notion of a bicriterion approximation is well-known; we state a definition that suits our needs while also fitting into the definition of previous works. Definition 3.3 ((α, β)-approximation). An (α, β)-approximation forP the k-median clustering of a multiset P is a map π : P → B for some set B such that p∈P w(p)D(p, π(p)) ≤ αOPTk (P ) and |B| ≤ βk. We now define a coreset: Definition 3.4 ((k, )-coreset). A (k, )-coreset of a multiset P is a weighted Pset (S, v) with k non-negative weight functionPv such that for every Z ∈ X we have (1 − ) p∈P D(p, Z) ≤ P s∈S v(s)D(s, Z) ≤ (1 + ) p∈P D(p, Z). Coresets with arbitrary weight functions (i.e. with negative weights allowed) have been considered [FL11, etc]. However, computing approximate solutions on these coresets in polynomial-time remains a challenge, so we restrict our definition to non-negative weight functions. This ensures that an approximate solution can be quickly produced. This implies a PTAS for Euclidean space and a polynomial-time 2γ(1 + )-approximation for general metric spaces (where γ is the best polynomial-time approximation factor for the problem in the batch setting). This factor of 2γ(1 + ) is well-known in the literature, see [COP03, BMO+ 11, GMM+ 03] for details. 3.2 Constant-Approximation Algorithm Let Pi denote the prefix of the stream {p1 , . . . , pi }. The entire stream is then Pn . Consider the moment when the first i points have arrived, meaning that the prefix Pi is the current set of arrived points. The algorithm A of [BMO+ 11] provides an (O(1), O(log n))-approximation of Pi in the following sense. Define f0 : ∅ → ∅ as the null map, and define Bi = image(fi ). Upon receiving point pi , algorithm A defines a map fi : Bi−1 ∪ {pi } → Bi . We define πi : Pi → Bi by πi (pj ) = fi (fi−1 (. . . (fj (pj )) . . .)) for each 1 ≤ j ≤ i. These mappings have an essential gaurantee stated in the following lemma. Theorem 3.5 ([BMO+ 11]). For every 1 ≤ i ≤ n, after receiving Pi , Algorithm A(k, n, δ) definesP a function fi such that with probability 1 − δ, using the above definition of πi , the bound p∈Pi D(p, πi (p)) ≤ αOPTk (Pi ) holds. The algorithm deterministically requires the storage of O(k(log n + log(1/δ))) points. 3.3 Offline Coreset Construction We briefly describe the offline coreset construction. The proof of correctness can be found in Sections 5 and 6. It is this construction that we will maintain in the streaming setting. The sensitivity of a point p ∈ P is defined as: D(p, Z) q∈P D(q, Z) s(p) = max P Z∈X k 8 0 Notice that 0 ≤ P s(p) ≤ 1. We give an upper bound s (p) ∈0 [s(p), 1]. Define Pthe total 0 sensitivity t = p∈P s(p). Likewise, we give an upper bound t ≥ t where t = p∈P s0 (p) and will show that t = O(k). The sampling probability distribution at point p is set to s0 (p)/t0 . We take an i.i.d. sample from P of size m for any m ≥ ct0 −2 (log n log t0 + log(1/δ)) where c is a constant. Let R be the union of these m i.i.d. samples, and then define a weight function v : R → [0, ∞) where v(r) = (|R|s0 (r))−1 . It is proven as one of our main theorems (Theorem 6.6) that the weighted set (R, v) is a (k, )-coreset for P . 3.4 Bounding the Sensitivity Consider the prefix Pi which is the input after the first i points have arrived. Using Algorithm A we obtain an (α, β)-approximation πi where α = O(1) and β = O(log n). Recall that Bi is the image of this approximation, i.e. Bi = image(πi (Pi )). Running an offline (γ, λ)-approximation algorithm on Bi , we obtain a multiset Ci of at most λk distinct points. Let p0 denote the element of Ci nearest to πi (p) (this is the element of Ci P that p gets mapped to when we pass from Pi → Bi → Ci ). The following lemma implies that p∈P w(p)D(p, p0 ) ≤ ᾱOPT(P ) where ᾱ = ρα + 2ρ2 γ(α + 1). This is an observation used widely in the literature [COP03, BMO+ 11], but we include a proof for completeness. Lemma 3.6. Let B be a (α, β)-approximation of P , and let C be a (γ, λ)-approximation of B. Then C is a (ρα + 2ρ2 γ(α + 1), λ)-approximation of A. Proof. Let π : P → B be the (α, β)-approximation of P and let t : B → C be the (γ, λ)approximation P of B. In the following, all sums P will be taken over all p ∈ P . The hypotheses ∗ state that D(p, π(p)) ≤ αOPT P Let P be∗ an P(P ) and∗ D(π(p), t(π(p))) 1≤ γ OPT(B). D(π(p), P ) ≤ optimal clustering of P , that is D(p, P ) = OPT(P ). Then 2 OPT(B) ≤ P ρ (D(π(p), p) + D(p, P ∗ )) ≤ ρ(α + 1)OPT(P ). The factor of 12 comes from the fact that OPT(B) is defined using centers restricted to B (see [GMM+ 03] for details). We now write P P D(p, t(π(p))) ≤ ρ (D(p, π(p))+D(π(p), t(π(p)))) ≤ (ρα+2ρ2 γ(α+1))OPT(P ) as desired. We now prove the following lemma which gives us our sampling probability s0 (p). Recall that for the construction to succeed, the sampling probability s0 (p) must be at least the sensitivity s(p) (defined in the previous subsection). Since we focus on a single iteration, we drop subscripts and write C = Ci and P = Pi . Let p 7→ p0 be an (ᾱ, λ)-approximation of P . Define P (p) = {q ∈ P : q 0 = p0 } to be the cluster containing p. Lemma 3.7. Let the map p 7→ p0 define an (ᾱ, λ)-approximation for the k-median clustering of P . For every point p ∈ P : ρᾱD(p, p0 ) ρ2 (ᾱ + 1) P s(p) ≤ + 0 |P (p)| q∈P D(q, q ) 9 Proof. For an arbitrary Z ∈ X k we need to provide a uniform bound for ρD(p, p0 ) ρD(p0 , Z) D(p, Z) P P ≤ + q∈P D(q, Z) q∈P D(q, Z) q∈P D(q, Z) P ρD(p0 , Z) ᾱρD(p, p0 ) P + ≤P 0 q∈P D(q, q ) q∈P D(q, Z) (1) P P where the second inequality holds because q∈P D(q, q 0 ) ≤ ᾱOPT(P ) ≤ q∈P D(q, Z). To bound the last term, recall that q 0 = p0 for all q ∈ P (p) so: X X D(p0 , Z)|P (p)| = D(p0 , Z) = D(q 0 , Z) q∈P (p) ≤ρ q∈P (p) X (D(q 0 , q) + D(q, Z)) q∈P (p) ≤ρ X D(q 0 , q) + ρ q∈P ≤ ρᾱ X D(q, Z) q∈P (p) X D(q, Z) + ρ q∈P X D(q, Z) q∈P (p) ≤ ρ(ᾱ + 1) X D(q, Z) q∈P Dividing by |P (p)| P q∈P D(q, Z) gives ρ(ᾱ + 1) D(p0 , Z) ≤ |P (p)| q∈P D(q, Z) P Substituting this in (16) yields the desired result. We therefore define our upper bound s0 (p) as in the An immediate but extremely P lemma. 0 0 important consequence of Lemma 3.7 is that t = p∈P s (p) = ρᾱ + ρ2 (ᾱ + 1)k ≤ 3ρ2 ᾱk. This can be seen by directly summing the formula given in the lemma. 3.5 Streaming Algorithm We now state Algorithm 1, which we then prove maintains a coreset. To use Lemma 3.7 0 to P determine0 s (p), we will compute the cluster sizes |P (p)| and estimate the clustering cost q∈P D(q, q ). We must bound the clustering cost from below because we need an upperbound of s(p). On Line 9, L is an estimate of the cost of clustering P to the centers C. On Line 4, c is the absolute constant used in Theorem 6.6. Algorithm 1 outputs (R, v) such that point p is sampled with probability xs0 (p) where x is defined on Line 4. For each p that has arrived, the value of s0 (p) is non-increasing (notice that it is defined as the minimum of itself and a new value on Line 13), so it is possible to 10 Algorithm 1: Input: stream of n points in a ρ-metric space,  > 0, k ∈ N, maximum failure probability δ > 0 1 Initilization: 2 R ← ∅ 0 2 3 t ← ρᾱ + ρ (ᾱ + 1)k −2 0 4 x ← 2c (log n log t + log(1/δ)) 5 Initialize A(k, n, δ) 6 Update Process: after receiving pi 7 (Bi , fi ) ← A.update(pi ) 8 C ← an (γ, λ)-approximation of Bi P −1 −1 9 L ← D(pi , C) + ᾱ (1 + ) r∈R v(r)D(r, C) 10 for r ∈ R do 11 πi (s) ← fi (πi−1 (r)) 0) 2 12 z(r) ← ρᾱD(p,p + ρ|P(ᾱ+1) L (p)| 13 s0 (r) ← min(s0 (r), z(r)) 14 for r ∈ R do 15 if u(r) > xs0 (r) then 16 Delete r from R 17 u(pi ) ← uniform random from [0, 1) 0 18 if u(pi ) ≤ xs (pi ) then 19 Add pi to R 20 πi (pi ) ← fi (pi ) 21 Query Process: 22 for each r ∈ R do 23 v(r) ← (|R|s0 (r))−1 11 maintain this in the streaming setting since once the deletion condition on Line 15 becomes satisfied, it remains satisfied forever. We now proceed with the proof of Theorem 1. Since the probability of storing point p is xs0 (p), the expected space of Algorithm 1 is xt0 . By Lemma 3.7 that implies t0 ≤ 3ρ2 ᾱk, we then bound the expected space as 2c−2 (log n log t + log(1/δ))(3ρ2 ᾱk). Simplifying notation by defining an absolute constant c̃ (a function of c and ᾱ), we write this expected space as c̃ρ2 −2 k log(ρk) log n log(1/δ). By a Chernoff bound, the high-probability gaurantee follows by replacing c̃ with 2c̃. Proof of Theorem 1. The proof of Theorem 1 can be divided into the following pieces: 1. P For correctness (to satisfy the bound given in Lemma 3.7, we must show that L ≤ 0 p∈Pi D(p, p ). For space, it is important that L is not too small. In particular, the space grows as 1/L. We show that L is a -approximation of the true cost. 2. The value of |P (p)| can be computed exactly for every p. This is needed on Line 12. 3. The construction of Algorithm 1 that samples p with probability xs0 (p) can be processed to be identical to the offline construction of Subsection 3.3 that takes an i.i.d. sample of size xt0 from the distribution where p is given sampling probability s0 (p)/t0 . 1: To lower bound the clustering cost, inductively assume that we have a (k, )-coreset Si−1 of Pi−1 . Note that pi is a (k, )-coreset of itself (in fact a (k, 0)-coreset of itself), so Si−1 ∪ {pi } is a (k, )-coreset of Pi . Let L be the cost of clustering Si−1 ∪ {pi } to C. Therefore the cost of clustering Pi to C is in the interval [(1 − )L, (1 + )L]. Recall that the upper bound on s(p) from Lemma 3.7 is: ρᾱD(p, p0 ) ρ2 (ᾱ + 1) P + 0 |P (p)| q∈P D(q, q ) P 0 0 0 By using L in place of the true cost p∈Pi D(p, p ) for defining s (p), the value of t =  P 1+ 0 2 4 p∈Pi s (p) increases to at most ρᾱ 1− +ρ (ᾱ+1)λk = O(ρ k). Here there is no dependence 1+ is bounded by an absolute constant. on  since we assume  ≤ 1/2, so 1− 2: Computing |P (p)| is straightforward. Define w(b) = |{p ∈ P P : π(p) = b}| and then let h : B → C be the (γ, λ)-approximate clustering. Then |P (p)| = b∈h−1 (p0 ) w(b). 3: In Algorithm 1, we sample point p with probability s0 (p) to maintain a set M of non-deterministic size. We now argue that this can be converted to the desired coreset, where an i.i.d. sample of size m is taken from the distribution s0 /t0 . First, by a Chernoff bound, |R| ≥ E[|R|]/2 with probability 1 − exp(−E[|R|]/8). Since E[|R|] = xt0 = (2c−2 log(ρk) log n log(1/δ)) · (ρᾱ + ρ2 (ᾱ + 1)k) = Ω(log(n)), we have that |R| ≥ E[|R|]/2 with probability 1 − O(1/n). Then by the union bound, this inequality holds true at each of the n iterations of receiving a point throughout the entire stream. Recall that for the offline coreset construction outlined in Subsection 3.3 to hold, we need an i.i.d. sample of at least m = ct0 −2 (log n log t0 + log(1/δ)). By Lemma 3.7 t0 = ρᾱ + ρ2 (ᾱ + 1)k, and so by plugging in values we see that E[|R|] = xt0 ≥ 2m. Having that |R| ≥ m with probability 1 − O(1/n), 12 it is well-known (see [DDH+ 07] for example) that this can be converted to the required i.i.d. sample. 4 4.1 Preliminaries for Offline Coreset Construction Query space In our framework, as in [FL11], we are given a finite input set P of items that are called points, a (usually infinite) set Q of items that are called queries, and a cost function f that maps each pair of a point in P and a query in Q to a non-negative number f (p, q). The cost of the set P to this query is the sum over all the costs, X f¯(P, q) := f (p, q). p∈P More generally, each input point might be given a positive multiplicative weight w(p) > 0, and the overall cost of each point is then reweighed, so that X w(p)f (p, q). f¯(P, w, q) = p∈P The tuple (P, w, f, Q) is thus define our input problem and we call it a query space. In the case that the points are unweighted we can simply define w(p) = 1 for every p ∈ P . However, for the following sections, it might help to scale the weights so that their sum is 1. In this case, we can think of the weights as a given distribution over the input points, and the cost f¯(P, w, q) is the expected value of f (p, q) for a point that is sampled at random from P . For the unweighted case we thus have w(p) = 1/n for each point, and 1X f (p, q) f¯(P, w, q) = n p∈P is the average cost per point. The cost function f is usually also scaled as will be explained later, to have values f (p, q) between 0 and 1, or −1 to 1. Example 1: Consider the following problem where the input is a set P of n points in d R . Given a ball B = B(c, r) of radius r that is centered in c ∈ Rd , we wish to compute the fraction of input points that are covered by this ball, |P|P∩B| . More generally, the query is a | set of k balls, and we wish to compute the fraction of points in P that are covered by the union of these balls. In this case, each input point p ∈ P has a weight w(p) = 1/n, the set Q of queries is the union over every k balls in Rd ,  Q = B(c1 , r1 ) ∪ · · · ∪ B(ck , rk ) | ∀i ∈ [k] : ci ∈ Rd , ri ≥ 0 , (2) and the cost f (p, q) for a query q = {B1 ∪ · · · ∪ Bk } ∈ Q is Peither 1/n if p is inside one of the balls of q, and 0 otherwise. The overall cost f¯(P, w, q) = p∈P f (p, q) is thus the fraction of points of P that are covered by the union of these k balls. 13 The motivation of defining query spaces is usually to solve some related optimization problem, such as the query q that minimizes the cost f¯(P, w, q). In this case, the requirement to approximate every query in Q is too strong, and we may want to approximate only the optimal query in some sense. To this end, we may wish to replace the set Q by a function that assigns a different set of queries Q(S) for each subset S of P . For the correctness of our results, we require that this function Q will be monotonic in the following sense: if T is a subset of S then Q(T ) must be a subset of Q(S). If we wish to have a single set Q(P ) of queries as above, we can simply define Q(S) := Q(P ) for every subset S of P , so that the desired monotonic property will hold. Example 2: For the set Q in (2), define Q(S) to be the set of balls in Rd such that the center of each ball is a point in S. More generally, we can require that the center of each ball will be spanned by (i.e., linear combination of) at most 10 points from S. We now conclude with the formal definitions for the above discussion. Definition 4.1 (weighted set). Let S be a subset of some set P and w : P → [0, ∞) be a function. The pair (S, w) is called a weighted set. Definition 4.2 (query space). [FL11]. Let Q be a function that maps every set S ⊆ P to a corresponding set Q(S), such that Q(T ) ⊆ Q(S) for every T ⊆ S. Let f : P × Q(P ) → R be a cost function. The tuple (P, w, Q, f ) is called a query space. We denote the cost of a query q ∈ Q(P ) by X w(p)f (p, q). f (P, w, q) := p∈P 4.2 (ε, ν)-Approximation Consider the query space (P, w, Q, f ) in Example 1 for k = 1, and suppose that we wish to compute a set S ⊆ P , such that, for every given ball B, the fraction of points in P that are covered by B, are approximately the same as the fraction of the points that are covered in S, up to a given small additive percentage error ε > 0. That is, for every ball B, |P ∩ B| |S ∩ B| − ≤ ε. |P | |S| By defining the weight u(p) = 1/|S| for every p ∈ S, this implies that for every query (ball) q = B, f¯(P, w, q) − f¯(S, u, q) = X 1 X 1 |P ∩ B| |S ∩ B| · f (p, q) − · f (p, q) = − ≤ ε. |P | |S| |P | |S| p∈P p∈S A weighted set (S, u) that satisfies the last inequality for every query q ∈ Q(S) is called an ε-approximation for the query space (P, w, f, Q). Note that the above example assumes that the maximum answer to a query q is f (p, q) ≤ 1. Otherwise, the error guaranteed by an ε-approximation for a query q is ε maxp∈P |f (p, q)|. 14 The above inequalities implies that if a ball covers a fraction of at least ε points from P (i.e., at least εn points), then it must cover at least one point of P . If we only ask for this (weaker) property from S then S is called an ε-net. To obtain the new results of this paper, we use a tool that generalizes the notion of ε-approximation and ε-net, but less common in the literature, and is known as (ε, ν)-approximation [LLS01]. By letting a = f¯(P, w, q) and b = f¯(S, u, q), an ε-approximation implies that |a − b| ≤ ε for every query q, and ε-net implies that b > 0 if a ≥ ε. Following [LLS00], we define below a distance function that maps a positive real |a − b|ν for each pair of positive real numbers a and b. A specific value ν will imply |a − b|ν ≤ ε, i.e., that S is an ε-approximation, and a different value of ν will imply that S is an ε-net for P . This is formalized as follows. Definition 4.3 ((ε, ν)-approximation [LLS00]). Let ν > 0. For every a, b ≥ 0, we define the distance function |a − b| . |a − b|ν = a+b+ν P Let (P, w, Q, f ) be a query space such that p∈P w(p) = 1 and f : P → [0, 1]. For ε > 0, a weighted set (S, u) is an (ε, ν)-approximation for this query space, if for every q ∈ Q(S) we have f (P, w, q) − f (S, u, q) ν ≤ ε (3) Corollary 4.4 ( [LLS00, HP11]). Let a, b ≥ 0 and τ, ν > 0 such that |a − b|ν ≤ τ . Let ε > 0. Then (i) (ε-sample/approximation). If τ = ε/4 and ν = 1/4 then |a − b| ≤ ε. (ii) (ε-net). If τ = 1/4 and ν = ε then (a ≥ ε ⇒ b > 0). (iii) (Relative ε-approximation). Put µ > 0. If ν = µ/2 and τ = ε/9 then (1) a ≥ µ (2) a < µ 4.3 ⇒ ⇒ (1 − ε)a ≤ b ≤ (1 + ε)a. b ≤ (1 + ε)µ. Constructing ε-Approximations Unlike the notion of coresets in the next section, the idea of ε-approximations is known for decades [VC71, Mat89]. In particular, unlike coresets, ε-approximations and (ε, ν)approximations in general, can be constructed using simple uniform random sampling of the points. The size of the sample depends linearly on the complexity of the queries in the sense soon to be defined in this section. Intuitively, and in most practical cases, including the examples in this paper, this complexity is roughly the number of parameters that are needed to define a single query. For 15 example, a ball in Rd can be defined by d + 1 parameters: its center c ∈ Rd , which is defined using d numbers and the radius r > 0 which is an additional number. A query of k balls is similarly defined by k(d + 1) parameters. However, by the set theory we have |R| = |Rm | for every integer c ≥ 1, which means that we can encode every m integers to a single integer. We can thus always reduce the number of parameters that are needed to define a query from m to 1 by redefining our cost function f and re-encoding the set of queries. There are also natural examples of query spaces whose cost function f is defined by one parameter, but the size of the sampling needed for obtaining an ε-approximation is unbounded, e.g., the query space where f (p, q) = sign(sin(pq)) and P = Q = Rd , where sign(x) = 1 if x > 0 and 0 otherwise; see details e.g. in [?]. Hence, a more involved definition of complexity is needed as follows. While the number of subsets from a given set of n points is 2n , its can be easily verified that the number of subsets that can be covered by a ball in Rd is roughly nO(d) . The exponent O(d) is called the VC-dimension of the family of balls in Rd . The following definition is a simple generalization by [FL11] for query spaces where the query set is a function and not a single set. The original definition of pseudo-dimension can be found e.g. in [LLS00] and is very similar to the definition of VC-dimension given by [VC71] as well as many other similar measures for the complexity of a family of shapes. Definition 4.5 (dimension [FL11]). For a query space (P, w, Q, f ) and r ∈ [0, ∞) we define range(q, r) = {p ∈ P | w(p) · f (p, q) ≤ r} . The dimension of (P, w, Q, f ) is the smallest integer d such that for every S ⊆ P we have {range(q, r) | q ∈ Q(S), r ∈ [0, ∞)} ≤ |S|d . The main motivation of the above definition, is that it tells us how many samples we need to take uniformly at random from the input set P , to get an (ε, ν)-approximation (S, u) as follows. Theorem 4.6 ([VC71, LLS00, FL11]). Let (P, w, Q, f ) be a query space of dimension d such P that p∈P w(p) = 1 and f : P → [0, 1], and let ε, δ, ν > 0. Let S be a random sample from P , where every point p ∈ P is sampled independently with probability w(p). Assign a weight 1 for every p ∈ S. If u(p) = |S| 1 |S| ∈ Ω(1) · 2 εν      1 1 d log + log ν δ then, with probability at least 1 − δ, (S, u) is an (ε, ν)-approximation for the query space (P, w, Q, f ). 16 5 Improved Coreset Framework 5.1 Improved (ε, ν)-approximations In this section we show the first technical result of this paper: P that the additive error ε maxp∈P |f (p, q)| in (3) can be replaced by ε, and the assumption i=1 wi = 1 in Theorem 4.6 can be removed. The condition for this to work is that the total importance value t, as defined below, is small. More precisely, the required sample size will be near-linear with t. Also, the uniform sampling in Theorem 4.6 will be replaced by non-uniform sampling with a distribution that is proportional to the importance of each point. This result is essentially a generalization and significant simplification of the framework in [FL11] that used ε-approximations for constructing coresets. Maybe more importantly: using the idea of (ε, ν)-approximations we are able to show that the sample size is near linear in t while in [FL11] it is quadratic in t. For some applications, such an improvement means turning a √ theoretical result into a practical result, especially when t is close to n. We define the importance of a point as the maximum absolute weighted cost w(p)f (p, q) of a point p, over all the possible queries q, i.e, s(p) := w(p) max |f (p, q)|, q∈Q(P ) and hope that this sum is small (say, constant or log n), in P other words, that not all the points are very important. More precisely, if the sum t = p∈P s(p) of these costs is 1, then we prove below that a new query space (P, w0 , Q, f 0 ) can be constructed, such that an (ε, ν)-approximation (S, u) for the new query space would imply |f (P, w, q)| − |f (S, u, q)| ν ≤ ε. (4) That is, the additive error in (3) is reduced as desired. The new query space (P, w0 , Q, f 0 ) is essentially a re-scaling of the original weights by their importance, w0 (p) = s(p). To make sure that the cost of each query will still be the same, we need to define f 0 such that w(p)f (p, q) = w0 (p)f 0 (p, q). This implies f 0 (p, q) := w(p)f (p, q)/s(p). While the new cost f¯0 (P, w0 , q) is the same as the old one f¯(P, w, q) for every query q, the maximum value of |f 0 (p, q)| is 1, by definition of s(p), even if |f (p, q)| is arbitrarily large. Hence, the additive error ε|f 0 (p, q)| in (3) reduced to ε in (4). More generally, an (ε, ν/t)-approximation for (P, w0 , Q, f 0 ) would yield (4). Using the uniform sample construction of Theorem 4.6, this implies that to get (4) we need to increase the sample size by a factor that is nearly linear in t. Theorem 5.1. • Let (P, w, Q, f ) be a query space where f (p, q) ≤ 1 for every p ∈ P and q ∈ Q(P ). • Let s : P → (0, ∞) such that s(p) ≥ w(p) maxq∈Q(P ) f (p, q). P • Let t = p∈P s(p). 17 • Let w0 : P → [0, 1] such that w0 (p) := s(p)/t. • Let f 0 : P × Q(P ) → [0, 1] be defined as f 0 (p, q) := w(p) · f (p, q) . s(p) • Let (S, u) be an (ε, ν/t)-approximation for (P, w0 , Q, f 0 ). • Let u0 (p) = u(p) · w(p) w0 (p) for every p ∈ S. Then for every q ∈ Q(S), |f (P, w, q) − f (S, u0 , q)|ν ≤ ε. (5) Proof. Put q ∈ Q(S). |f (P, w, q) − f (S, u0 , q)|ν = X w(p)f (p, q) − p∈P = t X s(p) X t · w(p) · X · f (p, q) (6) ν f (p, q) f (p, q) u(p) · w(p) · −t s(p) s(p) p∈S X w0 (p) · f 0 (p, q) − t p∈P = s(p) t p∈S p∈P = t X u(p)w(p) X u(p) · f 0 (p, q) p∈S w0 (p) · f 0 (p, q) − p∈P X (7) ν u(p) · f 0 (p, q) p∈S ν (8) ν/t ≤ ε, (9) where (6) is by the definition of u0 , (7) is by the definition of f 0 , (8) follows since |ta − tb|ν = |a − b| |ta − tb| = = |a − b|ν/t , ta + tb + ν a + b + ν/t (10) and (9) is by (3) and the definition of S in the sixth bullet of the statement. Plugging Theorem 4.6 in Theorem 5.1 yields our main technical result that would imply smaller coresets in the next sections. Theorem 5.2. Let (P, w, Q, f ) be a query space of dimension d, where f is non-negative, and let ε, δ, ν > 0. Let S be a random sample from P , where every point p ∈ P is sampled tw(p) independently with probability s(p)/t. Assign a weight u0 (p) = s(p)·|S| for every p ∈ S. If      t 1 t d log + log |S| ∈ Ω(1) · 2 εν ν δ then, with probability at least 1 − δ, |f (P, w, q) − f (S, u0 , q)|ν ≤ ε. 18 0 0 Proof. By Theorem P 5.10 it suffices to prove that S is an (ε, ν/t)-approximation for (P, w , Q, f ). Indeed, since p∈P w (p) = 1 and S is a random sample where p ∈ P is sampled with 0 probability w (p) = s(p)/t, the weighted set (S, u) is, with probability at least 1 − δ, an (ε, ν/t)-approximation for (P, w0 , Q, f 0 ) by Theorem 4.6. While Theorem 4.6 suggests to construct an ε-approximation simply by taking a uniform random sample from P , Theorem 5.2 requires us to take non-uniform sample where the distribution P is defined by the importance s(·). Bounding these importances such that the sum t = p∈P s(p) of importances will be small raise a new optimization problem that, as we will see in the next sections, might be not easy at all to solve. So what did we gain by proving Theorem 4.6 (or the framework of [FL11] in general)? Most of the existing papers for constructing coresets essentially had to bound the total importance of the related problem anyway. However, without Theorem 4.6, their proofs also had to deal with complicated terms that involved ε and include sophisticated probability arguments. Essentially each paper had to re-prove in some sense the very involved proofs in [VC71, LLS00] that were researched for decades, as well as the mathematics behind the usage of Definition 4.3. Beside the complicated proofs, the final bounds, the dependency on ε and δ, as well as the coreset construction algorithm, were usually sub-optimal compared to Theorem 4.6. On the contrary, bounding the total importance allows us to focus on a deterministic results (no δ involved) and the terms s(p) can be approximated up to constant factors (and not (1 + ε)-factors). This is demonstrated in Section 6. 5.2 Improved Coreset Framework While the result in the previous section can be used to improve the quality of (ε, ν)approximation in general, its main motivation is to construct the more recent type of data structures that is sometimes called coresets. As explained in Theorem 4.6, ε-approximation and (ε, ν)-approximation in general, can be easily computed using uniform random sampling. While ε-approximations are useful for hitting sets, where we wish to know how much points are covered by a set of shapes, they are less relevant for shape fitting, where we wish to approximate the sum of distances of the input points to a given query shape or model. The main reason is that in shape fitting the maximum contribution of a point to the overall cost (sum of covered points) is bounded by 1, while in general its distance to the shape is unbounded. Using the notation of the previous section: the importance of each point is the same, so Theorem 5.2 yields uniform sample S and the same error as Theorem 4.6. Example: In the Euclidean k-means problem the input is a set P of n points in Rd . For simplicity, assume that the set is unweighted, that is w(p) = 1/n for every p ∈ P . A query in this context is a set of points (centers) in Rd so Q(P ) is the family (set) of k balls in Rd . We denote the squared Euclidean distance from a point p ∈ P to a center c ∈ Rd by D(p, c) = kp − ck22 . The distance from p to its closest center in C = {c1 , · · · , ck } is then D(p, C) := min D(p, c) = min kp − ck22 . c∈C c∈C 19 By defining g(p, C) = D(p, C) we obtain the query space (P, w, g, Q), where ḡ(P, w, C) is the average squared distances to a given (query) set C of k centers. Our goal is to compute a weighted subset (S, u) such that ḡ(P, w, C) will approximate the average squared distances ḡ(S, u, C) for every set of centers. Suppose that (S, u) is an ε-approximation of (P, w, Q, g). Then |ḡ(P, w, C) − ḡ(S, u, C)| ≤ ε max g(p, C). p∈P (11) That is, X 1X D(p, C) − u(p)D(p, C) ≤ ε max D(p, C). p∈P n p∈P p∈P (12) In other words, the additive error depends on the maximum distance between a point to a given center, which can be arbitrary large, unless we assume, say, that both the input points and centers are inside the unit cube. Theorem 5.2 would not improve this bound by itself, since the importance of each point, maxc∈Q(P ) D(p, C) is unbounded. In this section we wish to compute a weighted subset (S, u) that will approximate the average distance ḡ(P, w, C) for every query, up to a multiplicative factor of 1 ± ε without further assumptions. Such a set is sometimes called a coreset as follows. Definition 5.3 (ε-coreset). For an error parameter ε ∈ (0, 1), the weighted set (S, u) is an ε-coreset for the query space (P, w, Q, g) if S ⊆ P and for every q ∈ Q(S), (1 − ε)ḡ(P, w, q) ≤ ḡ(S, u, q) ≤ (1 + ε)ḡ(P, w, q). An equivalent definition of an ε-coreset, is that the additive error ε maxp∈P g(p, C) in (11) is replaced by εḡ(P, w, q). That is, for every q ∈ Q(S) |ḡ(P, w, q) − ḡ(S, u, q)| ≤ εḡ(P, w, q). ε-coreset implies that not only the average, but also the sum of squared distances (or sum of costs, in general) are preserved up to 1 ± ε. Note also that simply multiplying the weight of each point in S by (1 − ε) would yield a one sided error, ḡ(P, w, q) ≤ ḡ(S, u, q)| ≤ 2ε 1+ε · ḡ(P, w, q) = 1 + · ḡ(P, w). 1−ε 1−ε If we assume in addition that ε ∈ (0, 1 − 2/c) for some c > 2, then 1 − ε ≥ 2/c and thus ḡ(P, w, q) ≤ ḡ(S, u, q)| ≤ (1 + cε)ḡ(P, w). Hence, an ε/c-coreset (S, u) implies, ḡ(P, w, q) ≤ ḡ(S, u, q) ≤ (1 + ε)ḡ(P, w, q). (13) For example, if ε ∈ (0, 1/2), then an (ε/4)-coreset would yield (13), by substituting c = 4. 20 The main observation for getting the desired multiplicative approximation is that a multiplicative approximation of εḡ(P, w, q), can be turned into an additive approximation of ε by replacing g(p, q) with its scaled version f (p, q) = g(p, q) . ḡ(P, w, q) To get a coreset for g as in (13) it suffices to have an ε-approximation for f . In addition, for many problems, while the importance s(p) of a point in p is unbounded with respect to g, it is bounded with respect to f . We formalize this observation as follows. Corollary 5.4. Let (P, w, Q, g) be a query space for some non-negative function g, and define f : P × Q(P ) → R such that for every p ∈ P and q ∈ Q(P ) we have f (p, q) = g(p, q) . ḡ(P, w, q)   1 Let (S, u ) be a ε/4, -approximation for (P, w0 , Q, f 0 ) as defined in Theorem 5.1. Then 4t (S, u0 ) is an ε-coreset for (P, w, Q, g), i.e., for every q ∈ Q(S) 0 |ḡ(P, w, q) − ḡ(S, u, q)| ≤ εḡ(P, w, q). Proof. Put q ∈ Q(S), τ = ε/4 and ν = 1/4. Applying Theorem 5.1 with ν yields |f¯(P, w, q) − f¯(S, u0 , q)|ν ≤ τ. Since f¯(P, w, q) = 1, this implies 1− ḡ(S, u0 , q) ḡ(P, w, q) = |f¯(P, w, q) − f¯(S, u0 , q)|ν ≤ τ. ν Substituting a = 1, and b = f¯(S, u0 , q) in Corollary 4.4(i) yields 1− ḡ(S, u0 , q) ≤ ε. ḡ(P, w, q) Multiplying by ḡ(P, w, q) yields an ε-coreset as |ḡ(P, w, q) − ḡ(S, u0 , q)| ≤ εḡ(P, w, q). Combining Corollary 5.4 and Theorem 4.6 yields the following theorem. 21 Theorem 5.5. Let (P, w, Q, g) be a query space, where g is a non-negative function. Let s : P → (0, ∞) such that w(p)g(p, q) s(p) ≥ max P , q∈Q(P ) p∈P w(p)g(p, q) P and t = p∈P s(p). Let d be the dimension of (P, w0 , Q, f 0 ) as defined in Theorem 5.4. Let c ≥ 1 be a sufficiently large constant, and let S be a random sample of    ct 1 |S| ≥ 2 d log t + log , ε δ points from P , such that for every p ∈ P and q ∈ S we have p = q with probability s(p)/t. t·w(p) Let u0 (p) = s(p)|S| for every p ∈ S. Then, with probability at least 1 − δ, (S, u0 ) is an ε-coreset for (P, w, Q, g), i.e., ∀Q ∈ Q(S) : (1 − ε)g(P, w, q) ≤ g(S, u0 , q) ≤ (1 + ε)g(P, w, q). 6 Application: Smaller and Generalized Coreset for kMeans Definition 6.1 (ρ-metric space). Let X be a set, and D : X 2 → [0, ∞) be a function. Let ρ > 0. The pair (X, D) is a ρ-metric space if for every (x, y, z) ∈ X 3 we have D(x, z) ≤ ρ(D(x, y) + D(y, z)). For C ⊆ X we denote D(x, C) := minc∈C D(x, c) assuming that such minimum exists. Moreover, for ε > 0, the pair (X, D) is a (ψ, ε)-metric space if for every (x, y, z) ∈ X 3 we have D(x, y) + εD(y, z)). |D(x, z) − D(y, z)| ≤ ψ Note that for every x, y ∈ X, and a center cy ∈ C that is closest to y, we have D(x, C) = min D(x, c) ≤ D(x, cy ) ≤ ρ(D(x, y) + D(y, cy )) = ρ(D(x, y) + D(y, C)). c∈C (14) A simple way to decide whether (D, X) is indeed a ρ-metric space is to use the following bound, known as Log-Log Lipschitz, that is usually easier to compute. The following lemma is very similar to [FS12, Lemma 2.1], where in the proof of (i) the constant 4 that appeared there is replaced here by 1/ε. Lemma 6.2 (Lemma 2.1(ii) in [FS12]). Let D̃ : [0, ∞) → [0, ∞) be a monotonic nondecreasing function that satisfies the following (Log-Log Lipschitz) condition: there is r > 0 such that for every x > 0 and ∆ > 1 we have D̃(∆x) ≤ ∆r D̃(x). 22 Let (X, dist) be a metric space, and let D(x, y) = D̃(dist(x, y)) for every x, y ∈ X. Then (X, D) is a ρ-metric space for ρ = max {2r−1 , 1}, and a (ψ, ε)-metric space for every ε ∈ (0, 1) and ψ = (r/ε)r . For example, consider a metric space (X, dist) and the function D̃(x) = x2 that corresponds to the squared distance D(p, q) = D̃(dist(p, q)) = (dist(p, q))2 . Note that (X, D) is not a metric space since the triangle inequality does not hold. However, for every x > 0 and ∆>1 D̃(x∆) = (x∆)2 = ∆2 x2 = ∆2 D̃(x). Hence, by Lemma 6.2 r = 2, ρ = 2r−1 = 2, (D, X) is a 2-metric space and a (ψ, ε)-metric space for ψ = (2/ε)2 . To compute a coreset for a problem we need to decide what are the important points, or more formally, to use Theorem 5.5 we need to bound the importance s(p) of each point p ∈ P . To do this, we usually need to solve another optimization problem that is usually related to computing the query with the minimal cost. For example, the bound of importance of a point in the k-mean problem, as will be defined later, is based on the optimal solution for the k-means problem. Unfortunately, this optimization problem is usually hard and the main motivation for constructing the coreset in the first place. There are two leeways from this chicken-and-egg problem: (i) Use the merge-and-reduce approach that reduces the problem of computing a coreset n small weighted for a large set of n items to the problem of computing coresets for 2|S| (core)sets. Each input coreset 2|S| is reduced to a coreset of |S| and merged with another such coreset, where 2|S| is the minimum size of input set that can be reduced to half using the given coreset construction. In this case, if this coreset construction takes time f (|S|) than, since there are such O(n) constructions, the overall running time will then be O(n) · f (|S|). (ii) For problems such as k-means, it is NP-hard to compute the optimal solution, even for a small set of n = O(k) points. Instead of computing an optimal solution, usually a constant factor approximation suffices for computing the importance of each point. Since for many problems such an approximation is also unknown or too slow to compute, (α, β)-approximation, (or bi-criteria, or bicriterion), can be used instead as explained below. Suppose that the optimal solution for the k-means problem on a set is OP Tk . That is, there is a set C of k centers whose cost (sum of squared distances to the input points of P ) is OP Tk , and there is no such set of smaller cost. Then a set C̃ is called an α-approximation if its cost is at most α · OP T . However, for many problems, even a rougher approximation would do: instead of using k centers to approximate OP Tk by a factor of α, we use βk centers, where each input point may be assigned for the nearest center. Note that the cost is still compared to OP Tk and not to OP Tβk . We define (α, β)-approximation formally below. For our purposes later, we generalize this common definition of (α, β)-approximation, and 23 allow a point to be assigned to a different center than its nearest one, as long as the overall cost is small. Definition 6.3 ((α, β)-approximation.). Let (X, D) be a ρ-metric space, and k ≥ 1 be an integer. Let (P, w, Q, g) be a query space such that P ⊆ X, Q(P ) = {C ⊆ X | |C| ≤ k}, and g : P × Q(P ) be a function such that g(p, C) = D(p, C) := min D(p, c). c∈C (15) Let α, β ≥ 0, B ⊆ X such that |B| ≤ βk and B : P → B such that X w(p)g(p, {B(p)}) ≤ α min ḡ(P, w, q). q∈Q(P ) p∈P Then B is called an (α, β)-approximation for (P, w, Q, g). For every b ∈ B, we denote by Pb = {p ∈ P | B(p) = b} the points that are mapped to the center b. We also denote p0 = B(p) for every p ∈ P . One of the main tools in our novel streaming algorithm is also a technique to update an (α, β)-approximation. However, due to memory limitations, our streaming algorithm cannot attach each point to its nearest center, but still the distances to the approximated centers is bounded. We thus generalize the definition of an (α, β)-approximation, which is usually a set B of size βk, to a function B : P → B that assigns each input point to a (not necessarily closest) center in B, while the overall cost is still bounded. Since an (α, β)-approximation yields a weaker result compared to a PTAS or α-approximation, it can usually be computed very quickly. Indeed, a very general framework for constructing (α, β)-approximation to any query space with a small VC-dimension is suggested in [FL11] where α = 1 + ε and β = O(log n). Reducing (α, β)-approximation to an α = O(1) approximation. The size of the coreset usually depends on α and β. However, if they are reasonably small (e.g. polynomial in log n), we can reduce the approximation factor and number of centers in few phases as follows: (i) Compute an (α, β)-approximation for small (but maybe not constant) α and β. (ii) Compute an ε-coreset for ε = 1/2 using this approximation. (iii) Compute an O(1) factor approximation on the coreset. Since the coreset is small, such an approximation algorithm can run inefficiently, say, in polynomial time if the coreset is of size (log n)O(1) . The resulting O(1) approximation for the coreset is also an O(1) approximation for the original set, by the definition of the ε = 1/2 coreset. (iv) Recompute the coreset for the complete (original) data using the O(1) approximation instead of the (α, β)-approximation to obtain a coreset of size independent of both n and d. Assumption 6.4. In what follows we assume that: • P is a set that is contained in X where (X, D) is a ρ-metric space and (φ, ε)-metric space as defined in (6.1). 24 Algorithm 2: Coreset(P, w, B, m) Input: A weighted set (P, w) where P ⊆ X and (D, X) is a ρ-metric space, (α, β)-approximation B : P → B, and sample size m ≥ 1. Output: A pair (S, u) that satisfies Theorem 6.6. 1 2 3 4 5 6 7 9 for each b ∈ B do Set Pb ← {p ∈ P | B(p) = b} for each b ∈ B and p ∈ Pb do w(p) w(p)D(p, B(p)) P . + Set Prob(p) ← P 2 q∈P w(q)D(q, B(q)) 2|B| q∈Pb w(q) Pick a sample S of at least m points from P such that for each q ∈ S and p ∈ P we have q = p with probability Prob(p). for each p ∈ P do w(p) Set u(p) ← |S|·Prob(p) . Set u(p) ← 0 for each p ∈ P \ S. /* Used only in the analysis. */ return (S, u) • (P, w, Q, g) is a query space as defined in (15). • dk denotes the dimension of f 0 as defined in Corollary 5.5. • c is a sufficiently large constant that can be determined from the proofs of the theorems. • B is an (α, β)-approximation for (P, w, Q, g) as in Definition 6.3. • We are given an error parameter ε ∈ (0, 1). • We are given a maximum probability of failure δ ∈ (0, 1). We begin with the following claim, that is a simplified and generalized version of a similar claim in [LS10]. Lemma 6.5. For every b ∈ B, and p ∈ Pb have w(p)D(p, C) ραw(p)D(p, p0 ) ρ2 (α + 1) P ≤P + . 0 q∈P w(q)D(q, C) q∈P w(q)D(q, q ) q∈Pb w(q) P Proof. Put p ∈ P and b ∈ B such that p ∈ Pb . We need to bound w(p)D(p, C) ρw(p)D(p, p0 ) ρw(p)D(p0 , C) ≤P +P q∈P w(q)D(q, C) q∈P w(q)D(q, C) q∈P w(q)D(q, C) P αρw(p)D(p, p0 ) ρw(p)D(p0 , C) P P ≤ + , 0 q∈P w(q)D(q, q ) q∈P w(q)D(q, C) 25 (16) where the first inequality holds by (14), and the second inequality holds since B is an (α, β)approximation. To bound the last term, we sum the inequality D(p0 , C) ≤ ρ(D(p0 , q) + D(q, C)) over every q ∈ Pb to obtain X X X D(p0 , C) w(q) = w(q)D(p0 , C) ≤ w(q) · ρ(D(p0 , q) + D(q, C)) q∈Pb q∈Pb =ρ q∈Pb X w(q)D(q 0 , q) + ρ q∈Pb ≤ ρα X X w(q)D(q, C) q∈Pb w(q)D(q, C) + ρ q∈Pb ≤ ρ(α + 1) X w(q)D(q, C) q∈Pb X w(q)D(q, C). q∈P Dividing by P q∈Pb w(q) · P q∈P w(q)D(q, C) yields ρ(α + 1) D(p0 , C) ≤P . q∈P w(q)D(q, C) q∈Pb w(q) P Substituting this in (16) yields the desired result ραw(p)D(p, p0 ) ρ2 (α + 1) w(p)D(p, C) P ≤P + . 0 q∈P w(q)D(q, C) q∈P w(q)D(q, q ) q∈Pb w(q) P Our first theorem suggests a coreset for k-means of size near-quadratic in k and quadratic in ε, based on our improved framework and last lemma. Existing work [LS10] for obtaining such coresets with only positive weights requires size cubic in k. Theorem 6.6. Under Assumption 6.4, let t = k · ρ2 (α + 1)β. Let (S, u) be the output of a call to algorithm Coreset(P, w, B, m), where    1 ct . m ≥ 2 dk log t + log ε δ Then, with probability at least 1 − δ, (S, u) is an ε-coreset of size m for (P, w, Q, g). Proof. Let f : P → [0, ∞) such that for every C ∈ Q(P ), D(p, C) , q∈P w(q)D(q, C) f (p, C) = P and define ραw(p)D(p, p0 ) ρ2 (α + 1) P + . s(p) = P 0 q∈P w(q)D(q, q ) q∈Pb w(q) 26 By Lemma 6.5, X XX XX max w(p)|f (p, C)| = max w(p)f (p, C) ≤ s(p) p∈P C∈Q(P ) b∈B p∈Pb C∈Q(P ) b∈B p∈Pb 2 = ρα + |B| · ρ (α + 1) = ρ(α + |B|α + |B|) ∈ O(ρ2 (α + 1)βk). Applying Theorem 5.5 with the query space (P, w, Q, g) then yields the desired bound. Our second theorem in this section suggests a coreset for k-means of size near-linear in k by combining new observations with our improved framework. Theorem 6.7. Under Assumption 6.4, let t = α/φ. Let (S, u) be the output of a call to algorithm Coreset(P, w, B, m), where    ck(t + β) 1 m≥ d log t + log(βk) + log . 2 ε δ Then, with probability at least 1 − δ, (S, u) is an ε-coreset of size m for (P, w, Q, g). Proof. Let   2D(p, p0 ) 0 H = p ∈ P | |D(p, C) − D(p , C)| ≤ . φ We need to bound by O(ε) the expression P p∈P (w(p) − u(p)) · D(p, C) P q∈P D(q, C) P 0 p∈H (w(p) − u(p)) · (D(p, C) − D(p , C)) P ≤ q∈P D(q, C) P X q∈P w(q)D(b, C) P b + · r∈P w(r)D(r, C) b∈B X (w(p) − u(p)) · D(p, C) X (w(p) − u(p)) · (D(p, C) − D(p0 , C)) P P − w(q)D(b, C) q∈P q∈Pb w(q)D(b, C) b p∈P p∈P ∩H b (17) (18) (19) ! . (20) b Put b ∈ B and p ∈ Pb . Then, X (w(p) − u(p)) · D(p, C) X (w(p) − u(p)) · (D(p, C) − D(p0 , C)) P P − q∈Pb w(q)D(b, C) q∈Pb w(q)D(b, C) p∈P p∈P ∩H b b X w(p) − u(p) P = q∈Pb w(q) p∈P (21) b + X (w(p) − u(p)) · (D(p, C) − D(b, C)) P . q∈Pb w(q)D(b, C) (22) p∈Pb \H We now prove that, with probability at least 1 − cδ, each of the expressions (18), (21) and (22) is bounded by 2ε. 27 Bound on (18): every p ∈ P , Let h(p, C) = D(p,C)−D(p0 ,C) P q∈P w(q)D(q,C) if p ∈ H and h(p, C) = 0 otherwise. For 2αw(p)D(p, p0 ) 2αProb(p) 2w(p)D(p, p0 ) P P ≤ ≤ . w(p) · |h(p, C)| ≤ 0 φ q∈P w(q)D(q, C) φ q∈P w(q)D(q, q ) φ Hence, using t = 2α/φ in Theorem 5.5, with probability at least 1 − δ, P p∈H (w(p) − u(p)) · (D(p, C) − D(p0 , C)) X P (w(p) − u(p))h(p, C) = |h̄(P, w, q)−h̄(S, u, q)| ≤ ε, = q∈P D(q, C) p∈H (23) Bound on (21): Let I(p, b) = 1/ P q∈Pb w(q) if p ∈ Pb and I(p, b) = 0 otherwise. We have max w(p)I(p, b) ≤ 2|B|Prob(p), p∈P P where Prob(p) is defined in Line 3 of Algorithm 2. Hence, p∈P max w(p)I(p, b) ≤ 2|B|. Also, each point in S is sampled with probability proportional to 2|B|Prob(p) and for c ≥ 2,       2|B| 1 2|B| |B| |S| ≥ 2 2 log(2|B|) + log = 2 log(|B|) + log . ε δ ε δ Using d = 1 and replacing δ by δ/|B| in Theorem 5.5 yields that S is an ε-coreset for (P, w, {b} , I), with probability at least 1 − δ/|B|. That is | X w(p) − u(p) ¯ w, b) − I(S, ¯ u, b)| ≤ ε. P | = |I(P, w(q) q∈P b p∈P (24) b By the union bound, with probability at least 1 − δ, the last inequality holds for every b ∈ B simultaneously. Bound on (22): Since (D, X) is a ρ-metric, D(p, b) |D(p, C) − D(b, C)| ≤ + εD(b, C) ≤ max φ Hence   2D(p, b) , 2εD(b, C) . φ X (w(p) − u(p)) · (D(p, C) − D(b, C)) X w(p) + u(p) P P ≤ 2ε . w(q)D(b, C) q∈Pb q∈Pb w(q) p∈Pb \H (25) p∈Pb \H The last expression is bounded using (24), as X w(p) + u(p) X (1 + ε)w(p) P P ≤ = (1 + ε). q∈Pb w(q) q∈Pb w(q) p∈Pb \H p∈Pb \H 28 (26) Bounding (17): least 1 − 10δ, P p∈P (w(p) P By combining the above bounds we obtain that with probability at − u(p)) · D(p, C) q∈P D(q, C) ≤ ε + (ε + 2ε(1 + ε)) X b∈B P w(q)D(b, C) Pq∈Pb ≤ cε. r∈P w(r)D(r, C) Replacing ε with ε/c, and δ with δ/c then proves the theorem. The values of ρ and ψ. Algorithm 2 can be applied to compute a coreset for any given variant of the k-means/median problem given a set P and a ρ or (ρ, ε)-metric (X, D). The only difference is the size of the required coreset. The parameters ρ and φ can usually be computed easily using Lemma 6.2. For example, in the case of distances to the power of r ≥ 1, the value of ρ is roughly 2r and the value of φ is roughly εr . For most common m-estimators the values are similar, when r is some constant. The values of α and β can be α = β = O(1) for k-means and all its variants, by using the generic algorithm for computing (α, β)-approximation in [FL11] with α = β = O(log n), and then use the technique for reducing α and β. For bounding the approximation of the bi-criteria approximation in [FL11] only the pseudo-dimension of the problem is required, which is usually easy to compute as explained below. Dimension d. Unlike the total sensitivity t, the dimension d for numerous problems was already computed in many papers in computational geometry and machine learning (in the context of PAC learning). This includes reductions and connections to similar notions such as the shattering dimension or the VC-dimension of a set. General techniques for computing the dimension of a set based on number of parameters to define a query, or number of operations that are needed to answer a query can be found in the book [AB99]. Dimension of the k-means problem and its variants. Note that, unlike sensitivity, the dimension is less dependent on the exact type of distance function. For example, using Euclidean distance or Euclidean distance to the power of 3 as a variant for the k-means clustering problem does not change the dimension. This is because set of ranges for both of these problems is the same: subsets of the input points that can be covered by k balls. It is easy to compute the dimension for the k-means problem (the query space (P, w, Q, g) in our paper, as well as the modified query space for the function f . These bounds can be found in [FL11]. In addition, [FL11] provide a simple reduction that shows that the dimension for k centers is the same as the dimension of 1 center multiplied by k. In short, for the Euclidean space, the dimension of the k-means/median problem is O(dk), and for metric spaces (graph) the dimension is O(k log n). 29 Smaller coreset for k-means queries. Consider the k-means queries in Rd , i.e., the P cost is the sum of squared distances p∈P D(p, C) over every point in P to its nearest d center in a given set C of k points in R . It was proven that projecting P onto an O(k/ε)dimensional subspace that minimizes its sum of squared distances, known as the low-rank approximation of P , would preserve this sum, to any set of k centers, up to a factor of 1 ± ε. This is in some sense an ε-coreset for P of size n and that is not subset of the input, but of low-dimensionality. In particular, this result implies that there is a set of centers (known as centroid set [HPK07]) that is contained in a O(k/ε)-dimensional space, such that every set of k centers in Rd can be replaced by a set of k centers in the centroid set, that would yield the same cost up to a factor of 1 ± ε. In particular, this implies that the dimension of the k-means problem can be reduced to O(k/ε) instead of dk, i.e., independent of d. Combining this result with our paper yields the first coreset for k-means of size independent of d that is subset of the input (in particular, preserve the sparsity of the input points) that also supports streaming. Weak coresets of size independent of d. For the non-Euclidean case or non-squared distances it seems that it is impossible to obtain coreset of size independent of d. However, coreset as defined above (sometimes called strong coreset) approximates every query in the set of queries, while the main application and motivation for constructing coreset is to compute the optimal query or its approximation. A weak coreset is a small set that can be used to give such an approximation. The exact definition of weak coreset also changes from paper to paper. In particular, a weak coreset for k-means was suggested in [FMS07]. However, to extract the approximated solution from the coreset we must run an exhaustive search and cannot use existing algorithms or heuristics as in the case of strong coreset. In this paper, following [FL11], we use a simple and general definition of weak coreset, that is also more practical. Instead of defining a unique (static, global) set Q of queries, we define Q to be a function that maps every subset (potential coreset) S of P to a set of queries. A weak coreset S needs only to approximate the queries in Q(S). It turns out that for many case the (generalized definition) of dimension for such a query space is much smaller compared to the traditional case where Q(S) = Q(P ) is the same for every subset S ⊆ P. To be able to use this property in our existing proofs, we require a monotonicity property: that the set Q(T ) of queries that are assigned to a subset T ⊂ S must be contained in Q(S). If we can prove that for every S ⊆ P , the set Q(S) contains a (1 + ε)-approximation to both the optimal solution of S and P , then we can extract such an approximation from S. For k-means, k-median and their variants, it was proven in [SV07] that the optimal k-centers of a set S can be approximated by such a set that is spanned by O(k/ε) points in S. By defining Q(S) to be the union of the optimal center of P , with all the centers that are spanned by O(k/ε) points in S, we get that S is a weak coreset. Note that the definition of Q can be explicit (without knowing the optimal center of P ) and is needed only to bound its dimension as in Definition 4.5. 30 Extracting a (1 + ε)-approximation from the coreset. It was proven in [FL11] that for problems such as k-median such weak coresets have dimension O(k/ε), i.e., independent of d. Unlike [FL11], we suggest here a very simple way to extract the approximated solution from the coreset: compute the weighted coreset (S, u) (of size independent of d) as defined in Algorithm 2, and then use any given algorithm to compute a (1 + ε) approximation set C of k centers on the coreset (or any other trusted heuristic that we hope computes such a set C). Since C is not necessarily spanned by few points in S, it may not be a good approximation for the original set P and we should not return it. However,the proof in [SV07] is constructive and shows a near-linear time algorithm that using such an approximated solution set C, we can compute another (1 + O(ε))-approximation C 0 that has the additional property that C 0 is spanned by O(k/ε) points in S. Hence, C 0 is both a near-optimal solution to S and in Q(S), so it must be a (1 + ε)-approximation for the optimal solution of P . 7 Appendix A: Merge and Reduce Tree We now briefly introduce the previous technique for maintaining coresets in the streaming setting due to Har-Peled and Mazumdar [HPM04] and Bentley and Sax [BS80]. In this method, a merge-and-reduce tree is built by using an offline coreset construction as a blackbox. Previously merge-and-reduce was the only known technique for building a streaming coreset for metric k-median, and it relies solely on the following two properties: 1. Merge: The union of (k, )-coresets is a (k, )-coreset. 2. Reduce: A (k, )-coreset of a (k, δ)-coreset is a (k,  + δ)-coreset. The merge-and-reduce tree works as follows. There are buckets Bi for i ≥ 0. In each step, the bucket B0 takes in a segment of O(1) points from the stream. Then the tree works like counting in binary: whenever buckets B0 to Bi−1 are full, these i buckets are merged and then reduced by taking a (k, log n )-coreset and storing the result in Bi . Let s be the space of offline construction, which depends on  as −a . At the end of the stream, O(log n) buckets have been used and each bucket uses O(s loga n) space; this incurs a multiplicative overhead of Θ(loga+1 n) in the storage requirement. The second factor comes from using the accuracy parameter log n , which is necessary by Property 2 since the construction will be compounded O(log n) times. Due to this compounding, the runtime is multiplied by a factor of O(log n). 8 Appendix B: General Streaming Reduction We present a general technique for converting an offline coreset construction to a streaming coreset construction with O(log n) overhead. Given a ρ-metric space (X, D) (recall Definition 6.1), we build a query space (P, w, g, Q) in the same way as in Definition 6.3: Q(P ) = {C ⊆ X | |C| ≤ k} and g(p, C) = D(p, C) := minc∈C D(p, c). Here k is a positive integer that denotes how many centers may be used for the clustering. 31 Our bicriterion algorithm is an adjustment to the algorithms of [BMO+ 11] and [CCF] with the following important difference: our bicriterion is online, so we do not delete and reassign centers as is [BMO+ 11]. This “online” property is critical for the algorithm to work and is one of the main technical ideas. Although a fully online bicriterion can require linear space, we maintain a division of the stream P into a prefix R and a suffix P \ R such that our bicriterion is online on the suffix P \ R and the prefix R can be largely ignored. To maintain this property of being online for the suffix, we incur only a modest space increase from O(k log n) to O(log( 1 )k log n). After having an online bicriterion (it is further explained below why this property is essential), the offline coreset algorithms perform non-uniform sampling procedure with carefully chosen probabilities that are defined by the bicriterion. Equipped with our new bicriterion algorithm, implementing the sampling procedure is rather straightforward computation which is explained in Section 8.2. As a result, we can implement any sampling-based coreset algorithm for k-median without merge-and-reduce and in one pass. As such it is applicable to several coreset constructions (such as k-means and other M -estimators). In addition, we believe that our methods will work with other objective functions as well such as (k, j)subspace, and we hope that future work will investigate these directions. Many clustering algorithms [COP03, GMM+ 03, BMO+ 11] maintain a weighted set (B, u) of points (which are selected using a facility-location algorithm). Upon arrival of an update (p, w(p)) from the stream, this update is added to the set by u(p) ← u(p) + w(p). In these algorithms, only a single operation is performed on (B, u) which we call MOVE. For two points p, p0 ∈ B with weights u(p) and u(p0 ), the function MOVE(p, p0 ) does the following: u(p0 ) ← u(p0 ) + u(p) and u(p) ← 0. This essentially moves the weight at location p to the location of p0 . The motivation for building (B, u) will be compression; (B, u) will be maintained over the stream P in such a way that |B| = O(log |P |). Throughout this section, we will assume for ease of exposition that each point in the stream is from a distinct location. This simplifies the analysis, allowing B to take only a single value for each input point. The algorithm works for general inputs without modification, requiring only a more careful notation for the analysis. Additionally, we state the algorithm for unweighted input (where w(p) = 1 for all p ∈ P ) and the parameter n is defined as |P |. We still include w(p) throughout the algorithm and analysis, as the analysis generalizes to weighted inputs where the parameter n is replaced by the sum of all weights (after normalizing the minimally weighted point to 1). 8.1 An Algorithm for building a coreset First, let us describe how the algorithm of [BMO+ 11] works. We will modify this algorithm as part of our coreset construction. In this summary, we alter the presentation from that of [BMO+ 11] to more fluidly transition to our modified version but the algorithm remains the same. [BMO+ 11] operates in phases i ≥ 1. This means that the algorithm maintains a phase number i (used internally by the algorithm), beginning in phase i = 1. As the stream arrives, the algorithm may decide to increment the phase number. Let (Ri , wi ) denote the prefix of the input received before the end of phase i, and let OPTk (Ri ) denote the minimal value of 32 Figure 1: A bicriterion approximation. Although connections are not optimal, the sum of all connections costs is O(OPT). ḡ(Ri , wi , C) over every C ∈ Q. When phase i + 1 begins, a value Li+1 is declared on Line 27 as a lower-bound for the current value of OPTk (Ri+1 ). The algorithm has computed (Mi , ui ), which we inductively assume is a bicriterion approximation for Ri (more precisely, a map B : Ri → Mi such that ∪p∈Ri (B(p), w(p)) = (Mi , ui ). However, to maintain polylogarithmicspace the algorithm pushes (Mi , ui ) to the beginning of the stream and restarts the bicriterion construction. This means that the algorithm, at this point, restarts by viewing the stream as (P, w − wi + ui ) (i.e. replacing (Ri , wi ) with (Mi , ui )). Continuing in this way, the algorithm maintains a bicriterion (Mi+1 , ui+1 ) for (Ri+1 , wi+1 − wi + ui ) (which is also a bicriterion for (Ri+1 , wi+1 ) by Theorem 8.2) until the next phase change is triggered. Now we explain our modifications to [BMO+ 11] (see Algorithm 3). The first step is that the bicriterion our algorithm builds must be determined “online” in the following sense: upon receiving a point (x, w(x)), the value of B(x) must be determined (and never be altered) before receiving the next point from the stream. This generalization is necessary for the following reason. Suppose we connect an element p to a center b1 . Later in the stream, we open a new center b2 that becomes the closest center to p. However, using polylogarithmic space, we have already deleted b1 and/or p from memory and the state of our algorithm is identical to the case where b1 remains the closest center to p. Therefore the connections must be immutable, and this results in non-optimal connections. Definition 8.1. An online [α, β]-bicriterion is an algorithm that maintains a bicriterion (B, t) over a stream X, and operates online in the following sense. Upon arrival of each point p, it is immediately decided whether p is added to B, and then t(p) is determined. Both of these decisions are permanent. Upon receiving an update (p, w(p)) from the stream, the algorithm may call MOVE(p, p0 ) for the nearest p0 ∈ B to p. In the analysis we use the function B : P → B that maps each point p to its immediate location after this initial move (either p itself, or p0 ). If future moves are performed on p, this does not change the value B(p). B is not stored by the algorithm due to space constraints; only the value of B(p) for the most recent point p is used by the algorithm, and older values are used in the analysis only. We will show that B is a (O(1), O(log n))-approximation that allows us to maintain a coreset over the stream. 33 We now state Algorithm 3. φ and γ are constants (dependent on ρ) used in the analysis that are defined as in [BMO+ 11]. Each point has a flag that is either raised or lowered (given by the F lag function). All points have their flag initially lowered, given on Line 1. A lowered flag shows that the point is being read for the first time (being received from the stream), and a raised flag shows that the point is being re-read by the algorithm (having been stored in memory). On Line 22, (Mi , ui ) is the weighted set (B, u) as it exists at the end of phase i. We define the cost of MOVE(p, p0 ) to be w(p)D(p, p0 ). The value Ki is therefore the total cost of all moves performed in phase i. At a phase change, the set (B, u) is pushed onto the beginning of the stream with all points having a raised flag. This means that during the next |B| iterations of the outer-loop where a point (x, w(x)) is received we actually receive a point from memory. We continue to process the stream after these |B| points are read. The following theorem summarizes the guarantees of this algorithm. We note that, as stated, the algorithm’s runtime of O(nk log n) is not correct - in fact the number of phases may be arbitrarily large. However, using the same technique as detailed in Section 3.3 n ) while requiring O(k 2 log2 n) of [BMO+ 11] the number of phases can be bounded to O( k log n time per phase. Theorem 8.2 ([BMO+ 11]). Let Algorithm 3 process a stream (P, w) of at most n points. Let Ri denote the prefix of the stream received before the end of phase i, and let Ki and Li be their final values from the algorithm (which are never modified after phase i). With probability at least 1 − n1 , the following statements all hold after processing each point: P ρφγ 1. i Ki ≤ φ−ρ OPTk (Ri ) 2. The total runtime is O(nk log n) 3. For every phase i, Li ≤ OPTk (Ri ) ≤ φLi ≤ Li+1 4. At the execution of Line 22, Mi consists of O(k log n) points Part 1 of the preceding theorem, which bounds the total cost of all moves performed by the algorithm, also serves as an upper bound on the Earth-Mover distance between the stream (P, w) and the maintained set (B, u). Definition 8.3 (Earth-Mover Distance). Let (A, wA ) and (B, wB ) be weighted sets in (X, D). Morever, let them be of equal weight in the sense that Σa∈A w(a) = Σb∈B w(b). Define a “movement” from (A, wA ) to (B, wB ) to be a weighted set (Y, v) in (X × X, D) such that ∪(a,b)∈Y (a, v(a, b)) = (A, wA ) and ∪(a,b)∈Y (b, v(a, b)) = (B, wB ). Then dEM (A, wA , B, wB ) is the minimum of Σ(a,b)∈Y v((a, b))D(a, b) over all movements Y from (A, wA ) to (B, wB ). Another way to view the preceding definition is in terms of probability distributions. Over all joint distributions over A × B with marginal distributions (A, wA ) and (B, wB ), we seek the minimum possible cost (as defined) for any such joint distribution. 34 Algorithm 3: Input: integer k, ρ-metric space (X, D), stream (P, w) of n weighted points from (X, D). Output: B(x) after receiving each point x, and a weighted set (Mi , ui ) after each phase i ≥ 1 1 F lag(x) = 0 for all x ∈ P 2 L1 ← minimum D(x, y) for any x, y in the first k distinct points 3 i ← 1 4 K1 ← 0 5 B ← ∅ 6 u(x) ← 0 for all x 7 for each point (x, w(x)) received do 8 u(x) ← u(x) + w(x) 9 y ← argminy∈Q D(x, y) (break ties arbitrarily) , 1}, otherwise I ← 0 10 I ← 1 with probability min{ Liw(x)D(x,y) /k(1+log2 n) 11 if I then 12 if F lag(x) = 0 then 13 B(x) ← x 14 B ← B ∪ {x} 15 else 16 Ki ← Ki + w(x)D(x, y) 17 u(y) ← u(y) + u(x) /* Step 1 of MOVE(x, y) */ 18 u(x) ← 0 /* Step 2 of MOVE(x, y) */ 19 if F lag(x) = 0 then 20 B(x) ← y 21 if Ki > γLi or |B| > (γ − 1)(1 + log2 n)k then 22 (Mi , ui ) ← (B, u) 23 F lag(b) ← 1 for all b ∈ B 24 Push (B, u) onto the stream (P, w) before the next point to read 25 B←∅ 26 u(x) ← 0 for all x 27 Li+1 ← φLi 28 q←0 29 Ki+1 ← 0 30 i←i+1 35 From now on we will write a weighted set A instead of (A, wA ) when the meaning is clear. If we start with a set A0 and apply n operations of MOVE until it becomes the set An , we can provide an upper-bound for dEM (A0 , An ) by summing dEM (Ai , Ai+1 ) for 0 ≤ i < n. This is a direct application of the triangle inequality. And if Ai+1 is obtained from Ai by applying MOVE(p, p0 ), then dEM (Ai , Ai+1 ) = D(p, p0 )w(p), the cost of this move. The Earth-Mover distance is important for clustering problems for the following reason. For any weighted sets (P, w) and (B, u) and query C, |ḡ(P, w, C) − ḡ(B, u, C)| ≤ dEM (P, w, B, u). This is immediate from a repeated application of the triangle-inequality (proofs are found in Theorem 2.3 of [GMM+ 03] as well as in [COP03, BMO+ 11, Guh09]).  Theorem 8.4. There exists an algorithm stores O(log 1 k log n) points and maintains for every prefix (R, w0 ) of the stream (P, w): (1) a weighted set (M, u) such that dEM (M, u, R, w0 ) ≤ OPTk (R), and (2) a (O(1), O(log( 1 ) log n))-bicriterion B for (R, w0 ). Morever, this bicriterion B is computed online in the sense that B(x) is determined upon receiving x from the stream. Proof. The algorithm will consist of running Algorithm 3 and storing certain information for the λ most recent phases (where λ depends on ). Let i be the current phase number, and let (R, w0 ) be the points received so far. We remind the reader that when the meaning is clear we suppress notation and write R for the weighted ργ )e. The prefix R and the set set (R, w0 ), and likewise for (M, u). Define λ = 2 + dlogφ ( (φ−ρ) M in the statement of the theorem will be Ri−λ and Mi−λ . To upper bound dEM (R, M ), which by definition is the minimum cost of any movement from R to M, we note that one movement is the set of moves carried out by the algorithm through phase i − λ, whose cost is Pi−λ ρφγ i−λ K . Part 1 of Theorem 8.2 then shows that dEM (R, M ) ≤ Σj=1 OPTk (Ri−λ ). Kj ≤ φ−ρ j j=1 1−λ Combining Statements 3 and 4 of the theorem shows that OPTk (Ri−λ ) ≤ φ OPTk (R). ρφγ 1−λ Therefore dEM (R, M ) ≤ φ−ρ φ OPTk (R) ≤ OPTk (R) as desired. As for the second statement of the theorem, the algorithm defines the map B and we are currently interested in the restriction of B to R \ Ri−λ . B maps to at most O(k log n) points per phase - this is guaranteed by Statement 5 (a direct result the termination condition on Line 17). Over the last λ phases, this then maps to O(λk log n) = O(( 1 )k log n) points. Therefore we have that β = O(( 1 ) log n). And the value of α is immediate from Statement 1 of Theorem 8.2, since B incurs only a subset of the costs as Kj (the subset that comes from the new portion of the stream Rj \ Rj−1 ). As a final note, we do not store B(P ) in memory (it may be linear in space). For algorithms in the following sections it is only required to know it’s value for the most recent point received; previous values are used only in the analysis. 8.2 Maintaining a coreset over the stream In the previous section, we presented an algorithm that maintains an (α, β)-approximation of the stream (this is given by the function B : P → B). In this section we show how we can use this approximation to carry out the coreset construction of Algorithm 2 on an insertion-only 36 stream. In the offline construction, a sample S of m points is taken from X according to a distribution where point p sampled with probability depending on D(p, B(p)), |B|, and nB(p) (the total weight of points connected to the center B(p), which is written as Σq∈Pb w(q) where b = B(p)) - the specific formula for the probability written below (and comes from Line 3 of Algorithm 2). All three of these quantities can easily be maintained over the stream using Algorithm 4 since B is online (i.e. B(p) never changes). P rob(p) = w(p) w(p)D(p, B(p)) P P + 2 q∈P w(q)D(q, B(q)) 2|B| q∈Pb w(q) Upon receiving a point p, we assign r(p) a uniform random number in the interval (0, 1). This is the threshold for keeping p in our sample S - we keep the point p if and only if r(p) < P rob(p). For each point p, P rob(p) is non-increasing as the stream progresses (this is immediate from the formula and from the fact that clusters never decrease in size since B is online). Therefore after receiving point p, we update P rob(s) for each s ∈ S and delete any such s that drop below their threshold: r(s) ≥ P rob(s). Once a point crosses the threshold, it may be deleted since P rob(s) is non-increasing and so it will remain below the threshold at all future times. In this way, the construction exactly matches the output as if the offline Algorithm 2 had been used. Algorithm 4: Input: integer k, ρ-metric space (X, D), stream P of points n from (X, D), online bicriterion B, sample size m ≥ 1. Output: a coreset S 1 S ← ∅ 2 for each point p that arrives do 3 Assign r(p) a uniform random in (0, 1) 4 S ← S ∪ {p} 5 Compute Prob(p) according to Line 3 of Algorithm 2 6 for each point s ∈ S do 7 Update Prob(s) 8 if Prob(s) ≤ r(s) then 9 Delete s from S 10 Update u(s) according to Line 6 of Algorithm 2 Algorithm 3 provides the function B and a weighted set Mi−λ . Beginning in phase i − λ, we will begin running Algorithm 4. This outputs the sample S for phases i − λ + 1 until the current phase i. The following theorem shows that Mi−λ ∪ Si is a coreset for the stream. Of course, we need to do this construction for each of the λ = O(log( 1 )) most recent phases, so the space gets multiplied by this factor. We return to definition 6.2 of an r Log-Log Lipschitz function D̃. Given a metric space (X, dist), the space (X, D) where D = D̃(dist) is a ρ-metric space for ρ = max{2r−1 , 1}. It is well-known that most M -estimators can be recast as a Log-Log Lipschitz function for a low constant value of r. For example, k-means has r = 2. 37 Theorem 8.5. There exists a single-pass streaming algorithm requiring O(−O(1) k log n(log n+ log k + log 1δ )) space that maintains a (k, )-coreset for the k-median clustering of an r-LogLog-Lipschitz function D̃ on a stream of at most n elements with probability at least 1 − δ. Proof. Running Algorithm 2 (producing the Mi ) and Algorithm 3 (producing the Si ) in parallel, we will show that Mi−λ ∪ Si is the desired coreset of the stream. We already have by Theorem 8.4 that dEM (Mi−λ , Ri−λ ) ≤ OPTk (P ) ≤ ḡ(P, w, C) for any set C of size k. Also, by Theorem 6.6 we have the Si is an (k, )-coreset for P \ Ri−λ . This is because (in the statement of Theorem 6.6) we are required to carry out the  1 d log t + log(βk) + log where t = α/ψ. construction of Algorithm 2 using m ≥ ck(t+β) 2 ε δ It was shown in Lemma 6.2 that ψ = (/r)r . We are using the (O(1), O(log( 1 ) log n))approximation B, and in [FL11] it is shown that d = O(log n) for k-median in a ρ-metric space. So therefore the minimal possible value of m thatsatisfies the hypotheses of the −r n) theorem is O( k( ε+log log n log −r + log(k log n) + log 1δ ). Simplifying notation, this is 2 O(−O(1) k log n(log n + log k + log 1δ )). We write COST(A, C) to denote ḡ(A, wA , C) to simplify notation; by A ∪ B we mean (A ∪ B, wA + wB ). Taking the union, we get that |COST(P, C) − COST(Mi−λ ∪ Si , C)| ≤ |COST(Ri−λ , C) − COST(Mi−λ , C)| + |COST(P \ Ri−λ , C) − COST(Si , C)|. The first term is upper-bounded by the Earth-Mover distance, and the second term is upper-bounded by  since Si is a (k, )-coreset for P \ Ri−λ . So therefore Mi−λ ∪ Si is a 2-coreset for the stream P , and the proof is complete after rescaling . The previous theorem has, as special cases, streaming coresets for k-median, k-means, Lp , Cauchy estimators, Tukey estimators, etc. This the first algorithm that does not use merge-and-reduce for building coresets over streams for any of these problems. Moreover, the constant in the exponent for  is small, for the example of k-median the  dependence is −3 log(1/). References [AB99] M. Anthony and P. L. Bartlett. Neural Network Learning: Theoretical Foundations. Cambridge University Press, Cambridge, England, 1999. [AHPV04] P. K. Agarwal, S. Har-Peled, and K. R. Varadarajan. Approximating extent measures of points. Journal of the ACM, 51(4):606–635, 2004. [AMR+ 12] Marcel R. Ackermann, Marcus Märtens, Christoph Raupach, Kamil Swierkot, Christiane Lammersen, and Christian Sohler. Streamkm++: A clustering algorithm for data streams. J. Exp. Algorithmics, 17:2.4:2.1–2.4:2.30, May 2012. [BF15] Artem Barger and Dan Feldman. k-means for streaming and distributed big sparse data. SDM’16 and arXiv preprint arXiv:1511.08990, 2015. 38 [BLK15] Olivier Bachem, Mario Lucic, and Andreas Krause. Coresets for nonparametric estimation-the case of dp-means. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pages 209–217, 2015. [BMO+ 11] Vladimir Braverman, Adam Meyerson, Rafail Ostrovsky, Alan Roytman, Michael Shindler, and Brian Tagiku. Streaming k-means on well-clusterable data. In Proceedings of the Twenty-second Annual ACM-SIAM Symposium on Discrete Algorithms, SODA ’11, pages 26–40. SIAM, 2011. [BS80] Jon Louis Bentley and James B Saxe. Decomposable searching problems i. static-to-dynamic transformation. Journal of Algorithms, 1(4):301–358, 1980. [CEM+ 15] Michael B Cohen, Sam Elder, Cameron Musco, Christopher Musco, and Madalina Persu. Dimensionality reduction for k-means clustering and low rank approximation. In Proceedings of the Forty-Seventh Annual ACM on Symposium on Theory of Computing, pages 163–172. ACM, 2015. [Che08] Ke Chen. A constant factor approximation algorithm for k -median clustering with outliers. In Shang-Hua Teng, editor, SODA, pages 826–835. SIAM, 2008. [Che09a] Ke Chen. On coresets for k-median and k-means clustering in metric and euclidean spaces and their applications. SIAM Journal on Computing, 39(3):923– 947, 2009. [Che09b] Ke Chen. On coresets for k-median and k-means clustering in metric and euclidean spaces and their applications. SIAM J. Comput., 39(3):923–947, August 2009. [COP03] Moses Charikar, Liadan O’Callaghan, and Rina Panigrahy. Better streaming algorithms for clustering problems. In Proceedings of the Thirty-fifth Annual ACM Symposium on Theory of Computing, STOC ’03, pages 30–39, New York, NY, USA, 2003. ACM. [DDH+ 07] Anirban Dasgupta, Petros Drineas, Boulos Harb, Ravi Kumar, and Michael W. Mahoney. Sampling algorithms and coresets for lp regression. CoRR, abs/0707.1714, 2007. [FFK11] Dan Feldman, Matthew Faulkner, and Andreas Krause. Scalable training of mixture models via coresets. In Advances in Neural Information Processing Systems, pages 2142–2150, 2011. [FL11] Dan Feldman and Michael Langberg. A unified framework for approximating and clustering data. In Proceedings of the Forty-third Annual ACM Symposium on Theory of Computing, STOC ’11, pages 569–578, New York, NY, USA, 2011. ACM. 39 [FMS07] D. Feldman, M. Monemizadeh, and C. Sohler. A PTAS for k-means clustering based on weak coresets. In SoCG, 2007. [FS05] G. Frahling and C. Sohler. Coresets in dynamic geometric data streams. In Proc. 37th Annu. ACM Symp. on Theory of Computing (STOC), pages 209–217, 2005. [FS12] Dan Feldman and Leonard J Schulman. Data reduction for weighted and outlierresistant clustering. In Proceedings of the twenty-third annual ACM-SIAM symposium on Discrete Algorithms, pages 1343–1354. SIAM, 2012. [FSS13] Dan Feldman, Melanie Schmidt, and Christian Sohler. Turning big data into tiny data: Constant-size coresets for k-means, pca and projective clustering. In Proceedings of the Twenty-Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1434–1453. SIAM, 2013. [GMM+ 03] Sudipto Guha, Adam Meyerson, Nina Mishra, Rajeev Motwani, and Liadan O’Callaghan. Clustering data streams: Theory and practice. IEEE Trans. on Knowl. and Data Eng., 15(3):515–528, March 2003. [Guh09] Sudipto Guha. Tight results for clustering and summarizing data streams. In Proceedings of the 12th International Conference on Database Theory, ICDT ’09, pages 268–275, New York, NY, USA, 2009. ACM. [HHR11] Frank Hampel, Christian Hennig, and Elvezio Ronchetti. A smoothing principle for the huber and other location m-estimators. Computational Statistics & Data Analysis, 55(1):324 – 337, 2011. [HP11] Sariel Har-Peled. Geometric approximation algorithms, volume 173. American mathematical society Providence, 2011. [HPK07] S. Har-Peled and A. Kushal. Smaller coresets for k-median and k-means clustering. Discrete Comput. Geom., 37(1):3–19, 2007. [HPM04] S. Har-Peled and S. Mazumdar. On coresets for k-means and k-median clustering. In STOC, 2004. [Hub81] P. J. Huber. Robust statistics. 1981. [LBK15] Mario Lucic, Olivier Bachem, and Andreas Krause. Strong coresets for hard and soft bregman clustering with applications to exponential family mixtures. CoRR, abs/1508.05243, 2015. [LLS00] Yi Li, Philip M. Long, and Aravind Srinivasan. Improved bounds on the sample complexity of learning. In SODA, pages 309–318, 2000. [LLS01] Y. Li, P. M. Long, and A. Srinivasan. Improved bounds on the sample complexity of learning. Journal of Computer and System Sciences (JCSS), 62, 2001. 40 [LS10] M. Langberg and L. J. Schulman. Universal ε approximators for integrals. To appear in proceedings of ACM-SIAM Symposium on Discrete Algorithms (SODA), 2010. [Mat89] Jiřı́ Matoušek. Construction of epsilon nets. In Proceedings of the fifth annual symposium on Computational geometry, pages 1–10. ACM, 1989. [PKB14] Dimitris Papailiopoulos, Anastasios Kyrillidis, and Christos Boutsidis. Provable deterministic leverage score sampling. In Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 997– 1006. ACM, 2014. [SV07] Nariankadu D Shyamalkumar and Kasturi Varadarajan. Efficient subspace approximation algorithms. In SODA, volume 7, pages 532–540. Citeseer, 2007. [Tyl87] David E Tyler. A distribution-free m-estimator of multivariate scatter. The Annals of Statistics, pages 234–251, 1987. [VC71] V. N. Vapnik and A. Y. Chervonenkis. On the uniform convergence of relative frequencies of events to their probabilities. Theory Prob. Appl., 16:264–280, 1971. [Zha11] Z. Zhang. M-estimators. http://research. microsoft.com/enus/um/people/zhang/INRIA/ Publis/Tutorial-Estim/node20.html, [accessed July 2011]. 41
8cs.DS
Noname manuscript No. (will be inserted by the editor) arXiv:cs/0012008v1 [cs.PL] 13 Dec 2000 A General Framework for Automatic Termination Analysis of Logic Programs⋆ Nachum Dershowitz1 , Naomi Lindenstrauss2 , Yehoshua Sagiv2 , Alexander Serebrenik3 1 2 3 School of Computer Science, Tel-Aviv University, Tel-Aviv 69978, Israel. e-mail: [email protected] Institute for Computer Science, The Hebrew University, Jerusalem 91904, Israel. e-mail: {naomil,sagiv}@cs.huji.ac.il Department of Computer Science, K.U. Leuven, Celestijnenlaan 200A, B-3001 Heverlee, Belgium. e-mail: [email protected] The date of receipt and acceptance will be inserted by the editor Abstract This paper describes a general framework for automatic termination analysis of logic programs, where we understand by “termination” the finiteness of the LD-tree constructed for the program and a given query. A general property of mappings from a certain subset of the branches of an infinite LD-tree into a finite set is proved. From this result several termination theorems are derived, by using different finite sets. The first two are formulated for the predicate dependency and atom dependency graphs. Then a general result for the case of the query-mapping pairs relevant to a program is proved (cf. [29,21]). The correctness of the TermiLog system described in [22] follows from it. In this system it is not possible to prove termination for programs involving arithmetic predicates, since the usual order for the integers is not well-founded. A new method, which can be easily incorporated in TermiLog or similar systems, is presented, which makes it possible to prove termination for programs involving arithmetic predicates. It is based on combining a finite abstraction of the integers with the technique of the query-mapping pairs, and is essentially capable of dividing a termination proof into several cases, such that a simple termination function suffices for each case. Finally several possible extensions are outlined. Key words constraints termination of logic programs – abstract interpretation – ⋆ This research has been partially supported by grants from the Israel Science Foundation 2 Nachum Dershowitz et al. 1 Introduction The results of applying the ideas of abstract interpretation to logic programs (cf. [10]) seem to be especially beautiful and useful, because we are dealing in this case with a very simple language which has only one basic construct—the clause. Termination of programs is known to be undecidable, but again things are simpler for logic programs, because the only possible cause for their non-termination is infinite recursion, so it is possible to prove termination automatically for a large class of programs. For a formal proof of the undecidability of the termination of general logic programs see [1]. The kind of termination we address is the termination of the computation of all answers to a goal, given a program, when we use Prolog’s computation rule (cf. [24]). This is equivalent to finiteness of the LD-tree constructed for the program and query (the LD-tree is the SLD-tree constructed with Prolog’s computation rule—cf. [2]). Even if one is interested only in a single answer, it is important to know that computation of all answers terminates, since the solved query may be backtracked into (cf. [27]). One of the difficulties when dealing with the LD-derivation of a goal, given a logic program, is that infinitely many non-variant atoms may appear as subgoals. The basic idea is to abstract this possibly infinite structure to a finite one. We do this by mapping partial branches of the LD-tree to the elements of a finite set of abstractions A. By using the basic lemma of the paper and choosing different possibilities for A, we get different results about termination. The first two results are formulated for the predicate dependency and atom dependency graphs. Then we get, by using the query-mapping pairs of [29,21], first a termination condition that cannot be checked effectively and then a condition that can. The latter forms the core of the TermiLog system (cf. [22]), a quite powerful system we have developed for checking termination of logic programs. Then a new method, which can be easily incorporated in the TermiLog or similar systems, is presented for showing termination for logic programs with arithmetic predicates. Showing termination in this case is not easy, since the usual order for the integers is not well-founded. The method consists of the following steps: First, a finite abstract domain for representing the range of integers is deduced automatically. Based on this abstraction, abstract interpretation is applied to the program. The result is a finite number of atoms abstracting answers to queries, which are used to extend the technique of query-mapping pairs. For each query-mapping pair that is potentially non-terminating, a bounded (integer-valued) termination function is guessed. If traversing the pair decreases the value of the termination function, then termination is established. Usually simple functions suffice for each query-mapping pair, and that gives our approach an edge over the classical approach of using a single termination function for all loops, which must inevitably be more complicated and harder to guess automatically. General Framework for Automatic Termination Analysis 3 It is worth noting that the termination of McCarthy’s 91 function can be shown automatically using our method. Finally generalizations of the algorithms presented are pointed out, which make it possible to deal successfully with even more cases. 2 Preliminaries Consider the LD-tree determined by a program and goal. Definition 2.1 Let ← r1 , . . . , rn and ← s1 , . . . , sm be two nodes on the same branch of the LD-tree, with the first node being above the second. We say ← s1 , . . . , sm is a direct offspring of ← r1 , . . . , rn if s1 is, up to a substitution, one of the body atoms of the clause with which ← r1 , . . . , rn was resolved. We define the offspring relation as the irreflexive transitive closure of the direct offspring relation. We call a path between two nodes in the tree such that one is the offspring of the other a call branch. Take for example the add-mult program given in Figure 2.1 and the goal mult(s(s(0)),s(0),Z). (i) (ii) (iii) (iv) (v) add(0,0,0). add(s(X),Y,s(Z)) :- add(X,Y,Z). add(X,s(Y),s(Z)) :- add(X,Y,Z). mult(0,X,0). mult(s(X),Y,Z)) :- mult(X,Y,Z1), add(Z1,Y,Z). Fig. 2.1 add-mult example The LD-tree is given in Figure 2.2. In this case node (2) and node (6) are, for instance, direct offspring of node (1), because the first atoms in their respective goals come from the body of clause (v), with which the goal of node (1) was resolved. Note that we add to the predicate of each atom in the LD-tree a subscript that denotes who its ‘parent’ is, i.e., the node in the LD-tree that caused this atom to be called as the result of resolution. A graphical representation of the direct offspring relation is given in Figure 2.3. The following theorem holds: Theorem 2.1 If there is an infinite branch in the LD-tree corresponding to a program and query then there is an infinite sequence of nodes N1 , N2 , . . . such that for each i, Ni+1 is an offspring of Ni . Proof Straightforward. The main idea of the paper is to find useful finite sets of abstractions of call branches and to formulate termination results in terms of them. An effort has been made to make the presentation as simple and self-contained as possible. 4 Nachum Dershowitz et al. (1) ← mult(s(s(0)), s(0), Z) (2) ← mult(1) (s(0), s(0), Z1), add(1) (Z1, s(0), Z) (3) ← mult(2) (0, s(0), Z2), add(2) (Z2, s(0), Z1), add(1) (Z1, s(0), Z) {Z2 7→ 0} (4) ← add(2) (0, s(0), Z1), add(1) (Z1, s(0), Z) {Z1 7→ s(Z3)} (5) ← add(4) (0, 0, Z3), add(1) (s(Z3), s(0), Z) {Z3 7→ 0} (6) ← add(1) (s(0), s(0), Z) {Z 7→ s(Z4)} {Z 7→ s(Z5)} (7) ← add(6) (0, s(0), Z4) (8) ← add(6) (s(0), 0, Z5) {Z4 7→ s(Z6)} {Z5 7→ s(Z7)} (9) ← add(7) (0, 0, Z6) (10) ← add(8) (0, 0, Z7) {Z6 7→ 0} {Z7 7→ 0} (11) ← (12) ← Fig. 2.2 LD-tree ✟✟ ✟ ✟ (1) (2) (3) ❅ ❅ ❍ ❍❍ ❍ (4) (7) (5) (9) (6) ❅ ❅ (8) (10) Fig. 2.3 The offspring relation 3 The basic lemma Given an LD-tree we define a shadow of it as a mapping from its set of call branches to a finite set of abstractions. Definition 3.1 (Shadow) Let an LD-tree for a query and program and a finite set A be given. A shadow of the LD-tree into A is a mapping α that assigns to each call branch of the tree an element of A. Then the following basic lemma holds Lemma 3.1 (Basic Lemma) Suppose the LD-tree for a program and a query has an infinite branch. Let α be a shadow mapping from the call branches of the tree into a finite set A. Then there is a sequence of nodes General Framework for Automatic Termination Analysis 5 M1 , M2 , . . . and an element A ∈ A, such that for each i, Mi+1 is an offspring of Mi , and for each j, k the call branch from Mj to Mk is mapped by α to A. Proof By Theorem 2.1, there is an infinite sequence of nodes N1 , N2 , . . ., such that for each i, Ni+1 is an offspring of Ni . To each call branch from Ni to an Nj the mapping α assigns one of the elements of the finite set A. By Ramsey’s theorem [17] we get that there is a subsequence Nk1 , Nk2 , . . ., such that for each i, j the mapping α assigns to the branch from Nki to Nkj the same element. There is some structure in the set of call branches. If we have two call branches, one going from N1 to N2 and one going from N3 to N4 , we can if N2 = N3 define their composition, which is the branch from N1 to N4 . This operation is associative. In accordance with the nomenclature in algebra we can call a set S with a partial associative operation ∗ : S × S → S a semi-groupoid. We may want the finite set A to be a semi-groupoid too and the mapping α to be a homomorphism. This brings us to the definition of a structured shadow. Definition 3.2 (Structured Shadow) Let an LD-tree for a query and program and a finite semi-groupoid A be given. A structured shadow of the LD-tree into A is a mapping α that assigns to each call branch of the tree an element of A so that for any two call branches B1 and B2 that can be composed we have that α(B1 ) ∗ α(B2 ) is defined and α(B1 ∗ B2 ) = α(B1 ) ∗ α(B2 ) When defining a structured shadow it is enough to give the value of α for call branches between nodes and their direct offspring. This is the reason for the name. The element A whose existence is proved in the basic lemma is, in the case of a structured shadow, an element that can be composed with itself. We call such an element a circular element. Moreover, it is idempotent. 4 Two simple applications of the basic lemma In the following sections we’ll give applications of the basic lemma. In each case we’ll give the set of abstractions A which will always be finite and the mapping α from call branches to elements of A. In the first two applications we use the absence of circular elements in A to derive termination. 4.1 The Predicate Dependency Graph Take as A elements of the form (p → q) where p and q are predicate symbols of the program. Define composition as (p → q) ∗ (q → r) = (p → r) 6 Nachum Dershowitz et al. If a call branch goes from a node ← p(X1 , . . . , Xn ), . . . to another node ← q(Y1 , . . . , Ym ), . . . we’ll define the value of α on it as (p → q). It is not difficult to see that α is a structured shadow. The predicate dependency graph of a program is a graph whose vertices are the predicate symbols of the program and such that for each clause A :− B1 , . . . , Bn it has an arc from the predicate of A to the predicate of Bi , for i = 1, . . . , n (cf. [28]). If N1 , N2 are nodes in the LD-tree such that one is the direct offspring of the other then the value of α for the call branch between them can be seen as an arc in the predicate dependency graph of the program. From the basic lemma we get that if there is non-termination then there must be a circular element in the image under α of all the call branches of the LD-tree, that is, an element of the form p → p. This means that there is a non-trivial strongly connected component in the predicate dependency graph (a trivial strongly connected component is one that consists of a single vertex with no arc going from it to itself). Consequently, the following wellknown theorem follows from the basic lemma: Theorem 4.1 If there is no non-trivial strongly connected component in the predicate dependency graph of a program any query to it terminates. It is easy to find examples of programs such that every query to them terminates and yet their predicate dependency graph has non-trivial strongly connected components. Take the program at(jerusalem, mary). at(X, jane) :− at(X, mary). where the predicate dependency graph has the single vertex at with an arc at → at. 4.2 The Atom Dependency Graph Define two atoms to be equivalent if they are variants of each other. For an atom At denote by [At] its equivalence class under variance. Take as A elements of the form [p(T1 , . . . , Tn )] → [q(S1 , . . . , Sm )] where p(T1 , . . . , Tn ) is an atom that appears in the head of a clause in the program and q(S1 , . . . , Sm ) is an atom that appear in the body of a clause. Composition is defined for pairs [p(T1 , . . . , Tn )] → [q(S1 , . . . , Sm )] and [q(R1 , . . . , Rm )] → [r(W1 , . . . , Wk )] such that representatives that are named apart of [q(S1 , . . . , Sm )] and [q(R1 , . . . Rm )] can be unified. In that case the result of the composition is [p(T1 , . . . , Tn )] → [r(W1 , . . . , Wk )]. Now suppose a node ← p(T1 , . . . , Tn ), . . . has as direct offspring a node ← q(S1 , . . . , Sm ), . . . and suppose the clause used for resolution with the first node was A :− B1 , . . . , Bl and that the atom q(S1 , . . . , Sm ) originates General Framework for Automatic Termination Analysis 7 in Bj . Then we will take α to map the call branch between the two nodes to [A] → [Bj ]. For call branches between nodes that are not direct offspring of each other we define the value of α by composition. We can define the atom dependency graph of a program as follows. Consider a graph whose vertices are equivalence classes of atoms that appear in the program. If there is a rule A :− B1 , B2 , ..., Bn then we put in the graph arcs [A] → [Bi ] (i = 1, ..., n). We call these arcs “arcs of the first kind”. Now if there are arcs of the first kind [A1 ] → [A2 ] and [B1 ] → [B2 ] and named apart variants of A2 and B1 can be unified, we also add an arc [A2 ] → [B1 ]. Such an arc we call “an arc of the second kind”. The graph we get we call the atom dependency graph (note the similarity to the U-graph of [38]). For the example at the end of the previous subsection the atom dependency graph consists of the two vertices [at(X, jane)], [at(X, mary)] and an arc from the first to the second. From the basic lemma we get that if there is an infinite branch in the LD-tree there must be a circular element in the image under α of the call branches of the LD-tree. So we get the following conclusion of the basic lemma: Theorem 4.2 If there is no non-trivial strongly connected component in the atom dependency graph of a program any query to it terminates. Again it is not difficult to find programs such that every query to them terminates and yet their atom dependency graph has non-trivial strongly connected components. Take the following program p(X, f(Z)) :− q(X, f(Z)). q(g(Y), W) :− r(g(Y), W). r(X, X) :− p(X, X). for which every SLD-tree is finite, but for which there is a strongly connected component consisting of 6 nodes in its atom dependency graph—if we denote by a, b, c, d, e, f respectively the atom dependency graph nodes [p(X, f (Y ))], [q(X, f (Y ))], [q(g(X), Y )], [r(g(X), Y )], [r(X, X)], [p(X, X)] then there are arcs of the first kind from a to b, from c to d and from e to f and arcs of the second kind from b to c, from d to e and from f to a, so the nodes a, b, c, d, e, f form a strongly connected component. 5 The Abstraction to Query-Mapping Pairs We will now consider a more complex abstraction and take as A the set of query-mapping pairs determined by the program. In this case termination will follow not from the absence of circular elements in the image of the 8 Nachum Dershowitz et al. shadow mapping, but from the absence of circular elements of a certain kind. We start with a formal definition of query-mapping pairs. The meaning of the pairs will be clarified later. Definition 5.1 (Mixed Graph) A mixed graph is a graph with both edges and arcs. (We use the usual terminology—edges are undirected, while arcs are directed.) A query-mapping pair consists of two parts, both of which are mixed graphs, however a different notation is used for each. Definition 5.2 (Query-Mapping Pair) A query-mapping pair (π, µ) consists of two parts: – The query π, that is a mixed graph whose nodes correspond to argument positions of some predicate in the program and are either black, denoted by b, or white, denoted by f. An edge from the i’th to the j’th position will be denoted by eq(i, j). An arc from the i’th to the j’th position will be denoted by gt(i, j). As an example of a query for the add-mult program take mult(b,b,f) [gt(1,2),eq(2,3)]. – The mapping µ, that is a mixed graph whose nodes correspond to the argument positions of the head of some rule (the domain) and the argument positions of some body atom of that rule (the range). Again nodes can be black or white. In this case we depict the graph pictorially, as in Figure 5.1. 11 0 mult 00 00 1 11 1 0 11 0 mult 00 00 1 11 1 0 Fig. 5.1 Example of mapping For examples of query-mapping pairs see Figures 5.2, 5.3, 5.4. Clearly the number of query-mapping pairs that can be created by using the predicate symbols of a program is finite. The means for proving termination is choosing a well-founded order on terms and using it to show that the LD-tree constructed for the program and query cannot have infinite branches. Different orders may be defined (cf. [14]). One of the ways an order can be given is by defining a norm on terms. For example, one can use symbolic linear norms, which include as special cases the term-size norm and the list-size norm. These symbolic linear norms will be linear expressions, which we will be able to use in the termination proof when they become integers. Essentially edges and arcs will denote equality and inequality of norms and a node will become black if its symbolic linear norm is an integer. General Framework for Automatic Termination Analysis 9 Definition 5.3 (Symbolic Linear Norm) A symbolic linear norm for the terms created from an alphabet consisting of function symbols and variables is defined for non-variable terms by kf (X1 , . . . Xn )k = c + n X ai kXi k i=1 where c and a1 , . . . an are non-negative integers that depend only on f /n. This also defines the norm of constants if we consider them as function symbols with 0 arity. With each logical variable we associate an integer variable to represent its norm (we use the same name for both, since the meaning of the variable is clear from the context). Definition 5.4 (Instantiated Enough) A term is instantiated enough with respect to a symbolic linear norm if the expression giving its symbolic norm is an integer. In this way of defining symbolic norms we follow [35]. Some authors define the norm of a variable to be 0 and then use the norm only for terms that are rigid with respect to it (cf. [13]). In our context it is more convenient to use the symbolic norm. If the symbolic linear norm of a term is an integer then we know that the term is rigid with respect to this particular norm. We get the term-size norm, which can be defined for a ground term as the number of edges in its representation as a tree, or alternatively as the sum of the arities of its functors, by setting for every f /n c = n , a1 = · · · an = 1 So, for instance, the symbolic term-size norm of f (g(X, X, Y ), X) is 5 + 3X + Y . The symbolic term-size norm of a term is an integer exactly when the term is ground. To get the list-size norm we set for the list functor k[H|T ]k = 1 + kT k that is c = 1, a1 = 0, a2 = 1, and for all other functors equate the norm of a term with them as head functor to 0. In this case the norm is a positive integer exactly for lists that have finite positive length, irrespective of whether their elements are fully instantiated or not. This is perhaps the place to note that, since for the term-size norm all the ai ’s are nonzero, a term is instantiated enough with respect to it only if it is ground, while for other symbolic norms a term may be instantiated enough without being ground. Given the LD-tree of a program we define the shadow mapping αreal as follows. With each call branch between nodes that are offspring of each other we associate a query-mapping pair in the following way: 10 Nachum Dershowitz et al. If – the node nearest to the root among the branch nodes is ← p1 , . . . , pm , – the node farthest from the root is ← q1 , . . . , qn , – the substitution θ is the composition of the substitutions associated with the branch, – abs is the abstraction function which associates with each atom the same atom with its arguments replaced by b for arguments that are instantiated enough for the norm used and f otherwise, then – the query of the pair is abs(p1 ), with the constraints that hold between the arguments of p1 , – the domain of the mapping is abs(p1 θ), – the range is abs(q1 ), – edges connect elements in the domain and range for which the corresponding elements in the tree (i.e. the arguments of p1 θ and q1 ) have the same norm, – arcs connect elements in the domain and range for which the corresponding elements in the tree are instantiated enough and for which a norm inequality can be inferred. (The reader might be puzzled why we introduce arcs between elements for which a norm inequality can be inferred only if the arguments are instantiated enough—the term-size of s(X) will always be larger than that of X, whatever the substitution for X will be. However, to prove termination we use the well foundedness of the non-negative integers, so will use the fact that there cannot be an infinite path of arcs, since in our case they connect elements with integer norm.) Take for example the add-mult program given in Figure 2.1 and the goal mult(s(s(0)),s(0),Z) and use the term-size norm (recall that for a ground term its term-size is the number of edges in its representation as a tree). To give a few examples of the query-mapping pairs we get for the LDtree of this program and goal, which is shown in Figure 2.2 (where we denote the constraints of a query by a list of elements of the form eq(i, j) if the i’th and j’th arguments have the same term-size, and gt(i, j) if the term-size of the i’th argument is greater than that of the j’th argument; and where there is in the mappings an edge between nodes with the same term-size and an arc from a node with larger integer term-size to a node with smaller integer term-size): For the call branch between node (1) and its direct offspring (2) we get the pair depicted in Figure 5.2. For the call branch between node (6) and its direct offspring (8) we get the pair presented in Figure 5.3. For the call branch between node (6) and its offspring node (10) we get the pair in Figure 5.4. Note the following properties of query-mapping pairs in the image of αreal . A black node corresponds to an argument position which is instanti- General Framework for Automatic Termination Analysis query: mult(b,b,f) 11 [gt(1,2)] 1 0 1 0 1 00 11 mapping: mult 0 0 1 0 1 1 0 0 1 00 11 0 1 1 0 001 11 0 0 1 00 11 0 1 mult 1 0 1 00 11 0 1 0 1 0 11 00 Fig. 5.2 Query-mapping pair for the branch from (1) to (2) query: add(b,b,f) mapping: add add [eq(1,2)] 0 1 1 0 11 00 0 1 0 1 00 11 0 1 0 1 00 11 0 1 0 1 00 11 11 00 0 1 0 1 00 11 1 0 1 0 Fig. 5.3 Query-mapping pair for the branch from (6) to (8) query: add(b,b,f) mapping: add add [eq(1,2)] 0 1 1 0 11 00 0 1 00 11 0 1 00 11 0 1 00 11 0 1 00 11 1 0 1 0 Fig. 5.4 Query-mapping pair for the branch from (6) to (10) ated enough for the chosen symbolic norm to be an integer. A white node corresponds to an argument position that is potentially not instantiated enough. An edge connects two nodes that have equal symbolic norms, and hence must be of the same color. An arc goes from a black node to another black node that has smaller norm (recall that norms of black nodes are nonnegative integers). The proof of termination uses the existence of such arcs and the well-foundedness of the non-negative integers with the usual order. We define consistency of a mixed graph: Definition 5.5 (Consistency) A mixed graph is consistent if it has no positive cycle (i.e. a cycle that may contain both edges and arcs, but has at least one arc). Then it is clear that queries and mappings in the image must be consistent. A positive cycle may have only black nodes. This means that for each argument T represented by such a node we have that kT k is an integer and kT k < kT k, which is impossible. That is, a query-mapping pair that is not consistent represents a branch that cannot really occur. Note further that sets of edges and arcs for queries and mappings are closed under transitive closure and that the domain of a mapping of a pair is subsumed by the query, where subsumption is defined as follows. 12 Nachum Dershowitz et al. Definition 5.6 (Subsumption) Given two mixed graphs with black and white nodes G1 and G2 , we say that G1 is subsumed by G2 if they have the same nodes up to color, every node that is black in G2 is also black in G1 , and every edge or arc between nodes in G2 also appears for the respective nodes in G1 . Among all query-mapping pairs we distinguish the ‘recursive’ pairs, those for which the query is identical to the range of the mapping (the query-mapping pair given in Figure 5.4 is of this kind). Before proceeding we need the following two definitions from [29]. We want to model recursive calls, so in the case of a query-mapping pair (π, µ) such that π is identical to the range of µ, we create what we call a circular variant by introducing special edges between corresponding nodes in the domain and range. These special edges behave like ordinary edges, except that they can only be traversed from range to domain. What a circular edge between a range node and domain node models, is that the range node can become unified with the domain node of another instance of the pair we considered. Definition 5.7 (Circular Variant) If (π, µ) is a query-mapping pair, such that π is identical to the range of µ, then the circular variant of (π, µ) is (π, µ′ ), where µ′ is obtained from µ by connecting each pair of corresponding nodes in the domain and range with a circular edge. Definition 5.8 (Forward Positive Cycle) A circular variant (π, µ) has a forward positive cycle if µ has a positive cycle, such that when this cycle is traversed, each circular edge is traversed from the range to the domain. From the basic lemma we get that if there is an infinite branch in the tree, there must be an infinite sequence of nodes N1 , N2 , . . . such that for each i the branch from Ni to Ni+1 is mapped into the same recursive pair. Suppose the circular variant of this pair has a positive forward cycle. Start with a node on a forward positive cycle, in the domain of the pair corresponding to some call branch, say from Ni to Ni+1 . Now traverse the cycle, but in the case of a circular edge go from the range of this pair to the domain of the pair for the call branch from Ni+1 to Ni+2 . After a number of steps equal to the number of circular arcs on the forward positive cycle we’ll return to the same node in the pair as we started from, only now corresponding to a lower call branch. From the existence of the forward positive cycle we can deduce a decrease in norm. This means that we can find an infinite sequence of arguments of atoms in the tree, such that their norms form a descending sequence of non-negative integers, which is impossible. So we get the following conclusion from the basic lemma Theorem 5.1 Let the LD-tree for a query and a program and a symbolic linear norm be given. Define αreal as above. If all the circular variants that can be created from the query-mapping pairs in the image of αreal have a forward positive cycle, then the tree must be finite, i.e., there is termination for the query with Prolog’s computation rule. General Framework for Automatic Termination Analysis 13 Again it is easy to find an example of a program that terminates although it does not satisfy the condition of the theorem. Take the program p(0). p(1) :− p(0). with query pattern p(f ) and a norm that assigns the same value to 0 and 1. Theorem 5.1 does not give us an effecive way to determine for a particular program and query if there is termination, because we cannot always construct the LD-tree that may be infinite. The next section gives a way to approximate the ‘real’ query-mapping pairs. The algorithm proposed either says that there is termination, or that it is not strong enough to decide. 5.1 The Query-Mapping Pairs Algorithm The following algorithm has been implemened in a system called TermiLog (cf. [21,22]), which is quite powerful and has been able to analyze correctly 82% of the 120 benchmark programs it was tested on, taken from the literature on termination and other sources. The basic idea of the algorithm is to approximate the set of query-mapping pairs that are associated with the LD-tree for a query and program. We will show that each ‘real’ querymapping pair arising from the LD-tree (i.e. the image under αreal of a call branch) is subsumed by a query-mapping pair in the approximation, so that a sufficient condition for the finiteness of the LD-tree is that every circular variant in the approximation has a forward positive cycle. We will define a structured shadow αapp , which is a widening (cf. [10]) of αreal , by giving its value for call branches between nodes that are direct offspring of each other (the generation step) and find its value for other call branches by composition (the composition step). It should be noted that in this case αapp associates with each call branch a query-mapping pair that depends not only—as in the previous section—on the nodes at the ends of the branch and the substitution associated with them, but also on the location of the branch in the tree. Since we are approximating the ‘real’ pairs our conclusions are sound, but there may be constraints which we have not inferred, so it may happen that the value of αapp for two call branches which look identical but are in different parts of the tree will be different. The first step is constructing from each rule of the program a weighted rule graph, which extracts the information about argument norms that is in the rule. Definition 5.9 (Weighted Rule Graph) The weighted rule graph associated with a rule has as nodes all the argument positions of the atoms in the rule; it has edges connecting the nodes of arguments which have equal norm and has a potential weighted arc between any two nodes such that the 14 Nachum Dershowitz et al. difference between the norms of the respective arguments, which is a linear expression, has non-negative coefficients and a positive constant term, and this potential arc is labeled by the difference. In our example, using the term-size norm, we get for the rule mult(s(X), Y, Z)) :− mult(X, Y, Z1), add(Z1, Y, Z). the weighted rule graph that is shown in Figure 5.5. The potential arc is mult s(X) 1 Y Z mult X Y Z1 add Z1 Y Z Fig. 5.5 Weighted rule graph shown by a dashed arc. It should be explained what potential arcs are. In the termination proof we use the fact that the order induced by the norm on terms that are instantiated enough is well-founded (recall that for such terms the norm is a non-negative integer). Once we know that the nodes connected by a potential arc are instantiated enough, we connect them with an arc. However, we will not do this when we do not know that the arguments are instantiated enough, because we want to be sure that there cannot be an infinite path consisting of arcs. Consider for example the program int(0). int(s(X)) :− int(X). with the query int(Y) and the term-size norm. From the rule we get the weighted rule graph that is shown in Figure 5.6, but as Figure 5.7 shows there is an infinite derivation. int s(X) 1 int X Fig. 5.6 Weighted rule graph We return now to the original example. We have the query mult(s(s(0)), s(0), Z) General Framework for Automatic Termination Analysis 15 ← int(Y ) {Y 7→ s(Y 1)} ← int(Y 1) {Y 1 7→ s(Y 2)} ← int(Y 2) .. . Fig. 5.7 Infinite derivation which we abstract to the query pattern mult(b, b, f ) with empty constraint list. We now construct the summaries of the augmented argument mappings associated with it, terms that will be defined presently. Our definition of augmented argument mapping differs from that in [29], for reasons that will be explained. The basic idea is that we take a rule r, for which the head predicate is the same as in the query, and a subgoal s in the body of r, and try to approximate the ‘real’ query-mapping pair corresponding to the head of r and s in the LD-tree. We do this by using information we have from the weighted rule graph of r and also, if we have them, results of instantiation analysis and constraint inference about the instantiations and constraints of the body subgoals preceding s, which we assume have succeeded before we got to s. The method used for the instantiation analysis and constraint inference is abstract interpretation. For the details see [21]. Definition 5.10 (Augmented Argument Mapping) An augmented argument mapping, which is a mixed graph, is constructed for a rule r and a subgoal s in its body as follows. – There are nodes for the argument positions of the head of r, for s, and for all subgoals that precede s. – Nodes are blackened in agreement with the rule and the instantiation analysis for subgoals that precede s.1 – There are all the edges and arcs that can be derived from the weighted rule graph and from the constraint inference for subgoals preceding s. – In the case of disjunctive information about constraints or instantiations the augmented argument mapping will use one disjunct. 1 In [29] nodes that correspond to arguments that precede s are made black. This is justified there because of the assumption that any variable in the head of a program clause also appears in its body, an assumption which causes all atoms in the success set of the program to be ground, but not in our more general setting. Another difference is the use of weighted arcs. For instance, if we have the configuration with edges, arcs and weighted arcs, that is presented in Figure 5.8, we can say that in the transitive closure there is an arc from N1 to N5 , while we could not come to this conclusion if the weighted arcs were ordinary arcs. 16 Nachum Dershowitz et al. – The graph is consistent. – The domain consists of the nodes corresponding to the head of r, and the range consists of the nodes corresponding to s. 2+X 2+X 111 000 00 1111 000 000 111 1111 0000 0 1 1 11 00 1 0 1 0 Fig. 5.8 The weighted arcs A few words about the consistency: If, for instance, we are constructing the augmented argument mapping for the rule a(X, Y) :− b(X, Y), c(X, Y), d(X, Y). and the subgoal d(X, Y ) we cannot use for b the constraint gt(1, 2) and for c the conflicting constraint gt(2, 1), or for b the instantiation b(ie, nie) and for c the conflicting instantiation c(nie, ie) (here ie denotes an argument that is instantiated enough, and nie an argument that is not—note the difference between ie and nie, which are mutually exclusive and b and f , where the second possibility includes the first). Definition 5.11 (Summary) If µ is a consistent augmented argument mapping, then the summary of µ consists of the nodes in the domain and range of µ and the edges and arcs among these nodes (it is undefined if µ is inconsistent). Summaries of augmented argument mappings give us approximations to ‘real’ mappings constructed for nodes that are direct offspring of each other. We return now to the query mult(b, b, f ) and build the augmented argument mappings derived for it from the rule mult(s(X), Y, Z)) :− mult(X, Y, Z1), add(Z1, Y, Z). It should be noted that when we build the augmented argument mapping for a query we also take into account the instantiations and constraints of the query. For the first subgoal we get the mapping presented in Figure 5.9. The 0 00 mult 1 01 0 1 011 1 00 11 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 00 01 0 1 mult 1 011 1 00 11 Fig. 5.9 Mapping for the first subgoal General Framework for Automatic Termination Analysis 17 summary is identical to the mapping, and Figure 5.10 presents the querymapping pair obtained. query: mult(b,b,f) [] 1 0 1 0 1 mapping: mult 0 0 1 0 1 1 0 0 1 0 1 1 0 0 1 0 1 0 1 mult 0 0 1 1 0 1 1 0 (1) Fig. 5.10 Query-mapping pair for the first subgoal of mult From the augmented argument mapping corresponding to the second subgoal of the rule we basically want to infer the relationship between mult(s(X), Y, Z) and add(Z1, Y, Z) assuming mult(X, Y, Z1) has already been proved. This is where we use instantiation analysis and, possibly, constraint inference. If we did not use any information on mult(X, Y, Z1) we would get the augmented argument mapping presented in Figure 5.11. Now mult 0 1 0 1 0 1 1 0 0 1 0 1 1 0 1 0 1 mult 0 0 1 1 0 add 0 1 Fig. 5.11 Mapping for the second subgoal from the instantiation analysis we will get that the two possible instantiations for mult are mult(ie, ie, ie) and mult(ie, nie, ie) where ie denotes a ground term and nie denotes a non-ground term, i.e., a term that contains at least one variable. Since the first two arguments of the intermediate subgoal are ground, so must the third one be. So we get the augmented argument mapping that is presented in Figure 5.12, which gives rise to the query-mapping pair presented in Figure 5.13 and the new query add(b, b, f ) (with no constraints). If we had not been able to use the results of the instantiation analysis we would have gotten the query add(f, b, f ), which does not terminate, and our algorithm would just have said for the original query that there may be non-termination. Using the appropriate augmented argument mappings for the new query add(b, b, f ), we get the new query-mapping pairs (Figures 5.14 and 5.15) and no new queries. 18 Nachum Dershowitz et al. 1 1 0 mult 0 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 1 mult 1 0 0 1 0 add 1 1 0 0 0 1 1 0 Fig. 5.12 Mapping for the second subgoal query: mult(b,b,f) [] 1 0 mapping: mult 0 0 1 0 1 1 1 0 0 1 add (2) 1 0 0 1 0 1 1 1 0 0 Fig. 5.13 Query-mapping pair for the second subgoal of mult query: add(b,b,f) mapping: add add [] 1 1 0 0 0 1 0 1 0 1 0 1 1 1 0 0 (3) Fig. 5.14 Query-mapping pair for add query: add(b,b,f) mapping: add add [] 0 1 1 0 0 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 (4) Fig. 5.15 Query-mapping pair for add Now we have to apply composition to the query-mapping pairs we have created thus far. Recall the following definitions from [29]: Definition 5.12 (Composition of Mappings) If the range of a mapping µ and the domain of a mapping ν are labeled by the same predicate, then the composition of the mappings µ and ν, denoted µ ◦ ν, is obtained by unifying each node in the range of µ with the corresponding node in the domain of ν. When unifying two nodes, the result is a black node if at least one of the nodes is black, otherwise it is a white node. If a node becomes black, so do all nodes connected to it with an edge. The domain of µ ◦ ν is that of µ, and General Framework for Automatic Termination Analysis 19 its range is that of ν. The edges and arcs of µ ◦ ν consist of the transitive closure of the union of the edges and arcs of µ and ν. Definition 5.13 (Composition of Query-Mapping Pairs) Let (π1 , µ1 ) and (π2 , µ2 ) be query-mapping pairs, such that the range of µ1 is identical to π2 . The composition of (π1 , µ1 ) and (π2 , µ2 ) is (π1 , µ), where µ is the summary of µ1 ◦ µ2 (and, hence, the composition is undefined if µ1 ◦ µ2 is inconsistent). By repeatedly composing the approximations we got thus far we get the following new pairs. Composition of pairs (1) and (2) gives a new pair (5); pairs (3) and (4) give a new pair (6); (2) and (6) give (7). These new pairs are presented by Figures 5.16, 5.17 and 5.18 respectively. No more query-mapping pairs can query: mult(b,b,f) [] 1 0 mapping: mult 0 0 1 0 1 1 1 0 0 1 add (5) 1 0 0 1 0 1 1 1 0 0 Fig. 5.16 Query-mapping pair for add query: add(b,b,f) [] mapping: add 1 0 0 0 1 1 0 1 add 1 1 0 0 (6) Fig. 5.17 Query-mapping pair for add query: mult(b,b,f) [] mapping: mult 0 1 1 0 add Fig. 5.18 Query-mapping pair for add be created. 1 0 0 0 1 1 0 1 (7) 20 Nachum Dershowitz et al. Since for each of the above query-mapping pairs, if the circular variant exists it has a forward positive cycle, it follows, since for each call branch its image under αapp subsumes its image under αreal , that queries of the form mult(b, b, f ) terminate. If in the above example we would have used results of the constraint inference for the one intermediate subgoal we had, we would have gotten more query-mapping pairs, but again every circular variant would have had a forward positive cycle, so we would have been able to show termination. However, if it is possible to prove termination without constraint inference, there is no reason to use it, because the more query-mapping pairs there are the longer the termination proof takes. The following theorem holds: Theorem 5.2 Let the LD-tree for a query and program and a symbolic linear norm be given. Define the structured shadow αapp as above. If all the circular variants that can be created from query-mapping pairs in the image of αapp have a forward positive cycle then the tree must be finite, i.e., there is termination for the query with Prolog’s computation rule. This theorem follows from Theorem 5.1 if we notice that for every call branch B we have that αreal (B) is subsumed by αapp (B). Actually, since we have here a structured shadow, the element whose existence is proved in the basic lemma is both circular and idempotent. So we can formulate a stronger theorem, which is more efficient to implement: Theorem 5.3 Let the LD-tree for a query and program and a symbolic linear norm be given. Define the structured shadow αapp as above. If all the circular idempotent query-mapping pairs in the image of αapp have an arc from an argument in the domain to the corresponding argument in the range, then the tree must be finite, i.e., there is termination for the query with Prolog’s computation rule. It is not difficult to see that the condition of Theorem 5.2 implies the condition of Theorem 5.3, since if we have a circular idempotent pair for which the circular variant has a forward positive cycle, and compose it with itself the right number of times (that is, the number of circular arcs on the forward positive cycle), we get an arc from an argument in the domain to the corresponding argument in the range. Theorem 5.3 is really stronger than Theorem 5.2, as the following program shows: p(0, 0). p(s(X), Y) :− p(f(0), X). p(X, s(Y)) :− p(Y, f(0)). In this case there is termination for queries of the form p(b, b), but, using the term-size norm, this can only be deduced from Theorem 5.3 and not General Framework for Automatic Termination Analysis 21 Theorem 5.2, because there are circular variants without forward positive cycle. It is interesting to note that the rule of composition does not hold for αreal , so it is not a structured shadow. For instance if we take the program p(X, a) :− q(X). q(X) :− r(X, a). and the LD-tree for p(X,a) (1) ← p(X, a) (2) ← q(X) (3) ← r(X, a) and the term-size norm, then the image under αreal of the branch from (1) to (2) composed with the image under αreal of the branch from (2) to (3) will not contain the edge between the second arguments of p and r that is in the image under αreal of the branch between (1) and (3). We will always have that αreal (B1 ) ∗ αreal (B2 ) subsumes αreal (B1 ∗ B2 ). The following optimization of Theorem 5.2 holds: It is enough to consider only query-mapping pairs in which the predicate of the domain and the predicate of the range are in the same strongly connected component of the predicate dependency graph. 6 Logic programs containing arithmetic predicates The algorithm we describe next would come into play only when the usual termination analyzers fail to prove termination using the structural arguments of predicates. As a first step it verifies the presence of an integer loop in the program. If no integer loop is found, the possibility of nontermination is reported, meaning that the termination cannot be proved by this technique. If integer loops are found, each of them is taken into consideration. The algorithm starts by discovering integer positions in the program, proceeds with creating appropriate abstractions, based on the integer loops, and concludes by applying an extension of the query-mapping pairs technique. The formal algorithm is presented in Subsection 6.6. The structured shadow we define in this case assigns to the branch from node ← r1 , . . . , rn to its direct offspring ← s1 , . . . , sk , where θ is the composition of the substitutions between the nodes, the following query-mapping pair: each atom is abstracted to a pair (predicate, constraint), where the constraint is one from a finite set of mutually exclusive numerical constraints (for example, arg1 > 0, arg1 > arg2, where arg1 and arg2 are respectively the first and the second arguments of the atom). The query is the abstraction of r1 . The mapping of the query-mapping pair, is as before, a quadruple— the domain, the range, edges and arcs. The domain of the query-mapping 22 Nachum Dershowitz et al. pair is the abstraction of r1 θ, the range is the abstraction of s1 , and there are edges and arcs between nodes of r1 θ and s1 . Edges and arcs correspond to numerical equalities and inequalities of the respective arguments. When composing two query-mapping pairs numerical nodes are unified only if they have the same constraint (remember that the constraints are mutually exclusive). Termination is shown by means of a non-negative termination function of the arguments of an atom, that decreases from the domain to the range (cf. [15]). Note that in the numerical part of the program we will use both the query-mapping pairs relative to the norm and the new kind of numerical query-mapping pairs. As we will see later on, sometimes in order to prove termination (cf. Example 6.12) both kinds of query-mapping pairs are essential. The technique we present in this section allows us to analyze correctly on the one hand common examples of Prolog programs (such as factorial [12], Fibonacci, Hanoi [7], odd even [28], between [2], Ackermann [32]), and on the other hand more difficult examples, such as gcd and mc carthy 91 [25, 20,16]. Note that some of these examples were previously considered in the literature on termination. However, they were always assumed to be given in the successor notation, thus solving the problem of well-foundedness. Moreover, the analysis of some of these examples, such as gcd, required special techniques [23]. 6.1 The 91 function We start by illustrating informally the use of our algorithm for proving the termination of the 91 function. This convoluted function was invented by John McCarthy for exploring properties of recursive programs, and is considered to be a good test case for automatic verification systems (cf. [25, 20,16]). The treatment here is on the intuitive level. Formal details will be given in subsequent sections. Consider the clauses: Example 6.1 mc carthy 91(X, Y) :− X > 100, Y is X − 10. mc carthy 91(X, Y) :− X ≤ 100, Z is X + 11, mc carthy 91(Z, Z1), mc carthy 91(Z1, Y). and assume that a query of the form mc carthy 91(i,f ) is given, that is, a query in which the first argument is bound to an integer, and the second is free. This program computes the same answers as the following one: mc carthy 91(X, Y) :− X > 100, Y is X − 10. mc carthy 91(X, 91) :− X ≤ 100. with the same query. Note, however, that while the termination of the latter program is obvious, since there is no recursion in it, the termination of the General Framework for Automatic Termination Analysis 23 first one is far from being trivial and a lot of effort was dedicated to find termination proofs for it ([25,20,16]). Our algorithm starts off by discovering numerical arguments. This step is based on abstract interpretation, and as a result both arguments of mc carthy 91 are proven to be numerical. Moreover, they are proven to be of integer type. The importance of knowledge of this kind and techniques for its discovery are discussed in Subsection 6.2.2. The next step of the algorithm is the inference of the (finite) integer abstraction domain which will help overcome difficulties caused by the fact that the (positive and negative) integers with the usual (greater-than or less-than) order are not well-founded. Integer abstractions are derived from arithmetic comparisons in the bodies of rules. However, a simplistic approach may be insufficient and the more powerful techniques presented in Section 6.3 are sometimes essential. In our case the domain {(−∞, 89], [90, 100], [101, ∞)} of intervals is deduced. For the sake of convenience we denote this tripartite domain by {small, med, big}. In the next step, we use abstract interpretation to describe answers to queries. This allows us to infer numerical inter-argument relations of a novel type. In Section 6.4 the technique for inference of constraints of this kind is presented. For our running example we get the following abstract atoms: mc carthy 91(big,big) mc carthy 91(big,med) mc carthy 91(med,med) mc carthy 91(small,med) These abstract atoms characterize the answers of the program. The concluding step creates query-mapping pairs in the fashion of [21]. This process uses the abstract descriptions of answers to queries and is described in Section 6.5. In our case, we obtain among others, the querymapping pair having the query mc carthy 91(i,f ), where i denotes an integer argument and f an unrestricted one, and the mapping presented in Figure 6.1. The upper nodes correspond to argument positions of the head of the recursive clause, and the lower nodes—to argument positions of the second recursive subgoal in the body. Circled black nodes denote integer argument positions, and white nodes denote positions on which no assumption is made. The arc denotes an increase of the first argument, in the sense that the first argument in the head is less than the first argument in the second recursive subgoal. Each set of nodes is accompanied by a set of constraints. Some could be inter-argument relations of the type considered in [21]. In our example this subset is empty. The rest are constraints based on the integer abstraction domain. In this case, that set contains the constraint that the first argument is in med. The query-mapping pair presented is circular (upper and lower nodes are the same), but the termination tests of [21,9] fail. Thus, a termination function must be guessed. For this loop we can use the 24 Nachum Dershowitz et al. 11 00 00 11 {arg1 in med } 11 00 {arg1 in med } Fig. 6.1 Mapping for McCarthy’s 91 function function 100−arg1, where arg1 denotes the first argument of the atom. The value of this function decreases while traversing the given query-mapping pair from the upper to the lower nodes. Since it is also bounded from below (100 ≥arg1), this query-mapping pair may be traversed only finitely many times. The same holds for the other circular query-mapping pair in this case. Thus, termination is proved. 6.2 Arithmetic Loops We start our discussion on termination of numerical computations by providing a formal definition of numerical loop, analyzing the problems one discovers when reasoning about termination of numerical loops and explain why we restrict ourselves to integer loops. In the end of this section we discuss a technique for discovering numerical argument positions that we’ll base our termination analysis on. 6.2.1 Numerical and integer loops Our notion of numerical loop is based on the predicate dependency graph (cf. [28]): Definition 6.1 Let P be a program and let Π be a strongly connected component in its predicate dependency graph. Let S ⊆ P be the set of program clauses, associated with Π (i.e. those clauses that have the predicates of Π in their head). S is called loop if there is a cycle through predicates of Π. Definition 6.2 A loop S is called numerical if there is a clause H :− B1 , . . . , Bn in S, such that for some i, Bi ≡ Var is Exp, and either Var is equal to some argument of H or Exp is an arithmetic expression involving a variable that is equal to some argument of H. However, termination of numerical loops that involve numbers that are not integers often depends on the specifics of implementation and hardware, so we limit ourselves to “integer loops”, rather than all numerical loops. The following examples illustrate actual behavior that contradicts intuition—a loop that should not terminate terminates, while a loop that should terminate does not. We checked the behavior of these examples on UNIX, with the CLP(Q,R) library [18] of SICStus Prolog [31], CLP(R) [19] and XSB [30]. General Framework for Automatic Termination Analysis 25 Example 6.2 Consider the following program. The goal p(1.0) terminates although we would expect it not to terminate. On the other hand the goal q(1.0) does not terminate, although we would expect it to terminate. p(0.0) :− !. p(X) :− X1 is X/2, p(X1). q(0.0) :− !. q(X) :− X1 is X − 0.1, q(X1). One may suggest that assuming that the program does not contain division and non-integer constants will solve the problem. The following example shows that this is not the case: Example 6.3 r(0). r(X) :− X > 0, X1 is X − 1, r(X1). The predicate r may be called with a real, non-integer argument, and then its behavior is implementation dependent. For example, one would expect that r(0.0) will succeed and r(0.000000001) will fail. However, in SICStus Prolog both goals fail, while in CLP(R) both of them succeed! Therefore, we limit ourselves to integer loops, that is numerical loops involving integer constants and arithmetical calculations over integers: Definition 6.3 A program P is integer-based if, given a query such that all numbers appearing in it are integers, all subqueries that arise have this property as well. Definition 6.4 A numerical loop S in a program P is called an integer loop if P is integer-based. Termination of a query may depend on whether its argument is an integer, as the following example shows: p(0). p(N) :- N > 0, N1 is N - 1, p(N1). p(a) :- p(a). For this program, p(X) for integer X terminates, while p(a) does not. So we extend our notion of query pattern. Till now a query pattern was an atom with the same predicate and arity as the query, and arguments b (denoting an argument that is instantiated enough with respect to the norm) or f (denoting an argument on which no assumptions are made). Here, we extend the notion to include arguments of the form i, denoting an argument that is an integer (or integer expression). Note that b includes 26 Nachum Dershowitz et al. the possibility of i in the same way that f includes the possibility b. In the diagrams to follow we denote i-arguments by circled black nodes, and as before, b-arguments by black nodes and f -arguments by white nodes. Our termination analysis is always performed with respect to a given program and a query pattern. A positive response guarantees termination of every query that matches the pattern. 6.2.2 Discovering integer arguments Our analysis that will be discussed in the subsequent sections is based on the size relationships between “integer arguments”. So we have to discover which arguments are integer arguments. In simple programs this is immediate, but there may be more complicated cases. The inference of integer arguments is done in two phases—bottom-up and top-down. Bottom-up inference is similar to type analysis (cf. [8,5]), using the abstract domain {int, not int} and the observation that an argument may became int only if it is obtained from is/2 or is bound to an integer expression of arguments already found to be int (i.e. the abstraction of int + int is int). Top-down inference is query driven and is similar to the “blackening” process, described in [21], only in this case the information propagated is being an integer expression instead of “instantiated enough”. Take for example the program p(0). p(N) :- N > 0, N1 is N - 1, p(N1). p(a) :- p(a). q(X) :- r(X,Y), p(Y). r(b,a). r(X,X). Denoting by int an integer argument, by gni an argument that is ground but not integer, and by ng an argument that is not ground, we get from bottom-up instantiation analysis that the only pattern possible for r(X, Y ) atoms that are logical consequences of the program are r(int, int), r(gni, gni), r(ng, ng) Now we get from top down analysis that a query q(i) gives rise to the query p(i) and hence terminates. The efficiency of discovering numerical arguments may be improved by a preliminary step of guessing the numerical argument positions. The guessing is based on the knowledge that variables appearing in comparisons or is/2atoms should be numerical. Instead of considering the whole program it is sufficient in this case to consider only clauses of predicates having clauses with the guessed arguments and clauses of predicates on which they depend. The guessing as a preliminary step becomes crucial when considering “realworld” programs that are large, while their numerical part is usually small. General Framework for Automatic Termination Analysis 27 6.3 Integer Abstraction Domain In this subsection we present a technique that allows us to overcome the difficulties caused by the fact that the integers with the usual order are not well-founded. Given a program P we introduce a finite abstraction domain, representing integers. The integer abstractions are derived from the subgoals involving integer arithmetic positions. Let S be a set of clauses in P , consisting of an integer loop and all the clauses for predicates on which the predicates of the integer loop depend. As a first step for definining the abstract domain for each recursive predicate p in S we obtain the set of comparisons Cp . If p is clear from the context we omit the index. More formally, we consider as a comparison, an atom of the form t1 ρt2 , such that t1 and t2 are either variables or constants and ρ ∈ {<, ≤, ≥, >}. Our aim in restricting ourselves to these atoms is to ensure the finiteness of C. Other decisions can be made as long as finiteness is ensured. Note that by excluding 6= and = we do not limit the generality of the analysis. Indeed if t1 6= t2 appears in a clause it may be replaced by two clauses containing t1 > t2 and t1 < t2 instead of t1 6= t2 , respectively. Similarly, if the clause contains a subgoal t1 = t2 , the subgoal may be replaced by two subgoals t1 ≥ t2 , t1 ≤ t2 . Thus, the equalities we use in the examples to follow should be seen as a brief notation as above. In the following subsections we present a number of techniques to infer C from the clauses of S. We define Dp as the set of pairs (p, c), for all satisfiable c ∈ 2Cp . Here we interpret c ∈ 2Cp as a conjunction of the comparisons in c and the negations of the comparisons in Cp \ c. The abstraction domain D is taken as the union of the sets Dp for the recursive predicates p in S. Simplifying the domain may improve the running time of the analysis, however it may make it less precise. 6.3.1 The simple case—collecting comparisons The simplest way to obtain C from the clauses of S is to consider the comparisons appearing in the bodies of recursive clauses and restricting integer positions in their heads (we limit ourselves to the recursive clauses, since these are the clauses that can give rise to circular pairs). We would like to view C as a set of comparisons of head argument positions. Therefore we assume in the simple case that S is partially normalized, that is, all head integer argument positions in clauses of S are occupied by distinct variables. This assumption holds for all the examples considered so far. This assumption will not be necessary with the more powerful technique presented in the next subsection. Example 6.4 Consider t(X) :− X > 5, X < 8, X < 2, X1 is X + 1, X1 < 5, t(X1). 28 Nachum Dershowitz et al. Let t(i) be a query pattern for the program above. In this case, the first argument of t is an integer argument. Since X1 does not appear in the head of the first clause X1<5 is not considered and, thus, C = {X > 5, X < 8, X < 2}. We have in this example only one predicate and the union is over the singleton set. So, D = {X < 2, 2 ≤ X ≤ 5, 5 < X < 8, X ≥ 8}. The following example evaluates the mod function. Example 6.5 mod(A, B, C) :− A ≥ B, B > 0, D is A − B, mod(D, B, C). mod(A, B, C) :− A < B, A ≥ 0, A = C. Here we ignore the second clause since it is not recursive. Thus, by collecting comparisons from the first clause, Cmod = {arg1 ≥ arg2, arg2 > 0} and thus, by taking all the conjunctions of comparisons of C and their negations, we obtain Dmod = {(mod, arg1 ≥ arg2 & arg2 > 0), (mod, arg1 ≥ arg2 & arg2 ≤ 0), (mod, arg1 < arg2 & arg2 > 0), (mod, arg1 < arg2 & arg2 ≤ 0)}. However, sometimes the abstract domain obtained in this way is insufficient for proving termination, and thus, should be refined. The domain may be refined by enriching the underlying set of comparisons. Possible ways to do this are using inference of comparisons instead of collecting them, or performing an unfolding, and applying the collecting or inference techniques to the unfolded program. 6.3.2 Inference of Comparisons As mentioned above, sometimes the abstraction domain obtained from comparisons appearing in S is insufficient. Instead of collecting comparisons, appearing in bodies of clauses, we collect certain comparisons that are implied by bodies of clauses. For example, X is Y+Z implies the constraint X=Y+Z and functor(Term,Name,Arity) implies Arity≥ 0. As before, we restrict ourselves to recursive clauses and comparisons that constrain integer argument positions of heads. Since a comparison that is contained in the body is implied by it, we always get a superset of the comparisons obtained by the collecting technique, presented previously. The set of comparisons inferred depends on the power of the inference engine used (e.g. CLP-techniques may be used for this purpose). We define the abstract domain D as above. Thus, the granularity of the abstract domain also depends on the power of the inference engine. 6.3.3 Unfolding Unfolding (cf. [33,4,2,23]) allows us to generate a sequence of abstract domains, such that each refines the previous. More formally, let P be a program and let H :− B1 , . . . , Bn be a recursive rule in P . Let P1 be the result of unfolding an atom Bi in H :− B1 , . . . , Bn in P . Let S1 be a set of clauses in P1 , consisting of an integer loop and the clauses of the predicates on which the integer loop predicates depend. General Framework for Automatic Termination Analysis 29 Obtain D for the clauses of S1 either by collecting comparisons from rule bodies or by inferring them, and use it as a new abstraction domain for the original program. If the algorithm still fails to prove termination, the process of unfolding can be repeated. Example 6.6 Unfolding mc carthy 91(Z1,Z2) in the recursive clause we obtain a new program for the query mc carthy 91(i,f ) mc carthy 91(X, Y) :− X > 100, Y is X − 10. mc carthy 91(X, Y) :− X ≤ 100, Z1 is X + 11, Z1 > 100, Z2 is Z1 − 10, mc carthy 91(Z2, Y). mc carthy 91(X, Y) :− X ≤ 100, Z1 is X + 11, Z1 ≤ 100, Z3 is Z1 + 11, mc carthy 91(Z3, Z4), mc carthy 91(Z4, Z2), mc carthy 91(Z2, Y). Now if we use an inference engine that is able to discover that X is Y+Z implies the constraint X=Y+Z, we obtain the following constraints on the bound head integer variable X (for convenience we omit redundant ones): From the second clause we obtain: X ≤ 100, and since X + 11 > 100 we get X > 89. Similarly, from the third clause: X ≤ 89. Thus, C = {X ≤ 89, X > 89∧X ≤ 100} Substituting this in the definition of D, and removing inconsistencies and redundancies, we obtain D = {X ≤ 89, X > 89 ∧ X ≤ 100, X > 100}. 6.3.4 Propagating domains The comparisons we obtain by the techniques presented above may restrict only some subset of integer argument positions. However, for the termination proof, information on integer arguments outside of this subset may be needed. For example, as we will see shortly, in order to analyze correctly mc carthy 91 we need to determine the domain for the second argument, while the comparisons we have constrain only the first one. Thus, we need some technique of propagating abstraction domains that we obtained for one subset of integer argument positions to another subset of integer argument positions. Clearly, this technique may be seen as a heuristic and it is inapplicable if there is no interaction between argument positions. To capture this interaction we draw a graph for each recursive numerical predicate, that has the numerical argument positions as vertices and edges between vertices that can influence each other. In the case of mc carthy 91 we get the graph having an edge between the first argument position and the second one. Let π be a permutation of the vertices of a connected component of this graph. Define πD to be the result of replacing each occurrence of argi in D by argπ(i) . Consider the Cartesian product of all abstract domains πD thus obtained, discarding unsatisfiable conjunctions. We will call this Cartesian product the extended domain and denote it by ED. In the case of 30 Nachum Dershowitz et al. mc carthy 91 we get as ED the set of elements mc carthy 91(A,B), such that A and B are in {small, med, big}. More generally, when there are arithmetic relations (e.g. Y is X+1) between argument positions, ED can contain new subdomains that can be inferred from those in D. 6.4 Abstract interpretation In this section we use the integer abstractions obtained earlier to classify, in a finite fashion, all possible answers to queries. This analysis can be skipped in simple cases (just as in TermiLog constraint inference can be skipped when not needed), but is necessary in more complicated cases, like mc carthy 91. Most examples encountered in practice do not need this analysis. The basic idea is as follows: define an abstraction domain and perform a bottom-up constraints inference. The abstraction domain that should be defined is a refinement of the abstraction domain we defined in Subsection 6.3. There we considered only recursive clauses, since non-recursive clauses do not affect the query-mapping pairs. On the other hand, when trying to infer constraints that hold for answers of the program we should consider non-recursive clauses as well. In this way using one of the techniques presented in the previous subsection both for the recursive and the non-recursive clauses an abstraction domain D̃ is obtained. Clearly, D̃ is a refinement of D. Example 6.7 For mc carthy 91 we obtain that the elements of D̃ are the intersections of the elements in ED (see the end of Subsection 6.3.4)with the constraint in the non-recursive clause and its negation. Example 6.8 Continuing the mod-example we considered in Example 6.5 and considering the non-recursive clause for mod as well, we obtain by collecting comparisons C˜ = {arg1 ≥ arg2, arg2 > 0, arg1 < arg2, arg3 < arg2, arg1 ≥ 0, arg1 ≤ arg3, arg1 ≥ arg3} and, thus, D̃ consists of all pairs (mod, c) for c a satisfiable element of 2C̃ . Given a program P , let B be the corresponding extended Herbrand base, where we assume that arguments in numerical positions are integers. Let TP be the immediate consequence operator. Consider the Galois connection provided by the abstraction function α : B → D̃ and the concretization function γ : D̃ → B defined as follows: The abstraction α of an element in B is the pair from D̃ that characterizes it. The concretization γ of an element in D̃ is the set of all atoms in B that satisfy it. Note that α and γ form a Galois connection due to the disjointness of the elements of D̃. Using the Fixpoint Abstraction Theorem (cf. [10]) we get that ! ∞ ∞ [ [ n α TP (∅) ⊆ (α ◦ TP ◦ γ)n (∅) n=1 n=1 General Framework for Automatic Termination Analysis 31 We will take a map w : D̃ → D̃, that is a widening [10] of α ◦ TP ◦ γ and compute its fixpoint. Because of the finiteness of D̃ this fixpoint may be computed bottom-up. The abstraction domain D̃ describes all possible atoms in the extended Herbrand base B. However, it is sufficient for our analysis to describe only computed answers of the program, i.e., a subset of B. Thus, in practice, the computation of the fixpoint can sometimes be simplified as follows: We start with the constraints of the non-recursive clauses. Then we repeatedly apply the recursive clauses to the set of the constraints obtained thus far, but abstract the conclusions to elements of D. In this way we obtain a CLP program that is an abstraction of the original one. This holds in the next example. The abstraction corresponding to the predicate p is denoted pw . Example 6.9 Consider once more mc carthy 91. As claimed above we start from the non-recursive clause, and obtain that mc carthy 91w (A, B) :− {A > 100, B = A − 10}. By substituting in the recursive clause of mc carthy 91 we obtain the following mc carthy 91(X, Y) :− X ≤ 100, Z1 is X + 11, Z1 > 100, Z2 is Z1 − 10, Z2 > 100, Y is Z2 − 10. By simple computation we discover that in this case X is 100, and Y is 91. However, in order to guarantee the termination of the inference process we do not infer the precise constraint {X = 100, Y = 91}, but its abstraction, i.e., an atom mc carthy 91w (med, med). Repeatedly applying the procedure described, we obtain an additional answer mc carthy 91w (small, med). More formally, the following SICStus Prolog CLP(R) program performs the bottom-up construction of the abstracted program, as described above. We use the auxiliary predicate in/2 to denote a membership in D and the auxiliary predicate e in/2 to denote a membership in the extended domain ED. :− use module(library(clpr)). :− use module(library(terms)). :− dynamic(mc carthy 91w /2). in(X, big) :− {X > 100}. in(X, med) :− {X > 89, X ≤ 100}. in(X, small) :− {X ≤ 89}. e in((X, Y), (XX, YY)) :− in(X, XX), in(Y, YY). 32 Nachum Dershowitz et al. mc carthy 91w (X, Y) :− {X > 100, Y = X − 10}. assert if new((H :− B)) :− \+ (clause(H1, B1), unify with occurs check((H, B), (H1, B1))), assert((H :− B)). deduce :− {X ≤ 100, Z = X + 11}, mc carthy 91w (Z, Z1), mc carthy 91w (Z1, Y), e in((X, Y), (XX, YY)), assert if new((mc carthy 91w (A, B) :− e in((A, B), (XX, YY)))), deduce. deduce. The resulting abstracted program is mc carthy 91w (A, B) :− {A > 100, B = A − 10}. mc carthy 91w (A, B) :− e in((A, B), (med, med)). mc carthy 91w (A, B) :− e in((A, B), (small, med)). Since we assumed that the query was of the form mc carthy 91(i,f ) we can view these abstractions as implications of constraints like arg1 ≤ 89 implies 89 < arg2 ≤ 100. We also point out that the resulting abstracted program coincides with the results obtained by the theoretic reasoning above. As an additional example consider the computation of the gcd according to Euclid’s algorithm. Proving termination is not trivial, even if the successor notation is used. In [23] only applying a special technique allowed to do this. Example 6.10 Consider the following program and the query gcd(i,i,f ). gcd(X, 0, X) :− X > 0. gcd(X, Y, Z) :− Y > 0, mod(X, Y, U), gcd(Y, U, Z). mod(A, B, C) :− A ≥ B, B > 0, D is A − B, mod(D, B, C). mod(A, B, C) :− A < B, A ≥ 0, A = C. In this example we have two nested integer loops represented by the predicates mod and gcd. We would like to use the information obtained from the abstract interpretation of mod to find the relation between the gcd-atoms in the recursive clause. Thus, during the bottom-up inference process we abstract the conclusions to elements of D̃mod , as it was evaluated in Example 6.8. Using this technique we get that if mod(X, Y, Z) holds then always Z < Y holds, and this is what is needed to prove the termination of gcd. General Framework for Automatic Termination Analysis 33 6.5 Query-mapping pairs In this subsection we extend the query-mapping pairs technique to programs having numerical arguments. We assume that a norm is defined for all arguments. We start with the construction of the original query-mapping pairs, but for atoms (in the query, domain or range) that are part of integer loops we also add the appropriate numerical constraints from the integer abstraction domain (remember that there is only a finite number of elements in the integer abstraction domain). We also add numerical arcs and edges between numerical argument positions. These arcs and edges are added if numerical inequalities and equalities between the arguments can be deduced. Deduction of numerical edges and arcs is usually done by considering the clauses. However, if a subquery q unifies with a head of a clause of the form A :− B1 , . . . , Bk , . . . , Bn and we want to know the relation between q and Bk (under appropriate substitutions), we may use the results of the abstract interpretation to conclude numerical constraints for B1 , . . . , Bk−1 . The reason is that if we arrive at Bk , this means that we have proved B1 , . . . , Bk−1 (under appropriate substitutions). All query-mapping pairs deduced in this way are then repeatedly composed. The process terminates because there is a finite number of query-mapping pairs. A query-mapping pair is called circular if the query coincides with the range. The initial query terminates if for every circular query-mapping pair one of the following conditions holds: – The circular pair meets the requirements of the termination test of Theorem 5.2. – There is a non-negative termination function for which we can prove a decrease from the domain to the range using the numerical edges and arcs and the constraints of the domain and range. Two questions remain: how does one automate the guessing of the function, and how does one prove that it decreases. Our heuristic for guessing a termination function is based on the inequalities appearing in the abstract constraints. Each inequality of the form Exp1 ρ Exp2 where ρ is one of {>, ≥} suggests a function Exp1 − Exp2. The common approach to termination analysis is to find one termination function that decreases over all possible execution paths. This leads to complicated termination functions. Our approach allows one to guess a number of relatively simple termination functions, each suited to its query-mapping pair. When termination functions are simple to find, the guessing process can be performed automatically. After the termination function is guessed, its decrease must be proved. Let V1 , . . . , Vn denote numerical argument positions in the domain and U1 , . . . , Un the corresponding numerical argument positions in the range of the query-mapping pair. First, edges of the query-mapping pair are translated to equalities and arcs, to inequalities between these variables. Second, 34 Nachum Dershowitz et al. the atom constraints for the V ’s and for the U ’s are added. Third, let ϕ be a termination function. We would like to check that ϕ(V1 , . . . , Vn ) > ϕ(U1 , . . . , Un ) is implied by the constraints. Thus, we add the negation of this claim to the collection of the constraints and check for unsatisfiability. Since termination functions are linear, CLP-techniques, such as CLP(R) [19] and CLP(Q,R) [18], are robust enough to obtain the desired contradiction. Note however, that if more powerful constraints solvers are used, non-linear termination functions may be considered. To be more concrete: Example 6.11 Consider the following program with query p(i,i). p(0, ). p(X, Y) :− X > 0, X < Y, X1 is X + 1, p(X1, Y). p(X, Y) :− X > 0, X ≥ Y, X1 is X − 5, Y1 is Y − 1, p(X1, Y1). We get, among others, the circular query-mapping pair having the query (p(i,i),{arg1 > 0, arg1 < arg2}) and the mapping given in Figure 6.2. The termination function derived for the circular query-mapping pair is arg2−arg1. In this case, we get from the arc and the edge the constraints: V1 < U1 , V2 = U2 . We also have that V1 > 0, U1 > 0, V1 < V2 , U1 < U2 . We would like to prove that V2 − V1 > U2 − U1 is implied. Thus, we add V2 − V1 ≤ U2 − U1 to the set of constraints and CLP-tools easily prove unsatisfiability, and thus, that the required implication holds. 1 0 00 011 1 00 11 {arg1>0, arg1<arg2} 100 0 11 {arg1>0, arg1<arg2} Fig. 6.2 Mapping for p In the case of the 91-function the mappings are given in Figure 6.3. (We omit the queries from the query-mapping pairs, since they are identical to the corresponding domains.) 1 0 0 1 {arg1 in med } 11 00 00 11 {arg1 in small } 1 0 0 1 {arg1 in small } 1 0 {arg1 in med } 00 11 {arg1 in med } 1 0 {arg1 in small } Fig. 6.3 Mappings for McCarthy’s 91 function In the examples above there were no interargument relations of the type considered in [21]. However, this need not be the case in general. General Framework for Automatic Termination Analysis 35 Example 6.12 Consider the following program with the query q(b,b,i) and the term-size norm. (1) q(s(X), X, ). (2) q(s(X), X, N) :− N > 0, N1 is N − 1, q(s(X), X, N1). (3) q(s(s(X)), Z, N) :− N =< 0, N1 is N − 1, q(s(X), Y, N1), q(Y, Z, N1). Note that constraint inference is an essential step for proving termination— in order to infer that there is a norm decrease in the first argument between the head of (3) and the second recursive call (i.e. k s(s(X)) k>k Y k), one should infer that the second argument in q is less than the first with respect to the norm (i.e. k s(X) k>k Y k). We get among others circular query-mapping pairs having the mappings presented in Figure 6.4. The queries of the mappings coincide with the corresponding domains. In the first mapping termination follows from the decrease in the third argument and the termination function arg3> 0. In the second mapping termination follows from the norm decrease in the first argument. 11 00 00 0 0011 11 00 1 11 0 1 {|| arg2 || < || arg1 ||, arg3>0} 1 0 0 00 0 1 1 011 1 00 11 {arg3=<0} 1100 00 11 0 1 {|| arg2 || < || arg1 ||, arg3>0} 1 0 0 100 11 {arg3=<0} Fig. 6.4 Mappings for q 6.6 The Extended Algorithm In this section we combine all the techniques suggested so far. The complete algorithm Analyze Termination is presented in Figure 6.5. Each step corresponds to one of the previous sections. Note that Step 3, computing the abstractions of answers to queries, is optional. If the algorithm returns NO it may be re-run either with Step 3 included or with a different integer abstraction domain. The Analyze Termination algorithm is sound: Theorem 6.1 Let P be a program and q a query pattern. – Analyze Termination(P , q) terminates. – If Analyze Termination(P , q) reports YES then, for every query Q matching the pattern q, the LD-tree of Q w.r.t. P is finite. Work is being done now to implement the ideas in this section, and thus to be able to deal with programs for which termination depends on the behavior of arithmetic predicates. 36 Nachum Dershowitz et al. Algorithm Input Output (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) Analyze Termination A query pattern q and a Prolog program P YES, if termination is guaranteed NO, if no termination proof was found Guess and verify numerical argument positions; Compute the integer abstraction domain; Compute abstractions of answers to queries (optional); Compute ordinary and numerical query-mapping pairs; For each circular query-mapping pair do: If its circular variant has a forward positive cycle then Continue; If the query-mapping pair is numerical then Guess bounded termination function; Traverse the query-mapping pair and compute values of the termination function; If the termination function decreases monotonically then Continue; Return NO; Return YES. Fig. 6.5 Termination Analysis Algorithm 7 Conclusion and Generalizations We have seen the usefulness of the query mapping-pairs approach for proving termination of queries to logic programs by using symbolic linear norm relations between arguments and also by comparing numerical arguments. In the query-mapping pairs method as outlined above there are two crucial elements: 1. There is a finite number of abstractions of atoms in subgoals of the LD-tree. This ensures that A is finite. 2. Arcs represent an order. This suggests two directions for generalization—using different abstractions and using different orders. 7.1 Using Different Abstractions of Terms and a Linear Norm We can use the original query-mapping pairs as before with the only difference that we’ll abstract nodes not to just black and white ones but to a larger, though finite, set. For instance if we have a program p(1) :− {infinite loop}. p(0). General Framework for Automatic Termination Analysis 37 and take the term-size norm and a query p(bound), the query-mapping algorithm will say that there may be non-termination. However, we can use the abstractions 1, g, f , where g means any ground term that is not 1 and f means any term, and apply the above algorithm, with the only difference being in the unification of the abstractions. In the algorithm in Subsection 5.1 we used unification of abstractions in two places—when adjusting the weighted rule graph to the instantiation pattern of the query and when composing query-mapping pairs. In those cases the result of the unification of two nodes of which at least one was black resulted in a black node, and the unification of two white nodes resulted in a white node. In the present case g and 1 will not unify so we will be able to prove that a query p(g) terminates. Observation 7.1 The original query-mapping pairs algorithm remains valid if we abstract arguments of atoms in the LD-tree to elements of any finite set of abstractions, as long as we include a sound procedure for unification of these abstractions. 7.2 Using Norms that Involve Ordinal Numbers There are programs for which the use of linear norms is not sufficient. The following program performs repeated differentiation. d(deriv(t), 1). d(deriv(A), 0) :− number(A). d(deriv(X + Y), L + M) :− d(deriv(X), L), d(deriv(Y), M). d(deriv(X ∗ Y), (X ∗ L + Y ∗ M)) :− d(deriv(X), M), d(deriv(Y), L). d(deriv(deriv(X)), L) :− d(deriv(X), M), d(deriv(M), L). In this case one can show that for no choice of constants in the definition of the linear norm will it be possible to prove termination of d(ground, f ree). However, we can use the query-mapping pairs method with the abstraction of arguments to ground and non-ground, but use a norm that associates with each term an ordinal number in the following way (ω denotes, of course, the first infinite ordinal): kderiv(X)k = ω + kXk kX + Y k = kXk ⊕ kY k + 2 kX ∗ Y k = kXk ⊕ kY k + 2 where (n1 ω + k1 ) ⊕ (n2 ω + k2 ) for non-negative integers n1 , n2 , k1 , k2 is defined as max(n1 , n2 )ω + (k1 + k2 ) and + is a usual addition of ordinal numbers. Observation 7.2 The original query-mapping algorithm remains valid if we replace, in the computation of norms, integers by ordinal numbers with the operations defined above. Acknowledgement: We are very grateful to the anonymous referees for their careful reading and helpful suggestions. 38 Nachum Dershowitz et al. References 1. Krzysztof R. Apt. Logic programming. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science, volume B: Formal Models and Semantics, chapter 15, pages 493–574. MIT Press, 1990. 2. Krzysztof R. Apt. From Logic Programming to Prolog. Prentice-Hall International Series in Computer Science. Prentice Hall, 1997. 3. Florence Benoy and Andy King. Inferring argument size relationships with CLP(R). In J. Gallagher, editor, Logic Program Synthesis and Transformation. Proceedings, pages 204–223. Springer Verlag, 1996. Lecture Notes in Computer Science, volume 1207. 4. Annalisa Bossi and Nicoletta Cocco. Preserving universal temination through unfold/fold. In Giorgio Levi and Mario Rodrı́guez-Artalejo, editors, Algebraic and Logic Programming, pages 269–286. Springer Verlag, 1994. Lecture Notes in Computer Science, volume 850. 5. Johan Boye and Jan Maluszyński. Directional types and the annotation method. Journal of Logic Programming, 33(3):179–220, 1997. 6. Alex Brodsky and Yehoshua Sagiv. Inference of inequality constraints in logic programs. In Proceedings of the Tenth ACM SIGACT-SIGART-SIGMOD Symposium on Principles of Database Systems, pages 227–240, 1991. 7. Francisco Bueno, Maria J. Garcı́a de la Banda, and Manuel V. Hermenegildo. Effectiveness of global analysis in strict independence-based automatic parallelization. In Maurice Bruynooghe, editor, Logic Programming, Proceedings of the 1994 International Symposium, pages 320–336. MIT Press, 1994. 8. Michael Codish and Vitaly Lagoon. Type dependencies for logic programs using ACI-unification. In Proceedings of the 1996 Israeli Symposium on Theory of Computing and Systems, pages 136–145. IEEE Press, June 1996. 9. Michael Codish and Cohavit Taboch. A semantic basis for termination analysis of logic programs. The Journal of Logic Programming, 41(1):103–123, 1999. 10. Patrick Cousot and Radhia Cousot. Abstract interpretation and application to logic programs. The Journal of Logic Programming, 13:103–180, 1992. 11. Danny De Schreye and Stefaan Decorte. Termination of logic programs: The never-ending story. The Journal of Logic Programming, 19/20:199–260, May/July 1994. 12. Saumya K. Debray. A simple code improvement scheme for prolog. The Journal of Logic Programming, 13:103–180, 1992. 13. Stefaan Decorte, Danny De Schreye, and Massimo Fabris. Automatic inference of norms: a missing link in automatic termination analysis. In D. Miller, editor, Proceedings of the 1993 International Logic Programming Symposium, pages 420–436, 1993. 14. Nachum Dershowitz. Orderings for term-rewriting systems. Theoretical Computer Science, 17(3):279–301, 1982. 15. Robert W. Floyd. Assigning meanings to programs. In J. Schwartz, editor, Mathematical Aspects of Computer Science, pages 19–33. American Mathematical Society, 1967. Proceedings of Symposia in Applied Mathematics; v. 19. 16. Jürgen Giesl. Termination of nested and mutually recursive algorithms. Journal of Automated Reasoning, 19:1–29, 1997. 17. Ronald L. Graham. Rudiments of Ramsey theory. Number 45 in Regional conference series in mathematics. American Mathematical Society, 1980. General Framework for Automatic Termination Analysis 39 18. Christian Holzbaur. OFAI CLP(Q,R) Manual. Technical Report TR-95-09, Austrian Research Institute for Artificial Intelligence, Vienna, 1995. 19. Joxan Jaffar and Michael J. Maher. Constraint logic programming: A survey. The Journal of Logic Programming, 19/20:503–582, May/July 1994. 20. Donald E. Knuth. Textbook examples of recursion. In Vladimir Lifschitz, editor, Artificial Intelligence and Mathematical Theory of Computation. Papers in Honor of John McCarthy, pages 207–229. Academic Press, Inc., 1991. 21. N. Lindenstrauss and Yehoshua Sagiv. Automatic termination analysis of logic programs. In Lee Naish, editor, Proceedings of the Fourteenth International Conference on Logic Programming, pages 63–77. MIT Press, July 1997. 22. Naomi Lindenstrauss, Yehoshua Sagiv, and Alexander Serebrenik. TermiLog: A system for checking termination of queries to logic programs. In Orna Grumberg, editor, Computer Aided Verification, 9th International Conference, pages 63–77. Springer Verlag, June 1997. Lecture Notes in Computer Science, volume 1254. 23. Naomi Lindenstrauss, Yehoshua Sagiv, and Alexander Serebrenik. Unfolding mystery of the mergesort. In Norbert Fuchs, editor, Proceedings of the Seventh International Workshop on Logic Program Synthesis and Transformation. Springer Verlag, 1998. Lecture Notes in Computer Science, volume 1463. 24. John W. Lloyd. Foundations of Logic Programming. Symbolic Computation. Springer Verlag, 1984. 25. Zohar Manna and John McCarthy. Properties of Programs and partial function logic. Machine Intelligence, 5:27–37, 1970. 26. Fred Mesnard and J. Ganascia. CLP(Q) for proving interargument relations. In A. Petrossi, editor, Proceedings META’92, pages 309–320. Springer Verlag, 1992. 27. Richard A. O’Keefe. The Craft of Prolog. MIT Press, 1990. 28. Lutz Plümer. Termination Proofs for Logic Programs. Lecture Notes in Artificial Intelligence, volume 446. Springer Verlag, 1990. 29. Yehoshua Sagiv. A termination test for logic programs. In International Logic Programming Symposium. MIT Press, 1991. 30. Konstatinos F. Sagonas, Terrance Swift, and David S. Warren. The XSB Programmer’s Manual. Version 1.3 (β). Department of Computer Science, SUNY @ Stony Brook, U.S.A., September 1993. 31. SICS. User Manual. Version 3.7.1. Swedish Institute of Computer Science, 1998. 32. Leon Sterling and Ehud Shapiro. The Art of Prolog. The MIT Press, second edition, 1994. 33. Hisao Tamaki and Taisuke Sato. Unfold/Fold transformation of logic programs. In Sten-Åke Tärnlund, editor, Proceedings of the Second International Logic Programming Conference, pages 127–138. Uppsala University, 1984. 34. Jeffrey D. Ullman and Allen van Gelder. Efficient tests for top-down termination of logical rules. Journal of the Association for Computing Machinery, 35(2):345–373, April 1988. 35. Allen van Gelder. Deriving constraints among argument sizes in logic programs. Annals of Mathematics and Artificial Intelligence, 3:361–392, 1991. 36. Kristof Verschaetse and Danny De Schreye. Deriving termination proofs for logic programs, using abstract procedures. In Koichi Furukawa, editor, Logic Programming, Proceedings of the Eigth International Conference, pages 301– 315. MIT Press, 1991. 40 Nachum Dershowitz et al. 37. Kristof Verschaetse and Danny De Schreye. Deriving of linear size relations by abstract interpretation. In Maurice Bryunooghe and Martin Wirsing, editors, Programming Language Implementation and Logic Programming, 4th International Symposium, pages 296–310. Springer Verlag, 1992. Lecture Notes in Computer Science, volume 631. 38. Bal Wang and R. K. Shyamasundar. A methodology for proving termination of logic programs. The Journal of Logic Programming, 21:1–30, 1994.
6cs.PL
1 Robust Designs of Beamforming and Power Splitting for Distributed Antenna Systems with Wireless Energy Harvesting arXiv:1801.10430v1 [cs.IT] 31 Jan 2018 Zhengyu Zhu, Sai Huang, Zheng Chu, Fuhui Zhou, Di Zhang and Inkyu Lee, Fellow, IEEE Abstract—In this paper, we investigate a multiuser distributed antenna system with simultaneous wireless information and power transmission under the assumption of imperfect channel state information (CSI). In this system, a distributed antenna port with multiple antennas supports a set of mobile stations who can decode information and harvest energy simultaneously via a power splitter. To design robust transmit beamforming vectors and the power splitting (PS) factors in the presence of CSI errors, we maximize the average worst-case signal-to-interference-plusnoise ratio (SINR) while achieving individual energy harvesting constraint for each mobile station. First, we develop an efficient algorithm to convert the max-min SINR problem to a set of “dual” min-max power balancing problems. Then, motivated by the penalty function method, an iterative algorithm based on semi-definite programming (SDP) is proposed to achieve a local optimal rank-one solution. Also, to reduce the computational complexity, we present another iterative scheme based on the Lagrangian method and the successive convex approximation (SCA) technique to yield a suboptimal solution. Simulation results are shown to validate the robustness and effectiveness of the proposed algorithms. I. I NTRODUCTION For the past decade, there has been a considerable evolution of wireless networks to satisfy demands on high speed data. Since resources shared among users are limited, a capacity increase is technically challenging in the wireless networks. Recently, a distributed antenna system (DAS) has received a lot of attentions as a new cellular communication structure to expand coverage and increase sum rates [1]–[3]. Unlike conventional cellular systems where all antennas are co-located at the cell center, distributed antenna (DA) ports of the DAS are separated geographically in a cell and are connected with each other by backhaul links [4]. Each DA port in the DAS is usually equipped with its own power amplifier at the analog front-end [4] [5]. Thus, individual power constraint Z. Zhu is with the School of Information Engineering, Zhengzhou University, Zhengzhou 450001, China (e-mail: [email protected]). S. Huang is with the School of Information and Communication Engineering, Beijing University of posts and telecommunications, Beijing, China (e-mail: [email protected]). Z. Chu is with the 5G Innovation Center (5GIC), Institute of Communication Systems (ICS), University of Surrey, Guildford, GU2 7XH, United Kingdom. (email: [email protected]). F. Zhou is with Information Engineering School, Nanchang University, Nanchang, China. (email: [email protected]). D. Zhang is with the School of Information Engineering, Zhengzhou University, Zhengzhou, 450-001, China, and also with the Information System Laboratory, Department of Electrical and Computer Engineering, Seoul National University, Seoul, 151-744, Korea (e-mail: di [email protected]). I. Lee is with School of Electrical Engineering, Korea University, Seoul, Korea (e-mail: [email protected]). at each antenna should be considered for the DAS unlike the conventional systems which normally impose sum power constraint [5]. In the meantime, one of the limits in current cellular communication systems is the short lifetime of batteries. To combat the battery problem of mobile users, simultaneous wireless information and power transmission (SWIPT) has been studied in [6]–[13]. With the aid of the SWIPT, users can charge their devices based on the received signal [8] [9]. To realize the SWIPT, a co-located receiver has been proposed [10], which employs a power splitter to perform energy harvesting (EH) and information decoding (ID) at the same time [11]. By adopting the power splitting (PS) receiver, the SWIPT scheme for multiple-input single-output (MISO) downlink systems has been examined in [8] and [11] where perfect channel state information at the transmitter (CSIT) was assumed. In practice, however, due to channel estimation errors and feedback delays, it is not possible to obtain perfect CSIT [14]–[17]. On the other hand, some recent works have investigated SWIPT in DAS [18]–[25]. [18] has provided several intuitions and revealed the challenges and opportunities in DAS SWIPT systems. In order to improve energy efficiency of SWIPT, the application of advanced smart antenna technologies has been focused in [19]. In [20], a power management strategy has been studied to supply maximum wireless information transfer (WIT) with minimum wireless energy transfer (WET) constraint for adopting PS. Moreover, a tradeoff between the power transfer efficiency and the information transfer capacity has been introduced in [21]. The work in [22] examined a design of robust beamforming and PS for multiuser downlink DAS SWIPT. However, only one antenna was considered in each DA port. The authors in [23] investigated resource allocation for DAS SWIPT systems based on the worst-case model, where per-DA port power constraint was adopted. In [24], a few open issues and promising research trends in the wireless powered communications area with DAS were introduced. In addition, to achieve a balance between transmission power and circuit power, [25] studies a system utility minimization problem in a DAS SWIPT system via joint design of remote radio heads selection and beamforming. However, joint optimal design of transmit beamforming and the receive PS factor for SWIPT in DAS PS-based systems with multiple transmit antennas of each DA port, has not been considered in the literature yet. 2 Motivated by the existing literature [18]–[25], in this paper, we study a joint design of robust transmit beamforming at the DA port and the receive PS factors at mobile stations (MSs) in multiuser DAS SWIPT systems with imperfect CSI. Channel uncertainties are modeled by the worst-case model as in [22]. Our aim is to maximize the worst-case signal-tointerference-and-noise ratio (SINR) subject to EH constraint and per-DA port power constraint. The contributions of this work are summarized as follows: • • For a given SINR target, the original problem is decomposed into a sequence of min-max per-DA port power balancing problems. In order to convert the non-convex constraint into linear matrix inequality (LMI), Schur complement is used to derive the equivalent forms of the SINR constraint and the EH constraint. Furthermore, we prove that a solution of the relaxed semi-definite program (SDP) is always rank-two. Also, to recover a near-optimal rank-one solution, we employ a penalty function method instead of the conventional Gaussian randomization (GR) technique. To reduce the computational complexity, another formulation is expressed for the minimum SINR maximization problem. By employing the Lagrangian multiplier method and the first order Taylor expansion, the SINR constraint can be approximately reformulated into two convex forms with linear constraints. Then, we propose an iterative algorithm based on the successive convex approximation (SCA) to find a suboptimal solution. Simulations evaluation have been conducted to provide the robustness and effectiveness of the proposed algorithms. The performance is also compared with other recent conventional schemes in this area. We show that the proposed algorithms has the superior performances in terms of average worst-case rate by extensive simulation results. The remainder of this paper is organized as follows: in Section II, we describe a system model for the multiuser DAS SWIPT and formulate the worst-case SINR maximization problem subject to per-DA port power and EH constraint. Section III derives the proposed robust joint designs. In Section IV, we present the computational complexity of the proposed algorithms. Simulation results are presented in Section V. Finally, Section VI concludes this paper. Notation: Lower-case letters are denoted by scalars, boldface lower-case letters are used for vectors, and boldface upper-case letters means matrices. kxk represents the Euclidean norm of a complex vector x and diag(x) denotes the diagonal matrix whose diagonal element vector is x. |z| stands for the norm of a complex number z. For a matrix M, MT , MH , rank(M), and [M]i,j are defined as trace, transpose, conjugate transpose, rank, and the (i, j)-th element, respectively. λmax (M) denotes the maximum eigenvalue of M, and vec(M) stacks the elements of M in a column vector. I defines an identity matrix. CM×N , HM×N and RM×N are the set of complex matrices, Hermitian matrices and real matrices of size M ×N , respectively. H+ equals the set of positive semidefinite (PSD) Hermitian matrices. 0M×L is a null matrix with size M × L. Main processing unit NT antenna DA port 1 NT antenna NT antenna MS1 MS2 DA port 2 DA port M MSK NT antenna NT antenna MS3 DA port 3 DA port 4 Fig. 1. Structure of a multi-user DAS downlink system II. S YSTEM M ODEL AND P ROBLEM F ORMULATION In Fig. 1, we describe a single cell system model for the multiuser downlink DAS scenario with SWIPT. The DAS consists of M DA ports and K single-antenna MSs. It is assumed that each DA port is equipped with NT antennas, which have individual power constraint. All DA ports are physically connected to the main processing unit (MPU) through fiber optics or an exclusive radio frequency (RF) link. Furthermore, all DA ports share the information of user distance and user data, but do not require CSI of all MSs as in [4]. The MS distance information can be simply obtained by measuring the received signal strength indicator [5]. Note that one MS can be supported by several DA ports. We consider the channel model for DAS which contains both small scale and large scale fading [5]. We denote the channel between the m-th DA port (m = 1, ..., M ) and the −γ/2 k-th MS (k = 1, ..., K) as hm,k = dm,k h̄m,k , where dm,k stands for the distance between the m-th DA port and the k-th MS, γ indicates the path loss exponent, and h̄m,k ∈ CNT ×1 equals the channel vector for small scale fading. For the k-th MS, the channel vector is given as hk = [hT1,k , ..., hTM,k ]T . Due to channel estimation and quantization errors, CSI is imperfect at each DA port and we assume that the uncertainty of the channel vectors is determined by Hk as an Euclidean ball [10] [14] as n o 2 Hk = ĥk + ∆hk ∆hH Φ ∆h ≤ ε k k k k , k = 1, 2, ..., K (1) where the ball is centered around the actual value of the estimated CSI vector ĥk from M DA ports to the k-th MS, ∆hk ∈ CMNT ×1 is the norm-bounded uncertainty vector, Φk ∈ CMNT ×MNT defines the orientation of the region, and εk represents the radius of the ball. During one time slot, K independent signal streams are conveyed simultaneously to K MSs. Specifically, the transmit NT ×1 beamforming vector vm is allocated for the k-th k ∈ C 3 MS at the m-th DA port. Thus, we denote the joint transmit MNT ×1 beamformer vector vk ∈ C used by M DS  ports for  v1,k v2,k . . . vM,k . Then, the k-th MS as vk = vec the transmitted signal to the k-th MS is obtained by xk = vk sk , ∀k, where sk ∼ CN (0, 1) indicates the corresponding transmitted data symbol for the k-th MS, which is independent and identically distributed (i.i.d.) circularly symmetric complex Gaussian (CSCG) random variable with zero mean and unit variance. We assume that each DA port has its own power constraint Pm (m = 1, ..., M ). Let us define an M NT ×M NT square matrix Dm , diag( 0, ..., 0 , 1, ..., 1, 0, ..., 0 ). Then, | {z } | {z } | {z } NT (m−1)NT per-DA per power constraint is given as (M−m)NT K P k=1 tr(Dm vk vH k ) αPm , ∀m. The received signal at the k-th MS is expressed as yk = hH k K X ≤ where nk represents the additive white gaussian noise (AWGN) with variance σk2 at the k-th MS. It is also assumed that each MS splits the received signal power into two parts using a power splitter, one for the EH and the other for the ID [8] [11]. The PS divides the ρk ∈ (0, 1] portion and the 1 − ρk portion of the received signal power to the ID and the EH, respectively. Therefore, the split signal for the ID of the k-th MS is written as K X  √ vj sj + nk + zk , ρk hH k j=1 where zk stands for the AWGN with variance δk2 during the ID process at the k-th MS. Then, the received SINR for the k-th MS is defined as SINRk ({vk }, ρk ) = ρk P j6=k ρk |hH k vk | 2 2 2 2 |hH k vj | + ρk σk + δk . (2) Also, due to the broadcast nature of wireless channels, the energy carried by all signals, i.e., the 1 − ρk portion of vk , can be harvested at the k-th MS, and the split signal for the EH of the k-th MS is thus given as ykEH = K X p  v j sj + n k . 1 − ρk hH k j=1 Then, the harvested energy by the EH of the k-th MS is obtained as Ek = ζk (1 − ρk ) max min {vk }, ρk hk ∈Hk s.t. SINRk ({vk }, ρk ) (3a) XK 2 2 |hH ζk (1 − ρk ) ( k vj | + σk ) ≥ ek , ∀k, (3b) j=1 XK tr(Dm vk vH (3c) k ) ≤ Pm , ∀m, k=1 0 < ρk ≤ 1, ∀k, (3d) where ek represents the required harvested power of the k-th MS. Problem (3) is non-convex due to coupled variables {ρk } and {vk } in both the objective function and the EH constraint, and thus, is difficult to solve efficiently. III. P ROPOSED ROBUST J OINT D ESIGNS vj sj + nk , j=1 ykID = also needs to satisfy per-DA port power constraint. Hence, our aim is to jointly optimize the transmit beamforming vector and the PS factor by maximizing the minimum SINR subject to EH constraint and per-DA power constraint. Then, by incorporating the norm-bounded channel uncertainty model in (1), the robust optimization problem is expressed as K X j=1 2 2 |hH k vj | + σk  where ζk ∈ (0 1] is the constant that accounts for the energy conversion efficiency for the EH of the k-th MS. In this paper, we assume that the harvested power at each MS should be larger than a given threshold, and each DA port In this section, we propose two robust joint design algorithms for problem (3). First, we present a bisection search method which generates a local optimal rank-one solution. To reduce the computational complexity, we then introduce an SCA based algorithm to achieve a suboptimal solution. A. Proposed Method Based on Bisection Search To make problem (3) tractable, we decompose the problem into a set of the min-max per-DA port power balancing problems, one for each given SINR target Γ > 0 [15]. Using bisection search over Γ, the optimal solution to problem (3) can be obtained by solving the corresponding min-max perDA port power balancing problem with different Γ. Then, for a given Γ, we focus on the following min-max per-DA port power balancing problem as PK H k=1 tr(Dm vk vk ) (4a) min max 1≤m≤M Pm {vk },ρk XK 2 2 |hH s.t. ζk (1 − ρk ) ( k vj | + σk ) ≥ ek , ∀k, (4b) j=1 SINRk ({vk }, ρk ) ≥ Γ, ∀k, 0 < ρk ≤ 1, ∀k. (4c) (4d) We represent α∗ (Γ) as the optimal objective value of problem (4). Note that based on the equation α∗ (Γ) = 1 [22, Lemma 2], we can obtain the optimal beamforming solution for problem (3). Problem (4) is still non-convex in terms of the non-convex objective function (4a). First, we tackle the objective function (4a) by introducing an auxiliary variable α. Then, the min-max per-DA port power balancing problem (4) can be rewritten as min {vk }, ρk , α, hk ∈Hk s.t. XK k=1 α tr(Dm vk vH k ) ≤ αPm , ∀m, (5a) (5b) (4b), (4c), (4d). We can see that problem (5) has semi-infinite constraints (4b) and (4c), which are non-convex. To make the constraint (4b) 4 tractable, the following lemma is introduced to convert (4b) In order to get rid of the channel uncertainty ∆hk in (9), Lemma 2 is adopted, and the constraint (9) is equivalently into a quadratic matrix inequality (QMI). Lemma 1: (Schur complement [26]) Let N be a complex modified as   Hermitian matrix as ρk δk 01×MNT   H H   Y1 Y2 δk ĥk Mk ĥk + σk2 − rk ĥk Mk   0, Bk =  N = NH = . H Y2 Y3 0 M ĥ M + rk I MNT ×1 −1 Y1 − YH 2 Y3 Y2 Then, we have N ≻ 0 if and only if  0 with −1 Y3 ≻ 0, or Y3 − YH  2 Y1 Y2  0 with Y1 ≻ 0. Let us define an M NT × M NT square matrix Vk as Vk = vk vH k . By utilizing Lemma 1, the constraint (4b) can be converted into   √ e ζk (1 − ρk )  H k  0, (6) √ ĥk + ∆hk R ĥk + ∆hk +σk2 ek PK where R , k=1 Vk . Note that (6) is still non-convex. In order to remove the channel uncertainty in (6), the following lemma is required to convert the constraint (6) into linear matrix inequality (LMI). Lemma 2: [30, Theorem 3.5] Let us denote Uk ∈ C, for k ∈ [1, 6]. If Ti  0 for i = 1, 2, then the following QMI   U1 U2 + U3 X  0, H (U2 +U3 X)H U4 +XH U5 +UH 5 X+X U6 X I−XH Ti X  0, for ∀X are equivalent to the LMI       U1 U2 U3 0 0 0 0 0 0 H  UH + λ1  0 I 0  + λ2  0 I 0   0, 2 U4 U5 H 0 0 T2 0 0 T1 U3 U5 U6 where λi ≥ 0 (i = 1, 2).  To proceed, we set X = ∆hk , T1 = 1/ε2k I, T2 = 0, U1 = H √ 1 − ρk , U2 = ek , U3 = 01×MNT , U4 = ĥk Rĥk + σk2 − tk , H U5 = ĥk R, U6 = R. Then, by exploiting Lemma 2, the constraint (6) can be equivalently modified as the following convex LMI   √ ζk (1−ρk ) ek 01×MNT H H √   ek ĥk Rĥk + σk2 − tk ĥk R   0, (7) Ak =  tk 0MNT ×1 Rĥk R + ε2 I k where tk ≥ 0 is a slack variable. Next, we transform the constraint (4c) to the convex one. Due to the definition of SINRk and Hk , the constraint (4c) can be recast as X  H 2 H 2 ρk ĥk +∆hk vk ≥ Γ ρk ĥk +∆hk vj +ρk σk2 +δk2 , j6=k and thus, it follows   H ρk ĥk + ∆hk Mk ĥk + ∆hk + σk2 ≥ δk2 , P where Mk = Γ1 Vk − Vj . k k j6=k Also, we utilize a similar methodology for (8) as follows. By applying Lemma 1, the constraint (8) can be changed into   ρk δk  H  0. (9) ĥk + ∆hk Mk ĥk + ∆hk +σk2 δk ε2k (10) where rk ≥ 0 is a slack variable. Defining V̂m,k as V̂m,k = Dm Vk , problem (5) is thus reformulated as min {Vk }, ρk , α, tk , rk s.t. XK k=1 α tr(V̂m,k ) ≤ αPm , ∀m, (11) Ak  0, Bk  0, Vk  0, (4d), tk ≥ 0, rk ≥ 0, rank(Vk ) = 1, ∀k. The above optimization problem is difficult to solve in general due to the rank-one constraint. Therefore, we employ the semi-definite relaxation (SDR) technique [27] which simply drops the constraints rank(Vk ) = 1 for all Vk ’s. Then, problem (11) becomes a convex problem which can be solved efficiently by a convex programming solver such as CVX [28]. In the following theorem, we show that a solution V∗k to problem (11) satisfies rank(V∗k ) ≤ 2. Theorem 1: If problem (11) is feasible, the rank of a solution V∗k to problem (11) via rank relaxation is less than or equal to 2. Proof: See Appendix A.  After V∗k is obtained, if rank(V∗k ) = 1, we can compute an optimal transmit beamforming solution vk by eigenvalue decomposition (EVD) of V∗k . If rank(V∗k ) = 2, we use the conventional Gaussian randomization (GR) technique [27] to find vk for k = 1, ..., K. In particular, the GR technique generates a suboptimal solution. Hence, when rank(V∗k ) = 2, we will propose an iterative algorithm to recover the optimal rank-one solution by following the approach in [34]. First, since V̂m,k is always semi-positive definite, we have tr(V̂m,k ) ≥ λmax (V̂m,k ). Thus, we can prove that rank(V̂m,k ) = 1 if tr(V̂m,k ) ≤ λmax (V̂m,k ). Then, we can transform the constraint rank(V̂m,k ) = 1 into the single reverse convex constraint as K X k=1 (tr(V̂m,k ) − λmax (V̂m,k )) ≤ 0. Note that the function λmax (V̂m,k ) on the set of Hermitian K P (tr(V̂m,k ) − λmax (V̂m,k )) is matrices is convex. When k=1 (8) k max H small enough, V̂m,k will approach λmax (V̂m,k )v̂max m,k (v̂m,k ) , max where v̂m,k represents the eigenvector corresponding to the maximum eigenvalue λmax (V̂m,k ) with kv̂max m,k k = 1. Then the optimal transmit beamformer vector can be expressed by q vm,k = λmax (V̂m,k )v̂max (12) m,k , which satisfies the rank-one constraint. 5 Thus, in order to make K P k=1 (tr(V̂m,k ) − λmax (V̂m,k )) as small as possible, we adopt the exact penalty method [26]. First, introducing a sufficiently large penalty ratio θ > 0, the alternative formulation is considered as min {Vk }, ρk , α, tk , rk α (13a) s.t. Ak  0, Bk  0, Vk  0, (4d), (13b) K X (tr(V̂m,k ) + θ(tr(V̂m,k ) − λmax (V̂m,k ))) ≤ αPm ,(13c) k=1 tk ≥ 0, rk ≥ 0, ∀k. (13d) We can find from (13c) that the difference tr(V̂m,k ) − λmax (V̂m,k ) will be minimized when θ is large enough. Clearly, (13c) is set to minimize tr(V̂m,k ) − λmax (V̂m,k ). Note that (13c) is non-convex due to the coupled θ and V̂m,k . To eliminate the coupling between θ and V̂m,k , we apply the following lemma to provide an effective approximation of (13c). Lemma 3: Let us define C ∈ H+ and E ∈ H+ . Then, it always follows λmax (C) − λmax (E) ≥ eH max (C − E)emax , where emax denotes the eigenvector corresponding to the maximum eigenvalue of E.  According to Lemma 3, we propose an iterative algorithm to recover a local optimal solution. For given some feasible (n) {V̂m,k } to problem (13), we get  (n+1) (n+1) (n) tr(V̂m,k ) + θ tr(V̂m,k ) − λmax (V̂m,k )  (n+1) (n)  max,(n) max,(n) H (14) − (v̂m,k ) V̂m,k − V̂m,k v̂m,k (n) (n) (n)  ≤ tr(V̂m,k ) + θ tr(V̂m,k ) − λmax (V̂m,k ) , where the superscript n represents the n-th iteration. Hence, the following SDP problem generates an optimal (n+1) (n) solution Vm,k that is better than Vm,k to problem (13) as min α {Vk }, ρk , α, tk , rk (15a) s.t. (13b), (13d),  K  X (n) tr(V̂m,k ) + θ tr(V̂m,k ) − λmax (V̂m,k ) k=1 max,(n) H −(v̂m,k ) (n)  max,(n) V̂m,k − V̂m,k v̂m,k  (15b) ≤ αPm . (15c) convergence. For the bisection method, we need to determine an upper bound Γmax as 0 < Γ < Γmax . Then, we can see that SINRk ({vk }, ρk ) = ρk P j6=k ≤ 2 ρk |hH k vk | ρk σk2 + δk2 ≤ ρk |hH k vk | 2 2 2 2 |hH k vj | + ρk σk + δk ρk khk k 2 PM j=1 ρk σk2 + δk2 Pm From this, we can set Γmax as max k  2 ≤ khk k PM σk2 j=1 + δk2  P khk k2 M j=1 Pm . 2 +δ 2 σk k Pm . Due to monotonicity  of α, the bisection search algorithm needs O log2 Γmax iterations, where η is a small positive constant η which controls the accuracy of the bisection search algorithm. It is noted that this bisection search algorithm converges to the optimal solution v∗k for problem (3). The proposed algorithm based on bisection search is summarized in Algorithm 1.1 Algorithm 1 Proposed algorithm based on bisection search   P khk k2 M j=1 Pm , n = 0, Set Γmin = 0, Γmax = max 2 2 σ +δ k k k θ > 0, a prescribed accuracy tolerance ǫ > 0o and η > 0. n (0) (0) Randomly generate an initial value Vk , ρk , ∀k in (16). Repeat Set Γmid = (Γmin + Γmax )/2. Repeat Solve problem (16) with Γmid to obtain a solution (n+1) (n+1) Vk and ρk . (n+1) (n) If V̂m,k = V̂m,k , set θ ← 2θ. Update n ← n+1. (n) (n) Until |tr(V̂m,k ) − λmax (V̂m,k )| < ǫ (0) (n) (0) (n) Set Vk = Vk , ρk = ρk , and n = 0. Repeat Solve problem (16) with Γmid to obtain a solution (n+1) (n+1) Vk , ρk , and α(n+1) . Update n ← n+1. (n) (n) Until |tr(V̂m,k ) − λmax (V̂m,k )| < ǫ If α(n+1) < 1, set Γmin = Γmid . else set Γmax = Γmid . Until |Γmax − Γmin | < η Calculate vk according to (12). Now, problem (15) can be further simplified to min α {Vk }, ρk , α, tk , rk (16a) s.t. (13b), (13d), K  X  tr(V̂m,k ) + θ tr(V̂m,k ) k=1 max,(n) H −(v̂m,k  max,(n)  ) V̂m,k v̂m,k (16b) ≤ αPm , ∀m. (16c) To summarize, we can solve problem (3) with a given Γ, and a bisection search algorithm is applied to update Γ for the objective value α∗ = 1. Then, this process is repeated until B. Robust Iterative Algorithm Based on Successive Convex Approximation To reduce the computational complexity of Algorithm 1, we consider another formulation for the minimum SINR maximization problem. Based on the SCA method, the optimization 1 The proposed optimization algorithm is performed by MPU. Then, the MPU can send the beamforming solutions to individual transmitters through fiber optics or an exclusive radio frequency (RF) link. Also, it can transmit the PS factor solution to individual receivers through the estimated instantaneous channel. 6 can also be reformulated into a convex form with linear constraints. Thus, the robust SINR maximization problem can be rewritten as min {vk }, ρk max hk ∈Hk P j6=k |hH k vk | 2 2 2 |hH k vj | + σk + (17a) 2 δk ρk XK 2 2 |hH s.t. min ζk (1 − ρk ) ( k vj | + σk ) ≥ ek , ∀k,(17b) j=1 hk ∈Hk (3c), (3d). In this problem, we minimize the numerator of SINR while maximizing the denominator of SINR [9]. Based on a tight approximation, the minimum and the maximum for each term can be determined by employing the Lagrangian multiplier method. In addition, to equivalently convert the objective function (17a), we introduce the exponential variables exk and eyk as 2 hk ∈Hk hk ∈Hk X j6=k 2 2 |hH k vj | + σk + δk2 . ρk (18b) Thus, in order to circumvent the non-convex objective function (17a), problem (17) is expressed by introducing a slack variable τ as min τ {vk }, ρk , τ, xk , yk xk −yk s.t. e k∆k kF ≤ξk  (n) δ2 (n) tr((Ĥk +∆k )Vj +σk2 + k ≤ eyk (yk −yk +1), ρk k∆k kF ≤ξk j6=k XK  ek tr((Ĥk + ∆k )Vj ≥ min − σk2 , j=1 k∆k kF ≤ξk ζk (1 − ρk ) (3c), (3d), (19a), Vk  0, rank(Vk ) = 1. (18a) (21) exk ≤ min |hH k vk | , eyk ≥ max where the first inequality is based on the triangle inequality, and the second inequality come from the Cauchy-Schwarz inequality. It is possible to choose ξk , ε2k + 2εk kĥk k. It is noted that the bounds of this uncertainty are derived by triangle inequality, Cauchy-Schwarz inequality, and multiplicity of the second norm, which are tight enough. Adopting the preceding notations, we can rewrite (19) at the n-th iteration as min τ {Vk }, ρk , τ, xk , yk  s.t. min tr (Ĥk + ∆k )Vk ≥ exk , ≤ τ, (19a) (3c), (3d), (17b), (18a), (18b). (19b) (n) yk Note that (18b) is in concave form. Defining as the variables yk at the n-th iteration for an SCA iterative (n) (n) algorithm, a Taylor series expansion ezk (zk −zk +1) ≤ ezk is adopted to linearize (18b) as X (n) δk2 2 (n) 2 eyk (yk −yk +1) ≥ max |hH . (20) k vj | + σk + hk ∈Hk ρk j6=k When computing the EH constraint in (17b) and the SINR H 2 constraint in (20),  we need to calculate |hk vj | . Using H H x Ax= tr Axx , we can write this as X max Note that problem (21) is non-convex due to the existence of tr((Ĥk + ∆k )Vk ) in both the SINR and EH constraints. For computing tr((Ĥk + ∆k )Vk ), we have the following proposition. and ∆max as the minProposition 1 : Let us denote ∆min k k imizer and the maximizer of tr((Ĥk + ∆k )Vk ), respectively. Then, ∆min and ∆max are expressed as k k VH VH k k , ∆max = ξk . (22) k kVk kF kVk kF  Proof: See Appendix B. Using these results in (22) to remove the channel uncertainty ∆k , we get the following convex form as ∆min = −ξk k min k∆k kF ≤ξk max k∆k kF ≤ξk K X j=1 X j6=k H = vH j (ĥk + ∆hk )(ĥk + ∆hk ) vj H = tr (ĥk + ∆hk )(ĥk + ∆hk ) vj vH j  = tr (Ĥk + ∆k )Vj  H ĥk ĥk , and ∆k , ĥk ∆hH where Ĥk is defined as Ĥk , k + H H ∆hk ĥk + ∆hk ∆hk represents the uncertainty in the matrix Ĥk . It is noted that ∆k is a norm-bounded matrix as k∆k kF ≤ ξk . We can straightforwardly find the following relation [27] as H H k∆k kF = kĥk ∆hH k + ∆hk ĥk + ∆hk ∆hk kF H H ≤ kĥk ∆hH k kF +k∆hk ĥk kF +k∆hk ∆hk kF H 2 ≤ kĥk kk∆hH k k + k∆hk kkĥk k+k∆hk k = ε2k + 2εk kĥk k, j=1  X  tr (Ĥk +∆k )Vj = tr(Ĥk Vj )+ξk kVj kF . j6=k Thus, by removing the rank-one constraint, the associated SINR maximization problem can be rewritten as min H 2 2 |hH k vj | = |(ĥk + ∆hk ) vj | K   X tr(Ĥk Vj )−ξk kVj kF , tr (Ĥk +∆k )Vj = {Vk }, ρk , τ, xk , yk τ s.t. tr(Ĥk Vk ) − ξk kVk kF ≥ exk , (23a) 2 X  (n) δ (n) tr(Ĥk Vj )+ξk kVj kF +σk2 + k ≤ eyk (yk −yk +1),(23b) ρk j6=k K X j=1  tr(Ĥk Vj )−ξk kVj kF ≥ ek − σk2 , (23c) ζk (1 − ρk ) (3c), (3d), (19a), Vk  0, ∀k. (n) Problem (23) becomes a convex form for a given {yk }, which can be solved by using CVX [28]. In the SCA approach, the approximation with the current optimal solution can be updated iteratively until the constraint (23b) hold with equality. The SCA algorithm is outlined in Algorithm 2 below. In Algorithm 2, the optimal solution to problem (23) at the n-th ∗(n) iteration is defined as {Vk }, which achieves a stable point when the SCA algorithm converges. 7 Algorithm 2 Robust Iterative Algorithm Based on SCA 6 (n) 5 Average worst−case rate (bps/Hz) Initialize {yk } and set n = 0. Repeat (n) ∗(n) Solve problem (23) with {yk } to obtain Vk and ∗(n) τ for k = 1, ..., K. (n) Set yk (n+1) = yk for k = 1, ...K. Update n ← n + 1. Until Convergence ∗(n) If rank(Vk ) = 1, compute {v∗k } by EVD of V∗k (n). else use the GR technique to find {v∗k } for k = 1, ..., K. 4 3 2 Algorithm 1 (P = 110 dBm) Algorithm 2 (P = 110 dBm) Algorithm 1 (P = 70 dBm) Algorithm 2 (P = 70 dBm) Algorithm 1 (P = 40 dBm) Algorithm 2 (P = 40 dBm) 1 0 1 2 3 4 5 6 7 8 9 10 Iteration number IV. C OMPUTATIONAL C OMPLEXITY In this section, we evaluate the computational complexity of the proposed robust design methods. As will be shown in Section V, the proposed algorithms exhibit gains in terms of both computational complexity and performance compared to the conventional SDP scheme in [22] which employs local search. Now, we will present the complexity comparison by adopting the analysis in [31] and [32]. The complexities of the proposed algorithms are shown in Table I. Here, we denote n, max Lmax = log2 Γmax and Dmax as the number of decision η ,Q variables, the bisection search number, the SCA iteration number and the local search number in [22], respectively. 1) Algorithm 1 in problem (16) involves 2K LMI constraints of size M NT + 2, K LMI constraints of size M NT , and 4K + M linear constraints. 2) Algorithm 2 in problem (23) has K second-order cones (SOC) constraints of dimension M 2 NT2 + 1, K SOC constraints of dimension (K − 1)M 2 NT2 + 1, K SOC constraints of dimension KM 2 NT2 + 1, K LMI constraints of size M NT , and 3K + M linear constraints. 3) Conventional scheme in [22] consists of 2K LMI constraints of size M NT + 1, K LMI constraints of size M NT , and 2K + M linear constraints. For example, for a system with M = 3, K = 2, NT = 3, Lmax = Qmax = 6, and Dmax = 100, the complexities of the proposed Algorithm 1, Algorithm 2, and the conventional scheme [22] are O(1.96 × 109 ), O(3.41 × 108 ) and O(4.31 × 1010 ), respectively. Thus the complexity of the proposed Algorihm 1 and Algorihm 2 are only 4.5% and 0.8% of that of the conventional scheme in [22], respectively . V. S IMULATION R ESULTS In this section, we numerically compare the performance of the proposed algorithms for multiuser DAS SWIPT systems. Throughout the simulation, we consider DAS with a circular antenna layout and set M = 3, K = 3, and NT = 4. The power of each DA port is set to P1 = P6 , P2 = P3 , and P3 = P2 as in [22]. Three DA ports form an equilateral triangle while all MSs are q uniformly distributed inside a disc with the cell radius R = 112 3 m centered at the centroid of the triangle. , r sin 2π(j−1) ) The j-th DA port is located atq(r cos 2π(j−1) M M 3 for j = 1, ..., M with r = 7 R as in [4]. The pathloss Fig. 2. Convergence performance of the proposed iterative algorithm for various P exponent γ is set to be 3. According to this setting, a received SNR loss of 23.5 dB is observed at cell edge users compared to cell center users. All channel coefficients h̄m,k ∈ CNT ×1 are modelled as Rician fading. Theqchannel vector h̄m,k is given q LOS N LOS LOS KR 1 , where h̄m,k as h̄m,k = 1+KR h̄m,k + 1+KR h̄m,k LOS indicates the line-of-sight (LOS) component with kh̄m,k k2 = N LOS −γ/2 represents the Rayleigh fading component dm,k , h̄m,k N LOS −γ/2 ∼ CN (0, dm,k I), and KR is the Rician factor as h̄m,k equal to 3. For the LOS component, we apply the far-field uniform linear antenna array to model the channels in [33]. For simplicity, it is assumed that all MSs have the same set of parameters, i.e., ζk = ζ, δk2 = δ 2 , σk2 = σ 2 , and ek = e for k = 1, ..., K. In addition, we set σ 2 = −50 dBm, δ 2 = −30 dBm, and ζ = 0.3. Also, all the channel uncertainties are chosen to be the same as εk = ε, ∀k. In the simulation, the worst-case rate in all the ID users min min log2 (1+SINRj ) ∀j ∆hj ∈Hj is plotted by taking an average over 1000 randomly generated channel realizations. Fig. 2 investigates the convergence performance of the proposed algorithms with e = 3 dBm and ε = 0.01. It is clear that the proposed iterative algorithms indeed converge in all cases. We can see that after 7 iterations, the steady average worst-case rate is achieved for all P . In Fig. 3, we present the average worst-case rate versus the number of DA ports M with various channel uncertainty ε with P = 60 dBm, e = 5 dBm and ε = 0.01. It is found that our proposed robust algorithms attain substantial worst-case rate improvements over the conventional scheme in [22]. It is observed that there is about 0.3 bps/Hz difference between the curves of ε = 0.01 and 0.1 for the proposed algorithms. Furthermore, our proposed Algorithm 2 achieves about 0.5 bps/Hz and 0.7 bps/Hz gain compared to the conventional scheme [22] for ε = 0.01 and 0.1, respectively. We also see that our proposed Algorithm 1 outperforms Algorithm 2 at the expense of increased complexity. Fig. 4 shows the performance comparison among robust algorithms for different number of antennas in each DA port 8 TABLE I C OMPLEXITY ANALYSIS OF DIFFERENT ALGORITHMS Algorithms Algorithm 1 Algorithm 2 Conventional scheme [22] Complexity Order p  3 3 O nLmax Qmax 2K(M NT +2)+KM N T +4K+M 2K(M NT +2) +K(M NT ) +n[2K(M NT  2 2 2 2 2 +3K+1) +2) +K(M√ NT ) ]+4K+M +n where n = O(M N T  O nQmax 6K+KM NT +3K+M K[(M2 NT2 +1)2 +((K−1)M 2 NT2 +1)2 +(KM 2 NT2 +1)2 ] 3 2 2 +K[(M Np where n = O(M 2 NT2 +3K+1) T ) +n(M NT ) ]+3K+M +n O nD max K(3M N +2)+2K+M [2K(M NT +1)3 +KM 3 NT3 +n(2K(M NT +1)2 +KM 2 NT2 T  +2K+M )+n2 ] where n = O(M 2 NT2 +2K+1) 5.5 4 Perfect CSI Algorithm 1 (ǫ =0.01) Algorithm 1 (ǫ =0.1) Algorithm 2 (ǫ =0.01) Algorithm 2 (ǫ =0.1) Conventional scheme (ǫ =0.01) [22] Conventional scheme (ǫ =0.1) [22] Average worst-case rate (bps/Hz) 4.5 4 3.5 3 2.5 3 2.5 2 1.5 1 2 0.5 1.5 1 0 2 2.5 3 3.5 4 4.5 Number of DA Ports, M 5 5.5 6 0 0.05 0.1 0.15 0.2 Maximum channel uncertainty ǫ 0.25 0.3 Fig. 5. Average worst-case rate versus channel uncertainty ε Fig. 3. Average worst-case rate versus the number of DA ports 4 5 4.5 3.5 4 3 Average worst-case rate (bps/Hz) Average worst-case rate (bps/Hz) Algorithm 1 Algorithm 2 Conventional scheme [22] 3.5 Average worst-case rate (bps/Hz) 5 2.5 2 1.5 1 Perfect CSI Algorithm 1 Algorithm 2 Conventional scheme [22] 0.5 1.5 2 2.5 3 3.5 4 4.5 Number of antennas in each DA Port N T 5 5.5 3 2.5 2 Perfect CSI Algorithm 1 (ǫ =0.01) 1.5 Algorithm 1 (ǫ =0.1) Algorithm 2 (ǫ =0.01) Algorithm 2 (ǫ =0.1) Conventional scheme (ǫ =0.01) [22] Conventional scheme (ǫ =0.1) [22] 1 0.5 0 1 3.5 6 0 10 20 30 40 50 60 70 Total transmit power target P (dBm) 80 90 Fig. 4. Average worst-case rate versus the number of antennas in each DA port Fig. 6. Average worst-case rate versus P for various ε with e = 5 dBm and P = 80 dBm. One can see that the conventional algorithm [22] requires more antennas than our proposed robust algorithms. The performance gap between our proposed Algorithm 1 and 2 curves is about 0.3 bps/Hz. Moreover, as NT increases, the performance gap between our proposed algorithms and the conventional scheme becomes bigger. Fig. 5 depicts the effect of the channel uncertainty ε on the average worst-case rate with e = 0 dBm and P = 50 dBm. We can check that as the maximum channel uncertainty ε decreases, the average worst-case rate becomes enhanced. Clearly, the proposed robust algorithms outperform the conventional scheme [22]. Finally, in Fig. 6, we exhibit the average worst-case rate versus the total transmit power target P for various ε with e = 3 dBm. Compared to our proposed Algorithm 1, Algo- 9 rithm 2 achieves a complexity reduction at the expense of a performance loss. It is observed that as ε increases, the performance gap between our proposed algorithms and the conventional scheme becomes larger. VI. C ONCLUSION In this paper, we have studied a design of robust transmit beamforming and power splitting in multiuser DAS SWIPT downlink systems under per-DA port power constraint and energy harvesting constraint. Assuming imperfect CSIT, the uncertainty of the channel is modeled by an Euclidean ball. We have developed an algorithm to find a robust beamforming solution for maximizing the worst-case SINR by addressing a set of convex per-DA port power balancing problems. The reformulated problem can be solved by applying the SDR technique. Also, given the beamforming solution, the PS factor has been calculated. We have proposed an iterative algorithm and a low-complexity algorithm for the worst-case SINR maximization problem. Simulation results have demonstrated the validity of the proposed algorithms. A PPENDIX A P ROOF OF T HEOREM 1 If the rank-one constraint is ignored, problem (11) becomes convex and satisfies the Slater’s condition. Thus, its duality gap is zero [26]. Assume that the dual variables {Ck } ∈ H+ , {Qk } ∈ H+ , {Sk } ∈ H+ and {µm } ≥ 0 correspond to the constraint Ak  0, Bk  0, Vk  0 K P tr(Dm Vk ) ≤ αPm in (11), respectively. Then, the and k=1 Lagrangian dual function of the primal problem (11) is given by L=α− + M X K X (tr (Ck Ak ) + tr (Qk Bk ) + tr (Sk Vk )) k=1 µm m=1 K X k=1 (24) ! tr(Dm Vk ) − αPm . Since Ck and Tk are Hermitian matrices, we have where Ek =  0MNT ×1 δk σk2 −rk 0MNT ×1  √ ek ζk (1−ρk ) √ ek σk2 −tk Fk =  0MNT ×1 0MNT ×1 Gk = [ 0 ĥk I ].  01×MNT 01×MNT  , rk I ε2k  01×MNT 01×MNT  , tk I ε2 m=1 = 0. Since M P m=1 µ∗m Dm has full rank, following the rank inequality rank(AB) ≤ min(rank(A), rank(B)), we can finally prove that M  X  rank µ∗m Dm V∗k = rank (V∗k ) m=1 ≤rank Gk C∗k + 1 ∗ H  Q G ≤ 2. λ k k A PPENDIX B OF P ROPOSITION 1 ∇∆∗k L (∆k , θ) =VH k + θ∆k = 0. k   H 1 = 0. µm Dm − Gk Ck GH k + Γ Gk Qk Gk +Sk where it is noted that S∗k V∗k We differentiate the Lagrangian function with respect to ∆∗k and equate it to zero [29] as Taking partial derivative of (24) with respect to Vk and applying the KKT conditions [26], it follows M X m=1  ∗   ∗ µ∗m Dm V∗k = Gk C∗k + Γ1 Q∗k GH k +Sk Vk , By introducing an arbitrary positive multiplier θ ≥ 0, the Lagrangian function is given by   2 L (∆k , θ) = tr (Ĥk + ∆k )Vk + θ k∆k k − ξk2 . tr(Qk Bk )= tr(Qk GH k Mk Gk ) + tr(Qk Ek ), ρk δk M X P ROOF tr(Ck Ak )= tr(Ck GH k TGk ) + tr(Ck Fk ),  Let {C∗k } , {Q∗k } , {S∗k } and {µ∗m } be the optimal dual solution to problem (11). Note that Q∗k B∗k = 0 from the complementary slackness conditions of problem (11). Since the size of Q∗k and B∗k is (M NT + 2) × (M NT + 2), we have rank(Q∗k ) + rank(B∗k ) ≤ M NT + 2. Denoting rk∗ as the optimal solution to problem (11), rk∗ in B∗k in (11) is nonnegative. If rk∗ > 0, rk∗ I+M∗k has full rank. We will prove that rk∗ 6= 0 by contradiction. If rk∗ = 0, the constraint k∆hk k2 ≤ ε2k does not hold since rk∗ is the dual variable for (10). Note that the condition k∆hk k2 ≤ ε2k is the only constraint on ∆hk . If ∆hk is the worst channel uncertainty which minimizes . P 2 2 H 2 2 ρ q , ρk |hH v | k k k j6=k |hk vj | + ρk σk + δk , we can always find a scalar ω > 1 which satisfies k∆hk k2 = ε2k . Substituting the channel uncertainty ω∆hk in q, we can find a SINR lower than that obtained by ∆h∗k . This is contradictory to the assumption that ∆h∗k minimizes the SINR. Thus, it follows rk∗ 6= 0, which leads to rk∗ > 0. As a result, rk∗ I+M∗k becomes full rank, and we have rank(B∗k ) ≥ N . Furthermore, since rank(Q∗k ) is non-zero. Thus, the rank of Q∗k equals 1. Similarly, we can show that rank (C∗k ) = 1. Then,  it ∗ ∗ 1 ∗ ≤ rank GH follows rank GH k Ck G k + k(Ck + Γ Qk )Gk H ∗ 1 Γ rank Gk Qk Gk = 2. Thus, multiplying both sides of (25) with V∗k yields (25) 1 H Then, we can find the optimal solution ∆opt k = − θ Vk . In order to remove the role of an arbitrary parameter of θ, the Lagrangian function is differentiated with respect to θ and set to zero as ∇θ L (∆k , θ) = ∆opt k 2 − ξk2 = 0. Thus the optimal solution for θ is obtained as θopt = kVH k k ξk . 10 By combining the above results, we finally get ∆opt k = ± ξk VH k kVk k . Accordingly, the minimum and maximum of ∆k can be expressed as ∆min k = − ξk VH VH k k , ∆max =ξ . k k kVk k kVk k To check if this optimal solution is a minimum, we confirm that the second derivative at the optimal solution point ∆opt k is positive semi-definite as  opt = θopt (vec {IMNT } vec {IMNT })T  0. ∇2∆∗k L ∆opt k ,θ R EFERENCES [1] W. Choi and J. G. Andrews, “Downlink performance and capacity of distributed antenna systems in a multicell environment,” IEEE Trans. Wireless Commun., vol. 6, no. 1, pp. 69-73, Jan. 2007. [2] J. Wang, H. Zhu and N. J. Gomes, “Distributed antenna systems for mobile communications in high speed trains,” IEEE J. Sel. Areas Commun., vol. 30, no. 4, pp. 675-683, May 2012. [3] H. Zhu, “Performance comparison between distributed antenna and microcellular systems,” IEEE J. Sel. Areas Commun., vol. 29, no. 6, pp. 1151-1163, Jun. 2011. [4] H. Kim, S.-R. Lee, K.-J. Lee, and I. Lee, “Transmission schemes based on sum rate analysis in distributed antenna systems,” IEEE Trans. Wireless Commun., vol. 11, no. 3, pp. 1201-1209, Mar. 2012. [5] S.-R. Lee, S.-H. Moon, H.-B. Kong, and I. Lee, “Optimal beamforming schemes and its capacity behavior for downlink distributed antenna systems,” IEEE Trans. Wireless Commun., vol. 12, no. 6, pp. 2578-2587, Jun. 2013. [6] L. Varshney, “Transporting information and energy simultaneously,” in Proc. IEEE Int. Symp. Inf. Theory, pp. 1612-1616, Jul. 2008. [7] P. Grover and A. Sahai, “Shannon meets Tesla: Wireless information and power transfer,” in Proc. IEEE Int. Symp. Inf. Theory, pp. 2363-2367, Jun. 2010. [8] R. Zhang and C. Ho, “MIMO broadcasting for simultaneous wireless information and power transfer,” IEEE Trans. Wireless Commun., vol. 12, no. 5, pp. 1989-2001, May 2013. [9] Z. Zhu, Z. Wang, K.-J. Lee, Z. Chu, and I. Lee, “Robust transceiver designs in multiuser MISO broadcasting with simultaneous wireless information and power transmission,” Journal of Commun. and Networks, vol. 18, no. 2, pp. 173-181, Apr. 2016. [10] D. W. K. Ng, E. S. Lo, and R. Schober, “Robust beamforming for secure communication in systems with wireless information and power transfer,” IEEE Trans. Wireless Commun., vol. 13, no. 8, pp. 4599-4615, Aug. 2014. [11] Q. Shi, L. Liu, W. Xu, and R. Zhang, “Joint transmit beamforming and receive power splitting for MISO SWIPT systems,” IEEE Trans. Wireless Commun., vol. 13, no. 6, pp. 3269-3280, Jun. 2014. [12] Z. Zhu, Z. Chu, Z. Wang, and I. Lee, “Joint optimization of AN-aided beamforming and power splitting designs for MISO secrecy channel with SWIPT,” in Proc. IEEE ICC, May 2016. [13] Z. Zhu, Z. Chu, N. Wang, S. Huang, Z. Wang, and I. Lee, “Beamforming and power splitting designs for AN-aided secure multi-user MIMO SWIPT systems,” IEEE Trans. Inf. Forensics Security, vol. 12, no. 12, pp. 2861-2874, Dec. 2017. [14] Z. Chu, H. Xing, M. Johnston, and S. Le Goff, “Secrecy rate optimizations for a MISO secrecy channel with multiple multi-antenna eavesdroppers,” IEEE Trans. Wireless Commun., vol. 15, no. 1, pp. 283297, Jan. 2016. [15] Z. Chu, Z. Zhu, M. Johnston, and S. L. Goff, “Simultaneous wireless information power transfer for MISO secrecy channel,” IEEE Trans. Vehicular Technol., vol. 15, no. 1, pp. 283-297, Jan. 2016. [16] Z. Zhu, Z. Wang, Z. Chu, X. Gao, Y. Zhang, and J. Cui, “Robust beamforming based on transmit power analysis for multiuser multipleinput single-output interference channels with energy harvesting,” IET Communications, vol. 10, no. 10, pp. 1221-1228, Jul. 2016. [17] Z. Chu, Z. Zhu, and J. Hussein, “Robust optimization for AN-aided transmission and power splitting for secure MISO SWIPT system,” IEEE Commun. Lett., vol. 20, no. 8, pp. 1571-1574, Aug. 2016. [18] F. Yuan, S. Jin, Y. Huang, K. K. Wong, Q. T. Zhang, and H. Zhu, “Joint wireless information and energy transfer in massive distributed antenna systems,” IEEE Commun. Mag., vol. 53, no. 6, pp. 109-116, Jun. 2015. [19] Z. Ding, C. Zhong, D. W. K. Ng, M. Peng, H. A. Suraweera, R. Schober, and H. V. Poor, “Application of smart antenna technologies in simultaneous wireless information and power transfer,” IEEE Commun. Mag., vol. 53, no. 4, pp. 86-93, Apr. 2015. [20] F. Yuan, S. Jin, K.-K. Wong, and H. Zhu, “Wireless information and power transfer design for energy cooperation distributed antenna systems,” IEEE Access, vol. 5, pp. 8094-8105, 2017. [21] K. Huang, “A Tradeoff between information and power transfers using a large-scale array of dense distributed antennas,” in Proc. IEEE GLOBECOM, Dec. 2015. [22] Z. Zhu, K.-J. Lee, Z. Wang, and I. Lee. “Robust beamforming and power splitting design in distributed antenna system with SWIPT under bounded channel uncertainty,” in Proc. IEEE VTC, May 2015. [23] D. W. K. Ng, R. Schober, “Secure and green SWIPT in distributed antenna networks with limited backhaul capacity,” IEEE Trans. Wireless Commun., vol. 14, no. 9, pp. 5082-5097, Sep. 2015. [24] K. Huang, C. Zhong and G. Zhu, “Some new research trends in wirelessly powered communications,” IEEE Wireless Commun., vol. 23, no. 2, pp. 19-27, Apr. 2016. [25] Y. Dong, J. Hossain, J. Cheng, and V. C. M. Leung, “Joint RRH selection and beamforming in distributed antenna systems with energy harvesting,” in Proc. International Conference on Computing, Networking and Communications (ICNC), pp. 582-586, Mar. 2017. [26] S. Boyd and L. Vandenberghe, Convex optimization. Cambridge U.K. Cambridge Univ. Press, 2004. [27] Z.-Q. Luo, W.-K. Ma, A. M.-C. So, Y. Ye, and S. Zhang, “Semidefinite relaxation of quadratic optimization problems: From its practical deployments and scope of applicability to key theoretical results,” IEEE Signal Process. Mag., vol. 27, no. 3, pp. 20-34, May 2010. [28] M. Grant and S. Boyd., “CVX: Matlab software for disciplined convex programming,” Available: http://cvxr.com/cvx, Sep. 2012. [29] R. A. Horn and C. R. Johnson, Matrix analysis. New York: Cambridge University Press, 1985. [30] Z.-Q. Luo, J. F. Sturm, and S. Zhang, “Multivariate nonnegative quadratic mappings,” SIAM J. Optim., vol. 14, no. 4, pp. 1140-1162, May 2004. [31] K.-Y. Wang, A. M. So, T.-H. Chang, W.-K. Ma, and C.-Y. Chi, “Outage constrained robust transmit optimization for multiuser MISO downlinks: Tractable approximations by conic optimization,” IEEE Trans. Signal Process., vol. 62, no. 21, pp. 5690-5705, Nov. 2014. [32] Z. Zhu, Z. Chu, Z. Wang, and I. Lee, “Outage constrained robust beamforming for secure broadcasting systems with energy harvesting,” IEEE Trans. Wireless Commun., vol. 15, no. 11, pp. 7610-7620, Nov. 2016. [33] E. Karipidis, N. D. Sidiropoulos, and Z.-Q. Luo, “Far-field multicast beamforming for uniform linear antenna arrays,” IEEE Trans. Signal Process., vol. 55, no. 10, pp. 4916-4927, Oct. 2007. [34] A. H. Phan, H. D. Tuan, H. H. Kha, and D. T. Ngo, “Nonsmooth optimization for efficient beamforming in cognitive radio multicast transmission,” IEEE Trans. Signal Process., vol. 60, no. 6, pp. 2941-2951, Jun. 2012.
7cs.IT
Synthesis of Parametric Programs using Genetic Programming and Model Checking Gal Katz Doron Peled Department of Computer Science, Bar Ilan University Ramat Gan 52900, Israel Formal methods apply algorithms based on mathematical principles to enhance the reliability of systems. It would only be natural to try to progress from verification, model checking or testing a system against its formal specification into constructing it automatically. Classical algorithmic synthesis theory provides interesting algorithms but also alarming high complexity and undecidability results. The use of genetic programming, in combination of model checking and testing, provides a powerful heuristic to synthesize programs. The method is not completely automatic, as it is fine tuned by a user that sets up the specification and parameters. It also does not guarantee to always succeed and converge towards a solution that satisfies all the required properties. However, we applied it successfully on quite nontrivial examples and managed to find solutions to hard programming challenges, as well as to improve and to correct code. We describe here several versions of our method for synthesizing sequential and concurrent systems. 1 Introduction Formal methods [16] assist software and hardware developers in enhancing the reliability of systems. They provide methods and tools to search for design and programming errors. While these methods are effective in the software development process, they also suffer from severe limitations: testing is not exhaustive, formal verification is extremely tedious and model checking is limited to particular domains (usually, finite state systems) and suffers from high complexity, where memory and time requirements are sometimes prohibitively high. A natural progress from formal methods are algorithms for automatically converting the formal specification into code or a description of hardware. Such algorithms would create correct-by-design code or piece of hardware. However, high complexity [19] and even undecidability [20] appear in some main classical automatic synthesis problems. The approach presented here is quite different from algorithmic synthesis. We perform a generateand-check kind of synthesis and use model checking or SAT solving to evaluate the generated candidates. An extreme approach would be to enumerate the possible programs (say, up to a certain size) and use model checking to find the correct solution(s). This was applied in Taubenfeld [3] to find mutual exclusion algorithms. Our synthesis method is based on genetic programming. It allows us to generate multiple candidate solutions at random and to mutate them, as a stochastic process. We employ enhanced model checking (model checking that does not only produce an affirmation to the checked properties or a counterexample, but distinguishes also some finer level of correctness) to provide fitness levels that are used to direct the search towards solutions that satisfy the given specification. Our synthesis method can be seen as a heuristic search in the space of syntactically fitting programs. It is not completely automatic, in the sense that the user can refine the specification and change the way the fitness is evaluated when the formal properties are satisfied. Our method is not guaranteed to terminate with a correct solution; we might give up after some time and can restart the search from a new random seed or with a refinement of the way the method assigns fitness. L. Clemente and L. Holik (Eds.): 15th International Workshop on Verification of Infinite-State Systems (INFINITY’13) EPTCS 140, 2014, pp. 70–84, doi:10.4204/EPTCS.140.5 G. Katz & D. Peled 71 Although this marriage between genetic programming and model checking is quite promising, it suffers from some limitations of model checking. First, model checking is primarily designed for finite state systems. Although some extensions of it exist (e.g., to programs with a single stack), model checking does not work in general for parametric systems. Unfortunately, most systems that we would like to synthesize are parametric in nature: almost every abstract algorithm on data structures, be it queue, tree, graph, is parametric, where the size of the structure, is not fixed. It is easy to demonstrate model checking on a sorting program with a fixed vector of numbers and some fixed initial assignment of values. However, when the length of the vector is parametric, and we need to prove correctness with respect to arbitrary set of values, existing model checking techniques often fail. For this reason, we use model checking in our approach for synthesizing parametric systems not as a comprehensive method for finding correctness, but as a generalized testing tool, which can make exhaustive checks for fixed parameters. Under this setting, we accept candidate programs when there is ample evidence that they are correct, specifically, when they passed enough checks, rather than when we establish comprehensive correctness. Our genetic programming synthesis approach allows us not only to generate code that satisfies a given temporal specification but also to improve and correct code. We can start with an existing solution for a specification, and use the genetic process to improve it. We can also start with some flawed version of the code and use our method to correct it. 2 Genetic Programming Based on Model Checking We present in [8, 9, 10, 11, 12] a framework combining genetic programming and model checking, which allows to automatically synthesize code for given problems. The framework we suggest is depicted in Figure 1. • The formal specification of the problem, as well as the required architecture and constraints on the structure of the desired solutions is provided by the user. This may also include some initial versions of the desired code that either need correction or improvement. • An enhanced GP engine that generates random programs and then evolves them using mutation operations that allow to change the code randomly. • A verifier that analyzes the generated programs, and provides useful information about their correctness. This can be a model checker, often enhanced to provide more information than yes/no (and counterexample), or a SAT solver. The synthesis process goes through the following steps: 1. The user feeds the GP engine with the desired architecture and a set of constraints regarding the programs that are allowed to be generated. This includes: (a) a set of functions literals and instructions used as building blocks for the generated programs, (b) the number of concurrent processes, the methods of communication between processes (in case of concurrent programs), (c) limitations on the size and structure of the generated programs, and the maximal number of permitted iterations. (d) The user may also provide some initial versions of the code that may be either incorrect or suboptimal. The genetic process can exploit these versions to evolve into better (correct or optimized) code. Synthesis of Parametric Programs using Genetic Programming and Model Checking 72 User Interface 1. Configuration 6. Results 2. Specification 3. Initial population Enhanced GP Engine 4. Verification results Enhanced Model Checker 5. New programs h Figure 1: The Suggested Framework 2. The user provides a formal specification for the problem. This consists, in our case, of a set of linear temporal logic properties, as well as additional quantitative requirements on the program behavior. 3. The GP engine randomly generates an initial population of candidate programs based on the provided building blocks and constraints. 4. The verifier analyzes the behavior of the generated candidates against the specification properties, and provides fitness measures based on the amount of satisfaction. 5. The GP engine creates new programs by applying the genetic operations of mutation, which performs small random changes to the code, and crossover, which glues together parts of different candidate solutions. Steps 4 and 5 are repeated until either a perfect program is found (fully satisfying the specification), or until the maximal number of iterations is reached. 6. The results are sent back to the user. This includes programs that satisfy all the specification properties, if one exists, or the best partially correct programs that was found, along with its verification results. For steps 4 and 5 above, we use the following selection method: • Randomly select µ candidate programs. • Create λ new candidates by applying mutation (and optionally crossover) operations (as explained below) to the above µ candidates. We now have µ + λ candidates. • Calculate the fitness function for each of the new candidates based on “enhanced model checking”. • Based on the calculated fitness, choose new µ candidates from the set of µ + λ candidates. Candidates with higher fitness values are selected with a higher probability than others. Replace the originally selected µ with the ones selected at this step. G. Katz & D. Peled 73 while while != assign 0 A[] A[] 2 me (i) 1 A[] != assign 0 A[] A[] me 0 2 (ii) Figure 2: (i) Randomly created program tree, (ii) the result of a replacement mutation We represent programs as trees, where an instruction or an expression is represented by a single node, having its parameters as its offspring. Terminal nodes represent constants. Examples of the instructions we use are assignment, while , if and block. The latter construct is a sequential composition of a pair of instructions. At the first step, an initial population of candidate programs is generated. Each program is generated recursively, starting from the root, adding nodes until the tree is completed. The root node is chosen randomly from the set of instruction nodes, and each child node is chosen randomly from the set of nodes allowed by its parent type, and its place in the parameter list. Figure 2(i) shows an example of a randomly created tree that represents the following program: while (A[2] != 0) A[me] = 1 The main operation we use is mutation. It allows making small changes on existing trees. The mutation includes the following steps: 1. Randomly choose a node s from the program tree. 2. Apply one of the following operations to the tree with respect to ihe chosen node: (a) Replace the subtree with root s with a new randomly generated subtree. (b) Add an immediate parent to s. Randomly create other offspring to the new parent, if needed. (c) Replace the node s by one of its offspring. Delete the remaining offspring of that node. (d) Delete the subtree with root s. The node ancestors should be updated recursively. Mutation of type (a) can replace either a single terminal or an entire subtree. For example, the terminal “1” in the tree of Figure 2(i), is replaced by the grayed subtree in 2(ii), changing the assignment instruction into A[me] = A[0]. Mutations of type (b) can extend programs in several ways, depending on the new parent node type. In case a “block” type is chosen, a new instruction(s) will be inserted before or after the mutation node. For instance, the grayed part of Figure 3 represents a second assignment instruction inserted into the original program. Similarly, choosing a parent node of type “while” will have the effect of wrapping the mutation node with a while loop. The type of mutation applied to candidate programs is randomly selected. All mutations must of course produce legal code. This affects the possible mutation type for the chosen node, and the type of new generated nodes. Another operation that is frequently used in genetic programming is crossover. The crossover operation creates new candidates by merging building blocks of two existing programs. The crossover steps are: 74 Synthesis of Parametric Programs using Genetic Programming and Model Checking while != block A[] 0 assign assign 2 A[] other A[] 2 1 me Figure 3: Tree after insertion mutation 1. Randomly choose a node from the first program. 2. Randomly choose a node from the second program that has the same type as the first node. 3. Exchange between the subtrees rooted by the two nodes, and use the two new programs created by this method. While traditional GP is heavily based on crossover, it is quite a controversial operation (see [2], for example). Crossover is not used in our work. Fitness is used by GP in order to choose which programs have a higher probability to survive and participate in the genetic operations. In addition, the success termination criterion of the GP algorithm is based on the fitness value of the most fitted candidate. Traditionally, the fitness function is calculated by running the program on some set of inputs (a training set), which represent the possible inputs. In contrast, our fitness function is not based on running the programs on sample data, but on an enhanced model checking procedure. While the classical model checking provides a yes/no answer to the satisfiablity of the specification (thus yielding a two-valued fitness function), our model checking algorithm generates a smoother function by providing several levels of correctness. Often, we have the following four levels of correctness, per each linear temporal logic property: 1. None of the executions of the program satisfy the property. 2. Some, but not all the executions of the program satisfy the property. 3. The only executions that do not satisfy the property must have infinitely many decisions that avoid a path that does satisfy the property. 4. All the executions satisfy the property. We provided several methods for generating the various fitness levels: • Using Streett Automata, and a strongly-connected component analysis of the program graph [9]. • Enhanced model checking logic and algorithm [8, 15]. • Probabilistic model checking. There are several other considerations in setting up the calculation of the fitness. First, priority between the properties is used to suppress assigning fitness value due to the satisfaction of a liveness property (e.g., “when a process wants to enter its critical section, it would eventually be able to do G. Katz & D. Peled 75 so”) when the safety property does not hold (e.g., “the two processes cannot enter their critical sections simultaneously”). Another consideration is to prevent needless growth of the program by useless code. To alleviate this, we use some negative fitness value related to the program’s length. This entails that a solution that satisfies all the specification is accepted even if it does not have perfect fitness value (due to length). 3 Example: Mutual Exclusion Algorithms As an example, we used our method in order to automatically generate solutions to several variants of the Mutual Exclusion Problem. In this problem, first described and solved by Dijkstra [5], two or more processes are repeatedly running critical and non-critical sections of a program. The goal is to avoid the simultaneous execution of the critical section by more than one process. We limit our search for solutions to the case of only two processes. The problem is modeled using the following program parts that are executed in an infinite loop: Non Critical Section Pre Protocol Critical Section Post Protocol These parts are fixed, and, together with the number of processes involved (two) and the number of variables allowed, consist of the architecture provided to our genetic programming tool, together with the temporal specification. The Non Critical Section part represents the process part on which it does not require an access to the shared resource. A process can make a nondeterministic choice whether to stay in that part, or to move into the Pre Protocol part. From the Critical Section part, a process always has to move into the Post Protocol part. The Non Critical Section and Critical Section parts are fixed, while our goal is to automatically generate code for the Pre Protocol and Post Protocol parts, such that the entire program will fully satisfy the problem’s specification. We use a restricted high level language based on the C language. Each process has access to its id (0 or 1) by the me literal, and to the other process’ id by the other literal. The processes can use an array of shared bits with a size depended on the exact variant of the problem we wish to solve. The two processes run the same code. The available node types are: assignment, if, while, empty-while, block, and, or and array. Terminals include the constants: 0, 1, 2, me and other. Table 1 describes the properties that define the problem specification. The four program parts are denoted by NonCS, Pre, CS and Post respectively. Property 1 is the basic safety property requiring the Table 1: Mutual Exclusion Specification No. 1 2,3 4,5 6 7,8 Type Safety Liveness Definition ✷¬(p0 in CS ∧ p1 in CS) ✷(pme in Post → ✸(pme in NonCS)) ✷(pme in Pre ∧ ✷(pother in NonCS)) → ✸(pme in CS)) ✷((p0 in Pre ∧ p1 in Pre) → ✸(p0 in CS ∨ p1 in CS)) ✷(pme in Pre → ✸(pme in CS)) Description Mutual Exclusion Progress No Contest Level 1 2 3 Deadlock Freedom 4 Starvation 4 mutual exclusion. Properties displayed in pairs are symmetrically defined for the two processes. Prop- Synthesis of Parametric Programs using Genetic Programming and Model Checking 76 erties 2 and 3 guarantee that the processes are not hung in the Post Protocol part. Similar properties for the Critical Section are not needed, since it is a fixed part without an evolved code. Properties 4 and 5 require that a process can enter the critical section, if it is the only process trying to enter it. Property 6 requires that if both processes are trying to enter the critical section, at least one of them will eventually succeed. This property can be replaced by the stronger requirements 7 and 8 that guarantee that no process will starve. There are several known solutions to the Mutual Exclusion problem, depending on the number of shared bits in use, the type of conditions allowed (simple / complex) and whether starvation-freedom is required. The variants of the problem we wish to solve are showed in Table 2. Table 2: Mutual Exclusion Variants Variant No. 1 2 3 Number of bits 2 3 3 Conditions Requirement Simple Simple Complex Deadlock Freedom Starvation Freedom Starvation Freedom Relevant properties 1,2,3,4,5,6 1,2,3,4,5,7,8 1,2,3,4,5,7,8 Known algorithm One bit protocol [4] Dekker [5] Peterson [18] Three different configurations where used, in order to search for solutions to the variants described in Table 2. Each run included the creation of 150 initial programs by the GP engine, and the iterative creation of new programs until a perfect solution was found, or until a maximum of 2000 iterations. At each iteration, 5 programs were randomly selected, bred, and replaced using mutation. The values µ = 5, λ = 150 where chosen. In addition to the temporal specification of mutual exclusion, our configuration allows three shared bits. The famous Dekker’s algorithm [5] uses two bits to announce that they want to enter the critical section, and the third bit is used to set turns between the two processes. Many runs initially converged into deadlock-free algorithms using only two bits. Those algorithms have executions in which one of the processes starve, hence only partially satisfying properties 7 or 8. Program (a) shows one of those algorithms, which later evolved into program (b). The evolution first included the addition of the second line to the post protocol section (which only slightly decreased its fitness level due to the parsimony measure). A replacement mutation then changed the inner while loop condition, leading to a perfect solution similar to Dekker’s algorithm. Non Critical Section A[me] = 1 While (A[other] == 1) While (A[0] != other) A[me] = 0 A[me] = 1 Critical Section A[me] = 0 (a) [94.34] Non Critical Section A[me] = 1 While (A[other] == 1) While (A[2] == me) A[me] = 0 A[me] = 1 Critical Section A[2] = me A[me] = 0 (b) [96.70] Inspired by algorithms developed by Tsay [21] and by Kessels [13], our next goal was to start from an existing algorithm, and by adding more constraints and building blocks, try to evolve into more advanced algorithms. G. Katz & D. Peled 77 First, we allowed a minor asymmetry between the two processes. This is done by the operators not0 and not1, which act only on one of the processes. Thus, for process 0, not0(x) = ¬x while for process 1, not0(x) = x. This is reversed for not1(x), which negates its bit operand x only in process 1, and do nothing on process 0. As a result, the tool found two algorithms that may be considered simpler than Peterson’s. The first one has only one condition in the wait statement (written here using the syntax of a while loop), although with a more complicated atomic comparison, between two bits. Note that the variable turn is in fact A[2] and is renamed here turn to accord with classical presentation of the extra global bit that does not belong to a specific process. Pre CS A[me] = 1 turn = me While (A[other] != not1(turn)); Critical Section A[me] = 0 The second algorithm uses the idea of setting the turn bit one more time after leaving the critical section. This allows the while condition to be even simpler. Tsay [21] used a similar refinement, but his algorithm needs an additional if statement, which is not used in our algorithm. Pre CS A[me] = 1 turn = not0(A[other]) While (A[2] != me); Critical Section A[me] = 0 turn = other Next, we aimed at finding more advanced algorithms satisfying additional properties. The configuration was extended into four shared bits and two private bits (one for each process). The first requirement was that each process can change only its 2 local bits, but can read all of the 4 shared bits This yielded the following algorithm. Pre CS A[me] = 1 B[me] = not1(B[other]) While (A[other] == 1 and B[0] == not1(B[1])); Critical Section A[me] = 0 The algorithm uses the idea of using two bits as the “turn”, were each process changes only its bit to set its turn, but compares both of them in the while loop. Finally, we added the requirement for busy waiting only on local bits (i.e. using local spins). The following algorithm (similar to Kessels’) was generated, satisfying all properties from the table above. 78 Synthesis of Parametric Programs using Genetic Programming and Model Checking Non Critical Section A[other] = 1 B[other] = not1(B[0]) T[me] = not1(B[other]) While (A[me] == 1 and B[me] == T[me]); Critical Section A[other] = 0 4 Synthesizing Parametric Programs Our experience with genetic program synthesis quickly hits a difficulty that stems from the limited power of model checking: there are few interesting fixed finite state programs that can also be completely specified using pure temporal logic. Most programming problems are, in fact, parametric. Model checking is undecidable for parametric families of programs (say, with n processes, each with the same code, initialized with different parameters) even for a fixed property [1]. One may look at mutual exclusion for a parametric number of processes. Examples are, sorting, where the number of processes and the values to be sorted are the parameters, network algorithms, such as finding the leader in a set of processes, etc. In order to synthesize parametric concurrent programs, in particular those that have a parametric number of processes, and even a parametric architecture, we use a different genetic programming strategy. First, we assume that a solution that is checked for a large number of instances/parameters is acceptable. This is not a guarantee of correctness, but under the prohibitive undecidability of model checking for parametric programs, at least we have a strong evidence that the solution may generalize to an arbitrary configuration. In fact, there are several works on particular cases where one can calculate the parameter size that guarantees that if all the smaller instances are correct, then any instance is correct [6]. Unfortunately, this is not a rule that can be applied to any arbitrary parametric problem. We apply a coevolution based synthesis algorithm: we collect parameters from failed checked cases and keep them as counterexamples. When suggesting a new solution, we check it against the collected counterexamples. We can view this process as a genetic search for both correct programs and counterexamples. The fitness is different, of course, for both tasks: a program gets higher fitness by being close to satisfying the full set of properties, while a counterexample is obtaining a high fitness if it fails the program. In this sense, the model checking of a particular set of instances can be considered as a generalized testing for these values: each set of instances of the parameters provides a single finite state system that is itself comprehensively tested using model checking. This idea can be also used, independently, for model checking parametric systems. For example, consider a concurrent sorting program consisting of a parametric array of processes, each containing some initial value. Adjacent processes may exchange values during the algorithm. For any particular size and set of values, the model checking provides automatic and exhaustive test for a particular set of values, but the check is not exhaustive for all the array sizes or array values, but rather samples them. In the classical leader election in a ring problem, the processes initially have their own values that they can transfer around, with the goal of finding a process that has the highest value. Then, the parameters include the size of the ring, and the initial assignment of values to processes. While we can check solutions up to a certain size, and in addition, check all possible initial values, the time and state explosion is huge. Instead, we can then store each set of instances of the parameters that failed for some candidate solution, and, when checking a new candidate solution, check it against the failed instances. A solution for the leader election, albeit not the most optimal one, was obtained using our genetic programming methods [10]. G. Katz & D. Peled 5 79 Correcting Erroneous Program Our method is not limited to finding new program that satisfy the given specification. In fact, we can start with the code of an existing program instead of a completely random population and try to improve or correct it. In order to improve code, our fitness measure may include some quantitative evaluation; then the initial program may be found inferior to some later generated candidates. If the program we start with is erroneous, then it would not get a very high fitness value by failing to satisfy some of the properties. In [11] we approached the ambitious problem of correcting a known protocol for obtaining interprocess interaction called α -core [17]. The algorithm allows multiparty synchronization of several processes. It needs to function in a system that allows nondeterministic choices, which makes it challenging, as processes that may consider one possible interaction may also decide to be engaged in another interaction. The algorithm uses asynchronous message passing in order to enforce selection of the interactions by the involved processes. This nontrivial algorithm, which is used in practice for distributed systems, contains an error. The protocol is quite big, involving sending different messages between the controlled processes, and the controlling processes, one per each possible multiparty interaction. These messages include announcing the willingness to be engaged in an interaction, committing an interaction, canceling an interaction, request for commit from the interaction manager processes, as well as announcement that the interaction can start, or is canceled due to the departure of at least one participant. The state space of such a protocol is obviously high. In addition, the protocol can run on any number of processes, each process with arbitrary number of choices to be involves in interactions, and each interaction includes any number of processes. Recall that model checking of parametric programs is undecidable in general [1]. In fact, we use our genetic programming approach first to find the error, and then to correct it. We use two important ideas: 1. Use the genetic engine not only to generate programs, but also to evolve different architectures on which programs can run. 2. Apply a co-evolution process, where candidate programs, and test cases (architectures) that may fail these programs, are evolved in parallel. Specifically, the architecture for the candidate programs is also represented as code (or, equivalently, a syntactic tree) for spanning processes and their interactions, which can be subjected to genetic mutations. The fitness function directs the search for a program that may falsify the specification for the given erroneous program. After finding a “bad” architecture for a program, one that causes the program to fail its specification, our next goal is to reverse the genetic programming direction, and try to automatically correct the program, where a “correct” program at this step, is one that has passed model checking against the architecture. Yet, correcting the program for the first found wrong architecture only, does not guarantee its correctness under different architectures, hence more architectures that fail candidate solutions are collected. Note that we use for the co-evolution two separate fitness functions: one for searching for “bad” architectures, and one for searching for a correct solution. In Figure 4 we show the architecture that was found to produce the error in the original α -core algorithm. A message sequence chart in Figure 5 demonstrate the found bad scenario. The correction consisted of changing the line of code if n>0 then n:=n-1 into if sender∈shared then n:=n-1 80 Synthesis of Parametric Programs using Genetic Programming and Model Checking P1 P2 C1 C2 Figure 4: An architecture violating the assertion msc Assertion violation P1 P2 C1 OFFER (1) OFFER (2) OFFER (3) OFFER (4) LOCK (5) OK (6) LOCK (7) OK (8) LOCK (9) START (10) REFUSE (11) START (12) REFUSE (13) ACKREF (14) UNLOCK (15) OFFER (16) OFFER (17) ACKREF (18) C2 n=1 n=2 n=0 n=1 n=0 Figure 5: A Message Sequence Chart showing the counterexample for the α -core protocol 6 A Tool for Genetic Programming Based on Model Checking We constructed a tool, MCGP [12], that implements our ideas about model checking based genetic programming. Depending on these settings, the tool can be used for several purposes: • Setting all parts as static will cause the tool to just run the enhanced model checking algorithm on the user-defined program, and provide its detailed results. • Setting the init process as static and all or some of the other processes as dynamic will order the tool to synthesize code according to the specified architecture. This can be used for synthesizing programs from scratch, synthesizing only some missing parts of a given partial program, or trying to correct or improve a complete given program. • Setting the init process as dynamic and all other processes as static, is used when trying to falsify a given parametric program by searching for a configuration that violates its specification (see [11]). G. Katz & D. Peled 81 Figure 6: MCGP screen shot during synthesis of a mutual exclusion algorithm • Setting both the init and the program processes as dynamic is used for synthesizing parametric programs, where the tool alternatively evolves various programs and configurations under which the programs have to be satisfied. 7 Replacing Model Checking by SAT Solving Our approach can use automated deductive techniques instead of model checking in order to prove the correctness of the synthesized algorithms. However, it requires the verification procedures to be both fully automatic, and quite fast, so it can be repeated a large number of times. Obviously, most theorem provers that require some user interaction during the proof process cannot be used along with our framework. Furthermore, verification in this case is in general undecidable, so fast and complete procedure is not achievable. Recently, there is a growing use of SAT and SMT solvers for verification purposes. These tools can function as high performance, and light-weight theorem provers for a broad range of decidable theories over first order logic, such as those of equalities with uninterpreted functions, bit-vectors and arrays. If we restrict our domain and structure of the synthesized programs as shown later, we can successfully (and quite quickly) verify their correctness for all inputs in the related domains. For some theories, variables are theoretically unbounded, while for other theories, we must limit their width. Our work is inspired by [7], in which a set of short but ingenious and nontrivial programs, selected from the book Hacker’s Delight [22], were successfully synthesized. These programs are loop-free, and use expressions over the decidable theory of bit-vectors. Thus, they can be easily converted into first order formulas which can then be verified by an SMT solver. The theory of bit-vectors is decidable only when limiting the width of its related variables. From a practical point of view, this does not impose a real constraint, since we can easily check the correctness of programs even with 128-bit variables. Unlike [7], we do not use the SMT solver for the direct synthesis of programs. Instead, we generate and evolve programs using our GP engine, and integrate the SMT solver into our verification component. We modify our original framework in order to adopt it to the synthesis of sequential programs. In this new framework, the configuration provided by the user to the GP engine includes a set of building blocks, such as variables and functions that are related to the theory in use. Only loop-free programs are generated. The specification provided by the user consists of first order logic formulas describing pre and post-conditions over the above variables. A new verification component is built for dealing with Synthesis of Parametric Programs using Genetic Programming and Model Checking 82 sequential programs, including two modules. A Prover module is able to get programs from the GP engine, and transfer them into logical formulas that are then checked for correctness by the SMT solver against the specification. The results received from the SMT solver are then used for calculating the fitness function, and for generating counterexamples. The core of this module is based on the Microsoft Z3 SMT Solver [14]. A Runner module is able to run programs directly, and check their correctness for specific given test cases. For sequential programs, we can use the Hoare notation {ϕ }P{ψ } to denote the requirement that if the execution of the program starts with a state satisfying the (first order formula) ϕ , upon termination, it satisfies ψ . The formula ϕ is over the input variables. Assume they do not change. Otherwise, we can use an additional copy of them; a fixed part of the code copies them to the changeable copy. The formula ψ represents the connection between the input and output variables upon termination. Termination is not an issue here, as our generated loop-free programs must always terminate by construction (they contain no loops). Let ϕ be the common precondition and ψ1 ..ψn be a set of post-conditions. We want to check for each ψi whether {ϕ }P{ψi } holds. Using standard construction, we obtain a formula ηP that represents the relationship between the input and output variables. For each postcondition ψi we define Fi := ϕ ∧ ηP ∧ ¬ψi and Fi′ := ϕ ∧ ηP ∧ ψi We can define the following three fitness levels in order of increasing value: 1. Fi′ is not satisfiable. Then, the program P is incorrect (w.r.t. ψi ) for all possible inputs. 2. both Fi and Fi′ are satisfiable. There exists an input for which P satisfies ψi . 3. Fi is unsatisfiable. P is correct (for all inputs). As an example for using our basic method, we tried first to synthesize one of the simplest programs from [22], which is required to output 0 in the variable R if and only if its input X equals 2n − 1 for some non-negative n. The GP engine was allowed to generate straight line programs, using only assignment instructions, bit-vectors related operators (such as and, or and xor) constants (0 and 1), and variables. Within a few seconds, the following correct program was generated. T = X + 1 R = T and X Solutions found by the method described above are guaranteed to be correct for every possible input (in the domain of the variables, such as bit-vectors with a specific width). This is a major advantage over solutions generated by traditional GP, which can usually guarantee correctness only for the set of test cases. However, using test cases can help in building a smoother fitness function that can direct the generated programs into gradual improvements. Hence, we used for calculating the fitness function, in addition to the above satisfiability based levels, a collection of test cases that failed on previous selected candidates. Each test case is obtained using the SAT solver when checking satisfiability of Fi on a previous candidate program. It consists of initial values from which we can run new checked candidates. Note that running the code on test cases, using the runner module, is faster than applying SAT solving using prover module. After adding the ability to use test cases, we tried to synthesize a more advanced program that is required to compute the floor of the average of its inputs X and Y without overflowing (which may be G. Katz & D. Peled 83 R = X + Y R = R >> 1 T = X >> 1 R = Y >> 1 R = T + R (a) (b) R T T R = = = = X X T R and Y xor Y >> 1 + T (c) Figure 7: Synthesized Programs for Computing avg(X,Y) caused by simply summing the inputs before dividing by two). Figure 7 shows some of the programs generated during the synthesis process (the logical shift right operator is denoted by “>>”). Program (a) is the naive way for computing the average. However, the addition may cause an overflow, and indeed the program was refuted by the SMT solver, yielding a counterexample with big inputs. At the next iteration, program (b) was generated. While not overflowing, the program is still incorrect if both of its inputs are odd, which was reflected by a second counterexample. Finally, the more ingenious program (c) was generated, and verified to be a correct solution (identical to the one presented in [22]). 8 Conclusions We suggested the use of a methodology and a tool that perform synthesis of programs based on genetic programming guided by model checking. Code mutation is at the kernel of genetic programming (crossover is also extensively used, but we did not implement it). Our method can be used for • synthesizing correct-by-design programs, • finding errors in protocols with complicated architectures, • automatically correcting erroneous code with respect to a given specification, and • improving code, e.g., to perform more efficiently. We demonstrated our method on the classical mutual exclusion problem, and were able to find existing solutions, as well as new solutions. In general, the verification of parametric systems is undecidable, and in the few methods that promise termination, quite severe restrictions are required. The same apply to code synthesis. Nevertheless, we provide a co-evolution method for synthesizing parametric systems based on accumulating cases to be checked. Parameters or architectures on which the synthesis failed before, or test cases based on previous counterexamples are accumulated to be checked later with new candidate solutions. As the model checking itself is undecidable, we finish if we obtain a strong enough evidence that the solution is correct on the accumulated cases. We allowed constructing the architecture (processes and the channels between them) as part of the code that can be mutated. Then the genetic mutation operation can be used in finding architectures in which given algorithms fail. This can be used to model check code with varying architecture, and furthermore, to correct it. We started recently to look at replacing model checking by SAT and SMT tools. This provides an efficient alternative for some synthesis problem. In particular, SMT solvers may succeed in some parametric cases where model checking fails. Although our method does not guarantee termination, neither for finding the error, nor for finding a correct version of the algorithm, it is quite general and can be fine tuned through provided heuristics in a convenient human-assisted process of code correction. 84 Synthesis of Parametric Programs using Genetic Programming and Model Checking References [1] Krzysztof R. Apt & Dexter Kozen (1986): Limits for Automatic Verification of Finite-State Concurrent Systems. Inf. Process. Lett. 22(6), pp. 307–309, doi:10.1016/0020-0190(86)90071-2. [2] W. Banzhaf, P. Nordin, R. E. Keller & F. D. Francone (2001): Genetic Programming – An Introduction; On the Automatic Evolution of Computer Programs and its Applications (3rd edition). Morgan Kaufmann, dpunkt.verlag. [3] Yoah Bar-David & Gadi Taubenfeld (2003): Automatic discovery of mutual exclusion algorithms. In: PODC, p. 305, doi:10.1145/872035.872080. [4] James E. Burns & Nancy A. Lynch (1993): Bounds on Shared Memory for Mutual Exclusion. Information and Computation 107(2), pp. 171–184, doi:10.1006/inco.1993.1065. [5] Edsger W. Dijkstra (1965): Solution of a problem in concurrent programming control. Commun. ACM 8(9), p. 569, doi:10.1145/365559.365617. [6] E. Allen Emerson & Kedar S. Namjoshi (1995): Reasoning about Rings. In: POPL, pp. 85–94, doi:10.1145/199448.199468. [7] Sumit Gulwani, Susmit Jha, Ashish Tiwari & Ramarathnam Venkatesan (2011): Synthesis of loop-free programs. In: PLDI, pp. 62–73, doi:10.1145/1993498.1993506. [8] Gal Katz & Doron Peled (2008): Genetic Programming and Model Checking: Synthesizing New Mutual Exclusion Algorithms. In: ATVA, LNCS 5311, pp. 33–47, doi:10.1007/978-3-540-88387-6 5. [9] Gal Katz & Doron Peled (2008): Model Checking-Based Genetic Programming with an Application to Mutual Exclusion. In: TACAS, LNCS 4963, pp. 141–156, doi:10.1007/978-3-540-78800-3 11. [10] Gal Katz & Doron Peled (2009): Synthesizing Solutions to the Leader Election Problem using Model Checking and Genetic Programming. In: HVC, LNCS 6405, pp. 117–132, doi:10.1007/978-3-642-19237-1 13. [11] Gal Katz & Doron Peled (2010): Code Mutation in Verification and Automatic Code Correction. In: TACAS, LNCS, pp. 435–450, doi:10.1007/978-3-642-12002-2 36. [12] Gal Katz & Doron Peled (2010): MCGP: A Software Synthesis Tool Based on Model Checking and Genetic Programming. In: ATVA, pp. 359–364, doi:10.1007/978-3-642-15643-4 28. [13] Joep L. W. Kessels (1982): Arbitration Without Common Modifiable Variables. Acta Inf. 17, pp. 135–141, doi:10.1007/BF00288966. [14] Leonardo Mendon¸ca de Moura & Nikolaj Bjørner (2008): Z3: An Efficient SMT Solver. In: TACAS, pp. 337–340, doi:10.1007/978-3-540-78800-3 24. [15] Peter Niebert, Doron Peled & Amir Pnueli (2008): Discriminative Model Checking. In: CAV, LNCS 5123, Springer, pp. 504–516, doi:10.1007/978-3-540-70545-1 48. [16] Doron Peled (2001): Software Reliability Methods. Springer, doi:10.1007/978-1-4757-3540-6. [17] Jose Antonio Perez, Rafael Corchuelo & Miguel Toro (2004): An order-based algorithm for implementing multiparty synchronization. Concurrency - Practice and Experience 16(12), pp. 1173–1206, doi:10.1002/cpe.903. [18] Peterson & Fischer (1977): Economical Solutions to the Critical Section Problem in a Distributed System. In: STOC: ACM Symposium on Theory of Computing (STOC), pp. 91–97, doi:10.1145/800105.803398. [19] Amir Pnueli & Roni Rosner (1989): On the Synthesis of a Reactive Module. In: POPL, pp. 179–190, doi:10.1145/75277.75293. [20] Amir Pnueli & Roni Rosner (1990): Distributed Reactive Systems Are Hard to Synthesize. In: FOCS, pp. 746–757, doi:10.1109/FSCS.1990.89597. [21] Yih-Kuen Tsay (1998): Deriving a Scalable Algorithm for Mutual Exclusion. In: DISC, pp. 393–407, doi:10.1007/BFb0056497. [22] Henry S. Warren (2002): Hacker’s Delight. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.
9cs.NE
Published as a conference paper at ICLR 2018 S ENSITIVITY AND G ENERALIZATION IN N EURAL N ETWORKS : AN E MPIRICAL S TUDY Roman Novak, Yasaman Bahri∗, Daniel A. Abolafia, Jeffrey Pennington, Jascha Sohl-Dickstein Google Brain arXiv:1802.08760v1 [stat.ML] 23 Feb 2018 {romann, yasamanb, danabo, jpennin, jaschasd}@google.com A BSTRACT In practice it is often found that large over-parameterized neural networks generalize better than their smaller counterparts, an observation that appears to conflict with classical notions of function complexity, which typically favor smaller models. In this work, we investigate this tension between complexity and generalization through an extensive empirical exploration of two natural metrics of complexity related to sensitivity to input perturbations. Our experiments survey thousands of models with various fully-connected architectures, optimizers, and other hyper-parameters, as well as four different image classification datasets. We find that trained neural networks are more robust to input perturbations in the vicinity of the training data manifold, as measured by the norm of the input-output Jacobian of the network, and that it correlates well with generalization. We further establish that factors associated with poor generalization – such as full-batch training or using random labels – correspond to lower robustness, while factors associated with good generalization – such as data augmentation and ReLU non-linearities – give rise to more robust functions. Finally, we demonstrate how the input-output Jacobian norm can be predictive of generalization at the level of individual test points. 1 I NTRODUCTION The empirical success of deep learning has thus far eluded interpretation through existing lenses of computational complexity (Blum & Rivest, 1988), numerical optimization (Choromanska et al., 2015; Goodfellow & Vinyals, 2014; Dauphin et al., 2014) and classical statistical learning theory (Zhang et al., 2016): neural networks are highly non-convex models with extreme capacity that train fast and generalize well. In fact, not only do large networks demonstrate good test performance, but larger networks often generalize better, counter to what would be expected from classical measures, such as VC dimension. This phenomenon has been observed in targeted experiments (Neyshabur et al., 2015), historical trends of Deep Learning competitions (Canziani et al., 2016), and in the course of this work (Figure 1). This observation is at odds with Occam’s razor, the principle of parsimony, as applied to the intuitive notion of function complexity (see §A.2 for extended discussion). One resolution of the apparent contradiction is to examine complexity of functions in conjunction with the input domain. f (x) = x3 sin(x) may seem decisively more complex than g(x) = x. But restrained to a narrow input domain of [−0.01,  0.01] they appear differently: g remains a linear function of the input, while f (x) = O x4 resembles a constant 0. In this work we find that such intuition applies to neural networks, that behave very differently close to the data manifold than away from it (§4.1). We therefore analyze the complexity of models through their capacity to distinguish different inputs in the neighborhood of datapoints, or, in other words, their sensitivity. We study two simple metrics presented in §3 and find that one of them, the norm of the input-output Jacobian, correlates with generalization in a very wide variety of scenarios. ∗ Work done as a member of the Google Brain Residency program (g.co/brainresidency) 1 Generalization gap Published as a conference paper at ICLR 2018 0.8 0.8 0.6 0.6 0.4 100k 1M 10M 100M 0.4 1B Number of weights 1p 1n 1μ 0.001 Train loss Figure 1: 2160 networks trained to 100% training accuracy on CIFAR10 (see §A.5.5 for experimental details). Left: while increasing capacity of the model allows for overfitting (top), very few models do, and a model with the maximum parameter count yields the best generalization (bottom right). Right: train loss does not correlate well with generalization, and the best model (minimum along the y-axis) has training loss many orders of magnitude higher than models that generalize worse (left). This observation rules out underfitting as the reason for poor generalization in low-capacity models. See (Neyshabur et al., 2015) for similar findings in the case of achievable 0 training loss. This work considers sensitivity only in the context of image classification tasks. We interpret the observed correlation with generalization as an expression of a universal prior on (natural) image classification functions that favor robustness (see §A.2 for details). While we expect a similar prior to exist in many other perceptual settings, care should be taken when extrapolating our findings to tasks where such a prior may not be justified (e.g. weather forecasting). 1.1 PAPER O UTLINE We first define sensitivity metrics for fully-connected neural networks in §3. We then relate them to generalization through a sequence of experiments of increasing level of nuance: • In §4.1 we begin by comparing the sensitivity of trained neural networks on and off the training data manifold, i.e. in the regions of best and typical (over the whole input space) generalization. • In §4.2 we compare sensitivity of identical trained networks that differ in a single hyperparameter which is important for generalization. • Further, §4.3 associates sensitivity and generalization in an unrestricted manner, i.e. comparing networks of a wide variety of hyper-parameters such as width, depth, non-linearity, weight initialization, optimizer, learning rate and batch size. • Finally, §4.4 explores how predictive sensitivity (as measured by the Jacobian norm) is for individual test points. 1.2 S UMMARY OF C ONTRIBUTIONS The novelty of this work can be summarized as follows: • Study of the behavior of trained neural networks on and off the data manifold through sensitivity metrics (§4.1). • Evaluation of sensitivity metrics on trained neural networks in a very large-scale experimental setting and finding that they correlate with generalization (§4.2, §4.3, §4.4). §2 puts our work in context of related research studying complexity, generalization, or sensitivity metrics similar to ours. 2 Published as a conference paper at ICLR 2018 2 2.1 R ELATED W ORK C OMPLEXITY M ETRICS We analyze complexity of fully-connected neural networks for the purpose of model comparison through the following sensitivity measures (see §3 for details): • estimating the number of linear regions a network splits the input space into; • measuring the norm of the input-output Jacobian within such regions. A few prior works have examined measures related to the ones we consider. In particular, Pascanu et al. (2013); Montúfar et al. (2014); Raghu et al. (2016) have investigated the expressive power of fully-connected neural networks built out of piecewise-linear activation functions. Such functions are themselves piecewise-linear over their input domain, so that the number of linear regions into which input space is divided is one measure of how nonlinear the function is. A function with many linear regions has the capacity to build complex, flexible decision boundaries. It was argued in (Pascanu et al., 2013; Montúfar et al., 2014) that an upper bound to the number of linear regions scales exponentially with depth but polynomially in width, and a specific construction was examined. Raghu et al. (2016) derived a tight analytic bound and considered the number of linear regions for generic networks with random weights, as would be appropriate, for instance, at initialization. However, the evolution of this measure after training has not been investigated before. We examine a related measure, the number of hidden unit transitions along one-dimensional trajectories in input space, for trained networks. Further motivation for this measure is discussed in §3. Another perspective on function complexity can be gained by studying their robustness to perturbations to the input. Indeed, Rasmussen & Ghahramani (2000) demonstrate on a toy problem how complexity as measured by the number of parameters may be of limited utility for model selection, while measuring the output variation allows the invocation of Occam’s razor. In this work we apply related ideas to a large-scale practical context of neural networks with up to a billion free parameters (§4.2, §4.3) and discuss potential ways in which sensitivity permits the application of Occam’s razor to neural networks (§A.2). Sokolic et al. (2017) provide theoretical support for the relevance of robustness, as measured by the input-output Jacobian, to generalization. They derive bounds for the generalization gap in terms of the Jacobian norm within the framework of algorithmic robustness (Xu & Mannor, 2012). Our results provide empirical support for their conclusions through an extensive number of experiments. Several other recent papers have also focused on deriving tight generalization bounds for neural networks (Bartlett et al., 2017; Dziugaite & Roy, 2017; Neyshabur et al., 2018). We do not propose theoretical bounds in this paper but establish a correlation between our metrics and generalization in a substantially larger experimental setting than undertaken in prior works. 2.2 R EGULARIZATION In the context of regularization, increasing robustness to perturbations is a widely-used strategy: data augmentation, noise injection (Jiang et al., 2009), weight decay (Krogh & Hertz, 1992), and max-pooling all indirectly reduce sensitivity of the model to perturbations, while Rifai et al. (2011); Sokolic et al. (2017) explicitly penalize the Frobenius norm of the Jacobian in the training objective. In this work we relate several of the above mentioned regularizing techniques to sensitivity, demonstrating through extensive experiments that improved generalization is consistently coupled with better robustness as measured by a single metric, the input-output Jacobian norm (§4.2). While some of these findings confirm common-sense expectations (random labels increase sensitivity, Figure 4, top row), others challenge our intuition of what makes a neural network robust (ReLU-networks, with unbounded activations, tend to be more robust than saturating HardSigmoid-networks, Figure 4, third row). 2.3 I NDUCTIVE B IAS OF SGD One of our findings demonstrates an inductive bias towards robustness in stochastic mini-batch optimization compared to full-batch training (Figure 4, bottom row). Interpreting this regularizing effect 3 Published as a conference paper at ICLR 2018 in terms of some measure of sensitivity, such as curvature, is not new (Hochreiter & Schmidhuber, 1997; Keskar et al., 2016), yet we provide a novel perspective by relating it to reduced sensitivity to inputs instead of parameters. The inductive bias of SGD (“implicit regularization”) has been previously studied in (Neyshabur et al., 2015), where it was shown through rigorous experiments how increasing the width of a singlehidden-layer network improves generalization, and an analogy with matrix factorization was drawn to motivate constraining the norm of the weights instead of their count. Neyshabur et al. (2017) further explored several weight-norm based measures of complexity that do not scale with the size of the model. One of our measures, the Frobenius norm of the Jacobian is of similar nature (since the Jacobian matrix size is determined by the task and not by a particular network architecture). However, this particular metric was not considered, and, to the best of our knowledge, we are the first to evaluate it in a large-scale setting (e.g. our networks are up to 65 layers deep and up to 216 units wide). 2.4 A DVERSARIAL E XAMPLES Sensitivity to inputs has attracted a lot of interest in the context of adversarial examples (Szegedy et al., 2013). Several attacks locate points of poor generalization in the directions of high sensitivity of the network (Goodfellow et al., 2014; Papernot et al., 2016; Moosavi-Dezfooli et al., 2016), while certain defences regularize the model by penalizing sensitivity (Gu & Rigazio, 2014) or employing decaying (hence more robust) non-linearities (Kurakin et al., 2016). However, work on adversarial examples relates highly specific perturbations to a similarly specific kind of generalization (i.e. performance on a very small, adversarial subset of the data manifold), while this paper analyzes average-case sensitivity (§3) and typical generalization. 3 S ENSITIVITY M ETRICS We propose two simple measures of sensitivity for a fully-connected neural network (without biases) f : Rd → Rn with respect to its input x ∈ Rd (the output being unnormalized logits of the n classes). Assume f employs a piecewise-linear activation function, like ReLU. Then f itself, as a composition of linear and piecewise-linear functions, is a piecewise-linear map, splitting the input space Rd into disjoint regions, implementing a single affine mapping on each. Then we can measure two aspects of sensitivity by answering 1. How does the output of the network change as the input is perturbed within the linear region? 2. How likely is the linear region to change in response to change in the input? We quantify these qualities as follows: 1. For a local sensitivity measure we adopt the Frobenius norm of the class probabilities Jacobian J(x) = ∂fσ (x) /∂xT (with Jij (x) = ∂ [fσ (x)]i /∂xj ), where fσ = σ ◦ f with σ being the softmax function1 . Given points of interest xtest , we estimate the sensitivity of the function in those regions with the average Jacobian norm: Extest [kJ (xtest )kF ] , that we will further refer to as simply “Jacobian norm”. Note that this does not require the labels for xtest . qP 2 Interpretation. The Frobenius norm kJ(x)kF = ij Jij (x) estimates the averagecase sensitivity of fσ around x. Indeed, consider an infinitesimal Gaussian perturbation  The norm of the Jacobian with respect to logits ∂f (x) /∂xT experimentally turned out less predictive of test performance (not shown). See §A.3 for discussion of why the softmax Jacobian is related to generalization. 1 4 Published as a conference paper at ICLR 2018 ∆x ∼ N (0, I): the expected magnitude of the output change is then h i h i hXX 2 i 2 2 E∆x kfσ (x) − fσ (x + ∆x)k2 ≈ E∆x kJ(x)∆xk2 = E∆x Jij xj i = X Jij Jij 0 E∆x [xj xj 0 ] = X ijj 0 = j 2 Jij E∆x  2 xj ij 2  kJ (x)kF . 2. To detect a change in linear region (further called a “transition”), we need to be able to identify it. We do this analogously to Raghu et al. (2016). For a network with piecewiselinear activations, we can, given an input x, assign a code to each neuron in the network f , that identifies the linear region of the pre-activation of that neuron. E.g. each ReLU unit will have 0 or 1 assigned to it if the pre-activation value is less or greater than 0 respectively. Similarly, a ReLU6 unit (see definition in §A.4) will have a code of 0, 1, or 2 assigned, since it has 3 linear regions2 . Then, a concatenation of codes of all neurons in the network (denoted by c(x)) uniquely identifies the linear region of the input x (see §A.1.1 for discussion of edge cases). Given this encoding scheme, we can detect a transition by detecting a change in the code. We then sample k equidistant points z0 , . . . , zk−1 on a closed one-dimensional trajectory T (x) (generated from a data point x and lying close to the data manifold; see below for details) and count transitions t(x) along it to quantify the number of linear regions: t(x) := k−1 X i=0 c (zi ) − c z(i+1)%k  1 ≈ I z∈T (x) ∂c(z) ∂ (dz) dz, (1) 1 where the norm of the directional derivative k∂c(z)/∂ (dz)k1 amounts to a Dirac delta function at each transition (see §A.1.2 for further details). By sampling multiple such trajectories around different points, we estimate the sensitivity metric: Extest [t (xtest )] , that we will further refer to as simply “transitions” or “number of transitions.” To assure the sampling trajectory T (xtest ) is close to the data manifold (since this is the region of interest), we construct it through horizontal translations of the image xtest in pixel space (Figure App.7, right). We similarly augment our training data with horizontal and vertical translations in the corresponding experiments (Figure 4, second row). As earlier, this metric does not require knowing the label of xtest . Interpretation. We can draw a qualitative parallel between the number of transitions and curvature of the function. One measure of curvature of a function f is the total norm of the directional derivative of its first derivative f 0 along a path: I ∂f 0 (z) C (f , T (x)) := dz. z∈T (x) ∂ (dz) F A piecewise-linear function f has a constant first derivative f 0 everywhere except for the transition boundaries. Therefore, for a sufficiently large k, curvature can be expressed as k−1 C (f , T (x)) =  1X 0 f (zi ) − f 0 z(i+1)%k 2 i=0 F , where z0 , . . . , zk−1 are equidistant samples on T (x). This sum is similar to t(x) as defined in Equation 1, but quantifies the amount of change in between two linear regions in a nonbinary way. However, estimating it on a densely sampled trajectory is a computationallyintensive task, which is one reason we instead count transitions. 2 For a non-piecewise-linear activation like Tanh, we consider 0 as the boundary of two regions and find this metric qualitatively similar to counting transitions of a piecewise-linear non-linearity. 5 Published as a conference paper at ICLR 2018 As such, on a qualitative level, the two metrics (Jacobian norm and number of transitions) track the first and second order terms of the Taylor expansion of the function. Above we have defined two sensitivity metrics to describe the learned function around the data, on average. In §4.1 we analyze these measures on and off the data manifold by simply measuring them along circular trajectories in input space that intersect the data manifold at certain points, but generally lie away from it (Figure 2, left). 4 E XPERIMENTAL R ESULTS In the following subsections (§4.2, §4.3) each study analyzes performance of a large number (usually thousands) of fully-connected neural networks having different hyper-parameters and optimization procedures. Except where specified, we include only models which achieve 100% training accuracy. This allows us to study generalization disentangled from properties like expressivity and trainability, which are outside the scope of this work. In order to efficiently evaluate the compute-intensive metrics (§3) in a very wide range of hyperparameters settings (see e.g. §A.5.5) we only consider fully-connected networks. Extending the investigation to more complex architectures is left for future work. 4.1 S ENSITIVITY O N AND O FF THE T RAINING DATA M ANIFOLD We analyze the behavior of a trained neural network near and away from training data. We do this by comparing sensitivity of the function along 3 types of trajectories: 1. A random ellipse. This trajectory is extremely unlikely to pass anywhere near the real data, and indicates how the function behaves in random locations of the input space that it never encountered during training. 2. An ellipse passing through three training points of different class (Figure 2, left). This trajectory does pass through the three data points, but in between it traverses images that are linear combinations of different-class images, and are expected to lie outside of the natural image space. Sensitivity of the function along this trajectory allows comparison of its behavior on and off the data manifold, as it approaches and moves away from the three anchor points. 3. An ellipse through three training points of the same class. This trajectory is similar to the previous one, but, given the dataset used in the experiment (MNIST), is expected to traverse overall closer to the data manifold, since linear combinations of the same digit are more likely to resemble a realistic image. Comparing transition density along this trajectory to the one through points of different classes allows further assessment of how sensitivity changes in response to approaching the data manifold. We find that, according to both the Jacobian norm and transitions metrics, functions exhibit much more robust behavior around the training data (Figure 2, center and right). We further visualize this effect in 2D in Figure 3, where we plot the transition boundaries of the last (pre-logit) layer of a neural network before and after training. After training we observe that training points lie in regions of low transition density. The observed contrast between the neural network behavior near and away from data further strengthens the empirical connection we draw between sensitivity and generalization in §4.2, §4.3 and §4.4; it also confirms that, as mentioned in §1, if a certain quality of a function is to be used for model comparison, input domain should always be accounted for. 4.2 S ENSITIVITY AND G ENERALIZATION FACTORS In §4.1 we established that neural networks implement more robust functions in the vicinity of the training data manifold than away from it. We now consider the more practical context of model selection. Given two perfectly trained neural networks, does the model with better generalization implement a less sensitive function? 6 Published as a conference paper at ICLR 2018 Trajectory Mean Jacobian norm Transition density along... along... a random ellipse an ellipse through 3 training points of a different class an ellipse through 3 training points of the same class a random ellipse an ellipse through 3 training points of a different class an ellipse through 3 training points of the same class ⇡/3 (point 1) 1 180 160 140 120 100 80 0.01 60 10k 100 ⇡ (point 2) 5⇡/3 (point 3) 100 π/3 (point 1) π (point 2) 5π/3 (point 3) 40 π/3 (point 1) π (point 2) 5π/3 (point 3) Figure 2: A 100%-accurate (on training data) MNIST network implements a function that is much more stable near training data than away from it. Left: depiction of a hypothetical circular trajectory in input space passing through three digits of different classes, highlighting the training point locations (π/3, π, 5π/3). Center: Jacobian norm as the input traverses an elliptical trajectory. Sensitivity drops significantly in the vicinity of training data while remaining uniform along random ellipses. Right: transition density behaves analogously. According to both metrics, as the input moves between points of different classes, the function becomes less stable than when it moves between points of the same class. This is consistent with the intuition that linear combinations of different digits lie further from the data manifold than those of same-class digits (which need not hold for more complex datasets). See §A.5.2 for experimental details. Before Training After Training Figure 3: Transition boundaries of the last (pre-logits) layer over a 2-dimensional slice through the input space defined by 3 training points (indicated by inset squares). Left: boundaries before training. Right: after training, transition boundaries become highly non-isotropic, with training points lying in regions of lower transition density. See §A.5.3 for experimental details. We study approaches in the machine learning community that are commonly believed to influence generalization (Figure 4, top to bottom): • • • • random labels; data augmentation; ReLUs; full-batch training. We find that in each case, the change in generalization is coupled with the respective change in sensitivity (i.e. lower sensitivity corresponds to smaller generalization gap) as measured by the Jacobian norm (and almost always for the transitions metric). 7 Published as a conference paper at ICLR 2018 Generalization Gap Generalization gap Jacobian norm Jacobian norm Transitions Transitions 1 0.8 0.6 1M w/ random labels w/ random labels w/ random labels 10k 1000 100 10 0.6 0.8 1 1 10 w/ true labels 100 1000 10k 1000 Jacobian norm 0.4 0.2 Transitions 100 10 1 0.1 0.1 0.6 1 w/ data augmentation 10 100 100k 10k 1000 1000 1000 w/ data augmentation Generalization gap 10k 100k 1M w/ data augmentation Jacobian norm Transitions 2 0.8 1M 1M w/o data augmentation w/o data augmentation w/o data augmentation 0.6 100k w/ true labels 1000 0.4 10k w/ true labels Generalization gap 0.2 10k 1000 1 0.4 0.4 100k 1M 0.7 0.6 HardSigmoid HardSigmoid HardSigmoid 10 5 2 1000 5 0.5 0.6 0.7 0.8 1 5 ReLU 2 10 5 1000 2 ReLU Generalization gap 10k 100k 1M ReLU Jacobian norm Transitions 1M 100 0.8 5 0.6 100k 2 L-BFGS L-BFGS L-BFGS 10k 1 0.5 0.4 0.4 100k 10 5 10k 2 1 1000 5 0.4 0.4 0.6 SGD + Momentum 0.8 5 1 2 5 10 2 SGD + Momentum 5 100 1000 10k 100k 1M SGD + Momentum Figure 4: Improvement in generalization (left column) due to using correct labels, data augmentation, ReLUs, mini-batch optimization (top to bottom) is consistently coupled with reduced sensitivity as measured by the Jacobian norm (center column). Transitions (right column) correlate with generalization in all considered scenarios except for comparing optimizers (bottom right). Each point on the plot corresponds to two neural networks that share all hyper-parameters and the same optimization procedure, but differ in a certain property as indicated by axes titles. The coordinates along each axis reflect the values of the quantity in the title of the plot in the respective setting (i.e. with true or random labels). All networks have reached 100% training accuracy on CIFAR10 in both settings (except for the data-augmentation study, second row; see §A.5.4 for details). See §A.5.5 for experimental details (§A.5.4 for the data-augmentation study) and §4.2.1 for plot interpretation. 8 Published as a conference paper at ICLR 2018 4.2.1 H OW TO R EAD P LOTS In Figure 4, for many possible hyper-parameter configurations, we train two models that share all parameters and optimization procedure, but differ in a single binary setting (i.e. trained on true or random labels; with or without data augmentation; etc). Out of all such network pairs, we select only those where each network reached 100% training accuracy on the whole training set (apart from the data augmentation study). The two generalization or sensitivity values are then used as the x and y coordinates of a point corresponding to this pair of networks (with the plot axes labels denoting the respective value of the binary parameter considered). The position of the point with respect to the diagonal y = x visually demonstrates which configuration has smaller generalization gap / lower sensitivity. 4.3 S ENSITIVITY AND G ENERALIZATION G AP We now perform a large-scale experiment to establish direct relationships between sensitivity and generalization in a realistic setting. In contrast to §4.1, where we selected locations in the input space, and §4.2, where we varied a single binary parameter impacting generalization, we now sweep simultaneously over many different architectural and optimization choices (§A.5.5). Our main result is presented in Figure 5, indicating a strong relationship between the Jacobian norm and generalization. In contrast, Figure App.8 demonstrates that the number of transitions is not alone sufficient to compare networks of different sizes, as the number of neurons in the networks has a strong influence on transition count. Generalization gap CIFAR10 CIFAR100 1 0.9 0.95 0.8 0.9 0.7 0.85 0.6 0.8 0.5 0.75 0.7 1 100 10k 1 Generalization gap MNIST 100 10k FASHION_MNIST 0.035 0.12 0.03 0.025 0.1 0.02 5 0.1 2 5 1 2 1 5 2 5 10 2 Jacobian norm Figure 5: Jacobian norm correlates with generalization gap on all considered datasets. Each point corresponds to a network trained to 100% training accuracy (or at least 99.9% in the case of CIFAR100). See §A.5.4 and §A.5.5 for experimental details of bottom and top plots respectively. 9 Published as a conference paper at ICLR 2018 4.4 S ENSITIVITY AND P ER -P OINT G ENERALIZATION In §4.3 we established a correlation between sensitivity (as measured by the Jacobian norm) and generalization averaged over a large test set (104 points). We now investigate whether the Jacobian norm can be predictive of generalization at individual points. As demonstrated in Figure 6 (top), Jacobian norm at a point is predictive of the cross-entropy loss, but the relationship is not a linear one, and not even bijective (see §A.3 for analytic expressions explaining it). In particular, certain misclassified points (right sides of the plots) have a Jacobian norm many orders of magnitude smaller than that of the correctly classified points (left sides). However, we do remark a consistent tendency for points having the highest values of the Jacobian norm to be mostly misclassified. A similar yet noisier trend is observed in networks trained using `2 -loss as depicted in Figure 6 (bottom). These observations make the Jacobian norm a promising quantity to consider in the contexts of active learning and confidence estimation in future research. Jacobian norm MNIST CIFAR10 1 1 100μ 100μ 10n 10n 1p 1p 100e−18 100e−18 10e−21 10n 1μ 100μ 0.01 1 10 100μ 0.01 1 100 CIFAR10 10 1 1 0.1 0.1 0.01 0.01 0.001 0.001 100μ 10μ 1μ Cross-entropy loss MNIST Jacobian norm 10e−21 10n 100 100μ 100p 10n 1μ 100μ 0.01 10μ 1 100p 10n 1μ 100μ 0.01 1 `2 -loss Figure 6: Jacobian norm plotted against individual test point loss. Each plot shows 5 random networks that fit the respective training set with 100% accuracy, with each network having a unique color. Top: Jacobian norm plotted against cross-entropy loss. These plots experimentally confirm the relationship established in §A.3 and Figure App.11. Bottom: Jacobian norm plotted against `2 -loss, for networks trained on `2 -loss, exhibits a similar behavior. See §A.5.6 for experimental details and Figure App.9 for similar observations on other datasets. 5 C ONCLUSION We have investigated sensitivity of trained neural networks through the input-output Jacobian norm and linear regions counting in the context of image classification tasks. We have presented extensive experimental evidence indicating that the local geometry of the trained function as captured by the input-output Jacobian can be predictive of generalization in many different contexts, and that it varies drastically depending on how close to the training data manifold the function is evaluated. We further established a connection between the cross-entropy loss and the Jacobian norm, indicating that it can remain informative of generalization even at the level of individual test points. Interesting directions for future work include extending our investigation to more complex architectures and other machine learning tasks. 10 Published as a conference paper at ICLR 2018 R EFERENCES Martı́n Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, et al. Tensorflow: Large-scale machine learning on heterogeneous distributed systems. arXiv preprint arXiv:1603.04467, 2016. Peter L Bartlett, Dylan J Foster, and Matus J Telgarsky. Spectrally-normalized margin bounds for neural networks. In Advances in Neural Information Processing Systems, pp. 6241–6250, 2017. Avrim Blum and Ronald L. Rivest. Training a 3-node neural network is np-complete. In Machine Learning: From Theory to Applications, 1988. Alfredo Canziani, Adam Paszke, and Eugenio Culurciello. An analysis of deep neural network models for practical applications. CoRR, abs/1605.07678, 2016. Anna Choromanska, Mikael Henaff, Michael Mathieu, Gérard Ben Arous, and Yann LeCun. The loss surfaces of multilayer networks. In Artificial Intelligence and Statistics, pp. 192–204, 2015. Yann Dauphin, Razvan Pascanu, aglar Gülehre, Kyunghyun Cho, Surya Ganguli, and Yoshua Bengio. Identifying and attacking the saddle point problem in high-dimensional non-convex optimization. In NIPS, 2014. Gintare Karolina Dziugaite and Daniel M Roy. Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. arXiv preprint arXiv:1703.11008, 2017. Daniel Golovin, Benjamin Solnik, Subhodeep Moitra, Greg Kochanski, John Karro, and D Sculley. Google vizier: A service for black-box optimization. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 1487–1495. ACM, 2017. Ian J. Goodfellow and Oriol Vinyals. Qualitatively characterizing neural network optimization problems. CoRR, abs/1412.6544, 2014. Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014. Shixiang Gu and Luca Rigazio. Towards deep neural network architectures robust to adversarial examples. arXiv preprint arXiv:1412.5068, 2014. Caglar Gulcehre, Marcin Moczulski, Misha Denil, and Yoshua Bengio. Noisy activation functions. In International Conference on Machine Learning, pp. 3059–3068, 2016. Geoffrey Hinton, Nitish Srivastava, and Kevin Swersky. Neural networks for machine learninglecture 6a-overview of mini-batch gradient descent, 2012. Sepp Hochreiter and Jürgen Schmidhuber. Flat minima. Neural Computation, 9(1):1–42, 1997. William H Jefferys and James O Berger. Ockham’s razor and bayesian analysis. American Scientist, 80(1):64–72, 1992. Yulei Jiang, Richard M Zur, Lorenzo L Pesce, and Karen Drukker. A study of the effect of noise injection on the training of artificial neural networks. In Neural Networks, 2009. IJCNN 2009. International Joint Conference on, pp. 1428–1432. IEEE, 2009. Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter Tang. On large-batch training for deep learning: Generalization gap and sharp minima. arXiv preprint arXiv:1609.04836, 2016. Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. Alex Krizhevsky. Convolutional deep belief networks on cifar-10. 2010. 11 Published as a conference paper at ICLR 2018 Anders Krogh and John A Hertz. A simple weight decay can improve generalization. In Advances in neural information processing systems, pp. 950–957, 1992. Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. arXiv preprint arXiv:1611.01236, 2016. Jaehoon Lee, Yasaman Bahri, Roman Novak, Sam Schoenholz, Jeffrey Pennington, and Jascha Sohldickstein. Deep neural networks as gaussian processes. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id=B1EA-M-0Z. David JC MacKay. Bayesian interpolation. 1991. David JC MacKay. A practical bayesian framework for backpropagation networks. Neural computation, 4(3):448–472, 1992. G. Montúfar, R. Pascanu, K. Cho, and Y. Bengio. On the Number of Linear Regions of Deep Neural Networks. Neural Information Processing Systems, February 2014. Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, Omar Fawzi, and Pascal Frossard. Universal adversarial perturbations. arXiv preprint arXiv:1610.08401, 2016. Iain Murray and Zoubin Ghahramani. A note on the evidence and bayesian occam’s razor, 2005. Vinod Nair and Geoffrey E Hinton. Rectified linear units improve restricted boltzmann machines. In Proceedings of the 27th international conference on machine learning (ICML-10), pp. 807–814, 2010. Radford M. Neal. Priors for infinite networks (tech. rep. no. crg-tr-94-1). University of Toronto, 1994. Behnam Neyshabur, Ryota Tomioka, and Nathan Srebro. In search of the real inductive bias: On the role of implicit regularization in deep learning. Proceeding of the international Conference on Learning Representations workshop track, abs/1412.6614, 2015. Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nathan Srebro. Exploring generalization in deep learning. CoRR, abs/1706.08947, 2017. Behnam Neyshabur, Srinadh Bhojanapalli, and Nathan Srebro. A PAC-bayesian approach to spectrally-normalized margin bounds for neural networks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id=Skz_WfbCZ. Nicolas Papernot, Patrick McDaniel, Somesh Jha, Matt Fredrikson, Z Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. In Security and Privacy (EuroS&P), 2016 IEEE European Symposium on, pp. 372–387. IEEE, 2016. R. Pascanu, G. Montufar, and Y. Bengio. On the number of response regions of deep feed forward networks with piece-wise linear activations. International Conference on Learning Representations, December 2013. B. Poole, S. Lahiri, M. Raghu, J. Sohl-Dickstein, and S. Ganguli. Exponential expressivity in deep neural networks through transient chaos. Neural Information Processing Systems, June 2016. M. Raghu, B. Poole, J. Kleinberg, S. Ganguli, and J. Sohl-Dickstein. On the Expressive Power of Deep Neural Networks. International Conference on Machine Learning, June 2016. Carl E. Rasmussen and Zoubin Ghahramani. Occam’s razor. In NIPS, 2000. Salah Rifai, Pascal Vincent, Xavier Muller, Xavier Glorot, and Yoshua Bengio. Contractive autoencoders: Explicit invariance during feature extraction. In Proceedings of the 28th international conference on machine learning (ICML-11), pp. 833–840, 2011. David E Rumelhart, Geoffrey E Hinton, Ronald J Williams, et al. Learning representations by back-propagating errors. Cognitive modeling, 5(3):1, 1988. 12 Published as a conference paper at ICLR 2018 Jure Sokolic, Raja Giryes, Guillermo Sapiro, and Miguel RD Rodrigues. Robust large margin deep neural networks. IEEE Transactions on Signal Processing, 2017. Ercan Solak, Roderick Murray-Smith, William E Leithead, Douglas J Leith, and Carl E Rasmussen. Derivative observations in gaussian process models of dynamic systems. In Advances in neural information processing systems, pp. 1057–1064, 2003. Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013. Matus Telgarsky. Representation benefits of deep feedforward networks. CoRR, abs/1509.08101, 2015. Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017. Huan Xu and Shie Mannor. Robustness and generalization. Machine learning, 86(3):391–423, 2012. C. Zhang, S. Bengio, M. Hardt, B. Recht, and O. Vinyals. Understanding deep learning requires rethinking generalization. International Conference on Learning Representations, November 2016. A A PPENDIX A.1 A.1.1 T RANSITION M ETRIC D ETAILS L INEAR R EGION E NCODING The way of encoding a linear region c (z) of a point z described in §3 (2) guarantees that different regions obtain different codes, but different codes might be assigned to the same region if all the neurons in any layer of the network are saturated (or if weights leading from the transitioning unit to active units are exactly zero, or exactly cancel). However, the probability of such an arrangement drops exponentially with width and hence is ignored in this work. A.1.2 T RANSITION C OUNTING The equality between the discrete and continuous versions of t (x) in Equation 1 becomes exact with a high-enough sampling density k such that there are no narrow linear regions missed in between consecutive points (precisely, the encoding c (z) has to only change at most once on the line between two consecutive points zi and zi+1 ). For computational efficiency we also assume that no two neurons transitions simultaneously, which is extremely unlikely in the context of random initialization and stochastic optimization. Figure App.7: Depiction of a trajectory in input space used to count transitions as defined in §3 (2). An interpolation between 28 horizontal translations of a single digit results in a complex trajectory that constrains all points to lie close to the translation-augmented data, and allows for a tractable estimate of transition density around the data manifold. This metric is used to compare models in §4.2 and §4.3. Straight lines indicate boundaries between different linear regions (straight-line boundaries between linear regions is accurate for the case of a single-layer piecewise-linear network. The partition into linear regions is more complex for deeper networks (Raghu et al., 2016)). 13 Published as a conference paper at ICLR 2018 Generalization gap CIFAR10 CIFAR100 1 1 0.8 0.8 0.6 0.6 0.4 1000 10k 100k 0.4 1M 1000 10k 100k 1M Transitions Figure App.8: Number of transitions, in contrast to Figure 5, does not generally correlate with generalization gap. Left: 2160 networks with 100% train accuracy on CIFAR10. Right: 2097 networks with at least 99.9% training accuracy on CIFAR100. See §A.5.5 for experimental details. FASHION_MNIST CIFAR100 1000 1 Jacobian norm Jacobian norm 1000 0.001 1μ 1n 1p 1f 1e−18 1 0.001 1μ 1n 1p 1f 1e−18 10n 1μ 100μ 0.01 1 100 10n 1μ 100μ 0.01 1 100 Cross-entropy loss 100 100 5 5 2 2 10 5 Jacobian norm Jacobian norm 10 2 1 5 2 0.1 5 2 0.01 5 2 0.001 5 2 100μ 5 2 5 2 0.1 5 2 0.01 5 2 0.001 5 2 100μ 5 2 10μ 5 1 2 100p 10n 1μ 100μ 0.01 10μ 1 100p 10n 1μ 100μ 0.01 1 `2 -loss Figure App.9: Jacobian norm plotted against individual test point loss on Fashion-MNIST (Xiao et al., 2017) and CIFAR100. As in Figure 6, each plot shows 5 random networks that fit the respective training set to a 100% with each network having a unique color. See §A.5.6 for experimental details. 14 Published as a conference paper at ICLR 2018 A.2 D O NEURAL NETWORKS DEFY O CCAM ’ S RAZOR ? Here we briefly discuss the motivation of this work in the context of Occam’s razor. Occam’s razor is a heuristic for model comparison based on their complexity. Given a dataset D, Occam’s razor gives preference to simpler models H. In the Bayesian interpretation of the heuristic (Jefferys & Berger, 1992) simplicity is defined as evidence P [D|H] and is often computed using the Laplace approximation. Under further assumptions (MacKay, 1991), this evidence can be shown to be inversely proportional to the number of parameters in the model. Therefore, given a uniform prior P [H] on two competing hypothesis classes, the class posterior P [H|D] ∼ P [D|H] P [H] is higher for a model with fewer parameters. An alternative, qualitative justification of the heuristic is through considering the evidence as a normalized probability distribution over the whole dataset space: Z D0 P [D0 |H] dD0 = 1 and remarking that models with more parameters have to spread the probability mass more evenly across all the datasets by virtue of being able to fit more of them (Figure App.10, left). This similarly suggests (under a uniform prior on competing hypothesis classes) preferring models with fewer parameters, assuming that evidence is unimodal and peaks close to the dataset of interest. Occam’s razor for neural networks. As seen in Figure 1, the above reasoning does not apply to neural networks: the best achieved generalization is obtained by a model that has around 104 times as many parameters as the simplest model capable of fitting the dataset (within the evaluated search space). On one hand, Murray & Ghahramani (2005); Telgarsky (2015) demonstrate on concrete examples that a high number of free parameters in the model doesn’t necessarily entail high complexity. On the other hand, a large body of work on the expressivity of neural networks (Pascanu et al., 2013; Montúfar et al., 2014; Raghu et al., 2016; Poole et al., 2016) shows that their ability to compute complex functions increases rapidly with size, while Zhang et al. (2016) validates that they also easily fit complex (even random) functions with stochastic optimization. Classical metrics like VC dimension or Rademacher complexity increase with size of the network as well. This indicates that weights of a neural network may actually correspond to its usable capacity, and hence “smear” the evidence P [D|H] along a very large space of datasets D0 , making the dataset of interest D less likely. Potential issues. We conjecture the Laplace approximation of the evidence P [D|H] and the simplified estimation of the “Occam’s factor” in terms of the accessible volume of the parameter space might not hold for neural networks in the context of stochastic optimization, and, in particular, do not account for the combinatorial growth of the accessible volume of parameter space as width increases (MacKay, 1992). Similarly, when comparing evidence as probability distributions over datasets, the difference between two neural networks may not be as drastic as in Figure App.10 (left), but more nuanced as depicted in Figure App.10 (right), with the evidence ratio being highly dependent on the particular dataset. We interpret our work as defining hypothesis classes based on sensitivity of the hypothesis (which yielded promising results in (Rasmussen & Ghahramani, 2000) on a toy task) and observing a strongly non-uniform prior on these classes that enables model comparison. Indeed, at least in the context of natural images classification, putting a prior on the number of parameters or Kolmogorov complexity of the hypothesis is extremely difficult. However, a statement that the true classification function is robust to small perturbations in the input is much easier to justify. As such, a prior P [H] in favor of robustness over sensitivity might fare better than a prior on specific network hyper-parameters. Above is one way to interpret the correlation between sensitivity and generalization that we observe in this work. It does not explain why large networks tend to converge to less sensitive functions. We conjecture large networks to have access to a larger space of robust solutions due to solving a highly-underdetermined system when fitting a dataset, while small models converge to more extreme weight values due to being overconstrained by the data. However, further investigation is needed to confirm this hypothesis. 15 Published as a conference paper at ICLR 2018 Expectation Reality? P [D0 |H] P [D0 |H] Small Hs Small Hs Large Hl Zeros D Noise D0 Zeros ? D Large Hl Noise D0 Figure App.10: Occam’s razor: simplified expectation vs hypothesized reality. All datasets D0 with input and target dimensions matching those of a particular dataset D are sorted according to the evidence P [D0 |H] of a large model Hl from left to right along the horizontal axis. Left: a classic simplified depiction of Bayesian Occam’s razor. Evidence P [D0 |H] of a small model Hs with few parameters has narrow support in the dataset space and is more peaked. If the model fits the dataset D well, it falls close to the peak and outperforms a larger model Hl with more parameters, having wider support. Right: suggested potential reality of neural networks. Evidence of the small model Hs peaks higher, but the large model Hl might nonetheless concentrate the majority of probability mass on simple functions and the evidence curves might intersect at a small angle. In this case, while a dataset D lying close to the intersection can be fit by both models, the Bayesian evidence ratio depends on its exact position with respect to the intersection. A.3 B OUNDING THE JACOBIAN N ORM Here we analyze the relationship between the Jacobian norm and the cross-entropy loss at individual test points as studied in §4.4. Target class Jacobian. We begin by relating the derivative of the target class probability Jy(x) to per-point cross-entropy loss l(x) = − log [fσ (x)]y(x) (where y(x) is the correct integer class). We will denote fσ (x) by σ and drop the x argument to de-clutter notation (i.e. write f instead of f (x)). Then the Jacobian can be expressed as   h   i ∂f T T T J = σ1 I − σ1 , ∂xT where is the Hadamard element-wise product. Then indexing both sides of the equation at the correct class y yields    ∂f T , Jy = σy (ey − σ) ∂xT where ey is a vector of zeros everywhere except for ey = 1. Taking the norm of both sides results in   2 X 2  d n  X ∂f ∂f y j 2 (1 − σy )2  + σj (2) kJy k2 = σy2 ∂xk ∂xk k=1 j6=y   2 X 2 d  n d  X X ∂f ∂f y j  = σy2 (1 − σy )2 + σj2 (3) ∂xk ∂xk j6=y k=1 k=1   n 2 2 X ∂f ∂f y j  = σy2 (1 − σy )2 + σj2 (4) ∂xT 2 ∂xT 2 j6=y 16 Published as a conference paper at ICLR 2018 We now assume that magnitudes of the individual logit derivatives vary little in between logits and over the input space3 : 2 2 ∂fi 1 ∂f , ≈ E x ∂xT 2 n test ∂xTtest F which simplifies Equation 4 to   n X 2 kJy k2 ≈ M σy2 (1 − σy )2 + σj2  , j6=y where M = Extest ∂f /∂xTtest tions we can bound: 2 F /n. Since σ lies on the (n − 1)-simplex ∆n−1 , under these assumpn X (1 − σy )2 6 σj2 6 (1 − σy )2 , n−1 j6=y and finally n 2 2 2 M σy2 (1 − σy ) / kJy k2 / 2M σy2 (1 − σy ) , n−1 or, in terms of the cross-entropy loss l = − log σy : r √   nM −l e 1 − e−l / kJy k2 / 2M e−l 1 − e−l . n−1 (5) We validate these approximate bounds in Figure App.11 (top). Full Jacobian. Equation 5 establishes a close relationship between Jy and loss l = − log σy , but of course, at test time we do not know the target class y. This allows us to only bound the full Jacobian norm from below: r  nM −l e 1 − e−l / kJy k2 6 kJkF . (6) n−1 For the upper bound, we assume the maximum-entropy case of σy : σi ≈ (1 − σy )/(n − 1), for i 6= y. The Jacobian norm is 2 kJkF = n X i=1 2 2 kJi k2 = kJy k2 + where the first summand becomes: " 2 kJy k2 2 ≈ M σy2 (1 − σy ) + (n − 1)  1 − σy n−1 n X i6=y 2 kJi k2 , 2 # = Mn 2 2 σ (1 − σy ) , n−1 y and each of the others 2 kJi k2  ≈M = 1 − σy n−1 2 "  1 − σy 1− n−1 2 + 2 M 2 (1 − σy ) nσy2 + n − 2 . 3 (n − 1) σy2  + (n − 2) 1 − σy n−1 2 !# 2 Adding n − 1 of such summands to kJy k2 results in √ √ q p M M kJkF ≈ (1 − σy ) n2 σy2 + n − 2 = 1 − e−l n2 e−2l + n − 2, (n − 1) (n − 1) (7) compared against the lower bound (Equation 6) and experimental data in Figure App.11. 3 In the limit of infinite width, and fully Bayesian training, deep network logits are distributed exactly according to a Gaussian process (Neal, 1994; Lee et al., 2018). Similarly, each entry in the logit Jacobian also corresponds to an independent draw from a Gaussian process (Solak et al., 2003). It is therefore plausible that the Jacobian norm, consisting of a sum over the square of independent Gaussian samples in the correct limits, will tend towards a constant. 17 Jacobian norm (correct class) Published as a conference paper at ICLR 2018 CIFAR10 1 0.001 1μ 1n 1p 1f 1e−18 1e−21 100n 1μ 10μ 100μ 0.001 0.01 0.1 1 10 100 100n 1μ 10μ 100μ 0.001 0.01 0.1 1 10 100 Jacobian norm 1 0.001 1μ 1n 1p 1f 1e−18 1e−21 Cross-entropy loss Figure App.11: Top: Jacobian norm kJy (x)k2 = ∂fσ (x)y /∂xT of the true class y output 2 probability is tightly related to the cross-entropy loss. Each point corresponds to one of the 1000 test inputs to a 100% trained network on CIFAR10, while lines depict analytic bounds from Equation 5. Bottom: Same experiment plotting the full Jacobian norm kJkF against cross-entropy. Solid lines correspond to the lower bound from Equation 6 and the norm approximation from Equation 7. See §A.5.7 for experimental details and Figures 6 and App.9 for empirical evaluation of this relationship on multiple datasets and models. A.4 N ON - LINEARITIES D EFINITIONS Following activation functions are used in this work: 1. 2. 3. 4. 5. A.5 ReLU (Nair & Hinton, 2010): max(x, 0); ReLU6 (Krizhevsky, 2010): min (max(x, 0), 6); Tanh: hyperbolic tangent, (ex − e−x )/(ex + e−x ); HardTanh (Gulcehre et al., 2016): min (max(x, −1), 1); HardSigmoid (Gulcehre et al., 2016): min (max(x + 0.5, 0), 1); E XPERIMENTAL S ETUP All experiments were implemented in Tensorflow (Abadi et al., 2016) and executed with the help of Vizier (Golovin et al., 2017). All networks were trained with cross-entropy loss. All networks were trained without biases. All computations were done with 32-bit precision. Learning rate decayed by a factor of 0.1 every 500 epochs. Unless specified otherwise, initial weights were drawn from a normal distribution with zero mean and variance 2/n for ReLU, ReLU6 and HardSigmoid; 1/n for Tanh and HardTanh, where n is the number of inputs to the current layer. 18 Published as a conference paper at ICLR 2018 All inputs were normalized to√have zero mean and unit variance, or, in other terms, lie on the ddimensional sphere of radius d, where d is the dimensionality of the input. All reported values, when applicable, were evaluated on the whole training and test sets of sizes 50000 and 10000 respectively. E.g. “generalization gap” is defined as the difference between train and test accuracies evaluated on the whole train and test sets. When applicable, all trajectories/surfaces in input space were sampled with 220 points. A.5.1 P LOTS AND E RROR BARS All figures except for 6 and App.11 are plotted with (pale) error bars (when applicable). The reported quantity was usually evaluated 8 times with random seeds from 1 to 84 , unless specified otherwise. E.g. if a network is said to be 100%-accurate on the training set, it means that each of the 8 randomlyinitialized networks is 100%-accurate after training. The error bar is centered at the mean value of the quantity and spans the standard error of the mean in each direction. If the bar appears to not be visible, it may be smaller than the mean value marker. Weight initialization, training set shuffling, data augmentation, picking anchor points of data-fitted trajectories, selecting axes of a zero-centered elliptic trajectory depend on the random seed. A.5.2 S ENSITIVITY ALONG A T RAJECTORY Relevant figure 2. A 20-layer ReLU-network of width 200 was trained on MNIST 128 times, with plots displaying the averaged values. A random zero-centered ellipse was obtained by generating two axis vectors with normallydistributed entries of zero mean and unit variance (as such making points on the trajectory have an expected norm equal to that of training data) and sampling points on the ellipse with given axes. A random data-fitted ellipse was generated by projecting three arbitrary input points onto a plane where they fall into vertices of an equilateral triangle, and then projecting their circumcircle back into the input space. A.5.3 L INEAR R EGION B OUNDARIES Relevant figure 3. A 15-layer ReLU6-network of width 300 was trained on MNIST for 218 steps using SGD with momentum (Rumelhart et al., 1988); images were randomly translated with wrapping by up to 4 pixels in each direction, horizontally and vertically, as well as randomly flipped along each axis, and randomly rotated by 90 degrees clockwise and counter-clockwise. The sampling grid in input space was obtain by projecting three arbitrary input points into a plane as described in §A.5.2 such that the resulting triangle was centered at 0 and it’s vertices were at a ×2 distance 0.8 form the origin. Then, a sampling grid of points in the [−1; 1] square was projected back into the input space. A.5.4 S MALL E XPERIMENT Relevant figures: 4 (second row) and 5 (bottom). All networks were trained for 218 steps of batch size of 256 using SGD with momentum. Learning rate was set to 0.005 and momentum term coefficient to 0.9. Data augmentation consisted of random translation of the input by up to 4 pixels in each direction with wrapping, horizontally and vertically. The input was also flipped horizontally with probability 0.5. When applying data augmentation (second row of Figure 4), the network is unlikely to 4 If a particular random seed did not finish, it was not taken into account; we believe this nuance did not influence the conclusions of this paper. 19 Published as a conference paper at ICLR 2018 encounter the canonical training data, hence few configurations achieved 100% training accuracy. However, we verified that all networks trained with data augmentation reached a higher test accuracy than their analogues without, ensuring that the generalization gap shrinks not simply because of lower training accuracy. For each dataset, networks of width {100, 200, 500, 1000, 2000, 3000}, depth {2, 3, 5, 10, 15, 20} and activation function {ReLU, ReLU6, HardTanh, HardSigmoid} were evaluated on 8 random seeds from 1 to 8. A.5.5 L ARGE E XPERIMENT Relevant figures: 1, 4 (except for the second row), 5 (top), App.8. 335671 networks were trained for 219 steps with random hyper-parameters; if training did not complete, a checkpoint at step 218 was used instead, if available. When using L-BFGS, the maximum number of iterations was set to 2684. The space of available hyper-parameters included5 : 1. CIFAR10 and CIFAR100 datasets cropped to a 24 × 24 center region; 2. all 5 non-linearities from §A.4; 3. SGD, Momentum, ADAM (Kingma & Ba, 2014), RMSProp (Hinton et al., 2012) and LBFGS optimizers; 4. learning rates from {0.01, 0.005, 0.0005}, when applicable. Secondary coefficients were fixed at default values of Tensorflow implementations of respective optimizers; 5. batch sizes of {128, 512} (unless using L-BFGS with the full batch of 50000); 6. standard deviations of initial weights from {0.5, 1, 4, 8} multiplied by the default value described in §A.5;  7. widths from 1, 2, 4, · · · , 216 ;  8. depths from 2, 3, 5, · · · , 26 + 1 ; 9. true and random training labels; 10. random seeds from 1 to 8. A.5.6 P ER - POINT G ENERALIZATION Relevant figures 6, App.9. Networks were with either cross-entropy or `2 -loss trained for 219 steps on whole datasets (CIFAR100, CIFAR10, Fashion-MNIST and MNIST) and evaluated on random subsets of 1000 test images. Hyper-parameters were: non-linearity (all functions from §A.4), width (50, 100, 200, 500, 1000), depth (2, 5, 10, 20, 30), learning rate (0.0001, 0.001, 0.01), optimizer (SGD, Momentum, ADAM, RMSProp). Only one random seed (1) was used. For each dataset a random subset of 5 configurations among all the 100%-accurate (on training) networks was plotted (apart from the case of CIFAR100, where networks of training accuracy of at least 99.98% were selected). A.5.7 C ROSS - ENTROPY AND S ENSITIVITY A NALYSIS Relevant figure App.11. Networks were trained for 218 on the whole CIFAR10 training set and evaluated networks on a random test subset of size 1000. The hyper-parameters consisted of non-linearity (all functions from §A.4), width (50, 100 or 200) and depth (2, 5, 10, 20). Only one random seed (1) was considered. A single random 100%-accurate (on training data) network was drawn to compare experimental measurements with analytic bounds on the Jacobian norm. 5 Due to time and compute limitations, this experiment was set up such that configurations of small size were more likely to get evaluated (e.g. only a few networks of width 216 were trained, and all of them had depth 2). However, based on our experience with smaller experiments (where each configuration got evaluated), we believe this did not bias the findings of this paper, while allowing them to be validated across a very wide range of scenarios. 20
9cs.NE
Extending Design by Contract for Aspect-Oriented Programming arXiv:cs/0501070v1 [cs.SE] 24 Jan 2005 David H. Lorenz Therapon Skotiniotis Technical Report NU-CCIS-04-14 College of Computer & Information Science Northeastern University Boston, Massachusetts 02115 USA { lorenz, skotthe }@ccs.neu.edu ABSTRACT DbC for OOP also validates logical implications between supertype assertions and subtypes assertions on methods [9]: an overriding method must be a behavioral substitute [18] for its overridden counterpart. In comparison, DbC for AOP must validate that the method with an advice is a behavioral substitute for its advice-less counterpart. Design by Contract (DbC) and runtime enforcement of program assertions enables the construction of more robust software. It also enables the assignment of blame in error reporting. Unfortunately, there is no support for runtime contract enforcement and blame assignment for Aspect-Oriented Programming (AOP). Extending DbC to also cover aspects brings forward a plethora of issues related to the correct order of assertion validation. We show that there is no generally correct execution sequence of object assertions and aspect assertions. A further classification of aspects as agnostic, obedient, or rebellious defines the order of assertion validation that needs to be followed. We describe the application of this classification in a prototyped DbC tool for AOP named C ONA, where aspects are used for implementing contracts, and contracts are used for enforcing assertions on aspects. These differences brings about several issues: (i) At what point during the execution of the program should each kind of assertion be checked? (ii) Should there be a connection between assertions on methods and assertions on advice and how should that be enforced at runtime? (iii) How is blame assignment affected? 1. INTRODUCTION In this paper we extend the classic DbC runtime contract enforcement mechanism to cover AspectJ’s [20, 12, 3] advice definitions. We concentrate on the impact of the relative interleaving order of object contract checking and aspect contract checking. Design by Contract (DbC) [22] is a methodology for software construction that is based on runtime enforcement of assertions. Several object-oriented programming (OOP) languages follow the Eiffel [23] example in providing support for DbC (including, e.g., Blue [14] and Sather [24]). Unfortunately, no aspect-oriented programming (AOP) language offers support for DbC. This paper extends DbC for controlling also the interactions between advice and methods [25], a need that is evident in any non-trivial AOP application development [11]. In Section 2, we show that there is no generally applicable correct order. In Section 3, we develop a classification of aspects according to the way they influence object contracts. We classify each aspect as either agnostic, obedient, or rebellious, and show that the membership of an aspect in one of the defined categories implies a particular order. Based on this classification, the execution order of method invocation (and its advice and assertions) changes, in order to properly assign blame for any contract violations that may occur. While runtime contract enforcement and blame assignment for objects is well understood, it is unclear how DbC extends to aspects. In DbC for OOP, assertions are enforced during method invocation; a failure clearly implicates one of two distinct objects, the caller or the callee. In DbC for AOP, there are two kinds of entities (objects and aspects), two different kinds of assertions (assertions for objects and assertions for aspects), and no implicit caller (for an aspect’s advice). Enforcing contracts via aspects is also an application area of aspects that serves as an illustration for the need to differentiate between agnostic, obedient, and rebellious aspects. In Section 4, we present C ONA [21, 29, 28, 26], a tool for the provision and enforcement of DbC in both OOP and AOP. 2. MOTIVATING EXAMPLE Consider a software system for an online bookstore (Figure 1) with offices in the USA, Greece, and Israel. A book sale transaction requires a non-empty ISBN number (pre-condition of OnlineBookstore.sale). The sale completes by providing a book that either matches the requested ISBN number or has the same title (postcondition of OnlineBookstore.sale) but possibly a different ISBN. The post-condition in OnlineBookstore.sale permits to substitute 1 OnlineBookstore + sale(ISBN):Book @pre{ISBN != null} @post{result.ISBN.equals(ISBN) k ISBN.getTitle() = result.getTitle()} USBranch + sale(ISBN):Book @pre{ISBN != null} @post{result.ISBN.equals(ISBN) k (result.ISBN != ISBN && result.getTitle() = bookDB.getTitle() && result.getBookType() = HC && bookDB.getBookType(ISBN) = PB && result.getShipping()< 20)} ILBranch + sale(ISBN):Book @pre{ISBN != null} @post{result.ISBN.equals(ISBN) k (result.ISBN != ISBN && result.getTitle() = bookDB.getTitle() && result.getBookType() = HC && bookDB.getBookType(ISBN) = PB && result.tCost()−Calc.tCost(ISBN)< 10)} GRBranch + sale(ISBN):Book @pre{ISBN != null} @post{result.ISBN.equals(ISBN) k ISBN.getTitle() = result.getTitle()} Figure 1: The online bookstore has offices in USA, Greece, and Israel. Each site has different taxes (Sales, VAT) and also different shipping agencies. sale is overwritten, however, the contracts associated with each method implementation make the three subclasses proper behavioral subtypes of OnlineBookstore. the requested book with a different edition of the book1 (e.g., a paperback (PB) version instead of a hardcover (HC) version, or vice versa). implemented) are used. Since an aspect may observe or alter information before, after, or around a method’s call/execution, a user aspect’s advice might: Concrete subclasses of OnlineBookstore specialize sale to reflect the policy in effect in each of the three different countries. Specifically, • Break a method’s pre-condition even when the client calls the method correctly. • Break a method’s post-condition even when the method’s pre- and post-condition where fulfilled by the method’s implementation. • In the USA, an order for a paperback version of a book that is not available in the bookstore may be fulfilled with a hardcover version of the book as long as the shipping costs for the hardcover version does not exceed the amount of 20 Dollars. • Correct a call to a method m that originally violated m’s precondition. • Correct a previously erroneous implementation that did not fulfill its post-condition. • In Greece, an order for a book that is not in-stock but another version (paperback or hardcover) is available is fulfilled by providing that version instead. • Add extra behavior to a method’s implementation without altering the set of states accepted by the pre- and post-condition assertions, i.e., provide a different mapping for the same input and output value sets of the method. • In Israel, if the requested book is a paperback but the bookstore has only the hardcover version, then the hardcover is provided as long as the difference in the total cost (book price plus shipping) is less than 10 Shekels. • Add extra behavior by extending the method’s specification (pre- and/or post-conditions). The post-condition on the specialized implementations of sale capture the corresponding country’s policy, which needs to be checked at runtime. • Monitor a method’s execution by collecting information or checking certain system properties without affecting the behavior of the method. In terms of contracts (transactions) the role of provider (server) is played by the online bookstore software. The consumer (client) role is played by the customer that uses the online bookstore software. The order of execution amongst aspect advice, pre- and post-condition validation, and method execution determines which one of the above situations occur. For example, behavioral extension via aspect advice should only be allowed when aspect advice is executed before a method’s pre-condition or post-condition validation. 2.1 Contracts in the Presence of Aspects Interesting issues arise in the situations where user aspects are present in the system where contracts (regardless of how they are being Consider (the addition of an aspect that will implement) an increase of 10% in shipping cost on hardcover books (Listing 1). ShippingCost is added to the system and attached to sale method calls with an after advice holding the relevant code for the enforcement of the extra cost. Focusing on sale method calls, it is not 1 We assume that two books with the same title are either the same or different editions of the same book. That is, there do not exist two books of different contents with the same title in the bookstore. 2 1 2 post-condition check is enforced then the difference in total cost is 0 Shekels and the sale can go through. Listing 1: ShippingCost aspect adding the 10% extra shipping cost on hardcover editions. aspect ShippingCost{ pointcut HDSales(ISBN isbn): call(∗ OnlineBookstore.sales(..) ) && args(isbn); One may resort to a conservative approach in which a method’s pre-condition is checked twice: once before the advice and once before the method (execution order C in Table 1). However, that would restrict the applicable aspects, thereby compromising obliviousness [8]. 3 after(ISBN isbn) returning (Book item): HDSales(isbn){ item.setShippingCost(item.getShippingCost() ∗ 1.1); item.calculateTotalCost(); } 4 5 6 7 8 9 3. A CLASSIFICATION OF ASPECTS FOR DBC } Aspects can be used: (i) to enforce properties without altering the behavior of the underlying system (e.g., logging the online bookstore system, checking the online bookstore coding style [17], implementing the DbC assertions found in Figure 1 [cf. Section 4]. obvious what execution sequence amongst pre- and post-condition validation, aspect advice and method execution should be followed. Three possibilities (Table 1) are possible and we will examine each one in turn within the context of the on line bookstore example. (ii) to allow for extensions to the behavior of the underlying system, (e.g., allowing for extra charges/discounts on the online bookstore). Assuming an execution policy where user aspects are executed before pre-conditions and after post-condition are enforced (execution order A in Table 1), clients to both the USBranch and ILBranch may be charged more than what was agreed. Although the client has maintained the originally agreed upon contract, the final outcome breaks the clients expectations blaming the provider. The two different uses of aspects in the presence of contracts imposes certain restrictions on their execution order. Furthermore, it may result in erroneous blame assignments complicating error detection and resolution. The shipping cost increase introduced via the aspect can result to shipments where the total shipping cost will be more than $20 and a total cost that is more than 10 Shekels. From the clients point of view, it is clearly an error of the online bookstore since the agreed policy for replacing a paperback edition was not followed.2 At the same time the corresponding branches have assurances (sale’s post-condition) that the replacement policy was honored. DbC mechanisms fail to correctly assign blame in the presence of aspects, misguiding developers and increasing the time spend on bug detection and correction. It is clear that the party that is actually at fault here is the aspect. One can conclude that the aspect is at fault only after observing all three entities, their execution sequence and their interactions. The choice of which interleaving execution order (Table 1) to enforce also depends on the mechanism of assigning blame in cases of violation. Standard DbC mechanisms are ignorant of aspects. Blame assignment must therefore be extended to deal with aspects as entities that can be assigned blame. Also, what is being violated has to be redefined in order to take into account the intention of code found in aspect definitions. The ability to define an aspect’s intentions through a clear declarative specification as well as the runtime validation of these intentions is crucial in error detection, error resolution and reasoning about aspect-oriented programs. We identify three intentional categories of aspects: namely, agnostic, obedient, and rebellious. However, an aspect can also be used to bring about the exact opposite effect. An aspect can intervene after the return of a method that originally returned a faulty result which violated the post-condition and modify the result in such a way so that now the post-condition is not violated. The execution interleaving would have to allow such aspects to intervene before the runtime check for a methods post-condition (execution order B in Table 1). These situations are examples of extensions/fixes through aspects. 3.1 Agnostic Aspects Agnostic aspects are aspects that do not affect a method’s assertions in any way. Agnostic aspects are “sandwiched” with the original method’s pre- and post-conditions. From the perspective of the callers of the method, the method with the advice (as on body) has the same assertions as the original method body. In addition, assertions do not change from the method’s perspective either. In the case of the online bookstore, suppose that a 20% markdown is in effect for all hardcover editions. Consider a customer in Israel ordering a book using the ISBN of the paperback edition. Suppose the paperback edition costs 80 Shekels and the hardcover edition costs 100 Shekels. The bookstore does not have any copies of the paperback edition and provides the hardcover edition of the book instead. Before applying the 20% markdown on the hardcover edition, the post-condition of the ILBranch disallows the switch from paperback to hardcover since the difference in cost is more than 10 Shekels. However if the aspect is allowed to intervene before the 3.1.1 Execution Order The language imposes the following execution sequence in the case of agnostic aspects (execution order C): bef mpre ❀ αbef pre ❀ α ❀ αpost ❀ mpre ❀ m ❀ mpost ❀ after after ❀ αpre ❀ α ❀ αpost ❀ mpost Where 2 In fact an OOP runtime contract enforcement mechanism will blame the corresponding bookstore branch since it does not take into account aspects and their specification. • αbef pre denotes to the pre-condition of the aspect’s (α) before advice 3 Policy Exec Order A Exec Order B Exec Order C α mpre mpre ❀ ❀ ❀ mpre α α ❀ ❀ ❀ Execution Interleaving m ❀ mpost ❀ α m ❀ α ❀ mpost mpre ❀ m ❀ mpost ❀ α ❀ mpost Table 1: Three alternative policies of interleaving execution (form left to right) of contracts checking pre- and post-conditions (mpre and mpost respectively) with advice from an aspect (α). • αbef post denotes to the post-condition of the aspect’s (α) before advice there should be no change in the method’s behavior and specification. Furthermore, the return values of the after advice are the return values of the method call as a whole and thus the method’s post-condition must also hold. • mpre denotes to the method’s (m) pre-condition • mpost denotes to the method’s (m) post-condition 3.2 Obedient Aspects • αafter pre denotes to the pre-condition of the aspect’s (α) after advice Another form of extension to the base system is one where the set of input and output states remains the same but the mapping of input to output values changes. In these situations the aspect with such an intended extension is categorized as an obedient aspect. • αafter post denotes to the post-condition of the aspect’s (α) after advice Obedient aspects are aspects used to provide extra behavior without changing the method’s pre- and post- conditions, i.e., obedient aspects just provide a different mapping from the same input to the same output value sets of the method. From the perspective of a caller of the method, the method with the advice has the same assertions as the original method had. This execution sequence makes sure that the original method’s preand post-condition is validated both before advice execution and after advice execution. 3.1.2 Blame Assignment Runtime assertion validation and blame assignment for agnostic aspects is described in Table 2. On top of checking for each individual assertion at runtime extra implications between assertions are validated to guarantee proper execution flow between aspect advice and method implementation. The method’s pre-condition has to imply the before advice pre-condition making sure that the aspect developer took into account the valid start states of the method. Furthermore, before advice post-condition has to imply the methods pre-condition. Since no alteration of behavior is allowed in agnostic aspects execution of the method’s implementation must start in a valid state satisfying the methods pre-condition. 3.2.1 Execution Order Declaring an obedient aspect imposes the following execution sequence (execution order B): bef after after mpre ❀ αbef pre ❀ α ❀ αpost ❀ m ❀ αpre ❀ α ❀ αpost ❀ mpost Adding an obedient aspect does not alter the pre- and post-conditions of the method as they are known to the rest of the system. The first assertion validation is still the original method’s pre-condition and the last assertion validation is the original method’s post-condition. Similarly, the method’s post-condition must imply the after advice pre-condition. This is again the responsibility of the aspect developer who is required to begin any agnostic aspect after advice from a valid state according to the method’s post-condition. Finally, after advice post-condition must directly imply the method’s postcondition. Upon completion of an agnostic aspect’s after advice Assertion Validation mpre mpre → αbef pre αbef post αbef post → mpre mpre mpost mpost → αafter pre αafter pre αafter post after αpost → mpost mpost 3.2.2 Blame Assignment Once the method’s pre-condition has been successful validated this should immediately imply the pre-condition for the aspect’s before advice is also true. The aspect developer knows the method’s precondition and has defined the aspect to be an obedient aspect, it is therefore the aspect developer’s responsibility to accept all legal starting states of the method as legal starting states of the aspect’s before advice. Failing to do so will signal an error blaming the aspect developer for attempting to use an obedient aspect without taking into account the original method’s pre-condition (Table 3). Blame Assignment Caller Aspect Advice Aspect Advice Method Advice Advice Advice Aspect Aspect Assertion Validation mpre mpre → αbef pre αbef post mpost → αafter pre αafter pre αafter post αafter post → mpost Table 2: Implications for agnostic aspect assertions and blame assignment. Order of execution goes from top (first) to bottom (last). Blame Assignment Caller Aspect Advice Aspect Advice Advice Aspect Table 3: Assertions validated for obedient aspects (execution flows from top to bottom) along with blame assignments. 4 In this way an extended version of the method can be provided to client programs. This kind of extension, however, raises an issue with clients as to which of the methods pre-conditions are clients supposed to follow? The aspect’s before advice post-condition is then checked. Failing the before advice post-condition blames the advice code for not fulfilling the expected assertion upon its termination. The next assertion to be checked is an implication relation between the original method’s post-condition and the after advice pre-condition. Blame is assigned to the aspect developer in the case of failure, for declaring an obedient aspect and not taking into account the method’s post-condition as a valid start state for the aspect’s after advice. The after advice pre-condition is then checked, blaming the composition rules (pointcuts) in the case of an error. The after advice post-condition validation follows which blames the advice code in case of an error. Finally an implication between the after advice post-condition and the original method’s post-condition is validated. This check makes sure that the state in which the after advice terminates (and thus the whole call to the method) does so in valid state according to the method’s original post-condition. The answer is either one. A rebellious aspect provides a behavioral method extension without breaking the existing method’s contracts, i.e., allows for a broader set of valid start states and a narrower set of valid end states. This is reflected in the way implication between assertions are being validated, after checking for the validity of each assertion, extra implications between pre- and post-conditions are further validated. 3.3.2 Blame Assignment Blame assignment is described in Table 4. The extra implication mpre → αbef pre makes sure that the extension made through the aspect definition maintains the previously valid start states for the method. In case that it does not then the blame lies with the aspect developer for providing an extension that breaks existing clients of the method. The implication αbef post → mpre verifies that after the termination of before advice and before the execution flows to the method’s implementation, the program state satisfies the method’s pre-condition. If before the advice post-condition implies the method’s pre-condition then the method is not being wrongly used by the aspect. The implication mpost → αafter pre verifies that upon completion of the method body execution flows into the aspect’s after advice in a correct start state for the after advice. It is therefore the responsibility of the aspect developer to make sure that all valid states reached upon return of the method are also valid start states for the aspect’s after advice. Finally, the implication αafter post → mpost verifies that all the valid states at after advice termination are also valid according to the original method’s post-condition. This last check verifies that the set of valid end states is the same as, or a subset of, the original method’s set of end states. The difference between agnostic and obedient aspects is subtle. In both cases, if the method pre-condition is valid, we can invoke the method with its advice, and the result satisfies the post-condition. However, in the case of the obedient aspect it is possible that a before aspect will invalidate the precondition, the method is executed on a state that does not satisfy the precondition, and an after advice fixes the postcondition (if necessary). With agnostic aspects, the method code executes only in the context it was meant for. 3.3 Rebellious Aspects Rebellious aspects are aspects used only to provide behavioral extensions to existing methods. Rebellious aspects change the behavior of existing methods. After the aspect is applied to a method, from the perspective of a caller of the method, the method with the advice has different assertions than the original method had. However, assertions do not change from the method’s perspective. As the category name implies, these are aspects that are determined to alter the behavior of a method to the extend where the existing pre- and post-conditions of the method are affected. Nonetheless, rebellious aspects can alter a method’s pre- and post-conditions in a controlled manner: Assertion Validation mpre → αbef pre αbef pre αbef post bef αpost → mpre mpre mpost mpost → αafter pre αafter pre αafter post after αpost → mpost • For all valid start states of the method’s pre-condition, the new pre-condition (aspect’s before pre-condition) has to also be valid. • For all valid states according to the new post-condition (aspect’s after post-condition) the original method’s post-condition has to also be valid. Blame Assignment Aspect Caller Advice Aspect Advice Method Aspect Advice Advice Aspect Table 4: Implications for rebellious aspect assertions and blame assignment. Order of execution goes from top (first) to bottom (last). The above implications between the extend pre-condition (and original method pre-condition) and extended post-condition (and the original method’s post-condition) ensure proper behavioral subtype between the original method and the extension to the method. 3.4 Application and Obliviousness A DbC for AOP system is able to provide for the runtime validation of assertions on both aspects and objects allowing for the detection of errors due to erroneous aspect advice implementations, erroneous aspect composition and aspect category violations allowing for faster error detection and resolution. 3.3.1 Execution Order A rebellious aspect is guaranteed an execution sequence imposed by the aspect that allows its advice to execute even before the method’s pre-condition. This enables the redefinition of the method’s precondition. In order to allow for the methods behavioral extension the execution order enforced by the language is (from left to right): bef after after αbef pre ❀ α ❀ αpost ❀ mpre ❀ m ❀ mpost ❀ αpre ❀ α ❀ αpost 5 The categorization into agnostic, obedient, and rebellious covers all behaviors that aspects can introduce to a system. Along with the incorporation of pre- and post-conditions for advice, DbC for In the remaining part of this section we further explain C ONA and the language extensions to Java and AspectJ as well as C ONA’s mechanisms for contract enforcement. First an overview of DbC for Java is presented followed by a more detailed analysis of how C ONA extends DbC for OOP to achieve DbC for AOP. AOP can resolve the execution order question by, e.g., introducing three new keywords to the AspectJ language that programmers can use to declare the categorizations of aspect implementations. DbC support for AspectJ would then use this classification to enforce the appropriate execution sequence according to each category. AspectJ could also extend DbC to aspects by allowing preand post-condition validation for advice and their implication on pre- and post-conditions on their attached methods. Such an implementation of DbC for AOP does not impose any restrictions on the base code, allowing the same level of obliviousness [8] as in the current implementations of AspectJ. 4. 4.1 An AOP Solution to DbC for OOP The AOP implementation for the provision of DbC for OOP maps each Java type to a contract aspect that is responsible for the enforcement of all contracts defined in that type. Pre- and post-conditions and invariant expressions are generated as aspect methods. Pointcuts are generated to capture executions of a type’s methods. Pointcuts are further used to distinguish which type’s method is called and which type’s implementation of this method is actually executed. In this way the correct type is blamed in the case of a contract violation. Extra methods are generated which recursively traverse contracts of the current type’s supertypes verifying the correctness of the type hierarchy. A CASE STUDY IN ENFORCING CONTRACTS USING ASPECTS WITH CONA So far we tacitly ignored the question of how the enforcement of assertions on methods (and on advice) is implemented. Enforcing runtime contract checking in a program is a classical cross-cutting concern by its very nature of monitoring calls made between software entities [19, 4]. At the heart of any runtime contract checking tool lies the ability to observe and intervene between calls made from one software unit to another. The kinds of checks that need to be carried out between calls differ depending on the paradigm (e.g., functional [10] vs. OO etc.). The ability of AOP technologies to non-invasively extend a system, along with the ability to encapsulate and compose cross-cutting concerns, make AOP an ideal implementation tool for DbC. Listing 2 shows an example of a contract aspect implementing a contract in AspectJ. The code has been generated by C ONA [27] and it illustrates that aspects implementing contracts can follow a pattern (template): pointcut definitions capture calls to the method (lines 5–7), before advice checks method pre-conditions (lines 8– 18), and after advice checks method’s post-conditions (lines 19– 29). Invariant assertions are checked both before and after a call to the object’s public methods. Auxiliary methods are generated inside aspects to deal with hierarchy checking (lines 36–51) [9]. The recipe for C ONA’s aspect generation is explained elsewhere [28]. C ONA [27] is a DbC tool for both OOP and AOP. It extends Java’s and AspectJ’s syntax with contracts and enforces their runtime validation. C ONA works by generating AspectJ aspects to enforce the runtime contract checking. C ONA generates aspect definitions only for the validation of contracts on Java classes; it generates class definitions for the validation of contracts on AspectJ aspects. Blame assignment for OOP [9] is summarized in Table 5. The last two rows display the type hierarchy check performed in order to verify proper behavioral subtyping. Due to the lack of aspectual polymorphism [5, 6] in AspectJ, the traversal of contracts in C ONA deploys AspectJ’s reflective features in order to acquire aspect instances at runtime. In a C ONA application there are always two “kinds” of aspects 1. User-Aspects these are aspect definitions provided by developers that affect the underlying Java program. The AOP implementation of DbC for OOP works well as long as the generated aspects are the only aspects in the system. 2. Contract-Aspects these are generated by C ONA and are responsible for the enforcement of contracts for objects (DbC for OOP). 4.2 An OOP Solution to DbC for AOP A DbC for AOP solution has to be able to enforce the execution sequence required by each aspect category as well as manage preand post-conditions found in user aspect definitions. and two “kinds” of objects Figure 2 uses a flowchart diagram superimposed on an interaction diagram showing when obedient (top) and a rebellious (bottom) aspects intervene during m’s execution, and what is the order of 1. User-Objects these are all the instances of user defined Java classes. 2. Contract-Objects these are all the instances of the C ONA generated Java classes used for the runtime validation of contracts defined inside user aspects. Contract Value ¬mpre ∀τ, τ ′ (τ ′ ≺: τ ∧ τ:: m ∧ τ ′:: m) → ¬(τ::mpre → τ ′::mpre ) ¬mpost ∀τ, τ ′ (τ ′ ≺: τ ∧ τ:: m ∧ τ ′:: m) → ¬(τ ′::mpost → τ::mpost ) Contracts on objects are implemented by contract aspects; contracts on aspects are implemented by contract objects. The desired DbC functionality is guaranteed provided that the generated contract aspects are the only aspects in the system. However, in the presence of user aspects, and in particular, the interplay between a contract aspect and user aspects, enforcing assertions correctly is non-trivial. C ONA is therefore an interesting testbed for exposing the issues of execution order and a natural client for our aspect classification. Blame Assignment Caller τ′ Callee τ′ Table 5: Blame assignment rules for OOP. τ ′ ≺: τ defines that τ ′ is a direct subtype of τ . τ::mpre denotes the method m with pre-conditions pre is defined in type τ . 6 Figure 2: A flowchart diagram superimposed on a sequence diagram for a method call to m showing the order of contract evaluation for obedient aspects (top) and rebellious aspects (bottom). mpre refers to m’s pre-conditions assertion and αbefore and αbefore pre post to the aspect’s pre- and post-condition assertions respectively. contract evaluation for these two aspect categories.3 Aspect category definitions denote a specific order of contract evaluation as well as implications between assertions in contract aspects and contract objects. All diamond shaped decisions points are generated by C ONA. Decisions points denoted as diamonds in Figure 2 and labeled with an α pattern are captured as Java classes (contract objects). Diamond shaped decision points labeled with an m pattern are captured as AspectJ aspects (contract aspects). relate to the state of the aspect, and also to the state of the receiver and the caller of method invocations. All information concerning a join point (e.g. target, args, source, etc.) can be referred to from inside an aspect’s pre- and post-conditions definitions. The programmer must specify the aspect’s category and the acceptable states in which advice may start/finish. Failing to meet the pre-condition of a block of advice implies that the attachment of the specific aspect to the base program P is not correct (Listing 4 line 18) and the aspect gets blamed. Similarly, if the post-condition of a piece of advice fails, this implies that the code inside the advice did not meet up to its obligations (Listing 4, line 15) and the advice code gets the blame. To support pre- and post-conditions for before and after advice we assume the AspectJ language was extended with the keywords agnostic, obedient (e.g., Listing 3, line 1), and rebellious, and, furthermore, that advice definitions can be annotated with preand post-conditions that apply to the corresponding advice body (Listing 3 lines 7– 8). Pre- and post-conditions are comprised of side effect free boolean expressions. Once pre- and post-conditions have been satisfied, the way by which pre- and post-conditions of advice interplay with method pre- and post-conditions of methods that they advice are checked for correctness based on the aspects defined category. The extension of C ONA for adding contracts to advice takes as input aspect definitions with pre- and post-conditions. Through a preprocessing stage, new aspects are generated to verify contracts on object instances and auxiliary class definitions to handle preand post-conditions on user defined advice. In the case of an obedient aspect (i.e., ShippingCost), before the execution of the after advice block the implication between the method’s post-condition and the after advice pre-condition (Listing 4, line 7) is checked by passing control to an auxiliary class (Listing 5). Failing to satisfy this implication throws an ObedientViolation (Listing 4, line 21) exception pointing out the erroneous implementation of the aspect’s before advice. The advice pre-condition and post-condition is then checked, blaming the aspect’s composition and the after advice implementation respectively (Listing 4, lines 18 and 15) First we present a sample program definition of advice with preand post-conditions along with the generated output. Listing 3 shows the obedient ShippingCost aspect presented earlier for the online bookstore example written in C ONA. Listing 4 shows the same aspect as Listing 3 after being processed by C ONA. The auxiliary class definitions (Listings 5 and 6) enforce the implications between contract objects and contract aspects. 5. DISCUSSION AND RELATED WORK Pre- and post-conditions inside advice must be side effect free Java boolean expressions. These expressions can refer to values that We have extended DbC for AOP to handle the interaction between pre- and post- conditions of methods and advice. Our goal was primarily to demonstrate the feasibility a novel approach for supporting DbC for AOP without compromising obliviousness. We have 3 Agnostic aspects are similar to obedient aspects with some additional contract checks interleaved during execution. 7 also presented a prototyped tool for enforcing DbC by generating aspects. This work paves the road to extending DbC for AOP but also leaves for future work a few issues that are need to be worked out for a complete practical support of DbC for AOP. 1 2 3 Listing 3: An example of using pre- and post-conditions in the ShippingCost aspect obedient aspect ShippingCost{ pointcut HDSales(ISBN isbn): call(∗ OnlineBookstore.sales(..)) && args(isbn); 4 after(ISBN isbn) returning (Book item): HDSales(isbn){ @pre{item.getBookType() = HD} @post{item.getShippingCost() = Calc.ShippingCost(item. ISBN) ∗ 1.1} item.setShippingCost(item.getShippingCost() ∗ 1.1); item.calculateTotalCost(); } 5 6 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 Listing 2: An aspect definition generated by C ONA for enforcingcontract obligations of GRBranch. priviledged aspect GRBranch Contract { GRBranch old; pointcut scope(): !within(GRBranch Contract) && !cflow(withincode(∗ GRBranch Contract.∗(..))); pointcut GRBranch sale(GRBranch tInst, ISBN isbn): call(public ∗ GRBranch.sale(..)) && !call(public ∗ ( GRBranch+ && !GRBranch).sale(..)) && args(isbn) && target(tInst) && scope(); before(GRBranch tInst, ISBN isbn): GRBranch sale(tInst,isbn){ boolean next = PreCondHier sale(tInst,isbn); boolean res = PreCond sale(tInst,isbn); if (!res){ //pre−condition violation exception } if (!next){ //pre−condition hierarchy violation exception } } after(GRBranch tInst, ISBN isbn)returning (Book result): GRBranch sale(tInst, isbn){ boolean res = PostCond sale(tInst,result,isbn); if (!res){ //post−condition violation exception } boolean postHier = PostCondHier sale(tInst,result,res,isbn) ; if(!postHier){ //post−condition hierarchy violation exception } } public boolean PreCond sale(GRBranch tInst, ISBN isbn){ return(isbn.notEqual(null)) } public boolean PostCond sale(GRBranch tInst, Book result, ISBN isbn){ return(result.ISBN.equals(isbn) || isbn.getTitle().equals( result.getTitle())) } public boolean PreCondHier sale(GRBranch tinst, ISBN isbn){ boolean myPre = PreCond sale(tInst,isbn); boolean hierarchy = OnlineBookstore Contract.aspectOf().PreCondHier sale( tInst,isbn); if (!hierarchy || myPre) return myPre; else return false; } public boolean PostCondHier sale(GRBranch tInst, Book result , boolean last, ISBN isbn){ myPost = PostCond sale(tInst, result, isbn); if (!last || myPost) return OnlineBookstore Contract.aspectOf(). PostCondHier sale(tInst, result, myPost, isbn); else return false; } } 7 8 9 10 11 12 1 2 3 } Listing 4: Sample output for ShippingCost aspect showing the wrapping of advice to check pre- and post-conditions aspect Contract ShippingCost { pointcut HDSales(ISBN isbn): call(∗ OnlineBookstore.sales(..)) && args(isbn); 4 after(ISBN isbn) returning (Book item): HDSales(isbn){ boolean implication1 = (new Contract ShippingCost After PreCond()).HDSales( thisJoinPoint,this,thisJoinPoint.getTarget(),isbn, item); if (implication1){ if(item.getBookRype()==HD){ item.setShippingCost(item.getShippingCost() ∗ 1.1); item.calculateTotalCost(); if (item.getShippingCost()==Calc.ShippingCost(item. ISBN) ∗ 1.1){ (new Contract ShippingCost After PostCond). HDSales(this,thisJoinPoint.getTarget(),isbn, item); }else{ new Error(this,”before”,jp); } }else{ new CompositionError(jp.getTarget().getClass(). getName(),this,thisJoinPoint); } }else{ new ObedientViolation(jp.getTarget().getClass(). getName(),this,thisJoinPoint); } 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 } Invariants and Object State. DbC makes the obligation–benefit contract between software consumers and providers explicit. Each instance method defines the valid states in which its execution can start (precondition), and the states in which it may terminate (postcondition). A more general assertion (invariant), which is maintained before as well as after any externally observable state of an object, ensures that the object maintains an acceptable state throughout the program’s execution. Object and aspect invariants can be checked by public methods as part of the pre- and postconditions using the same execution order we have established. However, to handle invariants, DbC for AOP needs not only control the interaction between aspects and object behavior, but also between aspects and object state. It is also not enough to moni8 1 action [25] should be handled similar to how overriding methods handle a call to super. One way of interpreting the aspect annotation for around advice is to require that an around advice of the form f (); proceed() would behave like a before advice would, and an around advice of the form proceed(); f () would behave like an after advice. Listing 5: Pre-condition wrapper for aspect after advice import org.aspectj.lang.∗; 2 3 class Contract ShippingCost After PostCond { 4 public boolean HDSales(JoinPoint jp, Contract ShippingCost uAspect, Object target, ISBN isbn, Book item){ String targetType = target.getClass().getName(); // Holds references to contract (aspects) AspectMethInvoker aInv = AspectMethInvoker.getInst(); 5 6 7 8 Introductions and Pointcut Descriptors. We have concerned ourselves with the pointcut and advice mechanism in AspectJ. AspectJ also support a static OC mechanism (e.g., introductions). This is yet another form for a possible interaction between an aspect and a class which we do not handle. Another subtle issue is the interaction between aspects and pointcuts. In our support of DbC for AOP we have thus far assumed that pointcuts have no side effects. This, however, is not generally true, not even for AspectJ. One might consider augmenting pointcut descriptors with pre- and post-conditions of their own. 9 // call appropriate contracts via reflection boolean m post = aInv.invokePost(targetType, jp.getSignature (), jp.getArgs(), item); boolean res = (item.getShippingCost() == Calc.ShippingCost( item.ISBN) ∗ 1.1); if (!res || m post){ return res; } else { new CompositionError(targetType,uAspect,jp); return false; } 10 11 12 13 14 15 16 17 18 19 } 20 21 1 Aspect Composition Validation Tool. Klaeren et al. [13] present the Aspect Composition Validation Tool for checking pre- and postconditions for aspect compositions according to configurations of the system’s components. The tool is developed using an older version of AspectJ (0.4beta7) which is drastically different than version 1.0.6. Further more, a set of configuration rules is added through AspectJ’s introductions and composition is validated according to these rules. Correctness is defined to be a valid aspect configuration that will allow a receiver to perform its task as specified by the overall system specification. Unfortunately, checking that the behavior of attached aspects and the base system is well defined is not verified. As long as the composition of aspects is within the set of valid compositions, the system is correct. An aspect can therefore break a methods pre- or post-condition as long as the configuration at hand allows it. There is no clear distinction between a type’s obligations in their system, since the same call to an instance of the same type can behave differently depending on its aspect configuration. } Listing 6: Post-condition wrapper for aspect after advice import org.aspectj.lang.∗; 2 3 class Contract ShippingCost After PostCond { 4 public boolean HDSales(JoinPoint jp, Contract ShippingCost uAspect, Object target, ISBN isbn, Book item){ String targetType = target.getClass().getName(); // Holds references to contract (aspects) AspectMethInvoker aInv = AspectMethInvoker.getInst(); 5 6 7 8 9 // call appropriate contracts via reflection boolean m post = aInv.invokePost(targetType, jp.getSignature (), jp.getArgs(), item); boolean res = (item.getShippingCost() == Calc.ShippingCost( item.ISBN) ∗ 1.1); if (!res || m post){ return res; } else { new CompositionError(targetType,uAspect,jp); return false; } 10 11 12 13 14 15 16 17 18 19 Assertions on aspects as well as objects are expressed in the Java Modeling Language (JML) [16]. The AspectJ syntax is extended with three main features: } 20 21 JML. Clifton and Leavens [2] use behavioral specifications for aspects as a means to assist in modular reasoning for aspect-oriented programs. Aspects are categorized as either observers that do not alter the behavioral specification of their attached methods, or as assistants that can alter behavior. Their categorization was a result after inspecting available AspectJ code and from discussions within the aspect community. } 1. JML can be used inside aspect definitions, defining the aspect’s behavioral specification tor only call and execution join points. Since advise can change the state of an object, the interaction between advice and objects’ state need to checked to enforce invariants. Additional checks are needed for checking the invariant of super-classes and outer classes. Invariants for aspects are particularly useful as an inductive hypothesis: What ever is assumed should be inductively provable. Other Kinds of Advice. We have focused on tween methods and before and after advice. replaces the method entirely and may or may ceed() call in its body. Such a narrowing or 2. Keywords observer and assistant can be used to annotate aspect definitions with their expected intend in the system. 3. The statement accept(TypePatern) has to be used inside modules, making explicit the modules intent to allow assistance from TypePatern. the interaction beAn around advice not contain a proreplacement inter- The specification of a method along with its assistant is created as a graph by following the possible execution paths, logically and-ing 9 between contracts on aspects and contracts in classes. Based on these decisions of execution order and contract implications, blame assignment can be defined. assertions and binding parameter variables and model variables to values. Although our goals are different than those of Clifton and Leavens the proposals share some ideas. Our notion of aspect categorization comes from an analysis of how aspects can affect a program execution and not through an analysis of existing usage of aspect oriented programming. In doing so we aim at providing a categorization that covers any possible usage of aspects rather than the common usage of aspects. Further more, our proposal brings these categorizations into the programming language and enforces an execution order disallowing aspect behavior outside the bounds of its defined category. Enforcing an execution sequence helps in defining the semantics of assertion validation along with blame assignment without having to resort to long and complicated path specifications based on control flow paths. Finally, in our proposal modules are not affected in any way and remain oblivious to the addition of aspects. Obliviousness is decreased in Clifton et al. [2] with the incorporation of the accept expression in the language. We provide an analysis of the possible execution order between contracts and view the addition of advice as a behavioral extension to the existing program. Our analysis leads us to a categorization of aspects into agnostic, obedient and rebellious. Each such categorization enforces an execution order between contracts as well as the necessary implications that verify at runtime that the extended (through aspects) system remains a behavioral subtype of the unextended original system. Error reporting and blame assignment is extended to deal with contracted aspect oriented systems. Our ideas have been integrated in C ONA, an aspect-based DbC tool for AOP which uses aspects to implement contracts and their runtime validation. C ONA serves both as a language extension to Java and AspectJ, but also as a case study for our own work. Through the development and usage of C ONA we hope to improve the ability to reasoning about the interactions of aspects with other program entities including aspects themselves. We believe that the incorporation of pre- and post-conditions on before and after advice is a step forward towards reasoning about aspects and their behavior. Pipa. Pipa [31] defines a Behavioral Interface Specification Language (BISL) tailored for AspectJ along the ideas of Clifton et al. [2]. Pipa statements extend the Java Modeling Language (JML) to accommodate pre- and post-conditions and invariants for advice. Specifications in Pipa, along with aspect definitions, are translated to JML and Java code, respectively. Pipa differs from the proposal of Clifton and Leaves. Assertions are allowed on aspect introductions and the accept expression is not provided by Pipa. Further more, the AspectJ language is not extended to accommodate for the definition of observer and assistant aspect definitions. Behavioral specifications inside aspects are translated into JML specifications following the specification generation of execution paths as defined in [2]. Pipa does not provide, nor enforce, aspect categories. By concentrating on AspectJ’s intermediate Java representation of aspect programs, Pipa becomes part of the AspectJ compiler making extensions difficult and blame assignment more complex. 7. REFERENCES [1] AOSD 2003. Proceedings of the 2nd International Conference on Aspect-Oriented Software Development, Boston, Massachusetts, Mar. 17-21 2003. ACM Press. [2] C. Clifton and G. T. Leavens. Observers and assistants: A proposal for modular aspect-oriented reasoning. Technical Report 02-04a, Iowa State University, Department of Computer Science, Apr. 2002. [3] A. Colyer. Aspectj. In Filman et al. [7], pages 123–143. [4] C. A. Constantinides and T. Skotiniotis. Reasoning about the classification of crosscutting concerns in object-oriented systems. In Second International Workshop on Aspect-Oriented Software Development. German Informatics Society, February 21-22 2002. Classification system. Rinard et al. [25] present a classification that is also derived from the interaction of advice and methods. Their focus is on automated analysis, while our work focuses on enforcing contracts based on annotations. The interaction between agnostic aspects and methods can be classified as augmentation in their classification. The obedient and rebellious aspects we have identified refine their combination class of interactions. The narrowing and replacement interactions can help in extending our work to also handle around advice with or without proceed. Their additional classification of scopes and field access, can also help in extending our DbC tool to handle set-field and get-field advice. Automated classification to help suggest or verify aspect categories annotation is a direction for future work. 6. [5] E. Ernst and D. H. Lorenz. Aspectual polymorphism. Technical Report NU-CCS-01-09, College of Computer Science, Northeastern University, Boston, MA 02115, Sept. 2001. [6] E. Ernst and D. H. Lorenz. Aspects and polymorphism in AspectJ. In AOSD 2003 [1], pages 150–157. http://www.ccs.neu.edu/home/lorenz/papers/aosd2003po [7] R. E. Filman, T. Elrad, S. Clarke, and M. Akşit, editors. Aspect-Oriented Software Development. Addison-Wesley, Boston, 2005. CONCLUSION The paper discusses the intricate issues related to DbC for AOP. The dynamic nature of aspects along with the base system’s obliviousness render existing DbC methodologies inadequate for dealing with aspect-oriented programs. This inadequacy unavoidably leads to erroneous error reporting and blame assignment. An extension to DbC to address aspect-oriented programming requires more than simple assertion validation at each program execution point where aspect advice gets to execute. A DbC mechanism for AOP has to address both the execution order of contracts (on classes and aspects) as well as the implications (if any) that must be validated [8] R. E. Filman and D. P. Friedman. Aspect-oriented programming is quantification and obliviousness. In Filman et al. [7], pages 21–35. [9] R. B. Findler and M. Felleisen. Contract soundness for object-oriented languages. In Proceedings of the 16th Annual Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 1–15, Tampa Bay, Florida, Oct. 14-18 2001. OOPSLA’01, ACM SIGPLAN Notices 36(11) Nov. 2001. 10 [10] R. B. Findler and M. Felleisen. Contracts for higher-order functions. In International Conference on Functional Programming (ICFP’02), pages 48–59, October 2002. [22] B. Meyer. Applying design by contract. Computer, 25(10):40–51, Oct. 1992. [23] B. Meyer. EIFFEL the Language. Object-Oriented Series. Prentice-Hall, 1992. [11] M. Kersten and G. C. Murphy. Atlas: A case study in building a web-based learning environment using aspect-oriented programming. In Proceedings of the 14th Annual Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 340–352, Vancouver, BC, Canada, Oct. 18-22 1999. OOPSLA’99, ACM SIGPLAN Notices 34(10) Oct. 1999. [24] S. M. Omohundro. The Sather 1.0 specification. Technical Report TR-94-062, International Computer Science Institute, Berkeley, 1994. [25] M. Rinard, A. Salcianu, and S. Bugrara. A classification system and analysis for aspect-oriented programs. In Taylor and Dwyer [30], pages 147–158. [12] G. Kiczales, E. Hilsdale, J. Hugunin, M. Kersten, J. Palm, and W. G. Griswold. An overview of AspectJ. In J. L. Knudsen, editor, Proceedings of the 15th European Conference on Object-Oriented Programming, number 2072 in Lecture Notes in Computer Science, pages 327–353, Budapest, Hungary, June 18-22 2001. ECOOP 2001, Springer Verlag. [26] T. Skotiniotis. Cona Home Page, 2004. http://www.ccs.neu.edu/home/skotthe/cona/. [27] T. Skotiniotis and D. H. Lorenz. Cona: aspects for contracts and contracts for aspects. In J. M. Vlissides and D. C. Schmidt, editors, OOPSLA Companion, pages 196–197, Vancouver, BC, Canada, Oct. 24-28 2004. ACM. http://doi.acm.org/10.1145/1028664.1028747 [13] H. Klaeren, E. Pulvermüller, A. Rashid, and A. Speck. Aspect composition applying the design by contract principle. In Proceedings of the GCSE 2000, Second International Symposium on Generative and Component-Based Software Engineering, 2000, Oct 2000. [28] T. Skotiniotis and D. H. Lorenz. Conaj: Generating contracts as aspects. Technical Report NU-CCIS-04-03, College of Computer and Information Science, Northeastern University, Boston, MA 02115, Mar. 2004. [14] M. Kölling and J. Rosenberg. Blue: Language Specification, 1997. [29] T. Skotiniotis and D. H. Lorenz. From contracts to aspects and back. Technical Report NU-CCIS-04-05, College of Computer and Information Science, Northeastern University, Boston, MA 02115, Mar. 2004. [15] S. Krishnamurthi, K. Fisler, and M. Greenberg. Verifying aspect advice modularly. In Taylor and Dwyer [30], pages 137–146. [30] R. N. Taylor and M. B. Dwyer, editors. Proceedings of the 12th ACM SIGSOFT International Symposium on Foundations of Software Engineering, Newport Beach, CA, USA, 2004. ACM Press. [16] G. T. Leavens, C. Ruby, K. Rustan, M. Leino, E. Poll, and B. Jacobs. Jml: notations and tools supporting detailed design in java (poster session). In Proceedings of the 15th Annual Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 105–106, Minneapolis, Minnesota, Oct. 15-19 2000. OOPSLA’00, ACM SIGPLAN Notices. Also Department of Computer Science, Iowa State University, TR 00-15, August 2000. [31] J. Zhao and M. Rinard. Pipa: Behavioral Interface Specification Language for AspectJ. In Proceedings of Fundamental Approaches to Software Engineering (FASE’2003), pages 150–165, 2003. [17] K. Lieberherr, D. H. Lorenz, and P. Wu. A case for statically executable advice: Checking the Law of Demeter with AspectJ. In AOSD 2003 [1], pages 40–49. http://www.ccs.neu.edu/home/lorenz/papers/aosd2003lod/ [18] B. Liskov and J. Wing. A behavioral notion of subtyping. ACM Trans. Prog. Lang. Syst., 16(6):1811–1841, Nov. 1994. [19] C. Lopes, M. Lippert, and E. Hilsdale. Design by contract with aspect-oriented programming, 2002. U.S. Patent No. 06,442,750. Issued August 27,2002. [20] C. V. Lopes and G. Kiczales. Recent developments in AspectJ. In S. Demeyer and J. Bosch, editors, Object-Oriented Technology. ECOOP’98 Workshop Reader, number 1543 in Lecture Notes in Computer Science, pages 398–401. Workshop Proceedings, Brussels, Belgium, Springer Verlag, July 20-24 1998. [21] D. H. Lorenz and T. Skotiniotis. Contracts and aspects. Technical Report NU-CCIS-03-13, College of Computer and Information Science, Northeastern University, Boston, MA 02115, Dec. 2003. http://www.ccs.neu.edu/home/lorenz/papers/reports/NU-CCIS-03-13.html 11
6cs.PL
Car-following model on two lanes and stability analysis* Jia Yu-han(贾宇涵)a),†, Wu Jian-ping(吴建平)a), Du Yi-man(杜怡曼)a), Qi Ge-qi(奇格奇)a) a Department of Civil Engineering, Tsinghua University, 100084, Beijing, China Abstract: Considering lateral influence from adjacent lane, an improved car-following model is developed in this paper. Then linear and non-linear stability analyses are carried out. The modified Korteweg-de Vries (MKdV) equation is derived with the kink-antikink soliton solution. Numerical simulations are implemented and the result shows good consistency with theoretical study. Key words: car-following model; stability analysis; MKdV equation PACS numbers: 05.70.Fh, 05.70.Jk, 02.60.Cb, 89.40.-a Based on OVM, GFM and FVDM, many 1. Introduction new models have been established by considTraffic flow is a system of consecutive vehicles with interacting [1]. Recently various models have been developed, including general models, safety distance models, action point models, optimal velocity models (OVM), cellular automaton models and fuzzy logic models [2-5]. Among those models, OVM developed ering decentralized delayed-feedback control [11], delay time due to driver’s reaction [12], extended OV function for cooperative driving control system [13,14], acceleration difference [15], multiple velocity difference [16], optimal velocity difference [17], and control method [18]. by Bando et al. [6,7] is well known for its accuracy and rationality. Afterwards Helbing and Tilch [8] calibrated the OV model by experimental data and developed a generalized force model (GFM) to overcome the deficiencies. But both OVM and GFM cannot describe the phenomenon that the following vehicle may not decelerate when the leading vehicle is much faster even if the headway distance is smaller than safety distance. After this, a full velocity difference model (FVDM) was developed by Jiang et al. [9,10] to solve the disadvantage. To study traffic jam waves in OVM, Komatsu Sasa [19] firstly derived the modified Korteweg-de Vries (MKdV) equation to describe kink waves. Then Muramatsu and Nagatani [20] derived Korteweg-de Vries (KdV) equation from OVM to describe sliton waves in traffic jam, and Nagatani also found triangular shock wave solved Burgers equation [21]. From then many models have been analyzed by non-linear stability theory aforementioned. Nagatani [22] derived MKdV equation near critical point in two continuum models: partial * † Project funded by the National High Technology Research and Development Program of China (Grant NO. 2012AA063303) Corresponding Author: [email protected] differential and discrete lattice model. Xue et al. theory method. Based on previous work, this [23,24] presented a simplified OVM consider- paper investigates a new car-following model ing relative velocity and derived KdV and considering lateral influence by introducing the MKdV equations. Ge et al. developed several combination of two OV functions. In section 2 intelligent transportation system (ITS) based the new model is developed and linear stability models with KdV and MKdV analysis [25,26] analysis is carried out in section 3. In section 4 and also did similar research in three OVM the MKdV equation is derived to obtain based models [27]. Yu [28] recently build a kink-antikink soliton solution. Then numerical two-delay model with MKdV investigation and simulation experiments are performed to verify implemented numerical simulations. More the theoretical study in section 5. The summary studies show that the triangular wave, soliton is given in section 6. wave and kink wave occur in stable region, metastable region and unstable region, respec- 2. Improved OVM The typical OVM is presented as [6,7] tively [21,29,30]. d 2 xn (t )   [V op (xn (t ))  vn (t )] , dt 2 However, only a few researches focused on (1) car-following with lateral impact, in which case where xn (t ) and vn (t ) are the position and the lateral influence from adjacent lane should velocity of the nth vehicle; xn (t ) is the be considered. Nagatani [31] presented two lat- headway distance between the nth and its lead- tice models to simulate traffic flow wave on a ing vehicle;  is the sensitivity parameter of two-lane highway with lane changing. Tang et the driver; V op ( ) is the optimal velocity func- al. [32] studied the stability of a two-lane OVM tion described as [6] based model with MKdV analysis by defining a V op (xn (t ))  weighted headway distance. Peng [33]. Jin et al. vmax [tanh(xn (t )  hc )  tanh(hc )] , (2) 2 [34] considered the lane-width influence and where vmax is the maximum velocity on a par- developed a non-lane-based FVDM with simu- ticular roadway; hc means the safety headway lation experiments. Ge et al. [35,36] studied the distance. influence from neighbor vehicle or non-motor vehicle by considering two more OV functions and analyzed the stability condition by control However, as noticed in the study on roadway, a driver usually focuses not only the lead- ing vehicle on the present lane, but also the vehicle on adjacent lane, especially when the neighbor vehicle decelerates. This phenomenon The new model can be expressed as d 2 xn (t )   [ pV op (xn (t ))  qV op (xl , n (t )) dt 2  vn (t )]  1vn (t )  2 vl , n (t ), (5) occurs because of the potential action of lane changing or the avoidance of collision when the where p and q are the weights of the two OV lane width is small [32]. Hence the lateral in- functions; 1 and 2 are the weights of ve- fluence should be considered in car-following locity difference. model even if lane changing does not occur. 3. Linear stability analysis It is assumed that the driver makes his decision upon the combination impact of leading vehicle and neighbor vehicle by introducing a According to linear stability analysis method [7,16], stable condition of the uniform traffic flow is given by second OV function, which can be defined as V op (xl , n 1 (t )),  V op (ln (t ))    0, lv xl , n 1 (t )  d others , (3) where xl ,n 1 (t ) is the headway distance between the nth vehicle and its leading vehicle on (0) op   xn (t )  nhc  V (h)t .  (0) op   xl , n (t )  nhc  V (h)t (6) Let yn (t ) and yl ,n (t ) be small deviations from xn(0) (t ) and xl(0),n (t ) as xn (t )  x(0) (t )  yn (t ) the adjacent lane, lv is the length of a normal and xl ,n (t )  xl(0) (t )  yl ,n (t ) . The linearized equa- vehicle and d is a preset constant. tion can be obtained: Referring to previous study [8,9], vn (t ) and vl , n (t ) are introduced, where vn (t )  vn 1 (t )  vn (t ) and vl , n (t ) can be given as d 2 yn (t )   [ pV (x (0) )y (t )  qV (xl(0) )yl (t ) dt 2  vn (t )] 1vn (t )  2 vln (t ), (7) where V  and V  are the derivatives of OV function V op (xn (t )) and V op (ln (t )) . Expanding vl , n (t )  vn (t ), vl , n (t )   0, lv xl , n 1 (t )  d others , (4) yn (t )  exp(ikn  zt ) and yl , n (t )  exp(ikn  zt ) , Eq. (7) can be rewritten as in which vl , n (t ) is the velocity of the leading z 2  [a  (1  2 )(eik  1)]z  vehicle on adjacent lane. a( pV   qV )(eik  1)  0 . (8) FIG.1. Headway-sensitivity space for (a) and (b): p=1, q=0; (c) and (d): p=0.8, q=0.2. Then expand z by the order of ik at the point Parameters are set as vmax  4m / s , hc  7m , p=1 of ik  0 as z  z1ik  z2 (ik )2  and insert it and q=0 in Fig. 1(a), while p=0.8 and q=0.2 in into Eq. (8). The following terms can be ob- Fig. 1(c). As can be seen, the unstable region is tained: smaller considering influence from adjacent  z1  pV   qV    1 1  2 ( pV   qV ) 2 , (9) )( pV   qV )   z2  (  2 a a  lane [31]. 4. Non-linear stability analysis For the convenience of non-linear analysis, According to previous study, the vehicle system is stable when z2  0 , which is a  2( pV   qV )  2(1  2 ) , (10) and the neutral stability condition has the following form: ac  2( pV   qV )  2(1  2 ) . (11) The stability surface is described in Fig. 1. Eq. (5) is rewritten as d 2 xn (t )  dt 2  [ pV (xn 1 (t ))  pV (xn (t ))  qV (xl , n 1 (t )) d xn (t ) d xn 1 (t ) ]  1 dt dt d xl , n 1 (t ) d xl , n (t ) d xn (t ) 1  2  2 , dt dt dt qV (xl , n (t ))  (12) MKdV equation is obtained in unstable (a  31  32 )( pV   qV ) , 6a region around the critical point (hc , ac ) , where m1  V   0 . m2   By the analysis method in [18-20], the long wave expansion is applied in this section. Two slow scales for space variable n and time variable t are introduced. We define slow vari- m3  m4  ables X and T as X   (n  bt ) , T   3t , (13) where b is a constant determined later and   ac a  1 . ( pV   qV ) , 2 4(2 pV   2qV   1  2 )(a  31  32 ) 24a 2 , a  4(1  2 )  ( pV   qV )  ( pV   qV ) 24a 2(2 pV   2qV   1  2 )  a ( pV   qV ) . 12a In order to have standard MKdV equation, the following transformations are made Headways for two lanes are set as  xn (t )  hc   R( X , T ) ,   xl , n (t )  hc   R( X , T ) T (14) Expand Eq. (12) to the fifth order of  , 1 Tm , R  m1 m1 Rm . m2 a ( pV   qV ) 2   a ( pV  qV ) (1  2 )b] 2X R   4 [aT R   3X R 6 (  2 )b 3 a ( pV   qV )  1 X R   X R3 ] (15) 2 6 a ( pV   qV ) 4  5 [(2b  1  2 ) X T R  X R 24 (  2 )b 4 a ( pV   qV ) 2 3  1 X R   X R ]  0. 6 12  2 [ab  a( pV   qV )] X R   3 [b 2  It is noticed that the  X T R in the sixth order term of Eq. (15) can be eliminated by taking the derivative of X in the fifth order term. Then insert b  pV   qV  and ac a  1   2 into Eq. (15), that is [T R  m  R  m2  X R ]   [m3 R  m4  R 3 1 X  m5  2X R3 ]  0, 3 2 X 4 X (16) (17) Then Eq. (16) can be rewritten as [Tm Rm   3X Rm   X Rm3 ]  then gives where m5  ( pV   qV ) , 6  m4  4X Rm   m1 [m3  2X Rm m1m5 2 3  X Rm ]  0. m2 (18) Ignoring the ( ) term, we have MKdV equation with a kink-antikink soliton solution expressed as Rm 0 ( X , Tm )  B tanh[ B ( X  BTm )] . 2 (19) To determine the value of amplitude B , the solvable condition is considered:  ( Rm0 , M [ Rm0 ])  R m0 M [ Rm0 ]dX  0 , (20)  where M [ Rm0 ] means the ( ) term in Eq. (18). By performing the integration of Eq. (20), the value of amplitude B can be obtained: B 5m2 m3 . 2m2 m4  3m1m5 (21) FIG.2. Space-time evolution of headway for lane1 in (a), lane2 in (b) and headway profile of traffic wave at t=950s for lane1 in (c), lane2 in (d). (a=2.85, p=1, q=0.) The kink-antikink soliton solution of headway can be written as follows xn  hc  (  tanh{ ( ( ac 5m1m3  1)( ) a 2m2 m4  3m1m5 ac 5m2 m3  1) [n  ( pV   qV )t (22) a 4m2 m4  6m1m5 ac 5m2 m3t  1) ]}. a 2m2 m4  3m1m5 With the amplitude of Eq. (22), we have coexisting surface and stability surface and unstable region below stability surface. 5. Numerical simulation Consider a two lane system with 100 vehicles running on each lane under a periodic boundary condition without overtaking or lane changing [31]. The initial values are vmax =4m/s, the coexisting surface in Fig. 1(b) and (d) based on (a) and (c), respectively. The space is divided into three regions: stable region above the coexisting surface, metastable region between hc =7m and d=10 on both lanes. Perturbations are defined as follows: FIG.3. Space-time evolution of headway for lane1 in (a), lane2 in (b) and headway profile of traffic wave at t=950s for lane1 in (c), lane2 in (d). (a=2.85, p=0.8, q=0.2) x (0)  7m  0.1m for lane1,  n xn (0)  7m x (0)  7m  0.3m for lane2,  n xn (0)  7m 45  n  50 others 45  n  50 others ; on both lanes. Furthermore, the traffic jam is more serious in lane2 because of the larger initial headway perturbation. . Then suppose a=2.85, p=0.8, q=0.2, First let a=2.85, p=1, q=0, 1 =0.2 and 1 =0.16 and 2 =0.04. Figure 3 describes the 2 =0, which cannot satisfy the stable condition space-time evolution of headway and the in Eq. (10). Figure 2 shows the space-time evolution of headway for lane1 in (a) and lane2 in (b) from 900s to 1000s. The headway profiles of traffic wave at t=950s are in (c) for lane1 and (d) for lane2. It is observed that the small perturbation propagates into traffic jam headway profiles of traffic wave at t=950s corresponding to Fig. 2. The initial perturbation decays after sufficient time on both lanes. Thus the consideration of lateral impact from adjacent lane can suppress traffic jam. The amplitude of traffic wave in lane2 is also larger. FIG.4. Space-time evolution of headway for lane1 in (a), lane2 in (b) and headway profile of traffic wave at t=950s for lane1 in (c), lane2 in (d). (a=2.2, p=0.8, q=0.2) Finally when a=2.2, p=0.8, q=0.2, In this paper, a new car-following model is 1 =0.16 and 2 =0.04, on which situation the proposed considering the lateral influence from system is more unstable, we find serious kink-antikink waves on both lanes in Fig. 4. Unlike Fig. 2 or Fig. 3, there is no significant difference between the two lanes, because all the vehicles get influenced heavily by lateral impact. By simulation, the theoretical analysis of MKdV solution can be described. adjacent lane. Both linear and non-linear stability analyses are carried out, from which MKdV equation is obtained. Numerical simulations show that the new model has good consistency with theoretical study. However, when satisfied the unstable condition, both lanes will have serious traffic jam of same level despite different initial headway perturbation. In conclusion, 6. Conclusions considering lateral impact indeed has influence on car-following behavior and can keep the vehicle system more stable. References: [1] Nagatani T 2002 Rep. Prog. Phys. 65 1331 [2] Helbing D 2001 Rev. Mod. Phys. 73 1067 [3] Brackstone M and McDonald M 1999 Transp. Res. F. 2 181 [4] Wu J P, Brackstone M and McDonald M 2003 Transp. Res. C. 11 463 [5] Papageorgiou M 1998 Transp. Res. A. 32 323 [6] Bando M, Hasebe K, Nakayama A, Shibata A and Sugiyama Y 1995 Phys. Rev. E. 51 1035 [7] Bando M, Hasebe K, Nakayama A, Shibata A and Sugiyama Y 1998 Phys. Rev. E. 58 5429 [8] Helbing D and Tilch B 1998 Phys. Rev. E. 58 133 [9] Jiang R, Wu Q S and Zhu Z J 2001 Phys. Rev. E. 64 017101 [10] Jiang R, Wu Q S and Zhu Z J 2002 Transp. Res. B. 36 405 [11] Konishi K, Kokame H and Hirata K 2000 Eur. Phys. J. B. 15 715 [12] Davis L C 2003 Physica A. 319 557 [13] Hasebe K, Nakayama A and Sugiyama Y 2003 Phys. Rev. E. 68 026102 [14] Hasebe K, Nakayama A and Sugiyama Y 2004 Phys. Rev. E. 69 017103 [15] Zhao X and Gao Z 2005 Eur. Phys. J. B. 47 145 [16] Wang T, Gao Z Y and Zhao X M 2006 Acta. Phys. Sin. 55 634 (in Chinese) [17] Peng G H, Cai X H, Liu C Q, Cao B F and Tuo M X 2011 Phys. Lett. A. 375 3973 [18] Cheng R J, Han X L, Lo S M and Ge H X 2014 Chin. Phys. B. 23 030507 [19] Komatsu T S and Sasa S I 1995 Phys. Rev. E. 52 5574 [20] Muramatsu M and Nagatani T 1999 Phys. Rev. E. 60 180 [21] Nagatani T 2000 Phys. Rev. E. 61 3564 [22] Nagatani T 1998 Physica A. 261 599 [23] Xue Y, Dong L Y, Yuan Y W and Dai S Q 2002 Acta. Phys. Sin. 51 492 (in Chinese) [24] Xue Y 2002 Chin. Phys. 11 1128 [25] Ge H X, Dai S Q, Dong L Y and Xue Y 2004 Phys. Rev. E. 70 066134 [26] Ge H X, Cheng R J and Li Z P 2008 Physica A. 387 5239 [27] Ge H X, Cheng R J and Dai S Q 2005 Physica A. 357 466 [28] Yu L, Shi Z K and Li T 2014 Phys. Lett. A. 378 348 [29] Nagatani T, Nakanishi K and Emmerich H 1998 J. Phys. A. 31 5431 [30] Ou Z H, Dai S Q and Dong L Y 2006 J. Phys. A. 39 1251 [31] Nagatani T 1999 Physica A. 265 297 [32] Tang T Q, Huang H J and Gao Z Y 2005 Phys. Rev. E. 72 066124 [33] Peng G H, Sun D H and He H P 2009 Chin. Phys. B. 18 468 [34] Jin S, Wang D, Tao P F and Li P F 2010 Physica A. 389 4654 [35] Ge H X, Meng X P, Ma J and Lo S M 2012 Phys. Lett. A. 377 9 [36] Zheng Y Z, Zheng P J and Ge H X 2014 Chin. Phys. B. 23 020503
5cs.CE
arXiv:1704.02315v1 [cs.DS] 7 Apr 2017 Much Faster Algorithms for Matrix Scaling Zeyuan Allen-Zhu [email protected] Institute for Advanced Study Yuanzhi Li [email protected] Princeton University Rafael Oliveira [email protected] Princeton University Avi Wigderson [email protected] Institute for Advanced Study April 7, 2017 Abstract We develop several efficient algorithms for the classical Matrix Scaling problem, which is used in many diverse areas, from preconditioning linear systems to approximation of the permanent. On an input n × n matrix A, this problem asks to find diagonal (scaling) matrices X and Y (if they exist), so that XAY ε-approximates a doubly stochastic matrix, or more generally a matrix with prescribed row and column sums. We address the general scaling problem as well as some important special cases. In particular, if A has m nonzero entries, and if there exist X and Y with polynomially large entries such that e + n4/3 ). This XAY is doubly stochastic, then we can solve the problem in total complexity O(m 4 e greatly improves on the best known previous results, which were either O(n ) or O(mn1/2 /ε). Our algorithms are based on tailor-made first and second order techniques, combined with other recent advances in continuous optimization, which may be of independent interest for solving similar problems. 1 Introduction The matrix scaling problem is natural and simple to describe. Given a non-negative real matrix A, can one scale its rows and columns (namely multiply each by a non-negative constant) to yield prescribed row sums and column sums. Note that the number of constraints is the same as the number of degrees of freedom; however, what makes it interesting (beyond the many applications that we detail below) is that the constraints are additive while the scalings are multiplicative. Taking real non-negative entries and computing the row and column sums actually captures a much more general problem: one can allow A to have complex entries and require the `p norms of rows and columns, after scaling, to equal prescribed values.1 For non-negative d × n matrix A, we say A is an (r, c)-matrix if r and c are respectively the vectors of row and column sums of A. Given vectors r and c, the problem of matrix (r, c)-scaling is to find diagonal matrices X and Y for which the matrix XAY is an (r, c)-matrix. When d = n and r = c = 1 ∈ Rn where 1 is the all-one vector, the matrix (1, 1)-scaling problem becomes the doubly stochastic scaling problem. While the above exact scaling problem is of interest, its asymptotic version is even more so, both from the algorithmic viewpoint and from the structural one, as it captures natural combinatorial 1 The simple reduction replaces any entry α in the matrix by |α|p . 1 problems. We say that A is asymptotically (r, c)-scalable if the row and column sums can reach r and c asymptotically: that is, for every  > 0, there exist positive diagonal matrices X, Y such that, letting B = XAY , we have kB1 − rk ≤ ε and k1> B − ck ≤ ε.2 The combinatorial essence of asymptotic scaling follows from a well-known characterization (see Proposition 2.2). A matrix A is asymptotically (1, 1)-scalable if and only if the permanent of A is positive, namely if the bipartite graph defined by the positive entries in A has a perfect matching. A matrix A is asymptotically (r, c)-scalable if and only if a natural flow on the same bipartite graph3 has a solution. Duality (Hall’s theorem and max-flow-min-cut theorem) gives simple certificates of non-scalability in terms of the patterns of 0’s in the matrix A. The main computational problem we study is: given a matrix A, vectors r, c and ε > 0, determine if A is ε-approximately (r, c) scalable, and if so, find the scaling matrices X, Y . Before diving into the history of matrix scaling, we explain one of its most basic applications, which also demonstrates its algorithmic importance. Preconditioning Linear Systems. When solving a linear system Az = b, it is often desirable —for numerical stability and efficiency purposes— to have matrix A be well-conditioned. When this is not the case, one tries to transform A into a “better conditioned” matrix A0 . Matrix scaling provides a natural and efficient reduction to do so. For instance, one would hope that a scaled matrix A0 , in which e.g. all row and column p-norms are (say) 1, is better conditioned.4 For this reason, we can use a matrix scaling algorithm to obtain diagonal matrices X, Y , and define A0 = XAY . Now, the solution to Az = b can be obtained by solving the (hopefully more numerically stable) linear system A0 z 0 = Xb and setting z = Y −1 z 0 . We stress here that A0 and A have the same sparsity. 1.1 History and Prior Work The matrix (r, c)-scaling problem is so natural and important that it was discovered independently by many different scientific communities, starting in 1937 with the work of Kruithof [20] in telephone forecasting, Deming and Stephan [10] in transportation science, Brown [8] in engineering, Stone [36] in economics, Wilkinson [37] in numerical analysis, and Friedlander [11] and Sinkhorn [34] in statistics. It has been applied in image reconstruction [14], operations research [30, 33], decision and control [5], theoretical computer science [22], and other scientific disciplines. For more references, we refer the reader to the survey [15], the paper [33] and references therein. Perhaps the most famous algorithm for solving matrix (r, c)-scaling is the RAS method [34]. 5 The RAS method alternatively applies row and column normalization, where in a row (resp. −1 −1 P P column) normalization we multiply each Ai,j by ri · (resp. by cj · ). j Aij i Aij In the original paper, Sinkhorn [34] only proved the convergence of the RAS method when A has only strictly positive entries and when r = c = 1. The best known complexity result for the RAS method is given by Kalantari et al. [16]. In particular, they showed that if the entries of A are 2 ) iterations6 for (1, 1)-scaling, e polynomially bounded, then the RAS method converges in O(n/ε e 2 /ε2 ) iterations for (r, c)-scaling, where r and c are integral vectors and h def or in O(h = krk1 = kck1 . Kalantari et al. also analyzed the RAS method when A is strictly positive in all n2 entries, or is 2 The choice of norm in these expressions is not too important, and can be take to be `2 . Connect the source to the row vertex i with capacity ri , and the column vertex j to the sink with capacity cj . 4 This indeed is widely use in practice (see [9, 29]), and indeed tends to numerically stabilize systems (see [7, 23, 29]), although no theoretical bounds are known (see [? ]). 5 Also known as the Sinkhorn process, discovered by Sinkhorn in 1964 [34]. The RAS method fits as an instance of the “alternate minimization” heuristic, of which this is one of the few known instances in which it converges quickly. 6 Each iteration of the RAS method costs complexity O(m), the number of non-zero entries in A. 3 2 Subcase full positive matrix scaling factors poly bounded Paper Total Complexity e 2 n1/2 /ε) RAS method [17, 1993] O(n Scaling0 Scaling1 or Scaling3 [ e 2 n1/3 /ε2/3 ) O(n e 2) O(n 1/2 e RAS method [16, 2008] O(mn /ε) Scaling0 Scaling1 Scaling2+Scaling3 [ 1/3 e O(mn /ε2/3 ) e O(m +n 3/2 e O(m +n 4/3 ) general interior point [5, 2004] max flow [32, 2007] Scaling1 Scaling0+Scaling3 Table 1: (1, 1)-scaling. [ scaling factors poly bounded 2/3 e O(mn/ε ) [ [ e 6) O(n general [ e O(mn +n 5/2 e O(mn +n 7/3 e 2 h1/2 /ε) RAS method [16, 2008] O(n Scaling0 Scaling1 Scaling0 Scaling1 e 2 h1/3 /ε2/3 ) O(n e 2) O(n e O(m +n e O(m +h ellipsoid [18, 1996] max flow [32, 2007] [ Scaling1 ) Scaling0+Scaling3 Table 2: (r, c)-scaling. e to hide log factors in n and 1/ε. • We use O • Scaling0 is a simple method just like RAS; • Scaling1, Scaling2, and Scaling3 use Laplacian system solvers and graph sparsification. • [ indicates the complexity is outperformed. 3/2 ) 1/2 n5/6 ) 2/3 1/3 e O(mn h /ε2/3 ) e 4) O(n [ 4 e ) ≥ Ω(mn e O(mn +n [ 5/2 ) 7 3 1 1 e O(mn + n + mn 3 h 2 ) Our Improvements Over Known Results We propose four algorithms to tackle the general matrix scaling problem and also some special cases. In all cases, we have outperformed all relevant previous results, and in some cases our complexities are close to linear in terms of the input size. To state our complexity bounds let us discuss the input conventions we use. We denote by m the number of nonzero entries of A, and assume m ≥ n ≥ d. We assume all entries of A are rational numbers with polynomial sizes (i.e., at most poly(n) in numerators and denominators9 ), and both def r and c are positive integral vectors with entries at most poly(n). Let h = krk1 = kck1 ≥ n.  1  That is, A can be (r, c)-scaled with diagonal scaling matrices X, Y where each Xi,i and Yj,j are in poly(n) , poly(n) . 8 e Ω e and Θ e notions to hide polylogarithmic factors in n and 1/ε. Throughout the paper, we use O, 9 More generally, the complexities scale linear with the bit-size of the matrix entries. 3 [ [ e 6) O(n • Following [16], we assume r and c are positive integral vectors and h = krk1 = kck1 . Obviously h ≥ n. • Since the complexity of maximum flow is at least Ω(m), we present a complexity lower bound to [32]. 7 [ [ exactly (r, c)-scalable with polynomial scaling factors.7 We summarize them in Table 1 and 2. Other algorithmic approaches were also developed for matrix scaling. The results [12, 24, 25, 33] proved asymptotic convergence without giving complexity bounds. Kalantari and Khachiyan [18] used the ellipsoid method, obtaining the first poly-logarithmic dependence on the approximation e 4 ).8 Balakrishnan [5] used interior point method and obparameter ε, with total complexity O(n e 6 ). Rote and Zachariasen [32] reduced the (r, c)-scaling problem to tained a total complexity O(n 4 e running O(n ) instances of mincost maximum flow. Linial et al. [22] proposed the first strongly e 7 ). polynomial algorithm with a total complexity O(n 1.2 [ [ 1/3 e O(mh /ε2/3 ) 5 e LSW method [22, 1998] O(mn ) interior point [5, 2004] [ ) [ 1/2 e RAS method [16, 2008] O(mh /ε) Scaling0 e 4) O(n Total Complexity 2 e RAS method [16, 2008] O(mh /ε2 ) [ 4 e ) ≥ Ω(mn Paper Scaling2+Scaling3 5 e LSW method [22, 1998] O(mn ) ellipsoid [18, 1996] [ full positive matrix ) 2 e RAS method [16, 2008] O(mn/ε ) Scaling0 [ Subcase A complete listing of our results appear in Table 1 and Table 2. Our Scaling0 can be viewed as an accelerated version of RAS. Its total complexity is 2/3 2/3 1/3 2/3 e e O(mn/ε ) for the (1, 1)-scaling, or O(mn h /ε ) for the general (r, c)-scaling. This improves the best result of RAS by a factor ε−4/3 for (1, 1)-scaling, and a factor h5/3 n−2/3 ε−4/3 ≥ nε−4/3 for (r, c)-scaling. We stress that even testing scalability requires ε < 1/n (see [22]) so reducing the ε dependency from ε−2 to ε−2/3 (and later to polylog(1/ε)) is very meaningful. In the polylog(1/ε) complexity regimes, our Scaling1 and Scaling3 have complexities  e e mn + min{n5/2 , n7/3 + mn1/3 h1/2 } for (r, c)-scaling. O(mn + n7/3 ) for (1, 1)-scaling, or O If A is (r, c)-scalable with polynomially large scaling factors,10 our complexities reduce to e e O(m + n4/3 ) for (1, 1)-scaling, or O(m + min{n3/2 , h1/2 n5/6 }) for (r, c)-scaling. Our Approaches. We have four algorithms Scaling0, Scaling1, Scaling2, and Scaling3, all based on tailor-made first and second-order techniques in continuous optimization. We also combine graph sparsification, Laplacian linear system solvers, and multiplicative weight updates into the optimization process. We now elaborate more on how this is done. Matrix scaling can be written (in several ways) as the solution to convex optimization problems. We focus on a specific convex objective in this paper, which is the log of the capacity function [13]:  P def P xj − c> x . (1.1) f (x) = di=1 ri log j∈[n] Ai,j e If A is asymptotically scalable, then the (approximate) minimizer of f (x) corresponds to scaling matrices X, Y such that XAY is an ε-approximate (r, c)-matrix (see Proposition 2.3). A similar objective was also studied by Kalantari et al. [16]. At a high level, Scaling0 uses first-order optimization techniques to minimize f (x), and all other methods Scaling1, Scaling2, and Scaling3 use a mixture of first and second order techniques. First-Order Framework. It was known that the RAS method can be viewed as a first-order method [16], but only with convergence rate 1/ε2 . Since f (x) is not Lipschitz smooth (i.e., ∇2 f (x) does not have a bounded spectral norm), one cannot apply generic optimization methods. We propose first-order building blocks that are specific to the matrix scaling problem, and then use the linear coupling framework of [4] to combine gradient and mirror descent, in order to achieve the 1/ε2/3 convergence rate. We call this method Scaling0 and it outperforms the RAS method in all relevant parameter regimes. Note that Scaling0 is as simple to implement as the RAS method. Second-Order Framework. It turns out the Hessian ∇2 f (x) is always Laplacian, so one can invert it efficiently using modern SDD linear system solvers and graph sparsification techniques. This gives hope for designing efficient second-order methods. Unfortunately, f (x) is not selfconcordant in the entire space so we cannot apply standard second-order methods (e.g. Newton method). Instead, we show f (x) satisfies a special property: the second-order Taylor approximation of f (x + δ) at point x is accurate for all vector δ with kδk∞ ≤ 1/8: f (x) + h∇f (x), δi + 61 δ > ∇2 f (x)δ ≤ f (x + δ) ≤ f (x) + h∇f (x), δi + δ > ∇2 f (x)δ . This implies if we can repeatedly minimize f (x) + h∇f (x), δi + 61 δ > ∇2 f (x)δ 10 over an `∞ constraint on δ, (1.2) Namely, when can be scaled  A  to an (r, c) matrix with diagonal scaling matrices X, Y that satisfying  1each Xi,i and  1 , poly(n) . This condition is satisfied at least when all entries of A are within poly(n) , poly(n) . Yj,j are within poly(n) 4 and update x ← x + 16 δ, then we can have an log(1/ε) convergence rate as opposed to 1/poly(ε). Our Scaling1 algorithm uses multiplicative weight update to solve (1.2), our Scaling2 algorithm uses accelerated gradient descent to solve (1.2), and our final and most involved algorithm Scaling3 uses more advanced multiplicative weight update in combination with first-order techniques to solve (1.2). We remark here that Scaling3 needs a warm-start, that is, a point x where f (x) − inf x {f (x)} is sufficiently small. We use Scaling0 or Scaling2 to find such a warm-start. A Parallel Work. When preparing this paper we found out that Aleksander Madry and his students obtained similar results for the same problem. The two works are completely independent, except on a psychological level.11 A Related Problem. In the matrix balancing problem, a symmetric matrix B ∈ Rn×n is `p balanced if the `p -norm of its i-th row equals that of its i-th column, for every i ∈ [n]. Given any A ∈ Rn×n , we wish to find a diagonal matrix D with positive diagonal entries, such that B = DAD−1 is `p -balanced. Our techniques in this paper can also be extended to matrix balancing. 1.3 Roadmap In Section 2, we discuss preliminaries. In Section 3, we show diameter bounds for the scaling parameters. In Section 4, we present our first-order framework and algorithm Scaling0. In Section 5, we present our second-order framework. In Section 6, 7, and 8 respectively, we introduce our algorithms Scaling1, Scaling2, and Scaling3. Throughout this paper, we assume exact arithmetic operations for presenting the cleanest proofs; we discuss how to use logarithmic bit-length to implement our algorithms in Section 9. Most of the proofs are in the appendix. 2 Notations and Preliminaries Throughout the paper, we denote by kvkp the p-norm of vector v if p ∈ [1, +∞], and kvk the  Pn def 2 1/2 the Euclidean norm of v when it is clear from the context. We denote by kvkw = i=1 wi vi w-normalized Euclidean norm of vector v if w is a positive vector. We denote by kvkA = (v > Av)1/2 the matrix-Euclidean norm. We denote by ev = (evi )i , log(v) = (log vi )i , and v −1 = (vi−1 )i the component-wise exponentiation, logarithm, and inversion for vector v. Given vectors u, v, we denote by u ≤ v the relationship that ui ≤ vi for all coordinates i. Given symmetric matrices M and N, we write M  N if N − M is positive semidefinite (PSD). WePsay a matrix M is Laplacian if (1) P M is symmetric, 2(2) Mi,j ≤ 0 for i 6= j, and (3) Mi,i = − j6=i Mi,j . It satisfies v > Mv = i<j |Mi,j |(vi − vj ) for every vector v. We say a matrix P M is symmetric diagonally dominant (or SDD for short) if (1) M is symmetric and (2) Mi,i ≥ j6=i |Mi,j |. Obviously, a Laplacian matrix is SDD; and an SDD matrix is PSD. Throughout this paper, A ∈ Rd×n ≥0 is non-negative and of dimensions d × n. We denote by m the number of non-zero entries of A. Without loss of generality, we assume d ≤ n ≤ m and the maximum entry of each row of A is exactly 1. We denote by  Ai the i-th row vector of A. 1 We assume all the positive entries of A are in the range poly(n) , 1 . We also assume r ∈ Rd>0 and def c ∈ Rn>0 are positive integral vectors and each ri , cj ∈ {1, 2, . . . , poly(n)}.12 We let h = krk1 = kck1 . 0 d 0 d Definition 2.1. Given r ∈ Rd>0 , c ∈ Rn>0 and A ∈ Rd×n ≥0 , and denote by r ∈ R≥0 (resp. c ∈ R≥0 ) the vector of row sums (resp. column sums) of A. We say 11 At the time we heard of their work, our bound was O(mn1/3 ). They told us that they believed they could obtain O(m + n4/3 ), which undoubtedly pushed us to discover that our techniques actually yield the same bound as well. 12 This assumption was also made for instance by Kalantari et al. [16]. 5 • A is an (r, c)-matrix if r = r0 and c = c0 . • A is an ε-approximate (r, c)-matrix if r0 = r and kc0 − ck2c−1 = P −1 0 j∈[n] cj (cj − cj )2 ≤ ε2 .13 • A is (r, c)-scalable if there exists positive diagonal matrices X, Y so XAY is an (r, c)-matrix. • A is asymptotically (r, c)-scalable if for every ε > 0, there exists positive diagonal matrices X, Y so that XAY is an ε-approximate (r, c)-matrix. It is known that the existence of (r, c)-scaling can be characterized by the following proposition. d×n Proposition 2.2 ([33]). A non-negative matrix A ∈ R≥0 is exactly (r, c)-scalable if and only if krk1 = kck1 and for every zero minor R × C ⊆ [d] × [n] of A, P P P P 1. i∈[d]\R ri ≥ j∈C cj or equivalently i∈R ri ≤ j∈[n]\C cj . 2. Equality in 1 holds iff the minor ([d] \ R) × ([d] \ C) is all zero as well. A nonnegative matrix A is asymptotically (r, c)-scalable if condition 1 holds. Proposition 2.3. Our objective f (x) in (1.1) is convex and P rA • ∇j f (x) = di=1 hAi i ,ei,jx i exj − cj . r A ·exj  • If k∇f (x)k2c−1 ≤ ε, then ihAi,j is an ε-approximate (r, c)-matrix. x i,j i ,e i • If A is exactly (r, c)-scalable, then there exists x∗ so that f (x∗ ) = minx {f (x)} and ∇f (x∗ ) = 0. • If A is asymptotically (r, c)-scalable, then inf x {f (x)} > −∞. • A is not asymptotically (r, c)-scalable if and only if inf x {f (x)} = −∞. 3 New Bounds on Scaling Parameters We first recall a few bounds for (r, c)-scalable matrices that are essentially from prior work. Lemma 3.1 (objective bound). For every x satisfying kxk∞ ≤ N , we have f (0) − f (x) ≤ 2hN . Proof of Lemma 3.1. Denoting x0 = x + kxk∞ 1, we know that f (x0 ) = f (x) and kx0 k∞ ≤ 2kxk∞ . 0 On the other hand, since for every i ∈ [d], we have hAi , ex i ≥ hAi , 1i ≥ 1, it satisfies f (0) − f (x0 ) ≤ c> x0 ≤ 2hN .  Lemma 3.2 (diameter bound). If A is exactly (r, c) scalable, and all non-zero entries of A are within [ν, 1] for some ν > 0. Then, the following holds: 1. If A is full then there exists a minimizer x∗ of f (x) such that kx∗ k∞ ≤ ln hn ν . 2. If A is not full, then there exists a minimizer x∗ of f (x) such that kx∗ k∞ ≤ (h + 1/2) ln hν . In this paper, we improve (the second item of) Lemma 3.2 in two aspects. First, we allow A to e e be asymptotically (r, c)-scalable. Second, we improve the diameter bound from O(h) to O(n) for arbitrary (r, c). (Recall that r and c are integral so h ≥ n.) Lemma 3.3 (diameter bounds for the asymptotic case). If A is asymptotically (r, c)-scalable, and all non-zero entries of A are within [ν, 1] for some ν > 0, then, for every ε > 0, there exists x∗ε ∈ Rn such that   ∗ )k ∗ ) − inf , k∇f (x ≤ ε , and f (x f (x) ≤ ε . kx∗ε k∞ = O n ln nh ∞ x ε ε νε In certain literature people have also used kc0 − ck22 ≤ ε2 as the definition of ε-approximation [16]. However, their performance loses a factor of kck∞ so we used this k · kc−1 notation to simplify our and their statements. 13 6 One can verify that Lemma 3.3 is tight (up to constant factors) for instance when A is a square upper-triangular matrix and the diagonal of A equals r = c. 4 A New First-Order Framework In this section, we minimize f (x) using a specially designed first-order optimization method, and finds an ε-approximate (r, c)-scaling with a total complexity that scales with ε−2/3 . High-Level Intuition. We first illustrate why the convergence rate ε−2/3 is reasonable from an optimization standpoint. Recall that if we are given a convex function g(x) that is O(1)-Lipschitz smooth —meaning that its Hessian ∇2 g(x) has a bounded spectral norm— then, using accelerated kx∗ k2  gradient descent [26, 27], one can find a point x1 satisfying g(x1 )−g(x∗ ) ≤ O T 2 2 in T iterations, where x∗ is a minimizer of g(x). At the same time, also recall that each step of gradient descent x0 = x−∇g(x) decreases the objective by at least g(x)−g(x0 ) ≥ 21 k∇g(x)k22 , so we can apply another kx∗ k2  T steps of gradient descent on top of x1 , and obtain a point x2 satisfying k∇g(x2 )k22 ≤ O T 3 2 . In other words, we reach x2 with k∇g(x2 )k22 ≤ ε2 in T ∝ ε−2/3 iterations. Unfortunately, the function f (x) we are dealing in this paper is not Lipschitz smooth, so we cannot apply the above approach. This is also why previous results using first-order techniques only achieve 1/ε2 rate in general and 1/ε rate in some special cases (see Table 1 and 2).14 Instead, we use the linear-coupling framework of [4] to recover this ε−2/3 convergence rate without using smoothness. To apply linear coupling, we need to design (1) a problem-specific gradient descent step, (2) a problem-specific mirror descent step, and then (3) linearly combine the analysis of the two for a faster convergence. Furthermore, in order to ensure that the output lies in an infinite-norm box, we have to ensure that gradient and mirror steps both work inside bounded convex region. This adds some extra difficulty in the analysis. Roadmap. We introduce our gradient and mirror descent steps in Section 4.1 and 4.2 respectively, and present our linear coupling method LC in Algorithm 1, and analyze it in Section 4.3. In Section 4.4 we build our algorithm Scaling0 using LC as a subroutine, and present the final theorems. We introduce the following notion for convenience:15 Definition 4.1 (gradient split). At any x ∈ Rn , define small and large gradients ∇s , ∇l ∈ Rn by  def def ∀j ∈ [n] : ∇sj = min cj , ∇j f (x) ∈ [−cj , cj ] and ∇lj = ∇j f (x) − ∇sj ≥ 0 . Also, define small and large coordinates Λs , Λl ⊆ [n] by  def  def Λs = j ∈ [n] : ∇j ∈ [−cj , cj ] and Λl = [n] \ Λs = j ∈ [n] : ∇j > cj 4.1 . A Specific Gradient Descent We now introduce a problem-specific gradient descent. Recall that when analyzing a smooth function g(x), one can show a quadratic lower bound def g(x) − g(x + δ) ≥ Q(x, δ) = −h∇g(x), δi − 12 kδk22 ,  and thus choosing δ = arg maxδ Q(δ) = −∇g(x) gives a decrease g(x) − g(x + δ) ≥ 21 k∇g(x)k22 . For our function f (x), we show a similar quadratic lower bound: For instance, the RAS method can be viewed as performing a gradient descent step x0 = x − ∇f (x) [16]. Recall that each coordinate ∇j f (x) is in the interval [−cj , ∞). This gradient splitting technique was earlier introduced to solve positive linear programming and semidefinite programming [1–3]. 14 15 7 Lemma 4.2. Given x ∈ Rn , denote by ∇ = ∇f (x) and Λs , Λl ⊆ [n] the set of small and large coordinates (see Def. 4.1). Then, for every δ ∈ Rn where kδk∞ ≤ 1/2, we have  P  def P • if δ ≥ 0, then f (x) − f (x + δ) ≥ Q+ (x, δ) = j∈Λs − ∇j · δj − 43 cj · δj2 + j∈Λl − 73 ∇j · δj .  P  def P • if δ ≤ 0, then f (x) − f (x + δ) ≥ Q− (x, δ) = j∈Λs − ∇j · δj − 34 cj · δj2 + j∈Λl − 12 ∇j · δj . (Recall that δ ≥ 0 or δ ≤ 0 means entry-wise non-negativity or non-positivity.) The above quadratic lower bounds distinct from the classical one Q(x, δ) in two aspects. First, for large coordinates j ∈ Λl , we only have a linear lower bound. Second, Q+ and Q− have different forms for δ ≥ 0 and δ ≤ 0. Here is an explanation for such two distinctions. Consider even a simple univariate function h(x) = ex −1. First, we do not have h(0)−h(δ) ≥ −h0 (0)δ−Cδ 2 for any constant C, so we cannot have a quadratic lower bound. Second, we only have h(0) − h(δ) ≥ − 37 h0 (0)δ for δ ≥ 0 and h(0) − h(δ) ≥ − 21 h0 (0)δ for and δ ≤ 0. The two constants 73 and 12 must be distinct for δ ≥ 0 and δ ≤ 0. For such reasons, we only have statements for vectors δ ≥ 0 or δ ≤ 0.. Lemma 4.2 suggests us to perform gradient descent as (one of) the minimizer of Q+ and Q− : Definition 4.3 (gradient descent). Given x satisfying kxk∞ ≤ N , define the projected gradient  def descent step x0 ← GradN (x) where GradN (x) = arg miny∈{y1 ,y2 } f (y) where n o V def  y1 = x + arg maxδ∈Ω+ Q+ (x, δ) and Ω+ = δ ≥ 0 | kx + δk∞ ≤ N kδk∞ ≤ 1/2 N,x N,x n o V def  y2 = x + arg maxδ∈Ω− Q− (x, δ) and Ω− kδk∞ ≤ 1/2 N,x = δ ≤ 0 | kx + δk∞ ≤ N N,x Obviously, GradN (x) can be computed in complexity O(n + m). Note that in the definition above, we have specified a parameter N which ensures that the output x0 = GradN (x) is also in the box kx0 k∞ ≤ N . One can also let N = +∞ and this means that we put no constraint on kx0 k∞ . The next two are direct corollaries of Lemma 4.2: Corollary 4.4. If x0 = GradN (x), then we have  1 f (x) − f (x0 ) ≥ max {Q+ (x, δ)} + max {Q− (x, δ)} ≥ 0 . 2 δ∈Ω+ δ∈Ω− N,x N,x Corollary 4.5. If x0 = Grad∞ (x) and ∇f (x) = ∇s + ∇l (see Def. 4.1), we have kx0 − xk∞ ≤ 1/2 and f (x) − f (x0 ) ≥ 3 s 2 32 k∇ kc−1 + 14 k∇l k1 ≥ Ω k∇s k2c−1 + k∇l k1  . Remark 4.6. Corollary 4.5 replaces the classical gradient descent statement on smooth functions g(x) that says g(x) − g(x0 ) ≥ 12 k∇g(x)k22 . Corollary 4.4 is the constrained version of Corollary 4.5. 4.2 A Specific Mirror Descent The mirror descent step we take is a constrained minimization with respect to the k · k2c norm: Definition 4.7 (mirror descent). Given z satisfying kzk∞ ≤ N , a feedback vector v ∈ Rn , define the projected mirror descent step z 0 ← MirrN (z, v) as  def MirrN (z, v) = arg minkz 0 k∞ ≤N hv, z 0 i + 12 kz 0 − zk2c } . Obviously, MirrN (z, v) can be computed in complexity O(n). The following lemma is classical for mirror descent: Lemma 4.8. If z 0 = MirrN (z, v), then for every u satisfying kuk∞ ≤ N , we have hv, z − ui ≤ hv, z − z 0 i − 21 kz − z 0 k2c + 21 kz − uk2c − 12 kz 0 − uk2c . 8 Algorithm 1 LC(A, N, T, y0 ) Input: A ∈ Rd×n , a non-negative matrix; N ≥ 1, a diameter bound; T ≥ 1, number of iterations; y0 ∈ Rn a starting vector satisfying ky0 k∞ ≤ 15N ; 1 1: z0 ← 0 and τ0 ← 32N ; 2: for k = 0 to T − 1 do τ2 3: τk ← the unique positive root of the quadratic equation τ 2k + τk − 1 = 0; k−1 xk+1 ← τk zk + (1 − τk )yk ; yk+1 ← Grad15N (xk+1 );  Define ∇s ∈ Rn where ∇sj ← min ∇j f (xk+1 ), 1 ;  3 ; zk+1 ← MirrN zk , αk ∇s where αk = 64τ k end for return yT . 4: 5: 6: 7: 8: 9: 4.3  τk ∈ (0, 1)  see Def. 4.3  see Def. 4.7  yT satisfies kyT k∞ ≤ 15N Linear Coupling We now introduce our linear-coupling algorithm LC (see Algorithm 1). Starting from two initial vectors y0 and z0 = 0, in each iteration k = 0, 1, . . . , T − 1, our LC chooses a linear combination xk+1 = τk zk + (1 − τk )yk for some parameter τk ∈ (0, 1), and performs two updates: yk+1 = Grad15N (xk+1 ) and zk+1 = MirrN (zk , αk ∇s ). Here, αk > 0 is the learning rate for mirror descent. The choices of τk and αk are in Algorithm 1. From the description: Fact 4.9. We always have kzk k∞ ≤ N , kxk k∞ ≤ 15N , and kyk k∞ ≤ 15N . Proof of Fact 4.9. y0 and z0 = 0 both satisfy norm bounds. yk comes from gradient descent with range 15N so kyk k∞ ≤ 15N ; zK comes from mirror descent with range N so kzk k∞ ≤ N ; finally, xk is a convex combination of yk−1 and zk−1 so satisfies kxk k∞ ≤ 15N .  We show the following lemma which describes the one-iteration behavior of LC:  1 Lemma 4.10. If τk αk ≤ 3/64, τk ∈ 0, 32N , and u is any vector satisfying kuk∞ ≤ N , then   k 0 ≤ 1−τ f (yk ) − f (u) − τ1k f (yk+1 ) − f (u) + 2α1 k kzk − uk2c − 2α1 k kzk+1 − uk2c . τk Lemma 4.10 is the main technical contribution of this section, and relies on careful applications of Lemma 4.2 and Lemma 4.8, together with tailor-made analysis for our f (x). The next theorem is a corollary of Lemma 4.10 by appropriate choices τk and αk , and telescoping k = 0, 1, . . . , T − 1. Theorem 4.11 (LC). If y0 satisfies ky0 k∞ ≤ 15N and T ≥ 1, then the output yT = LC(A, N, T, y0 ) (see Algorithm 1) satisfies that for every u ∈ Rn and kuk∞ ≤ N :  N 2 f (y )−f (u)+h  0 kyT k∞ ≤ 15N and f (yT ) − f (u) ≤ O . (N +T )2 4.4 Complexity Statements  2 The (NN f (y0 ) − f (u) term in Theorem 4.11 can hurt the performance of LC.16 For this reason, +T )2 as a warm start, one needs to repeatedly apply LC for log N times, each with T = Θ(N ). We summarize this final algorithm as Scaling0 in Algorithm 2 and present the final theorem: 16 e h) (see Lemma 3.1). For instance, the general upper bound on f (0) − f (x∗ ) is only O(N 9 Algorithm 2 Scaling0(A, N, T ) Input: A ∈ Rd×n , a non-negative matrix; N ≥ 1, a diameter bound; T ≥ 1, number of iterations; 1: z0 ← 0; 2: for k = 0 to log N do 3: z0 ← LC(A, N, Θ(N ), z0 ); 4: z1 ← LC(A, N, T, z0 ); 5: for k = 1 to T do 6: zk+1 ← Grad∞ (zk ); 7: z ← arg minz∈{z1 ,...,zT } {k∇f (z)k2c−1 }. 8: return (z1 , z).  z1 satisfies kz1 k∞ ≤ 15N Theorem 4.12 (Scaling0). If N ≥ 1, then (z1 , z) = Scaling0(A, N, T ) satisfies • If T ≥ N , then for every u satisfying kuk∞ ≤ N , we have kz1 k∞ ≤ 15N and f (z1 ) − f (u) ≤ O N 2h T2  . • If T ≥ (N 2 h)1/3 and there exists u so that kuk∞ ≤ N and f (u) − inf x {f (x)} ≤ 1, then 2  k∇f (z)k2c−1 ≤ O NT 3h . The total complexity of Scaling0 is O(m(N log N + T )). (Due to technical reasons, we do not have bound on kzk∞ .) Recall that to obtain an ε-approximate (r, c)-scaling, it suffices to find z with k∇f (z)k2c−1 ≤ 2 ε (see Proposition 2.3). Therefore, we can combine Theorem 4.12 with bounds on the scaling e e parameters: namely, N ≤ O(n) for the general (r, c)-scaling (see Lemma 3.3), or N ≤ O(1) if the scaling parameters are polynomially bounded (see Footnote 10). This gives us the claimed results of Scaling0 in Table 1 and Table 2. 5 A New Second-Order Framework In this section, we propose a second-order framework in order to minimize f (x). Our methods Scaling1, Scaling2 and Scaling3 in subsequent sections are all be based on this framework. We show that near any point x, the function value f (x + δ) is well approximated by the secondorder Taylor expansion of f (x), as long as kδk∞ ≤ 1/8: Lemma 5.1 (second-order approximation). For every x, δ ∈ Rn with kδk∞ ≤ 1/8, we have 1 f (x) + h∇f (x), δi + δ > ∇2 f (x)δ ≤ f (x + δ) ≤ f (x) + h∇f (x), δi + δ > ∇2 f (x)δ . 6 Note that if f (x) were an arbitrary convex function, such a quadratic approximation would only work for a very small region of δ. It is the special property of the matrix scaling problem that allows us to prove Lemma 5.1 for all kδk∞ ≤ 1/8. We include the details in Appendix E. Also, one may carefully verify that ∇2 f (x) is a Laplacian matrix that may contain up to n2 nonzero entries even if the original matrix A is sparse. Using classical graph sparsification techniques e (see Appendix A.2), with total complexity O(m), one can find another Laplacian matrix H ∈ Rn×n 2 e satisfying H  ∇ f (x)  1.1H, where H only has O(n) non-zero entries. 10 High-Level Intuition. Using Lemma 5.1, it becomes natural to study the minimization question ∗ h∇f (x), δi + 16 δ > Hδ over  all kδk∞ ∗≤ 1/8. If δ∗ is such a minimizer, then one can show f (x) − 1 ∗ f (x + δ ) ≥ Ω kx−x∗ k∞ (f (x) − f (x )) where x is the minimizer of f (x). This sounds like we only needed O(N log(1/ε)) iterations in total if kx∗ k∞ ≤ N . Unfortunately, this approach fails because kx − x∗ k∞ may increase by 1/8 per iteration, so the convergence rate may drop to 1/ε as opposed to log(1/ε). We fix this issue by restricting our attention only to the region {x ∈ Rn | kxk∞ ≤ N }. If this region contains x∗ , and if we can minimize h∇f (x), δi + 61 δ > Hδ over the of kx + δk∞ ≤ N and kδk∞ ≤ 1/8, then we can  intersection 1 ∗ ∗ always have f (x) − f (x + δ ) ≥ Ω N (f (x) − f (x )) and thus converge in O(N log(1/ε)) iterations. For the reason above, we wish to repeatedly solve the following minimization problem min N δ∈box (x)  1 h∇f (x), δi + δ > Hδ 6 (5.1) Definition 5.2. Given any point x ∈ Rn satisfying kxk∞ ≤ N for some N > 1, we define  1 1 1 ], if xi − 32 < −N ;  ( 32 − N − xi ) ∈ (0, 32 n o 1 def def N n 1 1 1 (N − xi − 32 ) ∈ [− 32 , 0), if xi + 32 > N; box (x) = δ ∈ R kδ−αk∞ ≤ where αi =  32 0, otherwise. Fact 5.3. For all δ ∈ boxN (x), we have kx + δk∞ ≤ N and kδk∞ ≤ 1 16 . We also have 0 ∈ boxN (x). Our next Lemma 5.4 says that if we can solve (5.1) up to a small additive error, then we can 1 decrease the objective distance to f (u) by a factor of 1 − 900N up to the same small additive error. Lemma 5.4. Given x with kxk∞ ≤ N and H with H  ∇2 f (x)  1.1H, the following holds: (a) For any u ∈ Rn with kuk∞ ≤ N ,   1 − minδ∈boxN (x) h∇f (x), δi + 61 δ > Hδ ≥ 64N f (x) − f (u) . b ∞ ≤ 1/8 and for ε ≥ 0: (b) If we are given δb satisfying kδk  1 > b + 1 δb> Hδb ≤ min h∇f (x), δi δ∈boxN (x) h∇f (x), δi + 6 δ Hδ + ε , 6   δb 1 then it satisfies that for every u ∈ Rn with kuk∞ ≤ N , f (x)−f x+ 6.6 ≥ 900N f (x)−f (u) −ε. 6 Second-Order Method 1: via Multiplicative Weight Updates In this section, we propose Scaling1 which uses multiplicative weight update (MWU) and an `2 constrained SDD system solver to tackle problem (5.1). def High-Level Intuitions. Denote by h(δ) = h∇f (x), δi + 61 δ > Hδ for notation simplicity. P def Given any weight vector w∈ ∆ where ∆ = {w ∈ [1/2, n]n | i wi = n}, instead of minimizing N 1 h(δ) over = δ ∈ Rn kδ − αk∞ ≤ 32 , we can minimize h(δ) over a larger set  all nδ ∈ box (x) n 2 17 Ωw = δ ∈ R kδ − αkw ≤ 1024 . We would like do so because `2 constrained minimization is computationally cheap: minimizing h(δ) over Ωw can be done using a variant of SDD linear system e solvers in total complexity O(n) (see Appendix A.3). Next, we wish to apply the multiplicative weight update framework. Starting from some w0 ∈ ∆, in each round k = 0, 1, . . . , T −1, we minimize h(δ) over set Ωwk and let δk ∈ Ωwk be an approximate minimizer. Then, we update wk+1 from wk by penalizing the coordinates i in δk where |δk,i − αi | is 17 √ It is easy to verify that boxN (x) ⊆ Ωw and conversely kδ − αk∞ ≤ O( n) for every δ ∈ Ωw . 11 Algorithm 3 MWUbasic(∇, H, α, T, K, ε) Input: ∇ ∈ Rn ; H ∈ Rn×n a Laplacian matrix; α ∈ Rn satisfying kαk∞ ≤ 1/32; T ≥ 1 number of rounds; K ≥ 1 a parameter; ε > 0 an accuracy parameter. P n 1: ∆ ← {w ∈ [1/2, n] : i wi = n} and w0 ← (1, 1, . . . , 1) ∈ ∆; 2: for k = 0 to T − 1 do n 3: Use Lemma A.4 to find a vector δk ∈ Rn satisfying kδk − αk2wk ≤ 1024 and  1 > 1 > h∇f (x), δk i + 6 δk Hδk ≤ minkδ−αk2w ≤n/1024 h∇f (x), δi + 6 δ Hδ + ε k Define loss vector `k∈ Rn by `k,i  P← −|δk,i − αii|. + wk,i − zi 5: wk+1 ← arg minz∈∆ ηh`k , zi + i∈[n] zi log wzk,i √  a multiplicative weight update with parameter η = 1/( n + K), see Section A.1 6: end for PT −1 7: return δ ← T1 k=0 δk ; 4: Algorithm 4 Scaling1(A, N, ε) Input: A ∈ Rd×n non-negative matrix; N ≥ 1 diameter bound; ε ∈ (0, 1) accuracy parameter. e √n); 1: x0 ← 0, K ← Θ(log(1/ε)), and T ← Θ( 2: for t = 0 to N K do 3: Define boxN (xt ) and α ∈ [−1/32, 1/32]n using Def. 5.2; e 4: H ← a matrix with O(n) nonzeros satisfying H  ∇2 f (xt )  1.1H; ε 5: δ ← MWUbasic(∇f (xt ), H, α, T, K, 900N ); δ and N ← N + xt+1 ← x + 6.6 7: end for 8: return y ← the last xt . 6: 1 50K ;  so xt+1 satisfies kxt+1 k∞ ≤ N for this new N e √n), the average δ = 1 PT −1 δk large. A variant of the MWU theory implies that, as long as T = O( k=0 T satisfies kδ − αk∞ ≤ O(1). At the same time, since objective δ minimizes (5.1) over a larger set k P −1 h(δk ) ≤ minδ∈boxN (x) h(δ). This gives an approximate Ωw ⊇ boxN (x), we also have h(δ) ≤ T1 Tk=0 e e 3/2 ) if H is given. solution to (5.1), and the total complexity is O(nT ) = O(n We summarize the above process as MWUbasic (see Algorithm 3), and show the following lemma: Lemma 6.1 (MWUbasic). If H ∈ Rn×n is Laplacian, K ≥ 1, T ≥ Ω((n1/2 K + K 2 ) log n), kαk∞ ≤ 1/32, and ε > 0, then the output δ = MWUbasic(A, H, α, T, K, ε) satisfies  1 1 1 > 1 kδ − αk∞ ≤ + and h∇, δi + δ Hδ ≤ min h∇, δi + δ > Hδ + ε . 32 8K 6 6 kδ−αk∞ ≤1/32 e With Lemma 6.1, we can repeatedly apply MWUbasic to minimize (5.1) for O(N log(1/ε)) times. We summarize the algorithm as Scaling1 (in Algorithm 4) and have the following final theorem: Theorem 6.2 (Scaling1). If N ≥ 1 and ε ∈ (0, 1), the output y = Scaling1(A, N, ε) satisfies kyk∞ ≤ 2N and f (y) − f (u) ≤ ε for every u with kuk∞ ≤ N . Furthermore, if there exists u satisfying f (u) − inf x {f (x)} ≤ ε and kuk∞ ≤ N , then we also have e (m + n3/2 )). k∇f (y)k2c−1 ≤ ε. The total complexity is O(N e We can combine Theorem 6.2 with bounds on scaling parameters: namely, N ≤ O(n) for the e general (r, c)-scaling (see Lemma 3.3), or N ≤ O(1) if the scaling parameters are polynomially bounded (see Footnote 10). This gives us the claimed results of Scaling1 in Table 1 and Table 2. 12 7 Second-Order Method 2: via Accelerated Gradient Descent In this section, we propose Scaling2 (see Algorithm 5) which directly solves the constrained minimization problem (5.1) using a constrained version of accelerated gradient descent [26, 27]. We shall not directly use Scaling2 to solve the matrix scaling problem; instead, we shall later use Scaling2 as a warm-start for Scaling3. Algorithm 5 Scaling2(A, N, T ) Input: A ∈ Rd×n , a non-negative matrix; N ≥ 1, a diameter bound; T ≥ 1, number of iterations; 1: x0 ← 0; e ) do 2: for t = 0 to O(N e 3: H ← a matrix with O(n) nonzeros satisfying H  ∇2 f (xt )  1.1H;  see Lemma A.3 for details.  4: δ ← approximate minimizer for minδ∈boxN (xt ) h∇f (xt ), δi + 16 δ > Hδ .  compute δ by applying T steps of constrained accelerated gradient descent. See Lemma 7.1 5: xt+1 ← xt + δ; 6: end for 7: return y ← the last xt .  y satisfies kyk∞ ≤ N We have the following main lemma to estimate the per-iteration performance of Scaling2: Lemma 7.1. In each iteration t of Scaling2, if kxt k∞ ≤ N , then we can compute xt+1 in come plexity O(m + T n), and it satisfies kxt+1 k∞ ≤ N and Nh 1 either (1) : f (xt+1 ) − f (u) ≤ O 2 or (2) : f (xt ) − f (xt+1 ) ≥ Ω (f (xt ) − f (u)) . T N Here, u is any vector satisfying kuk∞ ≤ N . The following theorem is a direct corollary of Lemma 7.1. Theorem 7.2 (Scaling2). If T ≥ 1, the output y = Scaling2(A, N, T ) satisfies Nh kyk∞ ≤ N and f (y) − f (u) ≤ O for every u with kuk∞ ≤ N . T2  e mN + N nT . The total complexity O Proof of Theorem  7.2 from Lemma 7.1. Whenever Line 3 is reached, either  we have f (xt+1 ) − Nh 1 f (u) ≤ O T 2 so we are done, or we have f (xt+1 ) − f (u) ≤ 1 − Ω N (f (xt ) − f (u)). The e ) times. latter cannot happen more than O(N  8 Second-Order Method 3: via More Advanced MWU In this section, we present our final (and most involved algorithm) Scaling3 to solve the matrix (r, c)-scaling problem. As shown in Algorithm 6, our Scaling3 method is almost identical to Scaling1, except that it calls a different subroutine MWUfull as opposed to MWUbasic. We have the following theorem for Scaling3: 13 Algorithm 6 Scaling3(A, N, x0 , ε) Input: A ∈ Rd×n a non-negative matrix; N ≥ 1 a diameter bound; x0 ∈ Rd a starting vector with kx0 k∞ ≤ N ; ε > 0 an accuracy parameter. e 1/3 ); 1: t ← 0, K ← Θ(log(1/ε)), ρ ← Θ(n1/3 ), and T ← Θ(n 2: repeat 3: Define boxN (xt ) and α ∈ [−1/32, 1/32]n using Def. 5.2; 2 e 4: H ← a matrix with O(n) nonzeros satisfying  H  ∇ f (xt )  1.1H; ε 5: δ ← MWUfull ∇f (xt ), H, α, T, ρ, K, O( N n3 ) ; δ xt+1 ← x + 6.6 and N ← N + 7: t ← t + 1; 8: until k∇f (xt )k2c−1 ≤ ε 9: return y ← the last xt . 6: 1 K;  so xt+1 satisfies kxt+1 k∞ ≤ N for this new N Theorem 8.1 (Scaling3). If x0 satisfies f (x0 )−f (u) ≤ N n1/3 and kx0 k∞ ≤ N , and ε ∈ (0, 1/4], then the output y = Scaling3(A, N, x0 , ε) satisfies kyk∞ ≤ 10N and f (y) − f (u) ≤ ε for every u with kuk∞ ≤ N . Furthermore, if there exists u satisfying f (u) − inf x {f (x)} ≤ ε and kuk∞ ≤ N , then we also have e (m + n4/3 )). k∇f (y)k2c−1 ≤ ε. The total complexity is O(N In Section 8.1, we present our MWUfull subroutine, illustrate its intuition, and discuss its differences to MWUbasic. To apply Scaling3 to solve the (r, c)-scaling problem, we need x0 with f (x0 ) − f (u) ≤ N n1/3 . We can either use Scaling0 or Scaling2 to find such this warm start x0 . We present our total complexity statements below: Corollary 8.2. To find a point y with f (y) − f (u) ≤ ε and kyk∞ ≤ O(N ), we can: 1. Either run Scaling0 to obtain a point x0 , satisfying kx0 k∞ ≤ 15N and f (x0 ) − f (u) ≤ N n1/3 , and then apply Scaling3. The total complexity is (using Theorem 4.12)   e mN + mN 1/2 h1/2 n−1/6 + N n4/3 O  e mn + mn1/3 h1/2 + n7/3 when N = O(n). e This gives us total complexity O 2. Or run Scaling2 to obtain a point x0 , satisfying kx0 k∞ ≤ 2N and f (x0 ) − f (u) ≤ N n1/3 , and then apply Scaling3. The total complexity is (using Theorem 7.2)     e mN + N n5/6 h1/2 , or O e m + n5/6 h1/2 when N = O(1). e O 8.1 A More Advanced Multiplicative Weight Update Subroutine Our main algorithmic tool for Scaling3 is a new MWU algorithm MWUfull (see Algorithm 7) which e 1/2 ) to O(n e 1/3 ), as compared to Lemma 6.1. can reduce T , the number of MWU rounds from O(n Intuition Behind MWUfull. Similar to MWUbasic, we run MWU for T rounds, and in each round k, we also compute a vector δk which minimizes the same objective  (5.1) (i.e., minimizes h∇, δi + 61 δ > Hδ) and replacing the `1 constraint with an `2 constraint Ωw = δ ∈ Rn kδ − αk2w ≤ n 1024 . 14 Algorithm 7 MWUfull(∇, H, α, T, ρ, K, ε) Input: ∇ ∈ Rn ; H ∈ Rn×n a Laplacian matrix; α ∈ Rn satisfying kαk∞ ≤ 1/32; T ≥ 1 number of iterations; ρ ≥ 1 a truncation parameter; K ≥ 1 a parameter; ε > 0 an accuracy parameter. 1: S ← ∅, v ← 0, and v bP ←0 2: ∆ ← {w ∈ [1/2, n]n : i wi = n} and w0 ← (1, 1, . . . , 1) ∈ ∆; 3: for k = 0 to T − 1 do n 4: Use Lemma A.4 to find a vector δk ∈ Rn satisfying kδk − αk2wk ≤ 1024 and  1 1 h∇, δi + δ > Hδ + ε h∇, δk i + δk> Hδk ≤ min 2 6 6 kδ−αkw ≤n/1024 k 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: Denote by y = δk for simplicity and assume wlog |y1 | ≥ |y2 | ≥ · · · ≥ |yn | in round k. if ∃s ∈ [ρ]: |ys | − |ys+1 | ≥ 15, |ys+1 | ≤ ρ2 and |ys | ≥ ρ4 then  each vk,j ∈ {−1, 0, 1} vk ← (sgn(y1 ), . . . , sgn(ys ), 0, . . . , 0). {z } | {z } | n−s s n n vk+ ← max{vk,j , 0} j=1 and vk− ← min{vk,j , 0} j=1 . + −  therefore vk = vk+ + vk− , vk,j ∈ {0, 1} and vk,j ∈ {−1, 0} > if |h∇, vk i| ≤ 2ε and vk Hvk ≤ 4ε then Let H/ ∈ Rs×s , ∇/ , α/ ∈ Rs be the sub-matrix and sub-vectors of H, ∇ and α;  see Def. 8.3 e √s), 1/4, ε) ∈ Rs so it satisfies kz/ − α/ k∞ ≤ 1 and z/ ← MWUbasic(∇/ , H/ , α/ , Θ( 16  1 > 1 > min h∇/ , zi + z H/ z + ε h∇/ , z/ i + (z/ ) H/ z/ ≤ 6 6 kz−α/ k∞ ≤1/32  this comes from Lemma 6.1 δk,i ← (z/ )i for all i ∈ [s].  replace the first s coordinates of δk with z/ else if |h∇, vk+ i| > ε then  necessarily |h∇, vk+ i| ≥ 1/2, see Lemma H.1 + + v ← v + vk and vb ← vb + vk else  necessarily |h∇, vk− i| ≥ 1/2, see Lemma H.1 − − v ← v + vk and vb ← vb − vk end if S = S ∪ {k}. end if end if Define loss vector `k∈ Rn by `k,i  truncate it at ρ + 1  P← − min{|δk,ii − αi |, ρ + 1}. wk+1 ← arg minz∈∆ ηh`k , zi + i∈[n] zi log wzk,i + wk,i − zi 1  a multiplicative weight update with parameter η = ρ+K , see Section A.1 end for T if |S| ≤ 2K then   P return δ ← T1 δ k∈[T ]\S k ; else return δ ← Kkbvvk∞ ; end if 15 Unlike MWUbasic, this time, we define the loss vector `k by letting `k,i = − min{|δk,i − αi |, ρ + 1} (see Line 22 of MWUfull), so we truncate the vector δk − α to [−ρ − 1, ρ + 1], for some parameter ρ = Θ(n1/3 ). This ensures that the “width” of MWU is only n1/3 so we only need to apply MWU e 1/3 ) iterations. for T = Θ(n Because of the truncation, we cannot always solve (5.1) almost optimally (like we did in MWUbasic). However, we observe that if truncation happens for  T rounds, then we are still okay (see Line 26 of MWUfull and Lemma 8.4.a). Otherwise, we wish to find a direction δ that at least decreases the objective by an additive amount (see Line 28 of MWUfull and Lemma 8.4.b). We now discuss a bit more in details regarding how to find such a direction δ. Since ρ = Θ(n1/3 ) and kδk k2w = O(n), using a simple counting argument, one can show that there are at most s = O(n1/3 ) coordinates of δk that get truncated in each round of MWU. Without loss of generality, say these are the first s coordinates of δk . Intuitively, we wish to replace these s coordinates with zero, and apply MWU again to solve this smaller-sized problem.18 Unfortunately, since the cross term in Hessian H, namely, P i∈[s],j∈[n]−[s] |Hi,j | might be very large, solving this smaller-sized problem may not necessarily yield good minimizers of the original problem. If the cross term is small (see Line 9 in MWUfull), then the above discussion works and we can recursively apply MWU on the smaller-sized problem (see Line 11). Otherwise, if the cross term is large (see Line 13), then we observe that moving in a direction vk = (1, . . . , 1, 0, . . . , 0) | {z } | {z } s n−s can essentially decrease the objective by constant. Since MWU guarantees that the truncated coordinates do not overlap too much across the T rounds, one can show that the summation of such directions vk is a good descent direction (that we denote by δ in Line 28), and it can decrease the objective value sufficiently by some additive amount (see Lemma 8.4.b). This concludes our high-level discussion on MWUfull. Details. In the description of MWUfull, we have denoted by v/ the sub-vector of v with only the first s coordinates. This notion is formally introduced as follows: Definition 8.3. Let s be in [n − 1]. • For any vector x ∈ Rn , we write x = (x/ , x. ) where x/ ∈ Rs and x. ∈ Rn−s . • For any Laplacian matrix H ∈ Rn×n , we write H/ ∈ Rs×s as the Laplacian sub-matrix where (H/ )i,j = Hi,j for every i, j ∈ [s] and i 6= j; and we write H. ∈ R(n−s)×(n−s) as the Laplacian sub-matrix where (H. )i,j = Hs+i,s+j for every i, j ∈ [n − s] and i 6= j. The diagonal entries of H/ and H. are automatically induced by the definition of Laplacian matrices. We have the following lemma for MWUfull: √ Lemma 8.4 (MWUfull). If ρ ∈ [10n1/3 , 2 n ], kαk∞ ≤ 1/32, ε ∈ [0, 1/16], K ≥ 1, and T = Ω((Kρ+K 2 ) log n), letting x be any vector in Rn and H be any Laplacian satisfying H  ∇2 f (x)  1.1H. Then, the output satisfies kδ − αk∞ ≤ 1 32 + 2 K δ ← MWUfull(∇f (x), H, α, T, ρ, K, ε) and either 18 More precisely, we can define ∇/ to be the sub-vector of ∇ but with only the first s coordinates. We can also define H/ to be essentially the sub-matrix of H with the upper left s×s block. Then, we can recursively use MWUbasic to minimize h∇/ , zi + 61 z > H/ z over the `1 constraint. Finally, we can replace the first s coordinates in δk with z ∈ Rs . 16 > (a) h∇f (x), δi + 16 δ Hδ ≤ > 1 4  minkδ−αk∞ ≤1/32 h∇f (x), δi + 16 δ > Hδ + 52n3 ε, or 1 ρ (b) h∇f (x), δi + 16 δ Hδ ≤ − 256 K. Above, case (a) corresponds to Line 26 of MWUfull, and says that we can solve the `1 constrained problem (5.1) with a multiplicative factor; and case (b) corresponds to Line 28 of MWUfull, and says that the objective value can be decreased by an additive amount ρ/K. We defer all the proofs to Appendix H. In particular, in Section H.1 we prove Theorem 8.1 from Lemma 8.4; and in Section H.3, we prove Lemma 8.4. 9 Discussion on Numerical Issues Throughout the paper we have assumed exact computations of the gradient ∇f (x) and (the sparsified approximation H of) the Hessian ∇2 f (x). Exact computations may take too much time, since e in principle, we need to compute exi where xi can go up to O(n) (see Lemma 3.3). We point out in this section that, in fact, we only need to compute ξ-additive approximations f2 satisfying k∇ f2 − ∇2 f (x)kF ≤ ξ, for some ξ ≤ ε . This is because, e e − ∇f (x)k2 and k∇ ∇ and ∇ poly(n) for every δ with kδk∞ ≤ 1, we have:  f2 δ  ≤ 2nξ e δi + δ > ∇ h∇f (x), δi + δ > ∇2 f (x)δ − h∇, so we can still approximate the function f (x) very well using approximate gradients or Hessians. f2 . By e and ∇ In the remainder of this section, we discuss how to obtain such approximations ∇ 2 the definition of the gradient ∇f (x), as well as the sparsification of ∇ f (x) (see Appendix A.2), A e xj Ai,j we only need to compute hAi,ji ,ex i = Pn xk −xj with an additive accuracy ξ. We introduce the k=1 Ai,k e following procedure to compute this quantity for each i ∈ [d] and j ∈ [n]: 1. Output 0 if Ai,j = 0. 2. Output 0 if there exists k with Ai,k 6= 0 and xk − xj ≥ ω(log nξ ). 3. For all k with Ai,k = 0 or xk − xj = −ω(log nξ ), then define zk = 0. Otherwise, define zk = exk −xj which is between 2−O(log(n/ξ)) and 2O(log(n/ξ)) . Finally, output The correctness follows from the following two simple observations: 1. if Ai,k 6= 0 and xk − xj = ω(log nξ ), then 2. If xk − xj = −ω(log nξ ), then Ai,k exk −xj so it is also okay to set zk = 0. Ai,j exj hAi ,ex i Pn Ai,j . k=1 Ai,k zk = o(ξ) and it is okay to output 0. P = o(ξ/poly(n)) and ns=1 Ai,s exs −xj ≥ Ai,j ≥ 1 poly(n) , In sum, to obtain such ξ additive accuracy, it suffices to use bit-length O(log nξ ) for all the arithmetic e notion to hide polylog factors in n and 1/ε, this does not affect computations. Since we use the O our complexity statements in Table 1 and Table 2. Acknowledgements We thank Isabella Lari for providing us the technical report version of their paper [16]. This material is based upon work supported by the National Science Foundation under agreement No. CCF1412958. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. 17 Appendix A Useful Subroutines In this section we provide some useful subroutines that shall be used in our second-order based methods (namely, Scaling1, Scaling2 and Scaling3). • Section A.1 defines and analyzes a special constrained variant of the multiplicative weight update method; • Section A.2 shows that the Hessian ∇2 f (x) for our objective function can always be sparsified e into a Laplacian matrix H with only O(n) non-zero entries; • Section A.3 shows that we can solve an `2 constraint variant of the SDD linear system. A.1 Constrained Multiplicative Weight Updates Given vector β ∈ Rn≥0 satisfying kβk1 ≤ n/2, we study the behavior of V the multiplicative weight P update (MWU) method over a constrained set ∆ = {w ∈ Rn : w = n ∀i, wi ≥ βi }. i i 1 The MWU Process. We start from a vector w0 ∈ ∆ where w0,i = βi + n−kβk ≥ 12 . In each n round k = 0, 1, . . . , T − 1, we are given a feedback vector ` ∈ [−ρ, ρ]n , and perform update X  yi def wk+1 = arg min ηh`k , zi + Vwk (z) + x i − yi where Vx (y) = yi log xi z∈∆ i∈[n] for some positive parameter η > 0 known as the learning rate. It is a simple exercise to verify that wk+1 is unique (because Vx (y) is strictly convex for the positive orthant) and the update can be efficiently computed in time O(n log n) (see Section A.1.1). We have the following theorem: Lemma A.1. In MWU, if each `k ∈ [−ρ, ρ]n and η ∈ (0, ρ−1 ], then for every u ∈ ∆ we have T −1 X k=0 h`k , wk − ui ≤ T −1 X n log(2n2 ) k`k k2wk . + 2η η k=0 Proof of Lemma A.1. In each round k, we first choose a dummy weight vector  w ek+1 = arg min ηh`k , zi + Vwk (z) z≥0 which is similar to wk+1 but with the constraint z ∈ ∆ replaced with z ≥ 0. We claim that w ek+1 is strictly positive in each coordinate. This follows from the fact that one can always find w ek+1 > 0 so that the gradient is zero:  0 = ∇i Vwk w ek+1 + η`k,i = (log w ek+1,i − log wk,i ) + η`k,i . (A.1) Next, it is easy to verify that wk+1 = arg minz∈∆ {Vwek+1 (z)} (by taking the derivative).19 We def assume for notational simplicity that w e0 = w0 . Using (A.1), we easily obtain that for every u ∈ ∆,  ¬ hη`k , wk − ui = h∇Vwk w ek+1 , u − wk i = Vwk (u) − Vwek+1 (u) + Vwek+1 (wk ) ­ 19 ≤ Vwek (u) − Vwek+1 (u) + Vwek+1 (wk ) . (A.2) This two-step interpretation of mirror descent is also known as the tweaked version by [31, 38]. Although most results can be proven from the original one-step version, this two-step interpretation often leads to cleaner proofs. 18 Above, equality ¬ is known as the “three-point equality” of Bregman divergence and can be easily checked via expanding out the definitions of Vx (y); inequality ­ is due to the generalized Pythagorean theorem of the Bregman divergence.20 On the other hand, we have ® ek+1 ), w ek+1 − wk i = hη`k , wk − w ek+1 i , ek+1 ) + Vwek+1 (wk ) = h∇Vwk (w Vwek+1 (wk ) ≤ Vwk (w where the equality ® is again due to the three-point equality and can be checked via expanding out the definitions of Vx (y). Now, noticing that w ek+1,i = wk,i · e−η`k,i , we have (using the fact that η`k,i ∈ [−1, 1]) X X wk,i `2k,i . (η`k,i ) · wk,i · (1 − e−η`k,i ) ≤ 2η 2 · Vwek+1 (wk ) ≤ hη`k , wk − w ek+1 i ≤ i∈[n] i∈[n] Finally, substituting the above upper bound into (A.2) and telescoping it for k = 1, . . . , T , we obtain for every u ∈ ∆: T −1 X k=0 Finally, the choice w0,i ≥ T −1 X Vwe0 (u) − VweT (u) h`k , wk − ui ≤ + 2η k`k k2wk . η k=0 1 2 implies a simple upper bound Vwe0 (u) = Vw0 (u) = n log(2n2 ). This gives the desired inequality. A.1.1 P ui i∈[n] ui log w0,i ≤  Efficient Implementation The constrained multiplicative weight update requires to compute  z ∗ = arg minz∈∆ ηh`k , zi + Vwk (z) (A.3) per round. We now show how to compute it with total complexity O(n log n). For simplicity, we only show this result when β = (1/2, . . . , 1/2) since we shall only use MWU for such β. Using Lagrange multipliers, we know that the minimizer z ∗ must be of the form: ∀i ∈ [n] : zi∗ = wk,i e−η`k,i ebi −a P where a is an arbitrary real value, each bi > 0 only when zi∗ = 12 , and i∈[n] zi∗ = n. n Now, let us define vector y = wk,i e−η`k,i i=1 , and assume without loss of generality that 0 < y1 ≤ y2 ≤ · · · ≤ yn . We have the following simple observation Claim A.2. For every j ∈ [n], if bj > 0 then for all i ≤ j it satisfies bi > 0. Proof of Claim A.2. Assume by way of contradiction that there exists i < j with bi = 0 and bj > 0. The optimal z ∗ satisfies zi∗ ≥ 12 all i ∈ [n]. However, zi∗ = yi e−a < yi ebj −a ≤ yj ebj −a = 12 and this gives a contradiction.  Using Claim A.2, we just need to find an index j so that zi∗ = 1/2 for all i ≤ j and zi∗ = yi e−a for all i > j. It must satisfy that P Pn 1 −a ∗ j<i≤n yi = n . i=1 zi = 2 j + e P def Let us denote the partial sum Zj = j<i≤n yi . 20 Namely, if x = arg minz∈∆ Vxe (z) is the so-called Bregman projection, we have for all u ∈ ∆: Vxe (u) ≥ Vx (u) + Vxe (x) ≥ Vx (u). See for instance the textbook [31]. 19 n− 21 j Zj . This implies that it suffices to define j to be an index in {0, · · · , n−1} n− 21 j 1 1 2 and Zj yj < 2 . Such an index j always exists, and moreover, if j satisfies We must have e−a = n− 1 j so that Zj2 yj+1 ≥ these two conditions, then we can choose ( 1 if i ≤ j; 2 zi0 = n− 12 j Zj yi if i > j. bi = ( log 12 − log 0  n− 12 j Zj yi  if i ≤ j; if i > j. P and they satisfy (1) each zi0 ≥ 1/2, (2) each bi ≥ 0, (3) bi > 0 only when zi0 = 12 , (4) i∈[n] zi0 = n. Using theory of Lagrangian multipliers, we know that z 0 must be a minimizer of (A.3). The total complexity for computing (A.3) is O(n log n): one can compute y in time O(n), sort the coordinates of y in time O(n log n), compute Z0 , Z1 , . . . , Zn−1 in time O(n), and find j and compute z 0 in time O(n). A.2 Laplacian Sparsification In this subsection we show that one can use standard graph sparsification techniques to sparsify the Hessian ∇2 f (x) of our objective function. Lemma A.3. Suppose A has at most m non-zero entries where m ≥ n + d. Then, for every e x ∈ Rn , in O(m) time one can find a Laplacian matrix H satisfying H  ∇2 f (x)  1.1H and e + d) non-zero entries. H has at most O(n A exj Proof of Lemma A.3. Let us denote by B ∈ Rd×n the matrix where Bi,j = hAi,ji ,ex i so B is row  P normalized. Denote by R = diag(r) ∈ Rd×d and by D = diag ( i∈[d] ri Bi,j )nj=1 ∈ Rn×n . Then, it is a simple exercise to verify that ∇2 f (x) = D − B> RB .  0 B> R , we Note that ∇2 f (x) is a Laplacian matrix and therefore PSD. Now, define C = RB 0 know that C is symmetric, non-negative, and its row sums are the same as the diagonal matrix 0 D0 = D 0 R . In other words, we have that D0 − C is a Laplacian matrix with at most O(m) non-zero entries. Using modern spectral graph sparsification techniques (see for instance Section 6 of Peng and e + d), in time O(m), e Spielman [28]), one can find a Laplacian matrix H0 with sparsity O(n satisfying H0  D0 − C(D0 )−1 C  1.1H0 .  > Since D0 − C(D0 )−1 C = D−B0 RB 0∗ , we have that the top left n × n block of H0 ∈ R(n+d)×(n+d) , if we denote it by H ∈ Rn×n , also satisfies H  D − B> RB = ∇2 f (x)  1.1H . A.3  Solving an `2 -Constrained SDD Linear System In this subsection, we study an `2 variant of (5.1), which is a constrained minimization problem n o minn hv, δi + δ > Hδ kδ − αk2w ≤ n/c δ∈R Rn>0 where w ∈ is a positive weight vector, α ∈ Rn is a shifting vector, v is arbitrary and H is a Laplacian matrix. One may immediately observe that without the constraint kδ − αk2w ≤ n/c, this minimization can be done in nearly-linear time in the sparsity of H, using the famous SDD 20 linear system solvers (see Theorem A.5 below). When the `2 constraint is present, by Lagrangian multipliers, one can solve the following min-max problem: n o minn max hv, δi + δ > Hδ + s kδ − αk2w − n/c . δ∈R s∈R≥0 For this reason, one can perform a binary search in s, and for each fixed value of s, apply an SDD linear system solver. We summarize this result into the following lemma: Lemma A.4. For every weight vector w ∈ [1/2, n]n , every SDD matrix H ∈ Rn×n with at most m ≥ n nonzero entries, every v ∈ Rn with kvk22 = O(poly(n)), every shifting vector α ∈ Rn with kαk2w ≤ O(n), every constant c ≥ 1, every ε ∈ (0, 1], we can compute a vector δ ∈ Rn satisfying  kδ − αk2w ≤ n/c and hv, δi + δ > Hδ ≤ min hv, δi + δ > Hδ + ε kδ−αk2w ≤n/c e e notion hides logarithmic factors in n, 1/ε. in time O(m), where the O Proof of Lemma A.4. First of all, we can apply a change of variable δ 0 = δ − α and minimize in kδ 0 k2w ≤ n/c for the new function hv + 2Hα, δ 0 i + δ 0> Hδ 0 . Therefore, we shall assume without loss of generality that α = 0 in this proof. ε Also, without loss of generality, we can assume 8n I  H. This is because, instead of solving > the original problem, we can minimize hv, δi + δ (H + tI)δ over kδk2w ≤ n/c for some sufficiently small t > 0. To see this, consider function ht (δ) = hv, δi + δ > (H + tI)δ. Let δ ∗ be the minimizer of the original function in kδk2w ≤ n/c and δt∗ be the minimizer of ht (δ) in kδk2w ≤ n/c. We have hv, δt∗ i + (δt∗ )> (H + tI)δt∗ ≤ hv, δ ∗ i + (δ ∗ )> (H + tI)δ ∗ ≤ hv, δ ∗ i + (δ ∗ )> Hδ ∗ + tkδ ∗ k22 ≤ hv, δ ∗ i + (δ ∗ )> Hδ ∗ + 4nt . c ε Therefore, we can instead fine an ε/2 approximate minimizer of ht (δ) for t = 8n . ε We now proceed to the main proof (under the assumption  that α = 0 and 8n I  H). Consider function gs (δ) = hv, δi + δ > Hδ + s kδk2w − n/c . Using the standard SDD solver (see ε3 Theorem A.5), for every s ≥ 0, we can find an δs such that gs (δs ) ≤ minδ∈Rd gs (δ) + 512s 2 n2 in time 21 e e O(m) where O hides polylog factor in n, s and 1/ε. Let us denote by  δ ∗ ∈ arg minkδk2w ≤n/c hv, δi + δ > Hδ . We now consider two cases.22 Case 1. In this case we assume kδ ∗ k2w = n/c. We always have ε ε gs (δs ) ≤ gs (δ ∗ ) + = hv, δ ∗ i + (δ ∗ )> Hδ ∗ + 4 4 and therefore, if kδs k2w ∈ [n/c − ε/(4s), n/c], we have: ε ε hv, δs i + (δs )> Hδs ≤ gs (δs ) + s · ≤ hv, δ ∗ i + (δ ∗ )> Hδ ∗ + 4s 2 2 as desired. Therefore, it remains to find a point δs such that kδs kw ∈ [n/c − ε/(4s), n/c]. Our binary-search algorithm proceeds as follows: 1. Find δ0 , if kδ0 k2w ≤ n/c then output δ0 . 21 ε We note that the original Theorem A.5 gives a multiplicative error bound. However, since H  8n I and kvk22 ≤ poly(n), this multiplicative error bound also implies an additive error bound. 22 Technically speaking, the algorithm does not know δ ∗ so does not know which of the two cases it belongs two. In any case, we can run the algorithm for both cases and outputs the one that gives a smaller objective value. 21 2. Let a = 0 and b = t = 4ckvk2 3. Repeatedly pick z = a+b 2 . If kδz k2w ≥ n/c, then let a = z, otherwise, let b = z. 4. Until kδz k2w ∈ [n/c − ε/(4z), n/c], and output δz . We first show that kδt k2w ≤ n/c − ε/(4t). Denote δs∗ = arg min{gs (δ)} = − 21 (H + sW)−1 v, where W = diag(w). We have kδt∗ k2w ≤ v > (H + tW)−1 W(H + tW)−1 v ≤ kvk22 Tr((H + tW)−1 W(H + tW)−1 ) ≤ Since H  ε 8n I, kvk22 n n ≤ . 2 t 2c (A.4) we also have: 8n ε3 ε2 8n (g(δt ) − g(δt∗ )) ≤ ≤ ε ε 512t2 n2 64t2 n ε and this implies kδt − δt∗ kw ≤ 8t . Plugging this into (A.4) we have kδt k2w ≤ n/c − ε/(4t). Since now we have kδt k2w ≤ n/c − ε/(4t), in each iteration of the binary search, we have kδb k2w ≤ n/c − ε/(4b) and kδa k2w ≥ n/c. Therefore, it suffices to bound the total number of binary-search iterations. To do this, we first calculate:   dkδs∗ k2w d 1 > −1 −1 v (H + sW) W(H + sW) v = ds ds 4   3  1 > −1 −1 −1 2 8n = v (H + sW) W(H + sW) W(H + sW) v ≤ 8kvk2 n2 . 2 ε kδt − δt∗ k22 ≤ This implies for any s, s0 : kδs∗ kw − kδs∗0 kw ≤ s 8kvk22  8n ε 3 n2 |s − s0 | Accordingly, we have kδs kw − kδs0 kw ≤ kδs − δs∗ kw − kδs0 − δs∗0 kw + kδs∗ kw − kδs∗0 kw ≤ ε 64kvk2 n2.5 p + |s − s0 | . 8s ε1.5 5 ε In other words, the binary search process must have terminated before |b − a| ≤ 32768n 5 kvk2 . This 2   ε5 e takes O log 32768n = O(1) iterations. Note also that throughout the binary search, s ≤ 5 kvk2 2 e 4ckvk2 , so the total complexity is O(m), hiding polylog factors in n and 1/ε. Case 2. In the case we assume kδ ∗ k2w < n/c. This implies δ ∗ = δ0∗ = −(2H)−1 v. We know that 1 2n hv, δ ∗ i + (δ ∗ )> Hδ ∗ = v > H−1 v ≤ kvk22 . 4 ε 5 In this case, we find δ0 such that g0 (δ0 ) ≤ g0 (δ ∗ ) + 512c2εn4 kvk4 . Again using H  2 s r 8n2 ε5 ε2 kδ0 − δ0∗ kw ≤ ≤ . ε 512c2 n4 kvk42 8kvk22 cn Therefore we still have: kδ0 k2w n ≤ (kδ kw + kδ − δ0 kw ) ≤ + 2 c ∗ ∗ 2 r n ε2 + c 8kvk22 cn 22  ε2 8kvk22 cn 2 ≤ ε 8n I, we have: n ε2 + . c 4ckvk22 If we just output δ = (1 − λ)δ0 for λ = ε2 , 4nkvk22 we will have:    ε2 n n ε2 2 2 2 kδkw ≤ (1 − λ) kδ0 kw ≤ 1 − ≤ + 2 2 c c 2nkvk2 2ckvk2 and   hv, δi + (δ)> Hδ ≤ (1 − λ) hv, δ0 i + (δ0 )> Hδ0 ε ≤ hv, δ ∗ i + (δ ∗ )> Hδ ∗ + + λ hv, δ0 i + (δ0 )> Hδ0 2 ε 2n ∗ ∗ > ∗ ≤ hv, δ i + (δ ) Hδ + + λkvk22 ≤ hv, δ ∗ i + (δ ∗ )> Hδ ∗ + ε 2 ε as desired.  Theorem A.5. Given a SDD matrix M ∈ Rn×n with m ≥ n nonzero entries, for every vector v ∈ Rn in the (column) span of M with 2-norm bounded by poly(n), every ε0 > 0, we can find a vector z ∈ Rn satisfying 1 1 kz − z ∗ k2M ≤ ε0 kz ∗ k2M and v > z + z > Mz ≤ (1 − ε0 ) minn {v > z + z > Mz} z∈R 2 2 0 e log(1/ε )), where the O e notation hides logarithmic factors in n. in time O(m Proof of Theorem A.5. Let z ∗ ∈ Rn be the exact minimizer for the right hand side, and denote by OPT = − minz∈Rn {v > z + 21 z > Mz}. Using standard SDD linear system solvers (originally proposed by Spielman and Teng [35], and later simplified by for instance [19, 21]) we can find a vector z satisfying e (z − z ∗ )> M(z − z ∗ ) ≤ ε0 (z ∗ )> Mz ∗ in time O((n + m) log(1/ε0 )) . (A.5) (See the appendix of [19] for this exact statement.) Using the fact that Mz ∗ = −v and OPT = 1 > ∗ 1 > 1 ∗ > ∗ > 0  2 (z ) Mz = − 2 v z , we can simplify (A.5) and obtain v z + 2 z Mv ≤ −(1 − ε )OPT. B Missing Details for Section 2 Recall that def f (x) = d X i=1 ri loghAi , ex i − c> x . (1.1) Proposition 2.3. Our objective f (x) in (1.1) is convex and P rA • ∇j f (x) = di=1 hAi i ,ei,jx i exj − cj . r A ·exj  • If k∇f (x)k2c−1 ≤ ε, then ihAi,j is an ε-approximate (r, c)-matrix. x i,j i ,e i • If A is exactly (r, c)-scalable, then there exists x∗ so that f (x∗ ) = minx {f (x)} and ∇f (x∗ ) = 0. • If A is asymptotically (r, c)-scalable, then inf x {f (x)} > −∞. • A is not asymptotically (r, c)-scalable if and only if inf x {f (x)} = −∞. Proof of Proposition 2.3. The first item after a simple calculation. The second item P is obtained rA hAi ,ex i follows as the ith row sum is given by nj=1 hAi i ,ei,jx i exj = ri · hA = ri and the j th column sum is x i ,e i P rA given by c0j = di=1 hAi i ,ei,jx i exj = ∇j f (x) + cj . Thus, kc0 − ck2c−1 = k∇f (x)k2c−1 ≤ ε implies that the 23 above matrix is an ε-approximate (r, c)-matrix. For the third item, let x, y be the scaling vectors so that diag(y)Adiag(x) is (r, c)-scaled. Then setting x∗ = log(x) we have ∇f (x∗ ) = 0. The fourth item follows from Lemma 3.3 established later. To prove the fifth item, it suffices to show if A is not scalable then f (x) can go to −∞. Using the characterization Proposition 2.2, one can find a direction x ∈ Rn to move so that f (xt) tends to −∞ as t → ∞.  C Missing Details for Section 3 C.1 Proof of Lemma 3.2 Lemma 3.2 (norm bound). If A is exactly (r, c) scalable, and all non-zero entries of A are within [ν, 1] for some ν > 0. Then, the following holds: 1. If A is full then there exists a minimizer x∗ of f (x) such that kx∗ k∞ ≤ ln hn ν . 2. If A is not full, then there exists a minimizer x∗ of f (x) such that kx∗ k∞ ≤ (h + 1/2) ln hν . Proof of Lemma 3.2. Let x∗ be any minimizer of f (x) and since ∇f (x∗ ) = 0, there must exist ∗ y ∈ Rd such that the matrix diag(y)Adiag(ex ) is an (r, c)-matrix. 1. Without loss of generality, we can P assume x∗1 ≥ x∗2 ≥ · · · ≥ x∗n = 0. It remains to bound x∗1 . ∗ Since Ai,n ≤ 1 for every i ∈ [d] and i∈[d] yi Ai,n exn = cn ≥ 1, there must exist i ∈ [d] such that h hn yi ≥ n1 . Therefore, since yi Ai,1 ex1 ≤ ri ≤ h and Ai,1 ≥ ν, we must have x1 ≤ ln Ai,1 yi ≤ ln ν . 2. It was shown in [16, Theorem 5.1 and Lemma 5.1] that one can assume |x∗j | ≤ (h + 1/2) ln hν .23  C.2 Proof of Lemma 3.3 In this section we prove the following lemma: Lemma 3.3. If A is asymptotically (r, c)-scalable, and all non-zero entries of A are within [ν, 1] for some ν > 0, then, for every ε > 0, there exists x∗ε ∈ Rn such that   ∗ )k ∗ ) − inf kx∗ε k∞ = O n ln nh , k∇f (x ≤ ε , and f (x f (x) ≤ ε . ∞ x ε ε νε In order to prove this Lemma 3.3, we need three structural lemmas. C.2.1 Structural Lemmas The first structural lemma states that if k∇f (x)k∞ is very small for some x ∈ Rn , then one can modify x to decrease its `∞ norm, without increasing k∇f (x)k∞ too much: Lemma C.1 (structural lemma 1). Suppose we are given x ∈ Rn satisfying k∇f (x)k∞ ≤ ε. Define 2 ρ = ln nν 2hε , and assume without loss of generality that x1 ≤ x2 ≤ · · · ≤ xn . Now, suppose there exists s ∈ [n − 1] such that xs+1 − xs = ρs ≥ ρ, then we choose y ∈ Rn as:  xi if i ≤ s; yi = xi − ρs + ρ if i > s.  and it satisfies k∇f (y)k∞ ≤ 1 + n1 ε. 23  They only stated the result for maxj∈[n] x∗j , however, their same proof also implies the upper bound on −x∗j . 24 Proof of Lemma C.1. Recall that for each i ∈ [n], ∇i f (y) = Pd j=1 rj to show that, for all i ∈ [n] and j ∈ [d] such that Aj,i 6= 0, we have Pn k=1 Aj,i Aj,k eyk −yi − ci . It suffices 1 1 ε − Pn ≤ . y −y x −x i i k k nh k=1 Aj,k e k=1 Aj,k e Pn We now divide the proof into the following two cases: P P P • Suppose i ≤ s. In this case, nk=1 Aj,k eyk −yi = sk=1 Aj,k exk −xi + nk=s+1 Aj,k eyk −yi . Now, if there exists k ≥ s + 1 such that Aj,k 6= 0, then we have: – Aj,k exk −xi ≥ νeρ , and this implies – Aj,k eyk −yi ≥ νeρ , and this implies Together, we have ε 1 ≤ νe1ρ ≤ 2nh ; and Aj,k exk −xi 1 ε 1 Pn yk −yi ≤ νeρ ≤ 2nh . k=1 Aj,k e Pn k=1 ε 1 − Pn A1 exk −xi ≤ nh . Aj,k eyk −yi j,k k=1 Pn P then k=1 Aj,k eyk −yi = nk=1 Aj,k exk −xi . Pn If there is no such k, k=1 • Suppose i > s. In this case, we have xi − xk ≥ ρs for k ≤ s and yk − yi = xk − xi for k ≥ s + 1. Hence, if Aj,k = 0 for all k ≤ s, we are done. Otherwise, we must have some k ≤ s such that ν ≤ Aj,k ≤ 1 and therefore, we have the following inequalities: s X k=1 Ajk exk −xi ≤ s X k=1 e−ρs ≤ se−ρs and as a consequence, we have: s s s X X X Ajk exk −xi ≤ se−ρ . Ajk exk −xi +(ρs −ρ) = eρs −ρ · Ajk eyk −yi = k=1 k=1 k=1 Since we are assuming that Aj,i 6= 0, and therefore Aj,i ≥ ν, we also have P P ν ≤ Aj,i ≤ nk=1 Aj,k exk −xi as well as ν ≤ Aj,i ≤ nk=1 Aj,k eyk −yi Together, we have 1 1 se−ρ ε P − ≤ ≤ . n y −y x −x 2 i i k k ν nh k=1 Aj,k e k=1 Aj,k e Pn  The second structural lemma says that if a matrix can be scaled sufficiently close to an (r, c)matrix, then it must be (asymptotically) (r, c)-scalable. Lemma C.2 (structural lemma 2). Suppose D is a non-negative matrix, with r = D1 and kD> 1− ck∞ < n1 , then D is asymptotically (r, c)-scalable. Proof of Lemma C.2. Suppose by way of contradiction that D is not asymptotically (r, c)-scalable. Then, by the Proposition 2.2, there must be a zero minor R × C ⊆ [d] × [n] of D P characterization P such that i∈[d]\R ri < j∈C cj . P P Since ri , cj are integers, we know that i∈[d]\R ri ≤ j∈C cj − 1. However, we also know that X X X X X X X ri = Di,j = Di,j ≥ Di,j i∈[d]\R i∈[d]\R j∈[n] = XX Di,j j∈C i∈[d] j∈C i∈[d]\R j∈[n] i∈[d]\R  X X 1 > cj − 1 . ≥ cj − n j∈C j∈C This contradiction completes the proof. 25  The third structural lemma gives an alternative characterization to the scalability of matrices: Lemma C.3 (structural lemma 3). If A is asymptotically (r, c)-scalable, then up to row and column permutations, A can be written as a block upper-triangular matrix A = (Bu,v )u∈[p],v∈[p] , where • each Bu,v is a submatrix (Ai,j )i∈Lu ,j∈Rv , where Lu ∩ Lu0 = Rv ∩ Rv0 = ∅ for u 6= u0 and v 6= v 0 .  • each Bu,u is exactly r|Lu , c|Ru -scalable. • each Bu,v = 0 if u > v. Proof of Lemma C.3. We prove this by induction. If A is already exactly (r, c) scalable then P P we are done. Otherwise, we claim that there must be a P zero minor L × R of A so that r = i j∈R cj . i∈L P This is because if for all zero minors it satisfies i∈L > j∈R cj , then A must be exactly scalable owing to Proposition 2.2. Now, if we permute the rows and columns, wePcan put this P L × R minor P in the lower P bottom B C of A, and write A = 0 D . In addition, since i∈L ri = j∈R cj and i∈L ri = j∈R cj , we claim that B is asymptotically (r|L , c|R )-scalable, and D is asymptotically (r|L , c|R )-scalable. This is because for every L0 × R0 zero minor of B, we have L0 ∪ L × R0 is also a zero minor of A, so it satisfies X X X ri = ri ≥ cj . i∈L\L0 i∈[d]\(L0 ∪L) j∈R0 And similarly for D. In sum, we can recurse on B and D until we find the desired block uppertriangular form.  C.2.2 Proof of Lemma 3.3 We are now ready to prove Lemma 3.3. Basically, we can start from a vector x with k∇f (x)k∞ being e sufficiently small, and then apply Lemma C.1 to make kxk∞ ≤ O(n). Finally, we use Lemma C.2 and Lemma C.3 to also bound the objective value. Proof of Lemma 3.3. As ∇f (x) = ∇f (x + t · 1) for any t ∈ R, we can always work with vectors x ∈ Rn such that kxk1 = n. Therefore, repeatedly applying Lemma C.1, we know that if A is asymptotically (r, c)-scalable, then for every ε > 0, we can obtain an xε ∈ Rn such that kxε k∞ =  nh O n ln νε and k∇f (xε )k∞ ≤ ε. A e(xε )j i,j Now, we define matrix A0 as A0i,j = hA . We know that A00 = (ri A0i,j )i,j is an εx i ,e ε i approximate (r, c)-matrix. Therefore, we claim that we can always write A00 as A00 = (1 − s)B + sD for some s ∈ [0, 1], where B is an exact (r, c)-matrix and D is not asymptotically (r, c)-scalable. This follows from an argument similar to [22]: since A00 is asymptotically (r, c)-scalable, we can write A00 in the upper triangular form according to Lemma C.3. This implies one can find an exact (r, c)-matrix C where the non-zero entries of C is a subset of the non-zero entries of A00 . Now, one can subtract a tC from A00 where t > 0 is the largest possible real value such that the entries of A00 − tC are still non-negative. If the remaining matrix A00 − tC is still asymptotically (r, c)-scalable, we can repeat this process until we reach a non-scalable matrix D. Finally, since the row sums of A00 already equal to r, we must have s ∈ [0, 1]. 00 is not asymptotically (r, s)-scalable, so by Lemma C.2, we have n1 ≤ Next, D = A −(1−s)B s kD> 1 − ck∞ = k(A00 )> 1−ck∞ s ≤ sε , which implies s ≤ εn. 26 Finally, defining B0 = diag(r)−1 B, we have for every x ∈ Rd : f (xε + x) − f (xε ) = ≥ = d X i=1 d X i=1 d X i=1 ¬ d X hAi , exε +x i − hc, xi = ri log ri loghA0i , ex i − hc, xi hAi , exε i i=1  ri log (1 − s)hB0i , ex i − hc, xi ri log(1 − s) + d X i=1 ri loghB0i , ex i − hc, xi ≥ −2hs ≥ −4hnε . Above, inequality ¬ uses the fact that B is already an (r, c)-matrix so for every x ∈ Rn (see Proposition 2.3). Dividing ε by 4hn gives the desired result. D D.1 ! Pd 0 x i=1 ri loghBi , e i−hc, xi ≥0  Missing Details for Section 4 Proof of Lemma 4.2 Lemma 4.2. Given x ∈ Rn , denote by ∇ = ∇f (x) and Λs , Λl ⊆ [n] the set of small and large coordinates (see Def. 4.1). Then, for every δ ∈ Rn where kδk∞ ≤ 1/2, we have  P  def P • if δ ≥ 0, then f (x) − f (x + δ) ≥ Q+ (x, δ) = j∈Λs − ∇j · δj − 43 cj · δj2 + j∈Λl − 73 ∇j · δj .  P  def P • if δ ≤ 0, then f (x) − f (x + δ) ≥ Q− (x, δ) = j∈Λs − ∇j · δj − 34 cj · δj2 + j∈Λl − 12 ∇j · δj . (Recall that δ ≥ 0 or δ ≤ 0 means entry-wise non-negativity or non-positivity.) Proof of Lemma 4.2. Note that Z 1 n Z X h∇f (x + τ δ), −δi dτ = f (x) − f (x + δ) = τ =0 j=1 1 τ =0 −(∇j f (x + τ δ) · δj ) dτ We now consider the two cases separately: • If δ ≥ 0, we have for all j ∈ [n], d X −(∇j f (x + τ δ) · δj ) = − i=1 d X ≥− If j ∈ Λs , then If j ∈ Λl , then Pd i=1 d X   ri Ai,j ri Ai,j xj +τ δj xj +τ δj − c · δ ≥ − − c · δj e e j j j hAi , ex i hAi , ex+τ δ i i=1 ri Ai,j xj i=1 hAi ,ex i e Pd Z i=1 = ∇j + cj ≤ 2cj so 1 4 −(∇j f (x + τ δ) · δj ) dτ ≥ −∇j · δj − δj2 cj . 3 τ =0 ri Ai,j xj i=1 hAi ,ex i e Z d X ri Ai,j  ri Ai,j xj 4 4 e (1 + τ δj ) − cj · δj = −∇j · δj − τ δj2 · exj x hAi , e i 3 3 hAi , ex i = ∇j + cj ≤ 2∇j f (x) so 1 4 7 −(∇j f (x + τ δ) · δj ) dτ ≥ −∇j · δj − δj2 ∇j ≥ − ∇j · δj 3 3 τ =0 27 • If δ ≤ 0, we have for all j ∈ [n], −(∇j f (x + τ δ) · δj ) = − ≥− If j ∈ Λs , Pd then Z 1 d X i=1 d X i=1 d X   ri Ai,j ri Ai,j xj +τ δj xj +τ δj e − c · δ ≥ − e − c · δj j j j hAi , ex i hAi , ex+τ δ i i=1 d X ri Ai,j  ri Ai,j xj 3 3 e (1 + τ δj ) − cj · δj = −∇j · δj − τ δj2 · exj x hAi , e i 4 4 hAi , ex i ri Ai,j xj i=1 hAi ,ex i e i=1 = ∇j + cj ≤ 2cj so 4 3 −(∇j f (x + τ δ) · δj ) dτ ≥ −∇j · δj − δj2 cj ≥ −∇j · δj − δj2 cj . 4 3 τ =0 P r A If j ∈ Λl , then di=1 hAi i ,ei,jx i exj = ∇j + cj ≤ 2∇j f (x) so Z 1 3 1 −(∇j f (x + τ δ) · δj ) dτ ≥ −∇j · δj − δj2 ∇j ≥ − ∇j · δj . 4 2 τ =0 D.2  Proof of Lemma 4.8 Lemma 4.8. If z 0 = MirrN (z, v), for every u satisfying kuk∞ ≤ N , we have 1 1 1 hv, z − ui ≤ hv, z − z 0 i − kz − z 0 k2c + kz − uk2c − kz 0 − uk2c . 2 2 2  n Proof of Lemma 4.8. 24 Denoting by w = (zi0 − zi )ci i=1 ∈ Rn , we compute that hv, z − ui = hv, z − z 0 i + hv, z 0 − ui ¬ ≤ hv, z − z 0 i + h−w, z 0 − ui 1 1 1 ­ = hv, z − z 0 i + kz − uk2c − kz 0 − uk2c − kz 0 − zk2c . 2 2 2 0 2 Here, ¬ is due to the minimality of z = arg minkxk∞ ≤N {kx − zkc + hv, xi}, which implies that  d h dx kx − zk2c + hv, xi x=z 0 , u − z 0 i = hw + v, u − z 0 i ≥ 0 for all kuk∞ ≤ N . Equality ­ can be verified by directly expanding out the three Euclidean norm squares, and is known as the “threepoint equality” for Bregman divergence.  D.3 Proof of Lemma 4.10  1 Lemma 4.10. If τk αk ≤ 3/64, τk ∈ 0, 32N , and u is any vector satisfying kuk∞ ≤ N , then 0≤   1 − τk 1 1 1 f (yk ) − f (u) − f (yk+1 ) − f (u) + kzk − uk2c − kzk+1 − uk2c . τk τk 2αk 2αk Proof of Lemma 4.10. Denoting by ∇ = ∇f (x) = ∇s + ∇l according to Def. 4.1, we use convexity to derive that f (xk+1 ) − f (u) ≤ h∇f (xk+1 ), xk+1 − ui = h∇f (xk+1 ), xk+1 − zk i + h∇l , zk − ui + h∇s , zk − ui (D.1) We bound the three terms on the right hand side of (D.1) separately. 24 This proof can be found for instance in the textbook [6]. 28 The first term in (D.1). We have xk+1 = τk zk + (1 − τk )yk and therefore h∇f (xk+1 ), xk+1 − zk i =  1 − τk 1 − τk h∇f (xk+1 ), yk − xk+1 i ≤ f (yk ) − f (xk+1 ) . τk τk (D.2) The second term in (D.1). Define u0 ∈ Rn where u0i = min{zk,i , ui }. Then, we have h∇l , zk − ui ≤ h∇l , zk − u0 i (D.3) because ∇l is a non-negative vector. Now, define v = 8τk u0 − 7τk zk + (1 − τk )yk and compare this to xk+1 = τk zk + (1 − τk )yk , we have that xk+1 − v = 8τk (zk − u0 ) ≥ 0. It is easy to verify that kvk∞ ≤ 15N because kzk k∞ ≤ N , ku0 k∞ ≤ N , kzk − u0 k∞ ≤ 2N , and kyk k∞ ≤ 15N . Now, consider two types of indices, let • A ⊆ [n] be the set of indices i where ∇li > 0 and xk+1,i > vi + 1/2, and • B ⊆ [n] be the set of indices i where ∇li > 0 and xk+1,i ≤ vi + 1/2. We apply Corollary 4.4 by choosing the following δ ∈ [−1/2, 0]n :  if j ∈ A;  −1/2, vi − xk+1,i ∈ [−1/2, 0], if j ∈ B; δj =  0, if j 6∈ A ∪ B. It must satisfy that ­ ® ¬ 1 1X 1X l 1X l ∇j · δ j ≥ − ∇j · δ j − ∇j · δj f (xk+1 ) − f (yk+1 ) ≥ Q− (xk+1 , δ) ≥ − 2 4 4 4 l j∈Λ = ° 1X 8 j∈A ≥ 2τk j∈A j∈B X ¯ 1X l 1 X l ∇lj + ∇j · (xk+1,j − vj ) ≥ ∇j · (zk,j − u0j ) + 2τk ∇lj · (zk,j − u0j ) 4 16N X j∈A∪B j∈B j∈A j∈B ± ∇lj · (zk,j − u0j ) = 2τk h∇l , zk − u0 i ≥ 2τk h∇l , zk − ui (D.4) Above, • Inequality ¬ comes from Corollary 4.4. (Note that we can apply Corollary 4.4 because kxk+1 + δk∞ ≤ 15N , which comes from the definition of δ and the facts kvk∞ ≤ 15N and kxk+1 k∞ ≤ 15N .) • Inequality ­ follows from the definition of Q− and the fact δ ≤ 0, see Lemma 4.2. • Inequality ® uses ∇j ≥ ∇lj for every j ∈ Λl and the fact δ ≤ 0. • Inequality ¯ uses kzk k∞ ≤ N and ku0 k∞ ≤ N so zk,j − u0j ∈ [0, 2N ], as well as the fact that xk+1 − v = 8τk (zk − u0 ) ≥ 0. • Inequality ° uses our assumption on τk . • Inequality ± comes from (D.3). The third term in (D.1). We first apply Lemma 4.8 to obtain h∇s , zk − ui ≤ h∇s , zk − zk+1 i − 1 1 1 kzk − zk+1 k2c + kzk − uk2c − kzk+1 − uk2c . 2αk 2αk 2αk (D.5) Define v = 8τk zk+1 − 7τk zk + (1 − τk )yk and compare this to xk+1 = τk zk + (1 − τk )yk , we have that xk+1 −v = 8τk (zk −zk+1 ). It is easy to verify that kvk∞ ≤ 15N because kzk k∞ ≤ N , kzk+1 k∞ ≤ N , kzk − zk+1 k∞ ≤ 2N , and kyk k∞ ≤ 15N . 29 We rewrite the first two terms on the right hand side of (D.5) as: h∇s , zk − zk+1 i − 1 1 1 kxk+1 − vk2c kzk − zk+1 k2c = h∇s , xk+1 − vi − 2 2αk 8τk 2 · 8 τk2 αk  1 4 ≤ h∇s , xk+1 − vi − kxk+1 − vk2c . 8τk 3 (D.6) Above, the inequality uses our provided upper bound to αk τk . Next, we define v 0 by  vj , if −∇sj · (vj − xk+1,j ) − 43 cj · (vj − xk+1,j )2 ≥ 0; 0 vj = xk+1,j , if −∇sj · (vj − xk+1,j ) − 34 cj · (vj − xk+1,j )2 ≤ 0. Therefore, (D.6) also implies h∇s , zk − zk+1 i −  1 1 4 kzk − zk+1 k2c ≤ h∇s , xk+1 − v 0 i − kxk+1 − v 0 k2c . 2αk 8τk 3 Define A−− , A− , A+ , A++ ⊆ [n] to respectively be the set of indices i where vi0 − xk+1,i is in the range (−∞, −1/2], (−1/2, 0), (0, 1/2), and [1/2, ∞). Define δ + , δ − ∈ Rn as the vector where  3 s  3 s if j ∈ A++ ; if j ∈ A−− ;  − 8 ∇j /cj ,  − 8 ∇j /cj , v 0 − xk+1,j , if j ∈ A+ ; v 0 − xk+1,j , if j ∈ A− ; and δj− = δj+ =  j  j 0, otherwise. 0, otherwise. One can carefully verify that δ + ∈ [0, 1/2]n and kxk+1 + δ + k∞ ≤ 15N .25 Similarly, it also satisfies δ − ∈ [−1/2, 0]n and kxk+1 + δ − k∞ ≤ 15N . Therefore, applying Corollary 4.4 we have 1 1 f (xk+1 ) − f (yk+1 ) ≥ Q+ (xk+1 , δ + ) + Q− (xk+1 , δ − ) . 2 2 25 (D.7) We verify them coordinate by coordinate. For each coordinate j ∈ [n], • If j 6∈ A+ ∪ A++ then δj+ = 0 so |xk+1,j + δj+ | = |xk+1,j | ≤ 15N . • If j ∈ A+ , we have δj+ ∈ [0, 1/2] by the definition of A+ , as well as |xk+1,j + δj+ | = |vj0 | ≤ 15N . • If j ∈ A++ then we have vj0 − xk+1,j > 0, so according to the definition of v 0 , we must have vj0 = vj , vj − xk+1,j > 0, and 4 ∇sj ≤ − cj (vj − xk+1,j ) < 0 3 However, ∇sj ∈ [−cj , cj ] so this means δj+ = − 83 ∇sj /cj ∈ (0, 3/8]. At the same time, xk+1,j + δj+ < xk+1,j + vj0 ≤ 15N . 30 1 2 ≤ Denote by δ = δ + + δ − , and noticing that δj+ and δj− cannot be both nonzero, we have Q+ (xk+1 , δ + ) + Q− (xk+1 , δ − ) X X  4 ¬ = − ∇j · δj − cj · δj2 + 3 s l j∈Λ j∈Λ ,δj >0 X ­ = j∈Λs ∩(A+ ∪A− ) X + ® ≥ ¯ ≥ X j∈Λl ∩A−  4 − ∇sj · δj − cj · (δj )2 + 3  1 − ∇j · δj + 2 X j∈Λl ∩A−− X j∈Λs X j∈Λl ,δj <0 j∈Λs ∩(A++ ∪A−− )  1 − ∇j · δj 2  4 − ∇sj · (vj0 − xk+1,j ) − cj · (vj0 − xk+1,j )2 + 3 j∈Λs X  7 − ∇j · δj + 3 X  1 − ∇j · δj 2  4 − ∇sj · δj − cj · (δj )2 3 j∈Λl ∩A−  1 − ∇j · δ j + 2 X j∈Λl ∩A−−  1 − ∇j · δj 2  1X  4 4 − ∇sj · (vj0 − xk+1,j ) − cj · (vj0 − xk+1,j )2 + − ∇sj · (vj0 − xk+1,j ) − cj · (vj0 − xk+1,j )2 3 2 3 l j∈Λ 1 X ≥ 2 j∈[n]  1  4 4 − ∇sj · (vj0 − xk+1,j ) − cj · (vj0 − xk+1,j )2 = h∇s , xk+1 − vi − kxk+1 − vk2c . 3 2 3 (D.8) Above, • Equality ¬ uses the definitions of Q− , Q+ , see Lemma 4.2. • Equality ­ uses the fact that whenever j ∈ Λl it must satisfy δj ≤ 0. Indeed, it satisfies ∇sj = cj so either vj0 = xk+1,j (in such a case δj = 0) or vj0 = vj (in such a case vj − xk+1,j < 0 so δj < 0). • Inequality ® is because (1) if j ∈ A+ ∪ A− then δj = vj0 − xk+1,j or (2) if j ∈ A++ ∪ A−− then arg maxt∈R {−∇sj · t − 43 cj · t2 } = − 38 ∇sj /cj = δj . • Inequality ¯ is because – For every j ∈ Λl ∩ A− , we have − 12 ∇j · δj ≥ − 12 ∇sj · δj ≥  1 4 s 0 0 2 2 − ∇j · (vj − xk+1,j ) − 3 cj · (vj − xk+1,j ) . 1 2  − ∇sj · δj − 43 cj (δj )2 = 3 – For every j ∈ Λl ∩ A−− , we have − 21 ∇j · δj = 16 cj ≥ 12 − ∇sj · (vj0 − xk+1,j ) − 43 cj · (vj0 −  2 xk+1,j ) , where the last inequality is because when ∇sj = cj —which holds since j ∈ Λl — 3 it satisfies maxt∈R {−∇sj · t − 34 cj · t2 } = 16 cj . Combining (D.5), (D.6), (D.7), and (D.8), we have h∇s , zk − ui ≤ 1 1 1 (f (xk+1 ) − f (yk+1 )) + kzk − uk2c − kzk+1 − uk2c . 2τk 2αk 2αk (D.9) Finally. Combining the three cases above, namely (D.2), (D.4), and (D.9), and plugging them back to (D.1), we have   1 − τk 1 1 1 f (xk+1 ) − f (u) ≤ f (yk ) − f (xk+1 ) + f (xk+1 ) − f (yk+1 ) + kzk − uk2c − kzk+1 − uk2c . τk τk 2αk 2αk After rearranging, we finish the proof of the lemma. 31  D.4 Proof of Theorem 4.11 Theorem 4.11. If y0 satisfies ky0 k∞ ≤ 15N and T ≥ 1, then the output yT = LC(A, N, T, y0 ) (see Algorithm 1) satisfies that for every u ∈ Rn and kuk∞ ≤ N :  N 2 f (y ) − f (u) + h  0 kyT k∞ ≤ 15N and f (yT ) − f (u) ≤ O . (N + T )2 Proof of Theorem 4.11. First of all, we show inductively that τk ≤ and τk is the unique positive root of the quadratic equation τk2 2 τk−1 2 64N +k . Recall that τ0 = 1 32N + τk − 1 = 0. Suppose this upper bound holds for τk−1 and we wish to prove that for τk . If τk ≥ 64N2+k then   τk2 64N + (k − 1) 2 2 1 + τk − 1 ≥ + −1= >0 2 64N + k 64N + k (64N + k)2 τk−1 which is a contradiction to the fact that τk is a root. Thus, we must have τk < 64N2+k . Now, since we have chosen τk αk = 3/64, we rewrite Lemma 4.10 as   32 1 32 1 − τk f (yk ) − f (u) − 2 f (yk+1 ) − f (u) + kzk − uk2c − kzk+1 − uk2c . 0≤ 2 3 3 τk τk Since 1−τk τk2 = 1 τT2 −1 1 , 2 τk−1 we can telescope the above inequality for k = 0, 1, . . . , T − 1 and obtain  32  1 − τ0 32 f (y0 ) − f (u) + kz0 − uk2c − kzT − uk2c . f (yT ) − f (u) ≤ 2 3 3 τ0 Plugging our bound τk ≤ D.5 2 64N +k and τ0 = (D.10) 1 32N , and noticing that z0 = 0, we immediately have that  N 2 f (y ) − f (u) + kuk2  0 c f (yT ) − f (u) ≤ O .  2 (N + T ) Proof of Theorem 4.12 We first establish a relationship between k∇s k2c−1 + k∇l k1 and k∇f (x)k2c−1 : Claim D.1. If ∇f (x) = ∇s + ∇l using Def. 4.1, and if k∇s k2c−1 + k∇l k1 ≤ t ∈ [0, 1], then k∇f (x)k2c−1 ≤ 3t and thus x gives a 3t-approximate (r, c)-scaling for A. 2 P Proof of Claim D.1. It satisfies k∇f (zk0 )k2c−1 = k∇s k2c−1 + j : ∇j f (z 0 )>cj ∇j f (zk0 ) /cj ≤ 3k∇s k2c−1 + k 2 P 2 j : ∇j f (z 0 )>cj ∇j f (zk0 ) − cj /cj ≤ 3k∇s k2c−1 + 2k∇l k21 ≤ 3t.  k Theorem 4.12 (Scaling0). If N ≥ 1, then (z1 , z) = Scaling0(A, N, T ) satisfies • If T ≥ N , then for every u satisfying kuk∞ ≤ N , we have kz1 k∞ ≤ 15N and f (z1 ) − f (u) ≤ O N 2h T2  . • If T ≥ (N 2 h)1/3 and there exists u so that kuk∞ ≤ N and f (u) − inf x {f (x)} ≤ 1, then 2  k∇f (z)k2c−1 ≤ O NT 3h . The total complexity of Scaling0 is O(m(N log N + T )). 32 Proof of Theorem 4.12. Recall that Scaling0 repeatedly applies LC. In each of the first log(N ) applications of LC, it satisfies according to Theorem 4.11 that  1  f (y0 ) − f (u) + h . kyT k∞ ≤ 15N and f (yT ) − f (u) ≤ O 2 Since it satisfies f (0)−f (u) ≤ 2hkuk∞ ≤ O(hN ) according to Lemma 3.1, after log(N ) applications of LC we must have kz0 k∞ ≤ 15N and f (z0 ) − f (u) ≤ O(h). Then, applying LC for T iterations, we have kz1 k∞ ≤ 15N and f (z1 ) − f (u) ≤ O(N 2 h/T 2 ) as desired. Finally, applying Corollary 4.5 for T steps, we have that there exists some k ∈ [T ] so that  2  (u)+1  x {f (x)} zk satisfies k∇s k2c−1 + k∇l k1 ≤ O f (z1 )−inf ≤ O f (z1 )−f ≤ O NT 3h , where ∇f (zk ) = T T ∇s + ∇l is the gradient splitting using Def. 4.1. Therefore, as long as N 2 h/T 3 ≤ 1, it must satisfy 2  k∇f (zk )k2c−1 ≤ O(k∇s k2c−1 + k∇l k1 ) ≤ O NT 3h owing to Claim D.1.  E E.1 Missing Details for Section 5 Proof of Lemma 5.1 Lemma 5.1 (second-order approximation). For every x, δ ∈ Rn with kδk∞ ≤ 1/8, we have 1 f (x) + hδ, ∇f (x)i + δ > ∇2 f (x)δ ≤ f (x + δ) ≤ f (x) + hδ, ∇f (x)i + δ > ∇2 f (x)δ . 6 First of all, we claim that it suffices to prove Lemma 5.1 for x = 0. This is because, if we define a new matrix A0 by setting A0i,j = Ai,j · exj , and a corresponding function g(·) defined in the same way as f (x) but with this new matrix A0 , then, it satisfies f (y) = g(y −x)+c> x, ∇f (y) = ∇g(y −x) and ∇2 f (y) = ∇2 g(y − x) for any y ∈ Rn Now, for a fixed direction (z1 , · · · , zd ), slightly abusing notation, we also define the univariate def function f (t) = f (tz1 , · · · , tzn ). We make the following claim which directly implies Lemma 5.1. Claim E.1. If kzk∞ ≤ 1 and |t| ≤ 81 , we have:  df 1 d2 f f (t) − f (0) + t + dt t=0 2 dt2 t t=0 2  ≤ 1 d2 f 3 dt2 t=0 t2 Proof of Claim E.1. The proof is just a direct calculation. We have !! Pn d tzj X j=1 Ai,j zj e 0 Pn f (t) = ri − hc, zi . tzj j=1 Ai,j e (E.1) i=1 We consider a fixed i ∈ [n] and focus on the term def hk (t) = n X Ai,j zjk etzj j=1 Pn j=1 Pn Ai,j zj etzj j=1 Ai,j etzj . Let us denote Pn tzj h1 (t) j=1 Ai,j zj e and g(t) = = Pn . tzj h0 (t) j=1 Ai,j e def (E.2) We wish to bound the higher-order derivatives of f (t) by bounding higher-order derivatives of g. Since h0 (t)g(t) = h1 (t), by the chain rule of derivative, we have for all s ∈ N s   s   dk g ds h1 X s dk g ds−k h0 X s = = h s−k dts k dtk dts−k k dtk k=0 k=0 33 where the last equality is due to dhk dt ds g 1 = s dt h0 = hk+1 . Now, s−1   X s dk g hs+1 − hs g0 − hs−k k k dt k=1 ! . k Again, for notation simplicity, let us denote gk = ddtkg , we then have: ! s−1   s−1   X X 1 s 1 s |gs | ≤ |hs+1 − hs g0 | + |hs−k ||gk | ≤ (|hs+1 − hs g0 |) + |gk | , |h0 | k |h0 | k def k=1 k=1 where the second inequality is because when |zj | ≤ 1, we always have |hs | ≤ |h0 | = h0 . This implies s−1   X s 1 (|hs+1 (0) − hs (0)g0 (0)|) + |gk (0)| |gs (0)| ≤ |h0 (0)| k k=1 Let us first check the term h0 (0) · (hs+1 (0) − hs (0)g0 (0)) = h0 hs+1 (0) − hs (0)h1 (0). We know that   X s+1 s s h0 (0)hs+1 (0) − hs (0)h1 (0) = Ai,j1 Ai,j2 zjs+1 + z − z z − z z j1 j2 j2 j1 j2 1 1≤j1 <j2 ≤d X = 1≤j1 <j2 ≤d ≤s X Ai,j1 Ai,j2 (zj1 − zj2 )2 1≤j1 <j2 ≤d Ai,j1 Ai,j2 (zj1 − zj2 )2 s−1 X zjk1 zjs−1−k 2 k=0 ! = s(h0 (0)h2 (0) − h1 (0)2 ) = sh0 (0)2 g1 (0) . In the same manner, we can also show h0 (0)hs+1 (0) − hs (0)h1 (0) ≥ −sh0 (0)2 g1 (0). Therefore, s−1   X s |gk (0)| . |gs (0)| ≤ s|g1 (0)| + k k=1 At this point, we can inductively prove that |gs (0)| ≤ 2s s!|g1 (0)| for s ≥ 1. This is true for s = 1. For s ≥ 2, we have: ! ! s−1   s−1 X X 2k s k ≤ |g1 (0)| (s + s!(2s − 1)) ≤ 2s s!|g1 (0)| . |gs (0)| ≤ |g1 (0)| · s + 2 k! = |g1 (0)| · s + s! (s − k)! k k=1 k=1 2s s!|g1 (0)| Plugging this upper bound |gs (0)| ≤ indices i ∈ [n], we immediately have ∀s ≥ 2, ds f dts t=0 back to (E.1) and (E.2), and summing up over all ≤ 2s s! d2 f dt2 t=0 . Using Taylor expansion, we can conclude that for all t ≤ 81 ,   df 1 d2 f 1 d2 f 2 f (t) − f (0) + t + t ≤ dt t=0 2 dt2 t=0 3 dt2 E.2 t=0 t2 .  Proof of Lemma 5.4 Lemma 5.4. Given x with kxk∞ ≤ N and Laplacian matrix H with H  ∇2 f (x)  1.1H, we have (a) For every u ∈ Rn with kuk∞ ≤ N ,   1 − minδ∈boxN (x) h∇f (x), δi + 16 δ > Hδ ≥ 64N f (x) − f (u) . 34 b ∞ ≤ 1/8 and (b) For ε ≥ 0, If we are given δb satisfying kδk  1 > b + 1 δb> Hδb ≤ min h∇f (x), δi δ∈boxN (x) h∇f (x), δi + 6 δ Hδ + ε , 6   1 δb ≥ 900N f (x)−f (u) −ε. then it satisfies that for every u ∈ Rn with kuk∞ ≤ N , f (x)−f x+ 6.6 N −1 1 Proof of Lemma 5.4. Let y = 64N 64N x + 64N u then one can carefully verify that y − x ∈ box (x). 1 1 By the convexity of f (·), we have f (y) ≤ (1 − 64N )f (x) + 64N f (u) and therefore f (x) − f (y) ≥ 1 64N f (x) − f (u) . This implies f (x) − min δ∈boxN (x) {f (x + δ)} ≥  1 f (x) − f (u) . 64N Now, using Lemma 5.1 and ∇2 f (x)  H, we further have −  1 1 {h∇f (x), δi + δ > Hδ} ≥ f (x) − f (u) . 6 64N δ∈boxN (x) min The conditions in item (b) imply    δb> δb  1  δb b + 1 δb> Hδb ≥ 1 i + 1.1 H =− h∇f (x), δi f (x) − f (u) − ε . − h∇f (x), 6.6 6.6 6.6 6.6 6 900N 2 At the same time, applying Lemma 5.1 again together with ∇ f (x)  1.1H, we have   δb> 2 δb  1 δb b i+ ∇ f (x) ≥ f (x) − f (u) − ε . f (x) − f (x + δ/6.6) ≥ − h∇f (x), 6.6 6.6 6.6 900N F F.1  Missing Details for Section 6 Proof of Lemma 6.1 Lemma 6.1 (MWUbasic). If H ∈ Rn×n is Laplacian, K ≥ 1, T ≥ Ω((n1/2 K + K 2 ) log n), kαk∞ ≤ 1/32, and ε > 0, then the output δ = MWUbasic(A, H, α, T, K, ε) satisfies  1 1 1 > 1 + and h∇, δi + δ Hδ ≤ kδ − αk∞ ≤ min h∇, δi + δ > Hδ + ε . 32 8K 6 6 kδ−αk∞ ≤1/32 Proof of Lemma 6.1. Our MWUbasic runs runs the constrained multiplicative weight update method introduced in Section A.1 with T iterations and βi = 12 for each i ∈ [n].  Define OPT = − minkδ−αk∞ ≤1/32 h∇, δi + 16 δ > Hδ ≥ 0 . In each iteration k, we use Lemma A.4 to find a vector δk ∈ Rn satisfying  1 1 n kδk − αk2wk ≤ and h∇f (x), δk i + δk> Hδk ≤ min h∇f (x), δi + δ > Hδ + ε 1024 6 6 kδ−αk2w ≤n/1024 k P 2 Since any vector δ with kδ − αk∞ ≤ 1/32 also satisfies kδ − αk2wk = i∈[n] (δi − αi ) wk,i ≤ P 1 i∈[n] wk,i = n/1024, we must have 1024 1 h∇f (x), δk i + δk> Hδk ≤ −OPT + ε . 6 n Define the loss vector `k by setting `k,i = −|δk,i − αi |. Since each (δk,i − αi )2 ≤ 1024w ≤ n, k,i √ √ we can choose ρ = n and η = 1/( n + K) in order to apply Lemma A.1. We have that for every 35 u ∈ ∆: T −1 T −1  n log(2n2 ) 1 X 1 X h`k , −ui ≤ h−`k , wk i + 2ηk`k k2wk + T T ηT k=0 k=0 T −1 q X  n log(2n2 ) k`k k2wk · kwk k1 + 2ηk`k k2wk + ηT k=0 √ T −1 1 X n 2 n  n( n + K) log(2n2 ) √ + . ≤ +√ T T n + K 2048 2048 k=0 P −1 n n 1/2 Therefore, as long as T ≥ Ω((n K + K 2 ) log n), we must have T1 Tk=0 h`k , −ui ≤ 32 + 8K . This P T −1 1 1 1 implies that T k=0 |δk,i − αi | ≤ 32 + 8K for every i ∈ [n] (because we can choose u = n × ei ). P −1 In sum, if we define δ = T1 Tk=0 δk , we have ≤ kδ − αk∞ ≤ 1 T 1 1 + 32 8K 1 > and h∇f (x), δi + δ Hδ ≤ −OPT + ε . 6  Theorem 6.2 (Scaling1). If N ≥ 1 and ε ∈ (0, 1), the output y = Scaling1(A, N, ε) satisfies kyk∞ ≤ 2N f (y) − f (u) ≤ ε and for every u with kuk∞ ≤ N . Furthermore, if there exists u satisfying f (u) − inf x {f (x)} ≤ ε and kuk∞ ≤ N , then we also have e (m + n3/2 )). k∇f (y)k2c−1 ≤ ε. The total complexity is O(N Proof of Theorem 6.2. In each iteration t, with 1 1 + and h∇, δi + kδ − αk∞ ≤ 32 8K we have kxt k∞ ≤ N and Lemma 6.1 finds us a vector δ  ε 1 > 1 . δ Hδ ≤ min h∇, δi + δ > Hδ + 6 6 900N kδ−αk∞ ≤1/32 We have kδk∞ ≤ kδ − αk∞ + kαk∞ < 1/16 and δ −α 6.6 ∞ ≤ 1 δ−α 6.6 Since any δ satisfying kδ − αk∞ ≤ δ 6.6 k∞ 1 50K . 1 32  1  + 1− α 6.6 ∞ ∞ ≤ 1 1 + . 32 50K also satisfies kxt + δk∞ ≤ N (see Fact 5.3), we immediately have kxt + ≤N+ In sum, owing to Lemma 5.4, if we let xt+1 = xt + δ/6.6 it satisfies n o 1 1 kxt+1 k∞ ≤ N + and f (xt ) − f (xt+1 ) ≥ max 0, f (xt ) − f (u) − ε . 50K 900N This means we can find a point y satisfying kyk∞ ≤ 2N and f (y) − f (u) ≤ ε if we choose K = Θ(log(1/ε)). If f (u) − inf x {f (x)} ≤ ε, then using Claim D.1 we also have k∇f (y)k2c−1 ≤ ε. e e The per iteration complexity of Scaling1 is O(m + n3/2 ), in which the complexity O(m) is for 2 e 3/2 ) is for obtaining the sparsification matrix H of the Hessian ∇ f (xt ), and the complexity O(n the multiplicative weight update subroutine MWUbasic.  36 G G.1 Missing Details for Section 7 Proof of Lemma 7.1 Lemma 7.1. In each iteration t of Scaling2, if kxt k∞ ≤ N , then we can compute xt+1 in come plexity O(m + T n), and it satisfies kxt+1 k∞ ≤ N and Nh 1 either (1) : f (xt+1 ) − f (u) ≤ O 2 or (2) : f (xt ) − f (xt+1 ) ≥ Ω (f (xt ) − f (u)) . T N Here, u is any vector satisfying kuk∞ ≤ N . Proof of Lemma 7.1. We use accelerated gradient descent to directly solve the following minimization problem:  1 def (G.1) 0 ≥ OPT = min h∇f (x), δi + δ > Hδ 6 δ∈boxN (x) p b i,j = √ Hi,j . This re-scaling translates We re-scale the problem by letting δbi = Hi,i δi and H Hi,i Hj,j  1 b> b b b b is still Laplacian the problem into a new one minδ∈ hg, δi + δ H δ , where the new matrix H b box d 6 b δb is 1-smooth (i.e., but has spectral norm at most 1. This means that the quadratic function 1 δb> H 6 its Hessian has constant spectral norm) so we can apply the constrained version of accelerated gradient descent (see for instance [4, Theorem 4.1]), and obtain a vector δ ∈ boxN (xt ) satisfying  kδb∗ k2  1 2 h∇f (xt ), δi + δ > Hδ − OPT ≤ O . 6 T2 p Here, δ ∗ is any minimizer of (G.1) and δb∗ is its re-scaled version (namely, δbi∗ = Hi,i δi∗ ). Since  P P P Ai,j e(xt )j i∈[d],j∈[n] ri hAi ,ext i = j∈[n] ∇j f (xt ) + cj = i∈[d] ri = h, we have kδb∗ k22 = X j∈[n] (δ ∗ )2j Hj,j ≤ X j∈[n] (δ ∗ )2j ∇j,j f (xt ) ≤ X j∈[n]  X  (δ ∗ )2j ∇j f (xt )+cj ≤ ∇j f (xt )+cj = h . j∈[n] Therefore, we can get a point δ ∈ boxN (xt ) satisfying  h 1 h∇f (xt ), δi + δ > Hδ − OPT ≤ O 2 . 6 T (G.2) h ) then we are done, because we can always At this point, if we have f (xt ) − f (u) ≤ O( N T2 assume that f (xt+1 ) ≤ f (xt ). (This is because we can always choose xt+1 = xt .) Otherwise, we must have −OPT ≥ Ω( Th2 ) according to Lemma 5.4.a, and this together with (G.2) implies we have h∇f (xt ), δi + 61 δ > Hδ ≤ OPT. According to Lemma 5.4.b, this means we can move to xt+1 = xt + δ and it satisfies f (xt )−f (xt+1 ) ≥ Ω( N1 )(f (xt )−f (u)). Note that we also have kxt+1 k∞ ≤ N because δ ∈ boxN (xt ) (see Fact 5.3). e Finally, since each iteration of the accelerated gradient runs in time O(n) because H has sparsity e at most O(n) (see Lemma A.3), we have the desired complexity bound.  H H.1 Missing Details for Section 8 Proof of Theorem 8.1 We first show that Theorem 8.1 is a simple corollary of Lemma 8.4. 37 Theorem 8.1 (Scaling3). If x0 satisfies f (x0 )−f (u) ≤ N n1/3 and kx0 k∞ ≤ N , and ε ∈ (0, 1/4], then the output y = Scaling3(A, N, x0 , ε) satisfies kyk∞ ≤ 10N and f (y) − f (u) ≤ ε for every u with kuk∞ ≤ N . Furthermore, if there exists u satisfying f (u) − inf x {f (x)} ≤ ε and kuk∞ ≤ N , then we also have e (m + n4/3 )). k∇f (y)k2c−1 ≤ ε. The total complexity is O(N Proof of Theorem 8.1. At the beginning of each iteration t, we have kxt k∞ ≤ N . Lemma 8.4 finds 1 us a vector δ with kδ − αk∞ ≤ 32 + K2 , and therefore  1 δ 1 1  1 α ≤ −α ≤ δ−α + 1− + 6.6 6.6 6.6 32 K ∞ ∞ ∞ Recall that any δ satisfying kδ − αk∞ ≤ δ 6.6 k∞ 1 32 1 K. also satisfies kxt + δk∞ ≤ N (see Fact 5.3), we ≤N+ immediately have that kxt + Lemma 8.4 also tells us that δ satisfies one of the following:  > 1. Either h∇, δi + 16 δ Hδ ≤ 0.25 minkδ−αk∞ ≤1/32 h∇, δi + 16 δ > Hδ + ε 20000N . δ In this case, owing to Lemma 5.4, if we let xt+1 = xt + 6.6 it satisfies n o ε 1 1 kxt+1 k∞ ≤ N + and f (xt ) − f (xt+1 ) ≥ max 0, f (xt ) − f (u) − . K 10000N 20000N This also means that if f (xt ) − f (u) ≥ ε, then f (xt+1 ) ≤ f (xt ). > 1 ρ 2. Or h∇f (x), δi + 61 δ Hδ ≤ − 256 K , this means that kxt+1 k∞ ≤ N + 1 K and f (xt ) − f (xt+1 ) ≥ 1 ρ . 256 K   e ) times Obviously, the second case can only happen no more than O (f (x0 )−infρx {f (x)})K = O(N   x {f (x)}) and thus diameter N can not be increased by more than O (f (x0 )−inf = O(N ). For the ρ first case, if we choose K = Θ(log(1/ε)) and allow the first case to run for N K iterations, then we must have a point y satisfying kyk∞ ≤ 10N and f (y) − f (u) ≤ ε. Finally, if f (u) − inf x {f (x)} ≤ ε, then using Claim D.1 we also have k∇f (y)k2c−1 ≤ ε. e We argue that the per-iteration complexity of Scaling3 is O(m + n4/3 ). First of all, it takes e complexity O(m) to obtain the sparsification matrix H of the Hessian ∇2 f (xt ). Next, each round 26 and there are at most T = O(n e e 1/3 ) rounds.  of subroutine MWUfull runs in complexity O(n), H.2 Three Structural Lemmas In order to prove Lemma 8.4, we need to establish three structural lemmas. Notations. Throughout this subsection, we use w to denote wk which is the weight vector at round k of MWUfull. We also denote by y = δk the approximate minimizer of h∇, δi + 61 δ > Hδ over the `2 constraint kδ − αk2wk ≤ n/1024 at iteration k of MWUfull (see Line 5). We also use ∇ and ∇2 to represent the gradient and Hessian at the current point, and it satisfies H  ∇2  1.1H. Suppose |y1 | ≥ · · · |yn |. Then, 26 This includes also Line 11 of MWUfull. Since s ≤ O(n1/3 ) when Line 11 is reached, the recursive call to MWUbasic e 3/2 ) = O(n e 1/2 ). on the smaller-sized problem (with dimension s) costs running time at most O(s 38 • In Section H.2.1, that that whenever there is a large gap between |ys | and |ys+1 |, then Ps we show 1 either (a) | i=1 ∇i | ≥ 2 or (b) the Hessian ∇2 is almost disconnected. See Lemma H.1. • In Section H.2.2, we show that if Case (b) happens, we can reduce the problem to a smallersized one with respect to the first s coordinates. See Lemma H.3. • In Section H.2.3, we show that if Case (a) happens, we can sufficiently decrease the objective by moving in the direction (1, · · · 1, 0, · · · 0). See Lemma H.4. H.2.1 Structural Lemma 1 We show that that whenever there is a large gap between |ys | and |ys+1 |, then either | or the Hessian ∇2 is almost disconnected. Ps i=1 ∇i | ≥ 1 2 Lemma H.1. Let w ∈ Rn be a weight vector satisfying wi ∈ [1/2, n], let α ∈ Rn be a vector satisfying kαk∞ ≤ 1 and kαk2w ≤ n/1024, and let ε be in 0, 41 . If y satisfies   1 > 1 > n 2 and h∇, yi + y Hy ≤ min h∇, δi + δ Hδ + ε ky − αkw ≤ 1024 6 6 δ∈Rn ,kδ−αk2w ≤n/1024 and without loss of generality y1 ≥ y2 ≥ · · · ≥ yn , then, for every s ∈ [n − 1], the following holds 1. If ys ≥ 15 and ys − ys+1 ≥ 15, then letting v = (1, . . . , 1, 0, . . . , 0), we have | {z } | {z } either X i∈[s] 1 ∇i ≤ − , 2 X i∈[s] ∇i ≥ v > ∇2 v  s n−s or  X i∈[s] ∇i ≤ ε, v > ∇2 v ≤ ε 2. If ys+1 ≤ −15 and ys − ys+1 ≥ 15, then letting v = (0, . . . , 0, −1, . . . , −1), we have | {z } | {z } either X i∈[s] 1 ∇i ≥ , 2 X i∈[s] ∇i ≥ v > ∇2 v  s or  X i∈[s] n−s v > ∇2 v ≤ ε ∇i ≤ ε,   Proof of Lemma H.1. We only prove the first case and the second is symmetric. The proof follows by “trying” to find a point y 0 satisfying ky 0 − αk2w ≤ n/1024 and 1 1 h∇, yi + y > Hy > h∇, y 0 i + (y 0 )> Hy 0 + ε 6 6 which gives a contradiction. In fact, we simply choose y 0 = y − v. Since kαk∞ ≤ 1 and ys ≥ 15, we know that for every i ∈ [s], it satisfies (yi0 − [α]i )2 ≤ (yi − [α]i )2 . This implies ky 0 − αk2w ≤ ky − αk2w ≤ n/1024. We now calculate the change of the quadratic function when we move from y to y 0 . It must be upper bounded by ε because of the optimality of y: X X 1 1 1 ε ≥ h∇, yi + y > Hy − h∇, y 0 i − (y 0 )> Hy 0 = ∇i + |Hi,j |[(yi − yj )2 − (yi − 1 − yj )2 ] 6 6 6 i∈[s] ≥ ≥ X i∈[s] X i∈[s] 1 ∇i + 6 X i∈[s],j∈[n]\[s] |Hi,j |[2(yi − yj ) − 1] ≥ X 29 ∇i + v > Hv ≥ ∇i + 4 · v > ∇2 v . 6 i∈[s],j∈[n]\[s] X i∈[s] ∇i + 29 6 X i∈[s],j∈[n]\[s] |Hi,j | i∈[s] The above the calculation uses the fact that H is Laplacian so δ > Hδ = next consider two cases: 39 P i<j |Hi,j |(δi − δj )2 . We 1. | P i∈[s] ∇i | P ≥ 12 . We must have i∈[s] ∇i ≤ − 12 . Therefore, using ε ≤ 1/4, we have X X ∇i . ∇i + 4v > ∇2 v ≤ ε =⇒ v > ∇2 v ≤ i∈[s] i∈[s] P P 2. | i∈[s] ∇i | < 12 . In this case we denote by ai = sj=1 Ai,j for each i ∈ [d], and have (which follows from the definitions of ∇ and ∇2 for our function f (·)) X ai (ri − ai ) X X X cj and v > ∇2 v = ai − ∇j = . ri j∈[s] i∈[d] j∈[s] i∈[d] Now, let us split ai into ai = [ai ] + {ai } where [ai ] is an integer and {ai } ∈ [−1/2, 1/2]. Since each ri is an integer and ai ∈ [0, ri ], we know ai (ri − ai ) 1 1X ≥ |{ai }| and v > ∇2 v ≥ |{ai }| . ri 2 2 i∈[d] Ps On the other hand, since j=1 cj is an integer, apply Fact H.2 on a = Ps P j=1 cj , we know that i∈[d] [ai ] − 1X 1 1 1 X v > ∇2 v ≥ |{ai }| ≥ |a| ≥ |a + b| = ∇i 2 2 2 2 i∈[d] which implies that ε≥ Therefore, we must have P i∈[s] ∇i + 4v > ∇2 v ≥ X i∈[s] and b = ∇i  ≤ ε and v > ∇2 v ≤ ε. Fact H.2. Let a ∈ R and b ∈ N. Suppose 0 ≤ |a + b| < 12 , then |a| ≥ |a + b|. Proof. Can be verified by case analysis. H.2.2 i∈[d] {ai } i∈[s] X i∈[s] ∇i P  Structural Lemma 2 P Our next lemma states that, the Hessian is almost disconnected —precisely, if the case “ i∈[s] ∇i ≤ > 2 ε and v ∇ v ≤ ε” takes place in Lemma H.1— then we can reduce the problem to a smaller one corresponding only to the first s coordinates (see (H.1) below), and then append the solution of this smaller problem (denoted by z/ ) with the last n − s coordinates of y (denoted by y. ). The final solution z = (z/ , y. ) satisfies kz − αk2w ≤ n/1024 and has a small quadratic value h∇, zi + 16 z > Hz (see (H.2) below). Lemma H.3. Let w ∈ Rn be a weight vector satisfying wi ∈ [1/2, n], let α ∈ Rn be a vector satisfying kαk∞ ≤ 1 and kαk2w ≤ n/1024, and let ε be in 0, 41 . Suppose y satisfies   1 > 1 > n 2 ky − αkw ≤ and h∇, yi + y Hy ≤ min h∇, δi + δ Hδ + ε . 1024 6 6 δ∈Rn ,kδ−αk2w ≤n/1024 Now, suppose there exists s ∈ [n − 1] satisfying 1. |yi | ≥ 15 for all i = 1, 2, . . . , s, and 2. h∇, vi ≤ ε and v > ∇2 v ≤ ε where v = (sgn(y1 ), . . . , sgn(ys ), 0, . . . , 0) | {z } | {z } s 40 n−s and suppose we are given z/ ∈ Rs satisfying kz/ −αk∞ 1 ≤ 16 and   1 > 1 1 > h∇/ , z/ i+ z/ H/ z/ ≤ min h∇/ , δi + δ H/ δ +ε (H.1) 6 2 δ∈Rs ,kδ−α/ k∞ ≤1/32 6 Then, letting z = (z/ , y. ), we have kz−αk2w n ≤ 1024 and   1 > 1 1 > h∇, zi+ z Hz ≤ min h∇, δi + δ Hδ +14n3 ε . (H.2) 6 2 δ∈Rn ,kδ−αk∞ ≤1/32 6 Proof of Lemma H.3. Define δ ∗ = (δ/∗ , δ.∗ ) where   1 > ∗ δ/ ∈ arg min h∇/ , δi + δ H/ δ , 6 δ∈Rs ,kδ−α/ k∞ ≤1/32   1 > ∗ δ. ∈ arg min h∇. , δi + δ H. δ 6 δ∈Rn−s ,kδ−α. k∞ ≤1/32 def 00 ∗ Let y 0 =  v. Define y. = (1 − λ)y. + λδ. for parameter λ = 1 y − each wi ∈ 2 , n , we have X ky 00 − αk2w = wi (yi00 − αi )2 ≤ ≤ ≤ X i∈[s] X i∈[s] X i∈[n] i∈[n] wi (yi0 − αi )2 + X i∈{s+1,··· ,n}  wi (yi − αi ) − 1 + 2 1 wi (yi − αi )2 − s + 2 n 1 ≤ − s+ 1024 2 X i∈{s+1,··· ,n} and 1 , 2n2 def and y 00 = (y/0 , y.00 ). Since (1 − λ)wi (yi − αi )2 + λwi ((δ ∗ )i − αi )2 X i∈{s+1,··· ,n} X i∈{s+1,··· ,n} wi (yi − αi )2 + λwi ((δ ∗ )i − αi )2   λwi ((δ ∗ )i − αi )2 λwi ((δ ∗ )i − αi )2 ≤ 1 n n − + n2 λ ≤ . 1024 2 1024 We now calculate the value of the quadratic function on y 00 comparing to y: ¬ 1 1 ε ≥ h∇, y − y 00 i + y > Hy − (y 00 )> Hy 00 6 6   2 ­ 1 1 1 1 ≥ h∇/ , y/ − y/00 i + y/> H/ y/ − (y/00 )> H/ y/00 + h∇. , y. − y.00 i + y.> H. y. − (y.00 )> H. y.00 − kys00 k2∞ v > Hv 6 6 6 6 3   2 1 > 1 0 > 1 > 1 00 > 0 0 00 00 = h∇/ , y/ − y/ i + y/ H/ y/ − (y/ ) H/ y/ + h∇. , y. − y. i + y. H. y. − (y. ) H. y. − kys00 k2∞ v > Hv 6 6 6 6 3   2 ® √ 1 1 2 ≥ h∇/ , v/ i + h∇. , y. − y.00 i + y.> H. y. − (y.00 )> H. y.00 − kys00 k2∞ v > Hv − nε . 6 6 3 3 ¯ 1 1 ≥ −4nε + h∇. , y. − y.00 i + y.> Hy. − (y.00 )> Hy.00 . 6 6 Above, inequality ¬ is by the approximate optimality of y; inequality ­ uses the fact that v = (sgn(y1 ), . . . , sgn(ys ), 0, . . . , 0) and thus for any vector p: X   4kpk∞ v > Hv ≥ |Hi,j |(pi − pj )2 = p> Hp − p> H/ p + p> H. p ≥ 0 ; (H.3) i∈[s],j∈[n−s] In equality ® uses y/> H/ y/ − (y/0 )> H/ y/0 ≤ ky/ k∞ X i,j∈[s] √ |Hi,j |(sgn(yi ) − sgn(yj ))2 ≤ 2ky/ k∞ v > Hv ≤ 4 nε 41 P Inequality ¯ uses (1) i∈[s] sgn(yi )∇i ≥ −ε, (2) v > Hv ≤ ε, and (3) kys00 k∞ ≤ max{kyk∞ , kδ ∗ k∞ } ≤ p √ √ 2 n, where (3) comes from the fact that ky −αk2w ≤ n/1024 implies |yi −αi | ≤ n/(1024wi ) ≤ n. Next, define convex function g(δ) = h∇. , δi + 16 δ > H. δ for δ ∈ Rn−s , then we have just proved 1 1 ε ≥ h∇, y − y 00 i + y > Hy − (y 00 )> Hy 00 ≥ g(y. ) − g(y.00 ) − 4nε = g(y. ) − g((1 − λ)y. + λδ.∗ ) − 4nε 6 6 ≥ λ(g(y. ) − g(δ.∗ )) − 4nε . This implies 5nε ≤ g(δ.∗ ) + 10n3 ε . (H.4) λ Finally, we are ready to analyze our choice z = (z/ , y. ). We first compute that X X X  wi ((z/ )i − αi )2 − (yi − αi )2 wi (yi − αi )2 + wi (zi − αi )2 = kz − αk2w = g(y. ) ≤ g(δ.∗ ) + i∈[s] i∈[n] i∈[n] ≤ n + 1024 X i∈[s] wi (  1 n − (15 − 1)2 ≤ . 2 16 1024 Therefore, the first assertion in (H.2) is satisfied. Next, denote by   1 > δ∈ arg min h∇, δi + δ Hδ , 6 δ∈Rn ,kδ−αk∞ ≤1/32 we also have     ¬ 1 > 1 1 2 > > h∇, zi + z Hz ≤ h∇/ , z/ i + (z/ ) H/ z/ + h∇. , z. i + (z. ) H. z. + kzk2∞ v > Hv 6 6 6 3     ­ 1 1 1 h∇/ , δ/∗ i + (δ/∗ )> H/ δ/∗ + h∇. , δ.∗ i + (δ.∗ )> H. δ.∗ + 10n3 ε + 3nε + ε ≤ 2 6 6     ® 1 1 ∗ > 1 ∗ > 1 ∗ ∗ ∗ ∗ h∇/ , δ/ i + (δ/ ) H/ δ/ + h∇. , δ. i + (δ. ) H. δ. + 14n3 ε ≤ 2 6 2 6     ¯ 1 1 1 1 h∇/ , δ / i + (δ / )> H/ δ / + h∇. , δ . i + (δ . )> H. δ . + 14n3 ε ≤ 2 6 2 6   1 1 ≤ h∇, δi + (δ)> Hδ + 14n3 ε . 2 6 Above, inequality ¬ uses (H.3) again; inequality ­ uses the assumption on z/ and (H.4); inequality ® uses the fact that kαk∞ ≤ 1/32 and thus h∇. , δ.∗ i + 61 (δ.∗ )> H. δ.∗ ≤ 0 from the definition of δ.∗ ; inequality ¯ uses the optimality of δ/∗ and δ.∗ , and the fact that δ = (δ / , δ . ); inequality ° uses the  H/ 0 fact that H  0 H. . This finishes the proof of the second assertion in (H.2).  H.2.3 Structural Lemma 3 P The next lemma focuses on the case when the condition | si=1 ∇i | ≥ 12 holds for many rounds, say, T0 rounds of MWUfull. When we apply Lemma P H.4 later we shall choose T0 = Θ(T ). More specifically, whenever the condition | si=1 ∇i | ≥ 12 , we define a subset S to consist of these first s coordinates of the vector y = δk before reordering.27 If there are T0 iterations that this condition holds, then we denote by S1 , S2 , . . . , ST0 the corresponding subsets. 27 Recall that for notational convenience, we have re-ordered the coordinates of y in Line 5 of MWUfull. 42 Lemma H.4 below shows that if one aggregate properly these subsets, we can find a direction δ so that the quadratic function h∇, δi + 61 δ > ∇2 δ is sufficiently small: Lemma H.4. Let S1 , · · · ST0 be subsets of [n], and satisfy that each i ∈ [n] is contained in at most P such subsets. Suppose it satisfies ∀t ∈ [T0 ] : X i∈St ∇i ≥ 1 2 and X i∈St ∇i ≥ vS>t ∇2 vSt where vSt is a vector with all coordinates in St being 1 and all coordinates in [n] \ St being 0. Then, 1 P the following holds: letting δ = − 8P t∈[T0 ] sgn (h∇, vSt i) · vSt , we have: 1 1 T and h∇, δi + δ > ∇2 δ ≤ − . 8 6 32P Proof of Lemma H.4. The proof is by direct calculation. First, since each i is contained in at most P subsets from S1 , . . . , ST0 , we have kδk∞ ≤ 1/8. P We now focus on the linear term h∇, δi. By assumption, for every t ∈ [T0 ], we have i∈St ∇i ≥ 1 2 . Therefore, we have 1 X T h∇, δi = − . sgn (h∇, vSt i) · h∇, vSt i ≤ − 8P 16P kδk∞ ≤ t∈[T0 ]  P We then move to the quadric term δ > ∇2 δ. Denoting by τt = −sgn i∈St ∇i , we have  2 X X X 1 ¬ δ > ∇2 δ = |∇2i,j |  τt 1i∈St − τt 1j∈St  2(8P )2 i,j∈[n] t∈[T0 ] t∈[T0 ]  2 X X X ­ 1  |∇2i,j |  1i∈St 1j ∈S 1i∈S ≤ / t + / t 1j∈St 2(8P )2 i,j∈[n] t∈[T0 ] t∈[T0 ]  2  2  X X X ® 1  +   ≤ |∇2i,j |  1i∈St 1j ∈S 1i∈S / t / t 1j∈St (8P )2 i,j∈[n] t∈[T0 ] t∈[T0 ]     X X X ¯ 1 +  |∇2i,j |  1i∈St 1j ∈S 1i∈S ≤ / t / t 1j∈St 64P i,j∈[n] t∈[T0 ] t∈[T0 ] 1 X > 2 > 1 X X |∇2i,j |1i∈St 1j ∈S vSt ∇ vSt = / t = 32P 16P t∈[T0 ] i,j∈[n] ≤ t∈[T0 ] 1 X 1 X X 1 ∇i = |h∇, vSt i| = − h∇, δi 16P 16P 2 t∈[T0 ] i∈St t∈[T0 ] ∇2 Above, equality ¬ uses the fact that is a Laplacian matrix; inequality ­ uses the fact that |τt (1i∈S 1j6∈St + 1i6∈St 1j∈St ; inequality ® uses (a + b)2 ≤ 2a2 + 2b2 ; inequality ¯ P t − 1j∈St )| ≤ 1i∈StP uses t∈[T0 ] 1i∈S / t 1j∈St ≤ / t ≤ P. t∈[T0 ] 1i∈S T .  Putting the two bounds together, we have h∇, δi + 16 δ > ∇2 δ ≤ − 32P H.3 Proof of Lemma 8.4 In this subsection we prove Lemma 8.4. Let us first recall its statement: 43 √ Lemma 8.4 (MWUfull). If ρ ∈ [10n1/3 , 2 n ], kαk∞ ≤ 1/32, ε ∈ [0, 1/16], K ≥ 1, and T = Ω((Kρ+K 2 ) log n), letting x be any vector in Rn and H be any Laplacian satisfying H  ∇2 f (x)  1.1H. Then, the output 1 2 32 + K and either  > 1 1 6 δ Hδ ≤ 4 minkδ−αk∞ ≤1/32 h∇f (x), δi 1 > 1 ρ 6 δ Hδ ≤ − 256 K . satisfies kδ − αk∞ ≤ (a) h∇f (x), δi + (b) h∇f (x), δi + δ ← MWUfull(∇f (x), H, α, T, ρ, K, ε) + 16 δ > Hδ + 52n3 ε, or Before proving Lemma 8.4, we make the following observations to help the readers understand our MWUfull method. In each round k of MWUfull, denoting by y = δk and assume that |y1 | ≥ · · · ≥ |yn | (see Line 5 of MWUfull), we have • If kyk∞ ≤ ρ, then we do not perform truncation in Line 22 of MWUfull. • If kyk∞ > ρ, by a simple counting argument (see Claim H.5 below), MWUfull must be able to find s ∈ [ρ] such that |ys | − |ys+1 | ≥ 15 and |ys+1 | ≤ ρ/2, |ys | ≥ ρ/4, thus reach Line 7. Claim H.5. If kyk∞ ≥ ρ, then there must be an s ∈ [ρ] such that |ys | − |ys+1 | ≥ 15 and |ys+1 | ≤ ρ/2, |ys | ≥ ρ/4. Proof of Claim H.5. Since kyk∞ ≥ ρ and ρ 2 1 ρ  ρ 2 X wi − |αi | ≥ · − 1 ≥ 2n , 2 2 2 2 i∈[ρ/2] we know that there must be an i ∈ [ρ/2] such that |yi | ≥ ρ/2 and |yi+1 | ≤ ρ/2. If there exists j ∈ {i, i + 1, · · · , i + ρ/60} such that |yj | − |yj+1 | ≥ 15, then we can already finish the proof by picking the smallest such j. Otherwise, we have: ρ ∀r ∈ [ρ/60] : |yi+r | ≥ − 15r 2 Therefore, ρ 2 ρ − 4 X X 1 1 1 2 wi (yi − αi )2 ≥ − 15r − 1 ≥ × ρ2 = ρ (ρ − 4) > n . 2 2 60 16 960 i∈[n] r∈[(ρ−4)/60] This contradicts ky − αk2w ≤ n/1024 and completes the proof.  We are now ready to prove Lemma 8.4. Proof of Lemma 8.4. Recall that in MWUfull, the subset S records the set of rounds k in which T T Line 13 has been reached. There are two cases, |S| ≤ 2K and |S| > 2K . In the former case, MWUfull returns on Line 26, and and in the latter case, MWUfull returns on Line 28. 1. Suppose |S| ≤ T 2K . We observe that at the each of each round k ∈ / [S], the vector δk satisfies (a) Observation 1: kδk k∞ ≤ ρ. This is by Claim H.5, which states that if kδk k∞ ≤ ρ then we must have reached Line 7 of MWUfull; however, if Line 9 is true, then we must have modified δk so that its large coordinates are all replaced with z/ so cannot be greater than ρ. In other words, if we have not reached Line 19 and put k into set S, then it must satisfy kδk k∞ ≤ ρ. 44  (b) Observation 2: h∇, δk i + 16 (δk )> Hδk ≤ 0.5 minkz−αk∞ ≤1/32 h∇, δi + 16 δ > Hδ + 52n3 ε. This is because, either we have not reached Line 7 in which case Line 4 of the algorithm already puts such guarantee on δk ; or if we have reached Line 7, then we must have reached Line 11, but in this case, z/ must satisfy (using Lemma 6.1)  1 1 h∇/ , z/ i + (z/ )> H/ z/ ≤ min h∇/ , zi + z > H/ z + ε . 6 6 kz−α/ k∞ ≤1/32 Applying our structural lemma Lemma H.3 with 4ε, we have that δk satisfies the desire inequality, after updating δk,i = (z/ )i for i ∈ [s] on Line 12. Using Observation 1, following the same calculation as in the proof Lemma 6.1 (for the 1 MWUbasic method), but instead this time we can pick η = ρ+K since k`k k∞ ≤ ρ + 1, we have that for every u ∈ ∆. T −1 T −1  n log(2n2 ) 1 X 1 X h`k , −ui ≤ h−`k , wk i + 2ηk`k k2wk + T T ηT k=0 ≤ 1 T k=0 T −1 q X ≤ 1 T √ k=0 T −1  X k=0  n log(2n2 ) k`k k2wk · kwk k1 + 2ηk`k k2wk + ηT n 2 n  n(ρ + K) log(2n2 ) + + . T 1024 ρ + K 2048 Therefore, as long as T ≥ Ω((ρK + K 2 ) log n), we must have 1 T P T −1 1 X n n h`k , −ui ≤ + . T 32 8K (H.5) k=0 1 1 |δk,i − αi | ≤ 32 + 8K for every i ∈ [n] (because we can P  1 choose u = n × ei ). Since we have chose δ ← T k∈[T ]\S δk , we therefore have for all i ∈ [n] However, this implies that |δ i − αi | ≤ k∈[T ]\S 1 T X k∈[T ]−S |δk,i − αi | + 1 1 2 |S||αi | ≤ + . T 32 K Also, by Observation 2 and convexity, we have:     X X 1 1 > 1 h∇, δk i + (δk )> Hδk + h∇, δi + δ Hδ ≤  0 6 T 6 k∈[T ]−S 2. Suppose |S| > T 2K . k∈[S]  1 1 ≤ min h∇, δi + δ > Hδ + 52n3 ε . 4 kz−αk∞ ≤1/32 6 We first bound the infinite norm of vb. Recall that in each round of MWUfull, vbi for each coordinate i either stays the same or increases by one. In particular, if vbi increases by one, then we must have: |yi | ≥ ρ/4 (because Line 19 must have been reached), and this implies |`k,i | ≥ ρ4 − 1. Using (H.5) again, and choosing u = nei , we conclude that this cannot happen for more than T /(ρ/4 − 1) times. In other words, we have ρ  − 1 kb v k∞ ≤ T . (H.6) 4 45 We next show that the output δ must satisfy 1 > T h∇, δi + δ ∇2 δ ≤ − . 6 32kb v k∞ K (H.7) For each round k ∈ S, because Line 19 is reached, there must either vk0 = vk− or vk0 = vk+ that satisfies |h∇, vk0 i| > ε or (vk0 )> Hvk0 > ε.28 Applying Lemma H.1, we know that it must satisfies 1 and |h∇, vk0 i| ≥ vk0> ∇2 vk0 . 2  Let us denotes the non-zero coordinates of vk0 as Sk . Applying Lemma H.4 on Sk | k ∈ [S] along with P = kb v k∞ , we immediately have (H.7). |h∇, vk0 i| ≥ Finally, combining (H.6) and (H.7), we have 1 > 1 ρ h∇, δi + δ ∇2 δ ≤ − 6 256 K Moreover, we know that kδ − αk∞ ≤ kαk∞ + kδk∞ ≤ 1 32 +  1 K. References [1] Zeyuan Allen-Zhu, Yin Tat Lee, and Lorenzo Orecchia. Using optimization to obtain a widthindependent, parallel, simpler, and faster positive SDP solver. In Proceedings of the 27th ACM-SIAM Symposium on Discrete Algorithms, SODA ’16, 2016. [2] Zeyuan Allen-Zhu and Lorenzo Orecchia. Nearly-Linear Time Positive LP Solver with Faster Convergence Rate. In Proceedings of the 47th Annual ACM Symposium on Theory of Computing, STOC ’15, 2015. [3] Zeyuan Allen-Zhu and Lorenzo Orecchia. Using optimization to break the epsilon barrier: A faster and simpler width-independent algorithm for solving positive linear programs in parallel. In Proceedings of the 26th ACM-SIAM Symposium on Discrete Algorithms, SODA ’15, 2015. [4] Zeyuan Allen-Zhu and Lorenzo Orecchia. Linear Coupling: An Ultimate Unification of Gradient and Mirror Descent. In Proceedings of the 8th Innovations in Theoretical Computer Science, ITCS ’17, 2017. Full version available at http://arxiv.org/abs/1407.1537. [5] H Balakrishnan, Inseok Hwang, and C.J. Tomlin. Polynomial approximation algorithms for belief matrix maintenance in identity management. In 2004 43rd IEEE Conference on Decision and Control (CDC) (IEEE Cat. No.04CH37601), volume 5, pages 4874–4879 Vol.5. IEEE, 2004. [6] Aharon Ben-Tal and Arkadi Nemirovski. Lectures on Modern Convex Optimization. Society for Industrial and Applied Mathematics, January 2013. [7] Andrew Michael Bradley. Algorithms for the equilibration of matrices and their application to limited-memory Quasi-Newton methods. PhD thesis, Stanford University, 2010. [8] David T Brown. A note on approximations to discrete probability distributions. Information and Control, 2(4):386–392, 1959. + − Otherwise, we would  have satisfied |h∇, vk i| ≤ |h∇, vk i| + |h∇, vk i| + > + − > − 2 (vk ) Hvk + (vk ) Hvk ≤ 4ε and thus cannot reach Line 19 of MWUfull. 28 46 ≤ 2ε and vk> Hvk ≤ [9] Eric Chu, Brendan Oı́Donoghue, Neal Parikh, and Stephen Boyd. A primal-dual operator splitting method for conic optimization. Stanford Internal Report, 2013. [10] W Edwards Deming and Frederick F Stephan. On a least squares adjustment of a sampled frequency table when the expected marginal totals are known. The Annals of Mathematical Statistics, 11(4):427–444, 1940. [11] D. Friedlander. A technique for estimating a contingency table, given the marginal totals and some supplementary data. Journal of the Royal Statistical Society. Series A (General), pages 412–420, 1961. [12] WM Gorman. Estimating trends in leontief matrices: a note on mr. bacharach’s paper. Nuffield College, Oxford, duplicated, 1963. [13] Leonid Gurvits and Alex Samorodnitsky. A deterministic algorithm for approximating the mixed discriminant and mixed volume, and a combinatorial corollary. Discrete & Computational Geometry, 27(4):531–550, 2002. [14] Gabor T Herman and Arnold Lent. Iterative reconstruction algorithms. Computers in biology and medicine, 6(4):273–294, 1976. [15] Martin Idel. A review of matrix scaling and sinkhorn’s normal form for matrices and positive maps. arXiv preprint arXiv:1609.06349, 2016. [16] B. Kalantari, I. Lari, F. Ricca, and B. Simeone. On the complexity of general matrix scaling and entropy minimization via the RAS algorithm. Mathematical Programming, 112(2):371–401, 2008. [17] Bahman Kalantari and Leonid Khachiyan. On the rate of convergence of deterministic and randomized ras matrix scaling algorithms. Operations research letters, 14(5):237–244, 1993. [18] Bahman Kalantari and Leonid Khachiyan. On the complexity of nonnegative-matrix scaling. Linear Algebra and its Applications, 240:87–103, jun 1996. [19] Jonathan A. Kelner, Lorenzo Orecchia, Aaron Sidford, and Zeyuan Allen Zhu. A simple, combinatorial algorithm for solving SDD systems in nearly-Linear time. In Proceedings of the 45th Annual ACM Symposium on Theory of Computing, STOC ’13, 2013. [20] J Kruithof. Telefoonverkeersrekening. De Ingenieur, 52:E15–E25, 1937. [21] Rasmus Kyng and Sushant Sachdeva. Approximate Gaussian Elimination for Laplacians Fast, Sparse, and Simple. In 2016 IEEE 57th Annual Symposium on Foundations of Computer Science (FOCS), pages 573–582. IEEE, oct 2016. [22] Nathan Linial, Alex Samorodnitsky, and Avi Wigderson. A deterministic strongly polynomial algorithm for matrix scaling and approximate permanents. In Proceedings of the thirtieth annual ACM symposium on Theory of computing - STOC ’98, pages 644–652, New York, New York, USA, 1998. ACM Press. [23] Oren E Livne and Gene H Golub. Scaling by binormalization. Numerical Algorithms, 35(1):97– 120, 2004. [24] Sally M Macgill. Theoretical properties of biproportional matrix adjustments. Environment and Planning A, 9(6):687–701, 1977. 47 [25] Albert W Marshall and Ingram Olkin. Scaling of matrices to achieve specified row and column sums. Numerische Mathematik, 12(1):83–90, 1968. [26] Yurii Nesterov. A method of solving a convex programming problem with convergence rate O(1/k 2 ). In Doklady AN SSSR (translated as Soviet Mathematics Doklady), volume 269, pages 543–547, 1983. [27] Yurii Nesterov. Introductory Lectures on Convex Programming Volume: A Basic course, volume I. Kluwer Academic Publishers, 2004. [28] Richard Peng and Daniel A Spielman. An efficient parallel solver for SDD linear systems. In Proceedings of the 46th Annual ACM Symposium on Theory of Computing - STOC ’14, pages 333–342, New York, New York, USA, 2014. ACM Press. [29] Thomas Pock and Antonin Chambolle. Diagonal preconditioning for first order primal-dual algorithms in convex optimization. In Computer Vision (ICCV), 2011 IEEE International Conference on, pages 1762–1769. IEEE, 2011. [30] TES Raghavan. On pairs of multidimensional matrices. Linear Algebra and its Applications, 62:263–268, 1984. [31] Alexander Rakhlin. Lecture notes on online learning. Draft, 2009. Available at http:// www-stat.wharton.upenn.edu/~rakhlin/courses/stat991/papers/lecture_notes.pdf. [32] Günter Rote and Martin Zachariasen. Matrix Scaling by Network Flow. In SODA ’07, pages 848–854, 2007. [33] Uriel G Rothblum and Hans Schneider. Scalings of matrices which have prespecified row sums and column sums via optimization. Linear Algebra and its Applications, 114:737–764, 1989. [34] Richard Sinkhorn. A relationship between arbitrary positive matrices and doubly stochastic matrices. The annals of mathematical statistics, 35(2):876–879, 1964. [35] Daniel A. Spielman and Shang-Hua Teng. Nearly-linear time algorithms for graph partitioning, graph sparsification, and solving linear systems. In Proceedings of the thirty-sixth annual ACM symposium on Theory of computing - STOC ’04, page 81, New York, New York, USA, 2004. ACM Press. [36] Richard Stone. Multiple classifications in social accounting. University of Cambridge, Department of Applied Economics, 1964. [37] James Hardy Wilkinson. Rounding errors in algebraic processes. In IFIP Congress, pages 44–53, 1959. [38] Martin Zinkevich. Online convex programming and generalized infinitesimal gradient ascent. In Proceedings of the 20th International Conference on Machine Learning, ICML 2003, pages 928–936, 2003. 48
8cs.DS
SUBMITTED TO IEEE TRANSACTIONS ON INTELLIGENT TRANSPORTATION SYSTEMS 1 Restricted Deformable Convolution based Road Scene Semantic Segmentation Using Surround View Cameras arXiv:1801.00708v2 [cs.CV] 3 Jan 2018 Liuyuan Deng, Ming Yang, Hao Li, Tianyi Li, Bing Hu, Chunxiang Wang Abstract—Understanding the surrounding environment of the vehicle is still one of the challenges for autonomous driving. This paper addresses 360-degree road scene semantic segmentation using surround view cameras, which are widely equipped in existing production cars. First, in order to address large distortion problem in the fisheye images, Restricted Deformable Convolution (RDC) is proposed for semantic segmentation, which can effectively model geometric transformations by learning the shapes of convolutional filters conditioned on the input feature map. Second, in order to obtain a large-scale training set of surround view images, a novel method called zoom augmentation is proposed to transform conventional images to fisheye images. Finally, an RDC based semantic segmentation model is built. The model is trained for real-world surround view images through a multi-task learning architecture by combining real-world images with transformed images. Experiments demonstrate the effectiveness of the RDC to handle images with large distortions, and the proposed approach shows a good performance using surround view cameras with the help of the transformed images. Index Terms—Deformable convolution, semantic segmentation, road scene understanding, surround view cameras, multi-task learning. I. I NTRODUCTION N autonomous vehicle needs to perceive and understand its surroundings (such as road users, frees-pace, and other road scene semantics) for decision making, path planning, etc. Vision-based approaches have become increasingly mature and practical for autonomous driving. Semantic segmentation takes an important step towards visual scene understanding by parsing an image into different regions with specific semantic categories, such as pedestrians, vehicles, and road. In recent years, road scene understanding has achieved a huge progress, thanks to the methodology of Convolutional Neural Network (CNN) based semantic segmentation using narrow-angle or even wide-angle conventional cameras [1]. Conventional cameras follow well the pinhole camera model: all straight lines in the real world are projected as straight A This work is supported by the National Natural Science Foundation of China (U1764264), International Chair on automated driving of ground vehicle. Ming Yang is the corresponding author. L. Deng, M. Yang, T. Li, B. Hu are with Department of Automation, Shanghai Jiao Tong University, Key Laboratory of System Control and Information Processing, Ministry of Education of China, Shanghai, 200240, China (phone: +86-21-34204553; e-mail: [email protected]). H. Li is with SJTU-ParisTech Elite Institute of Technology and also with Department of Automation, Shanghai Jiao Tong University, Shanghai, 200240, China (e-mail: [email protected]). C. Wang is with Research Institute of Robotics, Shanghai Jiao Tong University, Shanghai 200240, China. Fig. 1. Illustration of CNN based semantic segmentation on raw surround view images. Surround view cameras consist of four fisheye cameras mounted on each side of the vehicle. Cameras in different dirrections capture images with different image composition. lines in the image. However, a limitation of conventional cameras is their incapability of capturing ultra wide-angle landscapes. In order to enable a vehicle to perceive the 360◦ surrounding environment, the works presented in this paper explore the CNN based road scene semantic segmentation using surrounding view cameras. Surround view systems are widely applied in vehicles to provide drivers with 360◦ surround view of the environment. A surround view system normally consists of four to six fisheye cameras mounted around a vehicle. Each fisheye camera theoretically has a field of view (FOV) of 180◦ . Despite the advantage of an ultra wide FOV, a fisheye camera causes strong distortion to captured images, which brings difficulties in image processing. Thus, fisheye camera images are usually undistorted first in practical usage [2], [3]. However, image undistortion hurts image quality (especially at image boundaries) [4] and leads to information loss. On the other hand, the segmented results on raw images can be broadly used as a source for various tasks. One example is shown in Fig. 10. This paper explores CNN based semantic segmentation on raw surround view images, as illustrated in Fig. 1. Two challenging aspects are considered. The first is an effective deep learning model to handle fisheye images. Fisheye images have severe distortion which is unavoidable during the process of projecting an image of a hemispheric field onto a plane [5]. The degree of distortion is related to the distance between the camera and the objects, and also to the radial angle. The distortions are not uniform over all spatial areas [4]. This brings CNN models the demand for modeling large and unknown transformations. CNNs already have shown a remarkable representing ability with the help of large-scale datasets which contain diverse scenes. The ability largely originates from the large capacity of deep models 2 SUBMITTED TO IEEE TRANSACTIONS ON INTELLIGENT TRANSPORTATION SYSTEMS like VGGNet [6], GoogleNet [7] and ResNet [8]. Besides, handcrafted structures, for example pyramid pooling module [9], also contribute to the representational power. However, as discussed in [10], regular CNNs are inherently limited to model large, unknown geometric distortions, due to their fixed structures, such as fixed filter kernels, fixed receptive field sizes, and fixed pooling kernels. The second is about training datasets for the deep neural networks. So far, state-of-the-art CNN-based semantic segmentation methods require large-scale pixel-level annotated images for parameter optimization. The annotating process is a time-consuming and expensive work, yet several road scene datasets have already been created [11], [12] and contribute to the development of semantic segmentation algorithms. But there are few large-scale annotated datasets of semantic segmentation for surround view cameras. In our previous works [13], a fisheye dataset is generated from Cityscapes dataset for a forward-looking conventional camera. That’s still not enough for surround view cameras. First, the image composition of cameras in different directions varies a lot. For example, as shown in Fig. 1, a forward-looking camera usually captures the rear view of front vehicles, but a sideways-looking camera captures the side view of surround vehicles. Second, the Cityscapes dataset is collected from cities in Europe; the model trained using such dataset may not be suitable for applications in regions outside Europe. This paper is a considerable extension of our previous conference publication [13]. We further address the method of road scene semantic segmentation using surround view cameras. A more effective module is proposed to handle images with large distortions. Datasets for surround view image semantic segmentation are augmented by using the zoom augmentation method. This method is originally proposed in [13] to augment the training data with a randomly changing focal length. In this paper, we redefined zoom augmentation as the operation of transforming existing conventional images to fisheye images and implemented a zoom augmentation layer with a CUDA implementation for on-line training. Moreover, we successfully realized road scene semantic segmentation using surround view cameras. First, our proposed method exploits the deformable convolution [10] to handle fisheye images. To address the spatial correspondence problem [14], the Restricted Deformable Convolution (RDC) is proposed to further restrict deformable convolution for pixel-wise prediction tasks. Second, a variety of images are used to adapt models to local environment; these images include those transformed from Cityscapes and SYNTHIA-Seqs via the zoom augmentation method, and some real-world surround view images of our local environment. Finally, a multi-task learning architecture is presented to train an end-to-end semantic segmentation model for real-world surround view images by combining a small number of real-world images and a large number of transformed images. The AdaBN [15] is adopted to bridge the distributional gap between real-world images and transformed images. In addition, the Hybrid Loss Weightings (HLW) is proposed to improve the generalization ability by introducing auxiliary losses with different loss weightings. This paper is organized as follows: Section II reviews related works. Section III introduces the RDC, whereas Section IV describes the method of converting the existing datasets to fisheye datasets. Section V presents the training strategy. And Section VI demonstrates quantitative experiments. II. R ELATED W ORK Early semantic segmentation methods rely on handcrafted features; they use Random Decision Forest [16] or Boosting [17] to predict the class probabilities and use probabilistic models known as Conditional Random Fields (CRFs) to handle uncertainties and propagate contextual information across the image. In recent years, CNNs have made a huge step forward in vision recognition thanks to large-scale training datasets and high-performance Graphics Processing Unit (GPU). In addition, excellent open source deep learning frameworks like Caffe, MXNet and Tensorflow boost the development of algorithms. Powerful deep neural networks [6]–[8] emerged largely reducing the classification errors on ImageNet [18], which is also beneficial to semantic segmentation. FCN [19] successfully improved the accuracy of semantic segmentation by adapting classification networks into fully convolutional networks. For the task of semantic segmentation, it’s crucial to incorporate context information in relevant image regions when making a prediction. A broad receptive field is usually desirable to capture the entire useful information. The receptive field size can be increased multiplicatively by down-sampling operation and linearly by stacking more layers. After the down-sampling operation, lots of low-level visual features are lost and the spatial structure of the scene is prone to be damaged. Dilated convolution or Atrous convolution [20], [21] is proposed to alleviate this problem by enlarging the receptive field without reducing the spatial resolution. It enlarges the kernel size by introducing holes in convolution filters without increasing the number of parameters. Note that the dilation rates should be carefully designed to alleviate gridding artifacts [22]. On the other hand, modern nets like ResNet [8] theoretically have a large receptive field, even larger than the input image, due to the significantly increased depth. However, as investigated in [23], the effective receptive field of a network is much smaller than the theoretical one. Instead of hand-crafted designing modules, the deformable convolution [10] learns the shapes of convolution filters conditioned on an input feature map. The receptive field and the spatial sampling locations are adapted according to the objects’ scale and shape. It is shown that it’s feasible and effective to learn geometric transformation in CNNs for vision tasks. However, as indicated in [14], the deformable convolution does not address the spatial correspondence problem which is critical in dense prediction tasks. The DTN [14] preserves the spatial correspondence of spatial transformer layers between the input and output and uses a corresponding decoder layer to restore the correspondence. However, the DTN learns a global parametric transformation, which is limited to model non-uniform geometric transformations for each location. Some datasets for semantic road scene understanding have been created, for example, CamVid [11], Cityscapes [12], DENG et al.: RESTRICTED DEFORMABLE CONVOLUTION BASED SEMANTIC SEGMENTATION USING SURROUND VIEW CAMERAS and Mapillary Vistas [24]. Cityscapes is a large-scale dataset for semantic urban scene understanding with 5000 finely annotated images. The images are captured from Europe using forward-looking conventional cameras. Data annotation as well as data collection is time consuming and expensive. Therefore, another increasingly popular way to overcome the lack of large-scale dataset is explored by the usage of synthetic data, such as SYNTHIA [25], Virtual KITTI [26], and GTA-V [27]. Synthetic data is usually used to augment real training data [25], [28]. SYNTHIA is generated by rendering a virtual city created with the Unity development platform for semantic segmentation of driving scenes. Our previous works [13] can also be regarded as a synthetic dataset which is transformed from a real large-scale conventional image dataset. None of these datasets is created using surround view cameras. In order to achieve higher accuracy of semantic segmentation, the top performing networks based on very large models can be used, e.g., [9], [22]; however, such methods suffer from large computational costs. As a matter of fact, autonomous driving features multitasking with limited resource. The long inference times and large power consumption make them difficult to be employed in on-road applications. On the other hand, some works [29]–[31] explore a good tradeoff between accuracy and efficiency, so that it is feasible on embedded devices. ERFNet [29] achieved an excellent tradeoff by applying factorized convolutions [32]. And it can be trained from scratch. This paper takes ERFNet as the baseline model for efficient semantic segmentation. III. R ESTRICTED D EFORMABLE C ONVOLUTION In this section, we describe the RDC which is the restricted version of deformable convolution. And a factorized version of RDC is also provided. The regular convolution adopts a fixed filter with grid sampling locations, as shown in Fig. 2a and Fig. 2b. The shape of a regular grid is a rectangle, for example, as shown in Fig. 2b, a 3 × 3 filter with dilation 2 is defined as: In a deep CNN, the upper layers encode high-level semantic information with weak spatial information, including object- or category-level evidence. Features from the middle layers are expected to describe middle-level representations for object parts and retain spatial information. Features from the lower convolution layers encode low-level spatial visual information like edges, corners, circles, etc. The middle layers and lower layers are responsible for learning the spatial structures. If the deformable convolution is applied to the lower or middle layers, the spatial structures are susceptible to fluctuation. The spatial correspondence between input images and output label maps is difficult to be preserved. This is the spatial correspondence problem indicated in [14], which is critical in pixel-wise semantic segmentation. Hence, the deformable convolution is only applied to the last few convolution layers, as in the works presented in [10]. In this paper, a straightforward way is adopted to alleviate this problem. As illustrated in Fig. 2d, we freeze the central location of the filter and let the outer locations be learnable, considering that the ability of modeling transformations heavily depends on the outer sampling locations. This variant of deformable convolution is called Restricted Deformable Convolution (RDC), as shown in Fig. 3. The RDC is first initialized with the shape of a filter of regular convolution. Then 2D offsets are learned by a regular convolutional layer to augment the regular grid locations except the center. The shape of the filter is deformable and learned from the input features. The RDC can be included into a standard neural network architecture to enhance the ability of modelling geometric transformations. A. Formulation The convolution operator slides a filter or kernel over the input feature map X to produce output feature map Y. For each sliding position pb , a regular convolution with filter weights W, bias term b and stride 1 can be formulated as R = {(−2, −2), (0, −2), . . . , (0, 0), . . . , (0, 2), (2, 2)}. The deformable convolution adds 2D offsets to the grid sampling locations, as shown in Fig. 2c. Thus, each sampling location is learnable and dynamic. (a) (b) (c) (d) Fig. 2. The sampling locations of 3x3 convolutions: (a) Standard convolution. (b) Dilated convolution with dilation 2. (c) Deformable convolution. (d) Restricted deformable convolution. The dark points are the actual sampling locations, and the hollow circles in (c) and (d) are the initial sampling locations. (a) and (b) employ a fixed grid of sampling locations. (c) and (d) augment the sampling locations with learned 2D offsets (red arrows). The primary difference between (c) and (d) is that restricted deformable convolution employs a fixed central sampling location. No offsets are need to be learned for the central sampling location in (d). 3 ypb Y =W∗X+b X X = wc,n · xc,pb +pn + b c (1) pn ∈R where c is the index of input channel, pb is the base position of the convolution, n = 1, . . . , N with N = |R| and pn ∈ R enumerates the locations in the regular grid R. The center of R is denoted as pm which is always equal to (0, 0), under the assumption that both of height and width of the kernel are odd numbers, such as 3 × 3, and 1 × 3. This assumption is suitable for most CNNs. m is the index of the central location in R. The deformable convolution augments all the sampling locations with learned offsets {∆pn |n = 1, . . . , N }. Each offset has a horizontal component and a vertical component. Totally 2N offset parameters are required to learn for each sliding position. Equation (1) becomes X ypb = wn · xH(pn ) + b (2) pn ∈R 4 SUBMITTED TO IEEE TRANSACTIONS ON INTELLIGENT TRANSPORTATION SYSTEMS where H(pn ) = pb + pn + ∆pn is the learned sampling position on input feature map. The input channel c in (1) is omitted in (2) for notation clarity, because the same operation is applied in every channel. In order to preserve the spatial structure, we restrict the deformable convolution by fixing its central location. That is to say, the offset ∆pm is set as (0, 0). The center of R, pm , is also equal to (0, 0), thus the learned position is formulated as ( pb n=m H(pn ) = pb + pn + ∆pb n 6= m The RDC can also be formulated by X ypb = wm · xpb + wn · xpun ,pvn + b pn ∈R,n6=m pun pvn where and are horizontal and vertical components of H(pn ). The first term of the formula calculates the weighted value for the fixed central location. The second term calculates the weighted sum for the learned outer locations. The learned outer positions (pun , pvn ) are not integer numbers, because the offsets ∆pn are real numbers. Bilinear interpolation is used to sample over the input feature map for a fractional position. For the outer locations, the sampled output is formulated by  T   1 − ∆pun 1 − ∆pvn xpun ,pvn = Q ∆pun ∆pvn where Q=  xbpun c,bpvn c xdpun e,bpvn c xbpun c,dpvn e xdpun e,dpvn e  Fig. 3. A 3 × 3 restricted deformable convolution. The module is initiated with a 3×3 filter with dilation 2 (the hollow circles on the input feature map). Offset fields are learned from input feature map by a regular convolutional layer. The channel dimension 2(N − 1) corresponds N − 1 2D offsets (the red arrows). Here, N = 9. The actual sampling positions (dark points) are obtained by adding the 2D offsets to the initial locations. The value of the new position is obtained by using bilinear interpolation to weight the four nearest points. The yellow arrows denote the backpropagation paths of gradients. (a) (b) (c) Fig. 4. (a) 3 × 3 regular convolution. (b) Factorized convolutions. (c) Factorized restricted deformable convolution. The non-linearities in (b) and (c) are omitted in this illustration. The dark points, hollow circles and red arrows are the same as the definitions in Fig 2. ∆pun = pun − bpun c ∆pvn = pvn − bpvn c Q denotes the values of four nearest integer positions on the input feature map X. This bilinear interpolation operation is differentiable, as explained in [10]. As illustrated in Fig. 3, like the deformable convolution, the offsets {∆pn |n = 1, . . . , N, n 6= m} in the RDC are learned with a convolutional layer and from the same input feature map. The spatial resolution of the output offset fields is identical to that of the output feature map. Therefore, for each sliding position, a specific shape of the filter is learned. 2(N − 1) offset parameters are required to define the new shape, whereas no parameter is required to define the offset of the central location. The whole module is differentiable. It can be trained with the standard backpropagation method, allowing for end-to-end training of the models they are injected in. As illustrated in Fig 3, the gradients are passed to filter weights, and also backpropagated to the offsets and input feature map through the bilinear operation. B. Factorized Restricted Deformable Convolution 2D filters can be approximated as a combination of 1D filters, for the sake of reducing memory and computational cost. In [32], a basic decomposed layer consists of vertical kernels followed by horizontal ones, and a non-linearity is inserted in between 1D convolutions. For example, a convolutional layer of 3 × 3 (Fig. 4a) can be decomposed into two consecutive factorized convolutional layers of 3×1 and 1×3 (Fig. 4b). The ERFNet [29] has shown a good tradeoff between efficiency and accuracy with factorized convolutions. This paper also provides a factorized version of RDC. For 2D RDC, each learned offset has two components: vertical direction and horizontal direction. With 2D kernel decomposed into a vertical kernel and a horizontal kernel, the offsets can also be decomposed into two components of the same directions, as shown in Fig. 4c. In 1D kernels, only one parameter is learned to control the dilation factor for each outer location. This is called Factorized Restricted Deformable Convolution (FRDC). It can also be interpreted as that the dilations in 1D kernels are adaptively learned. The number of additional parameters for FRDC is N − 1, only a half of that of the RDC. That means FRDC is less flexible than RDC. FRDC shows a good performance for conventional images in the experiments. IV. T HE G ENERATION OF F ISHEYE I MAGE DATASET FOR S EMANTIC S EGMENTATION Few large-scale datasets are available worldwide for fisheye image semantic segmentation. To enrich such datasets, a transformation method is proposed to convert conventional images to fisheye images. A mapping is built from the fisheye DENG et al.: RESTRICTED DEFORMABLE CONVOLUTION BASED SEMANTIC SEGMENTATION USING SURROUND VIEW CAMERAS 5 Fig. 5. Zoom augmentation results. The left are the original color image and annotation. The right are the transformed images and annotations by zoom augmentation with a focal length changing from 200 to 800. image plane to the conventional image plane. Thus the scene in conventional image can be remapped into fisheye image. A. Mapping Conventional Image to Fisheye Image A conventional image is captured from a pinhole camera. The perspective projection of a pinhole camera model can be described by (3); for fisheye cameras, perhaps the most common model is the equidistance projection [33], as in (4). r = f tan θ (3) r = fθ (4) where θ is the angle between the principal axis and the incoming ray, r is the distance between the image point and the principal point, and f is the focal length. Both a conventional image and a fisheye image can be treated as a hemisphere image projected onto a plane according to different projection models and from different view angles. The details of the geometrical imaging model are described by [5], [33]. With the settings that the focal lengths of the perspective projection and the equidistance projection are identical and the max viewing angle θmax is equal to 180◦ . The mapping from the fisheye image point Pf = (xf , yf ) to the conventional image point Pc = (xc , yc ) is described by rc = f tan(rf /f ) (5) p where rc = (xc − ucx )2 + (yc − ucy )2 denotes the distance between the image point Pc and the principal point Uc = (ucx , ucy ) in the conventional image, and rf = p (xf − uf x )2 + (yf − uf y )2 correspondingly denotes the distance between the image point Pf and the principal point Uf = (uf x , uf y ) in the fisheye image. The mapping relationship (5) is determined by the focal length f . A base focal length f0 can be set, thus the fisheye camera model approximately covers a hemispherical field. Each image and its corresponding annotation in the existing segmentation dataset are transformed using the same mapping function to generate the fisheye image dataset. B. Zoom Augmentation for Fisheye Image Training of deep networks requires a huge number of training images, but training datasets are always limited. Data argumentation methods are adopted to enlarge training data using label-preserving transformations. Many forms are employed to do data augmentation for semantic segmentation, such as horizontally flipping, scaling, rotation, cropping and color jittering. Among them, scaling (zoom-in/zoom-out) is one of the most effective forms. DeepLab [21] augmented training data by random scaling the input images (from 0.5 to 1.5). PSPNet [9] adopted random resize between 0.5 and 2 combining with other augmentation methods. Conventionally, scaling means the operation of changing the image’s size. On the other hand, scaling the image can also be reasonably treated as the action of changing the focal length of the camera. Following this idea, is proposed in [13] a new data augmentation method called zoom augmentation which is specially designed for fisheye images. Instead of simply resizing the image, the zoom augmentation means augmenting training dataset with additional data that is derived from existing source by changing the focal length of the fisheye camera. Zoom augmentation adopts the mapping function in (5). Here, this operation of warping existing conventional images to fisheye-style images is generally called zoom augmentation. A fixed focal length can be applied for zoom augmentation. A randomly changing focal length within a specified range can also be applied to generate fisheye images with different degrees of distortion. Via the zoom augmentation method, an existing conventional image dataset for semantic segmentation can be transformed into a fisheye-style image dataset. Fig. 5 illustrates how the focal length affects the mapping results. The smaller the focal length, the larger the degree of distortions. Thus, we can get fisheye images with different distortions by randomly changing the focal length. V. T RAINING S TRATEGY In this section, we introduce the strategy of training the CNN model to improve semantic segmentation accuracy on real-world surround view images with the help of transformed images. It is rarely practical to train the model using the transformed datasets and then use it to handle real-world 6 SUBMITTED TO IEEE TRANSACTIONS ON INTELLIGENT TRANSPORTATION SYSTEMS Fig. 6. The multi-task learning architecture for road scene semantic segmentation. Cityscapes, and SYNTIA-Seqs are transformed via zoom augmentation layer. Layers in the green block share their weights while the classifiers do not. The total loss is the weighted sum of main losses and auxiliary losses. images, due to different label spaces (Not all the target categories are the same as those of the source) and domain shift [15] (different datasets). A simple way is to use a real-world dataset to fine-tune the CNN model pre-trained on transformed datasets. However, overfitting occurs when the amount of real-world images is limited. This paper uses both transformed images and real-world images to train the model. As shown in Fig. 6, a multi-task learning architecture is built to train the model on datasets with different label spaces. The ERFNet is adopted as the basic model. The last deconvolution layer in the ERFNet serves as a classifier. The same model with bounded weights is used to train both the source (transformed images) and the target (real-world images) domains. Two approaches are used to handle the domain shift and improve the generalization ability. A. Sharing Weights with Private Batch Normalization Statistics As illustrated in Fig. 6, all the weights except those of classifiers are shared to learn domain-invariant features. Domain related knowledge is heavily related to the statistics of the Batch Normalization (BN) layer. In order to learn domaininvariant features, it’s better for each domain to keep its own BN statistics in each layer. This paper uses an effective way for domain adaptation by sharing the weights but computing BN Statistics for each domain. This is called AdaBN in [15]. B. Hybrid Loss Weightings During training, the loss function is the weighted sum of softmax losses of the three tasks, as in (6). Lmain0 is the loss for real-world images. Lmain1 and Lmain2 are the losses for transformed images. The main loss weighting α is used to balance the contribution of the different losses. The losses for transformed images act as a regularization term controlled by α. A smaller α can make the training focus on the real data. A too small α incurs model overfitting, whereas a too large α has a consequence that the loss for real data will be overwhelmed by the regularization loss. In order to further balance the contribution of different losses, auxiliary losses are introduced. The auxiliary loss is formulated by (7). Laux0 is the auxiliary loss for realworld images. Laux1 and Laux2 are the auxiliary losses for transformed images. The auxiliary loss weighting β is used to balance the contribution of the different auxiliary losses. During training, the weighted auxiliary loss Laux is added to the total loss with a discount weight γ (γ is set to 0.2 in this paper), as formulated by (8). Lmain = (1.0 − α)Lmain0 + α Laux = (1.0 − β)Laux0 + β 2 X i=1 2 X Lmaini Lauxi (6) (7) i=1 Ltotal = Lmain + γLaux (8) In this paper, we use different weightings for the main loss Lmain and the auxiliary loss Laux . That means, α does not have to equal to β. A bigger weighting β can introduce stronger regularization. Thus with the bigger β for auxiliary loss, a smaller α for main loss can be employed to balance the contribution of different losses. This method is termed as Hybrid Loss Weightings (HLW). VI. E XPERIMENTS In this section, the datasets used for the experiments are first introduced. Then the RDC based model is evaluated on conventional and transformed fisheye datasets, respectively. At the end, experiments for road scene semantic segmentation using surround view cameras are conducted. A platform with two NVIDIA GTX 1080Ti GPUs is used to train and evaluate the models using MXNet. The semantic segmentation DENG et al.: RESTRICTED DEFORMABLE CONVOLUTION BASED SEMANTIC SEGMENTATION USING SURROUND VIEW CAMERAS Fig. 7. Transformed images by zoom augmentation with a randomly changing focal length. Images in the first row are from Cityscapes. Images in the second row are from SYNTHIA-Seqs. The first row captures the scene of the front view. The second row captures scene with different perspectives. performance is measured by the standard metric of mean Intersection-Over-Union (mIOU). A. Datasets for Surround View Image Semantic Segmentation Two complementary datasets Cityscapes [12] and SYNTHIA-Seqs [25] are used to augment surround view datasets via the zoom augmentation method. Cityscapes is a real large-scale dataset captured by a forward-looking conventional camera. Its training set of 2975 images is used in the experiments. SYNTHIA-Seqs are captured in a virtual city using four conventional cameras of different directions. Specifically, the sub-sequences: Spring, Summer and Fall of SEQS-01, SEQS-02 and SEQS-04 are used, totally containing 34696 images. Both the real and synthetic datasets are transformed to augment surround view images. The resolutions of the transformed images after applying zoom augmentation are set to 576 × 640 and 512 × 640 for Cityscapes and SYNTHIA-Seqs respectively. In order to employ zoom augmentation with a randomly changing focal length for the training, this paper implements a zoom augmentation layer. This new layer adopts a CUDA implementation, thus the image can be transformed online. The time consumption of the layer is very small. Some examples transformed by the zoom augmentation method are illustrated in Fig. 7. Besides, 532 surround view images are captured by four fisheye cameras mounted around a moving vehicle and annotated using the Cityscapes annotation tool [12]. Of these, 357 images are used for training and 175 images are used for validation. The defined classes are listed in Fig. 11e. Each image and annotation have a resolution of 512 × 864. Some examples are shown in Fig. 11. B. Evaluation for the Restricted Deformable Convolution The ERFNet is reimplemented in MXNet as the baseline model with a few differences. Batch normalization layer is applied after each convolutional layer and all the deconvolution layers use a kernel of 2 × 2 and stride 2. A RDCNet model is built by replacing the first two convolutional layers in non-bt-1D blocks (Fig. 8a) of the ERFNet with RDC layers. RDCNet-λ denotes only the last λ non-bt-1D blocks in the encoder that are reconstructed as shown in Fig. 8c. Similarly, (a) (b) 7 (c) Fig. 8. RDC layers are applied in the last λ non-bt-1D blocks in the encoder of RDCNet-λ. (a) Non-bt-1D block in ERFNet. (b) Reconstructed non-bt-1D block in RDCNet. The first two convolutional layers are replaced with RDC layers. (c) The encoder of RDCNet-λ. a DCNet-λ model is built using deformable convolution layers, and a FRDCNet-λ model is built using FRDC layers. All these models are trained from scratch in MxNet using Nesterov Accelerated Gradient (NAG) with a mini-batch of 12, momentum of 0.9 and weight decay of 0.0002. The initial learning rate is set to 0.05. Class balancing is not applied in the experiments. Instead, the softmax loss is multiplied by 2.0 to balance the regularization. Following the practice suggested in [29], we first train the encoder and then attach the decoder to jointly train the full network. For the ERFNet, both the encoder and joint model are trained for about 180 epochs and the learning rate is decayed by 0.2 every 60 epochs. For other models, the poly learning rate policy (the learning rate iter power is multiplied by (1 − max ) is adopted to speed up iter ) the training. The power is set to 0.9. The encoder is trained for 120 epochs and the joint model is trained for 100 epochs. During training of the encoder, weights of the convolutional layer for offset learning are initialized to zero, yet other layers are initialized by the Xavier method. Unlike the training in [10], the encoder is not initiated with a pre-rained model. In order to stabilize the training, the offsets are kept unchanged in the first 20 epochs. Thus a fixed conv shape is employed to warm up the training. Besides, the learning rates for offset learning are set to 1.0 and 0.1 times the base learning rate to train the encoder and joint model, respectively. To analyze the performances of the ERFNet, the DCNet, the RDCNet, and the FRDCNet for conventional images and fisheye images, they were evaluated on the Cityscapes dataset and the Fisheye-Cityscapes dataset which was generated by the zoom augmentation method with a fixed focal length of 240. The performances with different numbers of reconstructed non-bt-1D blocks are shown in Fig. 9a and Fig. 9b. The DCNet, RDCNet, and FRDCNet are all better than the baseline model on both datasets. As the number of reconstructed blocks increases, the performances of these models first improve and then become saturated. As shown in Fig. 9a, the models are saturated when 4 reconstructed blocks are applied on the conventional image dataset. The RDCNet and FRDCNet achieved better performances than the DCNet. The FRDCNet-4 achieved the best performance and outperformed the baseline model by 3.1% mIOU. But on Fisheye-Cityscapes dataset, as shown in Fig. 9b, FRDCNet 8 SUBMITTED TO IEEE TRANSACTIONS ON INTELLIGENT TRANSPORTATION SYSTEMS TABLE I E VALUATION ON THE VALIDATION S ET OF THE R EAL -W ORLD I MAGES U SING RDCN ET-8 (a) Comparison on Cityscapes dataset. AdaBn Zoom augmentation Main loss weighting Auxilary loss weighting mIOU × √ √ √ Fixed Fixed Random Random α = 1/2 α = 1/2 α = 1/2 α = 1/2 × × × β = 1/2 63.1 72.1 72.7 73.2 Random Random Random α = 1/3 α = 1/3 α = 1/3 β = 1/3 β = 1/2 β = 2/3 73.5 74.3 73.7 Random Random Random Random α = 1/5 α = 1/5 α = 1/5 α = 1/5 β = 1/5 β = 1/2 β = 2/3 β = 4/5 72.7 73.4 74.3 73.6 √ √ √ √ √ √ √ (b) Comparison on Fisheye-Cityscapes dataset. Fig. 9. Evaluating ERFNet (baseline), DCNet, RDCNet, and FRDCNet on different datasets. is the first to saturate when 2 blocks are applied. RDCNet-8 achieved the best performance and outperformed the baseline by 2.9% mIOU. The FRDCNet shows a poorer performance on FisheyeCityscapes dataset despite a better performance on Cityscapes dataset. It indicates that the models require a greater geometric transformation modeling capability to handle fisheye images. RDCNet and DCNet essentially possess a more powerful ability of modeling geometric transformations, because there are no constraints for the outer sampling locations of RDC and deformable convolution layers. As shown in Fig. 9b, on Fisheye-Cityscapes dataset, the DCNet achieved a better performance than RDCNet when one reconstructed blocks are applied, but with the increase of the reconstructed blocks, RDCNet surpassed DCNet. The experimental results show that the DCNet has a better geometric transformation modeling capability, but RDCNet is less prone to saturation than DCNet when more reconstructed blocks are used. That indicates fixing the central sampling location of RDC layer is effective for semantic segmentation. RDCNet-8 achieved the best score on Fisheye-Cityscapes dataset, which is adopted in the next section. C. Semantic Segmentation Using Surround View Cameras The multi-task learning architecture is shown in Fig. 6. The RDCNet-8 is adopted as the basic model. The net is trained with the training set of the real-world surround view images, Cityscapes, and SYNTHIA-Seqs. The weights except those of the classifiers are shared among all the tasks. The training procedure follows the RDCNet described in the previous section. 50K iterations are employed for training encoder and the joint model, respectively. In each iteration, four images are drawn from the three datasets to generate a mini-batch of 12 samples. The conventional images of Cityscapes and SYNTHIA-Seqs are transformed to fisheye images online through the zoom augmentation layer. The zoom augmentation method can adopt a fixed focal length or a randomly changing focal length. For the fixed mode, the focal length is set to 240 and 300 for Cityscapes and SYNTHIA-Seqs. For random mode, the focal length is changed randomly between 200 and 800. When applied the AdaBN, the BN statistics are not shared and each BN layer computed BN statistics for each domain. The auxiliary branch is a convolutional layer with a kernel of 1 × 1, stride 1, and 128 output channels. Batch Normalization and ReLU are applied after this layer. Main loss weighting α and auxiliary loss weighting β are set to balance the contribution of real samples and transformed samples. A strategy of HLW that employs different loss weightings is applied. That means main loss weighting α does not have to be equal to auxiliary loss weighting β. We evaluated how zoom augmentation, AdaBN and HLW affects performance on the validation set of the realworld images. The evaluated results are reported in Table I. Adopting the AdaBN largely improves the performance by 9%. Zoom augmentation with randomly changing focal length brings extra 0.6% improvement than fixed focal length. Training images with different degrees of distortion can improve the generalization ability of the model. Employing auxiliary losses is beneficial (about 0.5% improvement with α = β = 12 ). When decreasing α with α equal to β, the model shows performance degradation. The degradation is caused by overfitting due to the weak regularization. When setting a smaller α and a bigger β, the performance shows a significant improvement. With α = 13 and β = 12 or α = 51 and β = 23 , RDCNet8 achieved a performance of 74.3%. That indicates HLW is an effective way to reduce overfitting. Fig. 11 illustrates some results produced by RDCNet-8 with α = 31 and β = 12 . We can see the proposed method performs well on the raw surround view images with large distortions and different perspectives. The way of fine-tuning a pre-trained model using the realworld images was also tested, which resulted in a bad performance. Training the net with conventional image datasets instead of the datasets transformed by zoom augmentation can also improve the performance, but not as good as transformed DENG et al.: RESTRICTED DEFORMABLE CONVOLUTION BASED SEMANTIC SEGMENTATION USING SURROUND VIEW CAMERAS 9 Fig. 10. The bird’s eye view image semantic segmentation by mapping segmentation results of raw surround view images to bird’s eye view plane. (a) Front view (b) Rear view (c) Left view (d) Right view (e) List of 18 classes names and their corresponding colors used for labeling. The void class is marked as black. The vertical separator means a standing structure that used to separate areas, such as walls, fences and guard rails. Road markings which painted on the road surface are used to convey traffic information, usually including white or yellow lines or patterns. We believe this class is beneficial to solutions that use surround view cameras. Other classes adopt the same definitions as those in Cityscapes. Other unclear or ignored objects are assigned a void label, e.g., the reverse sides of traffic signs, commercial signs, electric wires and the invalid boundaries of the images. Fig. 11. Examples of RDCNet-8 results on the validation set of the real-world images. The results of front, rear, left and right view are displayed in (a)(b)(c)(d), respectively. The first column is raw image, the second column is ground truth, and the third column is the result produced by RDCNet-8. The color code is listed in (e). datasets. The road scene semantic segmentation results on raw surround view images can be used as a source for other tasks. For example, in order to get semantic segmentation results on a bird’s eye view image, we can first compute semantic segmentation results on raw surround view images and then map the results to the bird’s eye view plane using Inverse Perspective Mapping (IPM), as illustrated in Fig. 10. Table II reports the forward pass time of ERFNet and RDCNet-8 on a single GTX 1080Ti. RDCNet-8 remains efficient, taking 2 ms more than the ERFNet that can run at several FPS on an embedded GPU [29]. The times reported in Table II include data transfer time from CPU to GPU and the processing time on the GPU, but do not cover the preprocessing time on the CPU and data transfer time from GPU to CPU. 10 SUBMITTED TO IEEE TRANSACTIONS ON INTELLIGENT TRANSPORTATION SYSTEMS TABLE II F ORWARD PASS T IME FOR A 512 × 864 I MAGE Model net.forward (s) ERFNet RDCNet 0.016 0.018 VII. C ONCLUSION This paper provides a solution for CNN-based surrounding environment perception using surround view cameras. First, the Restricted Deformable Convolution (RDC) is proposed to enhance the transformation modeling capability of CNNs, so that the net can handle the images with large distortions. Second, in order to enrich surround view training data which are lacking, the zoom augmentation method is proposed to transform conventional images to fisheye images. Two complementary existing datasets are transformed using this method. Finally, an RDC based semantic segmenation model is trained for real-world surround view images through a multi-task learning architecture with the approaches of AdaBN and HLW. Experiments have shown that the RDC based network can effectively handle fisheye images. And the proposed solution was successfully implemented for road scene semantic segmentation using surround view cameras. RDC has a good ability of modeling geometric transformations and is less prone to saturation. Deformable convolution shows a better ability of modeling geometric transformations if only applied to the last few convolutional layers. As future work, RDC and deformable convolution should be combined in one network to further enhance the CNNs’ transformation modeling ability. R EFERENCES [1] M. Siam, S. Elkerdawy, M. Jagersand, and S. Yogamani, “Deep semantic segmentation for automated driving: Taxonomy, roadmap and challenges,” arXiv preprint arXiv:1707.02432, 2017. [2] C. Wang, H. Zhang, M. Yang, X. Wang, L. Ye, and C. Guo, “Automatic parking based on a bird’s eye view vision system,” Adv. Mech. Eng., vol. 6, p. 847406, 2014. [3] R. Varga, A. Costea, H. Florea, I. Giosan, and S. Nedevschi, “Supersensor for 360-degree environment perception: Point cloud segmentation using image features,” in IEEE Int. Conf. Intell. Transp. Syst., 2017, pp. 126–132. [4] V. Fremont, M. T. Bui, D. Boukerroui, and P. Letort, “Vision-based people detection system for heavy machine applications,” Sensors, vol. 16, no. 1, p. 128, 2016. [5] K. Miyamoto, “Fish eye lens,” JOSA, vol. 54, no. 8, pp. 1060–1061, 1964. [6] K. Simonyan and A. Zisserman, “Very deep convolutional networks for large-scale image recognition,” arXiv preprint arXiv:1409.1556, 2014. [7] C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich, “Going deeper with convolutions,” in IEEE Conf. Comput. Vis. Pattern Recog., 2015, pp. 1–9. [8] K. He, X. Zhang, S. Ren, and J. Sun, “Deep residual learning for image recognition,” in IEEE Conf. Comput. Vis. Pattern Recog., 2016, pp. 770– 778. [9] H. Zhao, J. Shi, X. Qi, X. Wang, and J. Jia, “Pyramid scene parsing network,” in IEEE Conf. Comput. Vis. Pattern Recog., July 2017, pp. 6230–6239. [10] J. Dai, H. Qi, Y. Xiong, Y. Li, G. Zhang, H. Hu, and Y. Wei, “Deformable convolutional networks,” arXiv preprint arXiv:1703.06211, 2017. [11] G. J. Brostow, J. Fauqueur, and R. Cipolla, “Semantic object classes in video: A high-definition ground truth database,” Pattern Recog. Lett., vol. 30, no. 2, pp. 88–97, 2009. [12] M. Cordts, M. Omran, S. Ramos, T. Rehfeld, M. Enzweiler, R. Benenson, U. Franke, S. Roth, and B. Schiele, “The cityscapes dataset for semantic urban scene understanding,” in IEEE Conf. Comput. Vis. Pattern Recog., 2016, pp. 3213–3223. [13] L. Deng, M. Yang, Y. Qian, C. Wang, and B. Wang, “CNN based semantic segmentation for urban traffic scenes using fisheye camera,” in IEEE Intell. Veh. Symp, 2017, pp. 231–236. [14] J. Li, Y. Chen, L. Cai, I. Davidson, and S. Ji, “Dense transformer networks,” arXiv preprint arXiv:1705.08881, 2017. [15] Y. Li, N. Wang, J. Shi, J. Liu, and X. Hou, “Revisiting batch normalization for practical domain adaptation,” arXiv preprint arXiv:1603.04779, 2016. [16] T. Scharwächter and U. Franke, “Low-level fusion of color, texture and depth for robust road scene understanding,” in IEEE Intell. Veh. Symp, 2015, pp. 599–604. [17] P. Sturgess, K. Alahari, L. Ladicky, and P. H. S. Torr, “Combining Appearance and Structure from Motion Features for Road Scene Understanding,” in Brit. Mach. Vis. Conf. London, United Kingdom: BMVA, Sep. 2009. [18] O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Z. Huang, A. Karpathy, A. Khosla, M. Bernstein et al., “Imagenet large scale visual recognition challenge,” Int. J. Comput. Vis, vol. 115, no. 3, pp. 211–252, 2015. [19] E. Shelhamer, J. Long, and T. Darrell, “Fully convolutional networks for semantic segmentation,” IEEE Trans. Pattern Anal. Mach. Intell., vol. 39, no. 4, pp. 640–651, April 2017. [20] F. Yu and V. Koltun, “Multi-scale context aggregation by dilated convolutions,” arXiv preprint arXiv:1511.07122, 2015. [21] L. C. Chen, G. Papandreou, I. Kokkinos, K. Murphy, and A. L. Yuille, “Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs,” IEEE Trans. Pattern Anal. Mach. Intell., vol. PP, no. 99, pp. 1–1, 2017. [22] P. Wang, P. Chen, Y. Yuan, D. Liu, Z. Huang, X. Hou, and G. Cottrell, “Understanding convolution for semantic segmentation,” arXiv preprint arXiv:1702.08502, 2017. [23] B. Zhou, A. Khosla, A. Lapedriza, A. Oliva, and A. Torralba, “Object detectors emerge in deep scene cnns,” arXiv preprint arXiv:1412.6856, 2014. [24] G. Neuhold, T. Ollmann, S. R. Bulò, and P. Kontschieder, “The mapillary vistas dataset for semantic understanding of street scenes,” in IEEE Int. Conf. Comput. Vis., 2017. [25] G. Ros, L. Sellart, J. Materzynska, D. Vazquez, and A. M. Lopez, “The synthia dataset: A large collection of synthetic images for semantic segmentation of urban scenes,” in IEEE Conf. Comput. Vis. Pattern Recog., 2016, pp. 3234–3243. [26] A. Gaidon, Q. Wang, Y. Cabon, and E. Vig, “Virtual worlds as proxy for multi-object tracking analysis,” in IEEE Conf. Comput. Vis. Pattern Recog., 2016, pp. 4340–4349. [27] S. R. Richter, V. Vineet, S. Roth, and V. Koltun, “Playing for data: Ground truth from computer games,” in Eur. Conf. Comput. Vis. Springer, 2016, pp. 102–118. [28] C. R. d. Souza, A. Gaidon, Y. Cabon, and A. M. Lpez, “Procedural generation of videos to train deep action recognition networks,” in IEEE Conf. Comput. Vis. Pattern Recog., July 2017, pp. 2594–2604. [29] E. Romera, J. M. Alvarez, L. M. Bergasa, and R. Arroyo, “ERFNet: Efficient Residual Factorized ConvNet for Real-Time Semantic Segmentation,” IEEE Trans. Intell. Transp. Syst., 2017. [30] A. Paszke, A. Chaurasia, S. Kim, and E. Culurciello, “Enet: A deep neural network architecture for real-time semantic segmentation,” arXiv preprint arXiv:1606.02147, 2016. [31] M. Treml, J. Arjona-Medina, T. Unterthiner, R. Durgesh, F. Friedmann, P. Schuberth, A. Mayr, M. Heusel, M. Hofmarcher, M. Widrich et al., “Speeding up semantic segmentation for autonomous driving,” NIPSW, vol. 1, no. 7, p. 8, 2016. [32] J. Alvarez and L. Petersson, “Decomposeme: Simplifying convnets for end-to-end learning,” arXiv preprint arXiv:1606.05426, 2016. [33] J. Kannala and S. S. Brandt, “A generic camera model and calibration method for conventional, wide-angle, and fish-eye lenses,” IEEE Trans. Pattern Anal. Mach. Intell., vol. 28, no. 8, pp. 1335–1340, 2006.
1cs.CV
arXiv:1801.03575v2 [math.GR] 16 Mar 2018 The Structure of the Three-Dimensional Special Linear Group over a Local Field David Wright March 19, 2018 Abstract For K a local field, it is shown that SL3 (K) acts on a simply connected two dimensional simplicial complex in which a single face serves as a fundamental domain. From this it follows that SL3 (K) is the generalized amalgamated product of three subgroups. Specifically if K is the field of fractions of the discrete valuation ring O, then SL3 (K) is the amalgamation of three subgroups isomorphic to SL3 (O) along pairwise intersections. This generalizes a theorem of Ihara, which gives the structure of SL2 (K) as the amalgamated product of two groups in analogous fashion. 1 Preliminary Notation and Definitions Throughout this paper K will be a commutative local field, the field of fractions of the discrete valuation ring O, with uniformizing parameter π ∈ O. We let k be the residue field O/πO. We let X be a vector space of rank 3 over K. We assume the reader is familiar with basic facts that apply in this situation, such as all O-modules are free, and for any O-module M , any lifting to M of a basis of the k-vector space M/πM forms a basis of M . Other applications of Nakayama’s Lemma will be used. A lattice of X is an O-submodule L of X that generates X as a K-vector space. Any such L is a free O-module of rank 3. If x ∈ K ∗ (for any ring R we write R∗ for its group of multiplicative units), then xL is also a lattice, and in this way the group K ∗ acts on the set of lattices. The orbits of this action are called classes; two lattices in the same class are called equivalent. 1 2 The Simplicial Complex We denote by V the set of classes of lattices in X. A 2-dimensional simplicial complex C will be constructed for which V comprises the vertices. 2.1. Distance. In order to define edges and faces of C we first define the notion of distance between vertices. Let L and L′ be lattices. Choose lattice representatives L and L′ from L and L′ , respectively. Replacing L′ by π n L′ for an appropriate integer n, which is unique, we can arrange that L′ ⊆ L but L′ * πL. We will refer to this unique choice of L′ relative to L as the tight-fitting representative of L′ within L. With this choice we can choose an O-basis {e1 , e2 , e3 } of L such that {π a e1 , π b e2 , e3 } forms a basis of L′ , with a ≥ b ≥ 0. The distance d(L, L′ ) from L to L′ is defined to be a. Note that d(L, L′ ) is the smallest power of π that kills the O-module L/L′ , once L′ is chosen to be tight-fitting within L, which shows that d(L, L′ ) is independent of the choices. Also it is symmetric, as reversing the roles of L and L′ results in bases {e′1 , e′2 , e′3 } for L′ and {π a e′1 , π a−b e′2 , e′3 } for L; hence d(L, L′ ) = d(L′ , L). These additional properties follow easily: 1. d(L, L′ ) = 0 if and only if L = L′ . 2. d(L, L′ ) = 1 if and only if for any representative L ∈ L, the tight-fitting representative L′ ∈ L′ within L contains πL; in fact we have proper containments πL $ L′ $ L. 2.2. Edges. A graph is constructed from V by connecting two lattice classes (i.e., vertices) L and L′ by an edge precisely when d(L, L′ ) = 1. We then say that L and L′ are adjacent vertices. We denote the set of edges by E. Further observations will now be made about this adjacency. Suppose L ′ and L′ are as in 2. of §2.1. Then L = L′ /πL is a proper nontrivial subvector ′ space of the rank 3 k-vector space L = L/πL. We can lift L to an O-submodule W ∈ L, unique modulo πL, whereupon we easily deduce that L′ = W + πL; ′ so L′ is uniquely determined by L . ′ Conversely let L ∈ L be a lattice and let L be a proper nontrivial k′ subvector space of L = L/πL. Lifting L to an O-submodule W ∈ L and letting L′ = W + πL, we see that d(L, L′ ) = 1, where L′ is the class of L′ . ′ We see, then, that L′ ←→ L gives a one-to-one correspondence between vertices adjacent to L and proper nontrivial k-subvector spaces of L = L/πL. 2.3. Faces. We complete the graph to a 2-dimensional complex by “filling in the triangles”. More precisely, three distinct vertices L, L′ , L′′ which are pairwise adjacent, i.e., d(L, L′ ) = d(L′ , L′′ ) = d(L, L′′ ) = 1, will determine a face. We denote the set of faces by F . 2 The following proposition sheds light on the situation where three vertices form a face. Proposition 2.4. Let L, L′ , L′′ be distinct lattice classes which form a face (i.e., are pairwist adjacent), and let L′ , L′′ be representatives of L′ , L′′ , respectively, which are tight-fitting within L. Then L′ $ L′′ or L′′ $ L′ . Proof. If either containment L′ ⊆ L′′ or L′′ ⊆ L′ holds, it is necessarily a proper containment, since L′ and L′′ represent distinct lattice classes. Suppose L′ * L′′ . Noting that L $ πL′ $ πL $ L′′ (by 2. of §2.1), it follows that πL′ $ L′′ is tight-fitting, since L $ L′′ is tight-fitting. Since d(L′ .L′′ ) = 1, we have πL′′ $ πL′ by 2. of §2.1. This implies L′′ $ L′ , which concludes the proof. 2.5. More about faces. Suppose, in the situation of the proposition, L′′ $ L′ . ′ ′′ Letting L, L and L be the respective images of L, L′ , and L′′ in L/πL = L, ′′ ′ ′′ we have {0} $ L $ L $ L. Therefore L has rank 1 as a k-vector space, ′ and L has rank 2. Choose basis {e1 , e2 , e3 } of L such that {e1 } is a basis for ′′ ′ ′ ′′ L and {e1 , e2 } is a basis for L . As per §2.2, any way we lift L and L to O-submodules W ′ and W ′′ of L we have L′ = W ′ + πL and L′′ = W ′′ + πL. (1) Specifically, lifting {e1 , e2 , e3 } of L to {e1 , e2 , e3 } we get an O-basis of L and we can choose W ′′ and W ′ to have bases {e1 } and {e1 , e2 }, respectively. Thus we have L = Oe1 ⊕ Oe2 ⊕ Oe3 L′ = Oe1 ⊕ Oe2 ⊕ Oπe3 (2) ′′ L = Oe1 ⊕ Oπe2 ⊕ Oπe3 Conversely, for L a lattice class and L ∈ L, if we have k-subvector spaces ′ ′′ ′′ ′ ′ ′′ L , L of L = L/πL with {0} $ L $ L $ L, then lifting L and L to O-submodules W ′ and W ′′ of L and defining L′ , L′′ as in (1), then L′ and L′′ are tight-fitting within L and their classes L′ , L′′ together with L form a face. Thus we see that, once a representative lattice L is chosen from L, faces containing L are in one-to-one correspondence with chains of k-subvector ′′ ′ spaces {0} $ L $ L $ L, where L = L/πL. Vertices adjacent to L correspond to proper non-trivial k-subvector spaces (necessarily of rank 1 or 2) of L. ′ Moreover, given a rank 2 k-subvector space L yielding the lattice L′ ∋ L′ as above, then faces containing the edge connecting L and L′ correspond to ′ rank 1 subvector spaces of L lying within L ; given a rank 1 k-subvector space ′′ L yielding the lattice L′′ ∋ L′′ , then faces containing the edge connecting L ′′ and L′′ correspond to rank 2 subvector spaces of L containing L . 3 Note also that, given a lattice L with O-basis {e1 , e2 , e3 } and letting L′ and L′′ be defined as in (2), then L, L′ , L′′ represent three distinct classes which form a face. Note, however, that the face does not determine the basis {e1 , e2 , e3 } of L, nor does it determine the O-submodules W ′ and W ′′ . It ′ ′ ′′ ′′ only determines the k-subvector spaces W = L and W = L . It is easily verified that another basis {e′1 , e′2 , e′3 } yields the same lattice precisely when the transition matrix in GL3 (O) is lower triangular modulo πO. 2.6. The Complex. We now let C be the two dimensional complex whose vertices, edges, and faces are the sets V , E, and F , respectively. 2.7. Orientation of Edges. The graph formed by the vertices V and edges E of C will now be given the structure of an oriented graph, i.e., one in which each edge has a direction. Let L and L′ be adjacent vertices in V , there by determining an edge in E. Choose representative latices L and L′ of L and L′ , respectively, such that ′ L $ L′ is tight-fitting. As we saw in §2.2, the image L of L′ in L = L/πL has rank 1 or 2 as a k-vector space. If this rank is 1, we say the edge is directed from L toward L′ ; if the rank is 2, the edge is directed from L′ toward L. It is easy to verify that this orientation does not depend on the choices of L and L′ , nor the choice that L′ is tight-fitting within L. If we had started with L tight-fitting within L′ , the above process yields the same orientation for the edge. Finally we observe that if three lattice classes (vertices) L, L, L′′ form a face, the orientation “points around” the face. Choosing representatives L, L′ , L′′ as in §2.5, we see that the edges point L′′ to L′ to L to L, i.e., around the triangle as indicated below. L ←−−− L′ ց ր L′′ 3 Simple Connectivity of the Complex Theorem 3.1. The 2-dimensional simplicial complex C defined in §2 is connected. Proof. Let L and L′ be distinct lattice classes. Choose lattice classes L and L′ of L and L′ , respectively, with L′ tight-fitting within L. As in §2.1, we choose an O-basis {e1 , e2 , e3 } of L such that {π a e1 , π b e2 , e3 } forms a basis of L′ , with a ≥ b ≥ 0, and a ≥ 1 (since L and L′ are distinct). For 0 ≤ i ≤ b let Li be the 4 sublattice of L having O-basis {π i e1 , π i e2 , e3 }; for b + 1 ≤ i ≤ a let Li be the sublattice of L having O-basis {π i e1 , π b e2 , e3 }. We have L = L0 % L1 % · · · % La = L′ and, for i = 1, . . . , a, Li is tight-fitting within Li−1 , with Li−1 ⊃ πLi . Hence d(Li−1 , Li ) = 1. Letting L0 , L1 , . . . , La be the lattice classes of L0 , L2 , . . . , La , respectively, we see that Li−1 and Li are connected in C by an edge Ei . Thus E1 , . . . , Ea gives a path in C from L0 = L to La = L′ , proving the theorem. 3.2. The following discussion provides the tools for the proof of Theorem 3.4 below. The context is as follows: Suppose L, M, and N are lattice classes with d(L, M) = a ≥ 1 and d(M, N ) = 1. We we will show that d(L, N ) is a + 1, a, or a − 1, and we will see explicitly how d(L, N ) can be determined. Choose lattices L, M, and N representing L, M and N , respectively, with L % M % N , both containments being tight-fitting. As in §2.1, we choose an O-basis {e1 , e2 , e3 } of L such that {π a e1 , π b e2 , e3 } forms a basis of M , with a ≥ b ≥ 0. Note that if we set e′1 = ue1 e′2 = ve2 + xπ a−b e1 e′3 (3) b a = we3 + yπ e2 + zπ e1 with u, v, w ∈ O∗ , x, y, z ∈ O, then {e′1 , e′2 , e′3 } also is an O-basis of L with {π a e′1 , π b e′2 , e′3 } forming a basis of M . We will be utilizing changes of bases of type (3) repeatedly in the remainder of §3. But we take a moment to note that the alternate basis {e′1 , e′2 , e′3 } can be chosen more generally in the cases b = a and b = 0. In the case b = a we can set e′1 = qe1 + re2 e′2 = se1 + te2 e′3 (4) a a = we3 + yπ e1 + zπ e2   q r with ∈ GL2 (O), w ∈ O∗ , y, z ∈ O, and we have {e′1 , e′2 , e′3 } also is an s t O-basis of L with {π a e′1 , π a e′2 , e′3 } forming a basis of M . In the case b = 0 we can set e′1 = ue1 e′2 = qe2 + re3 + xπ a e1 e′3 a = se2 + te3 + yπ e1 5 (5)   q r with ∈ GL2 (O), u ∈ O∗ , x, y ∈ O, and we have {e′1 , e′2 , e′3 } also is an s t O-basis of L with {π a e′1 , e′2 , e′3 } forming a basis of M . 3.3. Further Analysis. As above, suppose L, M, and N are lattice classes with d(L, M) = a ≥ 1 and d(M, N ) = 1. Choose representative lattices L, M , and N with L % M % N , both containments being tight-fitting. As in §2.1, choose an O-basis {e1 , e2 , e3 } of L such that {π a e1 , π b e2 , e3 } forms a basis of M , with a ≥ b ≥ 0. Then by 2. of §2.1 N properly contains πM , and according to the discussion of §2.2 N is determined by the k-subvector space N = N/πM of M = M/πM , the latter having k-basis {π a e1 , π b e2 , e3 }. We know that N has rank 1 or 2, depending on whether the edge E connecting M and N is directed toward N or M, respectively. We consider the following possibilities. Case A1: rank (N ) = 1 (i.e., E is directed toward N ), and N ⊆ kπ a e1 ⊕kπ b e2 . In this case N is generated by απ a e1 + βπ b e2 with α, β ∈ k, not both zero. If β 6= 0, we can make a basis change for L of the type (3), with only e2 being altered, to effect α = 0 so that N = kπ b e2 . Letting W = Oπ b e2 , we have N = W + πM (as in §2.2), which has basis {π a+1 e1 , π b e2 , πe3 }. If b = 0, then N is tight-fitting within L and this basis shows that d(L, N ) = a + 1. If b > 0, then π −1 N , which has basis {π a e1 , π b−1 e2 , e3 }, is tight-fitting within L, showing that d(L, N ) = a. If β = 0, then N = kπ a e1 , which lifts to W = Oπ a e1 , so that N = W + πM , which has basis {π a e1 , π b+1 e2 , πe3 }, showing that π −1 N , with basis {π a−1 e1 , π b e2 , e3 } is tight-fitting within L and thus d(L, N ) = a − 1 unless a = b, in which case d(L, N ) = a. Case A2: rank (N ) = 2 (i.e., E is directed toward M), and N ⊆ kπ a e1 ⊕kπ b e2 . This means N = kπ a e1 ⊕ kπ b e2 , by rank. Then N lifts to W = Oπ a e1 ⊕ Oπ b e3 and N = W + πM , which has basis {π a e1 , π b e2 , πe3 }. This is tight-fitting in L only if b = 0, in which case d(L, N ) = a. If b > 0, then π −1 N is tight-fitting within L with basis {π a−1 e1 , π b−1 e2 , e3 }, showing that d(L, N ) = a − 1. Case B1: rank (N ) = 1 (i.e., E is directed toward N ), and N * kπ a e1 ⊕kπ b e2 . Then N is generated by and element of the form απ a e1 + βπ b e2 + e3 . We can make a basis change for L of the type (3), with only e3 being altered, to effect α = β = 0. Lifting N to W = Oe3 , we have N = W +πM , which is tight-fitting within L with basis {π a+1 e1 , π b+1 e2 , e3 }, which shows that d(L, N ) = a + 1. Case B2: rank (N ) = 2 (i.e., E is directed toward M), and N * kπ a e1 ⊕kπ b e2 . In this case we can choose a basis for N of the form {γπ a e1 + δπ b e2 , απ a e1 + βπ b e2 + e3 } where γ and δ are not both 0. If δ 6= 0, we can make a basis change for L of the type (3), with only 6 e2 and e3 being altered, to arrange N = kπ b e2 ⊕ ke3 , which lifts to W = Oπ b e2 ⊕ Oe3 . Then N = W + πM , which is tight-fitting within L with basis {π a+1 e1 , π b e2 , e3 }. Therefore d(L, N ) = a + 1. If δ = 0, then γ 6= 0, and we can make a basis change for L of the type (3) altering only e3 to get N = kπ a e1 ⊕ ke3 . Lifting to W = Oπ a e1 ⊕ Oe3 , we have N = W + πM which is tight-fitting within L with basis {π a e1 , π b+1 e2 , e3 } and thus d(L, N ) = a unless a = b, in which case d(L, N ) = a + 1. Our goal in the remainder of this section is to prove: Theorem 3.4. The complex C is simply connected. The proof of Theorem 3.4 will occupy §3.5 to §3.10. 3.5. Closed Path. Suppose we have a closed path in C beginning and ending at a vertex L0 . It is clear this can be deformed continuously into a path P along a sequence of edges E1 , E2 , . . . , Eℓ ∈ E with Ei joining vertices Li−1 and Li , 1 ≤ i ≤ ℓ. We may assume P has no backtracks, by which we mean “immediate” bactracks, i.e., Li 6= Li+2 when 0 ≤ i ≤ ℓ − 2; equivalently Ei 6= Ei+1 , when 1 ≤ i ≤ ℓ − 1. Since P is closed, L0 = Lℓ . It is our goal to show that P can be deformed continuously so as to consist of the single vertex L0 . This will prove the theorem. 3.6. If P is not a single vertix, i.e., ℓ ≥ 1, then it is clear that ℓ ≥ 3 since there are no backtracks. If ℓ = 3 then L0 , L1 , L2 are the vertices of a face with edges E1 , E2 , E3 , and the path clearly contracts to L0 . So let us assume ℓ ≥ 4. Clearly d(L0 , Li ) ≤ i. For the path P let nP be the smallest number such that d(L0 , LnP +1 ) < nP + 1. Our proof is by induction on the pair (ℓ, nP ), ordering such pairs lexicographically. The induction hypothesis is that for smaller ℓ, or for the same length ℓ but smaller nP , the path E1 , E2 , . . . , EnP +1 can be deformed to a shorter path. Clearly nP ≥ 1, and if nP = 1, then d(L0 , L2 ) = 1, so L0 , L1 , and L2 are the vertices of a face, whereby the path can be contracted to eliminate L1 . So we assume np ≥ 2. Let n = nP . Choose lattices L0 , L1 , . . . , Ln+1 representing L0 , L1 , . . . , Ln+1 , respectively, such that Lj+1 is tight-fitting within Lj for 0 ≤ j ≤ n. We then have Lj % Lj+1 % πLj , according to 2. of §2.1. We now apply the analysis of §3.3 with L0 , Ln−1 , and Ln in the roles of L, M, and N , and L0 , Ln−1 , and Ln in the roles of L, M , and N . The number a in §3.3 is n−1 = d(L0 , Ln−1 ), and we now let b−1 play the role of the number b in §3.3. From the fact that d(L0 , Ln ) = n it follows that we are in either Case B1 or Case B2. As the analysis reveals, if we are in case B1 we have an O-basis {e1 , e2 , e3 } of L0 such that {π n−1 e1 , π b−1 e2 , e3 } forms a basis of Ln−1 , with n − 1 ≥ b − 1 ≥ 0, and Ln has basis {π n e1 , π b e2 , e3 }. If Case B2 holds we 7 again have an O-basis {e1 , e2 , e3 } of L0 such that {π n−1 e1 , π b−1 e2 , e3 } forms a basis of Ln−1 , with n − 1 ≥ b − 1 ≥ 0, and Ln has basis {π n e1 , π b−1 e2 , e3 }. (Note that in the case δ = 0 of Case B2 with a = b we can simply switch e1 and e2 to get to the δ 6= 0 case.) We have to address this according to the four possible combinations of orientations of the edges En and En+1 . The four cases are depicted by: E En+1 E En+1 E En+1 E En+1 n Ln−1 −−− → Ln −−−→ Ln+1 n Ln−1 −−− → Ln ←−−− Ln+1 n Ln−1 ←−− − Ln −−−→ Ln+1 n Ln−1 ←−− − Ln ←−−− Ln+1 (6) (7) (8) (9) Note that (6) and (7) are the possibilities if Case B1 holds, and (8) and (9) are the possibilities for Case B2. 3.7. Case (6). As we said, we have O-bases {π n−1 e1 , π b−1 e2 , e3 } for Ln−1 and {π n e1 , π b e2 , e3 } for Ln , according to the analysis of case B1. First let us assume πL0 ⊇ Ln+1 . Then Ln+1 is contained in πL0 ∩Ln , which has O-basis {π n e1 , π b e2 , πe3 }. Note that this intersection is πLn−1 , hence is in the same lattice class as Ln−1 . Denoting this lattice by L′n−1 , we note that Ln % L′n−1 % Ln+1 (the latter containment must be proper since the images of L′n−1 and Ln+1 in Ln /πLn are 2 and 1, respectively). This shows that d(Ln−1 , Ln+1 ) = 1, from which we conclude that Ln−1 , Ln , and Ln+1 form a face with orientation: En+1 Ln −−−→ Ln+1 En տ ւ E Ln−1 This the path P deforms through this face to the shorter path P ′ which proceeds directly from Ln−1 to Ln+1 via the edge E indicated above, completing the induction. Now assume πL0 + Ln+1 . Choosing an element in Ln+1 which is not in πL0 and writing it in terms of the Ln -basis {π n e1 , π b e2 , e3 }, we see that the coefficient of e3 cannot lie in πO, so we may assume the coefficient is 1. Thus Ln+1 must contain an element of the form e′3 = e3 + yπ b e2 + zπ n e1 , with y, z ∈ O. Note that we can replace e3 by e′3 , and the O-bases of Ln−1 and Ln given above remain intact. So we can assume e3 ∈ Ln+1 . Now we consider the image Ln+1 of Ln+1 in Ln = Ln /πLn . According to the orientation of the edge En+1 , this must be a k-vector space of rank 1, and since it contains the 8 image e3 of e3 we must have Ln+1 = must Ln+1 = Oe3 + πLn (see §2.2), But now we see that d(L0 , Ln+1 ) = assumption the nP = n. So this case ke3 . Lifting this vector space to Oe3 we which has O-basis {π n+1 e1 , π b+1 e2 , e3 }. n + 1, which is in contradiction to our cannot occur. 3.8. Case (7). As in the previous case, we have O-bases {π n−1 e1 , π b−1 e2 , e3 } for Ln−1 and {π n e1 , π b e2 , e3 } for Ln , according to the analysis of case B1. As before we first assume πL0 ⊇ Ln+1 , in which case Ln+1 ⊆ πL0 ∩ Ln , the latter having O-basis {π n e1 , π b e2 , πe3 }. As before, this intersection is πLn−1 , which is in the same lattice class as Ln−1 . Denoting this lattice by L′n−1 , we see that Ln % L′n−1 ⊇ Ln+1 . Since the images of L′n−1 and Ln+1 in Ln = Ln /πLn both have rank 2, we must have L′n−1 = Ln+1 , and hence Ln−1 = Ln+1 , showing that the edges En and En+1 constitute a backtrack, contradicting our assumption that none occur. We now deal wth the case πL0 + Ln+1 . Proceeding as in Case (6), we choose an element in Ln+1 which is not in πL0 and write it in terms of the Ln -basis {π n e1 , π b e2 , e3 }. As before, the coefficient of e3 cannot lie in πO, so we may assume it is 1, and the element has the form e′3 = e3 + yπ b e2 + zπ n e1 , with y, z ∈ O. As before, we replace e3 by e′3 to arrange that e3 ∈ Ln+1 . Now we consider the rank 2 k-vector space Ln+1 in Ln = Ln /πLn , where we can complete e3 to a basis {απ n e1 + βπ b e2 , e3 } of Ln+1 , with α, β ∈ k, not both zero. If β 6= 0, we can assume β = 1. Lifting α to a ∈ O, we can replace e2 by e′2 = e2 + aπ n−b (note this is a change of basis of type (3)) to arrange that Ln+1 has basis {π b e2 , e3 }. Therefore Ln+1 lifts to W = Oπ b e2 ⊕ Oe3 in Ln , and we have Ln+1 = W + πLn , which has O-basis {π n+1 e1 , π b e2 , e3 }. We see that Ln+1 is tight-fitting within L0 , and that d(L0 , Ln+1 ) = n + 1, which contradicts our assumption nP = n. Therefore β = 0 and we may assume α = 1, so that Ln+1 has k-basis n {π e1 , e3 }. We may also assume b < n, for if b = n, we could interchange e1 and e2 and be in the situation of the previous paragraph. Then Ln+1 lifts to W = Oπ n e1 ⊕ Oe3 , so that Ln+1 = W + πLn , which has O-basis {π n e1 , π b+1 e3 , e3 }. Let L be the lattice with O-basis {π n−1 e1 , π b e3 , e3 }, and let L denote its lattice class. Note that L is tight-fitting within L0 , and that d(L0 , L) = n − 1 (by our assumption b < n). Note that the chosen bases for Ln−1 , Ln , and L have the relationships expressed in (2), as do the chosen bases for Ln , Ln+1 , and L. Therefore each of these triples form a face and we have the configuration below, with these orientations: En+1 E n Ln−1 −−− → Ln ←−−− Ln+1 տ ↓ ր L 9 The path P can therefore deformed to the path P ′ that takes the “lower route”, bypassing Ln in favor of L. The path P ′ has the same length as P ; however, since d(L0 , L′ ) = n − 1, we have nP ′ = n − 1. After possibly shortening P ′ by retracting a backtrack that may have been introduced, the induction is complete. 3.9. Case (8). Here Ln−1 has O-basis {π n−1 e1 , π b−1 e2 , e3 } and Ln has basis {π n e1 , π b−1 e2 , e3 }, according to the analysis of Case B2. First let us deal with the case πL0 ⊇ Ln+1 . In this situation, Ln+1 is contained in πL0 ∩ Ln , which is contained in L = Oπ n e1 ⊕ Oπ b−1 e2 ⊕ Oπe3 , the containment being an equality unless b = 1. Letting L be the lattice class of L, and noting that that Ln ⊇ L is a tight-fitting containment, we see that Ln and L are connected by an edge E directed toward Ln , since the image L of L in Ln = Ln /πLn has rank 2 (being generated by π n e1 and π b−1 e2 ). Since the edge En+1 is directed toward Ln+1 , we see that the containments Ln ⊃ L ⊃ Ln+1 are proper and tight-fitting (we can’t have L = Ln+1 since the image Ln+1 of Ln+1 in Ln = Ln /πLn has rank one), and thus we have Ln , L, and Ln+1 forming a face with orientation: En+1 Ln −−−→ Ln+1 E տ ւ E′ L Looking at the bases, one notes that L is tight-fitting within Ln−1 , and that d(Ln−1 , L) = 1. Therefore Ln−1 , L, and Ln also form a face, so we have the configuration En+1 E n Ln−1 ←−− − Ln −−−→ Ln+1 ց ↑ ւ L Thus the path P can be deformed to the path P ′ that takes the “lower route” in the above diagram, thus replacing Ln by L. Now we must treat the cases b > 1 and b = 1 separately. If b > 1, then L0 ⊇ π −1 L, since π −1 L ∈ L has basis {π n−1 e1 , π b−2 e2 , e3 }. Since b − 2 ≥ 0, this shows that d(L0 , L) = n − 1. Hence nP ′ = n − 1. At this point we may be able to shorten P ′ by retracting a backtrack, but either way the induction is complete. If b = 1, Ln−1 has O-basis {π n−1 e1 , e2 , e3 }, Ln has basis {π n e1 , e2 , e3 }, and πL0 ∩Ln has basis {π n e1 , πe2 , πe3 }. We have Ln % πL0 ∩Ln ⊇ Ln+1 % πLn and since the images of πL0 ∩ Ln and Ln+1 modulo πLn both have rank one, those images must be equal, and hence πL0 ∩Ln = Ln+1 = Oπ n e1 ⊕Oπe2 ⊕Oπe3 . Let 10 L′ be the lattice with O-basis {π n−1 e1 , πe2 , πe3 }, and let L′ be its lattice class. Note that L′ is tight-fitting within Ln−1 , and d(Ln−1 , L′ ) = d(L′ , Ln+1 ) = 1, We have the configuration En+1 E n Ln−1 ←−− − Ln −−−→ Ln+1 ց ↑ ւ L′ As before, the path P can be deformed to the path P ′ that takes the “lower route”, replacing Ln by L′ . Noting that d(L0 , L′ ) = n − 2, we see that nP ′ = n − 1 = np − 1, and again the induction is complete after possibly retracting a backtrack. Now assume πL0 + Ln+1 . If b > 1, then Ln+1 must contain an element of the form e′3 = e3 + yπ b−1 e2 + zπ n e3 . If b = 1, we have symmetry between e2 and e3 , and after possibly interchanging them we again have an element of Ln+1 having this form. We now replace e3 with e′3 , noting that the O-bases of Ln−1 and Ln have the same form as before, to arrange e3 ∈ Ln+1 . As the image Ln+1 of Ln+1 in Ln = Ln /πLn has rank one, it must be generated by the image e3 of e3 . It follows that Ln+1 has basis {π n+1 e1 , π b e2 , e3 }. But this shows d(L0 , Ln+1 ) = n + 1, which contradicts our assumption nP = n. So this case cannot occur. 3.10. Case (9). Here again, Ln−1 has O-basis {π n−1 e1 , π b−1 e2 , e3 } and Ln has basis {π n e1 , π b−1 e2 , e3 }, according to Case B2. First let us deal with the case πL0 ⊇ Ln+1 . In this situation, Ln+1 is contained in πL0 ∩ Ln , which is contained in Oπ n e1 ⊕ Oπ b−1 e2 ⊕ Oπe3 , and we denote this direct sum by L. (Note, as before, that if b > 1 we have L = πL0 ∩ Ln .) We have tight-fitting containments Ln ⊃ L ⊃ Ln+1 . Letting L be the lattice class of L, we see that Ln and L are connected by an edge directed toward Ln , reflecting the fact that the image L of L in Ln = Ln /πLn has rank 2. Since the image Ln+1 of Ln+1 also has rank 2, and since L ⊆ Ln+1 , we must have L = Ln+1 and hence L = Ln+1 . But now note that Ln+1 is tightfitting within Ln−1 and that d(Ln−1 , Ln+1 ) = 1, showing that Ln−1 , Ln , and Ln+1 form a face F. Therefore the the path can be deformed through F to follow the edge connecting Ln−1 to Ln+1 , thus eliminating Ln . The resulting path P ′ has length ℓ − 1, as desired. After possibly retracting a backtrack, the induction is complete. Now we assume πL0 + Ln+1 . Then there exists w ∈ Ln+1 with w ∈ / n b−1 πL0 . Since w ∈ Ln we write in as w = xπ e1 + yπ e2 + ze3 , recalling that {π n e1 , π b−1 e2 , e3 } is an O-basis of Ln . Since w ∈ / πL0 and since n > 0, then either z ∈ O∗ , or else b = 1 and y ∈ O∗ . But in the latter case there is symmetry between e2 and e3 , so we can switch them and assume z ∈ O∗ , and, 11 in fact, multiplying by a unit in O, we can arrange z = 1. Now replace e3 by e′3 = xπ n e1 + yπ b−1 e2 + e3 . This is a change of type (3); note that with this replacement, the bases for both Ln−1 and Ln are expressed as before, and we now have e3 ∈ Ln+1 . Now consider the image Ln+1 of Ln+1 in Ln = Ln /πLn . Since the edge En+1 is directed toward Ln , this vector space has rank 2. Note that e3 ∈ Ln+1 and is non-zero, so it can be completed to a basis for Ln+1 of the form {απ n e1 + βπ b−1 e2 , e3 }. If β 6= 0, we can assume β = 1. Lifting α to a ∈ O, we can replace e2 by e′2 = e2 + aπ n−b+1 (note this is a change of basis of type (3)) to arrange that Ln+1 has basis {π b−1 e2 , e3 }. Then Ln+1 lifts to W = Oπe2b−1 ⊕ Oe3 and Ln+1 = W + πLn , which has O-basis {π n+1 e1 , π b−1 e2 , e3 }. But this implies d(L0 , Ln+1 ) = n + 1, contradicting our assumption. Therefore β = 0, so α 6= 0 and we may assume α = 1, so that Ln+1 has basis {π n e1 , e3 }. Thus Ln+1 lifts to W = Oπ n e1 ⊕ Oe3 , and Ln+1 = W + πLn , which has O-basis {π n e1 , π b e2 , e3 }. Note that the chosen bases of Ln−1 , Ln , and Ln+1 have the relationships expressed in (2), so Ln−1 , Ln , and Ln+1 form a face F, and as above, the path can be deformed through F to follow the edge connecting Ln−1 to Ln+1 , thus eliminating Ln and resulting in a shorter path P ′ . This concludes the proof of Theorem 3.4. 4 Structure of SL3(K) 4.1. We note that GL3 (K) acts on the set of lattices by virtue of its action on the ambient K-vector space X, and this action preserves lattice equivalence; hence it acts on the set V of vertices of C. It is clear from the way edges and faces are defined that the action preserves adjacency and orientation of edges, and extends to a continuous action on the complex C. It is not this action, but rather the restriction of the action to SL3 (K), that will produce the Main Theorem, Theorem 4.4 below. However, it will be important to note a few facts involving the action of GL3 (K). First, the action of GL3 (K) clearly acts transitively on the set ot lattices (and therefore on the set of lattices classes V ). However this is not the case for the action of SL3 (K). Observe, for example, that if an element γ of SL3 (K) fixes a vertex L ∈ V , it must fix each lattice L in the class L, for if γ carried L to π n L with n 6= 0, then its determinant would be π 3n , violating its membership in SL3 (K). It easily follows that the SL3 (K)-orbit of a lattice has at most one lattice in each lattice class. Moreover, it is not possible for γ ∈ SL3 (K) to carry a vertex to another vertex lying the same face. For suppose L, L′ , and L′′ are the vertices of a face, with representatives L, L′ , L′′ as in §2.5. If γL = L′ , then 12 γL = π n L′ , for some n, from which it follows that det γ = π 3n+1 ; if γL = L′ , we would get det γ = π 3n+2 . Either contradicts the fact that γ ∈ SL3 (K). Choose an ordered basis (e1 , e2 , e3 ) for the K-vector space X, and let F be the face in C whose vertices are the classes L, L′ , and L′′ defined in §2.5, represented respectively by the lattices L, L′ , and L′′ of (2). Let α, β ∈ GL3 (K) be defined by:     1 0 0 1 0 0 α = 0 1 0  β = 0 π 0  (10) 0 0 π 0 0 π Note that α(L) = L′ and β(L) = L′′ and that det α = π, det β = π 2 . These elements will be used in the proof of Proposition 4.2 below, and in the statement and proof of the Main Theorem (Theorem 4.4). Proposition 4.2. SL3 (K) acts transitively on the set F of faces of C. Moreover the action is “without inversion”, meaning that if a group element carries a face onto itself, then it acts as the identity function on that face. Thus any single face of C maps isomorphically to the quotient complex of C by the action of SL3 (K), hence serves as a fundamental domain for the action. Proof. First, we show that, given faces F, G ∈ F , with L being a vertex of F, there exists a unique vertex M of G which is in the SL3 (K)-orbit of L. The uniqueness follows from the fact, noted above, that and element of SL3 (K) cannot carry a vertex on F to another vertex on F. This shows that the action is “without inversion”. Let L. L′ , and L′′ be the vertices of F, with representatives L, L′ , L′′ defined as in §2.5 with respect to an ordered basis (e1 , e2 , e3 ); let M. M′ , and M′′ be the vertices of G, represented by M, M ′ , M ′′ defined similarly with respect to an ordered basis (f1 , f2 , f3 ). Choose ϕ ∈ GL3 (K) such that ϕ ei = fi for i = 1, 2, 3. Then ϕ L = M . We have det ϕ = uπ n for some n ∈ Z. Multiplying the left column of ϕ (expressed as a matrix with respect to (e1 , e2 , e3 )) by u−1 , and replacing f1 by u−1 f1 , we may assume u = 1. Write n = 3m + r, where m ∈ Z, r ∈ {0, −1, −2}. Now replacing ϕ by π −m ϕ, and replacing M, M ′ , M ′′ by π −m M, π −m M ′ , π −m M ′′ , we have det ϕ = π r . If r = 0, then ϕ ∈ SL3 (K), ϕL = M , so ϕL = M, and our immediate goal is accomplished. If r = −1, then taking α ∈ GL3 (K) having the form (10) relative to the basis (f1 , f2 , f3 ), we have det αϕ = 1 and αM = M ′ , therefore αϕL = M ′ , so αϕL = M′ as needed. If r = −2, we do the same using β instead of α to get βϕL = M′′ , with det βϕ = 1. Now relabel M, M′ , and M′′ so that ϕL = M, with ϕ ∈ SL3 (K), with representatives M , M ′ , and M ′′ where ϕL = M . Rechoose (f1 , f2 , f3 ) to be an O-basis for M such that M ′ and M ′′ are defined analogously as in as in §2.5, 13 with M, M ′ , M ′′ replacing L, L′ , L′′ and (f1 , f2 , f3 ) replacing (e1 , e2 , e3 ). We can compose ϕ with an element of SL3 (O) to arrange ϕ ei = fi for i = 1, 2, 3. It is now clear that ϕ(πei ) = πfi , so ϕL′ = M ′ and ϕL′′ = M ′′ . Hence ϕL = M, ϕL′ = M′ , ϕL′′ = M′′ , so ϕF = G and the proof of the proposition is complete. 4.3. Stabilizers. We have established that any single face serves as a fundamental domain for the action of SL3 (K) on C. It follows by the higher dimensional analogue of Serre’s tree theory [4], which can be found in [5], [6], or [2], that SL3 (K) is the generalized amalgamated product of the stabilizers of the three vertices of a single face. Thus SL3 (K) is what is sometimes called a “triangle of groups”. We now investigate the stabilizers that this amalgamation comprises. Choose an ordered basis (e1 , e2 , e3 ) for the K-vector space X, and let F be the face in C whose vertices are the classes L, L′ , and L′′ defined in §2.5, represented respectively by the lattices L, L′ , and L′′ of (2). We will determine the stabilizers of L, L′ , and L′′ in SL3 (K), which are precisely the stabilizers of the stabilizers of L, L′ , and L′′ (since, as we have observed, each SL3 (K)-orbit contains at most one lattice in each lattice class). We will represent elements of SL3 (K) by their matrix relative to the basis (e1 , e2 , e3 ). Clearly the stabilizer of L is SL3 (O), which we will now be denoted by G1 . With α, β ∈ GL3 (K) defined as in (10), we have α(L) = L′ and β(L) = L′′ . Therefore the SL3 (K)-stabilizers of L′ and L′′ , respectively, are G2 = αG1 α−1 and G3 = β G1 β −1 . According to the general theory recounted in §4.2, SL3 (O) is the generalized amalgamated product of G1 , G2 , and G3 along their pairwise intersections. We now explicitly describe these groups and their pairwise intersections. One sees from matrix multiplication that    a11 a12 π −1 a13   a21 G2 = a22 π −1 a23   πa31 πa32 a33    a11 π −1 a12 π −1 a13 G3 = πa21 a22 a23   πa31 a32 a33 From this one sees that 14  a11 a21 a31  a11 a21 a31   a12 a13  a22 a23  ∈ SL3 (O)  a32 a33   a12 a13  a22 a23  ∈ SL3 (O)  a32 a33 (11)   a11 G1 ∩ G2 = a21  a31   a11 G1 ∩ G3 = a21  a31    x11 G2 ∩ G3 = x21   x31 and   a12 a13  a22 a23  ∈ SL3 (O) | a31 , a32 ∈ πO  a32 a33   a12 a13  a22 a23  ∈ SL3 (O) | a21 , a31 ∈ πO  a32 a33   x11 , x12 , x22 , x23 , x33 ∈ O x12 x13  x21 , x31 , x32 ∈ πO x22 x23  ∈ SL3 (K)   x32 x33 x13 ∈ π −1 O (12)    a11 a12 a13 G1 ∩ G2 ∩ G3 = a21 a22 a23  ∈ SL3 (O)  a31 a32 a33 | a21 , a31 , a32 ∈ πO   (13)  4.4. Main Theorem. Collecting the observations of this section, following theorem states the main result of this paper. Theorem 4.5. Main Theorem. Let K be a local field, the field of fractions of the discrete valuation ring O, with uniformizing parameter π ∈ O. Then SL3 (K) is the generalized amalgamation of the subgroups G1 = SL3 (O), G2 = αG1 α−1 and G3 = β G1 β −1 along pairwise intersections. Here α and β are as defined in (10), and the pairwise intersections are described more explicitly in (12). Note that G1 , G2 , and G3 are all isomorphic copies of SL3 (O). As stated in the abstract, this theorem generalizes a theorem of Ihara (see [4], p. 143 Corollary 1 to Theorem 3), stated below. Theorem 4.6. (Ihara) Let K, O, and π be as in Theorem 4.5. Then SL2 (K) is the amalgamated product of the subgroups G1 = SL1 (O) and G2 = αG1 α−1 along their intersection. Here   1 0 α= 0 π and the intersection is given by    a b ∈ SL2 (O) c ∈ πO c d Note that G1 and G2 are isomorphic copies of SL2 (O). 15 5 Concluding Remarks 5.1. Questions about C. It is clear that the complex C has infinite diameter, i.e., its 1-skeleton has infinite diameter as a graph. This follows from the fact that the shortest path between two vertices L and L′ will have length d(L, L′ ) as defined in §2.1. However the following question about C is not known. Question 5.2. Is the complex C 2-connected, i.e., is π2 (C) = 0?. This should follow from a “curvature” argument, and will be hopefully given in a future revision of this paper. Some further knowledge about C might be useful in answering the following question. Question 5.3. Must each finite subgroup of SL3 (K) be conjugate to a subgroup of G1 , G2 , or G3 ? The above question’s analog has a positive answer for a group that is the amalgamated product of two groups. In general this fails for generalized amalgamations of three or more groups, so an affirmative answer to Question 5.3 would need to rely on some special characteristics of the complex C, perhaps including 2-connectivity. Question 5.4. Do Theorems 4.5 and 4.6 generalize to give a structure theorem for SLn (K), n > 3, as a generalized amalgamation of n analogous subgroups? The author sees no obstruction to carrying out this generalization using rank n lattices, along the lines of the proof of Theorem 4.5. 5.5. Related Matters. In [7], the author showed that the tame automorphism group of affine three-space over a field of characteristic zero is the generalized amalgamation of three subgroups (see [7], Theorem 4.1), a fact that was proved independently by Bisi, Furter, and Lamy in [1]. It has recently been proved (see [3]) that the two-dimensional complex associated with the amalgamated structure is 2-connected, hence contractible. The paper [7] also contains a run-down of numerous other instances of various automorphism groups that have the structure of amalgamated products. It is the author’s hope that the action of SL3 (K) on the complex C will lead to a structure theorem for SL3 (k[T ], where k[T ] is the polynomial ring in one variable over a field k. This conclusion should generalize Nagao’s Theorem, stated below. (Note: The author has now accomplished this; it will soon be included in a revision of this paper.) 16 Theorem 5.6. (Nagao) The group SL2 (k[T ]) is the amalgamated product of SL2 (k) and SB(k[T ]) along their intersection SB(k), where for a ring R, SB(R) denotes the lower triangular subgroup of SL2 (R). This is derived in [4], §1.6, from the theorem of Ihara (Theorem 4.6), which, in turn, arises from the action SL2 (K) on the tree whose vertices are rank 2 lattice classes, for which the complex C is a direct generalization. References [1] Cinzia Bisi, Jean-Philippe Furter, and Stéphane Lamy, The tame automorphism group of an affine quadric threefold acting on a square complex, J. Éc. polytech. Math. 1 (2014), 161–223. MR 3322787 [2] André Haefliger, Complexes of groups and orbihedra, Group theory from a geometrical viewpoint (Trieste, 1990), World Sci. Publ., River Edge, NJ, 1991, pp. 504–540. MR 1170375 (93m:20048) [3] Stéphane Lamy and Piotr Przytycki, Acylindrical hyperbolicity of the threedimensional tame automorphism group, ArXiv e-prints (2017). [4] Jean-Pierre Serre, Trees, Springer Monographs in Mathematics, SpringerVerlag, Berlin, 2003, Translated from the French original by John Stillwell, Corrected 2nd printing of the 1980 English translation. MR 1954121 (2003m:20032) [5] Christophe Soulé, Groupes opérant sur un complexe simplicial avec domaine fondamental, C. R. Acad. Sci. Paris Sér. A-B 276 (1973), A607– A609. MR 0317307 [6] Richard G. Swan, Generators and relations for certain special linear groups, Advances in Math. 6 (1971), 1–77 (1971). MR 0284516 [7] David Wright, The generalized amalgamated product structure of the tame automorphism group in dimension three, Transform. Groups 20 (2015), no. 1, 291–304. MR 3317803 Department of Mathematics, Washington University in St. Louis, St. Louis, MO 63130 E-mail: [email protected] 17
0math.AC
Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 Throughput-Distortion Computation Of Generic Matrix Multiplication: Toward A Computation Channel For Digital Signal Processing Systems Davide Anastasia and Yiannis Andreopoulos* ABSTRACT The generic matrix multiply (GEMM) function is the core element of high-performance linear algebra libraries used in many computationally-demanding digital signal processing (DSP) systems. We propose an acceleration technique for GEMM based on dynamically adjusting the imprecision (distortion) of computation. Our technique employs adaptive scalar companding and rounding to input matrix blocks followed by two forms of packing in floating-point that allow for concurrent calculation of multiple results. Since the adaptive companding process controls the increase of concurrency (via packing), the increase in processing throughput (and the corresponding increase in distortion) depends on the input data statistics. To demonstrate this, we derive the optimal throughputdistortion control framework for GEMM for the broad class of zero-mean, independent identically distributed, input sources. Our approach converts matrix multiplication in programmable processors into a computation channel: when increasing the processing throughput, the output noise (error) increases due to (i) coarser quantization and (ii) computational errors caused by exceeding the machine-precision limitations. We show that, under certain distortion in the GEMM computation, the proposed framework can significantly surpass 100% of the peak performance of a given processor. The practical benefits of our proposal are shown in a face recognition system and a multi-layer perceptron system trained for metadata learning from a large music feature database. Index Terms—matrix-based DSP, BLAS level-3, high performance computing, stochastic error estimation, throughput-distortion trade-offs in DSP; EDICS: HDW-HDSP (1st), HDW-AAOP (2nd) 1. INTRODUCTION Can we accelerate basic mathematical operations in computers by systematically trading off precision in the results in a stochastic manner? We address this question for one of the most essential operations in digital signal processing (DSP) systems: matrix multiplication. The authors are with the University College London, Dept. of Electronic & Electrical Engineering, Torrington Place, WC1E 7JE, London, UK; Tel: +44-20-76797303 (both authors); fax: +44-20-73889325 (both authors); email: [email protected] (D. Anastasia), [email protected] (Y. Andreopoulos). The work was supported by EPSRC, project EP/F020015/1. * Corresponding author. Address and contact information: see above. 1 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 Computationally-intensive DSP operations, such as covariance scatter matrix calculation [1], noise cancellation [2], back-propagation learning [3], and two-dimensional (2D) transform analysis and synthesis of large data sets [4] make heavy use of matrix multiplication operations. Optimized realizations of such operations in programmable processors are based on the standard basic linear algebra subprograms (BLAS) library1, which is tailored to the particular hardware via the use of optimized assembly or single-instruction-multiple-data (SIMD) code [5]. Single and double-precision floating-point matrix multiplication is realized in BLAS by the generic matrix multiply (GEMM) function. Since most BLAS functions can be rewritten to use GEMM as the dominant operation as the problem size scales [6], GEMM throughput measurements have traditionally been considered important enough to form a core part of processor benchmarking efforts. A. Related Work Most practical approaches for complexity-distortion scalability are algorithm-specific [7]-[10]. Although significant complexity reduction can be offered by such proposals, it is difficult to provide dynamic precision adaptation; essentially, one is forced to adopt an algorithmic modification leading to certain “generally acceptable” precision, without being able to adjust this at run-time, under the same implementation, and in an inexpensive manner. Within more generic, theory-driven, approaches, Monte Carlo algorithms have been proposed for fast approximate matrix multiplication [11]. The concept of approximate or stochastic computation was proposed as a broader way to achieve complexity-distortion scaling [8] and fault tolerance [12]. Such approaches target errortolerant applications where the aim is to provision for average performance vs. distortion requirements and not for the worst case. However, all existing proposals [8][11][12] are either based on complexity models or customized VLSI designs, and cannot be deployed in programmable processors that have fixed hardware for arithmetic, logic and memory units. One exception is work on software designs for image processing operations, where progressive (incremental) computation for general-purpose or DSP systems was achieved [13][14]. However, the proposed schemes apply only for lossy-to-lossless image processing operations and, importantly, no distortion-controlled acceleration of linear operations is proposed. 1 E.g.: www.netlib.org (Netlib repository), www.intel.com/software/products/mkl (Intel Math Kernel Library), http://developer.amd.com/cpu/Libraries/acml (AMD Core Math Library), http://www.maplesoft.com/ (Maple), http://www.mathworks.com/ (Matlab), http://eigen.tuxfamily.org/ (Eigen – ported to digital signal processors like the ARM Neon, the TI TMS320C6x series, etc.), provide optimized realizations of BLAS. 2 Anastasia and Andreopoulos, B. IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 Proposed Work In this paper we focus on high-performance realizations of the GEMM function of BLAS [5][6] (reviewed in Section 2). Our proposal for GEMM centers on: (i) SIMD-based realization of scalar quantization of inputs; (ii) a novel form of input packing for concurrent calculation of multiple results beyond what is possible with SIMD instructions (Section 3). Based on the detailed analysis of the quantization-induced error and the representationinduced error (Section 4), a throughput/distortion control mechanism is proposed for each subblock of GEMM (Section 5 and 6). Depending on the distortion tolerance or the throughput requirement for GEMM, the experiments of Section 7 demonstrate that our design ranges from zero distortion, i.e. identical throughput/precision to the conventional single or double-precision GEMM (sGEMM or dGEMM, respectively), up to 180% higher throughput with controlled distortion in the results. Since the throughput/distortion adaptation depends on the input statistics and computational errors can be introduced by exceeding the machine precision limitations, this system can be seen as a computation channel for high-performance matrix multiplication in programmable processors. Finally, even though the proposed control framework is tailored to the broad class of zero-mean, independent identically distributed (iid) input data, with some loss of optimality we also validate it in applications were inputs are not strictly iid (Section 8). Such applications are: a state-of-the-art face recognition system based on the 2D principal component analysis (PCA) algorithm [1] and multilayer perceptron-based training [3] applied to automated metadata identification from music features [15]. This work extends our initial efforts [16] by: (i) proposing different ways for packing of quantized input data and comparing their performance; (ii) incorporating the impact of the representation-induced noise in the final distortion; (iii) extending the initial control framework for the adaptation of GEMM toward the general case of multiple packings and providing a solution for dual control based on throughput or distortion; (iv) presenting extended experimental results that include both single and double-precision representations and extending these results within several DSP applications. As such, this paper and the accompanying demonstration materials [17] present the first generic approach toward systematic throughput/precision realizations of matrix-based DSP operations in programmable processors. This links this proposal with error-tolerant computing [18] and the imminent scaling and power-wall problems of programmable processors [19], with the added benefit of being directly applicable in today’s computing infrastructure without requiring architectural or hardware modifications. 3 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 2. OVERVIEW OF GEMM Consider the GEMM design depicted in Figure 1(a), following the general flow found in optimized BLAS implementations [5]. The application calls sGEMM or dGEMM for an level of Figure 1(b)] which is further subdivided into approach, SIMD is specified by: by “inner-kernel” matrix multiplications. For our LCM 2,3, … , max ! with: LCM "# , … , "$ ! the least common multiple of integers "# , … , "$ ; max packings utilized in the proposed throughput/distortion computation; SIMD 16 in this work); SIMD register (SIMD floating point representations; and matrix multiplication2, [top- (1) the maximum number of the number of bytes of each ( 4,8 the number of bytes for single and double-precision any positive integer. The inner-kernel result + ,,# of the example shown in Figure 1(a) comprises multiple subblock multiplications - ,,. /.,# : + ,,# ∑1/34# - ,,. /.,# . .56 (2) If the matrices’ dimensions are not multiples of , some “cleanup” code [5] is applied at the borders to complete an inner-kernel result of the overall matrix multiplication. This separation into top-level processing and subblock-level processing is done for efficient cache utilization. Specifically, during the initial data access of GEMM for top-level processing, data in matrix - and / is reordered into block major format: for each 1 > $ pair of subblocks - 7,. and /.,8 multiplied to produce inner-kernel result + 7,8 , 0 : ; < , 0 : = < , 0 : ? < , the input data within - 7,. and /.,8 is reordered in rowwise and columnwise 3 3 3 raster manner, respectively. Thus, sequential data accesses are performed during the actual computation and this enables the use of SIMD instructions for each subblock multiplication, thereby leading to significant acceleration. As shown in Figure 1(b), our proposal creates an intermediate level (Tier 1.5) that performs certain preprocessing for companding, rounding and packing before calling the subblock matrix multiplication code. Once the calculation is completed for each subblock multiplication, post-processing is applied to retrieve the results. The subblock-specific adjustment of the companding factors in our approach allows for data-driven (adaptive) packing and concurrency in the calculation of the inner-kernel results – thus, sGEMM and dGEMM are accelerated 2 Notations: Boldface uppercase and lowercase letters indicate matrices and vectors, respectively; the corresponding italicized lowercase indicate their individual elements, e.g. - and "@,A ; all indices are integers; max - and min - indicate the maximum and minimum values of matrix - and D-DE is the Frobenius (root-sum-square) norm; FGH rounds G to integer and IGJ is the largest integer not greater than G; GK, GL , GM indicate the quantized, packed, and dequantized value of G, respectively; all random variables used in this paper have mean zero and are represented by Greek lowercase letters, e.g. N~PQ RQ !, with PQ their zero-mean probability density function with standard deviation RQ (P and R are reserved for this purpose). 4 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 according to the input statistics of each subblock. Since our modifications are applied externally to the subblock matrix multiplication, in the next section we focus on the subblock processing stage. If the matrix sizes K M A 2,0 A 2,1 A K N B 0,1 B 1,1 B × N M R 2,1 Application (e.g. transform decomposition) Tier 1 Top-level sGEMM, possibly parallelized Tier 1.5 Companding, Rounding and Packing R → Throughput precision adaptation omitted for brevity of description. application requirements are not multiples of , trivial size modifications are required for the cleanup code at the borders [5], which are Tier 2 Subblock code (e.g. Intel or AMD highly-optimized code) Platform (multicore or manycore processor) (a) (b) Figure 1. (a) Illustration of outer and inner-kernel processing of GEMM in BLAS; (b) positioning of the proposed approach within the execution environment of signal processing tasks based on optimized linear algebra libraries. 3. PROPOSED APPROACH Our proposal is adjusting the quantization of the inputs according to their numerical range. As such, for each inner-kernel + 7,8 we need to calculate the maximum and minimum values within each subblock -7,. and 1 3 /.,8 [Figure 1(a), 0 : ; < ], and store them for the companding stage. These calculations are performed during the data reordering stage and thus do not require additional data accesses. Since the remainder of this section is focusing on subblock-level operations, for notational simplicity, we remove indices from subblocks - 7,. and /.,8 and, despite the block-major format reordering, we retain the 2D indexing in the equations. A. Scalar Quantization via Companding and Rounding We perform uniform companding and rounding within each subblock - and /, assuming input ranges Smin - , max - T and Smin / , max / T. For any element "@,A , @,A of -, /, 0 : U, V < , we have: "K@,A WX- "@,A Y, Z@,A WX/ @,A Y . (3) Hence, "K@,A are integers within FX- min - H, … , FX- max - H , with X- the companding coefficient (X- [ 0) that is designed according to precision requirements for the final result (equivalently for Z@,A ). These values are then used in the core of the calculation, which, for each output element, is a vector inner product with accumulate (MAC) operations: \̃@,A multiply- ∑34# K @,. Z.,A . .56 " (4) X- X/ !4# \̃@,A . (5) The final result is recovered after reverse companding: \̂@,A 5 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 The selection of X- and X/ , as well as the control of the overall process, is discussed in Section 5. f g +e due to quantization, using (4) for the actual computation of \̃@,A would not Despite the distortion 3d e+ # E lead to any acceleration in a programmable processor; however, once the inputs have been companded and rounded, we can create reduced-size input blocks by packing multiple inputs together via two different methods. Both methods aim for accelerated processing. B. Symmetric Packing h and / h with In the first method, the packing process creates two blocks (respectively) given by (kU, V: 0 : U, V < , U h "p@,Ap p@ h ,A @ mno , Vp A mno): i j and i j 7 ∑n4# K @,nApr7 , 756 q " coefficients (6) 47 Z ∑n4# h r7,A , n@ 756 q (7) where q, 0 < q < 1, is the utilized packing coefficient that controls the allocated space for each packed input within the floating point representation (details on the setting of q will be given in Section 4) and the number of packings performed. Notice that, unlike previous work on block-based packed processing [13][14][20], the s and / s are packed along input rows and columns (respectively). Due to the block major-format elements of both - reordering, (6) and (7) perform MAC operations in sequential memory elements, thereby allowing the use of SIMD instructions for accelerated processing. h Processing occurs using the packed data, i.e. + kU, V: \L@,A \L@,A ⁄n4# ∑3856 "p@,8 p8,A , h/ h: - ⁄n4# n4# 74w ∑3856 K @,n8r7 Zn8r7,A v ∑n4# "K@,n8r7 Zn8rw,A y ., u∑n4# 756 " 756 ∑w56 q wx7 The packed result of (8) contains the required output as well as z7,w q 74w "K@,n8r7 Zn8rw,A , k=, {: 0 : =, { < representation. As such, any high-performance , g (8) ! “side” outputs: & = } {. Notice that (8) is performed in the function’s native i j by ji subblock code for sGEMM or dGEMM can be used for (8), as indicated in the subblock processing of Figure 1(b). Due to companding and packing, (8) performs times the operations of conventional SIMD-based matrix multiplication; we term this approach as turbo SIMD. Following the completion of the processing, unpacking of the results can be performed by (kU, V!: \̃@,A ~@,A W\L@,A Y , ~@,A g •q 4# Wq~@,A Y€. (9) (10) 6 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 The unpacking process extracts the useful result from the packed output by: (i) the rounding operation to remove the first unneeded set of results, z7,w with = [ {, of (8); (ii) removing the second unneeded set of results, z7,w with = < {, of (8) by (10). Reverse companding can be applied to each \̃@,A via (5). C. Asymmetric Packing s or / s can be packed – this selection does not affect In the second method, only one input block is packed; either the performance in the case of GEMM as both blocks have been reordered in block major format. This is similar s is chosen, once the inputs have been companded to the packing proposed in previous work [14][20]. Assuming h with i and rounded by (3), the packing process creates block j U h @ mno!: "p@ h ,A coefficients given by (kU, V: 0 : U, V < , 7 ∑n4# K n@ h r7,A , 756 q " (11) where q, 0 < q < 1, is the utilized packing coefficient. Notice that, unlike (6), the packing of (11) operates along s in order to pack the columns of - rows together. This means that, in order to use SIMD instructions for accelerated computation of (11), we can group consecutive elements of each row and apply each MAC operation h of (11) to them with one SIMD instruction. Once (11) is completed, processing occurs via + U, V < , U h @ mno!: \L@ h ,A \L@,A Z ∑34# p@ h ,8 8,A , 856 " n4# 7 Z ∑34# K n@ h r7,8 8,A ., 856 ∑756 q " The packed result of (12) contains the output of groups of h/ s (kU, V: 0 : - (12) rows packed together. Since the processing is performed in the function’s native representation, any high-performance i j by subblock code for sGEMM or dGEMM can be used for (12). Following the completion of the processing, unpacking of the results can be performed by the following iterative process [14] (kU, V: 0 : U, V < , U h k= ( 1, … , \̃@ h ,A g 1 : • \L@ h r7,A W\L@ h ,A Y, q 4# •\L@ h r74#,A g \̃@ h r74#,A €, \̃@ h r7,A Reverse companding can be applied to each \̃@,A via (5). @ mno!: W\L@ h r7,A Y‚. (13) (14) D. Discussion Remark 1 (Integer Processing and the Concept of Packed Processing): Following the companding stage, matrix multiplication could be constructed using 16-bit integer representations (16-bit integer SIMD instructions exist for all mainstream processors). However, integer conversion to and from floating point leads to significant overhead since it cannot be performed with SIMD instructions. Furthermore, unlike floating point representations 7 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 where the maximum packed value can be flexible with graceful degradation in the results, a strict limit is set on the quantized values in integers in order to avoid overflow. A conceptual illustration of the packed representation of (8) and (12) and how the floating-point representation noise affects the packed results is given in Figure 2. Symmetric packing is better protected from the numerical representation noise, because the “lower” side result (multiplied by q 0.0001) is not used; this is despite the fact that noise is amplified in this representation as the “higher” side result (multiplied by q 4# 10000) takes the number further away from the high-precision region around zero [21]. This representation noise creates the notion of computational capacity in our approach: for given quantization distortion, there is a limit on the throughput increase achieved via increased packing (i.e. increased values for , surpassing 2 shown in Figure 2), beyond which the distortion stemming from the floating point computation surpasses the quantization distortion3. The interdependency between throughput and distortion and the notion of computational capacity make our approach a computation channel for generic matrix multiplication. integer part symmetric packing 10000 1 1 asymmetric packing Figure 2. Conceptual example of 2 packings with q □ decimal part 0.0001 numerical representation noise 0.0001 0.0001. Top: result of (8); bottom: result of (12). Shaded blocks contain side results that are produced during the packed processing but not used in GEMM. Remark 2 (Packing Tradeoff): The symmetric packing approach of Subsection 3.B produces each requiring ⁄ MAC operations. It requires 2 , 4# outputs, bytes for storage of the packed input data, with defined as for (1). On the other hand, the asymmetric packing of Subsection 3.C produces i j outputs 3 Or, equivalently: decreasing the quantization distortion with the proposed packing (by increasing the companders) leads to increased noise stemming from the floating-point computations, as more space is needed to pack the quantized inputs and results (i.e. q in Figure 2 becomes smaller); thus, for each packing (i.e. acceleration) , there is a limit on the quantization accuracy, beyond which the distortion stemming from floating-point computation surpasses the quantization distortion. 8 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 (that are then unpacked to the final 4# ! outputs), each requiring Sept. 7, 2011 MAC operations. It requires , 1v bytes for storage of the input data. Evidently, both approaches have the same complexity in terms of MAC operations. They are both memory efficient in comparison to the conventional approach that requires 2 , bytes of memory for the input data. Between them, the symmetric packing requires the least amount of memory for the computation and, when the numerical representation noise is taken under consideration, it leads to better precision in comparison to symmetric packing as indicated previously. □ 4. GEMM AS A COMPUTATION CHANNEL – NUMERICAL REPRESENTATION NOISE, QUANTIZATION NOISE, AND COMBINED NOISE MODEL A. Summary of Known Results on Operational Packing The accuracy of the numerical representation sets limits on error-free packed processing of integers, which have been established within the tight packing theory [14][20]. Proposition 1 (Error-free Packed Processing [14]): Error-free unpacking of ‘ signed integers by (9) and (10), or (13) and (14), after performing (8) or (12), respectively, requires: 1 q: 2’“”• v ~ ”‘ ‚ v 1˜, ‘ : –log — • 2’“”• v 1!~ with: ~ (15) the relative precision of the computer hardware used for implementation [14], ~ to avoid erroneous unpacking under marginal conditions [14] (in practice one can set ~ (16) ”‘ ”‘ a positive integer 50 to cover all possible scenarios with no practical loss in the packing capability) and, for the proposed companding process of h , ’“”• , given by: (3), the maximum amplitude of the elements of the packed matrix + ’“”• FX- X/ max |min - |, max - Proof: See [14]. A simple algorithm to calculate q and max |min / |, max / ‘ H. (17) for any processor is provided in [14][20]. The question we pose here is: Can we go beyond the limits of error-free packed processing of Proposition 1 under the proposed throughput/distortion framework? If this would be possible, we could approach the computational capacity of a given system under a specified distortion constraint. Exceeding the packing limitations was speculated by previous work [20], but it has never been investigated systematically until now. There are two ways this may be possible. Firstly, one can attempt to increase q beyond the limit of (15) in order to “squeeze in” more data in the floating-point representation. In such a case, the output results from the quantized processing of (8) or (12) may “invade” each other (i.e. the blocks of Figure 2 start to overlap) causing catastrophic error during unpacking [14][20]. Because of the severity of the errors caused, this is clearly an 9 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 ‘ undesired option. As an alternative, one can attempt to utilize values for packing beyond that is the limit set by (16). If one would apply such increased packing, distortion will gradually be introduced in the unpacked results of (10) and (13), (14). This may be acceptable since quantization already introduces approximation. To this end, by modifying ’“”• for every [ 1, one can systematically investigate the tradeoff between , quantization-induced error and representation-induced error in order to approach the system’s computational capacity: high values for ’“”• reduce the quantization error [since X- and X/ can be increased in (17)] but may [ lead to significant representation-induced error if the bound of (16) is violated (i.e. if we use ‘ for the selected ’“”• value); low values for ’“”• cause the reverse effect. Thus, via the use of companding and packing, we must identify the value of ’“”• for each packing B. leading to optimal throughput/distortion performance. Noise of Packed Matrix Multiplication in Floating-point Representations In order to collect statistics from the representation-induced error under packed processing, we use integer samples for - and / with 288 and we set X- X/ 1 in all these experiments, i.e. no loss is caused from companding and rounding. The experiments are performed with max values4. 22 and max / ( gmax / using five random instantiations for - and / for each combination of maximum 1,2, … ,63 , min / input gmin - Using (17), these ranges and subblock 6336, 12672, … ,399168 , which encompasses the range where size ‘ lead to output range ’“”• ( ( 2,3,4 is obtained in single or double- precision floating point representations. For each instantiation of each combination of ’“”• and , we measure the mean error and the root mean squared error (RMSE) of each packed matrix multiplication after unpacking by: kmax / , max - , respectively, with: : U•’“”• , € • id 34# ∑34# @56 ∑A56 \̂@,A g \@,A ! , ( 2,3,4 packings, q set for each ž•’“”• , € • id f g +e e+ E according to (15) and + computed with (18) 1 (conventional computation) under the same data type (single or double-precision floating point representation). When U•’“”• , € Ÿ 0 (near-zero bias), ž•’“”• , € approaches the sample standard deviation of the error. Furthermore, given that there is no quantization noise in this experiment, any mismatch in the results stems solely from the imprecision caused by the numerical representation. Specifically, depending on the value of and the ‘ of (16) for input dynamic range, packed processing may not induce any error [14][20]. However, once the setting of ’“”• of a particular measurement, the output will contain numerical errors. [ The ranges for - and / were chosen so as to produce ’“”• values within the range required to cover the numerical representation limits for each number of packings . 4 10 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 Figure 3(a) shows the relationship of RMSE with ’“”• for single and double-precision floating-point representations in an Intel Core 2 Duo P8800 processor (with 2 and 4, respectively). Figure 3(b) 4 are not displayed beyond presents the average error for each case. The results of double precision with ’“”• [ 120000 as they exceed acceptable limits: despite the increased accuracy of double-precision, four packings occupy significantly more space in the numerical representation; this makes the packed results of this case significantly more prone to numerical representation noise than the ones with two packings in single precision (see also Remark 1). This experiment indicates that, depending on the numerical representation (single or double-precision) and U•’“”• , , one can select a range of ’“”• values and safely assume near-zero average error €, i.e. no systematic error. In such a case, the sample standard deviation of the representation-induced error is monotonically increasing with ’“”• as shown in Figure 3(a). (a) (b) Figure 3. Error measurements for matrix multiplication of integer inputs (X- X/ and double-precision representation: (a) root mean squared error; (b) average error. 1) within single-precision 11 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Since each value of U•’“”• , € and ž•’“”• , Sept. 7, 2011 € reported in Figure 3 corresponds to hundreds of thousands of independent inner-product calculations [via (8) or (12)], the results of Figure 3 are a good approximation of the ensemble statistics. Thus, they are independent of the actual data being used for the matrix multiplication and stem solely from the numerical representation limitations and the utilized packing. Interestingly, for symmetric packing in single-precision floating point representation with up to ’“”• 320000 and obtain: @ ¡¢£ ,,! ¡¢£ < 0.0001% and ¥ ¡¢£ ,,! ¡¢£ 2, we can use < 0.04%. This indicates that one can utilize ’“”• values that are up to an order of magnitude higher than the maximum range of 16-bit signed integer representations (where ’“”• < 32768 is imposed in order to avoid overflow) with very small relative error induced by the representation. Thus, the proposed packed processing in floating-point representations allows for significantly increased quantization range at the cost of gradually increased representation-induced noise [i.e. increased noise standard deviation ž•’“”• , € for increased ’“”•]. This noise is significantly smaller for the case of symmetric packing, as shown by the comparison between the two graphs of Figure 3(a). This occurs because, as mentioned in Remark 1, this packing does not use outputs z7,w of (8) with = [ {, which are the outputs affected the most by the representation-induced noise. This part is indeed used in the asymmetric packing that actually extracts all outputs of (12) via the iterative unpacking of (13) and (14). C. Quantization Noise Model We now present a statistical model of the quantization noise introduced via companding. Inputs "@,A and @,A are modeled as zero-mean independent, identically distributed (iid), random variables (RVs) N~PQ RQ !, ¦~P§ R§ !, respectively. Quantization noise in "K@,A , Z@,A is modeled as additive, zero-mean, iid white, RVs ¨Q ~P©ª R©ª !, # , ¬- √#, ¨§ ~P©« R©« ! with R©ª # , ¬/ √#, R©« i.e. the standard deviation of the noise per matrix is scaled according to the companding applied. Finally, the output results "M@,A are modeled by zero-mean iid RVs ®M~P°̄ R°̄ !. Proposition 2 (Quantization Noise Power): Under iid inputs modeled by N~PQ RQ !, ¦~P§ R§ ! and iid quantization noise modeled by ¨Q ~P©ª R©ª !, ¨§ ~P©« R©« !, the expected noise power of the output results of the matrix multiplication under error-free unpacking is (0 : U, V < ): ±² ®@,A g ®M@,A !, ³ ´ RQ R©« !, v R§ R©ª !, v R©ª R©« !, µ. Proof: See Appendix. The expected power of the (error-free) output + is f versus + is: of + ± ¶ · ¸¹º» 10log#6 (19) RQ R§ !,. Hence, the expected signal to noise ratio (SNR) , •RQ R§ € ±² ®@,A g ®M@,A !, ³ (20) 12 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 Notice that, if the statistics of the input matrices are known (i.e. assuming known or estimated PQ and P§ ), (19) and (20) are parameterized solely by X- and X/ . D. Combined Noise Model Since the quantization noise of Proposition 2 and the representation-induced noise of Subsection 4.B stem from physically independent processes, we can assume they are statistically independent. The expected noise power of the output results is then: ¼n ’“”• , X- , X/ ! where ž ’“”• , 1 ž ’“”• , ´ RQ R©« ! v R§ R©ª ! v R©ª R©« ! µ v ½ X- X/ , , !¾ , (21) ! is the experimentally-measured RMSE of the representation-induced noise for values of ’“”• that correspond to U ’“”• , and , ! Ÿ 0 [examples for 2 and 4 are given in Figure 3(a)], and factor X- X/!4, maps the representation-induced noise from the quantization index domain to the output value domain [via the reverse companding of (5)]. For a given choice of packing , [ 1, we can express the intuitive trade-off between quantization and representation-induced noise by combining (21) and (17): increasing ’“”• leads to increased values for X- and X/ and therefore reduced quantization noise variances R©ª and R©« and reduced quantization noise power from Proposition 2; however, as shown in Figure 3(a), the representation-induced noise ž ’“”• , ! increases monotonically with ’“”• . Hence, ¼n , as expressed by (21), becomes the mechanism for adjusting the desired throughput and distortion of GEMM according to user-specified constraints for: (i) percentile throughput increase against the conventional (full precision) computation + f versus +. -/ and (ii) the SNR (distortion) of + 5. DISTORTION-CONTROLLED THROUGHPUT SCALING OF SUBBLOCK MULTIPLICATION When attempting to accelerate GEMM with the proposed approach, it is imperative to minimize ¼n for each subblock multiplication of each inner-kernel calculation of the by matrix multiplication [e.g. k;: - ,,. /.,# of + ,,# of Figure 1 and (2)] via the optimal use of companding and packing. Once the optimal configuration and minimum distortion is established for each packing of each subblock, the configuration for companding and packing can be decided for the overall matrix multiplication. A. Theoretical Calculation of Optimal Companders and Experimental Validation We provide the general form of admissible companders for each subblock under iid inputs. s Proposition 3 (General Form of Companders): For quantized packed subblock multiplication + s/ s of zero- mean iid inputs within Smin - , max - T and Smin / , max / T modeled by N~PQ RQ !, ¦~P§ R§ !, 13 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 respectively, and quantization noise modeled by ¨Q ~P©ª R©ª !, ¨§ ~P©« R©« !, the companders achieving expected SNR of ± ¶ X- · ¸¹º» 1 dB against + √2RQ X ¹ -/ calculated with floating-point precision are: , ¿¼ÀÁ à ļÀÁ g 4RQ, R§, X ,¹ , X/ √2RQ (22) , ¿¼ÀÁ à ļÀÁ g 4RQ, R§, X ,¹ with ¼ÀÁ expressing the quantization-versus-representation induced distortion, given by: X¹ ¼ÀÁ 12RQ, R§, 106.#Å ÆÇÈÉÉÊËÌÍ , •12ž•’“”• , €‚ v 1 g 12X ,¹ (23) max |min - |, max max |min / |, max / ’“”• (24) ¼ÀÁ Π2RQ R§ X ¹ . and (25) Proof: See Appendix. Given the input statistics, Proposition 3 demonstrates that various pairs of companders provide for ± ¶ · ¸¹º» dB as long as they lead to ’“”• [via (17)] that satisfies (25). This complicates the selection process for the operational parameters since, per subblock of the matrix multiplication, one must select: (i) the number of packings used ( ), (ii) the desired value of ’“”• in order to find ž ’“”• , (iii) the desired value for ± ¶ · ¸¹º» ! for this choice of packed processing via Figure 4(a), for the particular subblock [leading to ¼ÀÁ that satisfies (25)], and (iv) the specific set of companders from the permissible options of (22). Fortunately, in the following we show that, for each subblock and each choice of packing, ( 2,3,4 , there exists a unique value for each of: ’“”• , X- , and X/ , which maximizes the expected SNR ± ¶ expression for the obtained (maximum) value of ± ¶ · ¸¹º» for each · ¸¹º» . An is also provided. This facilitates the parameter selection to a great extent as there is a unique (optimal) parameter configuration for each packing of each subblock. Proposition 4 (Minimum-error Companders): Under the settings of Proposition 3 for subblock multiplication, for each packing [ 1, the companders providing the maximum expected SNR of ± ¶ Ï· X-Ï with Ï ’“”• ,± ¶ Ï· ¸¹º» n ¿ R§ , RQ X ¹ arg max Ò± ¶ k ¡¢£ · ¸¹º» X/Ï ¿ RQ R§ X ¹ ¸¹º» dB are: (26) , •12ž•’“”• , €‚ v 1 X¹ g10log#6 Ó v ÔÕ , , , 6RQ R§ 144RQ R§ X ¹ (27) 14 Anastasia and Andreopoulos, for every IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 [ 1 and X ¹ given by (24). Proof: See Appendix. We demonstrate indicative experimental versus theoretical (model) curves of ± ¶ ’“”• value, the experimental curves are produced by measuring the average SNR, ¶ · · ¸¹º» ¸¹º», in Figure 4. Per numerically from the output of multiple runs under the experimental settings of Subsection 4.B but this time using floating-point inputs instead of integers, and companders set via (26). For the theoretical calculation for each ’“”• value, we use the expression of (27) for ± ¶ · ¸¹º» with ž ’“”• , ! taken from the results of Figure 3(a). The very good agreement between the theoretical and experimental results demonstrates the accuracy of the proposed SNR estimation model of (27). The unique maximum SNR observed in the results of Figure 4 shows that, under the conditions of Proposition 3, there is indeed a unique solution for companders per subblock (and per minimizes the produced error, which is given by 27! of Proposition 4. ) that Figure 4. Indicative experiments for experimentally-obtained output SNR versus the expected SNR by Proposition 4 under the use of the optimal companders per ’“”• value. Finally, the independence assumption between quantization-induced and representation-induced error was further validated by calculating the Pearson correlation coefficient, ŲÖ×È¢ØÙ ÖÚÛÜÚ ³ d d ÄÅÝÖ×È¢ØÙ ÞÄŲÖÚÛÜÚ ³ with ßà·”á and ß the RVs of the error under solely quantization-induced and solely representation-induced noise (respectively5), from the ensemble of the experiments reported in Figure 4 and the corresponding experiments for double-precision representation. In both cases, the correlation coefficient was found to be smaller than 104, . This fact, along with 5 , Thus, ±²ßà·”á ³ is given by (19) and ı²ß , ³ ž•’“”• , €, which is given by (18). 15 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 the fact that the quantization-induced and representation-induced noise terms stem from physically-separated independent processes and that the model of (27) agrees very well with the experimental results, is a strong indication that the two error terms are indeed uncorrelated and that the distortion expressed in (21) is accurate. B. Practical GEMM Configuration for Optimized Throughput/Distortion Processing Proposition 4 simplifies the optimum selection of operational settings for the overall matrix multiplication under throughput or distortion constraints. This is achieved by first computing min - , max - , min / , max / , RQ , R§ during the subblock data accesses for reordering to block-major format at runtime. Subsequently, for every subblock multiplication of every Ï , ± ¶ Ï· multiplication, X-Ï , X/Ï , ’“”• runtime. For each ¸¹º» ! inner-kernel of the overall are computed via Proposition 4 for every packing , , the expected percentile throughput scaling, ân , versus the plain processing ( ! matrix ( 2,3,4 , at 1) can be calculated by off-line experiments on the target platform (e.g. during the package compilation [5]), since it depends only on the subblock size and the implementation of the inner-kernel processing. These optimal of each subblock, along with ân , are kept in a data structure in parameters for each packing configuration order to prune out the best possible combination of subblock multiplication options (at runtime) according to distortion or throughput constraints, as discussed in the next section. The only complex part of this process is obtaining the numerical maximum of (27) per subblock. However, Figure 4 shows that obtaining the exact Ï is not of critical importance, since there is a wide range of ’“”• values attaining near solution for ’“”• maximum SNR per subblock. Hence, we pre-compute (offline) an approximation for all possible solutions of (27) once, by using a representative set of input block standard deviations, ²RQ , R§ ³ ¹‘ã¸äá , expected to occur at runtime. We keep the corresponding solutions in a data structure and, during the GEMM runtime operation, for 1 each pair of subblocks - 7,. and /.,8 (0 : ; < 3 ), we select the solution with standard deviations RQ , R§ closest to the obtained ones (in the MSE sense), which requires minimal effort. 6. THROUGHPUT/DISTORTION OPTIMIZATION OF INNER-KERNEL MULTIPLICATION We can now perform throughput/distortion optimization that is controlled at the inner-kernel level of the overall matrix multiplication. Consider the example of the inner-kernel result + ,,# shown in Figure 1(a) and computed by (2). As elaborated in the previous section, for each individual subblock multiplication of (2), i.e. -,,. /.,# with Ï 0 : ; < 3 , we have precomputed parameters: k , ;: å ’“”• , ± ¶ Ï· 1 ¸¹º» |¹‘ã¸äá and ân , and for each packing we can compute X-Ï , X/Ï by (26) at runtime [and from that we can readjust ± ¶ Ï· ¸¹º» via the expression of (27) for 16 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T T-SP-11989_R1, to appear in 2012 2 Sept. 7, 2011 additional accuracy]. The aim is to select (per subblock) the highest possible packing, , and companders such that the inner-kernel, + ,,# , is derived close to the computational capacity of the system, i.e. with: (i) the highest percentile acceleration possible under an a SNR constraint, or (ii) the highest SNR possible under a percentile acceleration constraint. Controlling the throughput/distortion distortion optimization process at the inner-kernel level allows for flexibility within practical applications. For example, if matrix multiplication ultiplication is used for transform decomposition, some innerkernels of the resulting matrix corresponding to transform coefficients (e.g. frequency components) that are 1,, i.e. with nat native floating point accuracy required at the smallest possible distortion can be computed with 2,3,4 4 and produce approximate of sGEMM or dGEMM,, while others can be accelerated via the use of results. The application must only specify the required (minimum) SNR ¶» (0 : = < > ,0 3 $ 3 =, ?!! per á ¸ inner-kernel + 7,8 : ? < ) against the result at the native precision of GEMM, or the required percentile acceleration, â» á ¸ =, ?!, in comparison to computing with 1 and the pruning process described in the following will derive the appropriate settings per subblock lock multiplication in order to meet this specification. For each inner kernel + 7,8 , ¶» á ¸ =, ?! is converted to MSE by ¼» á ¸ =, ?! with RQ,7,. and R§,.,8 the standard deviation of - 7,. and /.,8 , respectively. 1046.#ÆÍÛÚØÛÊ Figure 5. Example distortion (MSE) for each of the subblocks of (2) with until ¼» á ¸ 1 3 7,8! 1 ⁄34# ∑.56 RQ,7,. R§,.,8 !,, 4 and pruning steps enumerated 2,1! : 11.0 is achieved. achieved The dashed rectangles indicate the final selection for each subblock. The utilized pruning is a top-down down approach where, starting from the maximum acceleration, the selection is pruned by removing the outcome with the highest distortion, until the distortion constraint, ¼» percentile throughput acceleration constraint, â» á ¸ á ¸ =, ?!, or the =, ?!, is met. This is illustrated for distortion distortion-constrained processing of inner-kernel + ,,# in the example exam of Figure 5, where we assume 64dB, which corresponded to ¼» á ¸ 1 3 4 and we set ¶» á ¸ 2,1! Î 2,1! : 11.0 under the utilized settings. For every calculation - ,,. /.,# , 17 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 0 : ; < 4, the algorithm starts from Sept. 7, 2011 4 and successively removes the subblock result with the highest distortion (the removal steps are enumerated), until the distortion constraint is met. Thus, the resulting settings utilize the maximum packing possible (i.e. offer the maximum acceleration) under a distortion constraint. 7. EXPERIMENTAL RESULTS We implemented the proposed framework in its entirety using streaming SIMD extensions (SSE3) in an Intel Core 2 Duo P8800 processor operating at X‘ gcc4.4.1 -O3 -march=native à 2.66GHz (Ubuntu Linux, single-threaded execution, -fomit-frame-pointer, CPU throttling disabled to ensure maximum performance). In our experiments we selected: 1,2,3,4 for double precision; and ( 1,2 for single precision floating point; ( 288 as a representative inner-kernel size. For the generic experiments of this section, we set input matrices - and / to contain uniformly distributed floating-point inputs selected from Sgmax , max T within subblocks of 288 288, with max selected randomly for each subblock from the set 4.0,5.0,6.0, … ,2048.0 . By disabling the processor throttling and running the proposed approach in maximum priority, we set various SNR requirements k=, ?: ¶» processing and obtained the results for á ¸ =, ?! for each inner-kernel shown in Figure 6. As an external comparison, we provide the performance of GEMM without the proposed approach (“sGEMM plain”, “dGEMM plain”) as well as the performance of the state-of-the-art ATLAS [5] and GOTO packages [22]. With the selected input dimensions, all packages avoid “cleanup” code for the borders of the matrix multiplication. The full source code of our proposal is available online for inspection and testing [17]. The results reported in Figure 6 show that the proposed approach provides for processing throughput that changes according to the required SNR value and it can in fact exceed 130% and 175% of the peak performance for single-precision and double-precision representation, respectively. Although this is theoretically possible due to the utilized companding and packing, the results of Figure 6 show that exceeding 100% of peak performance is indeed possible in practice. Notice that the companders for each inner kernel are found at runtime and the performance reported in Figure 6 includes the entire process and the control framework described in Sections 5 and 6. Finally, we validated that, even when the SNR setting leads to 1 for all inner-kernel processing, no loss in performance is observed against the conventional “sGEMM plain” and “dGEMM plain” approaches. Beyond distortion-controlled execution, we present an example of throughput-controlled acceleration in Figure 7 for the case of sGEMM, where matrix multiplication of size ( 1,2 . The 11 experimental points reported in the figure were obtained for 4032 by increasing the percentage of accelerated inner-kernel blocks 18 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 in steps of 10%: the (leftmost) maximum-SNR point (infinity – out of the graph’s range) corresponds to â» á ¸ lowest-SNR point (27.8dB for symmetric packing and 23.9dB for asymmetric packing) corresponds to â» á ¸ 0% of inner-kernel blocks accelerated (i.e. 1 for all – conventional computation), while the (rightmost) 100% of inner-kernel blocks accelerated (i.e. 2 for all). GOTO’s throughput was 19.7GFLOPS while ATLAS achieved 18.0GFLOPS for this example. Evidently, the symmetric packing provides for lower distortion along the operational points. This agrees with the error measurements of Figure 3 for symmetric and asymmetric packing and it occurs for the reason explained in Remark 1 and quantified in Section 4.B. Asymmetric Packing, Single-precision Symmetric Packing, Single-precision 135 135 125 proposed: sGEMM plain proposed: SNR ≥= 30dB proposed: SNR ≥= 24dB 45% GOTO ATLAS 115 105 80% 95 85 19% 10% 75 Peak Performance (%) Peak Performance (%) 125 proposed: sGEMM plain proposed: SNR=30dB ≥ proposed: SNR=24dB ≥ GOTO ATLAS 115 105 83% 95 85 19% 10% 75 65 65 55 55 0 288 576 0 864 1152 1440 1728 2016 2304 2592 2880 3168 3456 3744 4032 288 576 864 1152 1440 1728 2016 2304 2592 2880 3168 3456 3744 4032 M=N=K M=N=K proposed: dGEMM plain proposed: SNR=70dB ≥ proposed: SNR=40dB 205 ≥ proposed: SNR=25dB ≥ 195 proposed: SNR=19dB ≥ 185 GOTO 175 ATLAS Symmetric Packing, Double-precision 165 155 145 135 74% 125 154% 115 105 95 85 Peak Performance (%) proposed: dGEMM plain proposed: SNR=70dB ≥ proposed: 205 SNR=40dB ≥ proposed: SNR=25dB ≥ 195 proposed: SNR=19dB ≥ 185 Goto 175 ATLAS Peak Performance (%) 47% Asymmetric Packing, Double-precision 165 155 145 92% 135 125 180% 115 105 95 85 34% 75 46% 65 34% 75 46% 65 55 55 0 288 576 864 1152 1440 1728 2016 2304 2592 2880 3168 3456 3744 4032 0 288 576 864 1152 1440 1728 2016 2304 2592 2880 3168 3456 3744 4032 M=N=K M=N=K Figure 6. Percentage of peak performance of sGEMM and dGEMM (higher is better) under different SNR settings k=, ?: ¶» á ¸ =, ?! for the inner kernel processing; 100% of peak performance [22] corresponds to 8 21.28GFLOPS (Giga floating-point operations per second) for sGEMM and 4 X‘ à X‘ à 10.64GFLOPS for dGEMM. Overall, due to the highly-optimized nature of GOTO and ATLAS, our “sGEMM plain” subblock code for matrix multiplication (i.e. the conventional full-precision matrix multiplication core implemented for the purposes 19 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 of this paper [17]) is 19% less efficient than GOTO and approximately 10% less efficient than ATLAS. In double precision, the equivalent loss in performance is 46% and 34%, respectively. This indicates that there is room for further improvement: if our approach were to be deployed with GOTO’s (or any other) subblock code, landmark performance of beyond 150% of peak performance in single precision and beyond 200% of peak performance in double-precision representation could be achieved under throughput/distortion scaling. The gains in processing throughput can be exchanged for fault detection and correction functionalities under error-generating operating systems or processors [12][18][19]. Alternatively, one can reduce the operating processor frequency (and operating voltage – via dynamic voltage scaling) and still obtain comparable performance to using “sGEMM plain” (or “dGEMM plain”) at a higher processor frequency, albeit at higher distortion. This approach effectively translates the throughput/distortion scaling into power/distortion. 43 Throughput-controlled Execution 41 39 Symmetric Packing Asymmetric Packing SNR (dB) 37 35 33 31 29 27 25 23 15000 17000 19000 21000 23000 25000 27000 Throughput (GFLOPS) Figure 7. SNR vs. throughput in Giga floating-point operations per second for sGEMM under throughput control. 8. APPLICATIONS The proposed approach can bring important benefits to high-performance signal processing systems when the precision of computation is not of critical importance (error-tolerant systems) or when the input data is intrinsically noisy. A conceptual application of disturbance cancellation under estimation uncertainty and powerdistortion scalability with the proposed approach was already demonstrated in our recent work [16]. Here, we present two other applications of the proposed framework. A. Accelerated Processing in State-of-the-art Face Recognition State-of-the-art techniques for robust image recognition systems derive feature matrices and use 2D decomposition schemes via matrix multiplication in order to match features between a new image and an existing 20 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 database of images (e.g. for automatic identification of human faces [1]). Large-scale deployments of such systems run in high-performance workstations or in cloud computing infrastructures, such as Amazon’s EC2. In such deployments, it is not uncommon to expect that thousands of training and recognition tasks should be computed with the highest-possible throughout/precision capability of each server in order to maximize the servers’ or cloud utilization. Using the proposed approach, one can accelerate the real-time training and matching process. Specifically, the accelerated GEMM can be used for the image covariance matrix calculation and for the input image projection to the feature matrix [1]. In the following, we provide details of such a deployment for the prominent 2D PCA system of [1] under different SNR values for GEMM. The algorithm consists of three stages: training, feature extraction and classification. The training stage uses a number of training input images and first calculates the image covariance scatter matrix from ë input images, -8 , by: ìí zero-mean ÇÛÙ ∑í85# -8 -8î. Based on this input training set, it then calculates the projection matrix comprising a series of projection axes (eigenvectors), ï Såð# |å… |ðñ T, with ð7 , 1 : = : ò the orthonormal eigenvectors of ìí corresponding to its ò largest eigenvalues [1]. Each training-set image is mapped to ï via: ó ,8 -8 ï. For the feature extraction stage, each new input image /7 (test image) is mapped to ï via: ó ,7 /7 ï. Finally, the classification stage determines for each test image /7 the test-set image ? Ï with the smallest distance in their projections: ?/Ï ô arg mink8 eó ,7 gó ,8 eE . The complexity of 2D PCA is predominantly in the matrix multiplications required for the construction of ìí and the mapping during the feature extraction, i.e. ó ,7 , as the eigenvalue decomposition required for the creation of ï is only performed once every ë images and very fast algorithms exist for the quick estimation of ?/Ï ô (e.g. matching error measures [23]). training To examine the effects of throughput/distortion within this application, we utilize the proposed single- precision GEMM design for the matrix multiplication operations of 2D PCA. The Yale database of images (http://www.face-rec.org/databases/) was used for our experiments and, following prior work [1], each image was cropped to 288 288 pixels (that includes the face portion) and the mean value was subtracted prior to processing. Results from performing all matrix multiplication operations with reduced SNR, ¶» á ¸ 0,0!, are presented in Table 1. Following [1], the first 5 images of each of the 15 persons in the database were used for the training set and the remaining 6 images per person were used as test images and we set ò demonstrates that decreasing ¶» á ¸ 10. The table (for all GEMM subblocks) leads to increased processing throughput with the recognition accuracy remaining equal to the one obtained with the full-precision computation. In fact, for ¶» á ¸ 20dB, we observed a slight increase in the recognition accuracy due to the quantization acting as a 21 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 noise removal mechanism. We do not present results with values below ¶» á ¸ Sept. 7, 2011 20dB, as 20dB allowed for 2 packings in all GEMM computations, which is the maximum acceleration possible under single precision. Importantly, we obtain the results of Table 1 without any application-specific tailoring of the computation; instead, only a simple adjustment of the distortion specification is required and the optimization framework of Section 6 selects the appropriate companding and packing parameters for each GEMM computation at runtime. To demonstrate the importance of throughput/distortion optimization in practice, “Proposed, ad-hoc” in Table 1 shows the results obtained with 2, ’“”• 50000, X- X/ 0.1 (similar results were obtained with other ad-hoc variants); the severe drop in accuracy shows that ad-hoc parameter tuning does not suffice. Method GOTO [22] Proposed: sGEMM plain Proposed: ¶» á ¸ 50dB Proposed: ¶» á ¸ 20dB Proposed, ad-hoc Recognition (%) 78.4 78.4 78.4 78.8 44.0 Throughput (GFLOPS) 18.27 14.85 16.11 25.31 25.31 Table 1. Recognition accuracy versus requested SNR for the matrix operations of 2D PCA and versus the obtained throughput for all matrix multiplication operations (higher throughput is better). B. Accelerated Supervised Training of Multi-layer Perceptron (MLP) based Learning System We examine the benefits of the proposed approach in a large deployment of a multi-layer perceptron-based learning system [3]. MLP-based learning uses the back-propagation algorithm (BPA) to train a neural network to create connections between input features and outputs. BPA is operating in bunch mode [3]: instead of using one training pattern at a time to update the weight matrices, the design uses Võ [ 1 training patterns, which leads to matrix multiplications being used (and comprising the dominant part of the execution). In order to derive test results, we utilized the Million-song dataset from Columbia University, available via the UCI Machine Learning Repository [15]. Our target was to predict the publication year of each song (between 1920-2010) based on the provided set of 90 features per song. MLP-based approaches are appropriate for such problems as there is no clear methodology to connect song features and publication year and the hope is that the learning algorithm will discover such connections automatically. For our experiment, the bunch size was set to Võ 384 and training was repeated in groups of 24576 songs randomly chosen from the training subset of the database. Validation was done on groups of 24576 songs from the validation subset of the database [15]. The only modification performed in the MLP implementation was the replacement of the GEMM implementation with: sGEMM from the GOTO library [22], sGEMM plain, and 22 Anastasia and Andreopoulos, sGEMM with â» á ¸ IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 100% (for all GEMM subblocks, corresponding to using Sept. 7, 2011 2 everywhere); here we investigate throughput-controlled acceleration. All experiments were executed on a high-performance server (2 quad-core Intel Xeon X5460 at 3.16GHz). Table 2 reports summary results, showing that sGEMM with â» á ¸ 100% packings (and companders selected via Proposition 4 at runtime based on RQ and R§ ) achieves the same recognition accuracy as the conventional (full-precision) approaches. In this case, companding and rounding the inputs corresponds to quantizing to 13-15 bits. While it is well known that the BPA is robust to quantization, the quantization noise can increase the number of epochs required for training, as shown by Table 2. Importantly, sGEMM with â» á ¸ 100% achieves 21% execution time reduction in comparison to sGEMM plain (i.e. approximately 4 days less). Despite this reduction, in this case sGEMM with â» á ¸ 100% does not outperform GOTO due to its highly- optimized software implementation as compared to our own sGEMM plain design. However, a deployment of our approach using GOTO’s subblock code would indeed benefit from the demonstrated execution time speedup. Method Average number of epochs Proposed: sGEMM plain GOTO [22] Proposed: sGEMM â» á ¸ 100% 510240 510240 543460 Average recognition accuracy (correct/total) 14324/24576 (58%) 14324/24576 (58%) 14324/24576 (58%) Total time for GEMM computations (hours) 474.6 376.6 375.5 Table 2. Summary results of MLP algorithm. Smaller time values are better. 9. CONCLUSION We propose an operational approach that scales the throughput of generic matrix multiplication according to the tolerated distortion in the result, expressed as the expected error power instead of the usual worst-case tuning. This can be used in large-scale matrix-based digital signal processing problems that require rapid responses and have certain tolerance to error, or when handling inherently noisy input data. The processor effectively becomes a computation channel controlled in software. Our first results demonstrate that over 170% of the peak performance of a processor can be achieved under stochastic distortion control. For applications that can tolerate imprecision in their computation, this already makes our proposal 45%~180% more efficient than the current state of the art (Figure 6). Further work could investigate the throughput potential of different packing techniques as well as the possibility of incorporating fault detection and correction in the derived computations. APPENDIX - PROOFS Proof of Proposition 2: From (4) and under iid input statistics, the resulting output random variable ®M@,A is: (28) ∑34# ®M@,A M@,. ¦ö.,A .56 N 23 Anastasia and Andreopoulos, where, kU, ;, V: ÷Q°ø,ù ®M@,A IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 ÷§fù,ú 0, RQ°ø,ù 34# ∑.56 û÷Q°ø,ù ÷§fù,ú v RQ v R©ª , R§fù,ú Sept. 7, 2011 R§ v R©« . We can express ®M@,A in affine form [24]: ÷Q°ø,ù R§fù,ú ü. v ÷§fù,ú RQ°ø,ù ü3r. v RQ°ø,ù R§fù,ú ü,3r. ý with ü6 , … , üþ34# ~P 1! zero-mean iid RVs with unit standard deviation. Expanding on (29), we have: 6, … , with ®M@,A 34# ~P ∑34# .56 ûRQ R§ . v RQ R©« 3r. v R§ R©ª ,3r. v R©ª R©« 1! zero-mean iid RVs with unit standard deviation. þ3r. ý The equivalent expression for the inner product of a row of - with a column of / is: ∑34# ®@,A .56 RQ R§ . . Hence, the noise is expressed by: ®@,A g®M@,A ∑34# .56 ûRQ R©« 3r. v R§ R©ª ,3r. and the expected noise power, ±² ®@,A g ®M@,A !, ³, is given by (19). v R©ª R©« (29) (30) (31) þ3r. ý (32) ■ Proof of Proposition 3: We express X/ in function of X- from (17). We then link X- with the expected SNR via (21), given that ±² ®@,A g ®M@,A !, ³ RQ R§ !,⁄106.#Å ÆÇÈÉÉÊËÌÍ . Replacing (21) in the last equation and after a few straightforward algebraic manipulations, we reach: RQ, X ,¹ , 12RQ, R§, •12ž•’“”• , €‚ v 1 X- v Ó g Ô X , v R§, 106.#Å ÆÇÈÉÉÊËÌÍ 12X ,¹ with X ¹ defined by (24). Solving (33) for X-, provides: 0 , ¼ÀÁ à ļÀÁ g 4RQ, R§, X ,¹ X-, 2RQ, X ,¹ (33) (34) with ¼ÀÁ representing the quantization-versus-representation noise, defined by (23). From (34), in order for X- to be real, ¼ÀÁ Π2RQ R§ X ¹ and ¼ÀÁ [ 0. This leads to companders defined by (22). ■ Proof of Proposition 4: The term ¼ÀÁ of (23) expresses the quantization versus the representation noise. In particular, when quantization is refined via the use of larger ’“”•, the first term of (23), 12RQ, R§, 1046.#Å ÆÇÈÉÉÊËÌÍ , is monotonically decreasing as ± ¶ · ¸¹º» (obtained SNR) is monotonically increasing. However, the second part of (23) is monotonically increasing for increased ’“”• , since X 4, ¹ is , proportional to ’“”• and ž•’“”• , € is monotonically increasing with ’“”• [something that was also verified experimentally in Figure 3(a)]. Hence, the optimal point is found at the value of ’“”• for which ¼ÀÁ 2RQ R§ X ¹ , i.e. the maximum possible SNR is obtained with companders that remain marginally admissible by (25). This condition leads to the companders shown in (26). Furthermore, under this condition, solving (24) for ± ¶ · ¸¹º» derives the form for ± ¶ · ¸¹º» given in (27). Since this expression depends on ž•’“”• , €, for 24 Anastasia and Andreopoulos, IEEE Trans. on Signal Processing, T-SP-11989_R1, to appear in 2012 Sept. 7, 2011 which no analytic model exists, we can solve this equation numerically to derive the optimal (maximum) value for ± ¶ · ¸¹º» and ’“”• under the input data statistics and the given packing . ■ REFERENCES [1] J. Yang, et al, “Two-dimensional PCA: A new approach to appearance-based face representation and recognition,” IEEE Trans. on Pattern Anal. and Machine Intel., vol. 26, no. 1, pp. 131-137, Jan. 2004. [2] F. Abdelkefi and P. Duhamel, “Impulsive noise cancellation in multicarrier transmission,” IEEE Trans. On Commun., vol. 53, no. 1, pp. 94-106, Jan. 2005. [3] J. Bilmes, K. Asanovic, C.-W. Chin and J. Demmel, “Using PHiPAC to speed error back-propagation learning,” Proc. IEEE Acoust., Speech, and Signal Process., ICASSP, vol. 5, pp. 4153-4156, Apr. 1997. [4] Q. Du and J. E. Fowler, “Hyperspectral image compression using JPEG2000 and principal component analysis,” IEEE Geosc. and Remote Sens. Lett., vol. 4, no. 2, pp. 201-205, Apr. 2007. [5] R. C. Whaley, A. Petitet, and J. Dongarra, “Automatically empirical optimization of software and the ATLAS project,” Parallel Comp., vol. 27, no. 1-2, pp. 3-35, Jan. 2001. [6] J. L. Gustafson and B. S. Greer, “A hardware accelerator for the Intel Math Kernel,” White Paper, ClearSpeed Technology Inc., 2006. [7] T. Yeh et al, “Fool me twice: Exploring and exploiting error tolerance in physics-based animation,” ACM Trans. on Computer Graphics, vol. 29, no. 1, art. 5, Dec. 2009. [8] J. T. Ludwig, S. H. Nawab, and A. Chandrakasan, “Low-power digital filtering using approximate processing,” IEEE Journal of Solid-State Circ., vol. 31, no. 3, pp. 395-340, Mar. 1996. [9] R. Yuster and U. Zwick, “Fast sparse matrix multiplication,” ACM Trans. on Algorithms, vol. 1, no. 1, July 2005. [10] J. Kurzak and J. Dongarra, “Implementation of mixed precision in solving systems of linear equations on the Cell processor,” Concurr. and Comput.: Practice and Exper., vol. 19, no. 10, pp. 1371-1385, Jul. 2007. [11] P. Drineas, et al, “Fast monte carlo algorithms for matrices I: Approximating matrix multiplication,” SIAM J. Comput., vol. 36, no. 1, pp. 132-157, May 2006. [12] N. Shanbhag, et al, “Stochastic computation,” ACM Design Automation Conf., pp. 859-864, June 2010. [13] D. Anastasia and Y. Andreopoulos, “Software designs of image processing tasks with incremental refinement of computation,”IEEE Trans. on Image Process, vol. 19, no. 8, pp. 2099-2114, Aug. 2010. [14] D. Anastasia and Y. Andreopoulos, “Linear image processing operations with operational tight packing,”IEEE Signal Process. Letters, vol. 17, no. 4, pp. 375-378, April 2010. [15] A. Frank and A. Asuncion, UCI Machine Learning Repository, Irvine, CA: University of California, School of Information and Computer Science, YearPredictionMSD Data Set (a subset of the data from the Million Song Dataset), http://archive.ics.uci.edu/ml/datasets/YearPredictionMSD . [16] D. Anastasia and Y. Andreopoulos, “Throughput-precision computation for generic matrix multiplication: toward a computation channel for high-performance digital signal processing,” Proc. IEEE Dig. Sig. Process., Corfu, 2011. [17] Supplementary material available in the 2nd author’s webpage: http://www.ee.ucl.ac.uk/~iandreop/ORIP.html [18] D. Lammers, “The era of error-tolerant computing,” IEEE Spectrum, Nov. 2010. [19] S. Nassif, et al, “A resilience roadmap,” Proc. Design and Test in Europe, DATE, Dresden, Apr. 2010. [20] A. Kadyrov and M. Petrou, “The “Invaders” algorithm: range of values modulation for accelerated correlation,” IEEE Trans. Pattern Anal. Machine Intel., vol. 28, no. 11, pp. 1882-1886, Nov. 2006. [21] D. Goldberg, “What every computer scientist should know about floating-point arithmetic,” ACM Computing Surveys, vol. 23, no. 1, pp. 5-47, March 1991. [22] K. Goto and R. A. Van de Geijn, “Anatomy of high-performance matrix multiplication,” ACM Trans. on Math. Software, vol. 34, no. 3, Article 3, May 2008. [23] Y.-C. Lin and S.-C. Tai, “Fast full-search block-matching algorithm for motion-compensated video compression,” IEEE Trans. On Commun., vol. 45, no. 5, pp. 527-531, May 1997. [24] L. H. de Figueiredo and J. Stolfi, “Affine arithmetic: concepts and applications,” Numer. Algorithms, vol. 37, pp. 147158, 2004. 25
5cs.CE
HAUSDORFF DIMENSION IN R-ANALYTIC PROFINITE GROUPS arXiv:1406.1829v2 [math.GR] 24 May 2016 GUSTAVO A. FERNÁNDEZ-ALCOBER, EUGENIO GIANNELLI, AND JON GONZÁLEZ-SÁNCHEZ Abstract. We study the Hausdorff dimension of R-analytic subgroups in an R-analytic profinite group, where R is a pro-p ring whose associated graded ring is an integral domain. In particular, we prove that the set of such Hausdorff dimensions is a finite subset of the rational numbers. 1. Introduction The study of Hausdorff dimension in profinite groups was initiated by Abercrombie in [1], and has attracted special attention in recent times; see, for example, [2, 3, 4, 7, 9, 11]. If G is a countably based infinite profinite group, a (normal) filtration of G is a descending series {Gn }n∈N of (normal) open subgroups of G which is a base of neighbourhoods of 1. We can define a metric on G by d(x, y) = inf {|G : Gn |−1 | xy −1 ∈ Gn }, and the topology induced by d coincides with the original topology in G. The metric d defines a Hausdorff dimension function on all subsets of G, which we denote by hDim{Gn } . As shown in [4, Theorem 2.4], if the filtration {Gn }n∈N is normal and H is a closed subgroup of G, then hDim{Gn } (H) = lim inf n→∞ log |H : H ∩ Gn | . log |G : Gn | In [4], Barnea and Shalev studied the Hausdorff dimension in p-adic anan lytic pro-p groups with respect to the filtration {Gp }n∈N , and proved that hDim{Gpn } (H) = dim(H) dim(G) for every closed subgroup H of G. Here, if G is an analytic group, dim(G) denotes the dimension of G as an analytic manifold. In this paper we study Hausdorff dimension in R-analytic profinite groups, where R is a pro-p ring whose associated graded ring is an integral domain. This is the natural setting for working with analytic groups over pro-p rings, see [5, Chapter 13]. If G is an R-analytic profinite group, then G is virtually 2010 Mathematics Subject Classification. Primary 20E18; Secondary 28A78. Key words and phrases. Profinite groups, analytic groups, Hausdorff dimension. The first and third authors are supported by the Spanish Government, grants MTM2011-28229-C02 and MTM2014-53810-C2-2-P, and by the Basque Government, grants IT753-13 and IT974-16. The second author gratefully acknowledges financial support by the GRECA research group and by the ERC Advanced Grant 291512. 1 2 FERNÁNDEZ-ALCOBER, GIANNELLI, AND GONZÁLEZ-SÁNCHEZ n a pro-p group, but the subgroups Gp need not to form a filtration, since they need not to be open in G. We consider instead the natural filtration induced by a standard open subgroup of G. As we will see, the Hausdorff dimension of a closed subgroup H of G is the same with respect to the natural filtrations induced by all open standard subgroups of G. This allows us to define the concept of standard Hausdorff dimension of H, denoted by hDimStd (H). We get the following theorem, in the spirit of the result of Barnea and Shalev. Main Theorem. Let G be an R-analytic profinite group and let H be an R-analytic subgroup of G. Then (1) hDimStd (H) = dim(H) . dim(G) An R-analytic subgroup H of G is a subgroup that is also an R-analytic submanifold of G; then H is closed in G. A crucial remark is that while the converse is true in a p-adic analytic group, i.e. every closed subgroup is analytic, it need not hold for an arbitrary pro-p ring R. For example, Fp [[td ]] is a closed subgroup of Fp [[t]] for every positive integer d, but it is not analytic for d > 1, even if it is an Fp [[t]]-analytic group in its own right. Observe that (1) implies that the R-analytic spectrum of G, defined by SpecR (G) = {hDimStd (H) | H is an R-analytic subgroup of G}, is finite and consists of rational values. On the other hand, the spectrum of Fp [[t]] corresponding to all closed subgroups is the full interval [0, 1], as shown in [4, Lemma 4.1]. Thus our main theorem is pointing to the fact that most closed subgroups of Fp [[t]] are non-analytic. Notation. We write X (d) to denote the cartesian product of d copies of a set X. The symbol ⊆o indicates that a subset of a topological space is open. 2. Preliminaries Throughout this paper R is a pro-p ring whose associated graded ring is an integral domain. Hence R is an integral domain, and we write K for its field of fractions. If m is the maximal ideal of R, then R/m is a finite field of characteristic p. Set H(n) = dimR/m (mn /mn+1 ) for all n ∈ N. For large enough n, H(n) coincides with a polynomial P (n), called the Hilbert polynomial of R [6, Chapter 8, Theorem C]. Let G be an R-analytic group. Without loss of generality, we assume that the manifold structure is given by a full atlas. A subgroup H of G is an analytic subgroup if it is also an analytic submanifold of G. We adopt Serre’s definition of submanifold [10, Section 3.11]. Every analytic subgroup is closed in G. The converse is not true in general, but every open subgroup H of G (actually, any open subset) is a submanifold when considered with the restrictions of the charts of G, and dim H = dim G. An R-analytic group S with a global chart given by a homeomorphism φ : S → (mN )(d) is called an R-standard group of level N if φ(1) = 0 and, for all j ∈ {1, . . . , d}, there exist Fj (X, Y ) ∈ R[[X, Y ]] (where X and Y are HAUSDORFF DIMENSION IN R-ANALYTIC PROFINITE GROUPS 3 d-tuples of indeterminates), without constant term, such that (2) φ(xy) = F (φ(x), φ(y)), for every x, y ∈ S. Here, F = (F1 , . . . , Fd ) is called the formal group law associated to S. In these circumstances, we also say that (S, φ) is a standard group. By using (2), F defines a new group structure on (mN )(d) , other than its natural additive structure, and then φ is an isomorphism between S and ((mN )(d) , F ). Every R-analytic group contains an open (and so analytic) R-standard subgroup S [5, Theorem 13.20]. As a consequence, profinite R-analytic groups are countably based. The formal group law of a standard group satisfies the following result [5, pp. 331-334]. Lemma 2.1. Let F be a formal group law of dimension d associated to a standard group S. Then F (X, Y ) = X + Y + G(X, Y ), where every monomial involved in G has total degree at least 2, and contains a non-zero power of Xr and of Ys for some r, s ∈ {1, . . . , d}. Moreover, F (X, I(X)) = 0 = F (I(X), X) for some I(X) = −X + H(X) ∈ R[[X]], and every monomial involved in H has total degree at least 2. It follows that (mN +n )(d) is a subgroup of ((mN )(d) , F ) for all n ≥ 0. This allows us to introduce a special type of filtrations in an R-analytic group. Definition 2.2. Let G be an R-analytic group and let S be a standard open subgroup of G, with global chart (S, φ). Then for every positive integer n ≥ 0, and for every subset A ⊆ S, we define mnφ A = φ−1 (mn φ(A)). We say that {mnφ S}n∈N is the natural filtration of G induced by S. Observe that mnφ S = φ−1 ((mN +n )(d) ), which implies that mnφ S is an open subgroup of G, and also that {mnφ S}n∈N is a filtration of G. Actually, we have mnφ S E S (see [5, Proposition 13.22]). Lemma 2.3. Let (S, φ) be an R-standard group. Then: (i) For all x, y ∈ S and n ≥ N , we have φ(xy −1 ) ∈ (mn )(d) if and only if φ(x) − φ(y) ∈ (mn )(d) . (ii) For every n ≥ 0, we have |S : mnφ S| = |(mN )(d) : (mN +n )(d) | = P +n−1 q df (n) , where f (n) = N H(i). i=N (iii) φ is an isometry between the group S with the metric induced by the filtration {mnφ S}n∈N and the group ((mN )(d) , +) with the metric induced by the filtration {(mN +n )(d) }n∈N . Proof. (i) Since φ(1) = 0, we may assume that x 6= y. Let k ∈ N be such that φ(xy −1 ) ∈ (mk )(d) r (mk+1 )(d) . Then since φ(x) = φ(xy −1 y) = F (φ(xy −1 ), φ(y)) = φ(xy −1 ) + φ(y) + G(φ(xy −1 ), φ(y)), 4 FERNÁNDEZ-ALCOBER, GIANNELLI, AND GONZÁLEZ-SÁNCHEZ by Lemma 2.1, we have φ(x) − φ(y) ≡ φ(xy −1 ) (mod (mk+1 )(d) ). Hence also φ(x) − φ(y) ∈ (mk )(d) r (mk+1 )(d) , and (i) follows. (ii) Observe that (i) implies that (3) xy −1 ∈ mnφ S ⇐⇒ φ(x) − φ(y) ∈ (mN +n )(d) , or what is the same, x · mnφ S = y · mnφ S ⇐⇒ φ(x) + (mN +n )(d) = φ(y) + (mN +n )(d) . This proves (ii), since φ is a bijection. (iii) According to the definition of the metric associated to a fitration, it is clear that (ii) and (3) together imply that φ is an isometry.  Hausdorff dimension can be defined for any subset of a metric space, see [8, Chapter 2] for its definition and main properties. We need the following two lemmas about Hausdorff dimension in countably based profinite groups. Lemma 2.4. Let G be a countably based profinite group with filtration {Gn }n∈N . Let H be a closed subgroup of G, and let U be a non-empty open subset of H. Then hDim{Gn } (H) = hDim{Gn } (U ). Proof. The proof is a straightforward consequence of [8, Section 2.2].  Let G be a countably based profinite group and let S be an open subgroup of G. If {Sn }n∈N is a filtration of S, we can calculate the Hausdorff dimension of X ⊆ S with respect to the metric induced by {Sn }n∈N in S or in G, which we denote by hDimS{Sn } (X) and hDimG {Sn } (X), respectively. Our next lemma shows that there is no need to make this distinction in the notation. Lemma 2.5. Let G be a countably based profinite group and let S be an open subgroup of G. If {Sn }n∈N is a filtration of S, then S hDimG {Sn } (X) = hDim{Sn } (X) for every X ⊆ S. Proof. Let dS and dG be the metrics induced by {Sn }n∈N in S and G. Then dS (x, y) = |G : S| dG (x, y) for all x, y ∈ S, and the identity map from (S, dS ) to (S, dG ) is bi-Lipschitz. Now the result follows from [8, Corollary 2.4].  3. Proof of the main theorem In this section we first prove that the Hausdorff dimension of a closed subgroup in an analytic profinite group with respect to a natural filtration is independent of the standard subgroup. Then we prove the main theorem of our paper about Hausdorff dimension of analytic subgroups. Theorem 3.1. Let G be an R-analytic profinite group, and let (S, φ) and (T, ψ) be two open standard subgroups of G. Then hDim{mnφ S} (H) = hDim{mnψ T } (H) for every closed subgroup H of G. HAUSDORFF DIMENSION IN R-ANALYTIC PROFINITE GROUPS 5 Proof. Let us write Sn and Tn for mnφ S and mnψ T , and N (S) and N (T ) for the levels of S and T . We first show that there exist non-negative integers a and b such that (4) Sn+a ≤ Tn ≤ Sn−b for every n ≥ b. Since the charts φ and ψ belong to the full atlas of G, the two functions ψ ◦ φ−1 |φ(S∩T ) and φ ◦ ψ −1 |ψ(S∩T ) are analytic. Since φ(S ∩ T ) is open in φ(S), it follows that ψ ◦ φ−1 can be evaluated in (mℓ )(d) for some ℓ. By [5, Lemma 6.45], and observing that ψ ◦ φ−1 (0) = 0, there exists a natural number k such that ψ ◦ φ−1 ((mn+k )(d) ) ⊆ (mn )(d) for every n ≥ 0. This implies that Sn+a ≤ Tn for n ≥ 0, by choosing a = max{k − N (S) + N (T ), 0}. Arguing similarly with φ ◦ ψ −1 , we get (4). Now, by [4, Theorem 2.4], we have hDim{Tn } (H) = lim inf n→∞ ≤ lim inf n→∞ log |H : H ∩ Tn | log |G : Tn | log |H : H ∩ Sn+a | log |G : Sn+a | − log |Tn : Sn+a | log |H : H ∩ Sn+a | ≤ lim inf · n→∞ log |G : Sn+a | log |Sn−b : Sn+a | 1− log |G : Sn+a | !−1 = hDim{Sn } (H). The last equality holds because, by (ii) of Lemma 2.3, for n large enough we have N +n+a−1 X P (i), logq |Sn−b : Sn+a | = i=N +n−b which is polynomial in n of degree deg P ; on the other hand, logq |G : Sn+a | is asymptotically equivalent to logq |G : S| + N +n+a−1 X P (i) i=N and, by the Euler-MacLaurin formula, this sum is a polynomial in n of degree deg P + 1. By swapping S and T , the result follows.  Definition 3.2. Let G be an R-analytic profinite group and let H be a closed subgroup of G. Then the standard Hausdorff dimension of H, hDimStd (H), is the Hausdorff dimension of H calculated with respect to the natural filtration induced by any given standard open subgroup of G. We need the following lemma before proving our main theorem. Lemma 3.3. Let R be a pro-p ring, and let E be a vector subspace of dimension e of K (d) . Then, for every N ∈ N, the Hausdorff dimension of (mN )(d) ∩ E in R(d) with respect to the filtration {(mn )(d) }n∈N is e/d. 6 FERNÁNDEZ-ALCOBER, GIANNELLI, AND GONZÁLEZ-SÁNCHEZ Proof. Let B = {w1 , . . . , we } be a basis of E, and let A be the e × d matrix over K whose rows are the vectors in B. We may assume that A is in reduced echelon form. Set W = hw1 , . . . , we iR . Let k be such that the product of all denominators of the entries of A belongs to mk . One readily checks that mn+k W ⊆ (mn )(d) ∩ E ⊆ mn W. (5) The required Hausdorff dimension is the limit inferior of the sequence cn = log |(mN )(d) ∩ E : (mn )(d) ∩ E| , log |R(d) : (mn )(d) | where n ≥ N . Now, from (5), for n ≥ N + k, we have |mN +k W : mn W | ≤ |(mN )(d) ∩ E : (mn )(d) ∩ E| ≤ |mN W : mn+k W |. Since W is a free R-module of rank e, we have dimR/m (mn W/mn+1 W ) = eH(n), and consequently e(H(N ) + · · · + H(n + k − 1)) e(H(N + k) + · · · + H(n − 1)) ≤ cn ≤ . d(H(1) + · · · + H(n − 1)) d(H(1) + · · · + H(n − 1)) Now, since H(n) = P (n) for large enough n, we have P (N + k) + · · · + P (n − 1) H(N + k) + · · · + H(n − 1) = lim = 1, n→∞ H(1) + · · · + H(n − 1) P (1) + · · · + P (n − 1) since both sums in the last limit are polynomials in n of degree deg P +1 and with the same leading coefficient. Arguing similarly with the upper bound for cn given above, we conclude that limn→∞ cn = e/d, as desired.  lim n→∞ We are now ready to prove our main theorem. Proof of the Main Theorem. Let dim(G) = d and dim(H) = e. Since H is an R-analytic submanifold of G, there exist an open subset U of H containing 1, and a chart (V, φ) of G such that U ⊆ V and φ(U ) = E ∩ φ(V ), for some vector subspace E of K (d) of dimension e. From the proof of [5, Theorem 13.20], there exist a natural number N and an open subgroup S of G such that S ⊆ V and (S, φ) is a standard subgroup of G of level N . Since U ∩ S ⊆o U ⊆o H, we have hDimStd (H) = hDim{mnφ S} (U ∩ S), by Lemma 2.4. Since φ is an isometry between S and ((mN )(d) , +) by Lemma 2.3, we get hDim{mnφ S} (U ∩ S) = hDim{(mn )(d) } (φ(U ∩ S)). Now since φ(U ∩ S) = E ∩ (mN )(d) , Lemma 3.3 yields that e hDim{(mn )(d) } (φ(U ∩ S)) = , d which completes the proof.  Corollary 3.4. Let G be an R-analytic group of dimension d. Then n 1 d−1 o ,1 . SpecR (G) ⊆ 0, , . . . , d d In particular, the R-analytic spectrum of G is finite and consists of rational numbers. HAUSDORFF DIMENSION IN R-ANALYTIC PROFINITE GROUPS 7 Acknowledgement. We thank the anonymous referee for helpful comments. References [1] J.L. Abercrombie, Subgroups and subrings of profinite rings, Math. Proc. Cambr. Phil. Soc. 116 (1994), 209–222. [2] M. Abért, B. Virág, Dimension and randomness in groups acting on rooted trees, J. Amer. Math. Soc. 18 (2005), 157–192. [3] Y. Barnea, B. Klopsch, Index-subgroups of the Nottingham group, Adv. Math. 180 (2003), 187–221. [4] Y. Barnea, A. Shalev, Hausdorff dimension, pro-p groups, and Kac-Moody algebras, Trans. Amer. Math. Soc. 349 (1997), no. 12, 5073–5091. [5] J. Dixon, M. Du Sautoy, A. Mann, D. Segal, Analytic pro-p groups, 2nd ed., Cambridge University Press, Cambridge, 1999. [6] D. Eisenbud, Commutative algebra with a view toward algebraic geometry, Graduate Texts in Mathematics 150, Springer-Verlag, Berlin-Heidelberg-New York, 2004. [7] M. Ershov, On subgroups of the Nottingham group of positive Hausdorff dimension, Comm. Algebra 35 (2006), 193–206. [8] K. Falconer, Fractal geometry: mathematical foundations and applications, John Wiley and Sons, New York, 1990. [9] G.A. Fernández-Alcober, A. Zugadi-Reizabal, GGS-groups: order of congruence quotients and Hausdorff dimension, Trans. Amer. Math. Soc. 366 (2014), 1993–2017. [10] J.-P. Serre, Lie algebras and Lie groups, Lecture Notes in Mathematics 1500, Springer-Verlag, Berlin-Heidelberg-New York, 1992. [11] O. Siegenthaler, Hausdorff dimension of some groups acting on the binary tree, J. Group Theory 11 (2008), 555–567. Department of Mathematics, University of the Basque Country UPV/EHU, 48080 Bilbao, Spain E-mail address: [email protected] Department of Mathematics, University of Kaiserslautern, P.O. Box 3049, 67655 Kaiserslautern, Germany E-mail address: [email protected] Department of Mathematics, University of the Basque Country UPV/EHU, 48080 Bilbao, Spain E-mail address: [email protected]
4math.GR
Sparsification Upper and Lower Bounds for Graphs Problems and Not-All-Equal SAT∗ Bart M.P. Jansen and Astrid Pieterse Eindhoven University of Technology P. O. Box 513, Eindhoven, The Netherlands [email protected], [email protected] arXiv:1509.07437v1 [cs.CC] 24 Sep 2015 Abstract We present several sparsification lower and upper bounds for classic problems in graph theory and logic. For the problems 4-Coloring, (Directed) Hamiltonian Cycle, and (Connected) Dominating Set, we prove that there is no polynomial-time algorithm that reduces any nvertex input to an equivalent instance, of an arbitrary problem, with bitsize O(n2−ε ) for ε > 0, unless NP ⊆ coNP/poly and the polynomial-time hierarchy collapses. These results imply that existing linear-vertex kernels for k-Nonblocker and k-Max Leaf Spanning Tree (the parametric duals of (Connected) Dominating Set) cannot be improved to have O(k 2−ε ) edges, unless NP ⊆ coNP/poly. We also present a positive result and exhibit a non-trivial sparsification algorithm for d-Not-All-Equal-SAT. We give an algorithm that reduces an n-variable input with clauses of size at most d to an equivalent input with O(nd−1 ) clauses, for any fixed d. Our algorithm is based on a linear-algebraic proof of Lovász that bounds  the number of hyperedges n in critically 3-chromatic d-uniform n-vertex hypergraphs by d−1 . We show that our kernel is tight under the assumption that NP * coNP/poly. 1998 ACM Subject Classification F.2.2 Nonnumerical Algorithms and Problems, G.2.2 Graph Theory Keywords and phrases sparsification, graph coloring, Hamiltonian cycle, satisfiability 1 Introduction Background. Sparsification refers to the method of reducing an object such as a graph or CNF-formula to an equivalent object that is less dense, that is, an object in which the ratio of edges to vertices (or clauses to variables) is smaller. The notion is fruitful in theoretical [16] and practical (cf. [10]) settings when working with (hyper)graphs and formulas. The theory of kernelization, originating from the field of parameterized complexity theory, can be used to analyze the limits of polynomial-time sparsification. Using tools developed in the last five years, it has become possible to address questions such as: “Is there a polynomial-time algorithm that reduces an n-vertex instance of my favorite graph problem to an equivalent instance with a subquadratic number of edges?” The impetus for this line of analysis was given by an influential paper by Dell and van Melkebeek [8] (conference version in 2010). One of their main results states that if there is an ε > 0 and a polynomial-time algorithm that reduces any n-vertex instance of Vertex Cover to an equivalent instance, of an arbitrary problem, that can be encoded in O(n2−ε ) bits, then NP ⊆ coNP/poly and the polynomial-time hierarchy collapses. Since any nontrivial input (G, k) of Vertex Cover has k ≤ n = |V (G)|, their result implies that the number ∗ This work was supported by NWO Veni grant “Frontiers in Parameterized Preprocessing” and NWO Gravity grant “Networks”. 2 Sparsification Upper and Lower Bounds for Graphs Problems and Not-All-Equal SAT of edges in the 2k-vertex kernel for k-Vertex Cover [21] cannot be improved to O(k 2−ε ) unless NP ⊆ coNP/poly. Using related techniques, Dell and van Melkebeek also proved important lower bounds for d-cnf-sat problems: testing the satisfiability of a propositional formula in CNF form, where each clause has at most d literals. They proved that for every fixed integer d ≥ 3, the existence of a polynomial-time algorithm that reduces any n-variable instance of d-cnf-sat to an equivalent instance, of an arbitrary problem, with O(nd−ε ) bits, for some ε > 0 implies NP ⊆ coNP/poly. Their lower bound is tight: there are O(nd ) possible clauses of size d over n variables, allowing an instance to be represented by a vector of O(nd ) bits that specifies for each clause whether or not it is present. Our results. We continue this line of investigation and analyze sparsification for several classic problems in graph theory and logic. We obtain several sparsification lower bounds that imply that the quadratic number of edges in existing linear-vertex kernels is likely to be unavoidable. When it comes to problems from logic, we give the—to the best of our knowledge—first example of a problem that does admit nontrivial sparsification: d-NotAll-Equal-SAT. We also provide a matching lower bound. The first problem we consider is 4-Coloring, which asks whether the input graph has a proper vertex coloring with 4 colors. Using several new gadgets, we give a cross-composition [3] to show that the problem has no compression of size O(n2−ε ) unless NP ⊆ coNP/poly. To obtain the lower bound, we give a polynomial-time construction that embeds the √ logical 0 or of a series of t size-n inputs of an NP-hard problem into a graph G with O( t · nO(1) ) vertices, such that G0 has a proper 4-coloring if and only if there is a yes-instance among the inputs. The main structure of the reduction follows the approach of Dell and Marx [7]: √ we create a table with two rows and O( t) columns and O(nO(1) ) vertices in each cell. For each way of picking one cell from each row, we aim to embed one instance into the edge set between the corresponding groups of vertices. When the NP-hard starting problem is chosen such that the t inputs each decompose into two induced subgraphs with a simple structure, one can create the vertex groups and their √ connections such that for each pair of cells (i, j), the subgraph they induce represents the i · t + j-th input. If there is a yes-instance among the inputs, this leads to a pair of cells that can be properly colored in a structured way. The challenging part of the reduction is to ensure that the edges in the graph corresponding to no-inputs do not give conflicts when extending this partial coloring to the entire graph. The next problem we attack is Hamiltonian Cycle. We rule out compressions of size O(n2−ε ) for the directed and undirected variant of the problem, assuming NP * coNP/poly. The construction is inspired by kernelization lower bounds for Directed Hamiltonian Cycle parameterized by the vertex-deletion distance to a directed graph whose underlying undirected graph is a path [2]. By combining gadgets from kernelization lower bounds for two different parameterizations of Red Blue Dominating Set, we prove that there is no compression of size O(n2−ε ) for Dominating Set unless NP ⊆ coNP/poly. The same construction rules out subquadratic compressions for Connected Dominating Set. These lower bounds have implications for the kernelization complexity of the parametric duals Nonblocker and Max Leaf Spanning Tree of (Connected) Dominating Set. For both Nonblocker and Max Leaf there are kernels with O(k) vertices [6, 11] that have Θ(k 2 ) edges. Our lower bounds imply that the number of edges in these kernels cannot be improved to O(k 2−ε ), unless NP ⊆ coNP/poly. The final family of problems we consider is d-Not-All-Equal-SAT for fixed d ≥ 4. The B. M. P. Jansen and A. Pieterse input consists of a formula in CNF form with at most d literals per clause. The question is whether there is an assignment to the variables such that each clause contains both a variable that evaluates to true and one that evaluates to false. There is a simple linear-parameter transformation from d-cnf-sat to (d + 1)-nae-sat that consists of adding one variable that occurs as a positive literal in all clauses. By the results of Dell and van Melkebeek discussed above, this implies that d-nae-sat does not admit compressions of size O(nd−1−ε ) unless NP ⊆ coNP/poly. We prove the surprising result that this lower bound is tight! A linearalgebraic result due to Lovász [20], concerning the size of critically 3-chromatic d-uniform hypergraphs, can be used to give a kernel for d-nae-sat with O(nd−1 ) clauses for every fixed d. The kernel is obtained by computing the basis of an associated matrix and removing the clauses that can be expressed as a linear combination of the basis clauses. Related work. Dell and Marx introduced the table structure for compression lower bounds [7] in their study of compression for packing problems. Hermelin and Wu [15] analyzed similar problems. Other papers about polynomial kernelization and sparsification lower bounds include [5] and [17]. 2 Preliminaries A parameterized problem Q is a subset of Σ∗ × N, where Σ is a finite alphabet. Let Q, Q0 ⊆ Σ∗ × N be parameterized problems and let h : N → N be a computable function. A generalized kernel for Q into Q0 of size h(k) is an algorithm that, on input (x, k) ∈ Σ∗ × N, takes time polynomial in |x| + k and outputs an instance (x0 , k 0 ) such that: 1. |x0 | and k 0 are bounded by h(k), and 2. (x0 , k 0 ) ∈ Q0 if and only if (x, k) ∈ Q. The algorithm is a kernel for Q if Q0 = Q. It is a polynomial (generalized) kernel if h(k) is a polynomial. Since a polynomial-time reduction to an equivalent sparse instance yields a generalized kernel, we will use the concept of generalized kernels in the remainder of this paper to prove the non-existence of such sparsification algorithms. We employ the cross-composition framework by Bodlaender et al. [3], which builds on earlier work by several authors [1, 8, 13]. I Definition 1 (Polynomial equivalence relation). An equivalence relation R on Σ∗ is called a polynomial equivalence relation if the following conditions hold. 1. There is an algorithm that, given two strings x, y ∈ Σ∗ , decides whether x and y belong to the same equivalence class in time polynomial in |x| + |y|. 2. For any finite set S ⊆ Σ∗ the equivalence relation R partitions the elements of S into a number of classes that is polynomially bounded in the size of the largest element of S. I Definition 2 (Cross-composition). Let L ⊆ Σ∗ be a language, let R be a polynomial equivalence relation on Σ∗ , let Q ⊆ Σ∗ × N be a parameterized problem, and let f : N → N be a function. An or-cross-composition of L into Q (with respect to R) of cost f (t) is an algorithm that, given t instances x1 , x2 , . . . , xt ∈ Σ∗ of L belonging to the same equivalence Pt class of R, takes time polynomial in i=1 |xi | and outputs an instance (y, k) ∈ Σ∗ × N such that: 1. the parameter k is bounded by O(f (t)·(maxi |xi |)c ), where c is some constant independent of t, and 3 4 Sparsification Upper and Lower Bounds for Graphs Problems and Not-All-Equal SAT u root root inner vertices leaves (a) Treegadget with no red leaf. leaves (b) Treegadget where one of the leaves is red. v w corner (c) Triangular gadget. Figure 1 Used gadgets with example colorings. 2. (y, k) ∈ Q if and only if there is an i ∈ [t] such that xi ∈ L. I Theorem 3 ([3]). Let L ⊆ Σ∗ be a language, let Q ⊆ Σ∗ ×N be a parameterized problem, and let d, ε be positive reals. If L is NP-hard under Karp reductions, has an or-cross-composition into Q with cost f (t) = t1/d+o(1) , where t denotes the number of instances, and Q has a polynomial (generalized) kernelization with size bound O(k d−ε ), then NP ⊆ coNP/poly. For r ∈ N we will refer to an or-cross-composition of cost f (t) = t1/r log(t) as a degreer cross-composition. By Theorem 2, a degree-r cross-composition can be used to rule out generalized kernels of size O(k r−ε ). We frequently use the fact that a polynomialtime linear-parameter transformation from problem Q to Q0 implies that any generalized kernelization lower bound for Q, also holds for Q0 (cf. [3, 4]). Let [r] be defined as [r] := {x ∈ N | 1 ≤ x ≤ r}. 3 4-Coloring In this section we analyze the 4-Coloring problem, which asks whether it is possible to assign each vertex of the input graph one out of 4 possible colors, such that there is no edge whose endpoints share the same color. We show that 4-Coloring does not have a generalized kernel of size O(n2−ε ), by giving a degree-2 cross-composition from a tailor-made problem that will be introduced below. Before giving the construction, we first present and analyze some of the gadgets that will be needed. I Definition 4. A treegadget is the graph obtained from a complete binary tree by replacing each vertex v by a triangle on vertices rv , xv and yv . Let rv be connected to the parent of v and let xv and yv be connected to the left and right subtree of v. An example of a treegadget with 8 leaves is shown in Figure 1. If vertex v is the root of the tree, then rv is named the root of the treegadget. If v does not have a left subtree, then xv is a leaf of this gadget, similarly, if v does not have a right subtree then we refer to yv as a leaf of the gadget. Let the height of a treegadget be equal to the height of its corresponding binary tree. It is easy to see that a treegadget is 3-colorable. The important property of this gadget is that if there is a color that does not appear on any leaf in a proper 3-coloring, then this must be the color of the root. See Figure 1a for an illustration. I Lemma 5. Let T be a treegadget with root r and let c : V (T ) → {1, 2, 3} be a proper 3-coloring of T . If k ∈ {1, 2, 3} such that c(v) 6= k for every leaf v of T, then c(r) = k. Proof. This will be proven using induction on the structure of a treegadget. For a single triangle, the result is obvious. Suppose we are given a treegadget of height h and that the B. M. P. Jansen and A. Pieterse statement holds for all treegadgets of smaller height. Consider the top triangle r, x, y where r is the root. Then, by the induction hypothesis, the roots of the left and right subtree are colored using k. Hence x and y do not use color k. Since x, y, r is a triangle, r has color k in the 3-coloring. J The following lemma will be used in the correctness proof of the cross-composition to argue that the existence of a single yes-input is sufficient for 4-colorability of the entire graph. I Lemma 6. Let T be a treegadget with leaves L ⊆ V (T ) and root r. Any 3-coloring c0 : L → {1, 2, 3} that is proper on T [L] can be extended to a proper 3-coloring of T . If there is a leaf v ∈ L such that c0 (v) = i, then such an extension exists with c(r) 6= i. Proof. We will prove this by induction on the height of the treegadget. For a single triangle, the result is obvious. Suppose the lemma is true for all treegadgets up to height h − 1 and we are given a treegadget of height h with root triangle r, x, y and with coloring of the leaves c0 . Let one of the leaves be colored using i. Without loss of generality assume this leaf is in the left subtree, which is connected to x. By the induction hypothesis, we can extend the coloring restricted to the leaves of the left subtree to a proper 3-coloring of the left subtree such that c(r1 ) 6= i. We assign color i to x. Since c0 restricted to the leaves in the right subtree is a proper 3-coloring of the leaves in the right subtree, by induction we can extend that coloring to a proper 3-coloring of the right subtree. Suppose the root of this subtree gets color j ∈ {1, 2, 3}. We now color y with a color k ∈ {1, 2, 3} \ {i, j}, which must exist. Finally, choose c(r) ∈ {1, 2, 3} \ {i, k}. By definition, the vertices r, y, and x are now assigned a different color. Both x and y have a different color than the root of their corresponding subtree, thereby c is a proper coloring. We obtain that the defined coloring c is a proper coloring extending c0 with c(r) 6= i. J I Definition 7. A triangular gadget is a graph on 12 vertices depicted in Figure 1c. Vertices u, v, and w are the corners of the gadget, all other vertices are referred to as inner vertices. It is easy to see that a triangular gadget is always 3-colorable in such a way that every corner gets a different color. Moreover, we make the following observation. I Observation 8. Let G be a triangular gadget with corners u,v and w and let c : V (G) → {1, 2, 3} be a proper 3-coloring of G. Then c(v) 6= c(u) 6= c(w) 6= c(v). Furthermore, every partial coloring that assigns distinct colors to the three corners of a triangular gadget can be extended to a proper 3-coloring of the entire gadget. Having presented all the gadgets we use in our construction, we now define the source problem for the cross-composition. It is a variant of the problem that was used to prove kernel lower bounds for Chromatic Number parameterized by vertex cover [3]. 2-3-Coloring with Triangle Split Decomposition Input: A graph G with a partition of its vertex set into X ∪ Y such that G[X] is an edgeless graph and G[Y ] is a disjoint union of triangles. Question: Is there a proper 3-coloring c : V (G) → {1, 2, 3} of G, such that c(x) ∈ {1, 2} for all x ∈ X? We will refer to such a coloring as a 2-3-coloring of G. I Lemma 9. 2-3-Coloring with Triangle Split Decomposition is NP-complete. Proof. It is easy to verify the problem is in NP. We will show that it is NP-hard by giving a reduction from 3-nae-sat, which is known to be NP-complete [14]. Suppose we are given formula F = C1 ∧ C2 ∧ . . . ∧ Cm over set of variables U . Construct graph G in the following 5 6 Sparsification Upper and Lower Bounds for Graphs Problems and Not-All-Equal SAT b1 b2 r0 v1 u0 x u1 u2 r1 ¬x (a) Gadget for a variable v2 v3 (b) Gadget for a clause Figure 2 The gadgets constructed for the clauses and variables of F . way. For every variable x ∈ U , construct a gadget as depicted in Figure 2a. For every clause Ci , construct a gadget as depicted in Figure 2b. Let Ci = (`1 ∨ `2 ∨ `3 ) for i ∈ [m], connect vertex `j for j ∈ {1, 2, 3} to vertex vj in gadget Ci in G. It is easy to verify that G has a triangle split decomposition. In Figure 2, triangles are shown with white vertices and the independent set is shown in black. Suppose G is 2-3-colorable with color function c : V (G) → {1, 2, 3} and let c(v) ∈ {1, 2} for all v in the independent set. Note that in each of the pairs {x, ¬x}, {b1 , b2 }, and {u1 , u2 } the two vertices have distinct colors in any proper 2-3-coloring of G. To satisfy F , let x = true if and only if c(x) = 2. To show that this results in a satisfying assignment, consider any clause Ci for i ∈ [m]. Note that c(x) = 2 ⇔ c(¬x) = 1. Since c(b1 ) 6= c(b2 ) and c(b1 ), c(b2 ) ∈ {1, 2} we obtain c(r0 ) = 3. Therefore, v1 and u0 are colored using colors 1 and 2. Suppose c(v1 ) = 1. Thereby, c(`1 ) = 2, implying the first literal of Ci is set to true. By c(u0 ) = 2, we know c(u1 ) = 1 and c(u2 ) = 2. Thereby, c(r1 ) 6= 2, so either c(v2 ) = 2 or c(v3 ) = 2. If c(v2 ) = 2, then c(`2 ) = 1 which implies that literal `2 is f alse in Ci . Similarly, if c(v3 ) = 2, then c(`3 ) = 1 which implies that literal `3 is f alse in Ci . In both cases it follows that clause Ci is NAE-satisfied. When c(v1 ) = 2, we can use the same argument with the colors 1 and 2 swapped, to show that `1 is f alse in Ci and `2 or `3 is true, which implies that Ci is NAE-satisfied. Suppose F is a yes-instance, with satisfying truth assignment S. Define color function c : V (G) → {1, 2, 3} as c(x) := 1 and c(¬x) := 2 if x is set to false in S, define c(x) := 2 and c(¬x) := 1 otherwise. Color the remainder of the variable gadgets consistently. We now need to show how to color the clause gadgets. Consider any clause Ci = (`1 ∨ `2 ∨ `3 ). At least one of the literals is true and one is set to false, by symmetry we only consider four cases. The corresponding colorings are depicted in Figure 3, where red corresponds to 1, green corresponds to 2 and blue corresponds to color 3. It is easy to verify that this leads to a proper 3-coloring that only uses colors 1 and 2 on vertices in the independent set. J I Theorem 10. 4-Coloring parameterized by the number of vertices n does not have a generalized kernel of size O(n2−ε ) for any ε > 0, unless NP ⊆ coNP/poly. Proof. By Theorem 3 and Lemma 9 it suffices to give a degree-2 cross-composition from the 2-3-coloring problem defined above into 4-Coloring parameterized by the number of B. M. P. Jansen and A. Pieterse `1 `2 `3 `1 `2 7 `3 `1 `2 `3 `1 `2 `3 Figure 3 Valid colorings of a clause gadget, depending on the coloring of the literals `1 , . . . , `3 . Note that if the roles of `2 and `3 are exactly reversed, you can just exchange colors between their parents to get a proper coloring for that situation. vertices. For ease of presentation, we will actually give a cross-composition into the 4-List Coloring problem, whose input consists of a graph G and a list function that assigns every vertex v ∈ V (G) a list L(v) ⊆ [4] of allowed colors. The question is whether there is a proper coloring of the graph in which every vertex is assigned a color from its list. The 4-List Coloring reduces to the ordinary 4-Coloring by a simple transformation that adds a 4-clique to enforce the color lists, which will prove the theorem. For now, we focus on giving a cross-composition into 4-List Coloring. We start by defining a polynomial equivalence relation on inputs of 2-3-Coloring with Triangle Split Decomposition. Let two instances of 2-3-Coloring with Triangle Split Decomposition be equivalent under equivalence relation R when they have the same number of triangles and the independent sets also have the same size. It is easy to see that R is a polynomial equivalence relation. By duplicating one of the inputs, we can ensure that the number of inputs to the cross-composition is an even power of two; this does not change the value of or, and increases the total input size by at most a factor four. We will therefore assume that the input consists of t instances of 2-3-Coloring with √ Triangle √ 2i Split Decomposition such that t = 2 for some integer i, implying that t and log t √ 0 0 are integers. Let t := t. Enumerate the instances as Xi,j for 1 ≤ i, j ≤ t . Each input Xi,j consists of a graph Gi,j and a partition of its vertex set into sets U and V , such that U is an independent set of size m and Gi,j [V ] consists of n vertex-disjoint triangles. Enumerate the vertices in U and V as u1 , . . . , um and v1 , . . . , v3n , such that vertices v3`−2 , v3`−1 and v3` form a triangle, for ` ∈ [n]. We will create an instance G0 of the 4-List-Coloring problem, which consists of a graph G0 and a list function L that assigns each vertex a subset of the color palette {x, y, z, a}. Refer to Figure 4 for a sketch of G0 . 1. Initialize G0 as the graph containing t0 sets of m vertices each, called Si for i ∈ [t0 ]. Label the vertices in each of these sets as si` for i ∈ [t0 ], ` ∈ [m] and let L(si` ) := {x, y, a}. 2. Add t0 sets of n triangular gadgets each, labeled Tj for j ∈ [t0 ]. Label the corner vertices in Tj as tj` for ` ∈ [3n], such that vertices tj3`−2 , tj3`−1 and tj3` are the corner vertices of one of the gadgets for ` ∈ [n]. Let L(tj` ) := {x, y, z} and for any inner vertex v of a triangular gadget, let L(v) := {x, y, z, a}. 3. Connect vertex sik to vertex tj` if in graph Gi,j vertex uk is connected to v` , for k ∈ [m] and ` ∈ [3n]. By this construction, the subgraph of G0 induced by Si ∪ Tj is isomorphic to the graph obtained from Gi,j by replacing each triangle with a triangular gadget. 8 Sparsification Upper and Lower Bounds for Graphs Problems and Not-All-Equal SAT {x, y, a} S1 {x, y, z, a} {x, y, a} {y, z, a} {y, z} S2 {x, y} rS GS GT S3 {y, z} rT S4 S T {x, y, z} Figure 4 The graph G0 for t0 = 4, m = 3 and n = 2. Edges between vertices in S and T are left out for simplicity. 4. Add a treegadget GS with t0 leaves to G0 and enumerate these leaves as 1, . . . , t0 ; recall that t0 is a power of two. Connect the i’th leaf of GS to every vertex in Si . Let the root of GS be rS and define L(rS ) := {x, y}. For every other vertex v in GS let L(v) := {x, y, a}. 5. Add a treegadget GT with 2t0 leaves to G0 and enumerate these leaves as 1, . . . , 2t0 . For j ∈ [t0 ], connect every inner vertex of a triangular gadget in group Tj to leaf number 2j − 1 of GT . For every leaf v with an even index let L(v) := {y, z} and let the root rT have list L(rT ) := {y, z}. For every other vertex v of gadget GT let L(v) := {y, z, a}. I Claim 11. The graph G0 is 4-list-colorable ⇔ some input instance Xi∗ j ∗ is 2-3-colorable. Proof. (⇒) Suppose we are given a 4-list coloring c for G0 . By definition, c(rS ) 6= a. From Lemma 5 it follows that there is a leaf v of GS such that c(v) = a. This leaf is connected to all vertices in some Si∗ , which implies that none of the vertices in Si∗ are colored using a. Therefore all vertices in Si∗ are colored using x and y. Similarly the gadget GT has at least one leaf v such that c(v) = a, note that this must be a leaf with an odd index. Therefore there exists Tj ∗ where all vertices are colored using x,y or z. Thereby in Si∗ ∪ Tj ∗ only three colors are used, such that Si∗ is colored using only two colors. Using Observation 8 and the fact that G0 [Si∗ ∪ Tj ∗ ] is isomorphic to the graph obtained from Gi∗ ,j ∗ by replacing triangles by triangular gadgets, we conclude that Xi∗ j ∗ has a proper 2-3-coloring. (⇐) Suppose c : V (Gi∗ ,j ∗ ) → {x, y, z} is a proper 2-3-coloring for Xi∗ ,j ∗ . We will construct a 4-list coloring c0 : V (G0 ) → {x, y, z, a} for G0 . For uk , k ∈ [m] in instance Xi∗ ,j ∗ let ∗ ∗ c0 (sik ) := c(uk ) and for v` for ` ∈ [3n] let c0 (tj` ) := c(v` ). Let c0 (si` ) := a for i 6= i∗ and ` ∈ [n], furthermore let c0 (tj` ) := z for j 6= j ∗ and ` ∈ [3m]. For triangular gadgets in Tj ∗ the coloring c0 defines all corners to have distinct colors; by Observation 8 we can color the inner vertices consistently using {x, y, z}. For Tj with j ∈ [t0 ] and j 6= j ∗ , the corners of triangular gadgets have color z and we can now consistently color the inner vertices using {x, y, a}. The leaf of gadget GS that is connected to Si∗ can be colored using a. Every other leaf can use both x and y, so we can properly 3-color the leaves such that one leaf has color a. From Lemma 6 it follows that we can consistently 3-color GS such that the root rS does not B. M. P. Jansen and A. Pieterse receive color a, as required by L(rS ). Similarly, in triangular gadgets in Tj ∗ the inner vertices do not have color a. As such, leaf 2j ∗ − 1 of GT can be colored using a and we color leaf 2j ∗ with y. For j ∈ [t0 ] with j 6= j ∗ color leaf 2j − 1 with z and leaf 2j using y. Now the leaves of GT are properly 3-colored and one is colored a. It follows from Observation 8 that we can color GT such that the root is not colored a. This completes the 4-list coloring of G0 . J The claim shows that the construction serves as a cross-composition into 4-List Coloring. To prove the theorem, we add four new vertices to simulate the list function. Add a clique on 4 vertices {x, y, z, a}. If for any vertex v in G0 , some color is not contained in L(v), connect v to the vertex corresponding to this color. As proper colorings of the resulting graph correspond to proper list colorings of G0 , the resulting graph is 4-colorable if and only if there is a yes-instance among the inputs. It remains to bound the parameter of the problem, i.e., the number of vertices. Observe that a treegadget has at least as many leaves as its corresponding binary√tree, therefore the graph G0 has at most 12mt0 + nt0 + 6t0 + 12t0 + 4 = O(t0 · (m + n)) = O( t max |Xi,j |) vertices. Theorem 10 now follows from Theorem 3 and Lemma 9. J 4 Hamiltonian cycle In this section we prove a sparsification lower bound for Hamiltonian Cycle and its directed variant by giving a degree-2 cross-composition. The starting problem is Hamiltonian s − t path on bipartite graphs. Hamiltonian s − t path on bipartite graphs Input: An undirected bipartite graph G with partite sets A and B such that |B| = n = |A| + 1, together with two distinguished vertices b1 and bn that have degree 1. Question: Does G have a Hamiltonian path from b1 to bn ? It is known that Hamiltonian path is NP-complete on bipartite graphs [14] and it is easy to see that is remains NP-complete when fixing a degree 1 start and endpoint. I Theorem 12. (Directed) Hamiltonian Cycle parameterized by the number of vertices n does not have a generalized kernel of size O(n2−ε ) for any ε > 0, unless NP ⊆ coNP/poly. Proof. By a suitable choice of polynomial equivalence relation, and by padding the number of inputs, it suffices to give a cross-composition from √ the s −√t problem on bipartite graphs when the input consists of t instances Xi,j for i, j ∈ [ t] (i.e., t is an integer), such that each ∗ instance Xi,j encodes a bipartite graph Gi,j with partite sets A∗i,j and Bi,j with |A∗i,j | = m ∗ and |Bi,j | = n = m + 1, for some m ∈ N. For each instance, label all elements in A∗i,j as ∗ a∗1 , . . . , a∗m and all elements in Bi,j as b∗1 , . . . , b∗n such that b∗1 and b∗n have degree 1. The construction makes extensive use of the path gadget depicted in Figure 5a. Observe that if G0 contains a path gadget as an induced subgraph, while the remainder of the graph only connects to its terminals in0 and in1 , then any Hamiltonian cycle in G0 traverses the path gadget in one of the two ways depicted in Figure 5a. We create an instance G0 of Directed Hamiltonian Cycle that acts as the logical or of the inputs. √ 1. First√of all construct t groups of m path gadgets each. Refer to these groups as Ai , for i ∈ [ t], and label the gadgets within group √ Ai as ai1 , . . . , aim . Let the union of all created sets Ai be named A. Similarly, Refer to √ construct t groups of n path gadgets each. j these groups as Bj , for j ∈ [ t], and label the gadgets within group B as b , . . . , bjn . Let j 1 √ B be the union of all Bj for j ∈ [ t]. 9 10 Sparsification Upper and Lower Bounds for Graphs Problems and Not-All-Equal SAT start x1 y1 A2 A1 Path 0 IN 0 Path 1 end IN 1 B1 B2 x2 (a) A path gadget. y2 next (b) The general structure of the created graph, when given 4 inputs with n = 3 and m = 4. Figure 5 Illustrations for the lower bound for Hamiltonian Cycle. 2. For every input instance Xi,j , for each edge {a∗k , b∗` } in Xi,j with k ∈ [m], ` ∈ [n], add an arc from in0 of aik to in1 of bj` and an arc from in0 of bj` to in1 of aik . If some Xi,j has a Hamiltonian s − t path, it can be mimicked by the combination of Ai and Bj , where for each vertex in Xi,j we traverse its path gadget in G0 , following Path 1. The following construction steps are needed to extend such a path to a Hamiltonian cycle in G0 . 3. Add an √ arc from the in1 terminal of ai` to the in0 terminal of ai`+1 for all ` ∈ [m − 1] and 1 i 0 i all i ∈ [ t]. Similarly add √ an arc from the in terminal of b` to the in of b`+1 for all ` ∈ [n − 1] and all i ∈ [ t]. 4. Add a vertex start and a vertex end and the arc (end, start). √ 5. Let r := t − 1, add 2r tuples of vertices, xi , yi for i ∈ [2r] and connect start to x1 . Furthermore, add the arcs (yi , xi+1 ) for i ∈ [2r − 1]. √ j 6. For i ≤ r we add arcs from xi to the in0 terminal of the gadgets a , j ∈ [ t]. Furthermore 1 √ 1 j we add an arc from in of am to yi for √ all j ∈ [ t] and i ∈ [r]. When i > r add arcs from xi to the in0 terminal of bj1 for j ∈ [ t] and connect in1 of bjn to yi . 7. Add a vertex next and√the arc (y2r , next) and an arc from next to the in1 terminal of all gadgets bj1 for j ∈ [ t]. √ 8. Furthermore, add arcs from in0 of all gadgets bjn to end for j ∈ [ t]. So for each Bj , exactly one vertex has an outgoing arc to end and one has an incoming arc from next. This completes the construction of G0 . A sketch of G0 is shown in Figure 5b. In order to prove that the created graph G0 acts as a logical or of the given input instances, we first establish a number of auxiliary lemmas. I Lemma 13. Any Hamiltonian cycle in G0 traverses any path gadget in G0 via directed Path 0 or Path 1, as shown in Figure 5a. Proof. Any Hamiltonian cycle in G0 should visit the center vertex of the path gadget. Since in0 and in1 are its only two neighbors in G0 , the only option is to visit them consecutively, Path 0 and Path 1 are the only two options to do this. J B. M. P. Jansen and A. Pieterse I√Lemma 14. When any Hamiltonian cycle in G0 enters path gadget ai1 at in0 for some i ∈ [ t], the cycle then visits the gadgets ai2 , ai3 , . . . , aim in order without visiting other vertices in between. Similarly, if any Hamiltonian cycle in G0 enters path gadget bj1 at in0 , the cycle then visits the gadgets bj2 , bj3 , . . . , bjn in order without visiting other vertices in between. Proof. Consider a Hamiltonian cycle in G0 that enters path gadget ai1 at in0 . By Lemma 13 the cycle follows Path 0 and continues to the in1 terminal of the path gadget. Since that terminal has only one out-neighbor outside the gadget, which leads to the in0 terminal of ai2 , it follows that the cycle continues to that path gadget. As the adjacency structure around the other path gadgets is similar, the lemma follows by repeating this argument. The proof when entering group Bj at the vertex in0 of bj1 is equivalent. J cycle in G0 , such that its first arc is I Lemma 15. Let C be a directed Hamiltonian √ ∗ ∗ (start, x1 ). There are indices i , j ∈ [ t] such that subpath Cx1 ,y2r of the cycle between x1 and y2r contains exactly the vertices Ai∗ ∪ Bj ∗ ∪ {xi , yi | i ∈ [2r]} where Ai∗ contains all vertices of all gadgets in Ai for i = 6 i∗ , and similarly Bj ∗ contains all vertices of all gadgets in Bj for j 6= j ∗ . Proof. We will first show that when the cycle reaches any xi for i ∈ [r], it traverses exactly one group A` with ` ∈ [r + 1] and continues to yj and xj+1 for some j ∈ [r], without visiting other vertices in between. Similarly, when the cycle reaches any xi for r < i ≤ 2r, it traverses exactly one group B` with ` ∈ [r + 1] and continues to yj for some r < j ≤ 2r. For j < 2r, the cycle then continues to xj+1 , for j = 2r the cycle reached y2r , which is the last vertex of this subpath. ` By Step 6 √ in the construction, all outgoing arcs of any xi for i ∈ [r] lead √ to gadgets a1 for some ` ∈ [ t]. So for any xi in the cycle there must be a unique ` ∈ [ t] such that the arc from xi to the in0 terminal of a`1 is in C. By Lemma 14 the cycle visits all vertices in A` , and no other vertices, before reaching gadget a`m , which is traversed by Path 0 to get to in1 of this gadget. The only neighbors of in1 of gadget a`m lying outside this gadget are of type yj for j ∈ [r]. As such, the cycle must visit some yj next, and its only outgoing arc goes to xj+1 . The proof for i > r is similar. As such, visiting xi for i ∈ [r] results in visiting all vertices of exactly one group in A before continuing via yj to some xj+1 without visiting any vertices in between. Visiting xi for r < i ≤ 2r results in visiting all vertices of exactly one group in B and returning via yj to either the end of the subpath (j = 2r) or some xj+1 . Every vertex xi for i ∈ [2r] must be visited by C, it remains to show that it is visited in subpath Cx1 ,y2r . Suppose there exists an xi for i ∈ [2r] such that xi is not visited in the subpath from x1 to y2r . As we have seen above, visiting some xi results in visiting all vertices in some group in A or B, continued by visiting some yj for j ∈ [2r]. Note that no other vertices are visited in between. Hereby, yj is not in subpath Cx1 ,y2r . This implies j 6= 2r and thus the next vertex in the cycle is xj+1 . So, for xi not in subpath Cx1 ,y2r , one can find a new vertex xj+1 (where j + 1 6= i), such that xj+1 is also not in subpath Cx1 ,y2r . Note that we can not create a loop, by visiting a vertex xi seen earlier, as this would not yield a Hamiltonian cycle in G0 . For example, the vertex start would never be visited. This is however a contradiction since we only have finitely many vertices xi . Thus in subpath Cx1 ,y2r , exactly r groups of A are visited and exactly r groups of B are visited, and no other vertices than specified. This leaves exactly one group Ai∗ and one group Bj ∗ unvisited in Cx1 ,y2r . J 11 12 Sparsification Upper and Lower Bounds for Graphs Problems and Not-All-Equal SAT In Step 6 we create a selection mechanism that leaves one group in A and one in B unvisited. The following lemma formalizes this idea. I Lemma 16. Let C be a Hamiltonian cycle in G0 , such that its first arc is (start, x1 ). Let ∗ ∗ i∗ and j ∗ satisfy the conditions of Lemma 15. Then cycle C visits bj1 before bjn . Moreover, ∗ ∗ j the subpath of the cycle Cbj∗ ,bj∗ between terminal in1 of b1 and in0 of bjn (inclusive) contains n 1 all vertices of the gadgets in Ai∗ and Bj ∗ and no others. Proof. Vertex next is visited directly after y2r , since it is the only out-neighbor √ of y2r . Furthermore, the arc from next to gadget b`1 must be in the cycle for some ` ∈ [ t], since next only has outgoing arcs of this type. By Lemma 15, all gadgets in all Bj for j 6= j ∗ are visited in the path from x1 to y2r , and thus should not be visited after vertex next. ∗ ∗ Therefore, the arc from next to gadget bj1 is in the cycle, which also implies that bj1 is ∗ visited before bjn . It is easy to see that (end, start) is the last arc in C. By considering√the incoming arcs of end it follows that some arc from terminal in0 of b`n to end for ` ∈ [ t] is in the cycle. Since the vertices in gadgets b`n for ` 6= j ∗ are already visited in Cx1 ,y2r by Lemma 15, it ∗ follows that (bjn , end) is in C. By Lemma 15, none of the terminals of gadgets in Ai∗ and Bj ∗ are visited in the subpath Cx1 ,y2r or equivalently in the subpath Cstart,next . Since C is a Hamiltonian cycle these vertices must therefore be visited in Cnext,start , which is equivalent to saying that Cbj∗ ,bj∗ n 1 must contain all vertices in Ai∗ ∪ Bj ∗ . It is easy to see that this subpath cannot contain any other vertices, as all other vertices are present in Cstart,next or Cend,start . J Using the lemmas above, we can now prove that G0 has a Hamiltonian cycle if and only if one of the instances has a Hamiltonian path. I Lemma 17. Graph G0 has a directed Hamiltonian cycle if and only if at least one of the instances Xi,j has a Hamiltonian s − t-path. √ Proof. (⇐) Suppose G0 has a Hamiltonian cycle C. By Lemma 16 there exist i∗ , j ∗ ∈ [ t] ∗ ∗ such that the subpath of C from gadget bj1 to bjn visits exactly the gadgets in Ai∗ ∪Bj ∗ . Since ∗ gadget bj1 is entered at terminal in1 , it is easy to see that all gadgets are traversed using Path 1. We now construct a Hamiltonian path P for instance Xi∗ ,j ∗ . Let {a∗k (i∗ , j ∗ ), b∗` (i∗ , j ∗ )} ∈ P ∗ ∗ if the arc from in0 of aik to in1 of bj` is in C. Similarly let {b∗k (i∗ , j ∗ ), a∗` (i∗ , j ∗ )} ∈ P if the ∗ ∗ arc from in0 of bj` to in1 of aik is in C, where k ∈ [m] and ` ∈ [n]. Using that every gadget is visited exactly once via Path 1 in C, we see that C is a Hamiltonian path. (⇒) Suppose Xi∗ ,j ∗ has a Hamiltonian s − t path P . Then we create a Hamiltonian cycle ∗ C, for each vertex a∗` from instance Xi∗ ,j ∗ in P we add Path 1 in path gadget ai` to C and ∗ for each vertex b∗` we add Path 1 in path gadget bj` to C. Let P be ordered such that b∗1 is ∗ its first vertex. Now if a∗k is followed by b∗` in P , the arc from terminal in0 of aik to in1 of ∗ bj` is added to C. Similarly, if a vertex b∗` is followed by a∗k in P , the arc from terminal in0 ∗ ∗ of bj` to in1 of aik will be added to C. Now the subpath Cbj∗ ,bj∗ contains all terminals in n 1 all gadgets in Ai∗ ∪ Bj ∗ . ∗ From bjn the cycle goes to end, then to start and to x1 . To visit all groups Ai for i 6= i∗ and Bj for j 6= j ∗ , do the following. From xi where i < i∗ , the cycle continues to gadgets ai1 , then to ai2 , ai3 , . . . , aim following Path 0, and continue to yi , xi+1 . i+1 i+1 From xi where i∗ ≤ i ≤ r it goes to ai+1 and continues with yi , xi+1 . 1 , a2 , . . . , an B. M. P. Jansen and A. Pieterse 13 Similarly, from xi where r ≤ i < j ∗ , go through gadgets bi1 , . . . , bin and continue to yi , xi+1 . i+1 From xi where j ∗ ≤ i ≤ 2r, go to gadgets bi+1 and continue to yi , for i 6= 2r 1 , . . . , bn then add the arc (yi , xi+1 ). ∗ From y2r , continue to next, after which the arc (next, bj1 ) closes the cycle. By definition, no vertex is visited twice, so it remains to check that every vertex of G0 is in the cycle. For vertices start, next, end and all vertices xi , yi , zi this is obvious. All vertices in Ai and Bj where i 6= i∗ and j 6= j ∗ are in the cycle between some x` and y` . All vertices in Ai∗ and Bj ∗ are visited since P was a Hamiltonian path on these vertices. J √ √ √ The number of vertices of G0 is 3(m + n) t + 3 · 2( t − 1) + 3 = O( t · (m + n)) = √ O( t · max |Xi,j |). By with Lemma 17 the construction is a degree-2 cross-composition from Hamiltonian s − t-paths in Bipartite graphs to Directed Hamiltonian cycle parameterized by the number of vertices, proving the generalized kernel lower bound for the directed problem. Karp [19] gave a polynomial-time reduction that, given an n-vertex directed graph G, produces an undirected graph G0 with 3n vertices such that G has a directed Hamiltonian cycle if and only if G0 has a Hamiltonian cycle. This is a linear parameter transformation from Directed Hamiltonian cycle to Hamiltonian cycle. Since linear-parameter transformations transfer lower bounds [3, 4], we conclude that (Directed) Hamiltonian cycle does not have a generalized kernel of size O(n2−ε ) for any ε > 0. J 5 Dominating set In this section we discuss the Dominating Set problem and its variants. Dom et al. [9] proved several kernelization lower bounds for the variant Red-Blue Dominating Set, which is the variant on bipartite (red/blue colored) graphs in which the goal is to dominate all the blue vertices by selecting a small subset of red vertices. Using ideas from their kernel lower bounds for the parameterization by either the number of red or the number of blue vertices, we prove sparsification lower bounds for (Connected) Dominating Set. Since we parameterize by the number of vertices, the same lower bounds apply to the dual problems Nonblocker and Max Leaf Spanning Tree. We will prove these sparsification lower bounds using a degree-2 cross-composition, starting from a variation of the Colored Red-Blue Dominating Set problem (Col-RBDS) as described by Dom et al. in [9]. Equal-Sized Colored Red/Blue Dominating Set (Eq-Col-RBDS) Input: A bipartite graph G = (R ∪ B, E), where R is partitioned into k subsets R1 , . . . , Rk , such that |R1 | = |R2 | = . . . = |Rk |. Question: Is there a set S ⊆ R such that for each i ∈ [k] the set S contains exactly one vertex of Ri and every vertex in B is adjacent to at least one vertex from S. We will think of the vertices in set Ri as having color i. Hence the question is whether there is a set S ⊆ R containing exactly one vertex of each color, such that every vertex in B is adjacent to at least one vertex in S. I Lemma 18. eq-Col-RBDS is NP-complete. Proof. Dom et al. [9] proved the NP-completeness of Colored RBDS without the constraint that all color sets have equal size. The NP-completeness for the equal-sized version follows from the fact that we may repeatedly add isolated vertices to classes Ri that are too small, without changing the answer. J 14 Sparsification Upper and Lower Bounds for Graphs Problems and Not-All-Equal SAT Using this result, we can now give a degree-2 cross-composition and prove the following. I Theorem 19. (Connected) Dominating Set, Nonblocker, and Max Leaf Spanning Tree parameterized by the number of vertices n do not have a generalized kernel of size O(n2−ε ) for any ε > 0, unless NP ⊆ coNP/poly. Proof. A graph has a nonblocker of size k if and only if it has a dominating set of size n − k. Furthermore, the Maximum Leaf Spanning Tree problem is strongly related to Connected Dominating Set. The internal vertices of any spanning tree form a connected dominating set. Conversely, any connected dominating set contains a subtree spanning the dominating set, which – by the domination property – can be greedily extended to a spanning tree for the entire graph in which the remaining vertices are leaves. Hence a graph has a connected dominating set of size at most k if and only if it has a spanning tree with at least n − k leaves. Therefore we will show this result for (Connected) Dominating Set only. Define a polynomial equivalence relation R on instances of eq-Col-RBDS by first of all letting all instances where there is a vertex in B of degree 0 be in the same class, note that these are always no-instances. Let 2 instances (G = (R ∪ B), k) and (G0 = (R0 ∪ B 0 ), k 0 ) of eq-Col-RBDS be equivalent if |R| = |R0 | , |B| = |B 0 | and k = k 0 . It is easy to see that R indeed is a polynomial equivalence relation. √ √ Suppose we are given t instances of eq-Col-RBDS, such that t and log √ t ∈ N and such that all given instances are in the same equivalence class of R. Let t0 := t. If these instances are from the class where B contains a vertex of degree 0, output a constant size no-instance. Otherwise, label the given instances as Xi,j with i, j ∈ [t0 ]. Let instance Xi,j have graph ∗ ∗ ∗ ∗ ∗ Gi,j , which is bipartite with vertex set Ri,j ∪ Bi,j . Let |Ri,j | = m and |Bi,j | = n and let Ri,j ∗p ∗p 0 be partitioned into k color classes Ri,j for all i, j ∈ [t ] and p ∈ [k]. Label all vertices in Ri,j ∗ as rp,q (i, j) with p ∈ [k] and q ∈ [m/k], which means that this vertex is the q’th vertex of ∗ color p from instance Xi,j . Label vertices in Bi,j as b∗1 (i, j), . . . , b∗n (i, j) arbitrarily. We now create an instance (G, k) for Dominating Set using the following steps. A sketch of G can be found in Figure 6. i 1. Add vertices rp,q for p ∈ [k], q ∈ [m/k] and i ∈ [t0 ]. The dominating set problem does not use colored instances, however we will remember the color of these vertices for i simplicity. Let vertex rp,q have color p, for i ∈ [t0 ], q ∈ [m/k] and p ∈ [k]. Define S i Ri := {rp,q | p ∈ [k], q ∈ [m/k]} and let R := i∈[t0 ] Ri . Give every set Ri a unique identifier id(Ri ), which is a subset of K := 2 + k + log t0 numbers in the range [2K]. 2. Add vertices bj` for ` ∈ [n] and j ∈ [t0 ]. Define Bj and B as Bj := {bj` | ` ∈ [n]} and S B := j∈[t0 ] Bj . i ∗ 3. Add edges between the vertices rp,q and bj` for p ∈ [k], q ∈ [m/k] and i, j ∈ [t0 ] if rp,q (i, j) ∗ is connected to b` (i, j) in instance Xi,j . This ensures that the graph induced by Ri ∪ Bj ∗ is exactly Gij, and the coloring of vertices in Ri matches the coloring of Ri,j . 0 0 4. Add vertices s and s and edge {s , s}. Furthermore, add edges between s and all vertices in R. The degree-1 vertex s0 ensures there is a minimum dominating set containing s, which covers all vertices in R “for free”. 5. In a similar way as given by Dom et al. in [9], for every pair of colors (c1 , c2 ) ∈ {1, . . . , k}× (c ,c ) (c ,c ) {1, . . . , k} with c1 6= c2 we add a vertex set W(c1 ,c2 ) = {w1 1 2 , . . . , w2K1 2 }. For (c ,c ) x ∈ [2K] connect wx 1 2 to all vertices of color c1 in Ri if x ∈ id(Ri ), otherwise connect (c ,c ) wx 1 2 to all vertices of color c2 in Ri . This construction is used to choose which Ri is part of a solvable input instance Xij for some j ∈ [t0 ]. This idea is formalized in Lemmas 22 and 23. B. M. P. Jansen and A. Pieterse 15 id(R1 ) = {1} B1 R1 W(c1 ,c2 ) (c ,c2 ) w1 1 t01 (c ,c2 ) w2 1 s W(c2 ,c1 ) t21 (c ,c1 ) w1 2 t11 s0 (c ,c1 ) w2 2 R2 id(R2 ) = {2} R B2 B Figure 6 A sketch of G, where t0 = 2, m = 6 , n = 5 and k = 2. Thereby K should be 5 and W(c1 ,c2 ) should contain 10 vertices. In this example we show the constructed graph when choosing K = 1 for simplicity. We use the two colors c1 and c2 , corresponding to white and black in the figure. Edges from R to B are left out for simplicity. 6. Then, add log t0 triangles, with vertices {t0` , t1` , t2` } for ` ∈ [log t0 ]. Connect t0` to all vertices in Bj if the `’th bit of j equals 0, connect t1` to all vertices in Bj if the `’th bit of j equals 1. Define T to be the union of all these triangles. By choosing exactly one of the vertices t0` or t1` in a dominating set for each `, all groups Bj except one are dominated automatically. The non-dominated one should then be part of a solvable input instance. 7. Finally, add the edges {{s, ti` } | ` ∈ [log t0 ], i ∈ {0, 1}}. This step ensures that every vertex in T that is contained in the dominating set has s as a neighbor in the dominating set, which implies that there is always a minimum dominating set that is connected. We now make the following observations. I Lemma 20. If G has a dominating set D, then it also has a dominating set D0 of size at most |D| that does not contain any vertices from B. Proof. Suppose we are given a minimum dominating set D of G, where vertex v ∈ B is present. In any dominating set, s or s0 must be present. If s0 is present and s is not, we replace s0 by vertex s, and still obtain a valid dominating set of the same size. As such, all vertices in R are now dominated by s. Vertices t0` and t1` with ` ∈ [log t0 ] are dominated by s. Since t2` only has neighbors t1` and t0` , at least one of these three vertices is present in D for every ` ∈ [log t0 ], hereby every vertex in T has a neighbor in D. Since B is an independent set in G, the vertex v does not dominate other vertices in B. Since the polynomial equivalence relation ensures that there are no isolated vertices in B, vertex v has at least one neighbor u in R. We can safely replace v by u to obtain a valid dominating set that has the same size as D and does not contain any vertices from B. J I Lemma 21. Any dominating set of G of size at most k + 1 + log t0 contains at least 1 + log t0 vertices from {s, s0 } ∪ {t0` , t1` , t2` | ` ∈ [log t0 ]} and thus contains at most k vertices from R. Proof. In a dominating set D of G, at least log t0 vertices are needed from T , since t2` only has neighbors t1` and t0` , so one of these vertices must be in D for each ` ∈ [log t0 ]. Furthermore 16 Sparsification Upper and Lower Bounds for Graphs Problems and Not-All-Equal SAT at least one of the vertices s0 or s must be present, therefore there are 1 + log t0 vertices in the set that are not from R. J I Lemma 22. Any dominating set of G of size at most k + 1 + log t0 uses exactly one vertex of each color from R. Proof. Suppose a dominating set of G of size at most k + 1 + log t0 uses less than k colors from R. If at most k − 2 colors are used, there must be two colors c1 and c2 that are not present in the set. However, this implies that all 2K vertices in W (c1 ,c2 ) are not dominated by vertices in R and must therefore be in the set. This contradicts the maximum size of the dominating set, since K = k + 2 + log t0 . So, we are left with the possibility of using k − 1 colors. Consider some color c1 that was not used. Look at another color c2 that is used exactly once, such a color exists by Lemma 21. Suppose the vertex of color c2 in the dominating set was from set Ri for some i ∈ [t0 ]. Then for any x ∈ id(Ri ) we have that (c ,c ) wx 1 2 is not connected to any vertex in the dominating set and therefore must be in the dominating set itself. Since id(Ri ) contains K numbers, there are K vertices that are not dominated by R, which contradicts the maximum size of the dominating set. J I Lemma 23. For any dominating set D of G of size at most k + 1 + log t0 , there exists i ∈ [t0 ] such that all vertices in D ∩ R are contained in set Ri . Proof. Suppose there exists two vertices u, v ∈ D such that u ∈ Ri and v ∈ Rj for some i 6= j. By Lemma 22, u and v have different colors. Suppose u has color cu and v has color / id(Rj ). By Step 5 of cv . Since Ri 6= Rj , there exists x ∈ [2K] such that x ∈ id(Ri ) and x ∈ (cu ,cv ) the construction, this means that none of the neighbors of vertex wx are contained in the dominating set. However, this vertex is not in D and therefore D is not a dominating set of G, which is a contradiction. J Using the previous Lemmas, we obtain: I Lemma 24. 1. If there is an input Xi∗ ,j ∗ that has a col-RBDS of size k, then G0 has a connected dominating set of size k + 1 + log t0 . 2. If G0 has a (not necessarily connected) dominating set of size k + 1 + log t0 , then some input Xi∗ ,j ∗ has a col-RBDS of size k. Proof. (1) Let Xi∗ ,j ∗ have a colored RBDS D of size at most k, then we can construct a ∗ i dominating set D0 of G in the following way. For any vertex rp,q in D, add vertex rp,q to D0 . 0 0 0 ∗ Furthermore add the vertex s to D . Then add vertex t` to D if the q’th bit of j is 1, add vertex t1` otherwise. Now s0 is dominated and all vertices in R have neighbor s in D0 . All vertices in Bj ∗ are covered by the vertices in the dominating set from Ri∗ , since D was a col-RBDS of Xi∗ ,j ∗ . All vertices in Bj for j 6= j ∗ have neighbor t0` or t1` in D0 for some ` ∈ [log t0 ], since the bit representation of j must differ from the one of j ∗ at some position. It now follows from Step 6 of the construction that all vertices in Bj are connected to a vertex in the dominating set. It remains to verify that all vertices in W have a neighbor in D0 . (c ,c ) Consider wx 1 2 for x ∈ [2K] and c1 , c2 ∈ [k]. If x ∈ id(Ri∗ ), then this vertex is connected to all vertices of color c1 and exactly one of them is contained in D0 . If x ∈ / id(Ri∗ ), the (c1 ,c2 ) ∗ vertex wx is connected to all vertices of color c2 in Ri and again one vertex of this color in Ri∗ is contained in D0 . So D0 is a dominating set of G and it is easy to verify that |D0 | = k + 1 + log t0 . Furthermore, D0 is constructed in such a way that it is connected. We can show this by proving that every vertex in D0 is a neighbor of s, since we chose s in D. Vertices in D0 ∩ R and D0 ∩ T are neighbors of s, by Steps 4 and 7 of the construction of G. B. M. P. Jansen and A. Pieterse The vertex s0 and vertices from W and B are not contained in D0 . Thus, D0 is a connected dominating set. (2) Let D0 be a dominating set of G of size at most k + 1 + log t0 . Using Lemma 20 we modify D0 such that it chooses no vertices from B, without increasing its size. By Lemma 22 and 23, D0 contains exactly k vertices from R, all from the same Ri∗ for some i∗ and all of different color. D0 has size at most k + 1 + log t of which k are contained in R and one in {s, s0 }. Combined with the fact that for any ` ∈ [log t0 ] vertex t2` has t1` and t0` as its only two neighbors, it follows that exactly one of these three vertices is contained in D0 for all `. Therefore D0 contains at most one of the vertices t0` or t1` for every ` ∈ [log t0 ]. We can now define x` ∈ {0, 1} for ` ∈ [log t0 ], such that tx` ` ∈ / D0 for all ` ∈ [log t0 ]. Consider the index j ∗ ∈ [t] given by the binary representation [x1 x2 . . . xlog t0 ]2 . It follows from the bit representation of j ∗ that the vertices in Bj ∗ are not connected to any of the vertices in D0 ∩ T . Since vertices in Bj ∗ are only adjacent to vertices in R and vertices of T , it follows that every vertex in Bj ∗ has a neighbor in R that is in D0 . This implies that every vertex in Bj ∗ has a neighbor in D0 ∩ Ri∗ . Since G[Ri∗ ∪ Bj ∗ ] is isomorphic to the graph of instance Xi∗ ,j ∗ , it follows that Xi∗ ,j ∗ has a col-RBDS of size at most k, which are exactly the vertices in D0 ∩ Ri∗ . J  Given t instances, the graph G constructed above has n·t0 +m·t0 +2+3·log t0 +2 k2 ·2K = √ O( t max |Xi,j |2 ) vertices. It is straightforward to construct G in polynomial time. It follows from Lemma 24 that G has a dominating set of size k + 1 + log t0 , if and only if one of the input instances has a col-RBDS of size k. Furthermore, G has a connected dominating set of size k + 1 + log n if and only if one of the input instances has a col-RBDS of size k. Therefore we have given a degree-2 cross-composition to (Connected) Dominating Set. Using Theorem 3 it follows that Dominating Set and Connected Dominating Set do not have a generalized kernel of size O(n2−ε ) for any ε > 0, unless NP ⊆ coNP/poly. J Just as the sparsification lower bounds for Vertex Cover that were presented by Dell and van Melkebeek [8] had implications for the parameterization by the solution size k, Theorem 19 has implications for the kernelization complexity of k-Nonblocker and k-Max Leaf. Since the solution size k never exceeds the number of vertices in this problem, a kernel with O(k 2− ) edges would give a nontrivial sparsification, contradicting Theorem 19. Hence our results show that the existing linear-vertex kernels for k-Nonblocker [6] and k-Max Leaf [11] cannot be improved to O(k 2−ε ) edges unless NP ⊆ coNP/poly. 6 d-Hypergraph 2-Colorability and d-NAE-SAT The goal of this section is to give a nontrivial sparsification algorithm for nae-sat and prove a matching lower bound. For ease of presentation, we start by analyzing the closely related hypergraph 2-colorability problem. Recall that a hypergraph consists of a vertex set V and a set E of hyperedges; each hyperedge e ∈ E is a subset of V . A 2-coloring of a hypergraph is a function c : V → {1, 2}; such a coloring is proper if there is no hyperedge whose vertices all obtain the same color. We will use d-Hypergraph 2-Colorability to refer to the setting where hyperedges have size at most d. The corresponding decision problem asks, given a hypergraph, whether it is 2-colorable. I Theorem 25. d-Hypergraph 2-Colorability parameterized by the number of vertices n has a kernel with 2 · nd−1 hyperedges that can be encoded in O(nd−1 · d · log n) bits. 17 18 Sparsification Upper and Lower Bounds for Graphs Problems and Not-All-Equal SAT Proof. Suppose we are given a hypergraph with vertex set V and hyperedges E, where each hyperedge contains at most d vertices. We show how to reduce the number of hyperedges without changing the 2-colorability status. Let Er ⊆ E denote the set of edges in E that contain exactly r vertices. For each Er we construct a set Er0 ⊆ Er of representative hyperedges. Enumerate the edges in Er as er1 , . . . , erk . We construct a (0, 1)-matrix Mr with n N := r−1 rows and k columns. Consider all possible subsets A1 , . . . , AN of size r − 1 of the set of vertices V . Define the elements mi,j for i ∈ N and j ∈ k of Mr as follows.  1 if Ai ⊆ erj ; mi,j := 0 otherwise. Using Gaussian elimination, compute a basis B of the columns of this matrix, which is a subset of the columns that span the column space of Mr . Let Er0 contain edge eri if the i’th S column of Mr is contained in B, and define E 0 := r∈[d] Er0 , which forms the kernel. Using a lemma due to Lovász [20], we can prove that E 0 preserves the 2-colorability status. I Lemma 26 ([20]). Let H be an r-uniform hypergraph with edges E1 , . . . , Em . α1 , . . . , αm be real numbers such that for every (r − 1)-element subset A of V (H), X αi = 0. Let Ei ⊃A Then for every partition {V1 , V2 } of V (H) the following holds: X X αi = (−1)r αi . Ei ⊆V1 Ei ⊆V2 Now we can prove the correctness of the presented kernel. I Lemma 27. (V, E) has a proper 2-coloring ⇔ (V, E 0 ) has a proper 2-coloring. Proof. (⇒) Clearly, if (V, E) has a proper 2-coloring, then the same coloring is proper for the subhypergraph (V, E 0 ) since E 0 ⊆ E. (⇐) Now suppose (V, E 0 ) has a proper 2-coloring. We will show that for each r ∈ [d], no edge of Er is monochromatic under this coloring. All hyperedges contained in Er0 are 2-colored by definition. Suppose there exists r ∈ [d], such that Er contains a monochromatic hyperedge. Let Er = er1 , . . . , erk and let ei∗ be a hyperedge in Er whose vertices all receive the same color. By reordering the matrix Mr , we may assume that the basis B of Mr contains the first ` columns, thus i∗ > `. Let mi denote the i’th column of Mr . Since mi∗ is not contained in the basis, there exist coefficients α1 , . . . , α` such that ` X αi · mi = mi∗ . i=1 For i ∈ [k], define:   αi if i ≤ `; βi := −1 if i = i∗ ;  0 otherwise. From this definition of β it follows that k X i=1 βi · mi = ` X i=1 αi · mi − mi∗ = 0. B. M. P. Jansen and A. Pieterse 19 Let Aj be any size (r − 1)-subset of V . Since mi,j = 1 exactly when ei ⊇ Aj , and 0 otherwise, we have: X ei ⊃Aj βi = k X βi mi,j = 0. i=1 By Lemma 26 we obtain that for any partitioning V1 ∪ V2 of the vertices in V , X X βi = (−1)r βi . ei ⊆V1 (1) ei ⊆V2 Consider however the partitioning (V1 , V2 ) given by the 2-coloring of the vertices. Then every edge ei ∈ Er0 contains at least one vertex of each color and is thereby not fully contained in V1 or V2 . As such, these edges contribute 0 to both sides of the equation. The edge ei∗ is the only remaining edge with a non-zero coefficient and by assumption, it is contained entirely P within one color class. Without loss of generality, let ei∗ ⊆ V1 . But then ei ⊆V1 βi = −1 P while (−1)r ei ⊆V2 βi = 0, which contradicts (1). J To bound the size of the kernel, consider the matrix Mr for r ∈ [d]. Its rank  is bounded n by the minimum of its number of rows and columns, which is at most r−1 ≤ nr−1 . As P d such, we get |Er0 | ≤ rank(Mr ) ≤ nr−1 . Note that d ≤ n, such that |E 0 | ≤ r=1 nr−1 = Pd−1 r−1 d−1 d−1 0 d−1 ≤ 2 · n . So E contains at most 2n n + r=1 n hyperedges. Since a hyperedge consists of at most d vertices, the kernel can be encoded in O(nd−1 · d · log n) bits. J By a folklore reduction, Theorem 25 gives a sparsification for nae-sat. Consider an instance of d-nae-sat, which is a conjunction of clauses of size at most d over variables x1 , . . . , xn . The formula gives rise to a hypergraph on vertex set {xi , ¬xi | i ∈ [n]} containing one hyperedge per clause, whose vertices correspond to the literals in the clause. When additionally adding n hyperedges {xi , ¬xi } for i ∈ [n], it is easy to see that the resulting hypergraph is 2-colorable if and only if there is a NAE-satisfying assignment to the formula. The maximum size of a hyperedge matches the maximum size of a clause and the number of created vertices is twice the number of variables. We can therefore sparsify an n-variable instance of d-nae-sat in the following way: reduce it to a d-hypergraph with n0 := 2n vertices and apply the kernelization algorithm of Theorem 25. It is easy to verify that restricting the formula to the representative hyperedges in the kernel gives an equisatisfiable formula containing 2 · (n0 )d−1 ∈ O(2d−1 nd−1 ) clauses, giving a sparsification for nae-sat. As mentioned in the introduction, the existence of a linear-parameter transformation [18] from d-cnf-sat to (d + 1)-nae-sat also implies a sparsification lower bound for d-nae-sat, using the results of Dell and van Melkebeek [8]. Hence we obtain the following theorem. I Theorem 28. For every fixed d ≥ 4, the d-nae-sat problem parameterized by the number of variables n has a kernel with O(nd−1 ) clauses that can be encoded in O(nd−1 · log n) bits, but admits no generalized kernel of size O(nd−1−ε ) for ε > 0 unless NP ⊆ coNP/poly. 7 Conclusion We have added several classic graph problems to a growing list of problems for which non-trivial polynomial-time sparsification is provably impossible under the assumption that NP * coNP/poly. Our results for (Connected) Dominating Set proved that the linearvertex kernels with Θ(k 2 ) edges for k-Nonblocker and k-Max Leaf Spanning Tree cannot be improved to O(k 2−ε ) edges unless NP ⊆ coNP/poly. 20 Sparsification Upper and Lower Bounds for Graphs Problems and Not-All-Equal SAT The graph problems for which we proved sparsification lower bounds can be defined in terms of vertices: the 4-Coloring problem asks for a partition of the vertex set into four independent sets, Dominating Set asks for a dominating subset of vertices, and Hamiltonian Cycle asks for a permutation of the vertices that forms a cycle. In contrast, not much is known concerning sparsification lower bounds for problems whose solution is an edge subset of possibly quadratic size. For example, no sparsification lower bounds are known for well-studied problems such as Max Cut, Cluster Editing, or Feedback Arc Set in Tournaments. Difficulties arise when attempting to mimic our lower bound constructions for such edge-based problems. Our constructions all embed t instances into √ a 2 × t table, using each combination of a cell in the top row and bottom row to embed one input. For problems defined in terms of edge subsets, it becomes difficult to “turn off” the contribution of edges that are incident on vertices that do not belong to the two cells that correspond to a yes-instance among the inputs to the or-construction. This could be interpreted as evidence that edge-based problems such as Max Cut might admit non-trivial polynomial sparsification. We have not been able to answer this question in either direction, and leave it as an open problem. For completeness, we point out that Karp’s reduction [19] from Vertex Cover to Feedback Arc Set (which only doubles the number of vertices) implies, using existing bounds for Vertex Cover [8], that Feedback Arc Set does not have a compression of size O(n2−ε ) unless NP ⊆ coNP/poly. Another problem whose compression remains elusive is 3-Coloring. In several settings (cf. [12]), the optimal kernel size matches the size of minimal obstructions in a problem-specific partial order. This is the case for d-nae-sat, whose kernel with O(nd−1 ) clauses matches the fact that critically 3-chromatic d-uniform hypergraphs have at most O(nd−1 ) hyperedges. Following this line of reasoning, it is tempting to conjecture that 3-Coloring does not admit subquadratic compressions: there are critically 4-chromatic graphs with Θ(n2 ) edges [22]. The kernel we have given for d-nae-sat is one of the first examples of non-trivial polynomial-time sparsification for general structures that are not planar or similarly guaranteed to be sparse. Obtaining non-trivial sparsification algorithms for other problems is an interesting challenge for future work. Are there natural problems defined on general graphs that admit subquadratic sparsification? References 1 Hans L. Bodlaender, Rodney G. Downey, Michael R. Fellows, and Danny Hermelin. On problems without polynomial kernels. J. Comput. Syst. Sci., 75(8):423–434, 2009. 2 Hans L. Bodlaender, Bart M. P. Jansen, and Stefan Kratsch. Kernel bounds for path and cycle problems. Theor. Comput. Sci., 511:117–136, 2013. 3 Hans L. Bodlaender, Bart M. P. Jansen, and Stefan Kratsch. Kernelization lower bounds by cross-composition. SIAM J. Discrete Math., 28(1):277–305, 2014. 4 Hans L. Bodlaender, Stéphan Thomassé, and Anders Yeo. Kernel bounds for disjoint cycles and disjoint paths. Theor. Comput. Sci., 412(35):4570–4578, 2011. 5 Marek Cygan, Fabrizio Grandoni, and Danny Hermelin. Tight kernel bounds for problems on graphs with small degeneracy. In Proc. 21st ESA, pages 361–372, 2013. 6 Frank K. H. A. Dehne, Michael R. Fellows, Henning Fernau, Elena Prieto, and Frances A. Rosamond. NONBLOCKER: parameterized algorithmics for minimum dominating set. In Proc. 32nd SOFSEM, pages 237–245, 2006. 7 Holger Dell and Dániel Marx. Kernelization of packing problems. In Proc. 23rd SODA, pages 68–81, 2012. B. M. P. Jansen and A. Pieterse 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 Holger Dell and Dieter van Melkebeek. Satisfiability allows no nontrivial sparsification unless the polynomial-time hierarchy collapses. J. ACM, 61(4):23:1–23:27, 2014. Michael Dom, Daniel Lokshtanov, and Saket Saurabh. Kernelization lower bounds through colors and IDs. ACM Trans. Algorithms, 11(2):13:1–13:20, 2014. David Eppstein, Zvi Galil, Giuseppe F. Italiano, and Amnon Nissenzweig. Sparsification a technique for speeding up dynamic graph algorithms. J. ACM, 44(5):669–696, 1997. Vladimir Estivill-Castro, Michael Fellows, Michael Langston, and Frances Rosamond. FPT is P-time extremal structure I. In Proc. 1st ACiD, pages 1–41, 2005. Michael R. Fellows and Bart M. P. Jansen. FPT is characterized by useful obstruction sets: Connecting algorithms, kernels, and quasi-orders. TOCT, 6(4):16, 2014. Lance Fortnow and Rahul Santhanam. Infeasibility of instance compression and succinct PCPs for NP. J. Comput. Syst. Sci., 77(1):91–106, 2011. Michael R. Garey and David S. Johnson. Computers and Intractability. W.H. Freeman, 1979. Danny Hermelin and Xi Wu. Weak compositions and their applications to polynomial lower bounds for kernelization. In Proc. 23rd SODA, pages 104–113, 2012. Russell Impagliazzo, Ramamohan Paturi, and Francis Zane. Which problems have strongly exponential complexity? J. Comput. Syst. Sci., 63(4):512–530, 2001. Bart M. P. Jansen. On sparsification for computing treewidth. Algorithmica, 71(3):605–635, 2015. Bart M. P. Jansen and Stefan Kratsch. Data reduction for graph coloring problems. Information and Computation, 231:70–88, 2013. Richard M. Karp. Reducibility Among Combinatorial Problems. In Complexity of Computer Computations, pages 85–103. Plenum Press, 1972. Lásló Lovász. Chromatic number of hypergraphs and linear algebra. In Studia Scientiarum Mathematicarum Hungarica 11, pages 113–114, 1976. George L. Nemhauser and Leslie E. Trotter Jr. Vertex packings: structural properties and algorithms. Math. Program., 8:232–248, 1975. Bjarne Toft. On the maximal number of edges of critical k-chromatic graphs. Studia Scientiarum Mathematicarum Hungarica, 5:461–470, 1970. 21
8cs.DS
Upper and lower bounds for dynamic data structures on strings Raphael Clifford∗1 , Allan Grønlund†2 , Kasper Green Larsen‡2 , and Tatiana Starikovskaya§ 3 University of Bristol, Department of Computer Science, Bristol, U.K. Aarhus University, Department of Computer Science, Aarhus, Denmark 3 École Normale Supérieure, Department of Computer Science, Paris, France 1 arXiv:1802.06545v1 [cs.DS] 19 Feb 2018 2 February 20, 2018 Abstract We consider a range of simply stated dynamic data structure problems on strings. An update changes one symbol in the input and a query asks us to compute some function of the pattern of length m and a substring of a longer text. We give both conditional and unconditional lower bounds for variants of exact matching with wildcards, inner product, and Hamming distance computation via a sequence of reductions. As an example, we show that there does not exist an O(m1/2−ε ) time algorithm for a large range of these problems unless the online Boolean matrix-vector multiplication conjecture is false. We also provide nearly matching upper bounds for most of the problems we consider. 1 Introduction The search for lower bounds provides one of the greatest challenges in computer science. Progress in finding better truly unconditional lower bounds continues in slow but steady steps. There appears however, in the short term at least, to be no realistic prospect of finding unconditional lower bounds which are polynomial in the size of the input. One of the most exciting discoveries in recent years has been that such polynomial lower bounds can be given for a range of problems in P conditional on the hardness of a small set of well known and conjectured to be hard problems [2, 3, 14, 10, 1, 16]. These include the Strong Exponential Time Hypothesis (SETH), 3-SUM and online Boolean matrix-vector product (OMv). In this paper we study the hardness of a number of simply stated dynamic string problems and show both conditional lower bounds based on the OMv conjecture (see Conjecture 1 for a precise statement) as well as unconditional lower bounds. We will also give new upper bounds which in many cases will nearly match our new conditional lower bounds. Each problem will have the following form. Problem 1. Consider a text T of length n and a pattern P of length m. An update to the pattern (or text) is a pair (j, σ) which indicates that the letter at index j in the pattern (or text) is to be substituted with the letter σ. The task is to develop a dynamic data structure on P and T that supports the following queries: Given a position i of T , output f (P, T [i, . . . , i + m − 1]). Unless stated otherwise, we allow updates to both the pattern P and the text T . The different functions f we will consider are Hamming distance (DynHD), inner product (DynIP) and exact matching with ∗ [email protected]. Supported by EPSRC fellowship EPJ0192831. Supported by Center for Massive Data Algorithmics, a Center of the Danish National Research Foundation, grant DNRF84. ‡ [email protected]. Supported by a Villum Young Investigator grant, an AUFF starting grant and by Center for Massive Data Algorithmics, a Center of the Danish National Research Foundation, grant DNRF84. § [email protected][email protected]. 1 DynHD DynIP DynEM Mode Alphabet Upper bounds Cond. lower bounds Uncond. lower bounds exact polynom. √ O( m log m) Ω(m1/2−δ ) Ω(log m/ log log m) exact mod 2 approx. polynom. {0, 1} polynom. constant polynom. {0, 1} {0, 1, 2} √ O( m log m) √ O(√m log m) O( m log m) √ O( m log m) O(m3/4 log1/2 m) O(log m/ log log m) √ O( m log m) Ω(m1/2−δ ) Ω(m1/2−δ ) Ω(m1/2−δ ) Ω(m1/2−δ ) Ω(m1/2−δ ) — Ω(m1/2−δ ) Ω((log m/ log log m)2 ) Ω((log1/2 m/ log log m)3 ) Ω(log m/ log log m) Ω((log1/2 m/ log log m)3 ) Ω((log1/2 m/ log log m)3 ) Ω(log m/ log log m) Ω((log1/2 m/ log log m)3 ) exact mod 2 Table 1: Update/query time bounds for DynEM, DynHD, and DynIP for a text T of length m ≤ n ≤ 2m and a pattern P of length m. For the conditional lower bounds, δ > 0 is an arbitrary constant. Bounds for (1 + ε)-approximate DynHD are not shown (see Section 4 for details). wildcards (DynEM). These functions have formed the core of pattern matching with errors and wildcards for many years and have been extensively studied in both the standard offline pattern matching setting and to a lesser extent online and streaming. To the best of our knowledge, this is the first exploration of the complexity of pattern matching with errors √ and wildcards as a fully dynamic data structure problem. By way of preparation, we give O( m log m) query and update times for exact inner product, exact matching with wildcards, and for dynamic Hamming distance over constant-sized alphabets, as well as O(m3/4 log1/4 m)-time algorithm for dynamic Hamming distance over polynomial-size alphabets. These algorithms are derived via a lazy rebuilding scheme. We then show in Theorem 4 that there does not exist an O(m1/2−ǫ ) time solution to any of these problems unless the online Boolean matrix-vector conjecture is false. The lower bound for dynamic exact matching with wildcards is particularly interesting as it is exponentially higher than the known O(log m) time complexity for dynamic exact matching without wildcards. Our conditional lower bound also extends to (1 + ε)-approximate DynIP, DynIP modulo 2 and remarkably, to DynHD modulo 2 with a ternary input alphabet. This latter result is in stark contrast to the complexity of DynHD modulo 2 with a binary input alphabet which we show in Lemma 7 can be solved in O(log m/ log log m) query and update time. We complement all these conditional lower bounds with a set of unconditional lower bounds derived via reductions from different 2d-dynamic range counting problems. First we show that DynIP is at least as hard as weighted 2d-range counting. As a result, we get an unconditional lower bound of Ω((log m/ log log m)2 ) for DynIP. This matches the highest unconditional lower bound known for any dynamic data structure problem. We then go on to show Ω((log1/2 m/ log log m)3 ) unconditional lower bounds for DynHD over binary alphabets, DynIP modulo 2 over binary alphabets and DynHD modulo 2 over ternary alphabets. These lower bounds are derived from a recent breakthrough in the complexity of the unweighted version of 2d-range counting. To finish our unconditional lower bounds we then show Ω(log m/ log log m) unconditional lower bounds for DynHD modulo 2 over binary alphabets, DynEM and (1 + ε)-approximate DynIP. As our final set of dynamic problems, we move on to consider (1 + ε)-approximate DynHD for which we do not have matching conditional lower bounds, despite its superficial similarity to approximate DynIP. Unlike for approximate DynIP and exact DynHD, in Section 4 we show markedly different upper bounds for approximate DynHD depending on whether updates may occur in only the pattern and text or in both. For the former case we derive O(ε−c polylog m) time algorithms via Johnson-Lindenstrauss sketching. The exact value of c depends on the size of the input alphabet and in fact for some update operations the running time dependency on log m is completely removed. For the latter case with updates in both the pattern and text, √ our upper bound is O(ε−2 m polylog m) time. It is an interesting and open question whether there exist matching conditional lower bounds for these versions of approximate DynHD as well. We give a summary of the results in Table 1. 2 2 Related work In the dynamic setting we consider with single character updates, the most closely related previous work considers the problem of dynamic exact matching. In [8] an O(log log m) time algorithm was shown for dynamic exact matching when updates are only permitted in the text [8]. In [5] a more general data structure was developed supporting insertion and deletion of characters and movements of arbitrary large blocks of text. This was improved in a succession of papers culminating in the work [21] who give a data structure that supports, amongst other properties, concatenation, splitting and equality testing in O(log m) update and O(1) query time. The same data structure solves, for example, the dynamic exact matching problem without wildcards problem in O(log m) time. At the expense of O(log2 m) updates this latter work also supports finding occurrences of a specified pattern P in O(|P |) time. A separate line of work has considered the static data structure problem of text indexing for approximate matching [12, 7, 19, 13, 23, 13, 9]. There has also been a number of papers working on conditional hardness for other types of string problems. Larsen et al. proved lower bounds for document retrieval and forbidden pattern document retrieval conditional on hardness of boolean matrix multiplication [29]. Later, Kopelowitz et al. showed 3SUM-conditional lower bounds for these two problems [26]. Backurs and Indyk [10] proved lower bounds computing the edit distance of two string. Bringmann and Künnemann [16] proved lower bounds for dynamic time warping and longest common subsequence. Finally, Backurs and Indyk [11] and follow up work by Bringmann et al. [15] proves conditional lower bounds for regular expression matching. 3 Upper bounds for DynHD, DynIP, and DynEM In this section we show upper bounds for DynIP, DynHD, and DynEM problems. Recall that a query i asks for f (P, T [i, . . . , i + m − 1]). For DynIP we define f (P, T [i, . . . , i + m − 1]) to be equal to the inner product of P and T [i, . . . , i + m − 1], for DynHD the Hamming distance between P and T [i, . . . , i + m − 1]. In the DynEM problem we assume that P and T are strings over Σ ∩ {?}, where Σ is an integer alphabet and ? is a special wildcard symbol that matches any letter in Σ. We define f (P, T [i, . . . , i + m − 1]) to be equal to zero if P matches T [i, . . . , i + m − 1] and the number of mismatching positions otherwise. We define n to be the length of the text, and m to be the length of the pattern, n ≥ m. We will in fact present a general solution for dynamic string problems where f can be represented in a particular form. DynIP, DynHD Pj=m and DynEM will seen as special cases. The restriction is simply that f (P, T [i, . . . , i + m − 1]) = j=1 g(P [j], T [i + j − 1]), where the function g can be evaluated in constant time. This functional form is closely related to the idea of local distance functions that were key to the development of fast streaming pattern matching algorithms [18]. We first show that our string problems do indeed satisfy the stated requirements. Lemma 1. If f is inner product, Hamming distance, P or exact matching with wildcards, then there exists a function g such that f (P, T [i, . . . , i + m − 1]) = j=m j=1 g(P [j], T [i + j − 1]), where the function g can be evaluated in constant time. Proof. If f is inner product, we put g(Pj , Ti+j−1 ) = Pj · Ti+j−1 . In the case of Hamming distance, we define g(Pj , Ti+j−1 ) = 0 if Pj = Ti+j−1 and gj (Pj , Ti+j−1 ) = 1 otherwise. For DynEM we assume that wildcards are represented by the value 0. It is not hard to see that we can take g(Pj , Ti+j−1 ) to be the characteristic function of (Pj − Ti+j−1 )2 Pj Ti+j−1 > 0 and indeed this observation is the basis for one of the fastest offline exact matching with wildcards algorithms [17]. The key property we use is that either (a) if one of Pj and Ti+j−1 is a wildcard or Pj = Ti+j−1 then g(Pj , Ti+j−1 ) = 0, or (b) Pj 6= Ti+j−1 and then g(Pj , Ti+j−1 ) > 0. It follows that f (P, T [i, . . . , i + m − 1]) equals zero if and only if P and T [i, . . . , i + m − 1] match. We now show a solution for all dynamic string problems defined by a function f that can be represented in the form above. We consider the most general update model, where we are allowed to update both the text and the pattern. 3 Theorem 1. Let T be a text of length n, and P be a pattern of length m. Assume f can be represented as Pj=m f (P, T [i, . . . , i + m − 1]) = j=1 g(Pj , Ti+j−1 ), where g can be computed in constant time, and the values f (P, T [1, . . . , m]), f (P, T [2, . . . , m+1]), . . . , f (P, T [n−m+1, . . . , n]) can bep computed in T (n) time and S(n) space. We can then solve the corresponding dynamic string problem in O( T (n)) worst case update/query time using O(S(n) + n) space. p Proof. Let us first show a solution with O( T (n)) amortised time. We start by computing values A[1] = f (P, T [1, . . . , m]), . . . , A[n − m + 1] = f (P, T [n − m + 1, . . . , n]) in O(T (n)) time and S(n) space. At all times, we maintain a list of updates U that have p occurred since the last moment we recomputed the values A[i]. Suppose that the size of U is at most ⌈ T (n)⌉ and a query i arrives. We can then compute A′ [i] = f (P, T [i, . . . , i + m − 1]) from A[i] and U in the following way. We initialise A′ [i] = A[i], and consider each update in order. Suppose that an update change letters in a position k of P or T [i, . . . , i + m − 1], and let ′ ′ Pk′ and Ti+k−1 be the updated letters. We remember Pk′ and Ti+k−1 , and set ′ A′ [i] ← A′ [i] − g(Pk , Ti+k−1 ) + g(Pk′ , Ti+k−1 ) Since g can be evaluatedp in constant time, this step takes constant p time as well. Therefore, the time to perform each query is O( T (n)). When the size of U reaches ⌈ T (n)⌉, we apply the updates in U to T andpP , empty U , and recompute the values A[i] from scratch. The amortised cost of an update is therefore O( T (n)). We can p de-amortise the solution in a standard way. Namely, we restart the computation of p the values p A[i] each ⌈ T (n)/2⌉ updates, and run Θ( T (n)) steps of the computation per each of the ⌈ T (n)/2⌉ subsequent updates. While the computation is not over, we make use of the previously computed values f (P, T [1, . . . , m]), . . . , f (P, T [n− p m+ 1, . . . , n]) to answer queries. As before, we will need to correct the value of the function g in at most ⌈ T (n)/2⌉ positions. Note that apart from the space we need for computing the values f (P, T [1, . . . , m]), f (P, T [2, . . . , m + 1]), . . . , f (P, T [n − m + 1, . . . , n]), we need only O(n) space. Lemma 2. √For a text T of length m ≤ n ≤ 2m, and a pattern P of length m, problem DynHD can be solved in O( m log m) query/update time for constant-size alphabets, and in O(m3/4 log1/4 m) query/update time for polynomial-size alphabets. Both solutions use O(m) space, and both updates to the text and to the pattern are allowed. Proof. If the alphabet is binary, the values f (P, T [1, . . . , m]),. . . , f (P, T [n − m + 1, . . . , n]) can be computed by running the FFT algorithm twice. Recall that the FFT algorithm computes the inner product for each alignment of two strings. By running the FFT algorithm on P and T for the first time, we obtain, for each i, the number of positions j such that P [j] = T [i + j] = 1. By running it for the second time on the copies P and T where each bit is flipped, we obtain, for each i, the number of positions j such that P [j] = T [i + j] = 0. We can then compute the values f (P, T [1, . . . , m]), . . . , f (P, T [n − m + 1, . . . , n]) in linear time. For this algorithm, T (n) = O(n log n) = O(m log m). For alphabets of constant size |Σ|, we run the FFT algorithm |Σ| times, once for each letter a ∈ Σ, on the copies of P and T where a is replaced with 1 and all letters √ in Σ \ {a} are√replaced with 0. T (n) = O(m log m) as well. For polynomial-size alphabets, T (n) = O(n n log n) = O(m m log m) and S(n) = O(n) = O(m) bounds were shown independently by Abrahamson [4] and Kosaraju [27] in 1987. The claim immediately follows from Lemma 1 and Theorem 1. Lemma 3. For a text T of√length m ≤ n ≤ 2m, and a pattern P of length m, problems DynIP and DynEM can be solved in O( m log m) query/update time using O(m) space. Both updates to the text and to the pattern are allowed. Proof. For both problems, T (n) = O(n log n) = O(m log m) and S(n) = O(n) = O(m). For inner product, this is a direct corollary of the FFT algorithm. The bound for exact matching with wildcards was demonstrated in [20, 17]. The claim follows from Lemma 1 and Theorem 1. We now extend our solution to a general value of n. In this case there is also an additional cost of computing the full set of solutions before the first query or update is performed which we omit from the following theorem. 4 Theorem 2. For a text T of length n ≥ m, and a pattern P of length m, there is a linear-space data structure that solves √ 1/4 (a) the DynHD problem in O( m log m) query/update time for constant-size alphabets, and in O(m3/4 √ log m) query/update time for polynomial-size alphabets, and the DynIP and the DynEM problems in O( m log m) query/update time if only updates to the text are allowed; √ n n (b) the DynHD problem in O( m · m log m) query/update time for constant-size alphabets, and in O( m · 1/4 m3/4 log m) query/update time for polynomial-size alphabets, and the DynIP and the DynEM prob√ n lems in O( m m log m) query/update time when updates are allowed both to the text and to the pattern. Proof. We first partition T into blocks of length 2m overlapping by m positions (the last block may be shorter). Note that for each i a string T [i, . . . , i + m − 1] is a substring of one of such blocks, and each position of T belongs to at most two blocks. Suppose that we have a solution for a text of length 2m and a pattern of length m with update time tu , query time tq , and space S. (a) If only updates to the text are allowed, we can apply this solution independently to each of the blocks. Note that an update of the text changes at most two blocks, and therefore we obtain a solution for T n · S). with update time O(tu ), query time tq , and space O( m (b) If updates are allowed both to the text and to the pattern, we obtain a solution for T with update time n n O( m · tu ), query time tq , and space O( m · S). The claim follows from Lemmas 2 and 3. 4 Upper bounds for dynamic approximate Hamming distance In this section we develop algorithms for an approximate version of DynHD. We will refer to this version as DynApproxHD. In this problem a query i must return a (1 + ε)-approximation of the Hamming distance between P and T [i, . . . , i + m − 1], where ε > 0 is a parameter of the algorithm. Unlike the other problems we have considered, the complexity of DynApproxHD appears to have a strong dependence on whether updates are permitted only in the pattern or text or in both. At one extreme, when updates are only permitted in the pattern and the input alphabet is binary, we show in Theorem 3 a data structure that takes O(1/ε) update and O(1/ε2 ) query time. However if updates can occur in both the pattern and the text, then the complexity increases dramatically to be at least that of exact DynIP, DynEM and DynHD over binary alphabets. In Section 3 we showed that the DynHD problem can be solved in O(m1/2 log1/2 m) query/update time for constant-size alphabets, and in O(m3/4 log1/4 m) query/update time for polynomial-size alphabets. We start our exploration of the complexity of DynApproxHD by showing that this dependence on the alphabet size is almost completely removed in this approximate setting. The solution we give is deterministic and is based on the mapping idea of Karloff [25]. Lemma 4 ([25]). Let Σ be the alphabet of P and T . There exists Θ((1/ε2 ) log2 n) deterministic mappings mapj : Σ → {0, 1} such that a (1 + ε)-approximation of the Hamming distance between P and T at a particular alignment can be given by a normalised average of the Hamming distances between mapj (P ) = mapj (P1 ) . . . mapj (Pn ) and mapj (T ) = mapj (T1 ) . . . mapj (Tn ) at this alignment. Each mapping can be stored as a look-up table that permits to compute each mapj (Pk ) or mapj (Tk ) in O(1) time. Corollary 1. For a text T of length m ≤ n ≤ 2m, and a pattern √ P of length m, the DynApproxHD problem over polynomial-size alphabets can be solved in O((1/ε2 ) m · polylog m) query/update time and O((1/ε2 )m log2 m) space. Proof. We consider Karloff’s mappings mapj . For each j, we run our DynHD solution for constant-size alphabets (Lemma 2) on mapj (P ) and mapj (T ). The claim immediately follows. 5 We now present several randomised solutions for DynApproxHD in two special update models where we are allowed to update either only the text or only the pattern. We first assume a binary input alphabet, and then show how to extend our solutions to constant-size and then later polynomial-size alphabets as well. Theorem 3. For a text T of length n ≥ m, and a pattern P of length m, there is a randomised data structure for the DynApproxHD problem over a constant-sized alphabet with (a) O(1/ε) update time, O(1/ε2 ) query time, and O((1/ε2 ) · n) space if only updates to the pattern are allowed; (b) O((1/ε) · polylog n) update time and O((1/ε2 ) · polylog n) query time using O((1/ε2 ) · n polylog n) space if only updates to the text are allowed. Each answer is correct with constant probability. Proof. Let us first assume the input alphabet is of constant size. We will make use of the sparse JohnsonLindenstrauss transform by Kane and Nelson [24] defined by a random Θ(1/ε2 ) × n matrix M such that its entries are from {−1, 0, 1}, and each of its columns contains s = Θ(1/ε) non-zero entries. The result of a transform, which we call a sketch, is defined to be equal to s−1/2 M · x. Kane and Nelson showed how to choose a distribution on such matrices such that, with constant probability, the square of the L2 norm of the difference of the sketches of two strings gives a (1 + ε)-approximation of Hamming distance. (a) During the preprocessing step we compute the sketch of P and of each m-length substring of T . When an update to P arrives, we update its sketch in a naive way in O(1/ε) time. When a query i arrives, we can compute a (1 + ε)-approximation of the Hamming distance between P and T by computing the L2 norm of the difference of the sketches of P and T [i, . . . , i + m − 1]. Since the sketches are the vectors of length 1/ε2 , this can be done in O(1/ε2 ) time. (b) For this model, we will need a sketch that gives (1 + ε)-approximation of Hamming distance with error probability Θ(1/ log m). This can be achieved by repeating the scheme Θ(log log m) times. During the preprocessing, we first compute Θ(log log m) sketches for each 2k -length substring of the pattern P , where k = 1, 2, . . . , log m. We then compute Θ(log log m) sketches for each substring T [i · 2k + 1, . . . , (i + 1) · 2k ]. We call such substrings of T canonical. When an update (i, σ) arrives, we need to fix the sketches of O(log m) canonical substrings (since Ti belongs to O(log m) such substrings), which can be done in O((1/ε) log m log log m) time. A query i can be answered in O((1/ε2 ) log m log log m) time: First, we partition T [i, . . . , i + m − 1] into O(log m) canonical substrings S1 , . . . , Sk . Secondly, we compute a (1 + ε)-approximation of the Hamming distance between each Si and the corresponding substring of P using the sketches. Finally, we sum up all approximations to obtain the answer. Since the probability to error on each pair of substrings is Θ(1/ log m), the total error probability is constant by the union bound. Both algorithms can be extended to work for any constant sized alphabet by expanding the input alphabet in unary. That is we replace the letter i with a binary vector 0 . . . 010 . . . 0, where the set bit is in the i-th position. Corollary 2. For a text T of length n ≥ m, and a pattern P of length m, and ε > 1/n, there is a randomised data structure for the DynApproxHD problem over polynomial-size alphabets with (a) O((1/ε3 ) · polylog n) update time, O((1/ε4 ) · polylog n) query time, and O((1/ε4 ) · n polylog n) space if only updates to the pattern are allowed; (b) O((1/ε4 ) · polylog n) update time, O((1/ε4 ) · polylog n) query time, and O((1/ε4 ) · n polylog n) space if only updates to the text are allowed. Each answer is correct with constant probability. 6 Proof. We reduce the alphabet to binary by applying Karloff’s mappings. There are Θ((1/ε2 ) log2 n) mappings, and to compute the Hamming distance between P and T [i, . . . , i + m − 1] we need to compute the Hamming distance for each pair mapj (P ) and mapj (T [i, . . . , i + m − 1]). To achieve constant error probability, we run Θ(log((1/ε) log n)) = polylog n instances of the algorithm for text-only or pattern-only updates (Theorem 3). (We note that we will achieve (1 + ε)2 -approximation, which is (1 + ε′ )-approximation for ε′ = 2ε + ε2 .) 5 Lower bounds In this section we demonstrate conditional and unconditional lower bounds for different variants of DynEM, DynIP, and DynHD. The conditional lower bounds are derived from the hardness of a well-known problem, online Boolean matrix-vector product (OMv). Fig. 1 summarises the reductions we use. OMv DynHD modulo 2 (ternary alphabet) DynHD DynIP modulo 2 (bi(1 + ε)-approx. DynIP nary alphabet) DynEM DynIP Figure 1: Reductions between OMv and different variants of DynEM, DynIP, and DynHD. 5.1 Reductions between DynIP, DynHD and DynHD modulo 2 Before we get to our main lower bounds results we will first establish the relationship between some of the dynamic string problems we consider. Lemma 5. DynHD is at least as hard as DynIP over binary alphabets. Proof. We map the input alphabet of the text and the pattern separately. Take an instance of DynIP where the input alphabet is binary. In order to transform it into an instance of DynHD each 1 in the pattern or text is mapped to the string 111 in the DynHD instance. Similarly, a 0 in the pattern is mapped to the string 010 and a 0 in the text is mapped to the string 100. This transformation ensures that any two symbols that align in the DynIP instance will give Hamming distance 2 in the DynHD instance except when two 1s align. In this case the Hamming distance will be 0. We can therefore infer the inner product from the Hamming distance: The inner product will be equal to the length of the pattern minus the Hamming distance divided by two. We will later show both conditional and unconditional lower bounds not only for DynIP but also for DynIP modulo 2. The following two lemmas will lead to perhaps our most surprising result which is that DynHD modulo 2 over ternary alphabets is exponentially harder to solve than DynHD modulo 2 over a binary alphabet. It is worth emphasising by way of contrast that in the standard offline pattern matching setting, the asymptotic complexity of computing the Hamming distance at all alignments of a pattern and text is identical for any constant sized input alphabet. Lemma 6. DynHD modulo 2 over a ternary alphabet is at least as hard as DynIP modulo 2 over a binary alphabet. 7 Proof. We again map the input alphabet of the text and pattern separately. Take an instance of DynIP modulo 2 where the input alphabet is binary. Each 1 in the pattern is mapped to the string 22 and each 0 in the pattern is mapped to the string 01. Each 1 in the text is mapped to the string 11 and each 0 in the text is mapped to the string 02. This transformation ensures that any two symbols that align in the DynIP modulo 2 instance will give Hamming distance 1 in the DynHD modulo 2 instance except for when two 1s align in the DynIP modulo 2 instance when the resulting Hamming distance is 2. Therefore, the inner product modulo 2 is equal to the length of the pattern minus the Hamming distance modulo 2. However, DynHD modulo 2 over a binary alphabet is much easier than DynHD modulo 2 over a ternary alphabet. Lemma 7. For a binary text T of length n ≥ m, and a binary pattern P of length m the DynHD modulo 2 problem can be solved in O(log m/ log log m) update/query time using O(n) space. There is a matching unconditional lower bound for update/query time as well. Proof. As before, we divide the text T into 2m-length blocks overlapping by m positions. We will show that for each block DynHD modulo 2 can be solved in O(log m/ log log m) update/query time using O(m) space, hence giving the claim. Consider a 2m-length block of T . In order to answer a query at alignment i for DynHD modulo 2 we need only to sum, modulo 2, the number of 1s in the pattern and the corresponding substring of the text T [i, . . . , i + m − 1]. This can be seen via a simple proof by induction as follows. As the base case consider two strings of length 1 and let all arithmetic be over Z2 . In this case the Hamming distance is the sum of the Hamming weights of the two strings. For the inductive step, extend each of these two strings by one bit and observe that the new Hamming distance is the old Hamming distance before extending the strings plus the sum of the two new bits over Z2 . The Hamming weight of the pattern can be maintained straightforwardly. We argue that answering queries for the Hamming weight of substrings of the block is equivalent to the prefix sum problem modulo 2. To reduce from this problem to prefix sum we need only observe that we can compute the number of 1s in T [i, . . . , i + m − 1] by subtracting the prefix sum up to index i − 1 from the prefix sum up to index i + m − 1. To reduce from prefix sum to the DynHD modulo 2 problem we construct a text of length 2m with the first half all zeros and the second half as a copy of the prefix sum array. Setting the pattern to all 1s we can compute the prefix sum modulo 2 up to index i of its array of length m by performing a query at index i of the text. It follows from the upper and lower bounds of [32] that the complexity of DynHD modulo 2 over a binary alphabet is Θ(log m/ log log m). 5.2 Conditional lower bounds We will now give lower bounds for our dynamic string problems conditional on the hardness of a well known problem. The OMv problem was introduced in [22] as a means to prove conditional lower bounds for a number of dynamic problems. In this problem we are first given an r × r Boolean matrix M . We then receive r vectors v1 , . . . , vr , one by one. After seeing each vector vi , we have to output the product M vi (over the Boolean semi-ring) before we receive the next vector. A naive algorithm can solve this problem √ using O(r3 ) time in total with the current fastest solution taking O(r3 /2Ω( log r) ) time [31]. The OMv conjecture is as follows: Conjecture 1 (OMv Conjecture [22]). For any constant ǫ > 0, there is no O(r3−ǫ )-time algorithm that solves the OMv problem with error probability of at most 1/3. Theorem 4. Assuming the OMv conjecture, there does not exist an algorithm running in O(m1/2−ǫ ) for the maximum of query and update time for DynEM, DynIP, and DynHD. The same lower bound holds for DynIP modulo 2, for (1 + ε)-approximate DynIP, and for DynHD modulo 2 over ternary alphabets. The same lower bound holds even when updates are permitted only in the pattern or only in the text. 8 Proof. We first give a reduction from the online Boolean matrix-vector multiplication problem to DynEM. We create a text T of length 2m = 2r2 from the matrix M by concatenating the r rows of M one after another and filling the rest of T with the symbol 1 repeated r2 times. Now consider a single Boolean matrix vector product M vi . The pattern P has length m = r2 . Its first r symbols are a copy of the vector vi but with all 0s replaced by the wildcard symbol ? and all 1s replaced by the symbol 0. The remaining r2 − r symbols are set to the wildcard symbol ?. To perform a Boolean matrix vector multiplication we perform m exact match with wildcard queries at indices 1, r + 1, 2r + 1, . . . , (r − 1)r + 1. If a query i returns a match then M vi [j] = 0 and M vi [j] = 1 otherwise. If follows that any algorithm for DynEM running in O(m1/2−ε ) for the maximum of query and update time implies an O(r3−ε )-time algorithm that solves the online Boolean matrix-vector multiplication problem, thereby contradicting the OMv conjecture. DynIP and DynHD are at least as hard as DynIP modulo 2, so it suffices to show the lower bound for the latter. We give a similar reduction from OMv but this time with an extra randomisation step. We create a text T of length 2m = 2r2 from the matrix M by concatenating the r rows of M one after another and filling the rest of T with the symbol 0 repeated r2 times. Now consider a single Boolean matrix vector product M vi . We create a pattern P of length m = r2 with the first r symbols being a copy of vi and the remaining r2 − r symbols set to 0. We now flip each set bit in P with probability 1/2 and compute inner product modulo 2 queries at indices 1, r + 1, 2r + 1, . . . , (r − 1)r + 1. If M vi [j] = 0 then an inner product query j will always return 0. If M vi [j] = 1 then the inner product query will return 1 with probability 1/2. This gives a probability of at least 1/2 of giving the correct answer for each M vi [j]. We amplify the probabilities by repeating the randomised procedure O(log m) times using the fact that we have one-sided error at each iteration. It then follows that there does not exist an algorithm running in O(m1/2−ε ) for the maximum of query and update time for DynIP modulo 2 unless the OMv conjecture is false. The lower bound for (1 + ε)-approximate DynIP follows from the same reduction with the arithmetic performed over the reals rather than modulo 2 and without the randomisation step. This is because a (1 + ε)-approximation must be able to distinguish zero and non-zero inner products which is sufficient for our reduction from OMv. The lower bound for DynHD modulo 2 over a ternary alphabet now follows from Lemma 6. If updates are only allowed in the text then we derive the same lower bound as before by modifying our reductions. Let us take the reduction from the online Boolean matrix-vector multiplication problem to DynIP modulo 2 as an example. The other lower bounds follow analogously. We create a pattern P of length m = r2 from the matrix M by concatenating the r rows of M one after another. The text is of length 2m = 2r2 and will be all 0s except for the substring T [r2 − r + 1, . . . , r2 ]. In order to perform a single Boolean matrix vector product M vi the substring is updated so that T [r2 − r + 1, . . . , r2 ] = vi and we then flip each set bit in T with probability 1/2. We then compute inner product queries modulo 2 at indices 1, r + 1, 2r + 1, . . . , (r − 1)r + 1 which give the correct answer for each query with probability at least 1/2. We can amplify the probability as before giving us the desired lower bound. Our lower bound also holds for DynIP modulo c for any c ≥ 2. Corollary 3. Let integer c ≥ 2. Assuming the OMv conjecture, there does not exist an algorithm running in O(m1/2−ǫ ) for the maximum of query and update time for DynIP modulo c. Proof. Let the input alphabet be binary as before and perform the same randomised reduction from OMv as in the proof of Theorem 4. If the inner product equals 0 then we always give the correct answer. If the inner product is greater than 0 then after flipping the set bits, the inner product modulo c is greater than 0 with probability that tends asymptotically to c−1 c . We can then amplify the probabilities to ensure that every value in the matrix-vector product is correct with constant probability as before. 5.3 Unconditional lower bounds In this section we will give unconditional lower bounds for all the problems we have considered except DynApproxHD. Although these bounds are necessarily much lower than the conditional lower bounds we 9 gave previously, they nonetheless match in many cases the limits of what is known unconditionally for any dynamic data structure. We first show lower bounds for the DynIP and the DynHD problems by reduction from the dynamic weighted range counting problem. In this problem, we are given a r × r grid D. The points in the grid are assigned integer weights, and at any moment there can be at most r non-zero weights P wi . For our problem r = m1/3 . Updates may change the weight of a point and a query (i, j) asks for x≤i,y≤j Dx,y . In [28] Larsen gave an Ω((log r/ log log r)2 ) lower bound for the maximum of query and update time for dynamic weighted range counting. This lower bound does not hold however in the unweighted case (where the weights are in {0, 1}) and giving an ω(log r) lower bound for this situation remained an important open problem for a number of years. Recently in [30] a new Ω((log1/2 r/ log log r)3 ) lower bound was given for this unweighted range counting problem which also holds over F2 . Theorem 5. The DynIP problem has an unconditional Ω((log m/ log log m)2 ) lower bound for the maximum of query and update time for polynomial-size alphabets. DynHD over binary alphabets, DynIP modulo 2 over binary alphabets and DynHD modulo 2 over ternary alphabets have an Ω((log1/2 m/ log log m)3 ) lower bound. Proof. We give a reduction from dynamic range counting to DynIP. We take an instance of the problem for r = m1/3 and create a text T of length 2m and a pattern P of length m. The text has all symbols set to 0 except Tm−m1/3 +1 ,. . . , Tm that are set to w1 , . . . , wm1/3 respectively. For each of the m2/3 different possible queries to D, a subset of the wi ’s will be included in the query. We create a pattern P so that Pjm1/3 +i−1 = 1 if weight wi is included in the range for query j and Pjm1/3 +i−1 = 0 otherwise. To perform a range counting query, we need to align the relevant substring of the pattern of length m1/3 with T [m − m1/3 + 1, . . . , m] and perform an inner product query. Our lower bounds then follow from the lower bounds for the weighted and F2 versions of dynamic range counting and Lemmas 5 and 6. Finally, we give lower bounds for the DynEM and the (1 + ε)-approximate DynIP problems by reduction from the dynamic range emptiness problem. In this problem, theP set-up is exactly like in the unweighted dynamic range counting problem above, and a query (i, j) asks if x≤i,y≤j Dx,y = 0. In [6], Alstrup et al. showed a Ω(log r/ log log r) lower bound for this problem. Theorem 6. DynEM and (1 + ε)-approximate DynIP have unconditional Ω(log m/ log log m) lower bounds for the maximum of query and update time. Proof. Consider an instance of two dimensional range emptiness on D for r = m1/3 . We take an instance of this problem and create a text T of length 2m and a pattern P of length m. The text has all values set to 0 except Tm−m1/3 +1 , . . . , Tm set to w1 ,. . . ,wm1/3 respectively. For each of the m2/3 different possible queries to D in the dynamic range emptiness problem, a subset of the wi ’s will be included in the query. We create a pattern P so that Pjn1/3 +i−1 = 0 if weight wi is included in the range for query j and Pjn1/3 +i−1 = ? otherwise. If an exact match with wildcards query returns True then we know that all the weights in the corresponding range are 0. If it returns False then we know the range is not empty. We therefore have reduced from two dimensional range emptiness to DynEM giving an Ω(log m/ log log m) lower bound for DynEM. For the (1 + ε)-approximate dynamic inner product problem we must be able to distinguish an inner product of zero from all other values. We therefore use the same reduction from the proof of Theorem 5 but this time only report whether the approximate inner product is greater than zero. The result of this query is sufficient to determine the answer to a range emptiness query and we therefore derive the same Ω(log m/ log log m) lower bound. References [1] A. Abboud, A. Backurs, and V. V. Williams. Tight hardness results for LCS and other sequence similarity measures. In FOCS ’15: Proc. 56th Annual Symp. Foundations of Computer Science, pages 59–78, 2015. 10 [2] A. Abboud and V. V. Williams. Popular conjectures imply strong lower bounds for dynamic problems. In FOCS ’14: Proc. 55th Annual Symp. Foundations of Computer Science, pages 434–443, 2014. [3] A. Abboud, V. V. Williams, and O. Weimann. Consequences of faster alignment of sequences. In ICALP ’14: Proc. 41st International Colloquium on Automata, Languages and Programming, pages 39–51, 2014. [4] K. Abrahamson. Generalized string matching. SIAM Journal on Computing, 16(6):1039–1051, 1987. [5] S. Alstrup, G. S. Brodal, and T. Rauhe. Pattern matching in dynamic texts. In SODA ’00: Proc. 11th ACM-SIAM Symp. on Discrete Algorithms, pages 819–828, 2000. [6] S. Alstrup, T. Husfeldt, and T. Rauhe. Marked ancestor problems. In FOCS ’98: Proc. 39th Annual Symp. Foundations of Computer Science, pages 534–543, 1998. [7] A. Amir, D. Keselman, G. M. Landau, M. Lewenstein, N. Lewenstein, and M. Rodeh. Text indexing and dictionary matching with one error. Journal of Algorithms, 37(2):309–325, 2000. [8] A. Amir, G. M. Landau, M. Lewenstein, and D. Sokol. Dynamic text and static pattern matching. ACM Transactions on Algorithms (TALG), 3(2), 2007. [9] A. Amir, A. Levy, E. Porat, and B. R. Shalom. Dictionary matching with one gap. In CPM ’14: Proc. 25nd Annual Symp. on Combinatorial Pattern Matchin, pages 11–20, 2014. [10] A. Backurs and P. Indyk. Edit distance cannot be computed in strongly subquadratic time (unless SETH is false). In STOC ’15: Proc. 47th Annual ACM Symp. Theory of Computing, 2015. [11] A. Backurs and P. Indyk. Which regular expression patterns are hard to match? In FOCS ’16: Proc. 57th Annual Symp. Foundations of Computer Science, pages 457–466, 2016. [12] R. Baeza-Yates, G. Navarro, E. Sutinen, and J. Tarhio. Indexing methods for approximate text retrieval. Technical report, Dept. of CS, Univ. of Chile, March 1997. [13] L. Boytsov. Indexing methods for approximate dictionary searching: Comparative analysis. Journal of Experimental Algorithmics (JEA), 16:1.1:1.1–1.1:1.91, 2011. [14] K. Bringmann. Why walking the dog takes time: Frechet distance has no strongly subquadratic algorithms unless SETH fails. In FOCS ’14: Proc. 55th Annual Symp. Foundations of Computer Science, pages 661–670, 2014. [15] K. Bringmann, A. Grønlund, and K. G. Larsen. A dichotomy for regular expression membership testing. In FOCS ’17: Proc. 58th Annual Symp. Foundations of Computer Science, pages 307–318, 2017. [16] K. Bringmann and M. Künnemann. Quadratic conditional lower bounds for string problems and dynamic time warping. In FOCS ’15: Proc. 56th Annual Symp. Foundations of Computer Science, pages 79–97, 2015. [17] P. Clifford and R. Clifford. Simple deterministic wildcard matching. Information Processing Letters, 101(2):53–54, 2007. [18] R. Clifford, K. Efremenko, B. Porat, and E. Porat. A black box for online approximate pattern matching. Information and Computation, 209(4):731–736, 2011. [19] R. Cole, L.-A. Gottlieb, and M. Lewenstein. Dictionary matching and indexing with errors and don’t cares. In STOC ’04: Proc. 36th Annual ACM Symp. Theory of Computing, pages 91–100, 2004. [20] R. Cole and R. Hariharan. Verifying candidate matches in sparse and wildcard matching. In STOC ’02: Proc. 34th Annual ACM Symp. Theory of Computing, pages 592–601, 2002. 11 [21] P. Gawrychowski, A. Karczmarz, T. Kociumaka, J. Łącki, and P. Sankowski. Optimal dynamic strings. In SODA ’18: Proc. of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, 2018. [22] M. Henzinger, S. Krinninger, D. Nanongkai, and T. Saranurak. Unifying and strengthening hardness for dynamic problems via the online matrix-vector multiplication conjecture. In STOC ’15: Proc. 47th Annual ACM Symp. Theory of Computing, pages 21–30, 2015. [23] T. N. Huynh, W.-K. Hon, T.-W. Lam, and W.-K. Sung. Approximate string matching using compressed suffix arrays. Theoretical Computer Science, 352(1-3):240–249, 2006. [24] D. M. Kane and J. Nelson. Sparser Johnson-Lindenstrauss transforms. Journal of the ACM, 61(1):4:1– 4:23, Jan. 2014. [25] H. Karloff. Fast algorithms for approximately counting mismatches. Information Processing Letters, 48(2):53–60, 1993. [26] T. Kopelowitz, S. Pettie, and E. Porat. Higher lower bounds for the 3SUM conjecture. abs/1407.6756, 2015. CoRR, [27] S. R. Kosaraju. Efficient string matching. Manuscript, 1987. [28] K. G. Larsen. The cell probe complexity of dynamic range counting. In STOC ’12: Proc. 44th Annual ACM Symp. Theory of Computing, pages 85–94, 2012. [29] K. G. Larsen, J. I. Munro, J. S. Nielsen, and S. V. Thankachan. On hardness of several string indexing problems. Theor. Comput. Sci., 582:74–82, 2015. [30] K. G. Larsen, O. Weinstein, and H. Yu. Crossing the logarithmic barrier for dynamic boolean data structure lower bounds. arXiv preprint arXiv:1703.03575, 2017. [31] K. G. Larsen and R. Williams. Faster online matrix-vector multiplication. In SODA ’17: Proc. 28th Annual ACM-SIAM Symposium on Discrete Algorithms, pages 2182–2189, 2017. [32] M. Pǎtraşcu and E. D. Demaine. Tight bounds for the partial-sums problem. In SODA ’04: Proc. 15th Annual ACM-SIAM Symposium on Discrete Algorithms, pages 20–29, 2004. 12
8cs.DS
Choreographies in Practice? Luı́s Cruz-Filipe, Fabrizio Montesi arXiv:1602.08863v1 [cs.PL] 29 Feb 2016 University of Southern Denmark, Department of Mathematics and Computer Science {lcf,fmontesi}@imada.sdu.dk Abstract. Choreographic Programming is a development methodology for concurrent software that guarantees correctness by construction. The key to this paradigm is to disallow mismatched I/O operations in programs, called choreographies, and then mechanically synthesise distributed implementations in terms of standard process models via a mechanism known as EndPoint Projection (EPP). Despite the promise of choreographic programming, there is still a lack of practical evaluations that illustrate the applicability of choreographies to concrete computational problems with standard concurrent solutions. In this work, we explore the potential of choreographies by using Procedural Choreographies (PC), a model that we recently proposed, to write distributed algorithms for sorting (Quicksort), solving linear equations (Gaussian elimination), and computing Fast Fourier Transform. We discuss the lessons learned from this experiment, giving possible directions for the usage and future improvements of choreography languages. Keywords: Choreographies, Correctness by Construction, Distributed Algorithms 1 Introduction Choreographic Programming is an emerging paradigm for the programming of concurrent software based on message passing [18]. The key aspect of this paradigm is that programs are choreographies, i.e., global descriptions of communications based on an “Alice and Bob” notation inherited from security protocol notation [21]. Since the syntax of such notation disallows the writing of mismatched I/O actions, choreographies always describe deadlock-free systems by construction. Given a choreography, a distributed implementation can be projected automatically (synthesis) in terms of a process model. This transformation is typically called EndPoint Projection (EPP) [2,3]. If EPP is defined correctly, then the generated code behaves exactly as specified by the originating choreography, yielding a correctness-by-construction result: since a choreography cannot describe deadlocks, the generated process implementations must also be deadlock-free. Previous works have presented formal models for capturing different aspects of choreographic programming, e.g., web services [2,11], multiparty ? Supported by CRC (Choreographies for Reliable and efficient Communication software), grant no. DFF–4005-00304 from the Danish Council for Independent Research. sessions and asynchrony [3], runtime adaptation [23], modular development [20], protocol compliance [3,4], and computational expressivity [7]. More in general, looking also at other applications rather than just programming system implementations, choreographies have been investigated in the realms of type theory [14], automata theory [10,16], formal logics [5], and service contracts [1,24]. Despite the rising interest in choreographies found in the communities of programming languages and concurrent computing, there is still a lack of evidence about what kind of nontrivial programs can actually be written with choreographic programming. This is due to the young age of the paradigm [19]. Indeed, most works on languages for choreographic programming still focus on showcasing representative toy examples (e.g., [2,3,6,11,18,20]), rather than giving a comprehensive practical evaluation of how known algorithms can be implemented using choreographies. Here, we aim at contributing to filling this gap by investigating how choreographies can be used to tackle some common computational problems in the setting of concurrent programming. Our investigation is based on the language of Procedural Choreographies (PC), and its corresponding process calculus of Procedural Processes (PP), which we presented in [8]. PC, introduced in § 2, is a choreography language developed with the aim of capturing divide-and-conquer concurrent algorithms, by extending previous choreography models with primitives for parameterised procedures. Like several other choreography languages (e.g., [3,20]), PC supports implicit parallelism by means of a flexible semantics that allows non-interfering communications to take place in any order. In this work, we provide an empirical evaluation of the expressivity of PC, by showing how it can be used to program some representative and standard concurrent algorithms: Quicksort (§ 3), Gaussian elimination (§ 4), and Fast Fourier Transform (§ 5). As a consequence of using choreographies, all these implementations are guaranteed to be deadlock-free. We also illustrate how implicit parallelism has the surprising effect of automatically giving concurrent behaviour to traditional sequential implementations of these algorithms. Our exploration brings us to the limits of the expressivity of PC, which arise when trying to tackle distributed graph algorithms (§ 6), due to the lack of primitives for accessing the structure of process networks, e.g., broadcasting a message to neighbouring processes. 2 Background In this section, we recap the definition of Procedural Choreographies (PC), our choreography language, and its main properties. We refer the reader to the original presentation of PC, in [8], for a more comprehensive technical discussion. 2.1 Procedural Choreographies The syntax of PC is introduced in Figure 1. A procedural choreography is a pair hD, Ci, where C is a choreography and D is a set of procedure definitions. Process 2 C ::= η; C | I; C | 0 η ::= p.e -> q.f | p -> q[l] | p start q | p : q <-> r D ::= X(e q) = C, D | ∅ I ::= if p.e then C1 else C2 | Xhp̃i | 0 Fig. 1. Procedural Choreographies, Syntax. names, ranged over by p, q, r, . . ., identify processes that execute concurrently. Each process p is equipped with a memory cell that stores a single value of a fixed type. In the remainder, we will omit such types in the language and our examples since they can always be inferred using the technique given in [8]. Statements in a choreography can either be communication actions (η) or compound instructions (I), and both can have continuations. Term 0 is the terminated choreography, which we sometimes omit. The term 0; A is needed at runtime to capture the termination of procedure calls with continuations. Processes communicate via direct references (names) to each other. Communications are synchronous, as they are simple and suffice for our purposes here, but can be made asynchronous by adopting the asynchronous extension proposed in [3]. In a value communication p.e -> q.f , process p sends the result of evaluating expression e to q; the expression e can contain the placeholder c, which is replaced at runtime with the data stored at process p. When q receives the value from p, it applies to it the (total) function f , of the form λx.e0 , replacing the formal parameter x with the value sent by p. The result of the computation will be stored in q. The expression e0 , the body of f , can also contain the placeholder c, allowing it to read the contents of q’s memory. We assume that expressions and functions are written in a pure functional language, which we leave unspecified. The selection term p -> q[l] is standard, as in session types [13]: p communicates to q its choice of label l. Labels l range over an infinite enumerable set. In term p start q, process p spawns the new process q. Process name q is bound in the continuation C of p start q; C. Also, after executing p start q, process p is assumed to be the only process who knows the name of process q. (Or, in other words, process p is the only process connected to q.) In order to propagate knowledge of q to other processes, PC includes the action p : q <-> r, read “p introduces q and r”, where p, q and r are distinct. In a conditional term if p.e then C1 else C2 , process p evaluates expression e to choose between the possible continuations C1 and C2 . The set D defines global procedures that can be invoked in choreographies. Term X(e q) = C defines a procedure X with body C, which can be used anywhere in hD, Ci – in particular, inside the definitions of X and other procedures. The names q̃ are bound to C, and they are assumed to be exactly the free process names in C. The set D contains at most one definition for each procedure name. Term Xhp̃i then invokes procedure X, instantiating its parameters with the processes p̃. 3 The semantics of PC, which we do not detail, is a reduction semantics that relies on two extra elements: a total state function that assigns to each process the value it stores, representing the local memory of processes; and, a connection graph that keeps track of which processes know (are connected to) which other processes [8]. In particular, two processes can only communicate if there is an edge between them in the connection graph. Therefore, it is possible for choreographies to deadlock (be unable to reduce) because of errors in the programming of communications: if two processes are supposed to communicate but they are not connected according to the connection graph, the choreography gets stuck. This issue is addressed by a simple typing discipline that we do not discuss here (see [8]). When a choreography is well-typed in PC, it is guaranteed to be deadlock-free. Theorem 1 (Deadlock-freedom [8]). Let hD, Ci be a well-typed procedural choreography. Then, hD, Ci is deadlock-free. 2.2 Procedural Processes Choreographies in PC are compiled into a distributed implementation represented in terms of a process calculus: the calculus of Procedural Processes (PP). The syntax of PP is reported in Figure 2. A term p .v B is a process, where p is its name, v is the value stored in its memory cell, and B is its behaviour. Networks, ranged over by N, M , are parallel compositions of processes, where 0 is the inactive network. Finally, hB, N i is a procedural network, where B defines the procedures that the processes in N may invoke. Values, expressions and functions are as in PC. We comment on behaviours. A send term q!e; B sends the evaluation of expression e to process q, and then proceeds as B. Term p?f ; B is the dual receiving action: it receives a value from process p, combines it with the value in memory cell of the process executing the behaviour as specified by f , and then proceeds as B. Term q!!r sends process name r to q and process name q to r, making q and r “aware” of each other. The dual action is p?r, which receives a process name from p that replaces the bound variable r in the continuation. Term q⊕l; B sends the selection of a label l to process q. Selections are received by the branching term p&{li : Bi }i∈I , which can receive a selection for any of the labels li and proceed according to Bi . Branching terms must offer at least one branch. Term start q.B2 ; B1 starts a new process (with a fresh name) executing B2 , proceeding B ::= q!e; B | p?f ; B | q!!r; B | p?r; B | q ⊕ l; B | p&{li : Bi }i∈I ; B | 0 | start q . B2 ; B1 | if e then B1 else B2 ; B | Xhp̃i; B | 0; B N, M ::= p .v B | N |M | 0 B ::= X(q̃) = B, B | ∅ Fig. 2. Procedural Processes, Syntax. 4   q!e; [[C]]r [[p.e -> q.f ; C]]r = p?f ; [[C]]r   [[C]]r if r = p if r = q else  q!!r; [[C]]s     p?r; [[C]]s [[p : q <-> r; C]]s =  p?q; [[C]]s    [[C]]s ( if s = p if s = q if s = r else [[if p.e then C1 else C2 ; C]]r = [[p start q; C]]r =   q ⊕ l; [[C]]r [[p -> q[l]; C]]r = p&{l : [[C]]r }; 0   [[C]]r ( Xi hp̃i; [[C]]r [[Xhp̃i; C]]r = [[C]]r [[0]]r = 0 [[0; C]]r = [[C]]r if e then [[C1 ]]r else [[C2 ]]r ; [[C]]r ([[C1 ]]r t [[C2 ]]r ); [[C]]r ( start q . [[C]]q ; [[C]]r [[C]]r if r = p if r = q else if r = pi else if r = p else if r = p else Fig. 3. Procedural Choreographies, Behaviour Projection. in parallel as B1 . The other terms are standard (conditionals, procedure calls, and termination), while procedural definitions are stored globally as in PC. Some terms bind names: start q . B2 ; B1 binds q in B1 , and p?r; B binds r in B. The semantics of PP is again a reduction semantics, capturing the intuitive description of the operators given above. 2.3 EndPoint Projection (EPP) We now exhibit the compilation of procedural choreographies in PC to processes in PP. Behaviour Projection. We start by defining how to project the behaviour of a single process p, a partial function denoted [[C]]p . The rules defining behaviour projection are given in Figure 3. Each choreography term is projected to the local action of the process that we are projecting. For example, for a communication term p.e -> q.f , we project a send action if we are projecting the sender process p, a receive action if we are projecting the receiver process q, or we just proceed with the continuation otherwise. The rule for projecting a conditional uses the standard (and partial) merging operator t: B t B 0 is isomorphic to B and B 0 up to branching, where the branches of B or B 0 with distinct labels are also included [2]. Merging allows the process that decides a conditional to inform the other processes of its choice later on, using selections [15]. Unlike in previous work, our conditionals have continuations, which have to be moved inside the different branches if they do not coincide for all cases (see the example in § 3). Building on behaviour projection, we define how to project the set D of procedure definitions. Formally, the projection [[D]] is the component-wise extension 5 of the projection of a single procedure, defined below. [[X(e q) = C]] = X1 (q̃) = [[C]]q1 , . . . , Xn (q̃) = [[C]]qn where q̃ = q1 , . . . , qn . Definition 1 (EPP from PC to PP). Given a procedural choreography hD, Ci and a map of initial process values σ, the endpoint projection [[D, C, σ]] is defined as the parallel composition of the processes in C with all global definitions derived from D: D E Q [[D, C, σ]] = h[[D]], [[C, σ]]i = [[D]], p∈pn(C) p .σ(p) [[C]]p where [[C, σ]], the EPP of C wrt state σ, is independent of D. Above, σ is a total function mapping process names to their current values. For our purposes here, we will only consider a default mapping that assigns an initial undefined value to each process, and omit further discussions on σ since it does not influence our presentation in any way (see [8] for details). Properties. EPP guarantees the typical operational correspondence between PC and PP: the projection of a choreography implements exactly the behaviour of the originating choreography. This implies, in particular, that the projections of typable PC terms never deadlock. 3 Quicksort In this section, we illustrate PC’s capability of supporting the programming of divide-and-conquer algorithms, by providing a detailed implementation of (concurrent) Quicksort. We begin by defining procedure split, which splits the (non-empty) list stored at p among three processes: q< , q= and q> . Before giving the code for split, we describe the (standard) auxiliary functions and procedures that we are going to use. We assume that all processes store objects of type List(T), where T is some type. We also assume that these lists are implemented such that the following operations are supported and take constant time: accessing the first element (fst); accessing the second element (snd); checking that the length of a list is at most 1 (short); appending an element (add); and, appending another list (append). This can be readily achieved, for example, by an implementation of linked lists with pointers to the first, second and last node (and short simply checks where the pointer to the second node is null). We use the predicates fst<snd and fst>snd to test whether the first element of the list at a process is, respectively, smaller or greater than the second element. Finally, the procedure pop2 (which we omit) removes the second element from the list at its argument process. We use the abbreviation p -> q1,...,qn[l] to signify that p sends the label l to the processes q1,. . . ,qn, i.e., as an abbreviation for the sequence of selections p -> q1[l]; ...; p -> qn[l]. We can now show the code for split, reported in the following. 6 split (p , q< , q= , q> ) = if p . short then p -> q< , q= , q> [ stop ]; p . fst -> q= . add else if p . fst < snd then p -> q< [ get ]; p . snd -> q< . add ; p -> q= , q> [ skip ] else if p . fst > snd then p -> q> [ get ]; p . snd -> q> . add ; p -> q< , q= [ skip ] else p -> q= [ get ]; p . snd -> q= . add ; p -> q< , q> [ skip ] ; pop2 <p >; split <p , q< , q= , q> > Procedure split starts by testing whether the list at process p is short. If so, its element is stored in process q= and the procedure terminates. Otherwise, we test whether the second element in the list is smaller, greater, or equal to the first element in the list, and add it to the respective process q< , q= , or q> ; then, we pop the second element of the list at p and recursively invoke split. When split terminates, we know that all elements in q< and q> are respectively smaller and greater than those in q= . Sending the label skip to the processes that will not receive messages in an iteration is required for projectability. (So that they know whether they will receive a value or not.) Using split we can implement a robust version of Quicksort (in the sense that it works with lists containing duplicates), the procedure QS below. We use p start q1, ..., qn as a shortcut for the sequence p start q1; ...; p start qn. Observe that split is only called when p stores a non-empty list. QS ( p ) = if p . short then 0 else p . start q< , q= , q> ; split <p , q< , q= , q> >; QS < q< >; QS < q> >; q< . c -> p . id ; q= . c -> p . append ; q> . c -> p . append Procedure QS implements Quicksort using its standard recursive structure. However, the recursive calls run completely in parallel here. Indeed, the created processes q< , q= and q> do not even have references to each other, so they cannot exchange messages. Therefore, the network of processes becomes tree-like, as exemplified in Figure 4. q<> q<= q= q< q<< q>= p q><> q> q>< q>> q><< q><= Fig. 4. Example of a network connection graph after some recursive calls of QS. Applying EPP, we get the following process procedures, where we simplified the projections of procedure definitions to include only the arguments that are actually used inside the procedures (see [8]). 7 split_p (p , q< , q= , q> ) = if short then q< ⊕stop ; q= ⊕stop ; q> ⊕stop ; q= ! fst else if fst < snd then q< ⊕get ; q< ! snd ; q= ⊕skip ; q> ⊕skip else if fst > snd then q> ⊕get ; q> ! snd ; q< ⊕skip ; q= ⊕skip else q= ⊕get ; q= ! snd ; q< ⊕skip ; q> ⊕skip ; pop2 <p >; split_p <p , q< , q= , q> > split_ q< (p , q ) = p &{ stop : 0 , get : p ? add ; split_ q< (p , q ) , skip : split_ q< (p , q )} split_ q= (p , q ) = p &{ stop : p ? add , get : p ? add ; split_ q= (p , q ) , skip : split_ q= (p , q )} split_ q> (p , q ) = p &{ stop : 0 , get : p ? add ; split_ q> (p , q ) , skip : split_ q> (p , q )} QS_p ( p ) = if small then 0 else ( start q< . split_ q< <p , q< >; QS_p < q< >; p ! c ); ( start q= . split_ q= <p , q= >; p ! c ); ( start q> . split_ q> <p , q> >; QS_p < q> >; p ! c ); q< ? id ; q= ? append ; q> ? append Remark 1. Our implementation of split is suitable in a context where communication is cheap, e.g., as in object-oriented programming and/or a multi-threaded application. In architectures where communications are costly, it could be better to use a select function at p to compute the lists of elements smaller than, equal to, or larger than the pivot and send each of these in a single message to q< , q= or q> , respectively. 4 Gauss Elimination We now show how we can program the distributed resolution of systems of linear equations by Gaussian elimination. Let Ax = b be a system of linear equations in matrix form; our procedure gauss will transform this into an equivalent system U x = y, where U is an upper triangular matrix (so this system can be solved by direct substitution). We use parameter processes aij , with 1 ≤ i ≤ n and 1 ≤ j ≤ n+1. Each aij such that 1 ≤ i, j ≤ n stores one value from the coefficient matrix and ai,n+1 stores the independent term in one equation. (Including the independent terms in the coefficient matrix substantially simplifies the notation, as Gaussian elimination treats the independent vector exactly as the columns in the coefficient matrix.) After execution, each aij stores the corresponding term in the new system. For simplicity, we assume that the matrix A is non-singular and numerically stable. Implementing this algorithm in PC cannot be done directly, as our procedure gauss needs to take a variable number of parameters (the aij ). However, it is straightforward to extend PC so that procedures can also take process lists as parameters, instead of only processes. We succinctly describe how to do this. Syntax of PC. We extend parametric procedures with arguments that are lists of process names. In procedure calls, we can use standard list functions (e.g., head, tail) to manipulate these lists. These functions must be pure and take a list as their only argument. The processes in these lists are assumed to have all the same type, and process lists can only be used in procedure calls. 8 In our examples, we will use uppercase letters to identify process lists and lowercase letters for normal process identifiers. Semantics of PC. We assume that a procedure that is called with an empty list as one of its arguments is equivalent to the terminated process 0. Connections. We assume that the connections between processes are uniform wrt argument lists, i.e., if p is a process and A is a list of processes that are arguments to some procedure X, then X requires/guarantees that p be connected to none or all of the processes in Q. The type system presented in [8] can be trivially extended to check for this requirement. Syntax of PP. We extend it in the same way as PC. Semantics of PP. We assume that a procedure unfolds to 0 if the process unfolding it does not occur inside its arguments. EndPoint Projection. We project procedures as before, with one PP procedure for each argument of each PC procedure – regardless of whether the argument is a single process or a list of processes. The merge operator t also needs to be slightly adjusted; we explain how this is done in § 5, as this change is not required for the example in this section. This extension preserves the properties of PC, PP, and the EPP from the former to the latter. We use hd and tl to compute the head and tail of a list of processes, respectively; fst and rest, which take a list of processes representing a matrix and return, respectively, the first row of the matrix, or the matrix without its first row; and minor, which removes both the first row and the first column from a matrix. (Formally, some of these functions would need the size of the rows as arguments, but we omit these for simplicity.) Each process uses standard arithmetic operations to combine its value with the one it receives. The code of procedure gauss follows. gauss ( A ) = solve ( fst ( A )); eliminate ( fst ( A ) , rest ( A )); gauss ( minor ( A )) solve ( A ) = divide_all ( hd ( A ) , tl ( A )); set_to_one ( hd ( A )) divide_all (a , A ) = divide (a , hd ( A )); divide_all (a , tl ( A )) divide (a , b ) = a . c -> b . div eliminate (A , B ) = elim_row (A , fst ( B )); eliminate (A , rest ( B )) elim_row (A , B ) = elim_all ( tl ( A ) , hd ( B ) , tl ( B )); set_to_zero ( hd ( B )) elim_all (A ,m , B ) = elim_one ( hd ( A ) ,m , hd ( B )); elim_all ( tl ( A ) ,m , tl ( B )) elim_one (a ,m , b ) = b start x ; b : x <-> a ; b : x <-> m ; a . c -> x . id ; m . c -> x . mult ; x . c -> b . minus set_to_zero ( a ) = a start p ; p .0 -> a . id set_to_one ( a ) = a start p ; p .1 -> a . id Procedure solve divides the first equation by the pivot, obtaining the new first equation in the reduced system. Then, eliminate uses this row to perform an elimination step, setting the first column of the coefficient matrix to zeroes. 9 The auxiliary procedure elim_row performs this step at the row level, using elim_all to iterate through a single row and elim_one to perform the actual computations. The first row and the first column of the matrix are then removed in the recursive call, as they will not change further. This implementation follows the standard sequential algorithm for Gaussian elimination, as described in, e.g., Algorithm 8.4 in [12]. However, the implicit parallelism in the semantics of choreographies allows it to run concurrently. We explain this behaviour by focusing on a concrete example. Assume that A is a 3 × 3 matrix, so there are 12 processes in total. For legibility, we will write b1 for the independent term a14 etc.; A=ha11,a12,a13,b1,a21,a22,a23,b2,a31,a32,a33,b3i for the matrix; A1=ha11,a12,a13,b1i for the first row (likewise for A2 and A3); and, A’2=ha22,a23,b2i and likewise for A’3. Calling gauss(A) unfolds to solve ( A1 ); eliminate ( A1 , h A2 , A3 i ); solve (A ’2); eliminate (A ’2 ,A ’3); solve ( h a33 , b3 i ) or, unfolding eliminate, solve ( A1 ); elim_row ( A1 , A2 ); elim_row ( A1 , A3 ); solve (A ’2); elim_row (A ’2 ,A ’3); solve ( h a33 , b3 i ) Unfolding solve(A1) is straightforward, leading to a11 . c -> a12 . div ; a11 . c -> a13 . div ; a11 . c -> b1 . div ; a11 start x1 ; x1 .1 -> a11 . id and likewise for the remaining calls. In turn, elim_row(A1,A2) becomes elim_all ( h a12 , a13 , b1 i ,a21 , h a22 , a23 , b2 i ); set_to_zero ( a21 ) which can be expanded to elim_one ( a12 , a21 , a22 ); elim_one ( a13 , a21 , a23 ); elim_one ( b1 , a21 , b2 ); set_to_zero ( a21 ) and we note that each of these procedure calls involves only communication between the processes explicitly given as arguments. Since all these procedures involve a21, the semantics of choreographies requires them to be executed in this order. Likewise, the call to elim_row(A1,A3) must be executed afterwards (since it also involves processes a11 through a13), and unfolds to a sequential composition of procedure calls with a31 as argument. The interesting observation is that none of the processes intervening in elim_row(A1,A3) occur in the expansion of solve(A’2). In other words, elim_row ( A1 , A3 ); solve (A ’2) expands to elim_one ( a12 , a31 , a32 ); elim_one ( a13 , a31 , a33 ); elim_one ( b1 , a31 , b3 ); set_to_zero ( a31 ); a21 . c -> a22 . div ; a21 . c -> a23 . div ; a21 . c -> b2 . div ; a21 start x2 ; x2 .1 -> a21 . id and the semantics of PC therefore allows the communications in the second line to be interleaved with those in the first line in any possible way; in the terminology of [7], the calls to elim_row(A1,A3) and solve(A’2) run in parallel. 10 This corresponds to the implementation of Gaussian elimination with pipelined communication and computation described in § 8.3 of [12]. Indeed, as soon as any row has been reduced by all rows above it, it can apply solve to itself and try to begin reducing the rows below it. It is a bit surprising that we get such parallel behaviour by straightforwardly implementing an imperative algorithm; the explanation is that the EndPoint Projection encapsulates the part of determining which communications can take place in parallel, thus removing this burden from the programmer. In the next section, we will include a simple example of the EPP of a procedure with parameter lists. 5 Fast Fourier Transform We now present a more complex example: computing the discrete Fourier transform of a vector. We refer the reader to § 13.1 of [12] for details. Definition 2. Let x = hx0 , . . . , xn−1 i be a vector of n complex numbers. The Pn−1 discrete Fourier transform of x is y = hy0 , . . . , yn−1 i, where yj = k=0 xk ω kj with ω = e2πi/n . Given x, its discrete Fourier transform can be computed efficiently by the Fast Fourier Transform (FFT) as follows (Algorithm 13.1 in [12]). We assume n to be a power of 2; in the first call, ω has the value defined earlier. procedure R FFT(X,Y ,n,ω) if n = 1 then y0 = x0 else R FFT(hx0 , x2 , . . . , xn−2 i,hq0 , q1 , . . . , qn/2 i,n/2,ω 2 ) R FFT(hx1 , x3 , . . . , xn−1 i,ht0 , t1 , . . . , tn/2 i,n/2,ω 2 ) for j = 0 to n − 1 do yj = q(j% n2 ) + ω j t(j% n2 ) To implement this procedure in PC, we need a way to communicate labels in selections to a group of processes. We do this by means of two auxiliary procedures gsel_then(p,Q) and gsel_else(p,Q), where p is a process broadcasting a selection of label then or else, respectively, to all the processes in Q. In order for EPP to work correctly, we also need to extend the merge operator t slightly so as to recognize these procedures. We give the definition of gsel_then; this can trivially be adapted to any other label. gsel_then (p , Q ) = gsel1_then (p , hd ( Q )); gsel_then (p , tl ( Q )) gsel1_then (p , q ) = p -> q [ then ] The EPP of gsel_then looks as follows. gsel_then_p (p , Q ) = gsel1_then_p (p , hd ( Q )); gsel_then_p (p , tl ( Q )) gsel_then_Q (p , Q ) = gsel1_then_q (p , hd ( Q )); gsel_then_Q (p , tl ( Q )) gsel_then_p (p , q ) = q⊕l gsel_then_q (p , q ) = p &{ then : 0} 11 The key aspect is that, during execution, the call to gsel_then_Q(p,Q) will reduce to either gsel1_then_q(p,hd(Q)) or gsel_then_Q(p,tl(Q)), as each process can only be on one of hd(Q) or tl(Q)! So, while gsel_then_p(p,Q) essentially unfolds to a sequence of selections from p to each of the processes in Q, each local copy of gsel_then_Q(p,Q) at a process q∈Q unfolds exactly to the reception of one selection from p. We will use (without specifying them) the following auxiliary procedures. – intro(n,m,P), where n introduces m to every process in P (defined similarly to gsel_then above) – power(n,m,nm), where at the end nm stores the result of exponentiating the value in m to the power of the value stored in n (see [7] for a possible implementation in a sublanguage of PC). Before we present our implementation of FFT, we point out the one major difference wrt the algorithm R FFT reported above: we are not able to create a variable number of fresh processes and pass them as arguments to other procedures (corresponding to the auxiliary vectors q and t). Therefore, we have to use the result vector y to store the result of the recursive calls, and then create two auxiliary processes inside each iteration of the final for loop. fft (X ,Y ,n , w ) = if n . is_one then gsel_then (n , join (X , Y )); n -> w [ then ]; base ( hd ( X ) , hd ( Y )) else gsel_else (n , join (X , Y )); n -> w [ else ]; n start n ’; n . half -> n ’; intro (n ,n ’ , Y ); w start w ’; w . square -> w ’; intro (w ,w ’ , Y ); n : n ’ <-> w ; w : n ’ <-> w ’; fft ( even ( X ) , half1 ( Y ) ,n ’ ,w ’); fft ( odd ( X ) , half2 ( Y ) ,n ’ ,w ’); n ’ start wn ; n ’: w <-> wn ; power (n ’ ,w , wn ); w start wj ; w .1 -> wj ; intro (w , wj , Y ); combine ( half1 ( Y ) , half2 ( Y ) , wn ,w , wi ) base (x , y ) = x . c -> y combine ( Y1 , Y2 , wn ,w , wj ) = combine1 ( hd ( Y1 ) , hd ( Y2 ) , wn , wj ); w . c -> wj . mult ; combine ( tl ( Y1 ) , tl ( Y2 ) , wn ,w , wj ) combine1 ( y1 , y2 , wn , wj ) = y1 start q ; y1 . c -> q ; y1 : y2 start t ; y2 . c -> t ; y2 : q . c -> y1 ; wj . c -> t . mult ; q . c -> y2 ; wn . c -> t . mult ; q <-> y2 ; t <-> y1 ; y2 : t <-> wj ; t . c -> y1 . add ; t . c -> y2 . add The level of parallelism in this implementation is suboptimal, as the two recursive calls to fft both use n’ and w’; by duplicating these processes, however, these calls are able to run in parallel exactly as in the previous example. (We chose the current formulation for simplicity.) Process n’ is actually the main orchestrator of the whole execution. 6 Graphs Another prototypical application of distributed algorithms is graph problems. In this section, we focus on a simple example (broadcasting a token to all nodes of a graph) and discuss the limitations of implementing these algorithms in PC. 12 The idea of broadcasting a token in a graph is very simple: each node receiving the token for the first time should communicate it to all its neighbours. The catch is that, in PC, there are no primitives for accessing the connection graph structure from within the language. Nevertheless, we can implement our simple example of token broadcasting if we assume that the graph structure is statically encoded in the set of available functions over parameters of procedures. To be precise, assume that we have a function neighb(p,V), returning the neighbours of p in the set of vertices V. (The actual graph is encapsulated in this function.) We also use ++ and \ for appending two lists and computing the set difference of two lists. We can then write a procedure broadcast(P,V), propagating a token from every element of P to every element of V, as follows. broadcast (P , V ) = bcast ( hd ( P ) , neighb ( hd ( P ) , V )); broadcast ( tl ( P )++ neighb ( hd ( P ) , V ) , V \ neighb ( hd ( P ) , V )) bcast (p , V ) = bcast_one (p , hd ( V )); bcast (p , tl ( V )) bcast_one (p , v ) = p . c -> v . id Calling broadcast(hpi,G), where G is the full set of vertices of the graph and p is one vertex, will broadcast p’s contents to all the vertices in the connected component of G containing p. Furthermore, implicit parallelism again ensures that each node will start broadcasting as soon as it receives the token, independently of the remaining ones. This approach is however not very satisfactory as a graph algorithm, since it requires encoding the whole graph in the definition of broadcast; furthermore, it does not generalise easily to more sophisticated graph algorithms. Adding primitives for accessing the network structure at runtime is not simple, as it would influence the definitions of EPP and the type system of PC [8] (which we omitted in this presentation). We leave this as an interesting direction for future work, which we plan to pursue in order to be able to implement more sophisticated graph algorithms, e.g., for computing a minimum spanning tree. 7 Related Work To the best of our knowledge, this is the first experience report on using choreographic programming for writing real-world, complex computational algorithms. The work nearest to ours is the evaluation of the Chor language [18], an implementation of the choreographic programming model in [3]. Chor supports multiparty sessions (similar to channels in the π-calculus [17]) and their mobility, which recalls introductions in PC. Chor is evaluated by encoding some representative examples from Service-Oriented Computing, such as distributed authentication and streaming, but none of the presented examples cover interesting algorithms as in here. Previous works based on Multiparty Session Types (MPST) [14] have explored the use of choreographies as protocol specifications for the coordination of message exchanges in some real-world scenarios [9,22,25]. Differently from our approach, these works fall back to a standard process calculus model for defining 13 implementations. Instead, our programs are choreographies. As a consequence, programming the composition of separate algorithms in PC is done on the level of choreographies, whereas in MPST composition requires using the low-level process calculus. Also, our choreography model is arguably much simpler and more approachable by newcomers, since much of the expressive power of PC comes from allowing parameterised procedures, a standard feature of most programming languages. The key twist in PC is that parameters are process names. 8 Conclusions We have reported our experience with the writing of some representative concurrent algorithms in the paradigm of choreographic programming. What have we learned from this experience? First, that choreographies make it easy to produce a simple concurrent implementation of a sequential algorithm. This is obtained by choosing process identifers to maximise the effect of implicit parallelism. Then, EPP takes care of generating the concrete separate programs and the required I/O actions to implement the described behaviour. This is a striking difference from how concurrent algorithms usually differ from their sequential counterparts. Although we do not necessarily get the most efficient possible distributed algorithm, this automatic concurrency is a pleasant property to observe. The second interesting realisation is that it is relatively easy to implement nontrivial algorithms in choreographies. We exemplified this point with our implementations of Gaussian elimination and Fast Fourier Transform. This is an important deviation from the typical use of toy examples, of limited practical significance, that characterises previous works in this programming paradigm. In conclusion, we showed that the current state of choreographic programming can already be used for addressing complex real-world computational problems. We also identified a future direction for extending the paradigm towards settings that require accessing the structure of process networks, such as some algorithms on graphs. References 1. M. Bravetti and G. Zavattaro. Towards a unifying theory for choreography conformance and contract compliance. In M. Lumpe and W. Vanderperren, editors, Proc. of SC, volume 4829 of LNCS, pages 34–50. Springer, 2007. 2. M. Carbone, K. Honda, and N. Yoshida. Structured communication-centered programming for web services. ACM Trans. Program. Lang. Syst., 34(2):8, 2012. 3. M. Carbone and F. Montesi. Deadlock-freedom-by-design: multiparty asynchronous global programming. In R. Giacobazzi and R. Cousot, editors, Proc. of POPL, pages 263–274. ACM, 2013. 4. M. Carbone, F. Montesi, and C. Schürmann. Choreographies, logically. In P. Baldan and D. Gorla, editors, Proc. of CONCUR, volume 8704 of LNCS, pages 47–62. Springer, 2014. 14 5. M. Carbone, F. Montesi, C. Schürmann, and N. Yoshida. Multiparty session types as coherence proofs. In L. Aceto and D. de Frutos-Escrig, editors, Proc. of CONCUR, volume 42 of LIPIcs, pages 412–426. Schloss Dagstuhl, 2015. 6. Chor. Programming Language. http://www.chor-lang.org/. 7. L. Cruz-Filipe and F. Montesi. Choreographies, computationally. CoRR, abs/1510.03271, 2015. Submitted for publication. 8. L. Cruz-Filipe and F. Montesi. Choreographies, divided and conquered. CoRR, abs/1602.03729, 2016. Submitted for publication. 9. P.-M. Deniélou and N. Yoshida. Dynamic multirole session types. In T. Ball and M. Sagiv, editors, Proc. of POPL, pages 435–446. ACM, 2011. 10. P.-M. Deniélou and N. Yoshida. Multiparty session types meet communicating automata. In Proc. of ESOP, LNCS, pages 194–213. Springer-Verlag, 2012. 11. M. Gabbrielli, S. Giallorenzo, and F. Montesi. Applied choreographies. CoRR, abs/1510.03637, 2015. 12. A. Grama, A. Gupta, G. Karypis, and V. Kumar. Introduction to Parallel Computing. Pearson, 2003. 2nd edition. 13. K. Honda, V. Vasconcelos, and M. Kubo. Language primitives and type disciplines for structured communication-based programming. In C. Hankin, editor, Proc. of ESOP, volume 1381 of LNCS, pages 22–138. Springer, 1998. 14. K. Honda, N. Yoshida, and M. Carbone. Multiparty asynchronous session types. In G. C. Necula and P. Wadler, editors, Proc. of POPL, pages 273–284. ACM, 2008. 15. I. Lanese, C. Guidi, F. Montesi, and G. Zavattaro. Bridging the gap between interaction- and process-oriented choreographies. In Proc. of SEFM, pages 323– 332. IEEE, 2008. 16. J. Lange, E. Tuosto, and N. Yoshida. From communicating machines to graphical choreographies. In S. K. Rajamani and D. Walker, editors, Proc. of POPL, pages 221–232. ACM, 2015. 17. R. Milner, J. Parrow, and D. Walker. A calculus of mobile processes, I and II. Information and Computation, 100(1):1–40,41–77, Sept. 1992. 18. F. Montesi. Choreographic Programming. Ph.D. thesis, IT University of Copenhagen, 2013. http://fabriziomontesi.com/files/m13_phdthesis.pdf. 19. F. Montesi. Kickstarting choreographic programming. CoRR, abs/1502.02519, 2015. 20. F. Montesi and N. Yoshida. Compositional choreographies. In P. R. D’Argenio and H. C. Melgratti, editors, Proc. of CONCUR, volume 8052 of LNCS, pages 425–439. Springer, 2013. 21. R. M. Needham and M. D. Schroeder. Using encryption for authentication in large networks of computers. Commun. ACM, 21(12):993–999, Dec. 1978. 22. N. Ng and N. Yoshida. Pabble: parameterised scribble. Service Oriented Computing and Applications, 9(3-4):269–284, 2015. 23. M. D. Preda, M. Gabbrielli, S. Giallorenzo, I. Lanese, and J. Mauro. Dynamic choreographies – safe runtime updates of distributed applications. In T. Holvoet and M. Viroli, editors, Proc. of COORDINATION, volume 9037 of LNCS, pages 67–82. Springer, 2015. 24. Z. Qiu, X. Zhao, C. Cai, and H. Yang. Towards the theoretical foundation of choreography. In C. L. Williamson, M. E. Zurko, P. F. Patel-Schneider, and P. J. Shenoy, editors, Proc. of WWW, pages 973–982. ACM, 2007. 25. N. Yoshida, P. Deniélou, A. Bejleri, and R. Hu. Parameterised multiparty session types. In C. L. Ong, editor, Proc. of FOSSACS, volume 6014 of LNCS, pages 128–145. Springer, 2010. 15
6cs.PL
1 Adaptive M -QAM for Indoor Wireless Environments : Rate & Power Adaptation arXiv:1711.07386v1 [cs.IT] 20 Nov 2017 Indrakshi Dey, Member, IEEE, Geoffrey G. Messier, Member, IEEE, and Sebastian Magierowski, Member, IEEE Abstract—This letter presents a detailed study for indoor wireless environments, where transmit power, rate and target bit error rate (BER) are varied to increase spectral efficiency. The study is conducted for the recently proposed joint fading and two-path shadowing (JFTS) channel model, which is shown to be accurate for modeling non-Gaussian indoor WLAN environments. Analysis is done for both average and instantaneous BER constraints without channel coding, where only a discrete finite set of constellations is available. Numerical results show that, for a JFTS channel i) varying only the transmission rate (modulation constellation size) achieves more improvement in spectral efficiency compared to varying transmit power only, and ii) varying rate and/or power subject to instantaneous BER (IBER) constraint offers better performance than when subject to average BER (A-BER) constraint. Index Terms—Adaptive modulation, joint fading/shadowing channel, indoor radio propagation, spectral efficiency. I. I NTRODUCTION Over the last decade, adaptive modulation (AM) [1] has emerged as a preferred technique for indoor wireless communication links (for eg. packet data CDMA standard [2], IEEE 802.11n [3]) to optimize the transmission scheme according to the state of the link. Its major advantage is that it can be designed to maintain a constant bit error rate (BER), irrespective of channel conditions, and at the same time, improving spectral efficiency. A plethora of channel parameters like transmit power, transmit symbol rate, modulation constellation size, instantaneous BER (I-BER) etc. can be varied to improve link spectral efficiency [4]–[7]. Detailed studies have been presented, where one or two modulation parameters have been varied to achieve increase in spectral efficiency [4], [5], [6], [8], [9], [10]. However, how and which parameters should be adapted for maximizing spectral efficiency depends on the channel model upon which the study is based on. Traditional fading channel models like Rayleigh, Rician or Nakagami-m do not accurately characterize the indoor WLAN link, since indoor wireless links suffer from combined smallscale fading and large-scale shadowing effects. Moreover, in an indoor wireless environment, the path between the access point (AP) and the users is too short for shadowing to be accurately characterized by the log-normal distribution and the mobile I. Dey is with CONNECT- Center for Future Networks and Communications, Trinity College Dublin, Dublin, Ireland (e-mail: [email protected]). G. G. Messier are with the Electrical and Computer Engineering, University of Calgary, Calgary, Canada (e-mail: [email protected]). S. Magierowski is with the Department of Electrical Engineering and Computer Science, Lassonde School of Engineering, York University, Toronto, Canada (e-mail: [email protected]). users restrict their movement within a small area due to the incapability of most WLAN standards to handle soft handoffs efficiently. Best on an extensive measurement campaign, the recently proposed joint fading and two-path shadowing (JFTS) channel model [11] is shown to be the best choice for characterizing such an indoor propagation scenario. In this letter, we provide a detailed study on the increase in spectral efficiency obtained by optimally varying combinations of transmission rate, power and target BER over a JFTS faded/shadowed communication link. Numerical results demonstrate that achievable spectral efficiency over the JFTS channel enhances considerably with low target BER, an improvement much higher than exhibited by the Rayleigh fading channel [5]. The JFTS distribution combines the Ricean fading model with the two-wave with diffused power (TWDP) [12] shadowing distribution. Towards this end, to the best of the authors’ knowledge, this letter is the first ever unified study on the trade-offs in adapting different AM parameters over composite faded/shadowed wireless links. Moreover, since the JFTS distribution includes a wide variety of channel conditions as special cases, this study can be readily used in many practical scenarios, both in indoor and outdoor environments. II. S YSTEM AND C HANNEL M ODEL A. System Model Let us assume a composite slow shadowed and flat faded communication channel with JFTS statistics suffering from additive white Gaussian noise (AWGN) n[i] with variance σn2 at time instant i. We transmit over this channel with average power S, signal bandwidth B and instantaneous signal-tonoise ratio (SNR) γ[i]. It is to be noted here that the received instantaneous SNR will be equal to γ[i] as long as the transmit power is constant and equal to S. This instantaneous SNR only reflects the influence of the channel on the SNR and not that of a varying transmit power. For an AM technique, the instantaneous transmit power S(γ[i]) will vary depending on γ[i]. In that case, the received instantaneous SNR is equal to γ[i](S(γ[i])/S). Since the communication link is assumed to be quasi-stationary, γ[i] will be constant over a block of time. Hence, for simplicity of notation, we can omit the time reference i relative to γ and S(γ). It is also noteworthy that we assume the average channel power gain is adjusted to be equal to unity through appropriate scaling of S. In this letter, we consider a family of adaptive M -QAM, where the choice of the available constellation sizes is restricted to M = Ml , 2l for any positive integer l. In 2 this technique, the entire SNR range is divided into L + 1 fading regions and the region boundaries are denoted by γl . The constellation size Ml with pl bits per symbol is assigned to the lth fading region (l = 0, 1, . . . , L). Assuming that L different modulation constellations are used, the lth constellation M = Ml is used for transmission as long as γl ≤ γ < γl+1 and γL = ∞. No signal is transmitted if γ ≤ γ0 . We also consider that the transmit power follows the relationship, S(γ) = S for γ ≥ γ0 and S(γ) = 0 for γ < γ0 . B. Channel Fading Statistics The probability density function (PDF) of instantaneous SNR per symbol over a JFTS fading/shadowing channel can be expressed as [13], fγ (γ) = tmax 4 X m X X Ai,h −Bh γ/γ e 2 γ(t!) i=1 h=1 t=0 t t   × D1t C1i C3i γ/γ + D2t C2i C4i γ/γ (1) hΩ where, Ai,h = bPi R e−K−Sh , Bh = 2PΩ2 r2 , C1i = eSh ∆Ti , 1 P2 h C3i = KSh (1 − ∆Ti )Ω/(P1 P2 ), C2i = e−Sh ∆Ti , C4i =  2 γ t Ptmax +1 KSh (1 + ∆Ti )Ω/(P1 P2 ), D1t = γ(t!) u=1 (u − Ai,h C3i    γ(t!)2 γ u γ t Ptmax +1 γ u , Ti = 1)! Bh , D2t = Ai,h C4i u=1 (u − 1)! Bh cos((i−1)π/7), I0 is the 0th-order modified Bessel function of 2 2 the first kind, m is the quadrature order, Rh = |rwhh| erh −rh /2P1 , Ω is the mean-squared value of the JFTS envelope given by Ω = 4P1 P2 (1 + K)(1 + Sh ) [14]. In (1), γ is the average received SNR and can be given by γ = S/σn2 . The parameter K is the small scale fading parameter, Sh is the shadowing parameter, ∆ is the shape parameter of the shadowing distribution, P1 and P2 are the mean-squared voltages of the diffused and the shadowed components respec3577 751 , a2 = 17280 , tively. In (1), bi = ai I0 (1), where a1 = 17280 2989 49 a3 = 640 and a4 = 17280 . The multiplier wh denotes the Gauss-Hermite quadrature weight factors √ which is tabulated in [15] and is given by, wh = (2m−1 m! π)/(m2 [Hm−1 (rh )]2 ), where Hm−1 (·) is the Gauss-Hermite polynomial with roots rh for h = 1, 2, . . . , m. C. Instantaneous BER (I-BER) 1.6γS(γ) − (M l −1)S channel is approximated by, BER(γ) ≈ 0.2 e , which is tight within 1 dB for Ml ≥ 4 and BER ≤ 10−3 . Hence the I-BER asR a function of the instantaneous ∞ SNR γ, BERl (γl S/S) = γl BER(γ)fγ (γ)dγ over a JFTS faded/shadowed channel can be calculated as, tmax 4 X m X X ǫi,h,t i=1 h=1 t=0 (t!)2 Γ t + 1, ξh γl t+1  (2) t t 0.2 Ai,h (D1t C1i C3i +D2t C2i C4i )S (Ml −1)t+1 , (Bh S(Ml −1)+1.6γS(γ))t+1 Pt gv −g Γ(t+1, g) = (t!) e v=0 v! is the generalized upper incoml −1)+1.6γS(γ) . plete Gamma function [15] and ξh = Bh S(M Sγ(Ml −1) where ǫi,h,t = AND P OWER A DAPTATION In this section, we determine the rate region boundaries and transmit power constrained to I-BER or average BER (ABER) for improving spectral efficiency over a JFTS channel. In particular, we study the following cases : adaptive rate and constant power with I-BER constraint (A-Rate C-Pow I-BER), adaptive rate and constant power with A-BER constraint (ARate C-Pow A-BER), constant rate and adaptive power with I-BER constraint (C-Rate A-Pow I-BER) and adaptive rate and power with I-BER constraint (A-Rate A-Pow I-BER). A. A-Rate C-Pow I-BER We now consider the use of an I-BER constraint and a constant transmit power S(γ) =RS that is adjusted to satisfy ∞ the average power constraint, S γ0 fγ (γ)dγ = S [10], [16]. It implies that the cut-off SNR γ0 is to be chosen such that the transmit power satisfies the average power constraint. The transmit power used when transmission does occur will be higher than S, and for a JFTS faded/shadowed channel can be obtained as (using integral solution from [17, eq. 3.351.3, p. 340]), S= tmax 4 X m X X i=1 h=1 t=0 SAi,h Γ(t + 1, Bh γ0 /γ) (t!)2 Bht+1 t t × (D1t C1i C3i + D2t C2i C4i ). (3) The I-BER constraint is fulfilled at all the rate region boundaries such that, BERl (γl ) = TBER where TBER is the target BER. Using series expansion of Gamma function and putting it back in (3), the final expression for rate region boundaries can be obtained as,   1/u  tmax X 4 X m X t X t!(u − 1)! u 2 ˆ W ξh TBER (4) γl = ˜ ǫ̂i,h,t t=0 u=0 ξh i=1 h=1 t+1 t t (Ml −1)t+1 0.2 Ai,h (D1t C1i C3i +D2t C2i C4i )S , t+1 (Bh S(Ml −1)+1.6γS) Bh S(Ml −1)+1.6γS ˆ l −1)+1.6γS , ξh = Bh S(M and W (·) is Sγ(1−Ml ) Sγ(Ml −1) where ǫ̂i,h,t = ξ˜h = the Product-Log function denoted as the Lambert-W function tabulated in [15]. B. A-Rate C-Pow A-BER Assuming a square M -QAM with Gray-coded bits, the instantaneous BER (I-BER) as a function of γ on an AWGN BERl (γl S/S) = III. R ATE Here, we investigate the case concerning constant power and adaptive rate under the A-BER constraint. Similar to Subsection III-A, the transmit power will satisfy (3). In order to maintain the A-BER constraint, the rate region boundaries should satisfy BERl (γl ) = TBER − λ1 [10], where λ 6= 0 is the Lagrangian multiplier that satisfies the A-BER constraint. Using this constraint and following the same steps as the previous case, the final expression for rate region boundaries can be given by,  u1     tmax X 4 X m X t X 1 u 2 t!(u − 1)! ˆ TBER − W ξh . γl = ǫ̂i,h,t λ ξ˜ i=1 h=1 t=0 u=0 h (5) A bisection method will be used to numerically search for λ that satisfies the A-BER constraint. 3 8 8 If the transmit power S is chosen such that BER becomes equal to TBER for all γ ≥ γ0 , an I-BER constraint is fulfilled in spite of constant modulation rate. Hence, tmax X 4 X m X t X ǫ̂i,h,t −ξ̂h γ ˆ u e (ξh γ) = TBER. t!u! t=0 u=0 i=1 (6) h=1 ASE, ηA-Rate, C-Rate (bps/Hz) C. C-Rate A-Pow I-BER A-Rate A-Pow I-BER 6 A-Rate C-Pow I-BER C-Rate A-Pow I-BER 4 A-Rate A-Pow I-BER 6 4 C-Rate A-Pow I-BER A-Rate C-Pow I-BER Using the expressions for ξ̂h , ǫ̂i,h,t from Subsection III-A and putting them back in (6), we can rewrite (6) as, P4 Pm Ptmax Pt S u−t−1 −1.6γ S e = ζ, h S + 1.6γS) u=0 (B t=0 h=1 i=1 u u−t−1 Bh γ/γ e t!u! TBER γ S . The final expreswhere ζ = γ u 0.2 t +D C C t ) Ai,h (D1t C1i C3i 2t 2i 4i sion for the transmit power S can be calculated as, " 4 m tmax X t S XXX S= (t + 1 − u) 1.6γ i=1 h=1 t=0 u=0 # # " 1 Bh γ u−t−1 γζ (7) − Bh × W (2.71828) γ(t+1−u) Sγ(u − t − 1) Avg. Received SNR (dB) Fig. 1. Spectral Efficiency of Adaptive M-QAM at TBER of 10−3 over JFTS faded/shadowed channels when user and AP are in (a) Same Room : K = 10 dB, Sh = 10.5 dB, ∆ = 0.75 (b) Separated by 2-3 Walls : K = 6.5 dB, Sh = −1.5 dB, ∆ = 0.25. Plotted results are analytic only. It is to be noted here that the cut-off rate γ0 must be such that the average transmit power S satisfies Rchosen ∞ Sf (γ)dγ = S. γ γ0 For adaptive M -QAM, we consider L = 9 transmission modes (No transmission, 2-QAM, 4-QAM, 8-QAM, 16-QAM, 32QAM, 64-QAM, 128-QAM, 256-QAM). A. Calculation of Average Spectral Efficiency (ASE) In this case, both rate and power are chosen based on channel power gain information. When the I-BER is required to be equal to TBER for all SNR, the transmit power can be obtained using the constraint, BERl (γl S/S) = TBER, which finally can be expressed as, " 4 m tmax X t S(Ml − 1) X X X (t + 1 − u) S= 1.6γ i=1 h=1 t=0 u=0 # # " 1 Bh γl u−t−1 ζ̂ (8) − Bh × W (2.71828) γ(t+1−u) t+1 γl γ(u − t − 1) Assuming Nyquist data pulses at the lowest possible bandwidth 1/τs , where τs is the symbol period of P the modulation, average spectral efficiency, R γl L−1 fγ (γ)dγ, achievable over a JFTS ηA−Rate = l=0 pl γl−1 faded/shadowed communication link can be calculated as (using integral solution from [17, eq. 3.351.2, p. 340]), D. A-Rate A-Pow I-BER u u−t−1 t!u! TBER γ S where ζ̂ = 0.2 Ai,h t +D C C t ) . In order to obtain (D1t C1i C3i 2t 2i 4i the optimum rate region boundaries γl , we need to solve [16], l−1 , where p−1 = 0 and S−1 = 0. From (8), Sl−1 − Sl = pl −p λ the following expression can be arrived at, " " 4 m tmax X t Bh γl S(Ml−1 − Ml ) X X X W (2.71828) γ(t+1−u) 1.6γ i=1 h=1 t=0 u=0 # # 1 u−t−1 ζ̂ pl − pl−1 (9) × t+1 (t + 1 − u) − Bh = λ γl γ(u − t − 1) Solving the above equation, the expression for the optimum rate region boundaries γl can be obtained. In this case too, a bisection method will be used to numerically search for λ which satisfies the power constraint in (9). IV. N UMERICAL R ESULTS AND D ISCUSSION In this section, we derive analytical expressions for spectral efficiencies using the optimal rate region and power region boundaries derived for different AM techniques in Section III. Next, these expressions are plotted as functions of target BERs and average received SNR (γ) and the plots are generated by varying the fundamental parameters of the JFTS distribution. 2 A-Rate C-Pow A-BER 2 A-Rate C-Pow A-BER 2-3 Walls Separation Same Room 0 0 0 10 20 30 0 10 20 30 tmax L−1 4 X m X XX pl Ai,h t (D1t C1i C3i + D2t C2i 2 B t+1 (t!) h l=0 i=1 h=1 t=0   t (10) × C4i ) Γ(t + 1, Bh γl /γ) − Γ(t + 1, Bh γl−1 /γ) . ηA−Rate = For C-Rate A-Pow technique under I-BER constraint, the R∞ average spectral efficiency, ηC−Rate = pmax γ0,l fγ (γ)dγ, with pmax = max{pl } for 0 ≤ l ≤ L − 1 can be calculated as, ηC−Rate tmax 4 X m X X pmax Ai,h = Γ(t + 1, Bh γ0,l /γ) 2 B t+1 (t!) h i=1 h=1 t=0 t t × (D1t C1i C3i + D2t C2i C4i ). (11) B. Comparison of AM Techniques The spectral efficiency for TBER = 10−3 and two different communication scenarios (same room and 2-3 walls separation between user and AP) are illustrated in Fig. 1 for the four considered techniques. The gain in the spectral efficiency under good communication link condition is considerable, as compared with poor communication scenario. Comparing different policies from the spectral efficiency point of view, we observe that for the ‘same room’ scenario, the highest and lowest ASE are provided by A-Rate A-Pow I-BER and A-Rate C-Pow A-BER respectively due to the highest and lowest degrees of freedom respectively. However, as the link condition deteriorates, ASEs of different AM techniques approach closer to each other, except A-Rate A-Pow I-BER, which still offers considerable improvement over the other ones. 4 D. Impact of Target BER Fig. 3 demonstrates that ASE over JFTS link improves considerably with the decrease in TBER. It is worth highlighting that this improvement is much higher than over Rayleigh fading [5], where a huge decrease in TBER results in a very small improvement in ASE. The reason can be attributed to the fact that JFTS channel has a fading parameter K always higher than 0 dB (For Rayleigh channel, K = 0 dB). Hence, the JFTS channel experiences less severe fading in comparison to the Rayleigh fading condition. V. C ONCLUSION The main contribution of this letter is to provide a systematic study on the increase in spectral efficiency obtained by optimally varying combinations of modulation constellation 8 8 A-Rate C-Pow I-BER C-Rate A-Pow I-BER 6 ASE, ηA-Rate (bps/Hz) ASE, ηC-Rate (bps/Hz) 6 4 4 2 2 No. of Walls increases No. of Walls increases Simulation 0 0 10 20 30 0 0 10 20 30 Avg. Received SNR (dB) Fig. 2. Spectral Efficiency of Adaptive M-QAM at TBER of 10−3 over JFTS faded/shadowed channels with (a) A-Rate C-Pow I-BER and (b) C-Rate APow I-BER. Simulation result is also plotted for comparison. 8 6 6 A-Rate No. of Walls increases No. of Walls increases 4 4 ASE, Fig. 2 is used to compare the effect of different JFTS parameters on the achievable ASE using AM techniques. Four different indoor WLAN communication scenarios are considered, where the user and the AP are in the same room (K = 13 dB, Sh = 12 dB, ∆ = 0.9), separated by one (K = 10 dB, Sh = 6 dB, ∆ = 0.7), two (K = 7 dB, Sh = −1 dB, ∆ = 0.5) and three (K = 4 dB, Sh = −6 dB, ∆ = 0.3) walls. The target BER is kept constant at 10−3 in case of both AM techniques under consideration. Achievable ASE decreases with the decrease in the JFTS parameters, K and Sh and gets lower than over traditional fading models [10] as soon as K decreases to 7 dB and Sh to −1 dB (2walls separation scenario). The reason for this behavior is that smaller K and Sh , poorer is the link condition with higher fading and/or shadowing severity. We also compare analytical results with those obtained through Monte Carlo simulation in Fig. 2. Simulated results are plotted for the case where the user and the AP are in the same room in Fig. 2(a), and for the case where the user and the AP are separated by 2 walls in Fig. 2(b). It is evident that analytical results offer good agreement with that of simulation results and they fall within 1-2 dB of the simulation results. 8 (bps/Hz) C. Impact of JFTS Parameters 2 2 TBER = 10 -6 TBER = 10 -3 0 0 10 20 0 30 0 10 20 30 Avg. Received SNR (dB) Fig. 3. Spectral Efficiency of Adaptive M-QAM with A-Rate C-Pow I-BER technique over JFTS faded/shadowed channels with two sets of TBER, (a) 10−3 and (b) 10−6 . Plotted results are analytic only. size, power and target BER over a JFTS faded/shadowed indoor wireless link. Analytical results are shown to offer good agreement with that of the simulation results. Achievable ASE decreases as the number of partitions increases between the mobile user and the AP. Spectral efficiency also improves with the increase in degrees of freedom offered by different AM techniques. It is also note-worthy that ASE improves considerably with the decrease in TBER, an improvement much higher than what is observed in case of traditional fading channel models. R EFERENCES [1] A. Svensson, “An introduction to adaptive QAM modulation schemes for known and predicted channels,” IEEE Commun. Mag., vol. 95, no. 12, pp. 2322-2336, Dec. 2007. [2] E. T. S. Institute, “CDMA / HDR : A bandwidth efficient high speed wireless data service for nomadic users,” IEEE Commun. Mag., vol. 38, no. 7, pp. 70-77, Jul. 2000. [3] IEEE-SA, IEEE 802.11n-2009 - Amendment 5: Enhancements for Higher Throughput. IEEE, 2009. [4] W. T. Webb and R. Steele, “Variable rate QAM for mobile radio,” IEEE Trans. Commun., vol. COM-43, pp. 2223-2230, Jul. 1995. [5] A. J. Goldsmith and S. G. Chua, “Variable-rate variable-power M-QAM for fading channels,” IEEE Trans. Commun., vol. 45, no. 10, pp. 12181230, Oct. 1997. [6] A. J. Goldsmith and P. Varaiya, “Capacity of fading channels with channel side information,” IEEE Trans. Inform. Theory, vol. 43, pp. 1218-1230, Nov. 1997. [7] C. Kse and D. L. Goeckel, “On power adaptation in adapting signaling systems,” IEEE Trans. Commun., vol. 48, pp. 1769-1773, Nov. 2000. [8] J. K. Cavers, “Variable rate transmission for Rayleigh fading channels,” IEEE Trans. Commun., vol. COM-20, pp. 15-22, Feb. 1972. [9] D. L. Goeckel, “Adaptive coding for time-varying channels using outdated fading estimates,” IEEE Trans. Commun., vol. 47, pp. 844-855, Jun. 1999. [10] S. T. Chung and A. J. Goldsmith, “Degrees of freedom in adaptive modulation: A unified view,” IEEE Trans. Commun., vol. 49, no. 9, pp.1561-1571, Sep. 2001. [11] I. Dey, G. G. Messier, and S. Magierowski, “Joint fading and shadowing model for large office indoor WLAN environments,” IEEE Trans. Antennas Propagat., vol. 62, no. 4, pp. 2209-2222, Apr. 2014. [12] G. D. Durgin, T. S. Rappaport, and D. A. deWolf, “New analytical models and probability density functions for fading in wireless communications,” IEEE Trans. Commun., vol. 50, no. 6, pp. 1005-1015, Jun. 2002. 5 [13] I. Dey, G. G. Messier, and S. Magierowski, “Adaptive modulation and coding for large open office indoor wireless environments,” in Proc. IEEE VTC-Fall, Sep. 2016, p. 5 pages. [14] I. Dey, G. G. Messier, and S. Magierowski, “Fading statistics for the joint fading and two path shadowing channel,” IEEE Wireless Commun. Lett., vol. 3, no. 3, pp. 301-304, Jun. 2014. [15] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables, 9th ed. USA: New York: Dover, 1972. [16] S. Falahati, A. Svensson, T. Ekman, and M. Sternad, “Adaptive modulation systems for predicted wireless channels,” IEEE Trans. Commun., vol. 52, no. 2, pp. 307-316, Feb. 2004. [17] I. S. Gradshteyn and I. M. Ryzhik, Table of Integrals, Series and Products, 7th ed. USA: Elsevier Academic Press, 2007.
7cs.IT
arXiv:1803.02333v1 [math.GR] 6 Mar 2018 Eilenberg–Mac Lane Spaces for Topological Groups Ged Corob Cook Abstract The goal of this paper is to establish a topological version of the notion of an Eilenberg–Mac Lane space. If X is a pointed topological space, π1 (X) has a natural topology coming from the compact-open topology on the space of maps S 1 → X. In general the construction does not produce a topological group because it is possible to create examples where the group multiplication π1 (X) × π1 (X) → π1 (X) is discontinuous. This failure to obtain a topological group has been noticed by others, for example Fabel. However, if we work in the category of compactly generated, weakly Hausdorff spaces, we may retopologise both the space of maps S 1 → X and the product π1 (X)× π1 (X) with compactly generated topologies to get that π1 (X) is a group object in this category. Such group objects are known as kgroups. Next we construct the Eilenberg–Mac Lane space K(G, 1) for any totally path-disconnected k-group G. The main point of this paper is to show that, for such a G, π1 (K(G, 1)) is isomorphic to G in the category of k-groups. All totally disconnected locally compact groups are k-groups and so our results apply in particular to profinite groups. This answers questions that have been raised by Sauer. We also show that there are Mayer–Vietoris sequences and a Seifert– van Kampen theorem in this theory. The theory requires a careful analysis using model structures and other homotopical structures on cartesian closed categories as we shall see that no theory can be comfortably developed in the classical world. This work was done partly while supported by EPSRC grant EP/N007328/1, and partly while supported by ERC grant 336983 and the Basque government grant IT974-16. 2010 Mathematics Subject Classification: 55P20; 18G55; 18G30. Keywords: Eilenberg–Mac Lane space; k-group; homotopical algebra. 1 Introduction There are three constructions for discrete groups G that define the same classifying space BG. This space is an Eilenberg–Mac Lane space K(G, 1); it represents cohomology H 1 (X, G); it classifies G-torsors. This is described in detail in the preface to [10]. For topological groups, the third of these definitions makes sense, and indeed there are standard constructions of BG for topological groups G that satisfy this definition. In fact there are two slightly different definitions of classifying space possible in this context. A G-torsor is a map X → Y of spaces together with a free G-action on X such that X/G ∼ = Y ; some definitions require also that the G-action be locally trivial. With this local triviality condition, the classifying space for G-torsors is given by Milnor’s construction. An alternative classifying space contruction is given by Segal in [15]: by considering G as a one-object topological category, we may take the geometric realisation of the nerve of G. The question of what this space (usually also denoted BG) actually classifies is rather more subtle; see [11] for details on this. On the other hand, there has not previously been any way to apply the first two definitions to the situation of topological groups. Here we construct Eilenberg–Mac Lane spaces for totally path-disconnected groups, in Theorem 6.4. Being totally path-disconnected is crucial because the lack of any ‘higherdimensional homotopy’ for such spaces allows us to control the homotopy of the new spaces we will construct from them. The paper is structured as follows. Section 1 gives some background on the category of compactly generated, weakly Hausdorff spaces and group and module objects in this category. Section 2 motivates our definition of homotopy groups and related structures, over a more common definition in the literature. For a pointed topological space X, there is a natural compact-open topology on the space of continuous pointed maps S 1 → X, and we can give the fundamental group π1 (X) the quotient topology from this. In general the construction does not produce a topological group because it is possible to create examples where the product map π1 (X) × π1 (X) → π1 (X) is discontinuous. This failure to obtain a topological group has been noticed by other authors including for example Fabel. However, the novelty here is that our π1 (X) is a group object in the category of compactly generated weakly Hausdorff topological spaces. Such groups are called k-groups. In particular, it is always the case that the group multiplication is continuous when one retopologises the product π1 (X) × π1 (X) with the compactly generated topology. This raises the prospect of constructing a topological space X with chosen homotopy 2 groups. We take advantage of this better categorical behaviour by largely restricting attention in this paper to the category U of compactly generated, weakly Hausdorff spaces. Section 3 recalls the model category theory and homotopical structures will need from [2]. We have two different indispensable homotopical structures on the category of simplicial spaces sU, which we call the compact Hausdorff structure and the regular structure; these are defined below. Weak equivalences in the former structure are also weak equivalences in the latter, while weak equivalences in the regular structure induce isomorphisms of the topological homotopy groups described above. We give here definitions for the singular simplicial space functor Sing : U → sU and geometric realisation |−| : sU → U. These form an adjoint pair analogously to the classical singular simplicial set functor and geometric realisation. Understanding these functors, together with the left derived functor L|−| of |−|, is crucial to our approach. Sections 4 and 5 are the technical heart of the paper. The former consists primarily of proving a continuous analogue of the Seifert–van Kampen Theorem: Theorem A (Theorem 4.1). If C is an open cover of X ∈ U, write C ′ for the poset of finite intersections of sets in C, ordered by inclusion. Then Sing(X) is weakly equivalent (in the regular structure on sU) to the homotopy colimit (in the compact Hausdorff structure on sU) of {Sing(U)}U ∈C ′ . In the latter, analogously to our topological homotopy groups, we consider the topological singular homology groups of a space, and prove an Excision Theorem and a Mayer–Vietoris sequence. Theorem B (Theorem 5.6). Given subspaces A ⊆ B ⊆ X in U with A closed and B open, the inclusion (X \ A, B \ A) → (X, B) induces isomorphisms of the homology group objects Hn (X \ A, B \ A) → Hn (X, B) for all n. Equivalently, for open subspaces A, B ⊆ X covering X, the inclusion (B, A ∩ B) → (X, A) induces isomorphisms of homology group objects Hn (B, A ∩ B) → Hn (X, A) for all n. Theorem C (Theorem 5.7). For open subspaces A, B ⊆ X covering X there is a long exact sequence of homology group objects · · · → Hn+1 (X) → Hn (A ∩ B) → Hn (A) ⊕ Hn (B) → Hn (X) → · · · . We also show in Theorem 5.8 that this topological singular homology theory satisfies the axioms of a generalised homology theory. 3 Finally in Section 6, we put all the work together to construct the promised Eilenberg–Mac Lane spaces. Specifically, we show: Theorem D (Theorem 6.3). Suppose X ∈ sU with Xn totally path-disconnected for all n. Then Sing ◦ L|X| is weakly equivalent to X in the regular structure. Now given a group object G in U, in [2] a simplicial space W̄ G is constructed with π1 (W̄ G) = G and all other homotopy groups trivial. When G is totally path-disconnected so is each W̄ Gn . So we can apply Theorem D. Theorem E (Theorem 6.4). If G is totally path-disconnected, L|W̄ G| is an Eilenberg–Mac Lane space K(G, 1) for G. Finally we justify our use of the totally path-disconnected condition, rather than the stronger one of being totally disconnected, by constructing in Example 6.5 a totally path-disconnected group object in U which is not totally disconnected. 1 Topological groups and modules We work in U, the category of compactly generated, weakly Hausdorff spaces, together with a modification of the compact-open topology on spaces of maps. This makes U into a cartesian closed category; see [16] for a good general reference on this. We will write U(X, Y ) for the space of maps X → Y in U equipped with this topology, and more generally for a category C enriched over a category D we will write CD (X, Y ) for the enriched hom-object, or C(X, Y ) when there is no ambiguity. Note that the definitions in this section also make sense for spaces in K, the category of compactly generated spaces, which is also cartesian closed; we restrict to U for compatibility with later sections, where a model structure is only constructed on U. We can define internal group objects in U: these are groups G with a topology on their underlying set making multiplication G × G → G and inversion G → G continuous. Note that the product G × G here is the internal product in U. For ease of use we will refer to such group objects as topological groups, although they are not topological groups in general: in particular, writing ×0 for the product in the category of topological spaces, the map G ×0 G → G may not be continuous. Indeed, [6, Example 2.14] shows that group objects G in U for which G ×0 G → G is not continuous do arise in nature. As for these topological groups, we can define a category of ring objects in U, which we will call topological rings. Similarly, for a topological ring R, 4 we write R-UMod for the category of left R-module objects in U. All this includes as a special case UAb, the category of abelian group objects in U, which is Z-UMod where Z is given the discrete topology – indeed, results that apply analogously to R-UMod will mostly be stated in this paper as results about UAb, with the generalisation being left to the reader. For details on this module category, see [2, Sections 7-8]. In the rest of this section we summarise the results we will need, without further reference. Given A, B ∈ R-UMod, write UR (A, B) for the set of morphisms A → B: this naturally has the structure of an abelian group, and the restriction of the topology on U(A, B) makes U R (A, B) into an abelian topological group, so that R-UMod becomes an additive category enriched over UAb. One of the generalisations of abelian categories is the concept of quasiabelian categories. A quasi-abelian category is an additive category with all kernels and cokernels, satisfying two additional properties: (i) in any pull-back square A′ f′  f A B′ /  B, / if f is the cokernel of some map then so is f ′ ; (ii) in any push-out square f A  f′ A′ / B  / B′, if f is the kernel of some map then so is f ′ . It turns out that R-UMod is a complete and cocomplete quasi-abelian category. R-UMod also has free modules. That is, the forgetful functor RUMod → U has a left adjoint, which we will write as F . See [14, Section 1] for a complete account of homological algebra over quasi-abelian categories. For C a quasi-abelian category there is an abelian category LH(C) called the left heart of C whose objects consist of monomorphisms in C. There is a fully faithful, exact embedding C → LH(C) which induces an equivalence on the derived categories of chain complexes in the two categories. Thus for a chain complex in C we can think of it as a chain complex in LH(C) and take homology there: the resulting nth homology functor sends fn−1 fn · · · → Cn+1 −→ Cn −−→ Cn−1 → · · · 5 to the map coim(fn ) → ker(fn−1 ) in the left heart. Since the embedding C → LH(C) is exact, the family LH∗ of functors takes a short exact sequence of chain complexes in C and gives a long exact sequence in the left heart. Note that all this can be dualised to give a right heart and a right homology functor, which we will not use in this paper. The class of all kernel-cokernel pairs in R-UMod thus makes it into an exact category, in the sense of Quillen. We will refer to this as the quasiabelian structure, or the regular structure, by analogy to the non-additive case below. However, with this exact structure R-UMod does not have enough projectives, which is a serious drawback in doing homological algebra. Since R-UMod has free modules (that is, the forgetful functor to U has a left adjoint), we have various other structures available, which make R-UMod into a left exact structure (a generalisation of an exact structure which requires a well-behaved class of deflations but not inflations) with enough projectives. We are interested here the case where the projectives are summands of free modules on disjoint unions of compact Hausdorff spaces and the deflations are the epimorphisms A → B such that the induced map UR (P, A) → UR (P, B) is surjective for all projectives P . We will refer to this as the compact Hausdorff exact structure. 2 Topological homotopy groups Given a space X, a classical homotopy group, which we write as πnabs (X, x), is calculated as a quotient of the set of pointed maps S n → X. Since this set of maps has a natural topology, the compact-open topology, the obvious approach to putting a topology on πnabs (X, x) is to give it the quotient topology. Indeed there is a literature using this definition; see for example [3]. This definition has a shortcoming: this topology does not always make abs πn (X, x) into a topological group, as shown in [3]. Essentially the problem is caused by the failure of the category of topological spaces, together with the compact-open topology, to be cartesian closed. Our solution is to restrict to a convenient category of spaces which is. Using the same definitions internally to K, the category of compactly generated space, πnabs (X, x) is made into a group object in K, as shown in [2]. We write πnK (X, x) for this. But this definition has a shortcoming too. Given a fibration in U (in the model structure defined below), we would like to emulate the classical situation by obtaining a long exact sequence of topological homotopy groups; but such a sequence does not hold here. The problem here is that U and K are regular, but not Barr-exact, categories. 6 See [2] for more on this. But regular categories C have a well-behaved, canonical embedding into a Barr-exact category: the objects of this category are equivalence relations in C. We will identify spaces in U with their image in the exact completion Uex under this embedding. Explicitly, given X ∈ U, the space U(S n , X) of based maps S n → X (for some choice of basepoint x) has a natural topology in U, as before; so does the space H of based homotopies between such maps. The inclusions (id, 0), (id, 1) : S n → S n × [0, 1] induce a pair of maps H ⇒ U(S n , X), or equivalently a map H → U(S n , X) × U (S n , X). Factoring this map as a quotient followed by an injection gives a injective map H ′ → U(S n , X) × U(S n , X), and this is the equivalence relation we take to be the nth homotopy group πn (X, x): it is a group object in Uex . With this definition, a fibration in U, in the regular structure defined below, does give a long exact of these homotopy groups: [2, Section 5]. 3 Model structures In this paper we want to construct spaces with some chosen topological homotopy group G. As for abstract groups, it quickly becomes necessary to develop some tools to allow the calculation of the homotopy groups of any interesting spaces. In our context the most important tools are the model structures defined in [2]. We recall here the pieces of machinery we will need. We use the definitions of model structures and model categories given in [5, Section 1.1]. That is, a model category is a complete and cocomplete category together with a model structure, and factorisations are required to be functorial. Given two model categories C and D and an adjoint pair of functors F : C ⇄ D : G with F ⊣ G, suppose F preserves cofibrations and trivial cofibrations, or equivalently G preserves fibrations and trivial fibrations. We say that such a pair of functors forms a Quillen adjunction. Then we can define the left derived functor LF of F and dually the right derived functor RG of G, such that these derived functors preserve weak equivalences and hence induce functors on the associated homotopy categories. Explicitly, LF 7 can be constructed as the composite of F with the cofibrant replacement functor on C, and dually for RG. An important example of this idea is that of homotopy colimits (or dually homotopy limits): given a small category E, the colimit functor colim : C E → C is left adjoint to the diagonal functor ∆ : C → C E . We would like to put a model structure on C E that makes these functors into a Quillen adjunction. Theorem 3.1. If C is class-cofibrantly generated in the sense of [2], the projective model structure defined in [10, Section A.2.8] exists on C E , is classcofibrantly generated, and makes colim ⊣ ∆ a Quillen adjunction. Proof. The proof of [10, Proposition A.2.8.2] proves the existence of the projective model structure on C E when C is cofibrantly generated: the hypothesis of combinatoriality is not used in this part of the proof. But in fact a careful reading shows that exactly the same proof works in our situation, and shows that C E is class-cofibrantly generated. Then the final statement follows exactly as in [10, Proposition A.2.8.7(1)]. We can now define homotopy colimits (of shape E) as the left derived functor hocolim : C E → C of colim. Remark 3.2. The question of the existence of homotopy limits is a more delicate one here; the usual requirement for the existence of an injective model structure is that C be combinatorial. It may be possible to pursue a definition of class-combinatorial, analogously to the definition of class-cofibrantly generated, and construct homotopy limits in that way. But we will not need this here. Let us now define the model structures we will need in this paper. First on U: a weak equivalence (respectively, fibration) is a map X → Y such that the induced map U(K, X) → U(K, Y ) is a weak homotopy equivalence (respectively, Serre fibration) for all compact, Hausdorff spaces K. A cofibration is a retract of a composition of pushouts by maps of the form K × D n × {0} → K × D n × [0, 1], where D n is the n-ball. op Next we consider the category of simplicial spaces sU = U ∆ . Here ∆ is the simplex category – see [5, Chapter 3] for details on ∆ and simplicial sets. This category is also cartesian closed by [2, Proposition 3.2], so in particular it is enriched, via a forgetful functor, over simplicial sets sSet and over U. We get for free a projective model structure induced from the compact Hausdorff model structure on U, but here we consider a different one. See [2] for more details. Let Λnk , ∂∆n and ∆n be the standard simplicial (n, k)-horn, n-sphere and n-simplex, respectively. Let I be the class of maps in sU of the form ι × idK : ∂∆n × K → ∆n × K, 8 K compact Hausdorff, and let J be the class of maps of the form ι′ × idK : Λnk × K → ∆n × K, K compact Hausdorff, where ι : Λnk → ∆n , ι′ : ∂∆n → ∆n are the inclusion maps. Then a map f in sU is a cofibration if it is a retract of a composition of pushouts by maps in I, a fibration if it has the right lifting property with respect to J, and a weak equivalence if sU sSet (disc K, f ) is a weak equivalence in sSet for all compact Hausdorff K. Here disc is the constant simplicial space functor. Finally, we also consider the categories of simplicial objects in R-UMod and chain complexes in non-negative degrees in R-UMod. We write s(RUMod) for the former category and c(R-UMod) for the latter. By [9, Theorem 1.2.3.7], these two categories are equivalent, and correspondingly we get equivalent model structures on them. We give an explicit description of the structure on c(R-UMod): a map is a weak equivalence if its mapping cone is exact in the compact Hausdorff exact structure, a cofibration if it is a levelwise split monomorphism, and a fibration if it is a levelwise deflation in the compact Hausdorff exact structure. Theorem 3.3. These data define model structures on U, sU and c(R-UMod), which we call the compact Hausdorff model structures. All three are classcofibrantly generated. Proof. [2, Theorem 2.4, Theorem 4.19, Theorem 8.2] These categories have various Quillen functors between them, as shown in the following diagram: U ⇆Sing sU ⇄FU s(R-UMod) ∼ = c(R-UMod). |−| Here Sing is the singular simplicial space functor, |−| is geometric realisation, F is the free R-module functor and U is the forgetful functor; |−| is left adjoint to Sing and F is left adjoint to U. See [2] for details. We also need the standard Quillen model structures on U and sSet as defined in [5], where the weak equivalences are weak homotopy equivalences. Finally, we need one more homotopical structure one sU, which we call the regular structure. In [2] the regular structure is referred to as (sU, reg). The regular structure is defined on internal Kan complexes in sU, that is, objects X such that Xn → Λnk (X) is a regular epimorphism for all n, k. On these objects X we can define homotopy group objects πn (X, x) in the exact completion of U, for a choice of basepoint x. Here we say a map X → Y is a weak equivalence if it induces isomorphisms of all homotopy groups, a 9 fibration if Xn → Λnk (X) ×Λnk (Y ) Yn is a regular epimorphism for all n, k and a trivial fibration if Xn → ∂∆n (X) ×∂∆n (Y ) Yn is a regular epimorphism for all n. We would like to extend some of this structure to all of sU. Certainly the definition of fibrations and trivial fibrations makes sense. As for abstract simplicial sets, there is a functor Ex∞ (see [8]). It is stated in [8, Theorem 2.8] that in a regular category, if finite limits commute with colimits of sequences indexed by N, then Ex∞ preserves fibrations and trivial fibrations, Ex∞ (X) is an internal Kan complex for all X in sU, and if X is an internal Kan complex, the canonical map X → Ex∞ (X) is a weak equivalence. This does not hold in U. But we do have the following. Lemma 3.4. Suppose D is a finite category and we have a sequence of functors (Fn : D → U)n∈N and natural transformations Fn → Fn+1 . Suppose that for all d ∈ D and all n the maps Fn (d) → Fn+1 (d) are closed inclusions. Then the induced maps lim Fn → lim Fn+1 are closed inclusions and colimn limD Fn (D) = limD colimn Fn (D). Proof. The induced maps of limits are closed inclusions because closed inclusions are equalisers in U and limits commute. When D is a pullback diagram A → C ← B and all the maps Fn (B) → Fn+1 (B) and Fn (C) → Fn+1 (C) are identities, the commuting of limit and colimit is a special case of [7, Corollary 10.4]. The general case where D is a pullback diagram follows easily from this. Finite products commute with all colimits because U is cartesian closed. When D is an equaliser diagram f, g : A → B, the equaliser of f, g : Fn (A) → Fn (B) is the pullback of (idFn (B) ,idFn (B) ) (f,g) Fn (A) −−→ Fn (B) × Fn (B) ←−−−−−−−−−− Fn (B). So colimn lim Fn (D) = colimn lim Fn (A) → Fn (B) × Fn (B) ← Fn (B) D D = lim colimn Fn (A) → Fn (B) × Fn (B) ← Fn (B) D = lim colimn Fn (D). D All finite limits can be constructed as equalisers of maps between finite products, so a similar argument shows that the lemma holds for these too. 10 All the colimits indexed by N in the argument for [8, Theorem 2.8] are colimits of closed inclusions, because Xn → Ex(X)n is a split monomorphism, and hence a regular monomorphism. So its conclusions hold here too, and we get: Proposition 3.5. Ex∞ preserves fibrations and trivial fibrations, Ex∞ (X) is an internal Kan complex for all X in sU, and if X is an internal Kan complex, the canonical map X → Ex∞ (X) is a weak equivalence. Then we can define regular weak equivalences in sU to be maps X → Y such that Ex∞ (X) → Ex∞ (Y ) is a regular weak equivalence. It follows easily that weak equivalences in sU in the compact Hausdorff structure are weak equivalences in the regular structure: see [2, Lemma 5.16]. Just as we can define homotopy group objects for X ∈ U, we can now define homology group objects too. To ensure that these are invariant under weak equivalence in the compact-Hausdorff structure, we define Hn (X) to be LHn ◦ LF ◦ Sing(X) – where LF is the left derived functor of the free group functor F , calculated in the compact Hausdorff structure. This works because weak equivalences in c(UAb) in the compact Hausdorff structure are weak equivalences in the regular structure. 4 Sing and |−| Write Sing for the usual singular simplicial set functor. As for Sing, it has a geometric realisation functor |−| : sSet → U as a left adjoint. It is a standard result of homotopical algebra that the two compositions Sing|−| and |Sing(−)| are weakly equivalent to the identity. In fact the same is true of L|Sing(−)|, by [2, Proposition 4.29]. But it is easy to find counterexamples showing the same is not true of the other composition. Much of the rest of the paper will go into showing a partial result in this direction, Theorem 6.3. In fact the construction of Eilenberg–Mac Lane spaces for totally path-disconnected groups follows quite easily from this result. We can now state the main technical result of the paper. This can be thought of as a continuous version of the Seifert–van Kampen Theorem. Theorem 4.1. If C is an open cover of X ∈ U, write C ′ for the poset of finite intersections of sets in C, ordered by inclusion. Then Sing(X) is weakly equivalent (in the regular structure on sU) to the homotopy colimit (in the compact Hausdorff structure on sU) of {Sing(U)}U ∈C ′ . Remark 4.2. This mixture of the two homotopical structures is not beautiful, but it is a necessary evil. We will see later in Example 4.6 that in general the 11 homotopy colimit of {Sing(U)}U ∈C ′ is not weakly equivalent to Sing(X) in the compact Hausdorff structure; on the other hand, without a well-behaved notion of cofibrations in the regular structure, we have no way of defining homotopy colimits there – but see Section 5. This may be thought of as a ‘continuous version’ of [9, Proposition A.3.2], and we will start by reproving the intermediate result [9, Lemma A.3.3], using an approach that carries across better to the current situation. Lemma 4.3. ([9, Lemma A.3.3]) Let X ∈ U, and let C be an open cover of X. Let Sing′ (X) be the simplicial subset of Sing(X) spanned by those nsimplices |∆n | → X which factor through some U ∈ C. Then the inclusion i : Sing′ (X) → Sing(X) is a weak equivalence of simplicial sets. Proof. Via the adjunction between Sing and |−|, we see that Ex(Sing′ (X))n ∼ = ′ n n sU(sd ∆ , Sing (X)) is naturally isomorphic to the subset of U(|sd ∆ |, X) which maps each simplex of sd ∆n into some U ∈ C. In this way we think of Ex(Sing′ (X)) as a simplicial subset of Sing(X). Iterating this reasoning, we can identify the limit Ex∞ (Sing′ (X)) as the simplicial subset of Sing(X) consisting of all maps |∆n | → X for which there is some m ∈ N such that each simplex of sdm ∆n is mapped into some U ∈ C. By standard arguments, e.g. [4, Proof of Proposition 2.21], this is all of them. That is, Ex∞ (Sing′ (X)) = Sing(X). There is a subtlety here. There is a canonical map e : S → Ex S for a simplicial set S, but that is not the inclusion map we are using here. It is well-known that e is a trivial cofibration, and hence e∞ : S → Ex∞ S is too – we want to show our inclusion maps are all trivial cofibrations, and the result will follow. Since all our inclusion maps are injective and hence cofibrations of simplicial sets, it suffices to show each inclusion, which we will write (by abuse of notation) as i : Exm (Sing′ (X)) → Exm+1 (Sing′ (X)), is a weak equivalence. We do this by showing i is homotopic to the weak equivalence e : Exm (Sing′ (X)) → Exm+1 (Sing′ (X)), after which the result follows by standard model category theory. This homotopy comes simply from understanding what the maps i and e are doing: i is induced by the identity map |sdm ∆n | → |∆n |, while e is induced by the map which identifies one of the n-simplices of |sdm ∆n | with |∆n |, and retracts all the other simplices onto faces of |∆n |. These two maps are clearly homotopic, and a choice of homotopy induces a homotopy between i and e. 12 We can immediately prove a continuous version: Lemma 4.4. Let X ∈ U, and let C be an open cover of X. Let Sing′ (X) be the simplicial subset of Sing(X) spanned by those n-simplices |∆n | → X which factor through some U ∈ C. Then the inclusion i : Sing′ (X) → Sing(X) is a weak equivalence of simplicial spaces in the compact Hausdorff structure. Proof. It is an easy exercise to check that each Exm (Sing′ (X)) has Exm (Sing′ (X)) as its underlying set, and that its topology is the subspace topology from its inclusion map into Sing(X), defined as in the previous lemma. Hence Ex∞ (Sing′ (X)) = Sing(X) as before and we have to show the resulting map Sing′ (X) → Ex∞ (Sing′ (X)) is a weak equivalence. This works in exactly the same way as in [2, Theorem 4.19 (ii)]: first, for any X ∈ U and Y ∈ sU, sU sSet(disc X, Ex(Y )) = Ex(sU sSet (disc X, Y ): sU sSet (disc X, Ex(Y ))n = U(X, (Ex(Y )n ) = {sd ∆n , sU sSet (disc X, Y )} = Ex(sU sSet(disc X, Y )n . Note that each Exm (Sing′ (X))n is open in U(∆n , X) via the inclusion i, by definition of the compact-open topology: it is the subset consisting of the finite intersection (over simplices K of |sdm ∆n |) of the unions (over open sets U in the cover C) of the open sets O(K, U). So the maps in : Exm (Sing′ (X))n → Exm+1 (Sing′ (X))n are open inclusions. Since every compact Hausdorff space K is small with respect to open inclusions (that is, any compact Hausdorff subspace of Sing(X)n must be contained in one of the sequence Exm (Sing′ (X))n of open subspaces), we get sU sSet (disc K, Ex∞ (Sing′ (X))) = Ex∞ (sU sSet(disc K, Sing′ (X))) for all K. By the previous lemma, i : sU sSet (disc K, Sing′ (X)) → Ex∞ (sU sSet (disc K, Sing′ (X))) is a weak equivalence for all K, so the result follows. We want a concrete model for the homotopy colimit of {Sing(U)}U ∈C ′ (in the compact Hausdorff structure). The model structure on sU gives a cofibrant replacement functor Q: explicitly, for Y in sU, Q(Y )0 is the disjoint 13 union of the compact subspaces of Y0 and Q(Y )n is the disjoint union of the compact subspaces of the pullback ∂∆n (Q(Y )) ×∂∆n (Y ) Yn . This gives each Q(Y )n a canonical decomposition as a disjoint union of compact subspaces which we want to fix for later: call these compact subspaces ‘fat cells’. The intuition is that fat n-cells should be treated like single n-cells of simplicial sets which have been fattened up. Lemma 4.5. colimU ∈C ′ Q(Sing(U)) is a homotopy colimit for {Sing(U)}U ∈C ′ . Proof. Let C ′′ be the poset of all intersections of open sets in C. We will show {Q(Sing(U))}U ∈C ′′ is cofibrant in the projective model structure induced from the compact Hausdorff model structure on sU; the colimit of {Q(Sing(U))}U ∈C ′′ is the colimit of {Q(Sing(U))}U ∈C ′ by cofinality, and the result follows. The argument echoes the second part of the proof of [9, Proposition A.3.2]. Write Q(Sing′ (X)) as a transfinite colimit (Aα ) of pushouts by maps of the form ∂∆n × Kα → ∆n × Kα with Kα compact Hausdorff (that is, the generating cofibrations of the model structure), ordered by dimension. Identify each Q(Sing(U)) with its image as a simplicial subspace of Q(Sing′ (X)), consisting of a subset of the fat cells. Then the result follows by showing that for each Aα → Aα+1 the induced map {Q(Sing(U) ∩ Aα )}U ∈C ′′ → {Q(Sing(U) ∩ Aα+1 )}U ∈C ′′ is a cofibration in the projective model structure, since these are closed under transfinite composition. Let V ∈ C ′′ be the intersection of sets in C which contain the image of ∆n × Kα : then this map is a pushout by the projective cofibration F0 → F , where ( ( Kα × ∆n if V ⊆ U, Kα × ∂∆n if V ⊆ U, F (U) = F0 (U) = ∅ otherwise. ∅ otherwise, It remains to show that colimU ∈C ′ Q(Sing(U)) is weakly equivalent in the regular structure to Sing(X). But first we will give an example to show that it is not a weak equivalence in general in the compact Hausdorff structure. Factor the canonical map colimU ∈C ′ Q(Sing(U)) → Sing(X) using the functorial factorisation into a trivial cofibration followed by a fibration colimU ∈C ′ Q(Sing(U)) → Z → Sing(X). 14 Example 4.6. Let X be the pseudo-arc, as defined in [1]. This is a compact Hausdorff space (so in U) which is connected and totally path-disconnected. Let C be any open cover of X which does not contain X itself. To show the fibration Z → Sing(X) is not a trivial fibration it is enough to show that Z0 → Sing(X)0 is not CH-split, in the terminology of [2]: that is, that not every map from a compact Hausdorff space to Sing(X)0 lifts to a map to Z0 . More specifically, since Sing(X)0 = X is itself compact Hausdorff, it is enough to show Z0 → X does not split. Indeed, in the functorial factorisation, Z is the colimit of a sequence Z n ∈ sU where new 0-cells in Z n are attached via spaces of 1-cells in Sing(X) (or equivalently via spaces of paths in X) with one end in Z n−1 , and Z 0 = colimU ∈C ′ Q(Sing(U)). Since all paths in X are constant, and all spaces of 0-cells in Z 0 are disjoint unions of spaces whose image is contained in some U ∈ C, the same is true of Z. So Z0 is a disjoint union of spaces whose image is not the whole of X. Therefore any splitting X → Z0 would disconnect X, giving a contradiction. We will prove the theorem by showing that Z → Sing(X) is a trivial fibration in the regular structure. To do this we must first understand Z better. We set Z 0 = colimU ∈C ′ Q(Sing(U)). Given Z m−1 , for all n ∈ N, for all 0 ≤ k ≤ n, for every compact subspace K of Λnk (Z m−1 ) ×Λnk (Sing(X)) Sing(X)n , we attach K (m − 1)-cells and K m-cells filling in this space of n-horns, and call the resulting space Z m . Then Z is the colimit of the sequence Z 0 → Z 1 → · · · with the obvious inclusion maps. The strategy will be to show that the map Zn → ∂∆n (Z) ×∂∆n (Sing(X)) Sing(X)n is a β-epimorphism for all n, in the terminology of [16]: that is, that for every compact subspace of the pullback there is a compact subspace of Zn mapping onto it. The proposition will follow since β-epimorphisms are regular epimorphisms by [16, Proposition 3.12]. We do this by proving a slightly stronger result. Instead of just considering the standard n-simplex ∆n , we wish to consider every finite triangulation Σ of the n-ball. Just as for ∆n , we may consider its boundary ∂Σ, which is a finite triangulation of the n-sphere. Just as we may speak of spaces of nboundaries ∂∆n (Z) in a simplicial space Z, we may define ∂Σ(Z) = {∂Σ, Z}, the weighted limit of Z over ∂Σ; for more detail on weighted limits see [13]. Theorem 4.1 will follow once we prove: Proposition 4.7. For all such Σ, the map {Σ, Z} → {∂Σ, Z} ×{∂Σ,Sing(X)} {Σ, Sing(X)} 15 is a β-epimorphism. We prove this in several steps. By Lemma 3.4, for each finite triangulation Σ, {Σ, Z} is a finite limit, so it is the union of the closed subspaces {Σ, Z m }, so any compact subspace of {Σ, Z} is contained in some {Σ, Z m }. Similarly using ∂Σ. This allows us to use an inductive argument; we start with the base case. Suppose we have a compact subspace K of {∂Σ, Z}×{∂Σ,Sing(X)} {Σ, Sing(X)}. Label the canonical maps from the pullback f g {∂Σ, Z} ← − {∂Σ, Z} ×{∂Σ,Sing(X)} {Σ, Sing(X)} − → {Σ, Sing(X)}. We can assume that each simplex of f (K) (that is, the image of f (K) under the map {∂Σ, Z} → {∆m , Z} induced by a simplex inclusion ∆m → ∂Σ) is contained in a single fat cell, since K is the disjoint union of finitely many spaces of this form. Proposition 4.8. If f (K) is contained in the subspace {∂Σ, Z 0 }, there is a compact cover K1 , . . . , Kj of K such that the inclusion map of each Ki into {∂Σ, Z} ×{∂Σ,Sing(X)} {Σ, Sing(X)} lifts to a map Ki → {Σ, Z}. Proof. We will start by replacing K with an associated subspace A(K) of {∂Σ, Z} ×{∂Σ,Sing(X)} {Σ, Sing(X)}. For each m-cell D of Σ, K has a space KD of m-cells in Z 0 = colimC ′ Q(Sing(U), which by hypothesis is contained in a single fat cell, that is, some compact subspace of some U ∈ C. The ′ image of KD in Sing(U) is compact, so it corresponds to some fat cell KD 0 ′ in Z . Replacing KD with KD is functorial in the cells of ∂Σ, so together these spaces of cells give a subspace K ′ of {∂Σ, Z}, homeomorphic to f (K) whose image in {∂Σ, Sing(X)} is the same. Then let A(K) be the pullback of K ′ → {∂Σ, Sing(X)} ← g(K). This is canonically homeomorphic to K, and it is not hard to see that there is a series of simplicial homotopies in Z 0 between A(K) and K. Now consider g(A(K)) = g(K). We use the same compactness argument as Lemma 4.4: applying barycentric subdivision kStimes to Σ, each {sdk Σ, Sing′ (X)} is an open subspace of {Σ, Sing(X)} and k {sdk Σ, Sing′ (X)} = {Σ, Sing(X)}. Since g(K) is compact there must be some {sdk Σ, Sing′ (X)} containing it. In the compact-open topology, the space {sdk Σ, Sing′ (X)} = {maps from sdk Σ to X such that eachTsimplexSmaps into some U ∈ C} has an open cover by sets of the form D∈sdk Σ U ∈C O(D, U). This gives an open cover of g(K) which pulls back to an open cover of A(K); pick a finite subcover V1 , . . . , Vj . By the Shrinking Lemma of [12, Exercise 4.36.4], we can find a cover of A(K) by compact subspaces K1 , . . . , Kj such that 16 Ki ⊆ Vi for each i. For each simplex D in sdk Σ, there is some U ∈ C such that every element of g(Ki ) maps D into U. Therefore the inclusion Ki → {∂ sdk Σ, Z 0 } ×{∂ sdk Σ,Sing(X)} {sdk Σ, Sing(X)} lifts to a map Ki → {sdk Σ, Z 0 }. Because Z → Sing(X) is a fibration, we can stick all these spaces of cells together to get a lift Ki → {Σ, Z}. Because Z → Sing(X) is a fibration in the compact Hausdorff structure, we may now use the series of simplicial homotopies between A(K) and K to get a compact cover K1′ , . . . , Kj′ of K whose inclusion maps into {∂Σ, Z} ×{∂Σ,Sing(X)} {Σ, Sing(X)} lift to maps Ki′ → {Σ, Z}. Proof of Proposition 4.7. Now suppose we have a compact subspace K of {∂Σ, Z} ×{∂Σ,Sing(X)} {Σ, Sing(X)}: f (K) is contained in some {∂Σ, Z m }, m > 0. Suppose we have shown, for every compact subspace K ′ of {∂Σ, Z}×{∂Σ,Sing(X)} {Σ, Sing(X)} such that f (K ′ ) is contained in {∂Σ, Z m−1 }, that there is a compact cover K1′ , . . . , Kj′ of K ′ such that the inclusion map of each Ki′ into the pullback lifts to a map Ki′ → {Σ, Z}. Suppose Σ is a triangulation of the (n + 1)-ball. In the process of constructing Z, there are two possibilities: a fat k-cell in Z m can be added by a (k + 1)-horn and have all its faces in Z m−1 , or it can be added by a k-horn and have one face in Z m \ Z m−1 , and all other faces in Z m−1 . Therefore f (K) can only have fat n-cells and fat (n − 1)-cells in Z m \ Z m−1 ; moreover, any of its fat (n − 1)-cells in Z m \ Z m−1 is only the face of one fat n-cell in Z m , but it is the face of two fat n-cells in f (K), so these two fat cells must be the same. So there are two situations we will deal with: (i) a fat n-cell in Z m \ Z m−1 with all its faces in Z m−1 ; (ii) two copies of the same fat n-cell in Z m \ Z m−1 stuck together at one face in Z m \ Z m−1 . (i) For each fat n-cell D in case (i), we have a fat (n+ 1)-cell D ′ that has D as one face and all other faces in Z m−1 . Write Σ′ for the triangulation of the (n + 1)-ball obtained by attaching a new (n + 1)-cell to Σ at the face σ corresponding to D. Consider the new compact subspace K ′ of {∂Σ′ , Z} ×{∂Σ′ ,Sing(X)} {Σ′ , Sing(X)}: for each element of K, change its image in {Σ, Sing(X)} by attaching a new (n + 1)-cell via the map attaching D ′ at D, and change its image in {∂Σ, Z} by replacing the image of σ with an (n + 1)-horn via the map attaching D ′ at D. Note that f (K ′ ) has fewer fat n-cells in Z m \Z m−1 than f (K). Note too that, if we can find a compact cover K1′ , . . . , Kj′ of K ′ such that the inclusion map of each Ki′ into the pullback lifts to a map Ki′ → {Σ′ , Z}, we can use the fact that Z → Sing(X) is a fibration in the compact Hausdorff 17 structure to get a compact cover K1 , . . . , Kj of K such that the inclusion map of each Ki into {∂Σ, Z} ×{∂Σ,Sing(X)} {Σ, Sing(X)} lifts to a map Ki → {Σ, Z}. So by applying this procedure finitely many times we reduce to the case where f (K) has no fat n-cells of this type in Z m \ Z m−1 . (ii) For each fat n-cell D in case (ii), the approach is similar. Let Σ′ be the triangulation given by attaching a new (n + 1)-cell to Σ at the two faces corresponding to D. Consider the new compact subspace K ′ of {∂Σ′ , Z} ×{∂Σ′ ,Sing(X)} {Σ′ , Sing(X)}: for each element of K, change its image in {Σ, Sing(X)} by attaching a new degenerate (n + 1)-cell coming from the degeneracy maps on D to the faces corresponding to σ1 and σ2 , and change its image in {∂Σ, Z} by replacing the images of σ1 and σ2 with the other faces of the new (n + 1)-cell. These other faces are the degeneracies of (n − 2)-cells in f (K), so they are in Z m−1 ; so, as before, we reduce the number of fat cells in Z m \ Z m−1 . As before, if we can find a compact cover K1′ , . . . , Kj′ of K ′ such that the inclusion map of each Ki′ into the pullback lifts to a map Ki′ → {Σ′ , Z}, we can use the fact that Z → Sing(X) is a fibration in the compact Hausdorff structure to get a compact cover K1 , . . . , Kj of K such that the inclusion map of each Ki into {∂Σ, Z} ×{∂Σ,Sing(X)} {Σ, Sing(X)} lifts to a map Ki → {Σ, Z}. So by applying this procedure finitely many times we reduce to the case where f (K) has no fat n-cells in Z m \ Z m−1 , and we are done. 5 Excision If the weak equivalence in the regular structure proved in Theorem 4.1 were a weak equivalence the CH structure, an excision theorem for homology would be an easy corollary: since left derived functors preserve homotopy colimits, we could apply LF to get a result analogous to [4, Proposition 2.21], and deduce excision from there exactly as in [4]. As it is not, we have to work a bit harder. As before, let C be an open cover of X ∈ U, and write C ′ for the poset of finite intersections of sets in C, ordered by inclusion. The idea here is that the map colimU ∈C ′ Q(Sing(U)) → Q(Sing′ (X)) looks a lot like a trivial cofibration, even though it is not one in general. We can produce Q(Sing′ (X)) 18 from colim Q(Sing(U)) by attaching collections of cells which are close enough to trivial cofibrations that they behave nicely under F . Let Y 0 = colim Q(Sing(U)). We will create Y α , for ordinals α, by adding spaces of cells to Y α−1 when α is a successor, and by taking Y α = colimβ<α Y β for α a limit. At each step Y α will be a simplicial subspace of Q(Sing′ (X)) consisting of a subset of the fat cells. We need two new operations: filling empty horns and gluing fat cells together. An empty n-horn in Y α is a fat n-cell K of Q(Sing′ (X)) which is not in Y α , such that all but one of its face maps K → Q(Sing′ (X))n−1 factors through Y α but there is some k such that its kth face map does not. We can attach K (n − 1)-cells and K n-cells to Y α via these maps, and refer to this as filling an empty horn in Y α . Suppose we have a fat n-cell K of Q(Sing′ (X)) which is not in Y α , but all of its face maps factor through Y α . Suppose there is a finite cover of K by compact subspaces K1 , . . . , Kj , such that there are fat n-cells Di in Y α for each i and Di and Ki have the same image in the pullback ∂∆n (Y α ) ×∂∆n (Q(Sing′ (X))) Q(Sing′ (X))n for each i. We want to glue the Ki s together to get K, but it is not yet clear whether this can done without changing Y α homotopically ‘too much’, in a sense which will become clear later. For now, call this a 1-valid opportunity. If, for each non-empty intersection Ki ∩ Kj , Y α has a fat cell Di,j of Ki ∩ Kj (n + 1)-cells filling the space of (n + 1)-boundaries created by the subspaces Ki ∩ Kj of cells of Di and Dj , we say the opportunity is 2-valid. Similarly, we inductively say an (r − 1)-valid opportunity is r-valid if, for each non-empty intersection Ki1 ∩ · · · ∩ Kir , Y α has a fat cell Di1 ,...,ir of Ki1 ∩· · ·∩Kir (n+r−1)-cells filling the space of (n+r−1)-boundaries created by the subspaces Ki1 ∩ · · · ∩ Kir of cells of Di1 ,...,is−1 ,is+1 ,...,ir for 1 ≤ s ≤ r. If an opportunity is r-valid for all r (equivalently, if it is j-valid), we say it is valid, and call n its dimension. Given a valid opportunity, we can glue fat cells together. Attach D to α Y . For each i, attach a fat cell Ei of Ki (n + 1)-cells to the space of (n+ 1)-boundaries created by Di and the subspace Ki of cells of D. Continue inductively: for each non-empty intersection Ki1 ∩ · · · ∩ Kir , attach a fat cell Ei1 ,...,ir of Ki1 ∩· · ·∩Kir (n+r)-cells to the space of (n+r)-boundaries created by Di1 ,...,ir and the subspaces Ki1 ∩ · · · ∩ Kir of cells of Ei1 ,...,is−1 ,is+1 ,...,ir for 1 ≤ s ≤ r. Note that this process terminates after at most j steps. Now we can define Y α inductively: for α a successor, if Y α−1 has any empty horns, pick one, fill it, and call the result Y α . If it has no empty horns, but has valid opportunities to glue fat cells together, pick one of 19 minimal dimension, take it, and call the result Y α . For α a limit we let Y α = colimβ<α Y β . Note that when Y α is a simplicial subspace of Q(Sing′ (X)) consisting of a subset of the fat cells, Y α+1 is too, so we can see inductively that this is true for all Y α . So this process must terminate: there is some ordinal γ such that Y γ has no empty horns and no valid opportunities. As we are building Y γ , we can label each fat cell K with a finite compact cover l(K) of the space of cells. For fat cells in Y 0 , take l(K) = {K}, and assume we have labelled all the fat cells in Y β for all β < α. Assume that all the labels for β < α have the following two properties. First, any face map of a fat cell K in Y γ sends any Ki ∈ l(K) into some element of the label of the face. Second, for any fat cell K in Y γ and Ki ∈ l(K), the image of the subspace Ki in Sing′ (X) is contained in some Sing(U). For α a limit there is no more to do; suppose it is a successor. When we create Y α from Y α−1 by filling an empty k-horn, each face map except the kth on the new fat cell pulls back to a finite compact cover of K; pick a common refinement of all of these: that is, a finite compact cover K1 , . . . , Kj such that the image of every Ki under every face map except the kth is contained in one of the compact spaces in the finite cover labelling that space. For each Ki , we get an open cover by sets of the form {x ∈ Ki : the image of {x} in K → Sing′ (X) is contained in Sing(U), U ∈ C}. Pick a finite subcover of this, and then a compact refinement Ki,1 , . . . , Ki,li , which exists by the Shrinking Lemma, [12, Exercise 4.36.4]. The compact cover of K given by {K1,1 , . . . , K1,l1 , . . . , Kj,1 , . . . , Kj,lj } has the required properties, showing such a cover exists. Now take a compact cover of K of minimal size satisfying these properties to be the labels of K and its kth face. If Y α comes from Y α−1 by gluing cells, we are attaching finitely many fat cells by filling spaces of boundaries. For each of these fat cells K, we pick some finite compact cover which is a common refinement of all the finite compact covers induced by the face maps. We refine it further, as above, to show a label satisfying the required properties exists; then we label K with a label of minimal size satisfying these properties. Proposition 5.1. Consider a fat cell K in Q(Sing′ (X)) whose image in Sing(X) is contained in some Sing(U), whose image under each face map is in some Y α , and each such image is contained in a single element of the label of a single fat cell. Then K is in some Y β , β ≥ α, obtained from Y α just by filling empty horns. Proof. This is proved by induction on α; thanks to our hypotheses on the labels, everything works when we imitate the proof of Proposition 4.7. 20 Proposition 5.2. Y γ = Q(Sing′ (X)). Proof. Suppose not. Let n be the minimal dimension of a fat cell of Q(Sing′ (X)) which is not in Y γ , and let K be such a fat cell. For simplicity we can assume that every simplex of K (that is, the image of K under any sequence of face maps) is contained in a single fat cell, since K is the disjoint union of finitely many spaces of cells of this form. By hypothesis, all the faces d0 (K), . . . , dn (K) of K are in Y γ , and already labelled. We can label l(K) = {K1 , . . . , Kj } as above, so that any face map of K sends any Ki into some element of the label of the face, and the image of each Ki in Sing′ (X) is contained in some Sing(U). We will show that K can be added to Y γ by gluing cells together, giving a contradiction. For every Ki ∈ K, the corresponding fat cell Di such that Di and Ki have the same image in the pullback ∂∆n (Y α ) ×∂∆n (Q(Sing′ (X))) Q(Sing′ (X))n has a single element in its label, since we have chosen the labels to have minimal size. So by the previous proposition, Di is in Y γ . Moreover, we see inductively that for every non-empty intersection Ki1 ∩ · · · ∩ Kir , every Di1 ,...,is−1 ,is+1 ,ir has a single element in its label, and the subspaces Ki1 ∩ · · · ∩ Kir of the cells of each Di1 ,...,is−1 ,is+1 ,ir form the boundary in Q(Sing′ (X)) of a space of degenerate (n + r − 1)-cells whose image in Sing′ (X) is contained in the image of Ki1 ∩ · · · ∩ Kir . By the previous proposition again, Di1 ,...,ir is in Y γ . Since this holds for all non-empty Ki1 ∩ · · · ∩ Kir , we have a valid opportunity to add K to Y γ by gluing fat cells, giving a contradiction. Lemma 5.3. Colimits of sequences of closed inclusions are exact in UAb in the regular structure. That is, given short exact sequences An ֌ Bn ։ Cn in the regular structure on UAb, and commutative diagrams A n /  / An+1 / B n //  / Bn+1 C n  // Cn+1 , the induced sequence colim An → colim Bn colim Cn is exact. Proof. Given any diagram of groups {Gi } in UAb, the colimit in Ab with the colimit topology (if this is in U) becomes an object in UAb. Indeed, the only non-trivial thing to check is that multiplication is continuous: (colim Gi ) × (colim Gi ) = colim(Gi ×Gi ) → colim Gi is continuous because finite products commute with colimits in U. It follows immediately that this is the colimit in UAb. Clearly in the current situation the colimit topologies on the An s, Bn s and Cn s are in U, so the sequence colim An → colim Bn colim Cn is an exact 21 sequence of the underlying groups. We know colim is right exact because it is a left adjoint, so we only need to check colim An → colim Bn is a closed inclusion of spaces. Each An → Bn is a closed inclusion, which is an equaliser in U, so the result follows because finite limits commute with colimits of sequences of closed inclusions in U by Lemma 3.4. Theorem 5.4. LF (Sing(X)) is weakly equivalent (in the regular structure on sUAb) to the homotopy colimit of {LF (Sing(U))}U ∈C ′ (in the compact Hausdorff structure on sUAb). Proof. We already know that LF (Sing(X)) is weakly equivalent (in the compact Hausdorff structure) to LF (Sing′ (X)) = F (Q(Sing′ (X))) = F (Y γ ). We also have that the homotopy colimit of {LF (Sing(U))}U ∈C ′ is F (colimU ∈C ′ Q(Sing(U)) = F (Y 0 ) by Lemma 4.5. We will show inductively that F (Y α ) is weakly equivalent to F (Y 0 ), in the regular structure, for all α ≤ γ; the result follows. When α is a limit ordinal this follows immediately from Lemma 5.3. When α is a successor and Y α−1 → Y α is a trivial cofibration, it is trivial. When α is a successor and Y α−1 → Y α comes from an n-dimensional opportunity to glue cells together in the notation used at the beginning of the section, use the Dold-Kan correspondence of [9, Theorem 1.2.3.7] and think of the F (Y α ) as chain complexes in UAb. The mapping cone of F (Y α−1 ) → F (Y α ) is homotopic to the complex M with M F (Ki1 ∩ · · · ∩ Kir ) Mn+r = Ki1 ∩···∩Kir 6=∅ with maps induced by the face maps between the Ei1 ,...,ir , so we just need to show this is exact in the regular structure. It is not hard to check on the elements that the homology groups of the underlying abstract chain complex are trivial; it follows from [6, Proposition 2.32] that the induced maps coim(Mk+1 → Mk ) → ker(Mk → Mk−1 ) are isomorphisms in UAb, as required. Remark 5.5. Pushing out by these collections of cells, which look provocatively like finite length exact sequences of projectives, ought to be a trivial cofibration in some nice homotopical structure on sU, but I do not know what that structure should be. From Theorem 5.4 we may deduce the usual form of the Excision Theorem as in [4, p.124], using mapping cones (i.e. homotopy cokernels) instead of quotient complexes. 22 Theorem 5.6 (Excision Theorem). Given subspaces A ⊆ B ⊆ X in U with A closed and B open, the inclusion (X \ A, B \ A) → (X, B) induces isomorphisms of the homology group objects Hn (X \ A, B \ A) → Hn (X, B) for all n. Equivalently, for open subspaces A, B ⊆ X covering X, the inclusion (B, A ∩ B) → (X, A) induces isomorphisms of homology group objects Hn (B, A ∩ B) → Hn (X, A) for all n. Proof. We prove the second formulation. Write Q(Sing(A + B)) for the pushout of Q(Sing(A)) ← Q(Sing(A ∩ B)) → Q(Sing(B)). The square LF (Sing(A ∩ B)) /  LF (Sing(A)) LF (Sing(B))  / F ◦ Q(Sing(A + B)) is a pushout, so the cokernels of the two rows are isomorphic, so the maps induced on their homology group objects are isomorphisms. By Theorem 5.4, the canonical map F ◦Q(Sing(A+B)) → LF (Sing(X)) is a weak equivalence in the regular structure, so the maps induced on their homology group objects are isomorphisms too. Now we can use the long exact sequence in homology to see that the maps of homology group objects induced by coker(LF (Sing(A)) → F ◦ Q(Sing(A + B))) → coker(LF (Sing(A)) → LF (Sing(X))) are isomorphisms, and the result follows. Much of the rest of [4, Chapter 2] can be carried across to our topological homology theory fairly painlessly from this point; we give a few highlights. Theorem 5.7 (Mayer–Vietoris sequence). For open subspaces A, B ⊆ X covering X there is a long exact sequence of homology group objects · · · → Hn+1 (X) → Hn (A ∩ B) → Hn (A) ⊕ Hn (B) → Hn (X) → · · · . Proof. Think of the rows of the commutative square in the proof of Theorem 5.6 as a chain complex of chain complexes; the vertical maps give a map between these chain complexes of chain complexes. This square is a pushout and a pullback; it is a standard result of commutative alebra in quasi-abelian categories that the mapping cone of this square is then a short exact sequence of chain complexes 0 → LF (Sing(A∩B)) → LF (Sing(A))⊕LF (Sing(B)) → F ◦Q(Sing(A+B)) → 0 in the regular structure. Taking homology and applying Theorem 5.4 gives the result. 23 In constructing a homology theory on U, we would like certain axioms to be satisfied: those of a generalised homology theory. These axioms are usually listed for homology theories from spaces to abelian groups, but they make sense in our context. A generalised homology theory is here taken to be a functor E from pairs (X, Y ) of spaces Y ⊆ X in U to chain complexes in R-UMod, with the regular structure, satisfying: (i) homotopy invariance: homotopies in U induce homotopies in R-UMod; (ii) exactness: associated naturally to a pair (X, Y ) is an exact triangle E(Y, ∅) → E(X, ∅) → E(X, Y ) →; F F (iii) additivity: if (X, A) is a disjoint union of pairs ( X , Ai ), then the i L canonical map E(Xi , Ai ) → E(X, A) is a weak equivalence; (iv) dimension: E(∗, ∅) is exact in non-zero dimensions; (v) excision: for A ⊆ B ⊆ X with A closed and B open, the canonical map E(X \ A, B \ A) → E(X, A) is a weak equivalence. Given our definitions, the excision axiom was the only non-trivial thing to check. So we have: Theorem 5.8. Singular homology LF ◦Sing is a generalised homology theory. 6 Eilenberg–Mac Lane Spaces Now we will use Theorem 4.1 to construct certain Eilenberg–Mac Lane spaces for topological groups. Lemma 6.1. For all n, Sing ◦ |∆n | is weakly equivalent to ∆n in the compact Hausdorff structure. Proof. Any map ∆0 → ∆n is a trivial cofibration; |∆n | is homotopy equivalent to a point, so Sing ◦ |∆n | is homotopy equivalent to ∆0 . Suppose X ∈ sU. As usual, each Q(X)n comes with a canonical decomposition as a disjoint union of compact fat cells: write S for the set of fat cells. For each fat n-cell K ∈ S, consider the diagram DK in sU given by objects K × ∆m indexed by the m-cells of ∆n and maps indexed by the face and degeneracy maps of ∆n . Write Q(X) as the colimit of a sequence (Y α ) of pushouts Y α ← K × ∂∆n → K × ∆n attaching fat cells in order of dimension: these attaching maps induce maps from the copies of K × ∆m in DK to copies of K ′ × ∆m in DK ′ wherever an m-face of K is attached to an m-face 24 of K ′ . The set of diagrams DK , K ∈ S, together with these maps between objects of the diagrams, give a bigger diagram D. Proposition 6.2. Q(X) is the homotopy colimit of D. Proof. The colimit of D is the colimit of the Y α , since we can get each K × ∂∆n as the colimit (and in fact the homotopy colimit) of all the objects of DK except K × ∆n itself, and then the maps between the DK ′ s induce the map Y α ← K × ∂∆n from the pushout. And we know the colimit of the Y α is Q(X). Since we are adding fat cells in order of dimension, for each n there is some αn such that Y αn is the n-skeleton of Y . Then Y αn is the homotopy colimit of the pushout G G Kα × ∆n Kα × ∂∆n → Y αn−1 ← αn−1 ≤α<αn αn−1 ≤α<αn because all three objects are cofibrant and the second map is a cofibration, by [10, Proposition A.2.4.4]. Then Y is the colimit of a sequence (Y αn ) of cofibrant objects with cofibrations between them, so it is the homotopy colimit by [13, Example 11.5.11]. It follows that colimit Q(X) is the homotopy colimit of D. Since we can change a diagram by a weak equivalence without changing the homotopy colimit, we can change D to a diagram D ′ of the same shape where we replace each K × ∆m with disc(K) = K × ∆0 ; the maps in D ′ are the obvious ones induced by those of D. We conclude that Q(X) is the homotopy colimit of D ′ . We denote the points of D n × Xn by the coordinates (r, θ, x), where (r, θ) parametrises the closed unit ball in spherical coordinates and x ∈ Xn . For each n, we have a map Φn from D n × Xn to the n-skeleton |X|n of |X| which restricts to a homeomorphism from (D n \ S n ) × Xn to |X|n \ |X|n−1 , in the same way as for CW-complexes. Theorem 6.3. Suppose X ∈ sU with Xn totally path-disconnected for all n. Then Sing ◦ L|X| is weakly equivalent to X in the regular structure. Proof. By replacing X with Ex(X) (which gives a weak equivalence in the compact Hausdorff structure), if necessary, we may assume for simplicity that for any fat cell in Q(X) the images of its face maps are pairwise disjoint. Q(X) is weakly equivalent to X in the compact Hausdorff structure, and if the Xn are totally path-disconnected, so are the Q(X)n . |Q(X)| is then a KW-complex, as defined in [2, Section 2], and we construct an open cover inductively on the skeleta: on the 0-skeleton we take an 25 open cover whose open sets are the fat cells of Q(X)0 . Suppose we have an open cover Cn−1 of the (n − 1)-skeleton. For each fat cell K of Q(X)n , we have the open space UK of open n-cells K × (D n \ S n ). Also, for every open U ∈ Cn−1, think of (Φn )−1 (U) as an open subset of S n × Xn ; in spherical coordinates as before, define U ′ = (1 − δ, 1] × (Φn )−1 (U) ∪ U for some small δ > 0. Take Cn to be the the open cover of the n-skeleton given by the UK s and the U ′ s. Taking limits over n, we get a cover C of |Q(X)|. Let C ′ be the set of finite intersections of open sets in C. We can see directly that any non-empty element of C ′ is homotopic to some fat cell K of Q(X). Since K is totally path-disconnected, all singular maps into K are constant and Sing(K) is just the constant simplicial space on K. By Theorem 4.1, Sing ◦ L|X| is weakly equivalent (in the regular structure on sU) to the homotopy colimit of {Sing(U)}U ∈C ′ , which is the homotopy colimit of {disc(K)}U ∈C ′ . But this diagram is easily seen to be isomorphic to D ′ , so its homotopy colimit is X. Given a group object G in sU, a construction is given in [2, Section 6] for W̄ G ∈ sU such that πn (W̄ G) = πn−1 (G) for n > 0, and π0 (W̄ G) = {∗}. In this construction W̄ Gn = Gn × · · · × G0 . Now if G is a topological group in U, disc G is a group object in sU, and πn (W̄ G) is G for n = 1 and trivial otherwise. Note too that if G is totally path-disconnected, every W̄ Gn is too. So we can apply Theorem 6.3. Theorem 6.4. If G is totally path-disconnected, L|W̄ G| is an Eilenberg–Mac Lane space K(G, 1) for G. Similarly, when G is totally path-disconnected and abelian, L|W̄ n G| is a K(G, n). Note that totally disconnected spaces are totally path-disconnected, so totally disconnected groups are included as a special case. Here is a totally path-disconnected topological group in U which is not totally disconnected. Example 6.5. Let X be the pseudo-arc, as in Example 4.6. Let F (X) be the free group object (in U) on X: see [6, Notation 2.10] for the construction. F (X) is not totally disconnected because X is connected and the canonical map X → F (X) is a closed embedding by [6, Theorem 2.12]. Suppose there is a non-constant map p : [0, 1] → F (X). In theFnotation of [6], topologically F (X) is the colimit of the closed subspaces π( i≤n M i ) by [6, Proposition 2.16]. So by compactness, there is some n such that the 26 image of p is contained in π( there is some open subspace F i i≤n M ) but not π( U = p−1 (π( G M i ) \ π( i≤n G F i≤n−1 M i ); in particular M i )) i≤n−1 of F [0, 1] on whichFp is not constant, or else for x ∈ Ū we would have p(x) ∈ π( i≤n M i ) \ π( i≤n−1 M i ), implying U = Ū = [0, 1] and p is not constant on [0, 1] by hypothesis. Then pick a closed interval [a, b] ⊆ U on which p is not constant. From the construction, M i is the disjoint union of spaces of the form MS = {(x1 , . . . , xn ) ∈ (X ⊔ X ∗ )n : xi ∈ X for i ∈ S, xi ∈ X ∗ for i ∈ / S} where S ranges over subsets of {1, . . . , n}. Observe that if we restrict to the subspaces G G M i )), MS′ = MS ∩ π −1 (π( M i ) \ π( i≤n we have π( G i≤n M i ) \ π( G M i) = i≤n−1 i≤n−1 G π(MS′ ). S⊆{1,...,n} So p([a, b]) must be contained in some π(MS′ ). It follows from [6, Proposition 2.16], by the same argument as [6, Corollary 2.18], that π : MS′ → F (X) is an embedding. So p|[a,b lifts to a non-constant map p : [a, b] → MS′ , but MS′ is totally path-disconnected as a subspace of a product of copies of X, giving a contradiction, and implying that F (X) is totally path-disconnected. As a final application, we return to singular homology. Generalise the definition of ∆-complexes given in [4, p.103] to allow totally path-disconnected spaces of cells: as in the classical case, the definition ensures that such a ∆-complex X ′ ∈ U is the geometric realisation of some X ∈ sU such that every Xn is totally path-disconnected. Call such spaces generalised simplicial complexes. As in the classical case, we define the simplicial homology H Simp (X ′ ) of X ′ to be the singular homology of X. Proposition 6.6. The singular and simplicial homology theories for generalised ∆-complexes are naturally isomorphic. Proof. We showed in the proof of Theorem 6.3 that X is weakly equivalent, in the compact Hausdorff structure, to {Sing(U)}U ∈C ′ , where C ′ is the open cover of |X| described there. So LF (X) is weakly equivalent in the compact Hausdorff structure to LF ({Sing(U)}U ∈C ′ ), which is weakly equivalent to LF (Sing(|X|)) in the regular structure by Theorem 5.4. So all three have the same homology. 27 References [1] R.H. Bing, Concerning hereditarily indecomposable continua, Pacific J. Math. Volume 1, Number 1 (1951), 43-51. [2] Corob Cook, G: Homotopical Algebra in Categories with Enough Projectives, available at https://arxiv.org/abs/17003.00569. [3] Fabel, P: Multiplication is discontinuous in the Hawaiian earring group (with the quotient topology). Bull. Polish Acad. Sci. Math. 59 (2011), 77-83 [4] Hatcher, A: Algebraic Topology. Cambridge University Press, Cambridge (2002). [5] Hovey, M: Model Categories (Mathematical Surveys and Monographs, 63). Amer. Math. Soc., Providence (1999). [6] LaMartin, W: On the Foundations of k-Group Theory (Diss. Math., CXLVI). Państwowe Wydawn. Naukowe, Warsaw (1977). [7] Lewis, L: The stable category and generalized Thom spectra: Appendix A, available at http://www.math.uchicago.edu/~ may/MISC/GaunceApp.pdf. Ph.D. Thesis, University of Chicago (1978). [8] Low, Z: Internal and Local Homotopy Theory (2014), available at https://arxiv.org/pdf/1404.7788. [9] Lurie, J: Higher Algebra (2017), http://www.math.harvard.edu/~ lurie. available at [10] Lurie, J: Higher Topos Theory (Annals of Mathematics Studies, 170). Princeton University Press, Princeton (2009). [11] Moerdijk, I: Classifying Spaces and Classifying Topoi (Lecture Notes in Mathematics, 1616). Springer, Berlin (1995). [12] Munkres, J: Topology, 2nd edition. Prentice Hall (2000). [13] Riehl, E: Categorical Homotopy Theory (New Mathematical Monographs, 24). Cambridge University Press, Cambridge (2014). [14] Schneiders, J-P: Quasi-Abelian Categories and Sheaves. Mém. Soc. Math. Fr. (2), 76 (1999). 28 [15] Segal, G: Classifying Spaces and Spectral Sequences. Publications Mathmatiques de l’IHÉS 34 (1968), 105-112. [16] Strickland, N: The Category of CGWH Spaces, available at https://neil-strickland.staff.shef.ac.uk/courses/homotopy/cgwh.pdf. 29
4math.GR
arXiv:1710.11087v1 [cs.CV] 30 Oct 2017 An Integrated Approach to Crowd Video Analysis: From Tracking to Multi-level Activity Recognition Neha Bhargava Indian Institute of Technology Bombay India Subhasis Chaudhuri Indian Institute of Technology Bombay India [email protected] [email protected] Abstract priate to estimate them together instead of sequentially. See Figure 1 as an example of this hierarchical structure where the atomic actions of the individuals are all standing, there are two groups each with group activity as talking and thus leading to the collective activity also as talking. These inherent dependencies among the various components motivate us to explore this idea of simultaneous recognition of tracks, groups and activities. We propose a novel approach to build on the detections to obtain the tracks, groups and activities in a causal framework, i.e. without considering future frames into estimation process. We solve this unified problem in two passes. The first pass consists of finding the graph structure that corresponds to the track association and group detection. We propose an linear programming based formulation for the same. The second pass involves activity recognition at various levels of granularity. We formulate this problem under the structured SVM formulation [29]. We present an integrated framework for simultaneous tracking, group detection and multi-level activity recognition in crowd videos. Instead of solving these problems independently and sequentially, we solve them together in a unified framework to utilize the strong correlation that exists among individual motion, groups and activities. We explore the hierarchical structure hidden in the video that connects individuals over time to produce tracks, connects individuals to form groups and also connects groups together to form a crowd. We show that estimation of this hidden structure corresponds to track association and group detection. We estimate this hidden structure under a linear programming formulation. The obtained graphical representation is further explored to recognize the node values that corresponds to multi-level activity recognition. This problem is solved under a structured SVM framework. The results on publicly available dataset show very competitive performance at all levels of granularity with the state-of-the-art batch processing methods despite the proposed technique being an online (causal) one. 1. Introduction A crowd video analysis system first detects the individuals and then tracks them over time. These tracks are used for higher level applications such as group detection and activity recognition. This approach is sequential in nature whereas the various components of the system are highly correlated and influence each other. For example, a particular group activity motivates its group member for a particular action and all the groups together define the crowd activity. On the other hand, group behavior is influenced by its members and the overall crowd behavior. Effectively, these components - individual’s motion, groups, group activity and collective activity are correlated and can be expressed in a hierarchical structure. Hence it is more appro- Figure 1. Illustration of hierarchical structure present in a video. It represents video in terms of atomic actions, groups, group activities and collective activity. There are 6 individuals who are standing and forming two groups with group activities as talking and hence the collective activity is also talking. In this paper, the term action refers to an atomic movement performed by a single person, the term group activity denotes an activity performed by a group and collective activity refers to the activity performed by all the groups collectively. The paper is organized as follows. The next section discusses the related work followed by our contri1 (a) (b) Figure 2. (a). Graphical representation showing the hierarchical structure present in a video. The first layer Tk−1 and second layer dk are fully connected since the track association is unknown until estimated. The third layer corresponds to the actions hk associated with the detections. The third and fourth layers are again fully connected since the group association is unknown. The final layer corresponds to the connection between the overall activity and the group activities. (b). The figure shows a possible graphical structure obtained after track association and group detection. xi , xg and x0 are the respective features for a person, group and collectively that are derived from the video frames and to be used for activity recognition. butions. The proposed model is described in Section 3. The subsequent Sections 4, 5 and 6 elaborate on frameworks for multi-target tracking with group detection followed by activity recognition. Experimentation details are provided in Section 7 and the paper concludes in Section 8. [2, 3, 7, 13, 14]. Amer et al. in [2] proposed a hierarchical random field based modeling of higher order temporal dependencies of video features. Lan et al. in [14] jointly estimate actions, pairwise interactions and group activity. However, they assume the availability of action labels and they do not handle track association. Choi and Savarese in [7] proposed a hierarchical model and combine the problems of tracklet association and multi-level activity recognition (action, pairwise interaction and collective). All these methods either assumed availability of action label or trackelets whereas our proposed framework requires only detections. 2. Related work The task of multi-target tracking (MTT) is to correctly associate all the detections (or tracklets) corresponding to each individual. Linear programming (LP) based global optimization for MTT is a popular approach. Many approaches formulate MTT either as min-cost flow optimization problem or MAP and use LP to find the global optimum. [4, 6, 9, 20, 35]. Recently, the approaches of utilizing social behavior to improve tracking are gaining attention [5, 15, 19, 22, 34]. The idea is to simultaneously associate a detection to a track and to a group. Our approach for obtaining groups is similar to that of [22] where they combine track association with grouping under a LP framework. Since the number of groups K is unknown, they run the algorithm with all possible values of K with a linear penalty. Our proposed method exploits the group information from the previous time instant and does not require to run for all values of K resulting in a fast convergence. Due to its various applications in video surveillance, activity recognition has been an active area of research. The survey on action and activity recognition can be found in [21, 30, 32]. There are many works dealing with single person action [12, 17, 18, 26, 31] and with single group activity recognition [8, 11, 16, 24, 25]. Recently, researchers have started exploring the problem of joint recognition of these actions and activities under a hierarchical framework Our work in this paper advances the existing approaches and add one more intermediate layer (i.e. grouping layer) in the hierarchy as shown in Figure 2a and explained in Section 3. The main contributions of this work are as follows: 1. We propose a hierarchical graphical structure that combines multi-target tracking, group detection and activity recognition under an unified framework. 2. We built a causal framework that takes only human detections as an input and outputs tracks, groups and activities at each time step. 3. We propose an iterative linear programming based method for simultaneous track association and group detection. 4. We propose an approach for simultaneous recognition of activities at various levels of granularity under a structured SVM framework. 5. To make it suitable for real-time applications, we provide a fast algorithm for both training and inferencing. 2 3. The Proposed Model nition (Eq. 3). i.e. In this section, we discuss the proposed model. Let yk ∈ Y be the collective activity at time k with group activity vector gk = [g1k , g2k , ..., gmk ] where gik ∈ G is the activity of ith group and m be the number of groups present at time instant k. The atomic activity vector is denoted as hk = [h1k , h2k , ..., hkN ] with hik ∈ H as the atomic activity of the ith person and N is the total number of persons present at time k. Let Tk−1 denotes the estimated tracks available till time k − 1 and Gk be the group label vector of length N where its ith entry denotes the group label for the ith detection at time k. Let dk denotes the detections at time k. By a detection, we mean a person’s location in the form of a bounding box. Now the problem statement is as follows: Given the detections dk and tracks Tk−1 at time k, the goals are (a) to associate these detections dk to the appropriate tracks in Tk−1 to get Tk , (b) identify the group label vector Gk and (c) recognize the atomic, group and collective activities (hk , gk , yk ). Let zk = [yk , gk , hk ] be the activity vector for notational convenience. The problem is formulated under the score maximization framework with a linear function as, z∗k , G∗k , T∗k = arg G∗k , T∗k = arg max w1 T Φ1 (Gk , Tk ; dk , Tk−1 , zk−1 ) Gk ,Tk (2) z∗k = arg max w2 T Φ2 (zk ; Tk , Gk , zk−1 ). zk (3) The next two sections discuss these two sub problems in detail. 4. Multi target tracking (MTT) and group detection We estimate the tracks and groups together under a linear programming framework. Let N number of detections and Ng (unknown) number of groups be present at time k. Let Tk−1 be a set of T trajectories present at k − 1. We define Ψ ∈ {0, 1}N ×T as the track association matrix where Ψij = 1 indicates association of the ith detection with the j th track. We also define Ω ∈ {0, 1}N ×Ng as the group association matrix where Ωil = 1 indicates that the ith detection belongs to the lth group. Then the optimization equation to estimate Ψ and Ω is as follows: Ψ∗ , Ω∗ = arg max T max w Φ(zk , Gk , Tk ; dk , Tk−1 ). Ψ,Ω zk ,Gk ,Tk (1) N X T X Ψij Mij +λ i=1 j=1 Ng N X X Ωil Cil (4) i=1 l=1 s.t. The problem is illustrated as a graphical model in Figure 2a. There are N detections with an unknown number Ng of groups at time k. Tik−1 denotes the ith track available at time k − 1. The root node denotes the collective activity which is connected to the group activity nodes. The group activity nodes are also connected to the atomic activity nodes of the group members. The graph emphasizes that collective activity is related to the group activities while a group activity is correlated both with its members’ actions and the collective activity of the scene. Since the track association (Tk−1 ↔ dk ) and group information (hi ↔ gj ) are unknown - (a) every node Tik−1 is connected to all the detection nodes and (b) each node of the action layer is connected to all the group activity nodes as shown in Figure 2a. Once we know the track association and group labels, the corresponding graph structure is known. One possible graph structure corresponding to Figure 2a is shown in Figure 2b. Here xi , xg and x0 are the respective observations for a person, group and collective entity defining the video. The procedure to obtain these observations are discussed later. Ψij , Ωij ∈ {0, 1}, Ng X Ωil ≤ 1 ∀i, j=1 N X Ψij ≤ 1 ∀j, i=1 T X Ψij ≤ 1 ∀i, (5) j=1 where λ ∈ R+ is a weighing factor that decides the balancing between the group association and track association scores. Mij ∈ [−1, 1] is the compatibility score of the ith detection with the j th track based on motion and visual similarity, and Cil ∈ [−1, 1] is the compatibility score for the ith detection with the lth group based on motion, spatial and pose compatibility. The constraints in Eq. 5 ensure that each detection is assigned to at most one track and to one group. It also ensures that each track gets at most one detection while there is no such constraint for the group. The next sub-sections discuss the construction of compatibility matrices M and C. 4.1. Construction of M We break this complete problem in two sub problems (a) Graph structure estimation: This corresponds to track association and group detection (Eq. 2), and (b) Node value estimation: This corresponds to multi-level activity recog- M ∈ RN ×T is a score matrix for track association where Mij is the score of assigning ith track to the j th detection. It is calculated based on visual similarity, spatial proximity 3 and the motion compatibility between the ith detection with the j th track. The visual similarity score is based on color histogram matching of the j th detection with that at the last location of the ith track. The spatial proximity is the measure of closeness of the j th detection from the ith track. Lastly, the motion compatibility is based on the velocity consistency when the j th detection is added to the ith track. By combining these three scores, we obtain Mij = 3 X (n) αn (2e−βn ||xi (n) −xj ||22 − 1), Figure 3. (a) Illustration of score calculation for pose compatibility between a candidate group and a detection. In the figure, (p1, p2, p3) form a group with group’s FoV as ABCDE. F IDE and GHIF are FoVs of detections q1 and q2 respecIDE tively. Therefore S(q1, (p1, p2, p3)) = ABCDE∩F = 1 ABCDE while S(q2, (p1, p2, p3)) = ABCDE∩GHIF = 0. (b) Illustration ABCDE of field of view (FoV) for a person. The arrow signifies the pose direction. The boundary rectangle corresponds to the observed image. Best viewd in color. (6) n=1 where α and β are the weight and normalizing vectors respectively. x(1) represents color histogram, x(2) is the location and x(3) is the velocity estimate. We keep αn = 31 , β1 = 1 and β3 = 1 in the experiments. β2 is chosen as the inverse of height of the bounding box. 4.2. Construction of C from the previous time instant k − 1 to get an initial estimate of C for the present detections. Then we solve Eq. 4 to get the optimal Ω. If any row (say ith ) of Ω consists of all zeros, it indicates that ith detection does not belong to any of the groups. In such a case, we add one more group to the list with ith detection as its founding member and again solve for Eq. 4. We iteratively do this until we get group assignment for all the detections. Also, to discourage formation of singleton groups (with one member) , we remove such groups before the start of the iterative algorithm at each frame. To initialize in the first frame of the video, we consider Ng = 1 i.e. all the detections belong to a single group. This iterative method is detailed in Algorithm 1. The algorithm is found to converge within a few iterations only. In the worst case when all the detections form singleton groups and different from the groups present at previous time instant, the algorithm takes N number of iterations. C ∈ RN ×Ng is a score matrix for group association where Cil is the score of assigning the ith detection to the lth group. It is calculated based on the motion similarity, spatial closeness and the pose compatibility between the ith detection and the lth group. The group location and group velocity are defined as the averages over the locations and velocities of the members, respectively. To compute motion similarity between ith detection and lth group, we first find the track associated with the ith detection from Ψ. We then compute the velocity compatibility between the obtained track with the lth group. To obtain pose compatibility, we first calculate the interacting zone of the group formed by the members. The normalized intersection of the field of vision of the detection with the group’s interacting zone gives the score for the pose compatibility. This is illustrated in Figure 3. Let p1, p2 and p3 form a group and q1, q2 are the detections. We define field of view (FoV) for a person as the complete area in the pose direction as illustrated in Figure 3(b). The pose compatibility between a detection d and oV (d) a group ḡ is defined as S(d, ḡ) = F oV F(ḡ)∩F , where oV (ḡ) F oV (ḡ) is the intersection of FoVs of the group members. In Figure 3, q1 has high compatibility score while q2 has zero score since it has no intersection. The pose compatibility is added to discourage the non-facing persons forming a group. Finally, we combine the three scores obtained from motion, spatial and pose compatibilities to construct C as done previously for M . Algorithm 1 Algorithm to obtain Ψ and Ω 1: procedure 2: t=0, Gtk = Gk−1 3: Solve Eq. 4 to get Ψ∗ and Ω∗ 4: d = set of detections without any group assignment 5: while d is non-empty do • Add one column to Ω∗ with one of the detections from d • Solve Eq. 4 to get Ψ∗ and Ω∗ • Update Gtk and id • t←t+1 6: return Gtk , Ψ∗ and Ω∗ end 4.3. Iterative algorithm to obtain Ψ and Ω Since the group information is initially unknown at time k, we do not know the score matrix for group association i.e. C. Hence, we propose an iterative algorithm to construct C and to solve Eq. 4. We use the group information 4 5. Activity recognition 4. Group Activity Potential: wT3 φ3 (g, H(hg )) defines the compatibility of atomic activities of the group members with the group activity. It is modeled as X wT3 φ2 (g, H(hg )) = wT3b 1(g = b)H(hg ), (12) Solution of Eq. 4 gives an estimate of the latent graph structure (e.g. Figure 2b). The next problem is to estimate the optimal node values of this graph structure at all time instants causally. In other words, the aim is to recognize the activities at individual, group and collective levels. The problem is cast under a linear energy function framework as Φ(y, g, h, x) = wT φ(y, g, h, x), b∈G where H(hg ) is the histogram of atomic activities of the group members. (7) 5. Atomic Action - Image Potential: wT4 φ4 (hi , xi ) defines the compatibility of the individual’s observation with the atomic activity and modeled as X wT4 φ4 (hi , xi ) = wT4c 1(hi = c)xi . (13) where φ calculates the compatibility of activities (y, h, g) and the observations x = {x0 , xg , xi }. We follow the motivation of [7] to solve the problem. As said before, x contains individual, group and collective features which are obtained once Tk and Gk are known. We take advantage of hierarchical structure and decompose Φ(y, g, h, x) according to the graph Figure 2b as follows: Φ(y, g, h, x) = + Ng P wT0 φ0 (y, x0 ) Ng P wT2 φ2 (gi , xgi ) + i=1 + c∈H 6. Inference and Learning for activity recognition wT1 φ1 (y, H(g)) In this section, we discuss the learning and inference algorithms. Given a graph structure at any time instant k (i.e Tk and Gk ), we need to recognize the activities at all levels. Solution of Eq. 7 provides the inference about the unknown node variables (y, g, h). We use the structured SVM framework [10] to learn w, and an iterative alternate optimization method for the inference. The next two subsections discuss both these algorithms in detail. wT3 φ3 (gi , H(hgi )) i=1 +wT4 N P φ4 (hi , xi ), (8) i=1 where w = [w0 , w1 , w2 , w3 , w4 ] and φ [φ0 , φ1 , φ2 , φ3 , φ4 ]. Each term is described as follows: = 1. Collective Activity - Image Potential: It is the compatibility score of collective activity y ∈ Y with the collective observation x0 . It is modeled as X wT0 φ0 (y, x0 ) = wT0a 1(y = a)x0 , (9) 6.1. Inference Given the learned model parameters w, the inference problem is to find the optimal collective activity y ∗ , group activity vector g∗ and atomic activity vector h∗ for the input x. i.e. a∈Y where w0 = [w01 , w02 , ..., w0|Y| ] and 1(:) is an indicator function. y ∗ , g∗ , h∗ = arg max wT φ(y, g, h, x). y,g,h 2. Collective - Group Activity Potential: wT1 φ1 (y, g) is the compatibility of group activities g with the collective activity y and defined as X wT1 φ1 (y, H(g)) = wT1a 1(y = a)H(g), (10) We use an iterative method to solve Eq. 14. We initialize y, g and h with the values in the previous time step if available or random otherwise. The method is detailed in Algorithm 2. 6.2. Learning a∈Y Given a training data D = {xi , Gi , hi , gi , y i } ∀{i = 1, 2, ..., S} where S is the total number of training samples and Gi is the group label vector, the goal is to learn the optimal weight vector w∗ . We use 1-Slack structured SVM with margin-rescaling [10] where there is only a single slack variable ξ for all the constraints. Let us define zi = [hi , gi , y i ] to simplify the notations. The optimization equation is as follows: where H(g) is the histogram of group activities. 3. Group Activity - Image Potential: wT2 φ2 (g, xg ) defines the compatibility of group activity g ∈ G with the group observation xg as wT2 φ2 (g, xg ) = X wT2b 1(g = b)xg . (14) (11) b∈G 5 Algorithm 2 Inference algorithm 1: procedure I NFERENCE 2: Initialize y 0 , g0 , h0 3: t=0, err=1000 ,  = 0.01 4: while err >  do 5: y t+1 ← arg max{wT0 φ0 (y, x0 ) + wT1 φ1 (y, H(gt ))} y 6: git+1 ← arg max{wT1 φ1 (y t+1 , H(gt \git , g)) + wT2 φ2 (gi , xg ) + wT3 φ3 (g, H(htg )}, ∀i = 1 : Ng 7: ht+1 ← arg max{wT3 φ3 (gjt+1 , H(ht \hti , h)) + wT4 φ4 (xi , h)}, ∀i = 1 : N , j: group index of ith person i g h err ← 1+N1+Ng {1(y t 6= y t+1 ) + 1(gt 6= gt+1 ) + 1(ht 6= ht+1 )} t←t+1 10: return y t , gt and ht end 8: 9: w∗ = arg min 12 ||w||22 + Dξ w talking) and 8 poses (right, right-front, ..., etc.) are provided. Additionally, the authors of [7] have provided annotations for target correspondence, atomic action labels (standing, walking) and 8 pairwise interaction labels. Since we are interested in finding groups and group activities instead of pair-wise interactions, we provide annotations for group labels and group activities (walking, waiting, queuing and talking) after every 10 frames. We consider collective activity as the major activity happening at a time. For example - if out of 5 groups, 3 or 4 groups are talking and one is walking, we consider the overall activity as talking. Moreover, we differ in the definition of crossing from that mentioned in [7]. In this paper, we consider crossing happens when two or more groups cross each other on the contrary to road crossing used in [7]. We have re-annotated crossing videos accordingly. As is common in most feature tracking methods, we preprocess the videos for image stabilization. To do this, we use a time window of 20 frames where the 1st frame acts as the reference frame. The camera motion is compensated in the subsequent frames with respect to it by estimating an affine transformation between the reference frame and the k th frame. (15) s.t. ∀zi : S S 1X 1 TX ∆(zi , z̄i ) − ξ. (16) w [φ(xi , zi ) − φ(xi , z̄i )] ≥ S S i=1 i=1 The loss function ∆(z̄, zi ) is defined as |z| ∆(z̄, zi ) = 1 X 1(z̄j 6= zji ), |z| j=1 (17) where z̄ is any possible combination and zi is the actual output corresponding to the ith input. Since the number of constraints grows exponentially with S, the cutting plane algorithm [10] constructs a set of working constraints and optimize the function over this set. This set is constructed by identifying the most violated constraint for each data sample (xi , zi ) at each iteration. Finding the most violated constraint for (xi , zi ) is again an optimization problem and is as follows: ẑi = arg max wT φ(z, xi ) + ∆(z, zi ). z∈Z 7.2. Observations (18) The observations x consist of individual related features xi , group level features xg and collective features x0 . The individual observations xi ∈ R|P|×|H| include pose ∈ P and action ∈ H. xg is the mean of the feature vectors of the group members while x0 is the mean of feature vectors of all the individuals. Note that only pose and action are not enough to discriminate between waiting and queue since all the members possess the same pose and action. To incorporate some discrimination, we additionally include a pose-position compatibility to xg . The score is calculated for all the pairs (i, j) of the group members and is defined as |pT (di − dj )| where p is the pose vector corresponding to the statistical mode of the member poses and di is the This is same as our inference problem with an additional term of ∆(z, zi ). We use the same method to solve this. 7. Discussions and Experiments 7.1. Dataset We demonstrate the performance of the proposed method on the commonly used collective activity dataset provided in [7]. The dataset has 44 video clips composed of different challenging videos. The annotations for 5 collective activities (crossing, waiting, queuing, walking, and 6 position of the ith member. Higher value of the score corresponds to queue since both the vectors are aligned in the same direction while waiting will have a low value because both the vectors are orthogonal to each other. This is illustrated in Figure 4. We append the mean value of the score values obtained for all the pairs of the group to xg . model indicates the effectiveness of combined estimation of groups and tracks over independent track association. Table 1. Table showing tracking performance Baseline model Full model ID Switches 22 (4.5%) 17 (3.7%) 7.4. Group detection performance (a) Waiting To evaluate the group detection performance, we use the following clustering measures which are commonly used: Purity [1], Rand Index [23] and Normalized mutual information (NMI) [33]. We compare with a baseline case present within our framework which corresponds to group association (second part of Eq. 4). The full model incorporates both track association and group association. The quantitative results are given in Table 2. (b) Queue Figure 4. Illustration of pose-position compatibility score. The arrows for p1 and p2 indicate their pose directions. Basic setup in case of waiting and queue to be utilized to discriminate between them. (a) In case of waiting, the persons p1 and p2 are standing side by side, thereby creating a right angle between position vector (p1-p2) with pose vector. (b) In case of queue, the persons p1 and p2 are one after another and hence the position vector is aligned with pose vector. Table 2. Table showing group detection performance Framework Purity Rand Index NMI Baseline 0.82 0.75 0.65 Full 0.89 0.81 0.72 To learn a pose classifier, we fine-tune all the 19 layers of the VGG [27] network on PARSE-27k [28] pedestrian attribute dataset comprised of 27 thousand labeled training images. To account for inherent order in poses, we modify cross entropy loss by penalizing misclassification. The penalty is less for predicting nearby pose and high otherwise; For example, the penalty is less if the classifier predicts Right-Front for the true pose of Right while the penalty is high if the prediction is Left. We employ the following procedure to estimate action. We fit lines separately on the x and y coordinates of the topleft and bottom right of the bounding box as a function of time over 20 frames and use the estimated slopes to learn a SVM classifier for atomic action classification. The reason for considering both top-left and bottom right coordinates of the bounding box is to capture the possible movement along the viewing direction of the camera (i.e. effect of approaching and receding). Again, the higher values of the clustering measures in the full model indicates the effectiveness of combined estimation of groups and tracks over independent group detection. 7.5. Activity recognition performance We compare the collective activity results with [2], [14], [8] and [7] in the Table 3. To ensure a fair comparison with [2] and [14], we divide the dataset into separate training and testing sets as suggested by them. We use leave-one-videoout method to compare with [8] as suggested. To compare with [7], we use four fold setup with the splits mentioned by [7]. The Figure 5 compares the confusion table of the proposed framework with that of [7]. To find the accuracy for the group activity, we first identify the correctly detected groups and estimate accuracy for group activity on these groups. The confusion tables for group activity and atomic action are also given in Figure 5. 7.3. Tracking performance We assume that the detections per frame are available to us. We do not handle occlusion in this paper. Whenever any target returns back to the scene after occlusion, a new id is assigned to it. To evaluate the tracking performance, we consider the number of identity switches. We compare the tracking results with a baseline model present in our framework. It corresponds to the track association based on visual, spatial and velocity compatibility (first part of Eq. 4) only. The full model incorporates both track association and group association. The number of ID switches are given in Table 1. The total number of tracks in the dataset is 466. The decrease in the number of ID switches in the full Table 3. Comparison of overall and mean accuracies Accuracy [2] / [14] / Ours [8] / Ours [7] / Ours Overall 79.7 81.1 74.4 79.1 76.3 Mean 92.0 78.4 80.5 70.9 75.7 79.9 76.2 Class Form the Table 3, we notice that the proposed method offers a better accuracy than the methods [14] and [8], and is marginally inferior to [7]. However, all these methods assume availability of either tracklets or action labels whereas our method only needs the detections. Further, all these 7 Cross 61.30% 9.50% 2.80% 2.00% 24.50% Cross 78.63% 5.34% 0.00% 0.00% 16.03% Wait 2.40% 82.90% 4.40% 2.40% 7.80% Wait 7.67% 76.99% 13.70% 1.37% 0.27% Queue 4.60% 0.00% 95.40% 0.00% 0.00% Queue 8.21% 7.73% 77.54% 5.56% 0.97% Talk 0.00% 0.00% 0.00% 94.90% 5.10% Talk 5.01% 4.33% 18.22% 72.21% 0.23% Walk 29.00% 4.80% 1.20% 0.00% 65.10% Walk 23.14% 1.33% 0.00% 0.00% 75.53% Cross Wait Queue Talk Walk Cross (a) Wait Queue Talk Walk Walk 85.21% 14.43% 0.31% 0.05% Wait 14.06% 73.48% 9.27% 3.19% Queue 8.08% 18.46% 66.54% 6.92% Talk 9.14% 14.52% 11.29% 65.05% Wait Queue Talk Walk (b) (c) Walk 90.12% 9.88% Stand 14.72% 85.28% Walk Stand (d) Figure 5. (a) Confusion matrix for collective activity y from [7]. (b), (c), (d) Confusion matrices for collective activity, group activity and atomic action respectively form the proposed method. (a) Two crossing groups (b) Two waiting groups (c) A group in a queue (d) Two talking groups (e) Two walking groups (f) Two crossing groups (g) A waiting group (h) A group in a queue (i) A talking group (j) Three walking groups Figure 6. Qualitative results showing various collective and group activities. Collective activities column-wise: ’cross’, ’wait’, ’queue’, ’talk’, and ’walk’. A group is represented by a same color. Best viewed in color and when zoomed. methods are non-causal in nature and involve batch processing of data unlike the proposed method. Additionally, we provide results at all levels of granularity (individual, group and collective). Figure 6 shows some qualitative results for group detection, group activity and collective activity. The members forming a group are represented by the same color. For example, Figure 6(a) has two groups which are correctly identified as crossing each other. Hence the group activity for both the groups is walking while the collective activity is crossing. 8. Conclusions 7.6. Computational Performance References In this paper, we have proposed a novel approach for video understanding at various levels of granularity. We have presented a linear programming based method for joint estimation of tracks and groups. We have also proposed a method to recognize activities at various levels - individual, group and collective. The framework being causal in nature and computationally efficient, it is amenable for real-time implementation in video surveillance applications. The experiments show that the proposed method is very competitive with the state-of-the-art algorithms. [1] C. C. Aggarwal. A human-computer interactive method for projected clustering. IEEE Transactions on Knowledge and Data Engineering, 16(4):448–460, 2004. [2] M. R. Amer, P. Lei, and S. Todorovic. Hirf: Hierarchical random field for collective activity recognition in videos. In European Conference on Computer Vision, pages 572–585. Springer, 2014. [3] M. R. Amer, D. Xie, M. Zhao, S. Todorovic, and S.-C. Zhu. Cost-sensitive top-down/bottom-up inference for multiscale activity recognition. In European Conference on Computer Vision, pages 187–200. Springer, 2012. Towards our main aim of developing a real-time system capable of simultaneous tracking, group detection and multi-level activity recognition, currently we achieve around 3 fps with our unoptimized MATLAB code on a i7 machine with 3.50 GHz processor. With a proper implementation in GPU, we expect the frame rate to go up to 25 fps. To compare the computation time with one of the stateof-the-art algorithms, the method proposed in [2] takes 6 hours of training and 120 s per inference whereas our proposed method takes around 90 s and 0.3 s respectively. 8 [4] A. Andriyenko and K. Schindler. Globally optimal multitarget tracking on a hexagonal lattice. In European Conference on Computer Vision, pages 466–479. Springer, 2010. [5] L. Bazzani, M. Zanotto, M. Cristani, and V. Murino. Joint individual-group modeling for tracking. IEEE transactions on pattern analysis and machine intelligence, 37(4):746– 759, 2015. [6] J. Berclaz, F. Fleuret, E. Turetken, and P. Fua. Multiple object tracking using k-shortest paths optimization. IEEE transactions on pattern analysis and machine intelligence, 33(9):1806–1819, 2011. [7] W. Choi and S. Savarese. A unified framework for multitarget tracking and collective activity recognition. In European Conference on Computer Vision, pages 215–230. Springer, 2012. [8] W. Choi, K. Shahid, and S. Savarese. Learning context for collective activity recognition. In Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on, pages 3273–3280. IEEE, 2011. [9] H. Jiang, S. Fels, and J. J. Little. A linear programming approach for multiple object tracking. In Computer Vision and Pattern Recognition, 2007. CVPR’07. IEEE Conference on, pages 1–8. IEEE, 2007. [10] T. Joachims, T. Finley, and C.-N. J. Yu. Cutting-plane training of structural svms. Machine Learning, 77(1):27–59, 2009. [11] S. M. Khan and M. Shah. Detecting group activities using rigidity of formation. In Proceedings of the 13th annual ACM international conference on Multimedia, pages 403– 406. ACM, 2005. [12] T. Lan, L. Sigal, and G. Mori. Social roles in hierarchical models for human activity recognition. In Computer Vision and Pattern Recognition (CVPR), 2012 IEEE Conference on, pages 1354–1361. IEEE, 2012. [13] T. Lan, Y. Wang, W. Yang, and G. Mori. Beyond actions: Discriminative models for contextual group activities. In Advances in neural information processing systems, pages 1216–1224, 2010. [14] T. Lan, Y. Wang, W. Yang, S. N. Robinovitch, and G. Mori. Discriminative latent models for recognizing contextual group activities. IEEE Transactions on Pattern Analysis and Machine Intelligence, 34(8):1549–1562, 2012. [15] L. Leal-Taixé, G. Pons-Moll, and B. Rosenhahn. Everybody needs somebody: Modeling social and grouping behavior on a linear programming multiple people tracker. In Computer Vision Workshops (ICCV Workshops), 2011 IEEE International Conference on, pages 120–127. IEEE, 2011. [16] R. Li, R. Chellappa, and S. K. Zhou. Learning multi-modal densities on discriminative temporal interaction manifold for group activity recognition. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pages 2450–2457. IEEE, 2009. [17] J. Liu, J. Luo, and M. Shah. Recognizing realistic actions from videos in the wild. In Computer vision and pattern recognition, 2009. CVPR 2009. IEEE conference on, pages 1996–2003. IEEE, 2009. [18] J. C. Niebles, H. Wang, and L. Fei-Fei. Unsupervised learning of human action categories using spatial-temporal words. [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] 9 International journal of computer vision, 79(3):299–318, 2008. S. Pellegrini, A. Ess, and L. Van Gool. Improving data association by joint modeling of pedestrian trajectories and groupings. In European Conference on Computer Vision, pages 452–465. Springer, 2010. H. Pirsiavash, D. Ramanan, and C. C. Fowlkes. Globallyoptimal greedy algorithms for tracking a variable number of objects. In Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on, pages 1201–1208. IEEE, 2011. R. Poppe. A survey on vision-based human action recognition. Image and vision computing, 28(6):976–990, 2010. Z. Qin and C. R. Shelton. Improving multi-target tracking via social grouping. In Computer Vision and Pattern Recognition (CVPR), 2012 IEEE Conference on, pages 1972–1978. IEEE, 2012. W. M. Rand. Objective criteria for the evaluation of clustering methods. Journal of the American Statistical association, 66(336):846–850, 1971. M. Ryoo and J. Aggarwal. Stochastic representation and recognition of high-level group activities. International journal of computer Vision, 93(2):183–200, 2011. M. S. Ryoo and J. K. Aggarwal. Spatio-temporal relationship match: Video structure comparison for recognition of complex human activities. In Computer vision, 2009 ieee 12th international conference on, pages 1593–1600. IEEE, 2009. S. Savarese, A. DelPozo, J. C. Niebles, and L. Fei-Fei. Spatial-temporal correlatons for unsupervised action classification. In Motion and video Computing, 2008. WMVC 2008. IEEE Workshop on, pages 1–8. IEEE, 2008. K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. CoRR, abs/1409.1556, 2014. P. Sudowe, H. Spitzer, and B. Leibe. Person Attribute Recognition with a Jointly-trained Holistic CNN Model. In ICCV’15 ChaLearn Looking at People Workshop, 2015. I. Tsochantaridis, T. Hofmann, T. Joachims, and Y. Altun. Support vector machine learning for interdependent and structured output spaces. In Proceedings of the twenty-first international conference on Machine learning, page 104. ACM, 2004. P. Turaga, R. Chellappa, V. S. Subrahmanian, and O. Udrea. Machine recognition of human activities: A survey. IEEE Transactions on Circuits and Systems for Video Technology, 18(11):1473–1488, 2008. L. Wang, Y. Qiao, and X. Tang. Latent hierarchical model of temporal structure for complex activity classification. IEEE Transactions on Image Processing, 23(2):810–822, 2014. D. Weinland, R. Ronfard, and E. Boyer. A survey of visionbased methods for action representation, segmentation and recognition. Computer vision and image understanding, 115(2):224–241, 2011. M. Wu and B. Schölkopf. A local learning approach for clustering. In Advances in neural information processing systems, pages 1529–1536, 2006. [34] K. Yamaguchi, A. C. Berg, L. E. Ortiz, and T. L. Berg. Who are you with and where are you going? In Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on, pages 1345–1352. IEEE, 2011. [35] L. Zhang, Y. Li, and R. Nevatia. Global data association for multi-object tracking using network flows. In Computer Vision and Pattern Recognition, 2008. CVPR 2008. IEEE Conference on, pages 1–8. IEEE, 2008. 10
1cs.CV
Sampled-data reachability analysis using sensitivity and mixed-monotonicity arXiv:1803.02214v1 [cs.SY] 6 Mar 2018 Pierre-Jean Meyer1 , Samuel Coogan2 , Murat Arcak1 Abstract— This paper deals with the over-approximation of the reachable sets of a continuous-time uncertain system based on the sensitivity of its trajectories with respect to initial conditions and uncertain parameters. We first prove the equivalence between an existing over-approximation result based on the sign-stability of the sensitivity matrices and a discrete-time approach relying on a mixed-monotonicity property. We then present a new over-approximation result applicable to any continuous-time system with bounded sensitivity and provide a simulation-based approach to estimate these bounds through sampling and falsification. The obtained results are illustrated in numerical examples on traffic networks and satellite orbits. I. I NTRODUCTION Reachability analysis deals with the problem of computing the set of all possible successors or trajectories of a system, given its sets of initial conditions and admissible disturbance and uncertainty values. Since exact computation of the reachable set is rarely possible except in simple cases [3], we instead evaluate an over-approximation to guarantee that the obtained set contains all possible successors or trajectories of the system. An over-approximation can be used for safety verification to ensure that a bad set is never crossed (see e.g. [8]) or for the synthesis of high-level controller through the use of discrete abstractions (see e.g. [6]). Various methods and representations exist for these over-approximations, such as ellipsoids [12], polytopes [4], level-sets [13] or multidimensional intervals [14]. This paper focuses on the computation of interval overapproximations of reachable sets for a continuous-time uncertain system and relies on its sensitivity matrices, i.e. the partial derivatives of its trajectories with respect to the initial state or uncertain parameters. Such an approach was introduced in [16] for the case of systems whose sensitivity matrix is sign-stable over the set of initial states. This paper presents three main contributions. 1) In Section III, we formally prove the equivalence between the signstable sensitivity approach proposed in [16] for continuoustime systems and the one based on mixed-monotonicity for discrete-time systems in [6]. 2) We next propose in Section IV a generalized sensitivity-based reachability analysis applicable to any continuous-time system whose sensitivity matrices are bounded. This generalization is motivated by the one applied in [17] to continuous-time mixed-monotone Funded in part by the National Science Foundation grant CNS-1446145. 1 P.-J. Meyer and M. Arcak are with the Department of Electrical Engineering and Computer Sciences, University of California, Berkeley, USA. {pjmeyer,arcak}@berkeley.edu 2 S. Coogan is with the School of Electrical and Computer Engineering and the School of Civil and Environmental Engineering at the Georgia Institute of Technology, Atlanta, USA. [email protected] systems. 3) Since the proposed approach is based on the system trajectories and sensitivity which are unknown for most continuous-time systems, we finally present a simulationbased method to estimate the sensitivity bounds using sampling and falsification in Section V. Section VI then illustrates these results through two numerical examples, one on traffic networks and the other one on satellite orbits. II. P RELIMINARIES Let R be the set of reals and I ⊆ 2R the set of closed real intervals, i.e. for all X ∈ I, there exists x, x ∈ R such that X = [x, x] = {x ∈ R | x ≤ x ≤ x} ⊆ R. I n and I n×q then represent the sets of interval vectors in Rn and interval matrices in Rn×q , respectively. A. System definition We consider a continuous-time, time-varying system ẋ = f (t, x, p), (1) with state x ∈ Rn , uncertain parameter p ∈ Rq and continuously differentiable vector field f : R × Rn × Rq → Rn . We denote as Φ(t; t0 , x0 , p) ∈ Rn the state reached by (1) at time t ≥ t0 from initial state x0 with parameter p. The variable p can also represent control or disturbance parameters that remain constant over the considered time interval [t0 , t]. Given sets X0 ⊆ Rn and P ⊆ Rq of initial states and parameters, respectively, the reachable set of (1) at time t ≥ t0 is denoted as R(t; t0 , X0 , P ) = {Φ(t; t0 , x0 , p) | x0 ∈ X0 , p ∈ P }. (2) The sensitivity of the trajectories of (1) with respect to the initial conditions is defined as the square matrix: sx (t; t0 , x0 , p) = ∂Φ(t; t0 , x0 , p) ∈ Rn×n . ∂x0 (3) The sensitivity with respect to the uncertain parameter is similarly defined as: sp (t; t0 , x0 , p) = ∂Φ(t; t0 , x0 , p) ∈ Rn×q . ∂p (4) B. Problem formulation Given an initial time t0 ∈ R, our objective is to compute an over-approximation of the reachable set of (1) at time T ≥ t0 and for sets X0 ⊆ Rn and P ⊆ Rq defined as intervals. Problem 1: Given times t0 ∈ R and T ≥ t0 and intervals X0 ∈ I n and P ∈ I q , find a set R̄(T ; t0 , X0 , P ) ⊆ Rn such that R(T ; t0 , X0 , P ) ⊆ R̄(T ; t0 , X0 , P ). III. R EACHABILITY WITH SIGN - STABLE SENSITIVITY In this section, we review the over-approximation approach presented in [16] with the aim of connecting it in Section III-B to discrete-time mixed-monotonicity from [6]. A. Sensitivity-based reachability analysis A particular case of the results presented in [16] provides a method to obtain an interval over-approximation of the reachable set for an autonomous system ẋ = f (x) whose sensitivity matrix sx (T, x0 ) at time T ≥ 0 is sign stable over the set of initials states X0 . For the purpose of the comparison in Section III-B, these results are reviewed here in a more general framework where the system (1) explicitly depends on both the time t and an uncertain parameter p. Given, t0 ∈ R, T ≥ t0 , X0 ∈ I n and P ∈ I q as in Problem 1, we first assume that both sensitivity matrices sx and sp as defined in (3) and (4) at time T are sign-stable over the sets X0 and P . Assumption 2: For all x0 , x̃0 ∈ X0 , p, p̃ ∈ P , i, j ∈ {1, . . . , n}, k ∈ {1, . . . , q}, we have ( sxij (T ; t0 , x0 , p)sxij (T ; t0 , x̃0 , p̃) ≥ 0, spik (T ; t0 , x0 , p)spik (T ; t0 , x̃0 , p̃) ≥ 0. Let x0 , x0 ∈ Rn and p, p ∈ Rq be such that X0 = [x0 , x0 ] and P = [p, p]. For each i ∈ {1, . . . , n}, we define the states i i i ξ i = [ξ i1 ; . . . ; ξ in ], ξ = [ξ 1 ; . . . ; ξ n ] ∈ X0 and parameters π i = [π i1 ; . . . ; π iq ], π i = [π i1 ; . . . ; π iq ] ∈ P such that for all j ∈ {1, . . . , n} and k ∈ {1, . . . , q}:  i  sxij (T ; t0 , x0 , p) ≥ 0 ⇒ ξ ij = x0 j , ξ j = x0j ,    i  x sij (T ; t0 , x0 , p) < 0 ⇒ ξ ij = x0j , ξ j = x0 j , (5) sp (T ; t0 , x0 , p) ≥ 0 ⇒ π i = p , π i = p ,  k  k k ik k   p sik (T ; t0 , x0 , p) < 0 ⇒ π ik = pk , π ik = pk . i The states ξ i , ξ ∈ X0 and parameters π i , π i ∈ P defined in (5) are then used to obtain an interval over-approximation R̄(T ; t0 , X0 , P ) ∈ I n of the reachable set R(T ; t0 , X0 , P ). Theorem 3 ([16]): Under Assumption 2, an overapproximation R̄(T ; t0 , X0 , P ) ∈ I n is given in each dimension i ∈ {1, . . . , n} by: i R̄i (T ; t0 , X0 , P ) = [Φi (T ; t0 , ξ i , π i ), Φi (T ; t0 , ξ , π i )] ∈ I. The main idea of the proof of Theorem 3 in [16] is to use the monotonicity of the successor components Φi (T ; t0 , x0 , p) with respect to the initial state and parameter components x0,j and pk (induced by the sign of sxij (T ; t0 , x0 , p) and spik (T ; t0 , x0 , p), respectively). Remark 4: Theorem 3 requires the computation of the full i successor Φ of (1) for each pair (ξ i , π i ), (ξ , π i ) ∈ X0 × P even though only its ith component Φi is actually used to define the over-approximation. When some pairs are nonunique, more components of the same successor Φ will be used. The computational burden can thus go from at most 2n successors when all the above pairs are unique, to at least 2 successors when there exists x̃, x̂ ∈ X0 i and p̃, p̂ ∈ P such that (ξ i , ξ , π i , π i ) = (x̃, x̂, p̃, p̂) or i (ξ i , ξ , π i , π i ) = (x̂, x̃, p̂, p̃) for all i ∈ {1, . . . , n}. The latter case corresponds to continuous-time monotonicity of (1) with respect to orthants, described in [2]. It can also be noted that the over-approximation obtained in Theorem 3 is tight in the sense that R̄(T ; t0 , X0 , P ) is the smallest interval in I n containing the reachable set R(T ; t0 , X0 , P ). Corollary 5: For all X ∈ I n , if R(T ; t0 , X0 , P ) ⊆ X then R̄(T ; t0 , X0 , P ) ⊆ X. Proof: For all i ∈ {1, . . . , n} we have i ξ i , ξ ∈ X0 and π i , π i ∈ P from (5), thus leading i to Φ(T ; t0 , ξ i , π i ), Φ(T ; t0 , ξ , π i ) ∈ R(T ; t0 , X0 , P ). Since components i of these reachable states define R̄i (T ; t0 , X0 , P ) in Theorem 3, any interval X ∈ I n strictly contained in R̄(T ; t0 , X0 , P ) cannot contain the whole reachable set R(T ; t0 , X0 , P ). B. Comparison with discrete-time mixed-monotonicity In this section, we show that the approach described in Section III-A for the over-approximation of continuoustime systems with sign-stable sensitivity is equivalent to the method presented in [6] for discrete-time systems satisfying a mixed-monotonicity property. We first recall the definition of a discrete-time mixed-monotone system, where ≤ and ≥ denote the componentwise inequalities. Definition 6 (Discrete-time mixed-monotonicity [6]): A discrete-time system x+ = F (t, x, p) with F : R × X × P → X is mixed-monotone if there exists a decomposition function g : R × X × P × X × P → X such that • ∀t ∈ R, x ∈ X, p ∈ P, g(t, x, p, x, p) = F (t, x, p), • ∀t ∈ R, x, x̃, ξ ∈ X, p, p̃, π ∈ P , if x ≤ x̃ and p ≤ p̃, then g(t, x, p, ξ, π) ≤ g(t, x̃, p̃, ξ, π), • ∀t ∈ R, x, ξ, ξ˜ ∈ X, p, π, π̃ ∈ P , if ξ ≤ ξ˜ and π ≤ π̃, ˜ π̃). then g(t, x, p, ξ, π) ≥ g(t, x, p, ξ, These three conditions imply that F is embedded in g, g is non-decreasing in its first two components and nonincreasing in its last two components. A sufficient condition for Definition 6 to hold is to have a system whose Jacobian matrices ∂F/∂x and ∂F/∂p are sign-stable. Proposition 7 ([6]): The discrete-time system x+ = F (t, x, p) is mixed-monotone if there exists {εij | i, j ∈ 2 {1, . . . , n}} ∈ {−1, 1}n and {δik | i ∈ {1, . . . , n}, k ∈ {1, . . . , q}} ∈ {−1, 1}nq such that for all t ∈ R, x ∈ X ⊆ Rn , p ∈ P ⊆ Rq , i, j ∈ {1, . . . , n}, k ∈ {1, . . . , q} we have: ∂Fi ∂Fi (t, x, p) ≥ 0, δik (t, x, p) ≥ 0. ∂xj ∂pk Theorem 8 ([6]): Define g : R×X×P ×X×P → X such that for all i ∈ {1, . . . , n}, gi (t, x, p, x̃, p̃) = Fi (t, ξ i , π i ) with ξ i = [ξ1i ; . . . ; ξni ] ∈ X and π i = [π1i ; . . . ; πqi ] ∈ P defined for all j ∈ {1, . . . , n}, k ∈ {1, . . . , q} by ( ( xj if εij = 1, pk if δik = 1, i i ξj = πk = x̃j if εij = −1, p̃k if δik = −1. εij Then, for all x0 ∈ [x0 , x0 ] ∈ I n and p ∈ [p, p] ∈ I q , we have: g(t, x0 , p, x0 , p) ≤ F (t, x0 , p) ≤ g(t, x0 , p, x0 , p). The equivalence between Theorems 3 and 8 can then be formulated as follows. Theorem 9: Given the initial time t0 ∈ R, the intervals X0 = [x0 , x0 ] ∈ I n and P = [p, p] ∈ I q and the discretetime system x+ = F (t, x, p) with F (t, x, p) = Φ(T ; t, x, p), the over-approximations in Theorems 3 and 8 are equivalent: R̄(T ; t0 , X0 , P ) = [g(t0 , x0 , p, x0 , p), g(t0 , x0 , p, x0 , p)]. Proof: From F (t0 , x0 , p) = Φ(T ; t0 , x0 , p), we first note that the mixed-monotonicity conditions in Proposition 7 are equivalent to Assumption 2 on the sign stability of the sensitivity matrices sx and sp defined in (3) and (4). For each i ∈ {1, . . . , n}, Theorem 8 thus defines gi (t0 , x0 , p, x0 , p) = i Fi (t0 , ξ i , π i ) and gi (t0 , x0 , p, x0 , p) = Fi (t0 , ξ , π i ) with i the same ξ i , ξ ∈ X0 and π i , π i ∈ P as defined in (5). The equality in Theorem 9 finally results from using F (t0 , x0 , p) = Φ(T ; t0 , x0 , p) again. IV. R EACHABILITY WITH BOUNDED SENSITIVITY We now modify (5) and Theorem 3 for this overapproximation method to be applicable to any continuoustime system (1) whose sensitivities sx (T ; t0 , x0 , p) and sp (T ; t0 , x0 , p) are bounded over the sets X0 and P . This modification is motivated by an extension of the definition of mixed-monotonicity for continuous-time systems in [17]. Assumption 10: For all i, j ∈ {1, . . . , n}, k ∈ {1, . . . , q}, there exists sxij , sxij , spik , spik ∈ R such that for all x0 ∈ X0 , p ∈ P we have sxij (T ; t0 , x0 , p) ∈ [sxij , sxij ] and spik (T ; t0 , x0 , p) The generalization of Theorem 3 is then formulated in i the following result, where ξ i , ξ ∈ Rn and π i , π i ∈ Rq are i n column vectors and c ∈ R and di ∈ Rq are row vectors. Theorem 11: Under Assumption 10, an overapproximation R̄(T ; t0 , X0 , P ) ∈ I n is given in each dimension i ∈ {1, . . . , n} by: R̄i (T ; t0 , X0 , P ) = i [Φi (T ; t0 , ξ i , π i ) − ci (ξ i − ξ ) − di (π i − π i ), i i states ξ i , ξ ∈ X0 and parameters π i , π i ∈ P obtained in (6) are the same as their hatted counterparts that would be obtained in (5) for the auxiliary system. Applying Theorem 3 to Φ̂ implies that for all i ∈ {1, . . . , n}, x0 ∈ X0 and p ∈ P : Φi (T ; t0 , x0 , p) ∈ [spik , spik ]. ∈ Denoting the center of [sxij , sxij ] and [spik , spik ] as sx∗ ij and p∗ sik , respectively, we first update the definition of the states i ξ i , ξ ∈ X0 and parameters π i , π i ∈ P in (5) as follows:  i i  sx∗  ij ≥ 0 ⇒ ξ j = x0 j , ξ j = x0j ,   i  x∗ sij < 0 ⇒ ξ ij = x0j , ξ j = x0 j , (6)   sp∗ ≥ 0 ⇒ π ik = pk , π ik = pk ,  ik   p∗ sik < 0 ⇒ π ik = pk , π ik = pk . Note that the condition sx∗ ij ≥ 0 in the first line of (6) covers both cases where the whole interval [sxij , sxij ] is positive (as p in (5)) and where it is mostly positive (spik ≤ 0 ≤ sx∗ ij ≤ sik ). To account for the deviations from the sign-stable cases of (5) that may arise through the mostly positive and mostly negative cases in (6), we introduce two row vectors ci = [ci1 , . . . , cin ] ∈ Rn and di = [di1 , . . . , diq ] ∈ Rq for each i ∈ {1, . . . , n} defined such that for all j ∈ {1, . . . , n}, k ∈ {1, . . . , q}:  i x  sx∗  ij ≥ 0 ⇒ cj = min(0, sij ),    x∗ sij < 0 ⇒ cij = max(0, sxij ), (7) p∗ p i  ), s ≥ 0 ⇒ d = min(0, s  k ik ik   sp∗ < 0 ⇒ di = max(0, sp ). k ik ik Equation (7) means that cij = 0 in the sign stable cases (sxij ≥ 0 or sxij ≤ 0), cij = sxij ≤ 0 in the mostly positive case and cij = sxij ≥ 0 in the mostly negative case. i Φi (T ; t0 , ξ , π i ) + ci (ξ i − ξ ) + di (π i − π i )]. Proof: Consider an auxiliary system whose trajectories Φ̂ are such that for all x0 ∈ X0 , p ∈ P and i ∈ {1, . . . , n} we have Φ̂i (T ; t0 , x0 , p) = Φi (T ; t0 , x0 , p) − ci x0 − di p. Then, from the sensitivity bounds in Assumption 10 and the definition of ci and di in (7), the sensitivities ŝx (T ; t0 , x0 , p) and ŝp (T ; t0 , x0 , p) of this auxiliary system are sign stable over the sets X0 and P , i.e. for all x0 ∈ X0 and p ∈ P , ŝxij (T ; t0 , x0 , p) = sxij (T ; t0 , x0 , p) − cij ≥ 0 (resp. ≤ 0) p if sx∗ ij ≥ 0 (resp. ≤ 0), with similar results for ŝ . Since x x∗ ŝij (T ; t0 , x0 , p) and sij have the same sign (and similarly for ŝpij (T ; t0 , x0 , p) and sp∗ ij ), this also guarantees that the [Φi (T ; t0 , ξ i , π i ) + ci (x0 − ξ i ) + di (p − π i ), i i Φi (T ; t0 , ξ , π i ) + ci (x0 − ξ ) + di (p − π i )]. From (7), cij ≤ 0 (resp. ≥ 0) if sx∗ ij ≥ 0 (resp. ≤ 0). Then i for all x0 ∈ [x0 , x0 ], we have ci ξ ≤ ci x0 ≤ ci ξ i , with i ξ i , ξ ∈ X0 defined as in (6). We similarly obtain di π i ≤ di p ≤ di π i for all p ∈ [p, p], which finally leads to the over-approximation in the theorem statement. Remark 12: Although the over-approximation R̄(T ; t0 , X0 , P ) is tight in the sign-stable case (Theorem 3, Corollary 5), tightness cannot be guaranteed in the more general case of Theorem 11 due to the additional terms i ±ci (ξ i − ξ ) and ±di (π i − π i ). Following the comparison with the discrete-time mixedmonotonicity in Section III-B, a side product of Theorem 11 is a new over-approximation method for discrete-time systems generalizing the approach from [6]. Corollary 13: Let x+ = F (t, x, p) have bounded Jacobian matrices ∂F (t,x,p) ∈ I n×n and ∂F (t,x,p) ∈ I n×q over ∂x ∂p all states x ∈ [x0 , x0 ] and parameters p ∈ [p, p]. Then, the reachable set F (t, X0 , P ) after one step can be overapproximated as follows on each dimension i ∈ {1, . . . , n}: i Fi (t, X0 , P ) ⊆ [Fi (t, ξ i , π i )−ci (ξ i −ξ )−di (π i −π i ), i i Fi (t, ξ , π i ) + ci (ξ i − ξ ) + di (π i − π i )], i where ξ i , ξ , π i , π i and ci , di are defined as in (6) and (7) using the bounds of the Jacobian matrices. V. O BTAINING BOUNDS ON THE SENSITIVITIES Despite the equivalence between the continuous- and discrete-time over-approximations methods highlighted in Theorem 9 and Corollary 13, one significant difference is that the discrete-time approach is based on the (usually) known successor function F : R × X × P → X while the continuous-time approach relies on the trajectory Φ(·; t0 , x0 , p) : [t0 , +∞) → X evaluated at time T ≥ t0 , which is rarely known explicitly. Although the successors Φ(T ; t0 , x0 , p) can be computed through numerical integration of the system ẋ = f (t, x, p), the main challenge is the computation of the sensitivity matrices sx (T ; t0 , x0 , p) in (3) and sp (T ; t0 , x0 , p) in (4) for all x0 ∈ X0 and p ∈ P to evaluate the sign-stability or boundedness of these sensitivities as in Assumptions 2 and 10, respectively. A. Sampling and falsification In this section, we propose a simulation-based approach where we first evaluate the sensitivity bounds from a few samples in X0 × P and then use a falsification method to iteratively enlarge these bounds by looking for other pairs in X0 × P whose sensitivity does not belong to these bounds. From the definition of sx in (3), we can use the chain rule to define the time-varying linear system ṡx (t; t0 , x0 , p) = Dfx |Φ sx (t; t0 , x0 , p), (8) where Dfx |Φ = Dfx (t, Φ(t; t0 , x0 , p), p) denotes the Jacoevaluated along the trajectory bian Dfx (t, x, p) = ∂f (t,x,p) ∂x Φ(t; t0 , x0 , p). System (8) is initialized with the identity matrix sx (t0 ; t0 , x0 , p) = In ∈ Rn×n [7]. A similar timevarying affine system can be found for the sensitivity sp : ṡp (t; t0 , x0 , p) = Dfx |Φ sp (t; t0 , x0 , p) + Dfp |Φ , (9) where Dfp |Φ is the evaluation of Dfp (t, x, p) = ∂f (t,x,p) ∂p along the trajectory Φ(t; t0 , x0 , p) and (9) is initialized with the zero matrix sp (t0 ; t0 , x0 , p) = 0n×q ∈ Rn×q [11]. For a given time T ≥ t0 , we first compute the sensitivity matrices sx (T ; t0 , x0 , p) and sp (T ; t0 , x0 , p) through the numerical integration of the systems (8) and (9) for at least one pair (x0 , p) ∈ X0 ×P to obtain initial sensitivity bounds denoted as [sx , sx ] ∈ I n×n and [sp , sp ] ∈ I n×q . More than one pair (x0 , p) can be obtained through either random sampling or a gridded discretization of X0 and P . The second step aims to falsify these bounds [10] through an optimization problem, i.e. to find x0 ∈ X0 and p ∈ P such / that either sx (T ; t0 , x0 , p) ∈ / [sx , sx ] or sp (T ; t0 , x0 , p) ∈ p p [s , s ]. Focusing on the sensitivity with respect to the initial state, we want to solve the following optimization problem !! sxij − sxij sxij + sxij x min min − sij (T ; t0 , x0 , p) − i,j x0 ∈X0 2 2 p∈P whose cost function is negative if and only if there exists i, j ∈ {1, . . . , n} such that sxij (T ; t0 , x0 , p) ∈ / [sxij , sxij ]. If the obtained local minimum is negative and the corresponding arguments are denoted as x∗0 ∈ X0 and p∗ ∈ P , the sensitivity bounds are thus updated as follows using elementwise min and max operators: sx ← min(sx , sx (T ; t0 , x∗0 , p∗ )), sx ← max(sx , sx (T ; t0 , x∗0 , p∗ )). This process is repeated with the new bounds until a positive minimum is obtained. A similar approach can be applied to [sp , sp ]. Remark 14: While this approach is likely to result in an accurate approximation of the actual sensitivity bounds, it is not guaranteed to over-approximate the set of all possible sensitivity values over X0 ×P since the falsification relies on an optimization problem only able to provide local minima. B. Interval arithmetics An alternative approach recommended in [16] is based on the use of interval arithmetics to solve an affine time-varying system as presented in [1]. For the purpose of comparison with the method in Section V-A on the numerical examples of Section VI, we thus review how the results described in [1] can be applied to the sensitivity systems (8) and (9) to obtain guaranteed bounds on the sensitivity matrices. We start from the assumption that bounds on the Jacobian and Dfp (t, x, p) = ∂f (t,x,p) matrices Dfx (t, x, p) = ∂f (t,x,p) ∂x ∂p of (1) are known or can be computed. Assumption 15: Given an invariant set X ⊆ Rn of (1), there exists interval matrices A ∈ I n×n and B ∈ I n×q such that for all t ∈ [t0 , +∞), x ∈ X, p ∈ P we have Dfx (t, x, p) ∈ A and Dfp (t, x, p) ∈ B. Using the Jacobian bounds from Assumption 15, we can rewrite (8) and (9) as the set-valued systems: ṡx (t) ∈ Asx (t), p p ṡ (t) ∈ As (t) + B, sx (t0 ) = In , (10) s (t0 ) = 0n×q . (11) p The solution of these systems at time T ≥ t0 is given in [1] x by (T ) ∈ eA(T −t0 ) sx (t0 ) and sp (T ) ∈ eA(T −t0 ) sp (t0 ) + R T s A(t−t 0) e Bdt, where the definition of the interval addition t0 and multiplication operators can be found in [9]. The interval matrix exponentials eAt ∈ I n×n are approximated in [1] by i P∞ truncating their Taylor series eAt = i=0 (At) to an order i! m and over-approximating the truncated terms by a function i P∞ E : [0, +∞) → I n×n such that i=m+1 (At) ⊆ E(t). We i! refer the reader to [1] for a detailed definition of E(t). Therefore, from the interval matrix exponential overi Pm approximation eAt ⊆ i=0 (At) + E(t), the monotonicity i! of E (E(t) ⊆ E(t∗ ) if t ≤ t∗ [1]) and the initial conditions of (10) and (11), we obtain the following result. Proposition 16: Under Assumption 15, the sensitivity matrices (3) and (4) at time T ≥ t0 are bounded over the sets of initial states X0 ⊆ X and parameters P as follows: m X (A(T − t0 ))i + E(T − t0 ), i! i=0 ! m i X (A(T − t )) 0 + E(T − t0 ) (T − t0 )B. sp (T ) ∈ (i + 1)! i=0 Remark 17: Unlike the sampling-based method in Section V-A, Proposition 16 is sound in the sense that it provides guaranteed over-approximations for the sensitivities. However, these bounds have a risk of being overly conservative due to the fact that interval arithmetics cannot provide exact sx (T ) ∈ set computation but only over-approximations as soon as more than two interval matrices are multiplied [9]. Remark 18: The minimal Taylor order m∗ for the overP∞ (At)i ⊆ approximation of the truncated terms i=m∗ +1 i! E(t) to be valid is an affine function of time: m∗ (t) = at−2 with a ≥ 0 [1]. It might thus be practically infeasible to obtain sensitivity bounds using Proposition 16 when the desired time step T − t0 is too large. VI. N UMERICAL EXAMPLES A. Traffic network Consider the 3-link traffic network describing a diverge junction (the vehicles in link 1 divide evenly among the outgoing links 2 and 3) as in [5]:   p − g(x) x+ = F (x, p) = x + g(x)/2 − min(c, vx2 ) , (12) g(x)/2 − min(c, vx3 ) p ∈ R we have, using componentwise inequalities,    v 0 0 0 2w ∂F (x, p) w ≤ − 0 v + w ≤ v/2 0 ∂x v/2 0 0 w v+w  2w 0 0 (x,p) = [1; 0; 0]. This means that the system is and ∂F∂p mixed-monotone and we can apply Theorem 8 to obtain an approximation of the reachable set in blue. Although the red and blue sets are obtained with the same over-approximation method (see Theorem 9), it is applied to different successor functions: the exact successor Φ(T ; x0 , p) for the continuoustime system (13) and its Euler approximation F (x0 , p) for the discrete-time system (12). This explains why the blue interval is not an over-approximation of the reachable set for the continuous-time system (13), although it is an overapproximation of the discrete-time reachable set F (X0 , P ). where g(x) = min(c, vx1 , 2w(x̄ − x2 ), 2w(x̄ − x3 )), x ∈ R3 is the vehicle density in the three links, p ∈ P = [40, 60] is the constant but uncertain vehicle inflow to link 1 and c = 40, v = 0.5, x̄ = 320, w = 1/6 are known parameters of the network detailed in [5]. System (12) from [5] is an Euler discretization, with sampling time T = 30 seconds, of the continuous-time system: ẋ = f (x, p) = F (x, p) − x . T (13) In addition to the uncertain disturbance input p ∈ P = [40, 60], we consider a set X0 ⊆ I 3 of initial conditions such that X0 = [150, 200] × [250, 320] × [50, 100], meaning that link 2 is close to its maximal capacity x̄ = 320 while link 3 has more availability. Figure 1 presents the projection in the (x1 , x3 ) plane of the initial interval X0 (dashed black), the reachable set {Φ(T ; x0 , p) | x0 ∈ X0 , p ∈ P } (hatched black) of the continuous-time system (13) after time T = 30 seconds and three methods to approximate this set. We first estimate the sensitivity bounds of (13) with the sampling and falsification method in Section V-A resulting in sign-stable sensitivity matrices as in Assumption 2. We then apply Theorem 3 to obtain the tight red over-approximation. We next over-approximate the sensitivity bounds with the interval arithmetics approach in Proposition 16 for a Taylor order m = 30, resulting in sound but much larger bounds (as predicted in Remark 17) which do not satisfy Assumption 2. The over-approximation in green is thus obtained from the generalized result in Theorem 11 and is much more conservative than the red one, firstly because Theorem 11 is known not to be tight (Remark 12), but also because it tries to compensate for the sensitivity elements believed not to be sign-stable while their real values are actually signstable according to the sampling-based estimation above. Finally, we consider the discrete-time system (12) whose Jacobian matrices can be shown to be sign-stable by computing their bounds explicitly from (12): for all x ∈ R3 and Fig. 1. Reachable set (hatched black) of (13) from the initial interval (dashed black) and its over-approximations using sampling-based sensitivity bounds (red), interval arithmetics (green) and discrete-time mixedmonotonicity (blue) for system (12). We now extend this three link example by adding links downstream of the diverging junction so that traffic on link 2 flows to link 4 then to link 6, etc., and, likewise, traffic flows from link 3 to 5 to 7, etc. The modified dynamics are 1 (g(x)/2 − h(xi , xi+2 )), i ∈ {2, 3} (14) T 1 fi (x, p) = (βh(xi−2 , xi ) − h(xi , xi+2 )), i ∈ {4, . . . , n} T (15)   where h(η, ζ) = min c, vη, w β (x̄ − ζ) , n is the total number of links in the network, and we take β = 34 . For i ∈ {n − 1, n}, the term w β (x̄ − xi+2 ) is excluded from the minimization in h. It is known that the Euler discretization for this system has sign stable Jacobians [5], and, moreover, the sampling and falsification method proposed above indicates that the sensitivity matrices of (14)-(15) are sign-stable for all T . In particular, sxij ≥ 0 if i = 1 or j = 1, and, otherwise, sxij ≥ 0 if i + j is even and sxij ≤ 0 if i + j is odd. For T = 300 seconds, n = 11, and X0 = [20, 300]11 , fi (x, p) = the reachable set is over-approximated as   x1 ∈ [79, 798],     11 [x2 ; x4 ; x6 ; x8 ; x10 ] ∈ [a, b], R̄(T ; X0 , P ) = x ∈ R     [x3 ; x5 ; x7 ; x9 ; x11 ] ∈ [a, b] where a = [13.8; 8.8; 6.4; 5.5; 5.3] [266.9; 241.5; 199.3; 153.2; 118.0]. and b = B. Satellite orbit Consider the non-linear system describing a satellite orbiting a celestial body from [15]:     R + 400 x2   0 − xp2 + x1 x24    , x(0) =  1 ẋ =    , (16) 0   x4 q  p 2x2 x4 − x1 (R+400)3 where x1 is the distance of the satellite to the center of the body, x3 its angular position and x2 and x4 their respective derivatives. The parameter p ∈ R is defined as p = GM , where G is the gravitational constant and M the mass of the body. The initial conditions of (16) are chosen to obtain a circular orbit at 400km above the body’s surface (radius R). Assuming uncertain values (around Earth’s known values) for both the parameter p ∈ [3.9779, 3.9938] ∗ 105 km3 /s2 and the desired orbit radius R + 400 ∈ [6.7718, 6.7845] ∗ 103 km, we obtain uncertainty bounds denoted as p ∈ [p, p] ⊆ R and x(0) ∈ [x0 , x0 ] ∈ I × {0} × {0} × I ⊆ R4 . We want to study the effect of these uncertainties on the reachable set of (16) at time T = 92 minutes (after approximately one whole revolution around the Earth). As hinted in Remark 18, the interval arithmetics approach from Section V-B is not applicable to (16) since the choice of T = 5520 seconds requires a minimum Taylor order m∗ (T ) = 88883. We thus rely on the sampling-based approach from Section V-A and obtain sensitivity bounds [sx , sx ] ∈ I 4×4 and [sp , sp ] ∈ I 4 which do not satisfy the sign-stability condition in Assumption 2 since 0 ∈ [sxij , sxij ] for 6 of the 16 (i, j) pairs, and 0 ∈ [spik , spik ] for 3 of the 4 (i, k) pairs. Applying the generalized result in Theorem 11, we thus obtain an over-approximation R̄(T ; 0, [x0 , x0 ], [p, p]) ∈ I 4 of the reachable set of (16) at time T , reported in Figure 2, along with an estimation of the actual reachable set (cloud of black dots) obtained from 10000 random samples (x0 , p) ∈ [x0 , x0 ] × [p, p]. Although the over-approximation is an interval of R4 , note that Figure 2 only displays its projection into the polar coordinate system (x1 , x3 ). VII. C ONCLUSION In this paper, we studied reachability analysis methods based on the sensitivity matrices of a continuous-time system. The existing approach for sign-stable sensitivity was first connected to discrete-time mixed-monotonicity and then generalized to the case of non-stable but bounded sensitivity. Finally, we provided a sampling and falsification method to evaluate the sensitivity bounds and compared it in two numerical examples with an alternative approach based on interval arithmetics. Fig. 2. Reachable set (black) of (16) and its over-approximation R̄(T ; 0, [x0 , x0 ], [p, p]) (blue) projected in the polar plane (x1 , x3 ). R EFERENCES [1] M. Althoff, O. Stursberg, and M. Buss. Reachability analysis of linear systems with uncertain parameters and inputs. In 46th IEEE Conference on Decision and Control, pages 726–732. IEEE, 2007. [2] D. Angeli and E. D. Sontag. Monotone control systems. IEEE Transactions on Automatic Control, 48(10):1684–1698, 2003. [3] E. Asarin, O. Maler, and A. Pnueli. Reachability analysis of dynamical systems having piecewise-constant derivatives. Theoretical computer science, 138(1):35–65, 1995. [4] A. Chutinan and B. H. Krogh. Computational techniques for hybrid system verification. IEEE transactions on automatic control, 48(1):64– 75, 2003. [5] S. Coogan and M. Arcak. A benchmark problem in transportation networks. arXiv preprint arXiv:1803.00367. [6] S. Coogan and M. Arcak. Efficient finite abstraction of mixed monotone systems. In Proceedings of the 18th International Conference on Hybrid Systems: Computation and Control, pages 58–67. ACM, 2015. [7] A. Donzé and O. Maler. Systematic simulation using sensitivity analysis. In International Workshop on Hybrid Systems: Computation and Control, pages 174–189. Springer, 2007. [8] G. Frehse. Phaver: Algorithmic verification of hybrid systems past hytech. In International workshop on hybrid systems: computation and control, pages 258–273. Springer, 2005. [9] L. Jaulin. Applied interval analysis: with examples in parameter and state estimation, robust control and robotics, volume 1. Springer Science & Business Media, 2001. [10] J. Kapinski, J. V. Deshmukh, X. Jin, H. Ito, and K. Butts. Simulationbased approaches for verification of embedded control systems: an overview of traditional and advanced modeling, testing, and verification techniques. IEEE Control Systems, 36(6):45–64, 2016. [11] H. K. Khalil. Nonlinear systems. Pearson, third edition, 2001. [12] A. A. Kurzhanskiy and P. Varaiya. Ellipsoidal techniques for reachability analysis of discrete-time linear systems. IEEE Transactions on Automatic Control, 52(1):26–38, 2007. [13] I. Mitchell and C. J. Tomlin. Level set methods for computation in hybrid systems. In Hybrid Systems: Computation and Control, pages 310–323. Springer, 2000. [14] N. Ramdani, N. Meslem, and Y. Candau. A hybrid bounding method for computing an over-approximation for the reachable set of uncertain nonlinear systems. IEEE Transactions on Automatic Control, 54(10):2352–2364, 2009. [15] W. T. Thomson. Introduction to space dynamics. Courier Corporation, 2012. [16] B. Xue, M. Fränzle, and P. N. Mosaad. Just scratching the surface: Partial exploration of initial values in reach-set computation. In 56th IEEE Conference on Decision and Control, pages 1769–1775, 2017. [17] L. Yang and N. Ozay. A note on some sufficient conditions for mixed monotone systems. Technical report, 2017.
3cs.SY
arXiv:1707.00973v2 [math.PR] 5 Jul 2017 Empirical optimal transport on countable metric spaces: Distributional limits and statistical applications Carla Tameling ∗ Max Sommerfeld ∗ † Axel Munk ∗ †‡ July 6, 2017 Abstract We derive distributional limits for empirical transport distances between probability measures supported on countable sets. Our approach is based on sensitivity analysis of optimal values of infinite dimensional mathematical programs and a delta method for non-linear derivatives. A careful calibration of the norm on the space of probability measures is needed in order to combine differentiability and weak convergence of the underlying empirical process. Based on this we provide a sufficient and necessary condition for the underlying distribution on the countable metric space for such a distributional limit to hold. We give an explicit form of the limiting distribution for ultra-metric spaces. Finally, we apply our findings to optimal transport based inference in large scale problems. An application to nanoscale microscopy is given. MSC subject classification Primary 60F05, 60B12, 62E20; Secondary 90C08, 90C31, 62G10 Keywords optimal transport, Wasserstein distance, empirical process, limit law, statistical testing 1 Introduction Optimal transport based distances between probability measures (see e.g., Rachev and Rüschendorf (1998) or Villani (2009) for a comprehensive treatment), e.g., the Wasserstein distance (Vasershtein, 1969), which is also known as Earth Movers distance (Rubner et al., 2000), Kantorovich-Rubinstein distance (Kantorovich and Rubinstein, 1958) or Mallows distance (Mallows, 1972), are of ∗ Institute for Mathematical Stochastics, University of Göttingen, Goldschmidtstraße 7, 37077 Göttingen † Felix Bernstein Institute for Mathematical Statistics in the Biosciences, University of Göttingen, Goldschmidtstraße 7, 37077 Göttingen ‡ Max Planck Institute for Biophysical Chemistry, Am Faßberg 11, 37077 Göttingen 1 fundamental interest in probability and statistics, with respect to both theory and practice. The p-th Wasserstein distance (WD) between two probability measures µ and ν on a Polish metric space (X , d) is given by  Wp (µ, ν) = 1/p d(x, y) dπ(x, y) Z p inf (1) X ×X for p ∈ [1, ∞), the infimum is taken over all probability measures π on the product space X × X with marginals µ and ν. The WD metrizes weak convergence of a sequence of probability measures on (X , d) together with convergence of its first p moments and has become a standard tool in probability, e.g., to study limit laws (e.g., Johnson and Samworth (2005); Rachev and Rüschendorf (1994); Shorack and Wellner (1986)), to derive bounds for Monte Carlo computation schemes such as MCMC (e.g., Eberle (2014); Rudolf and Schweizer (2015)), for point process approximations (Barbour and Brown, 1992; Schuhmacher, 2009) or bootstrap convergence (Bickel and Freedman, 1981). Besides of its theoretical importance, the WD is used in many applications as a measure to compare complex objects, e.g., in image retrieval (Rubner et al., 2000), deformation analysis (Panaretos and Zemel, 2016), meta genomics (Evans and Matsen, 2012), computer vision (Ni et al., 2009), goodness-of-fit tests (Munk and Czado, 1998; del Barrio et al., 2000), finance (Rachev et al., 2011) and machine learning (Rolet et al., 2016). In such applications the WD has to be estimated from a finite sample of the underlying measures. This raises the question how fast the empirical Wasserstein distance (EWD), i.e., P when either µ or ν (or both) Pm are estimated by the n 1 empirical measures µ̂n = n1 i=1 δXi (and ν̂m = m i=1 δYi ) approaches WD. Ajtai et al. (1984) investigated the rate of convergence of EWD for the uniform measure on the unit square, Talagrand (1992) and Talagrand (1994) extended this to higher dimensions. Horowitz and Karandikar (1994) provided non-asymptotic bounds for the average speed of convergence for the empirical 2-Wasserstein distance. There are several refinements of these results, e.g., Boissard and Gouic (2014) and Fournier and Guillin (2014). As a natural extension of such results, there is a long standing interest in distributional limits for EWD, in particular motivated from statistical applications. Most of this work is restricted to the univariate case X ⊂ R. Munk and Czado (1998) derived central limit theorems for a trimmed WD on the real line when µ 6= ν whereas del Barrio et al. (1999a,b) consider the empirical Wasserstein distance when µ belongs to a parametric family of distributions, e.g., for a Gaussian location scale family, for the assessment of goodness of fit. In a similar spirit del Barrio et al. (2005) provided asymptotics for a weighted version of the empirical 2-Wasserstein distance in one dimension and Freitag and Munk (2005) derive limit laws for semiparametric models, still restricted to the univariate case. There are also several results for dependent data in one dimension, e.g., Dede (2009), Dedecker and Merlevede (2015). For a recent survey we refer to Bobkov and Ledoux (2014) and Mason (2016) and references 2 therein. A major reason of the limitation to dimension D = 1 is that only for X ⊂ R (or more generally a totally ordered space) the coupling which solves (1) is known explicitly and can be expressed in terms of the quantile functions F −1 and G−1 of µ and ν, respectively, as π = (F −1 × G−1 )#L, where L is the Lebesgue measure on [0, 1] (see Mallows (1972)). All the above mentioned work relies essentially on this fact. For higher dimensions only in specific settings such a coupling can be computed explicitly and then can be used to derive limit laws (Rippl et al., 2016). Already for D = 2 Ajtai et al. (1984) indicate that the scaling rate for the limiting distribution of W1 (µ̂n , µ) when µ is the uniform measure on X = [0, 1]2 (if it exists) must be ofpcomplicated nature as it is bounded from above and below by a rate of order n log(n). Recently, del Barrio and Loubes (2017) gave distributional limits for the √ quadratic EWD in general dimension with a scaling rate n. This yields a (non-degenerate) normal limit in the case µ 6= ν, i.e., when the data generating measure is different from the measure to be compared with (extending Munk and Czado (1998) to D > 1). Their result centers the EWD with an expected EWD (whose value is typically unknown) instead of the true WD and requires µ and ν to have a positive Lebesgue density on the interior of their convex support. Their proof uses the uniqueness and stability of the optimal transportation potential (i.e., the minimizer of the dual transportation problem, see Villani (2003) for a definition and further results) and the Efron-Stein variance inequality. However, in the case µ = ν, their distributional limit degenerates to a point mass at 0, underlining the fundamental difficulty of this problem again. An alternative approach has been advocated recently in Sommerfeld and Munk (2016) who restrict to finite spaces X = {x1 , . . . , xN }. They derive limit laws for the EWD for µ = ν (and µ 6= ν), which requires a different scaling rate. In this paper we extend their work to measures r = (rx )x∈X that are supported on countable metric spaces (X , d), linking the asymptotic distribution of the EWD on the one hand to the issue of weak convergence of the underlying multinomial process associated with µ̂n with respect to a weighted `1 -norm X krk`1 (dp ) = dp (x, x0 ) |rx | + |rx0 | (2) x∈X and on the other hand to infinite dimensional sensitivity analysis. Here, x0 ∈ X is fixed, but arbitrary. Notably, we obtain a necessary and sufficient condition for such a limit law, which sheds some light on the limitation to approximate the WD between continuous measures for D ≥ 2 by discrete random variables. The outline of this paper is a follows. In Section 2 we give distributional limits for the EWD of measures that are supported on a countable metric space. In short, this limit can be characterized as the optimal value of an infinite dimensional linear program applied to a Gaussian process over the set of dual solutions. The main ingredients of the proof are the directional Hadamard differentiability of the Wasserstein distance on countable metric spaces and the delta method for non-linear derivatives. We want to emphasize that the delta method for non-linear derivatives is not a standard tool (see Shapiro (1991); 3 Römisch (2004)). Moreover, for the delta method to work here weak √ convergence in the weighted `1 -norm (2) of the underlying empirical process n(r̂n − r) is required as the directional Hadamard differentiability is proven w.r.t. this norm. We find that the well known summability condition X √ (3) dp (x, x0 ) rx < ∞ x∈X is necessary and sufficient for weak convergence. This condition is known to √ be necessary and sufficient for the discrete empirical process n(µ̂n − µ) to be Donsker according to the Borisov-Durst Theorem (see Dudley (2014)) and was originally introduced in a more general way by Jain (1977). Furthermore, we examine (3) in a more detailed way. We give examples and counterexamples for (3) and discuss whether the condition holds in case of an approximation of continuous measures. Further, we examine under which assumptions it follows that (3) holds for all p0 ≤ p if it is fulfilled for p, and put it in relation to its one-dimensional counterpart, see del Barrio et al. (1999b). In Section 3 we specify the case where the metric structure on the ground space is given by a rooted tree with weighted edges. In this case we can provide a simplified limiting distribution and use its explicit formula to derive a distributional upper bound for general metric spaces. In Section 4 we combine this with a well known lower bound (Pele and Werman, 2009) to derive a computationally efficient strategy to test for the equality of two measures r and s on a countable metric space. Furthermore, we derive an explicit formula of the upper bound from Section 3 in the case of X being a regular grid. An application of our results to data from single marker switching microscopy imaging is given in Section 5. As the number of pixels typically is of magnitude 105 - 106 this challenges the assumptions of a finite space underlying the limit law in Sommerfeld and Munk (2016) and our work provides the theoretical justification to perform EWD based inference in such a case. Finally, we stress that our results can be extended to many other situations, e.g., the comparison of k samples and when the underlying data are dependent, as soon as a weak limit of the underlying empirical process w.r.t. the weighted `1 -norm (2) can be shown. 2 2.1 Distributional Limits Wasserstein distance on countable metric spaces To be more specific, let X = {x1 , x2 , . . .} be a countable metric space equipped with a metric d : X × X → R+ . The probability measures on X are infinite dimensional vectors r in ( ) X P(X ) = r = (rx )x∈X : rx ≥ 0 ∀x ∈ X and rx = 1 . x∈X 4 The p-th Wasserstein distance (p ≥ 1) then becomes Wp (r, s) =   inf w∈Π(r,s) X dp (x, x0 )wx,x0 1/p  , (4)  x,x0 ∈X where n X Π(r, s) = w ∈ P(X × X ) : wx,x0 = rx x0 ∈X and X wx,x0 = sx0 ∀x, x0 ∈ X o x∈X is the set of all couplings between r and s. Furthermore, let ( ) X p Pp (X ) = r ∈ P(X ) : d (x, x0 )rx < ∞ x∈X be the set of probability measures on the countable metric space X with finite p-th moment w.r.t. d. Here, x0 ∈ X is arbitrary and we want to mention that the space is independent of the choice of x0 . The weighted `1 -norm (2) can be extended in the following way to Pp (X × X ) kwk`1 (dp ) = X dp (x0 , x) |wx,x0 | + |wx0 ,x0 | x,x0 ∈X X + dp (x0 , x0 ) |wx,x0 | + |wx,x0 | . x,x0 ∈X 2.2 Main Results Before we can state the main results we need a few definitions. Define the empirical measure generated by i.i.d. random variables X1 , . . . , Xn from the measure r as n r̂n = (r̂n,x )x∈X , where r̂n,x = 1X 1{Xk =x} , n (5) k=1 i.i.d. and ŝm defined in the same way by Y1 , . . . , Ym ∼ s. In the following we will D denote weak convergence by −→ and furthermore, let   `∞ (X ) = (ax )x∈X ∈ RX : sup |ax | < ∞ x∈X and ( `1 (X ) = ) (ax )x∈X ∈ RX : X x∈X 5 |ax | < ∞ . Finally, we also require a weighted version of the `∞ -norm to characterize the set of dual solutions: ! kak`∞ (1/dp ) = max |ax0 | , sup d−p (x, x0 )ax , x6=x0 ∈X for p ≥ 1. The space `∞ d−p (X ) contains all elements which have a finite k · k`∞ (1/dp ) -norm. For r, s ∈ Pp (X ) we define the following convex sets n ∞ p S ∗ (r, s) = (λ, µ) ∈ `∞ d−p (X ) × `d−p (X ) : hr, λi + hs, µi = Wp (r, s) o (6) λx + µx0 ≤ dp (x, x0 ) ∀x, x0 ∈ X and n o p 0 0 S ∗ = λ ∈ `∞ d−p (X ) : λx − λx0 ≤ d (x, x ) ∀x, x ∈ X . (7) For our limiting distributions we define the following (multinomial) covariance structure ( rx (1 − rx ) if x = x0 , Σ(r) = (8) −rx rx0 if x 6= x0 . Theorem 2.1. Let (X , d) be a countable metric space and r, s ∈ Pp (X ), p ≥ 1, and r̂n be generated by i.i.d. samples X1 , ..., Xn ∼ r. Furthermore, let G ∼ N (0, Σ(r)) be a Gaussian process with Σ as defined in (8). Assume (3) for some x0 ∈ X . Then a) n 1 2p D 1  max∗ hG, λi Wp (r̂n , r) −→ p λ∈S , as n → ∞. (9) b) In the case where r 6= s it holds for n → ∞ 1 D n 2 (Wp (r̂n , s) − Wp (r, s)) −→ 1 1−p W (r, s) p p   max hG, λi . (10) (λ,µ)∈S ∗ (r,s) Remark 2.2. a) Note, that in the case r 6= s in the one sample case (10) the objective function is independent of the second component µ of the feasible set S ∗ (r, s). This is due to the fact that the second measure s is deterministic in this case. b) We will comment on condition (3), known from the Borisov-Durst Theorem (see Dudley (2014), Thm. 7.9), in Section 2.3. 6 c) Observe, that the limit in (10) is normally distributed if the set S ∗ (r, s) is a singleton. In the case of finite X conditions for S ∗ (r, s) to be a singleton are known (Hung et al., 1986; Klee and Witzgall, 1968). d) Parallel to our work del Barrio and Loubes (2017) showed asymptotic normality of EWD in general dimensions for the case r 6= s. Their results require the measures to have moments of order 4 + δ for some δ > 0 and positive density on their convex support. Their proof relies on a Stein-identity. e) We emphasize that our distributional limit also holds for p ∈ (0, 1) even if Wp is no longer a distance in this case. f ) The limiting distribution in the case r = s can also be written as  1 p = Wp (G+ , G− ), max∗ hG, λi λ∈S where G+ and G− are the (pathwise) Jordan-decomposition of the Gaussian process G, such that G = G+ − G− . For more details see Appendix A.2. For statistical applications it is also interesting to consider the two sample case, extensions to k-samples, k ≥ 2 being obvious then. Theorem 2.3. Under the same assumptions as in Thm. 2.1 and with ŝm iid generated by Y1 , . . . , Ym ∼ s, independently of X1 , . . . , Xn and H ∼ N (0, Σ(s)), which is independent of G, and the extra assumption that s also fulfils (3) the following holds. a) Let ρn,m = (nm/(n + m))1/2 . If r = s and min(n, m) → ∞ such that m/(n + m) → α ∈ [0, 1] we have D ρ1/p → n,m Wp (r̂n , ŝm ) −  1 p max∗ hG, λi . λ∈S (11) b) For r 6= s and n, m → ∞ such that min(n, m) → ∞ and m/(n + m) → α ∈ [0, 1] we have D ρn,m (Wp (r̂n , ŝm ) − Wp (r, s)) −→   √ √ 1 1−p Wp (r, s) max∗ αhG, λi + 1 − α hH, µi . p (λ,µ)∈S (r,s) (12) Note, that we obtain different scaling rates under equality of measures r = s (null-hypothesis) and the case r 6= s (alternative), which has important statis√ tical consequences. For r 6= s we are in the regime of the standard C.L.T. n, 1 but for r = s we get the rate n 2p , which is strictly slower for p > 1. According to Bobkov and Ledoux (2014) Thm. 7.11 in the one dimensional case this rate is optimal since the support of a probability measure on a countable metric space is not connected. 7 Remark 2.4. In the case of dependent data the results from Thm. 2.1 and 2.3 can also be applied, if one shows the weak convergence of the empirical process w.r.t. the k · k`1 (dp ) -norm. All other steps of the proof remain unchanged. The rest of this subsection is devoted to the proofs of Theorem 2.1 and Theorem 2.3. Proof of Thm. 2.1 and Thm. 2.3. To prove these two theorems we use the delta method A.2. Therefore, we need to verify (1.) √ directional Hadamard differentiability of Wp (·, ·) and (2.) weak convergence of n(r̂n − r). We mention that the delta method required here is not standard as the directional Hadamard derivative is not linear (see Römisch (2004), Shapiro (1991) or Dümbgen (1993)). 1. In Appendix A.1, Theorem A.3 directional Hadamard differentiability of Wp is shown with respect to the k · k`1 (dp ) -norm (2). 2. The weak convergence of the empirical process w.r.t. the k · k`1 (dp ) -norm is addressed in the following lemma. Lemma 2.5. Let X1 , . . . , Xn ∼ r be i.i.d. taking values in a countable metric space (X , d) and let r̂n be the empirical measure as defined in (5). Then √ D n(r̂n − r) −→ G with respect to the k · k`1 (dp ) -norm, where G is a Gaussian process with mean 0 and covariance structure ( rx (1 − rx ) if x = x0 , Σ(r) = −rx rx0 if x = 6 x0 , as given in (8) if and only if condition (3) is fulfilled. Proof of Lemma. The weighted √ `1 -space `1dp is according to Prop. 3, Maurey (1973) of cotype 2, hence n(r̂n − r) converges weakly w.r.t. the `1 (dp )-norm by Corollary 1 in Jain (1977) if and only if the summability condition (3) is fulfilled. Theorem 2.1 a) is now a straight forward application of the delta method A.2 and the continuous mapping theorem for f (x) = x1/p . For Theorem 2.1 b) we use again the delta method, but this time in combination with the chain rule for directional Hadamard differentiability (Prop. 3.6 (i), Shapiro (1990)). 8 The proof of Theorem 2.3 works analogously. Note, that under the assumptions of the theorem it holds (r = s) ρn,m ((r̂n , ŝm ) − (r, s)) r r  m √ n √ = n(r̂n − r), m(ŝm − s) n+m n+m √ √ D −→ ( αG, 1 − αG0 ) (13) D with G0 = G. 2.3 Examination of the summability condition (3) According to Lemma 2.5 condition (3) is necessary and sufficient for the weak convergence with respect to the k · k`1 (dp ) -norm (2). As this condition is crucial for our main theorem and we are not aware of a comprehensive discussion, we will provide such in this section. The following question arises. ”If the condition holds for p does it then also hold for all p0 ≤ p?” This is not true in general, but it is true if X has no accumulation point (i.e., is discrete in the topological sense). Lemma 2.6. Let X be a space without an accumulation point. If condition (3) holds for p, then it also holds for all p0 ≤ p. Proof. Let X be a space without an accumulation point, i.e., there exists  > 0 such that d(x, x0 ) >  for all x 6= x0 ∈ X . Then, X X  d(x0 , x) p √ √ p p d (x0 , x) rx =  rx  x∈X x∈X 0 X  d(x0 , x) p √ p ≥ rx  x∈X 0 X 0 √ = p/p dp (x0 , x) rx . x∈X Exponential families As we will see, condition (3) is fulfilled for many well known distributions including the Poisson distribution, geometric distribution or negative binomial distribution with the euclidean distance as the ground measure d on X = N. Theorem 2.7. Let (Pη )η be an s-dimensional standard exponential family (SEF) (see Lehmann and Casella (1998), Sec. 1.5) of the form ! s X η i rx = hx exp ηi Tx − A(η) . (14) i=1 The summability condition (3) is fulfilled if (Pη )η satisfies 9 1.) hx ≥ 1 for all x ∈ X , 2.) the natural parameter space N is closed with respect to multiplication with P P η/2 1 η < ∞, x∈X rx < ∞ ⇒ x∈X rx 2 , i.e., P 3.) the p-th moment w.r.t. the metric d on X exists, i.e., x∈X dp (x, x0 )rx < ∞ for some arbitrary, but fixed x0 ∈ X . Proof. For the SEF in (14) condition (3) reads v ! u s X X u p t i ηi Tx − A(η) hx d (x0 , x) exp i=1 x∈X =p 1 X λ(η) x∈X p d (x0 , x) exp 1 2 s X ! p ηi Txi hx (15) i=1 λ( 1 η) X p d (x0 , x) exp ≤ p2 λ(η) x∈X 1 2 s X ! ηi Txi hx < ∞, i=1 where λ(η) denotes the Laplace transform. The first inequality is due to the fact that hx ≥ 1 for all x ∈ X and the second is a result of the facts that the natural parameter space is closed with respect to multiplication with 12 and that the p-th moment w.r.t. d exist. The following examples show, that all three conditions in Theorem 2.7 are necessary.  Example 2.8. Let X be the countable metric space X = k1 k∈N and let r be the measure with probability mass function r1/k = 1 1 ζ(η) k η with respect to the counting measure. Here, ζ(η) denotes the Riemann zeta function. This is an SEF with natural parameter η, natural statistic − log(k) and natural parameter space N = (1, ∞). We choose the euclidean distance as the distance d on our space X and set x0 = 1. It holds ∞ X 1− k=1 1 k p ∞ X 1 1 1 1 ≤ =1<∞ ζ(η) k η ζ(η) k η ∀η ∈ N k=1 and hence all moments exist for all η in the natural parameter space. Furthermore, h1/k ≡ 1. However, the natural parameter space is not closed with respect to multiplication with 12 and therefore, ∞ X k=1 1− 1 p k ∞ 1 1 1 X 1 1 p ≥ =∞ η/2 ζ(η) k η/2 2p k ζ(η) k=2 i.e., condition (3) is not fulfilled. 10 ∀η ∈ (1, 2], The next example shows, that we cannot omit condition 1.) in Thm. 2.7. p Example 2.9. Consider X = N with the metric d(k, l) = |k! − l!|. The family of Poisson distributions constitute an SEF with natural parameter space N = (−∞, ∞) which satisfies condition 2.) in Thm. 2.7, i.e., closed with respect to multiplication with 21 . The first moment with respect to this metric exists and hk < 1 for all k ≥ 2. Condition (3) for p = 1 with x0 = 0 reads r ∞ √ ∞ X X ηk k! exp(−η) = η k/2 exp(−η/2) = ∞ k! k=1 k=1 for all η > 1, i.e., the summability condition (3) is not fulfilled. If the p-th √ moment does not exist, it is clear that condition (3) cannot be fulfilled as x ≥ x for x ∈ [0, 1]. 2.4 Approximation of continuous distributions In this section we investigate to what extend we can approximate continuous measure by its discretization such that condition (3) remains valid. Let X =  k be a discretization of R and X a real-valued random variable with M k∈Z c.d.f. F which is continuous and has a Lebesgue density f . We take d to be the euclidean distance and x0 = 0. For k ∈ Z we define     k+1 k rk := F −F . (16) M M Now, (3) can be estimated as follows. s     ∞ p X k+1 k k −F F M M M k=−∞ s Z ∞ p k+1/M X 1 k √ M = f (x)dx M M k/M k=−∞ Z k+1/M p ∞ p X k √ M f (x)dx ≥ M k/M k=−∞ Z k+1/M ∞ X p √ 1 p ≥ M |x| f (x)dx 2p k/M k=−∞ p √ 1 Z p = M p |x| f (x)dx, 2 R where the first inequality is due to Jensen’s inequality. As the r.h.s. tends to √ infinity with rate M as M → ∞, condition (3) does not hold in the limit. Consequently, we are not able to derive distributional limits for continuous measures from our results. 11 The one-dimensional case D = 1 For the rest of this Section we consider X = R and want to put condition (3) in relation to the condition (del Barrio et al., 1999b) Z ∞p F (t)(1 − F (t))dt < ∞, (17) −∞ where F (t) denotes the cumulative distribution function, which is sufficient and necessary for the empirical 1-Wasserstein distance on R to satisfy a limit law (see also Corollary 1 in Jain (1977) in a more general context). Condition (3) is stronger than (17) as the following shows. Let X be a countable subset of R and index the elements xi for i ∈ Z such that they are ordered. Furthermore, let d(x, y) = |x − y| be the euclidean distance on X . For any measure r with cumulative distribution function F on X it holds Z ∞p F (t)(1 − F (t))dt −∞ sX sX X = d(xk , xk+1 ) rj rj ≤ k∈Z j≤k ∞ X sX d(xk , xk+1 ) ∞ X d(xk , xk+1 ) k=0 = ∞ X rj + j>k k=0 ≤ j>k X√ −1 X d(xk , xk+1 ) k=−∞ rj + j>k −1 X sX rj j≤k d(xk , xk+1 ) k=−∞ X√ rj j≤k −1 X √ √ d(x0 , xk ) rk . d(x0 , xk ) rk + k=−∞ k=0 Hence, if condition (3) holds, (17) is also fulfilled. However, the conditions are not equivalent as the following example shows. Example 2.10. Let X = N and d(x, y) = |x − y| the euclidean distance and 1 1 r a power-law, i.e., rn = ζ(s) ns , where ζ(s) is the Riemanm zeta function. In this case (17) reads v Z ∞p ∞ uX ∞ X u k 1 X 1 1 t F (t)(1 − F (t))dt = s s ζ(s) j j −∞ j=1 k=1 j=k+1 v ∞ uX ∞ ∞ r 1 Xu 1 1 X s t ≤ . ζ(s) js ζ(s) k s−1 k=1 j=k k=1 and this is finite for all s > 3. On the other hand, condition (3) reads as s ∞ ∞ X 1 1 1 X 1 p (k − 1) ≤ . ζ(s) k s k s/2−1 ζ(s) k=1 k=1 12 This is finite for all s > 4. Hence, condition (17) is fulfilled for s ∈ (3, 4], but not (3). For p = 2 in dimension D = 1 there is no such easy condition anymore in the case of continuous measures, see del Barrio et al. (2005). Already for the normal distribution one needs to subtract a term that tends sufficiently fast to infinity to get a distributional limit (which was originally proven by de Wet and Venter (1972)). Nevertheless, for a fixed discretization of the normal distribution via binning as in (16) condition (3) is fulfilled and Theorems 2.1 and 2.3 are valid. 3 3.1 Limiting Distribution for Tree Metrics Explicit limits In this subsection we give an explicit expression for the limiting distribution in (9) and (11) in the case r = s when the metric is generated by a weighted tree. This extends Thm. 5 in Sommerfeld and Munk (2016) for finite spaces to countable spaces X . In the following we recall their notation. Assume that the metric structure on the countable space X is given by a weighted tree, that is, an undirected connected graph T = (X , E) with vertices X and edges E ⊂ X × X that contains no cycles. We assume the edges to be weighted by a function w : E → R+ . Without imposing any further restriction on T , we assume it to be rooted at root(T ) ∈ X , say. Then, for x ∈ X and x 6= root(T ) we may define parent(x) ∈ X as the immediate neighbour of x in the unique path connecting x and root(T ). We set parent(root(T )) = root(T ). We also define children(x) as the set of vertices x0 ∈ X such that there exists a sequence x0 = x1 , . . . , xn = x ∈ X with parent(xj ) = xj+1 for j = 1, . . . , n − 1. Note that with this definition x ∈ children(x). Furthermore, observe that children(x) can consist of countably many elements, but the path joining x and x0 ∈ children(x) is still finite as explained below. For x, x0 ∈ X let e1 , . . . , en ∈ E be the unique path in T joining x and x0 , then the length of this path, 0 dT (x, x ) = n X w(ej ), j=1 defines a metric dT on X . This metric is well defined, since the unique path joining x and x0 is finite as we show in the following. Let A0 = {x ∈ X : x = root(T )} and Ak = {x ∈ X : parent(x) ∈ Ak−1 }Sfor k ∈ N. By the definition of the Ak , ∞ these sets are disjoint and it follows k=0 Ak = X . Now let x, x0 ∈ X , then there exist k1 and k2 such that x ∈ Ak1 and x0 ∈ Ak2 . Then, there is a sequence of k1 + k2 + 1 vertices connecting x and x0 . Hence, the unique path joining x and x0 has at most k1 + k2 edges. 13 Additionally, define X (ST u)x = ux0 x0 ∈children(x) and ) p1 ( ZT ,p (u) = X |(ST u)x |dT (x, parent(x))p (18) x∈X for u ∈ RX and we set w.l.o.g. x0 = root(T ). The main result of this section is the following. Theorem 3.1. Let r ∈ Pp (X ), defining a probability distribution on X that fulfils condition (3) and let the empirical measures r̂n and ŝm be generated by independent random variables X1 , . . . , Xn and Y1 , . . . Ym , respectively, all drawn from r = s. Then, with a Gaussian vector G ∼ N (0, Σ(r)) with Σ(r) as defined in (8) we have the following. a) (One sample) As n → ∞, D 1 n 2p Wp (r̂n , r) −→ ZT ,p (G) (19) b) (Two sample) If n ∧ m → ∞ and n/(n + m) → α ∈ [0, 1] we have  nm n+m 1  2p D Wp (r̂n , ŝm ) −→ ZT ,p (G). (20) A rigorous proof of Thm. 3.1 is given in Appendix A.3. The same result was derived in Sommerfeld and Munk (2016) for finite spaces. For X countable we require a different technique of proof. Simplifying the set of dual solutions in the same way, the second step of rewriting the target function with a summation and difference operator does not work in the case of measures with countable support, since the inner product of the operators applied to the parameters is no longer well defined. For this setting we need to introduce a new basis in `1dp (X ) and for each element µ ∈ `1dp (X ) a sequence which has only finitely many non-zeros that converges to µ in order to obtain an upper bound on the optimal value. Then, we define a feasible solution for which this upper bound is attained. 3.2 Distributional Bound for the Limiting Distribution In this section we use the explicit formula on the r.h.s. of (19) for the case of tree metrics to stochastically bound the limiting distribution. This is based on the following simple observation: Let T be a spanning tree of X and dT the tree metric generated by T and the weights (x, x0 ) 7→ d(x, x0 ) 14 as described in Section 3.1. Then for any x, x0 ∈ X we have d(x, x0 ) ≤ dT (x, x0 ). Let ST∗ denote the set defined in (7) with the metric dT instead of d. Then S ∗ ⊂ ST∗ and hence max∗ hv, λi ≤ max∗ hv, λi λ∈S λ∈ST X for all v ∈ R . It follows that max hv, λi ≤ ZT ,p (v) λ∈S ∗ (21) for all v ∈ RX and this proves the following main result of this subsection. Theorem 3.2. Let r, s ∈ Pp (X ), assume that r, s fulfil condition (3) and let r̂n , ŝm be generated by i.i.d. X1 , . . . , Xn ∼ r and Y1 , . . . , Ym ∼ s, respectively. Let further T be a spanning tree of X . Then, under the null hypothesis r = s we have, as n and m approach infinity such that n ∧ m → ∞ and n/(n + m) → α, that # " 1/2p nm Wp (r̂n , ŝm ) ≥ z ≤ P [ZT ,p (G) ≥ z] , (22) lim sup P n+m n,m→∞ where G ∼ N (0, Σ(r)) with Σ(r) as defined in (8). Remark 3.3. While the stochastic bound of the limiting distribution ZT ,p is very fast to compute as it is explicitly given, the Wasserstein distance Wp (r̂n , ŝm ) in (22) is a computational bottleneck. Classical general-purpose approaches, e.g., the simplex algorithm (Luenberger and Ye, 2008) for general linear programs or the auction algorithm for network flow problems (Bertsekas, 1992, 2009) were found to scale rather poorly to very large problems such as image retrieval (Rubner et al., 2000). Attempts to solve this problem include specialized algorithms (Gottschlich and Schuhmacher, 2014) and approaches leveraging additional geometric structure of the data (Ling and Okada, 2007; Schmitzer, 2016). However, many practical problems still fall outside the scope of these methods (Schrieber et al., 2017), prompting the development of numerous surrogate quantities which mimic properties of optimal transport distances and are amenable to efficient computation. Examples include Pele and Werman (2009); Shirdhonkar and Jacobs (2008); Bonneel et al. (2015) and the particularly successful entropically regularized transport distances (Cuturi, 2013; Solomon et al., 2015). In the next section we will discuss how to approximate the countable space X by a finite collection of points. Here, we want to mention that the distributional bound also holds on a finite collection of points. 4 Computational strategies for simulating the limit laws If we want to simulate the limiting distributions in Thm. 2.1 and 2.3 we need to restrict to a finite number N of points, i.e., we choose a subset I of X such 15 that #I = N . Let r ∈ Pp (X ) fulfilling (3) and G ∼ N (0, Σ(r)), we define GI = (GI )x = Gx 1{x∈I} . An upper bound for the difference between the exact limiting distribution and the limiting distribution on the finite set I in the one sample case for r = s is given as (see (21)) max hGI , λi − max∗ hG, λi ≤ max∗ hGI , λi − hG, λi λ∈S ∗ λ∈S λ∈S ≤ max∗ hGI − G, λi λ∈ST   = max max∗ hGI − G, λi, max∗ hG − GI , λi λ∈ST λ∈ST X I = |(ST (G − G))x |dT (x, parent(x))p x∈X = X |Gx | dT (x, root(T ))p . x∈I / For the last equality one needs to construct the tree as follows: Choose I such that x0 from condition (3) is an element of I and choose x0 to be the root of the tree and let all other elements of X be direct children of the root, i.e., children(x) = x for all x 6= root(T ) ∈ X . The upper bound can be made stochastically arbitrarily small as " # X X p E |Gx | dT (x, root(T ))p ≤ dT (x, root(T ))p rx (1 − rx ), (23) x∈I / x∈I / where we used Hölder’s inequality and the definition of Σ(r). As the root was chosen to be x0 , the sum above is finite as r fulfils condition (3) and becomes arbitrarily small for I large enough. Hence, (23) details that the speed of approximation by GI depends on the decay of r and suggests to choose I such that most of the mass of r is concentrated on it. However, the computation of maxλ∈S ∗ hGI , λi is a linear program with N 2 constraints and N variables and hence as difficult as the computation of the WD between two measures supported on I, i.e., on N points. This renders a naive Monte-Carlo approach to obtain quantiles computational infeasible for large N . In the following subsections we therefore discuss possibilities to make the computation of the limit more accessible. 4.1 Thresholded Wasserstein distance Following Pele and Werman (2009) we define for a thresholding parameter t ≥ 0 the thresholded metric dt (x, x0 ) = min {d(x, x0 ), t} . 16 (24) Then, dt is again a metric. Let Wpt (r, s) be the Wasserstein distance with respect to dt . Since dt (x, x0 ) ≤ d(x, x0 ) for all x, x0 ∈ X we have that Wpt (r, s) ≤ Wp (r, s) for all r, s ∈ P(X ) and all t ≥ 0. Theorem 4.1. The limiting distribution from Thm. 2.1 with the thresholed ground distance dt instead of d can be computed in O(N 2 log N ) time with O(N ) memory requirement, if each point in X has O(1) neighbours with distance smaller or equal to t. The limiting distribution can be calculated as the optimal value of the following network flow problem: X p min − dt (x, x0 )wx,x0 ×X w∈RX + subject to X wx̃,x − x,x0 ∈X X (25) wx,x0 = Gx , x0 ∈X ,x0 6=x x̃∈X ,x̃6=x where G = (Gx )x∈X is a Gaussian process with mean zero and covariance structure as defined in (8). Proof. If we take the thresholded distance as the ground distance similar as in Theorem 2.1 we obtain the limiting distribution as  1/p max∗ hG, λi , λ∈St  where now St∗ = λ ∈ RX : λx − λx0 ≤ dpt (x, x0 ) . The p-th power of the limiting distribution is again a finite dimensional linear program and since there is strong duality in this case, it is equivalent to solve (25). As the linear program (25) is a network flow problem, we can redirect all edges with length t through a virtual node without changing the optimal value. From the assumption that each point has O(1) neighbours with distance not equal to t, we can deduce that the number of edges (N 2 in the original problem) is reduced to O(N ). According to Pele and Werman (2009) the new linear program with the virtual node can be solved in O(N 2 log N ) time with O(N ) memory requirement. Remark 4.2. a) In contrast to the computation of the limiting distribution for the thresholded Wasserstein distance in Thm. 4.1, general purpose network flow algorithms such as the auction algorithm, Orlin’s algorithm or general purpose LP solvers are required for the computation of the limiting distribution with a generic ground distance (that is, not thresholded). These algorithms have at least cubic worst case complexity (Bertsekas, 1981; Orlin, 1993) and quadratic memory requirement and perform much worse than O(N 2 ) empirically (Gottschlich and Schuhmacher, 2014). b) The resulting network-flow problem can be tackled with existing efficient solvers (Bertsekas, 1992) or commercial solvers like CP LEX (https://www.ibm.com/jmen/marketplace/ibm-ilog-cplex) which exploit the network structure. 17 c) For the distributional bound (22) one can also use the thresholded Wasserstein distance Wpt instead of Wp to be computational more efficient. A large threshold t will result in a better approximation of the true Wasserstein distance, but will also require more computation time. 4.2 Regular Grids In this section we are going to derive an explicit formula for the distributional bound from Section 3.2, when X is a regular grid. In this case a spanning tree can be constructed from a dyadic partition. Let D be a positive integer, L a power of two and X the regular grid of LD points in the unit hypercube [0, 1]D . The general case is analogous, but it is cumbersome. For 0 ≤ l ≤ lmax with lmax = log2 L let Pl be the natural partition of X into 2Dl squares of each LD /2Dl points. Theorem 4.3. Under the assumptions described above, (22) reads ZT ,p (u) = (l max X )1/p Dp/2 2−p(l+1) X |SF u| . (26) F ∈Pl l=0 This expression can be evaluated efficiently and used with Theorem 3.2 to obtain a stochastic bound of the limiting distribution on regular grids. Proof. Define X 0 by adding to X all center-points of sets in Pl for 0 ≤ l < lmax . We identify center points of Plmax with the points in X . A tree with vertices X 0 can now be build using the inclusion relation of the sets {Pl }0≤l≤lmax as ancestry relation. More precisely, the leaves of the tree are the points of X and the parent of the center point of F ∈ Pl is the center point of the unique set in Pl−1 that contains F . If we use the Euclidean metric to define the distance between neighboring vertices we get √ −l D2 , dT (x, parent(x)) = 2 if x ∈ Pl . A measure r on X naturally extends to a measure on X 0 if we give zero mass to all inner vertices. We also denote this measure by r. Then, if x ∈ X 0 is the center point ofP the set F ∈ Pl for some 0 ≤ l ≤ lmax , we have that (ST r)x = SF r where SF r = x∈F rx . Inserting this two formulas into (22) yields (26). 5 Application: Single-Marker Switching Microscopy Single Marker Switching (SMS) Microscopy (Betzig et al., 2006; Rust et al., 2006; Egner et al., 2007; Heilemann et al., 2008; Fölling et al., 2008) is a living 18 cell fluorescence microscopy technique in which fluorescent markers which are tagged to a protein structure in the probe are stochastically switched from a nosignal giving (off) state into a signal-giving (on) state. A marker in the on state emits a bunch of photons some of which are detected on a detector before it is either switched off or bleached. From the photons registered on the detector, the position of the marker (and hence of the protein) can be determined. The final image is assembled from all observed individual positions recorded in a sequence of time intervals (frames) in a position histogram, typically a pixel grid. SMS microscopy is based on the principle that at any given time only a very small number of markers are in the on state. As the probability of switching from the off to the on state is small for each individual marker and they remain in the on state only for a very short time (1-100ms). This allows SMS microscopy to resolve features below the diffraction barrier that limits conventional far-field microscopy (see Hell (2007) for a survey) because with overwhelming probability at most one marker within a diffraction limited spot is in the on state (Aspelmeier et al., 2015). At the same time this requires quite long acquisition times (1min-1h) to guarantee sufficient sampling of the probe. As a consequence, if the probe moves during the acquisition, the final image will be blurred. Correcting for this drift and thus improving image quality is an area of active research (Geisler et al., 2012; Deschout et al., 2014; Hartmann et al., 2016). In order to investigate the validity of such a drift correction method we introduce a test of the Wasserstein distance between the image obtained from the first half of the recording time and the second half. This test is based on the distributional upper bound of the limiting distribution which was developed in Section 3.2 in combination with a lower bound of the Wasserstein distance (Pele and Werman, 2009). In fact, there is no standard method for problems of this kind and we argue that the (thresholded) Wasserstein distance is particular useful in such a situation as the specimen moves between the frames without loss of mass, hence the drift induces a transport structure between successive frames. In the following we compare the distribution from the first half of frames with the distribution from the second half scaled with the sample sizes (as in (20)). We reject the hypothesis that the distributions from the first and the second half are the same, if our test statistic is larger than the 1−α quantile of the distributional bound of the limiting distribution in (22). If we have statistical evidence that the tresholded Wasserstein distance is not zero, we can also conclude that there is a significant difference in the Wasserstein distance itself. Statistical Model It is common to assume the bursts of photons registered on the detector as independent realizations of a random variable with a density that is proportional to the density of markers in the probe (Aspelmeier et al., 2015). As it is expected that the probe drifts during the acquisition this density will vary over time. In particular, the positions registered at the beginning of the observation will follow a different distribution than those observed at the 19 1.0 Before Drift Correction 0.2 0.4 Fn(x) 0.6 0.8 ● 0.0 p−value = 0.001 3.0 3.5 4.0 4.5 5.0 x Figure 1: Left: Aggregated samples of the first (first row) and the last (second row) 50% of the observation time as heat maps of relative frequency without correction for the drift of the probe. Magnifications of a small area are shown to highlight the blurring of the picture. Right: Empirical distribution function of a sample from the upper bound (tree approximation) of the limiting distribution. The red dot (line) indicates the scaled thresholded Wasserstein distance for t = 6/256. end. Data and Results We consider an SMS image of a tubulin structure presented in Hartmann et al. (2016) to assess their drift correction method. This image is recorded in 40.000 single frames over a total recording time of 10 minutes (i.e., 15 ms per frame). We compare the aggregated sample collected during the first 50% (= ˆ 20.000 frames) of the total observation time with the aggregated sample obtained in the last 50% on a 256 × 256 grid for both the original uncorrected values and for the values where the drift correction of Hartmann et al. (2016) was applied. Heat maps of these four samples are shown in the left hand side of Figure 1 (no correction) and Figure 2 (corrected), respectively. The question we will address is: ”To what extend has the drift been properly removed by the drift correction?” In addition, from the application of the thresholded Wasserstein distance for different thresholds we expect to obtain detailed understanding for which scales the drift has been removed. As Hartmann et al. (2016) have corrected with a global drift function one might expect that on small spatial scales not all effects have been removed. We compute the thresholded Wasserstein distance W1t between the two pairs 20 0.0 0.2 0.4 Fn(x) 0.6 0.8 1.0 After Drift Correction p−value = 1 ● 3.0 3.5 4.0 4.5 5.0 x Figure 2: Left: Aggregated samples of the first (first row) and the last (second row) 50% of the observation time as heat maps of relative frequency with correction for the drift of the probe. Magnifications of a small area are shown to highlight the drift correction of the picture. Right: Empirical distribution function of a sample from the upper bound (tree approximation) of the limiting distribution. The red dot (line) indicates the scaled thresholded Wasserstein distance after drift correction for t = 6/256. The difference between the fist and the second 50% is no longer significant. 21 1.0 0.0 0.2 0.4 p−value 0.6 0.8 before correction after correction 2 4 6 8 10 12 14 t*256 Figure 3: P-values for the null hypothesis ’no difference’ for different thresholds t before and after the drift correction. The red line indicates the magnitude of the total dirft. of samples as described in Section 4.1 with different thresholds t ∈ {2, 3, . . . , 14}/256. We compare these values with a sample from the stochastic upper bound for the limiting distribution on regular grids obtained as described in Section 4.2. This allows us to obtain a test for the null hypothesis ’no difference’ based on Theorem 3.2. To visualize the outcomes of theses tests for different thresholds t we have plotted the corresponding p-values in Figure 3. The red line indicates the magnitude of the drift over the total recording time. As the magnitude is approximately 6/256, we plot in the right hand side of Figure 1 and Figure 2 the empirical distribution functions of the upper bound (22) and indicate the value of the test-statistic for t = 6/256 with a red dot without the drift correction and with the correction, respectively. As shown in Figure 3 the differences caused by the drift of the probe are recognized as highly statistically significant (p ≤ 0.05) for thresholds larger than t = 4/256. After the drift correction method is applied, the difference is no longer significant for thresholds smaller than t = 14/256. The estimated shift during the first and the second 50% of the observations is three pixels in x-direction and one pixel in y-direction. That shows that the significant difference that is detected when comparing the images without drift correction for t ∈ {5, 6, 7, 8, 9, 10}/256 is caused in fact by the drift. The fact that there is still a significant difference for large thresholds (t ≥ 14) in the corrected pictures 22 suggests further intrinsic and local inhomogeneous motion of the specimen or non-polynomial drift that is not captured by the drift model used in Hartmann et al. (2016) and bleaching effects of fluorescent markers. In summary, this example demonstrates that our strategy of combining a lower bound for the Wasserstein distance with a stochastic bound of the limiting distribution is capable of detecting subtle differences in a large N setting. Acknowledgments The authors gratefully acknowledge support by the DFG Research Training Group 2088 Project A1 and CRC 755 Project A6. References Ajtai, M., Komlós, J., and Tusnády, G. (1984). On optimal matchings. Combinatorica, 4(4):259–264. Aspelmeier, T., Egner, A., and Munk, A. (2015). Modern statistical challenges in high-resolution fluorescence microscopy. Annu. Rev. Stat. Its Appl., 2(1):163–202. Barbour, A. D. and Brown, T. C. (1992). Stein’s method and point process approximation. Stochastic Process. Appl., 43(1):9–31. Bertsekas, D. P. (1981). A new algorithm for the assignment problem. Mathematical Programming, 21(1):152–171. Bertsekas, D. P. (1992). Auction algorithms for network flow problems: A tutorial introduction. Comput. Optim. Appl., 1(1):7–66. Bertsekas, D. P. (2009). Auction algorithms. In Encyclopedia of Optimization, pages 128–132. Springer. Betzig, E., Patterson, G. H., Sougrat, R., Lindwasser, O. W., Olenych, S., Bonifacino, J. S., Davidson, M. W., Lippincott-Schwartz, J., and Hess, H. F. (2006). Imaging intracellular fluorescent proteins at nanometer resolution. Science, 313(5793):1642–1645. Bickel, P. J. and Freedman, D. A. (1981). Some asymptotic theory for the bootstrap. Ann. Statist., 9(6):1196–1217. Bobkov, S. and Ledoux, M. (2014). One-dimensional empirical measures, order statistics and Kantorovich transport distances. Preprint. Boissard, E. and Gouic, T. L. (2014). On the mean speed of convergence of empirical and occupation measures in Wasserstein distance. Ann. Inst. H. Poincaré Probab. Statist., 50(2):539–563. 23 Bonnans, J. F. and Shapiro, A. (2000). Perturbation Aanalysis of Optimization Problems. Springer. Bonneel, N., Rabin, J., Peyré, G., and Pfister, H. (2015). Sliced and Radon Wasserstein barycenters of measures. J. Math. Imaging Vis., 51(1):22–45. Cuturi, M. (2013). Sinkhorn distances: Lightspeed computation of optimal transport. In Advances in Neural Information Processing Systems, pages 2292–2300. de Wet, T. and Venter, J. H. (1972). Asymptotic distributions of certain test criteria of normality. South African Statist. J., 6(2):135–149. Dede, S. (2009). An empirical central limit theorem in l1 for stationary sequences. Preprint. https://arxiv.org/abs/0812.2839. Dedecker, J. and Merlevede, F. (2015). Behavior of the Wasserstein distance between the empirical and the marginal distributions of stationary α-dependent sequences. Preprint. https://arxiv.org/abs/1503.00113. del Barrio, E., Cuesta-Albertos, J. A., Matrán, C., and Rodrı́guez-Rodrı́guez, J. M. (1999a). Tests of goodness of fit based on the L2-Wasserstein distance. Ann. Statist., 27(4):1230–1239. del Barrio, E., Cuesta-Albertos, J. A., and Matrán, C. (2000). Contributions of empirical and quantile processes to the asymptotic theory of goodness-of-fit tests. Test, 9(1):1–96. del Barrio, E., Giné, E., and Utzet, F. (2005). Asymptotics for l2 functionals of the empirical quantile process, with applications to tests of fit based on weighted Wasserstein distances. Bernoulli, 11(1):131–189. del Barrio, E., Giné, E., and Matrán, C. (1999b). Central limit theorems for the Wasserstein distance between the empirical and the true mesaure. Ann. Probab., 27(2):1009–1071. del Barrio, E. and Loubes, J.-M. (2017). Central Limit Theorems for empirical transportation cost in general dimension. Preprint. https://arxiv.org/abs/1705.01299v1. Deschout, H., Zanacchi, F. C., Mlodzianoski, M., Diaspro, A., Bewersdorf, J., Hess, S. T., and Braeckmans, K. (2014). Precisely and accurately localizing single emitters in fluorescence microscopy. Nat. Methods, 11(3):253–266. Dudley, R. M. (2014). Uniform Central Limit Theorems. Cambridge University Press. Dümbgen, L. (1993). On nondifferentiable functions and the bootstrap. Probab. Theory Relat. Fields, 95(1):125–140. 24 Eberle, A. (2014). Error bounds for Metropolis–Hastings algorithms applied to perturbations of Gaussian measures in high dimensions. The Annals of Applied Probability, 24(1):337–377. Egner, A., Geisler, C., von Middendorff, C., Bock, H., Wenzel, D., Medda, R., Andresen, M., Stiel, A. C., Jakobs, S., Eggeling, C., Schönle, A., and Hell, S. W. (2007). Fluorescence nanoscopy in whole cells by asynchronous localization of photoswitching emitters. Biophysical Journal, 93(9):3285–3290. Evans, S. N. and Matsen, F. A. (2012). The phylogenetic Kantorovich–Rubinstein metric for environmental sequence samples. J. R. Stat. Soc. Ser. B Stat. Methodol., 74(3):569–592. Fölling, J., Bossi, M., Bock, H., Medda, R., Wurm, C. A., Hein, B., Jakobs, S., Eggeling, C., and Hell, S. W. (2008). Fluorescence nanoscopy by ground-state depletion and single-molecule return. Nat. Meth., 5(11):943–945. Fournier, N. and Guillin, A. (2014). On the rate of convergence in Wasserstein distance of the empirical measure. Probab. Theory Relat. Fields, pages 1–32. Freitag, G. and Munk, A. (2005). On Hadamard differentiability in k-sample semiparametric models—with applications to the assessment of structural relationships. J. Multivariate Anal., 94(1):123–158. Geisler, C., Hotz, T., Schönle, A., Hell, S. W., Munk, A., and Egner, A. (2012). Drift estimation for single marker switching based imaging schemes. Opt. Express, 20(7):7274–7289. Gottschlich, C. and Schuhmacher, D. (2014). The Shortlist method for fast computation of the earth mover’s distance and finding optimal solutions to transportation problems. PLoS ONE, 9(10):e110214. Hartmann, A., Huckemann, S., Dannemann, J., Laitenberger, O., Geisler, C., Egner, A., and Munk, A. (2016). Drift estimation in sparse sequential dynamic imaging: with application to nanoscale fluorescence microscopy. J. R. Stat. Soc. Ser. B Stat. Methodol., 78(3):563–587. Heilemann, M., van de Linde, S., Schüttpelz, M., Kasper, R., Seefeldt, B., Mukherjee, A., Tinnefeld, P., and Sauer, M. (2008). Subdiffraction-resolution fluorescence imaging with conventional fluorescent probes. Angew. Chem. Int. Ed. Engl., 47(33):6172–6176. Hell, S. W. (2007). Far-field optical nanoscopy. Science, 316(5828):1153–1158. Horowitz, J. and Karandikar, R. L. (1994). Mean rates of convergence of empirical measures in the Wasserstein metric. J. Comput. Appl. Math., 55(3):261– 273. Hung, M. S., Rom, W. O., and Waren, A. D. (1986). Degeneracy in transportation problems. Discrete Appl. Math., 13(2-3):223–237. 25 Jain, N. C. (1977). Central limit theorem and related questions in Banach space. In Probability (Proc. Sympos. Pure Math., Vol. XXXI, Univ. Illinois, Urbana, Ill., 1976), volume 31, pages 55–65. Amer. Math. Soc., Providence, R.I. Johnson, O. and Samworth, R. (2005). Central limit theorem and convergence to stable laws in Mallows distance. Bernoulli, 11(5):829–845. Kantorovich, L. V. and Rubinstein, G. S. (1958). On a space of completely additive functions. Vestn. Leningr. Univ, 13(7):52–59. Klee, V. and Witzgall, C. (1968). Facets and vertices of transportation polytopes. In Mathematics of the Decision Sciences, Part I (Seminar, Stanford, Calif., 1967), pages 257–282. Amer. Math. Soc., Providence, R.I. Lehmann, E. and Casella, G. (1998). Theory of Point Estimation. Springer. Ling, H. and Okada, K. (2007). An efficient earth mover’s distance algorithm for robust histogram comparison. IEEE Trans. Pattern Anal. Mach. Intell., 29(5):840–853. Luenberger, D. G. and Ye, Y. (2008). Linear and Nonlinear Programming. Springer. Mallows, C. L. (1972). A note on asymptotic joint normality. Ann. Math. Statist., 43(2):508–515. Mason, D. M. (2016). A weighted approximation approach to the study of the empirical wasserstein distance. In High Dimensional Probability VII, pages 137–154. Birkhäuser, Cham. Maurey, B. (1972–1973). Espaces de cotype p, 0 < p ≤ 2. In Séminaire MaureySchwartz (année 1972–1973), Espaces Lp et applications radonifiantes, Exp. No. 7, pages 1–11. Centre de Math., École Polytech., Paris. Munk, A. and Czado, C. (1998). Nonparametric validation of similar distributions and assessment of goodness of fit. J. R. Stat. Soc. Ser. B Stat. Methodol., 60(1):223–241. Ni, K., Bresson, X., Chan, T., and Esedoglu, S. (2009). Local histogram based segmentation using the Wasserstein distance. Int. J. Comput. Vis., 84(1):97– 111. Orlin, J. B. (1993). A faster strongly polynomial minimum cost flow algorithm. Oper. Res., 41(2):338–350. Panaretos, V. M. and Zemel, Y. (2016). Amplitude and phase variation of point processes. Ann. Statist., 44(2):771–812. Pele, O. and Werman, M. (2009). Fast and robust earth mover’s distances. In IEEE 12th International Conference on Computer Vision, pages 460–467. 26 Rachev, S. T. and Rüschendorf, L. (1994). On the rate of convergence in the CLT with respect to the Kantorovich metric. In Probability in Banach spaces, 9 (Sandjberg, 1993), volume 35 of Progr. Probab., pages 193–207. Birkhäuser Boston, Boston, MA. Rachev, S. T. and Rüschendorf, L. (1998). Mass Transportation Problems: Volume I: Theory. Springer. Rachev, S. T., Stoyanov, S. V., and Fabozzi, F. J. (2011). A Probability Metrics Approach to Financial Risk Measures. John Wiley & Sons. Rippl, T., Munk, A., and Sturm, A. (2016). Limit laws of the empirical Wasserstein distance: Gaussian distributions. J. Multivariate Anal., 151:90–109. Rolet, A., Cuturi, M., and Peyré, G. (2016). Fast dictionary learning with a smoothed Wasserstein loss. In Gretton, A. and Robert, C. C., editors, Proceedings of the 19th International Conference on Artificial Intelligence and Statistics, volume 51 of Proceedings of Machine Learning Research, pages 630–638, Cadiz, Spain. PMLR. Römisch, W. (2004). Delta method, infinite dimensional. In Encyclopedia of Statistical Sciences. John Wiley & Sons, Inc. Rubner, Y., Tomasi, C., and Guibas, L. J. (2000). The earth mover’s distance as a metric for image retrieval. Int. J. Comput. Vis., 40(2):99–121. Rudolf, D. and Schweizer, N. (2015). Perturbation theory for Markov chains via Wasserstein distance. Bernoulli. accepted. Rust, M. J., Bates, M., and Zhuang, X. (2006). Sub-diffraction-limit imaging by stochastic optical reconstruction microscopy (STORM). Nat. Meth., 3(10):793–796. Schmitzer, B. (2016). A sparse multiscale algorithm for dense optimal transport. J. Math. Imaging Vision, 56(2):238–259. Schrieber, J., Schuhmacher, D., and Gottschlich, C. (2017). DOTmark – a benchmark for discrete optimal transport. IEEE Access, 5:271–282. Schuhmacher, D. (2009). Stein’s method and Poisson process approximation for a class of Wasserstein metrics. Bernoulli, 15(2):550–568. Shapiro, A. (1990). On concepts of directional differentiability. J. Optim. Theory Appl., 66(3):477–487. Shapiro, A. (1991). Asymptotic analysis of stochastic programs. Ann. Oper. Res., 30(1):169–186. Shirdhonkar, S. and Jacobs, D. W. (2008). Approximate earth mover’s distance in linear time. In IEEE Conference on Computer Vision and Pattern Recognition, pages 1–8. 27 Shorack, G. R. and Wellner, J. A. (1986). Empirical processes with applications to statistics. Wiley series in probability and mathematical statistics. Wiley, New York. Solomon, J., De Goes, F., Peyré, G., Cuturi, M., Butscher, A., Nguyen, A., Du, T., and Guibas, L. (2015). Convolutional Wasserstein distances: Efficient optimal transportation on geometric domains. ACM Transactions on Graphics (TOG), 34(4):66. Sommerfeld, M. and Munk, A. (2016). Inference for empirical Wasserstein distances on finite spaces. J. R. Stat. Soc. Ser. B Stat. Methodol., to appear. Talagrand, M. (1992). Matching random samples in many dimensions. Ann. Appl. Probab., pages 846–856. Talagrand, M. (1994). The transportation cost from the uniform measure to the empirical measure in dimension≥ 3. Ann. Probab., pages 919–959. Vasershtein, L. N. (1969). Markov processes over denumerable products of spaces describing large system of automata. Problemy Peredači Informacii, 5(3):64–72. Villani, C. (2003). Topics in optimal transportation. Number 58. American Mathematical Soc. Villani, C. (2009). Optimal Tansport - Old and New. Springer. A A.1 Proofs Hadamard directional differentiability In this section we follow mainly Shapiro (1991) and Römisch (2004). Let U and Y be normed spaces. Definition A.1 (cf. Shapiro (1991), Römisch (2004)). A mapping f : Df ⊂ U → Y is said to be Hadamard directionally differentiable at u ∈ U if for any sequence hn that converges to h and any sequence tn & 0 such that u+tn hn ∈ Df for all n the limit f (u + tn hn ) − f (u) (27) fu0 (h) = lim n→∞ tn exist. Note that this derivative is not required to be linear in h, but it is still positively homogeneous. Moreover, the directional Hadamard derivative fu0 (·) is continuous if u is an interior point of Df (Römisch, 2004). An extension of this definition is the Hadamard directional differentiability tangentially to a set. Let K be a subset of U, f is directionally differentiable tangentially to K in the sense of Hadamard at x if the limit (27) exists for all 28 sequences hn that converge to h of the form hn = t−1 n (kn − u) where kn ∈ K and tn & 0. This derivative is defined on the contingent (Bouligand) cone to K at x n o TK (u) = h ∈ X : h = lim t−1 (k − u), k ∈ K, t & 0 . n n n n n→∞ The delta method for mappings that are directionally Hadamard differentiable tangentially to a set reads the following: Theorem A.2 (Römisch (2004), Theorem 1). Let K be a subset of U, f : K → Y a mapping and assume that the following two conditions are satisfied: i) The mapping f is Hadamard directionally differentiable at u ∈ K tagentially to K with derivative fu0 (·) : TK (u) → Y. D ii) For each n, Xn : Ωn → K are maps such that an (Xn −u) −→ X for some sequence an → +∞ and some random element X that takes values in TK (u). D Then we have an (f (Xn ) − f (u)) −→ fu0 (X). Hadamard directional differentiability of the Wasserstein distance on countable metric spaces For r, s ∈ Pp (X ) the p-th power of the p-th Wasserstein distance is the optimal value of an infinite dimensional linear program. We use this fact to verify that the p-th power of the Wasserstein distance (4) on countable metric spaces is directionally Hadamard differentiable with methods of sensitivity analysis of optimal values. The p-th power of the Wasserstein distance on countable metric spaces is the optimal value of the following infinite dimensional linear program X min dp (x, x0 )wx,x0 w∈RX ×X subject to x,x0 ∈X X wx,x0 = rx ∀x ∈ X , (28) x0 ∈X X w =s , x,x0 x0 0 ∀x ∈ X , x∈X wx,x0 ≥ 0, ∀x, x0 ∈ X . Theorem A.3. Wpp as a map from (RX , k · k`1 (dp ) ) to R, (r, s) 7→ Wpp (r, s) is Hadamard directionally differentiable and the directional derivative is given by (d1 , d2 ) 7→ −(hλ, d1 i + hµ, d2 i), sup (29) (λ,µ)∈S ∗ (r,s) where S ∗ (r, s) is set of optimal solutions of the dual problem which is defined in (6). Recall, that definition n ∞ p S ∗ (r, s) = (λ, µ) ∈ `∞ d−p (X ) × `d−p (X ) : hr, λi + hs, µi = Wp (r, s), o λx + µx0 ≤ dp (x, x0 ) ∀x, x0 ∈ X . 29 The set of dual solutions S ∗ is convex and the limiting distribution is again an infinite dimensional linear program. Hence, the maximum is attained at the boundary of S ∗ . Proof. We will use Theorem 4.24 from Bonnans and Shapiro (2000). Therefore, we need to check the following four assumptions. P 1. Problem (28) is convex, since the cost function x,x0 ∈X dp (x, x0 )wx,x0 is ×X ×X convex, the constraint set K = RX × {0} × {0}, where RX are the + + matrices that have only non-negative entries, is convex. It remains to show that the constraint function   w G(w, (r, s)) = wT 1 − r  , w1 − s is convex with respect to −K, i.e. ψ((w, (r, s)), (w̃, (r̃, s̃))) = IK (G((w, (r, s))) + (w̃, (r̃, s̃))) is convex. Let (w1 , r1 , s1 , w̃1 , r̃1 , s̃1 ) and (w2 , r2 , s2 , w̃2 , r̃2 , s̃2 ) be in RX ×X × RX × RX × RX ×X × RX × RX such that G(w1 , (r1 , s1 )) + (w̃1 , r̃1 , s̃1 ) and G(w2 , (r2 , s2 )) + (w̃2 , r̃2 , s̃2 ) are in K. This yields for i = 1, 2 that wi + w̃i ≥ 0, wiT 1 − ri + r̃i = 0, (30) wi 1 − si + s̃i = 0. And therefore the convex combination of G(w1 , (r1 , s1 ))+(w̃1 , r̃1 , s̃1 ) and G(w2 , (r2 , s2 )) + (w̃2 , r̃2 , s̃2 ) is also in K. 2. We want to show that the set of optimal solutions is non-empty. Since X is countable, the space is separable. If we take the discrete topology on X that is induced by the discrete metric ( 0 if x = y, D d (x, y) = 1 if x 6= y, our space is complete and hence, X is a Polish space. By Thm. 4.1 in Villani (2009) with a, b ≡ 0 the set of optimal solutions of (28) is nonempty for each right hand side of constraints (r, s). 3. Set for some direction (d1 , d2 ) ∈ RX × RX Ḡ(w, t) = (w, wT 1 − r + td1 , w1 − s + td2 , t). We are going to show that the following directional regularity condition in a direction (d1 , d2 ) ∈ RX × RX  0 ∈ int Ḡ(w0 , 0) + Dx Ḡ(w0 , 0)RX ×X × {0} − K × R , 30 holds for all optimal solutions w0 . For an optimal solution w0 it is Ḡ(w0 , 0) = (w0 , 0, 0, 0). Since Ḡ(w, t) is linear in w and bounded Dw Ḡ(w0 , 0)RX ×X × {0} = Ḡ(w, 0) and the directional regularity condition reads  0 ∈ int (w0 , 0, 0, 0) + (w, wT 1 − r, w1 − s, 0) − K × R . This is fulfilled because w ∈ RX ×X . 4. We aim to verify the stability of the optimal solution. Let (rk )k∈N be a sequence in Pp (X ) such that rk → r as k → ∞. X X X dp (x0 , x) |rx | ≤ dp (x0 , x) |rx − (rk )x | + dp (x0 , x) |(rk )x | x∈X x∈X x∈X ≤ kr − rk k`1 (dp ) + X p d (x0 , x) |(rk )x | < ∞, x∈X since all rk are elements of Pp (X ) and rk → r w.r.t. the k · k`1 (dp ) and hence, Pp (X ) together with the `1 (dp )-norm is complete. Let (rk )k∈N be a sequence that converges to r and (sk )k∈N a sequence that converges to s, let (wk )k∈N ∈ Π(rk , sk ), where Π(rk , sk ) is the set of all transport plans between rk and sk . 1. Step: Prove that (wk )k∈N has a convergent subsequence. S Let A1 ⊂ A2 ⊂ A3 · · · ⊆ X be such that X = n∈N An and |An | < ∞ ∀n ∈ N, this is possible since X is countable. Now write w1|A1 ×A1 w1|A2 ×A2 .. . w2|A1 ×A1 w2|A2 ×A2 .. . w3|A1 ×A1 w3|A2 ×A2 .. . w4|A1 ×A1 w4|A2 ×A2 .. . ··· ··· ··· ··· wk|Al ×Al ··· Since all wk ’s are probability measures, the k · k`1 (dp ) of each row is bounded and therefore, we are able to extract a convergent subsequence. We delete the columns that are not in this subsequence from the scheme. The remaining elements of the second row form again a bounded sequence and we can extract a convergent subsequence and proceed the same way with all other rows. In this manner, we obtain a subsequence of (wk ) (which, for notational convenience, we also denote by (wk )) such that wk|Al ×Al is convergent for any fixed l ∈ N. Now we want to prove that (wk ) is a Cauchy-sequence in Pp (X ) × Pp (X ). Since it holds for r ∈ Pp (X ) that krk`1 (dp ) is a convergent series and therefore we can choose l large enough such that kr|ACl k`1 (dp ) < . C (Al × Al )C = X × AC l ∪ Al × X 31 and hence kwk|(Al ×Al )C k`1 (dp ) ≤ kwk|X ×ACl k`1 (dp ) + kwk|ACl ×X k`1 (dp ) = krk|ACl k`1 (dp ) + ksk|ACl k`1 (dp ) < 2. For all m, k ≥ k0 it holds kwk − wm k`1 (dp )(X ×X ) = kwk − wm k`1 (dp )(Al ×Al ) + kwk − wm k`1 (dp )((Al ×Al )C ) k0 →∞ → 0. Hence there exists a convergent subsequence of (wk ) by the completeness of Pp (X ) with k · k`1 (dp ) , that will also be denoted by (wk ) such that wk → w as k → ∞. 2. Step: It remains to show that w is an optimal transport plan of r and s. For this, we need the definition of c-cyclical monotonicity. Definition A.4 (Cyclical Monotonicity, Def. 5.1 Villani (2009)). Let X and Y be arbitrary sets and c : X × Y → (−∞, +∞] be a function. A subset Γ ⊂ X × Y is said to be c-cyclically monotone if for any N ∈ N and any family (x1 , y1 ), · · · , (xN , yN ) of points in Γ holds the inequality N X c(xi , yi ) ≤ N X c(xi , yi+1 ), i=1 i=1 where yN +1 = y1 . A transport plan is said to be c-cyclically monotone if it is concentrated on a c-cyclically monotone set. We take again X with the discrete topology and a ≡ b ≡ 0. Since all wk are optimal and the optimal cost is finite, since we restricted ourselves to Pp (X ), they are by Thm. 5.10 (ii) in Villani (2009) dp -cyclically monotone. Therefore, wk⊗N = ⊗N i=1 wk is concentrated on n C(N ) = (x1 , y1 ), · · · ,(xN , yN ) ∈ (X × X )N | N X i=1 dp (xi , yi ) ≤ N X o dp (xi , yi+1 ) . i=1 For fixed N this set is closed since it is determined by a continuous function. This implies that w⊗N is also concentrated on C(N ) and hence w is dp cyclically monotone. It follows from Thm. 5.10 (ii) in Villani (2009) that w is optimal. Step 1 and step 2 give the stability of the optimal solution. 32 A.2 Rewriting the limiting distribution under equality of measures First, observe that for the case r = s the set of dual solutions S ∗ (7) can be rewritten in the following way: S ∗ = S ∗ (r, r) n ∞ = (λ, µ) ∈ `∞ d−p (X ) × `d−p (X ) : hr, λi + hr, µi = 0 o λx + µx0 ≤ dp (x, x0 ) ∀x, x0 ∈ X n ∞ = (λ, µ) ∈ `∞ d−p (X ) × `d−p (X ) : λ = −µ o λx + µx0 ≤ dp (x, x0 ) ∀x, x0 ∈ X . We decompose the Gaussian process G with mean zero and covariance structure as defined in (8) into G = G+ − G− with G+ , G− non-negative, then the limiting distribution in (9) can be rewritten as follows: max hG, λi = max∗ hG+ , λi − hG− , λi λ∈S ∗ λ∈S = max hG+ , λi + hG− , µi (λ,µ) s.t. λx + µx0 ≤ dp (x, x0 ) ∀x, x0 ∈ X , for the second equality we used that λ = −µ. The maximization problem in the last line is the dual of the p-th power of th p-Wasserstein distance between G+ and G− and as Kantrovich duality holds this equals Wpp (G+ , G− ). A.3 Proof of Theorem 3.1 Simplify the set of dual solutions S ∗ As a first step, we rewrite the set of dual solutions S ∗ given in definition (7) in our tree notation as 0 p S ∗ = {λ ∈ `∞ d−p (X ) : λx − λx0 ≤ dT (x, x ) , x, x0 ∈ X } . (31) 0 p The key observation is that in the condition λx −λx0 ≤ dT (x, x ) we do not need to consider all pairs of vertices x, x0 ∈ X , but only those which are joined by an edge. To see this, assume that only the latter condition holds. Let x, x0 ∈ X arbitrary and x = x1 , . . . , xn = x0 the sequence of vertices defining the unique path joining x and x0 , such that (xj , xj+1 ) ∈ E for j = 1, . . . , n − 1. That this path contains only a finite number of edges, was proven in Section 3. Then λx − λ x0 = n−1 X j=1 (λxj − λxj+1 ) ≤ n−1 X dT (xj , xj+1 )p ≤ dT (x, x0 )p , j=1 such that (31) is satisfied for all x, x0 ∈ X . Noting that if two vertices are joined by an edge then one has to be the parent of the other, we can write the set of dual solutions as  p S ∗ = λ ∈ `∞ x ∈ X . (32) d−p (X ) : |λx − λparent(x) | ≤ dT (x, parent(x)) , 33 Rewrite the target function To rewrite the target function we need to make several definitions. Let  1 if y = x,   dp (x,x0 ) 1 ẽ(x) = if y = parent(x), − y dp (x,x0 )   0 else. Furthermore, we define for µ ∈ `1dp (X ) X ηx = dp (x, x0 )µx0 x0 ∈children(x) and X µn = 1 X ηx ẽ(x) = µ1A<n + x∈A=n x∈A≤n \root(T ) ηx e(x), dp (x, x0 ) here A≤n = {x ∈ X : level of x ≤ n, x is within the first n vertices of its level}, A=n = {x ∈ X : level of x = n, x is within the first n vertices of its level}, A>n = {x ∈ X : level of x > n or x is not within the first n vertices of its level} and e(x) the sequence 1 at x and 0 everywhere else. For this sequence µn it holds kµ − µn k`1 (dp ) = X X dp (x, x0 ) µ1A>n − x∈X x̃∈A=n X ≤ kµ1A>n k`1 (dp ) + 1 ηx̃ e(x̃) dp (x̃, x0 ) x ηx . x∈A=n As n → ∞, the first part tends to zero as µ ∈ `1dp (X ), and X x∈A=n ηx ≤ X X |µx0 | dp (x0 , x0 ) ≤ x∈A=n x0 ∈children(x) X n→∞ |µx | dp (x, x0 ) −−−−→ 0. x∈A≥n Hence, our target function for µ ∈ `1dp (X ) and λ ∈ `∞ d−p (X ) can be rewritten in the following way hµ, λi = lim hµn , λi n→∞ X = lim ηx hẽ(x) , λi n→∞ = lim n→∞ ≤ lim n→∞ = lim n→∞ x∈A≤n X X µx0 (λx − λparent(x) ) x∈A≤n x0 ∈children(x) X X (33) µx0 λx − λparent(x) x∈A≤n x0 ∈children(x) X |(ST µ)x | λx − λparent(x) x∈A≤n 34 Observe that for λ ∈ S ∗ it holds λx − λparent(x) ≤ dP (x, parent(x)). (34) By condition (3) G ∼ N (0, Σ(r)) is an element of `1dp (X ). For λ ∈ S ∗ we get with (33) and (34) that X hG, λi ≤ lim |(ST G)x | dT (x, parent(x))p . (35) n→∞ x∈A≤n Therefore, maxλ∈S ∗ hG, λi is bounded by limn→∞ We can define the sequence ν ∈ `∞ d−p (X ) by P x∈A≤n |(ST G)x |dT (x, parent(x))p . νroot = 0 νx − νparent(x) = sign((ST G)x )dT (x, parent(x))p (36) From (32) and the fact that dp (x, parent(x)) ≤ dp (x, root(T )) we see that ν ∈ S ∗ and by plugging ν into equation (35) we can conclude that hG, νi attains the upper bound in (35). As the last step of our proof, we verify that the limit in (35) exists. Therefore, we rewrite condition (3) in terms of the edges and recall that x0 = root(T ). X X X √ √ dT (x, parent(x))p rx0 . (37) dT (x, x0 )p rx ≥ x∈X x0 ∈children(x) x∈X The first moment of the limiting distribution can be bounded in the following way:   X E |(ST G)x |dT (x, parent(x))p  x∈X \{root(T )} ≤ X dT (x, parent(x))p p (ST r)x (1 − (ST r)x ) x∈X ≤ X X √ dT (x, parent(x))p rx0 x∈X x0 ∈children(x) <∞ due to Hölder’s inequality and (37). This bound shows that the limit in (35) is almost surely finite and hence, concludes the proof. 35
10math.ST
Additive Spanners and Distance Oracles in Quadratic Time Mathias Bæk Tejs Knudsen∗ arXiv:1704.04473v1 [cs.DS] 14 Apr 2017 University of Copenhagen, [email protected] Abstract Let G be an unweighted, undirected graph. An additive k-spanner of G is a subgraph H that approximates all distances between pairs of nodes up to an additive error of `k, that is, it satisfies dH pu, vq ď dG pu, vq`k for all nodes u, v, where d is the shortest ` path ˘ distance. `We˘give a deterministic algorithm that constructs an additive Op1q-spanner with O n4{3 edges in O n2 time. This should be compared with the randomized Monte Carlo algorithm by `Woodruff˘[ICALP 2010] giving an ` ˘ additive 6-spanner with O n4{3 log3 n edges in expected time O n2 log2 n . An pα, βq-approximate distance oracle for G is a data structure that supports the following distance queries between pairs of nodes in G. Given two nodes u, v it can in constant time compute a distance estimate d˜ that satisfies d ď d˜ ď αd ` β where d is the distance between u and v in G. Som-˘ ` 5{3 mer [ICALP 2016] `gave a randomized Monte Carlo p2, 1q-distance oracle of size O n poly log n ˘ 2 in expected time O n poly log n . As an application of the additive Op1q-spanner we improve the ` 5{3 ˘ construction in ` 2 ˘ by Sommer [ICALP 2016] and give a Las Vegas ` 2 ˘ p2, 1q-distance oracle of size O n time O n . This also implies an `algorithm that in O n gives approximate distance for all pairs ˘ of nodes in G improving on the O n2 log n algorithm by Baswana and Kavitha [SICOMP 2010]. ∗ Research partly supported by Advanced Grant DFF-0602-02499B from the Danish Council for Independent Research under the Sapere Aude research career programme and by the FNU project AlgoDisc - Discrete Mathematics, Algorithms, and Data Structures 1 Introduction Let G “ pV, Eq be an unweighted, undirected graph on n nodes and m edges. A subgraph H of G is an additive k-spanner if the following holds for every pair u, v of nodes in G: dH pu, vq ď dG pu, vq ` k , where dH pu, vq and dG pu, vq is the distance between u and v in H and G respectively. This paper will only consider additive spanners and not multiplicative or mixed spanners, so we will simply say that H is a k-spanner when we mean that H is an additive k-spanner. In this paper we consider algorithms constructing k-spanners, and there are therefore three interesting parameters: The distortion k, the running time of the algorithm, and the ` 3{2 ˘ size of the `spanner ˘ created. 5{2 Elkin and Peleg [19] showed how to construct 2-spanners with O n edges in O n time, and ` ˘ ` ˘ Baswana et al [9] gave an algorithm that constructs 6-spanners with O n4{3 edges in O n2{3 m time. The running time of these algorithms can be improved if we allow the k-spanners to be larger by´ a poly log n¯factor. Dor, Halperin and Zwick [18] showed that we can construct 2-spanners with ` ˘ O n3{2 log1{2 n edges in O n2 log2 n time, and Woodruff [33] gave an algorithm to construct 6-spanners ` ˘ ` ˘ with O n4{3 log3 n edges in O n2 log2 n time. The construction of Woodruff is furthermore randomized Monte Carlo. These results are summarized in Table 1. These improvements to the running time fit into the following paradigm: For a fixed k the authors find algorithms that produce spanners that are almost as small as the best known construction of kspanners and have near -quadratic running time. We reverse this way of looking at the problem. We are now trying to find algorithms that yield k-spanners that are exactly as small as the best known constructions for any k “ Op1q, i.e. Opn4{3 q, and at the same time we want the algorithm to run as fast as possible. All known algorithms for creating Op1q-spanners that have close to optimal size run in time Ωpn2 q. 1 So a natural is to `ask˘ if there exists a k “ Op1q and an algorithm that constructs ˘ ` question a k-spanner with O n4{3 edges in O n2 time. In fact Sommer [28] mentioned at his talk at ICALP 2016 that the main obstacle towards getting a better running time for constructing the distance oracle he presented is the lack of such an algorithm. In his case the distortion k “ Op1q is only factored into the running time and not the distortion of oracle. Therefore, it does not matter what k is as long as it is constant. We show that it possible ` ˘ to attain this ` ˘goal by giving an algorithm that constructs 8-spanners deterministically with O n4{3 edges in O n2 time. Comparing this with the algorithm by Woodruff [33] this gets rid of the log3 n factor on the number of edges and a factor of log2 n in the running time. Furthermore, the algorithm is deterministic and not randomized Monte Carlo. The price of these improvements is that the distortion is` larger ˘ than 6. We note that there are no lower bounds ruling out the possibility of a 4-spanner with O n4{3 edges. For the application to the distance oracle by Sommer [28], the` distortion is unimportant as long as it is constant. We also show how to construct 2-spanners ˘ ` 2˘ 3{2 with O n edges in O n time. For a comparison to previous work see Table 1. Related work Elkin and Peleg [19] showed that2 any graph ´ on n nodes ¯ has a 2-spanner with 1{5 3{2 7{5 Opn q edges, Chechik [15] showed that it has a 4-spanner with O n log n edges, and Baswana et al [9] showed that it has a 6-spanner with Opn4{3 q edges. These results are complemented by a negative result of Abboud and Bodwin [1]. A consequence of their result is that for any k “ Op1q there exists a graph on n nodes such that any k-spanner of this graph has at least n4{3´op1q edges. ´ ¯ For instance the algorithm by Baswana et al [9] gives a 6-spanner with O n4{3 edges and is therefore only interesting ´ ¯ ´ ¯ ` ˘ when m “ Ω n4{3 , in which case the running time is Θ n2{3 m “ Ω n2 . 1 2 Aingworth et al [5] earlier showed the same result up to logarithmic factors on the size of the spanner. 1 k 2 2 2 6 6 8 Number of Edges ` ˘ O´n3{2 ¯ O n3{2 log1{2 n ` ˘ O n3{2 ` ˘ O`n4{3 ˘ O`n4{3 ˘log3 n O n4{3 Running Time ` ˘ O n5{2 ` ˘ O n2 log2 n ` ˘ O n2 ` ˘ O`n2{3 m ˘ O`n2 ˘log2 n O n2 Comment Deterministic Reference [19] Deterministic [18] Deterministic Deterministic Randomized Monte Carlo Deterministic Theorem 1 [9] [33] Theorem 2 Table 1: A summary of the performance of selected algorithms that creates a k-spanner H from a graph on n nodes. It shows the additive distortion, k, and an upper bound on the number of edges in H as well as the running time of the algorithm that constructs H. Another negative result comes from `Erdős’s˘girth conjecture [20]. It states that for any constant k there exists graphs with n nodes and Ω n1`1{k edges where the girth is 2k ` 2. This conjecture has been proved for k “ 2, 3, 5 [31, 11]. In particular if the conjecture is˘ true this implies that there exists ` graphs for which any p2k ´ 1q-spanner must have at least Ω n1`1{k edges. Woodruff [32] proved that whether the conjecture is` true or not, ˘ there exists a graph on n nodes such that any p2k ´ 1q-spanner of the graph has at least Ω k ´1 n1`1{k edges. There are also upper and lower bounds when we allow the distortion k to depend on n, see [14, 13, 15, 22]. In this paper, however, we are only interested in the case where k “ Op1q. The upper and lower bounds for k “ Op1q are summarized in Table 2. k 2&3 4&5 ě6 Upper Bound ˘ ` O´n3{2 ¯ O n7{5 log1{5 n ` ˘ O n4{3 Lower Bound ˘ ` Ω n3{2 ` ˘ Ω n4{3 Reference [19]/[31] n4{3´op1q [9]/[1] [15]/[11] Table 2: For a given k an upper bound of f pnq is a proof that any graph on n nodes has a k-spanner with no more than f pnq edges. A lower bound of gpnq is a proof that there exists a graph on n nodes for which any k-spanner must have at least gpnq edges. ` ˘ Techniques Previous algorithms that construct k-spanners in Õ n2 time all relied on constructing a hitting set for some set of neighbourhoods. In [18] this is done deterministically via a dominating set algorithm, and in [33] this is done via sampling. This approach will inherently come with the cost of a poly log n factor. Furthermore, in the construction of 6-spanners by Woodruff [33] the number of neighbourhoods that need to be hit is so large that it seems impossible with current techniques to modify the algorithm to be Las Vegas. Too avoid this we instead use a clustering approach described in Section 2. The algorithm in Theorem 2 is obtained using this clustering and a careful modification of the path-buying algorithm of [9]. Approximate Distance Oracles and All Pairs Almost Shortest Paths Given an undirected an unweighted graph G an pα, βq-approximate distance oracle for G is a data structure that supports the following query. Given two nodes u, v it can compute a distance estimate d˜ that satisfies d ď d˜ ď αd ` β where d is the distance between u and v in G. For work on approximate distance oracles see e.g. [2, 3, 4, 6, 7, 8, 10, 12, 16, 17, 23, 24, 26, 27, 29, 30, Monte ˘Carlo ` 34]. Sommer ˘ [28] gave a randomized ` p2, 1q-distance oracle that can be constructed in O n2 poly log n time, has size O n5{3 poly log n and ` ˘ ` ˘ can answer queries in Op1q time. We improve the construction time and the size to O n2 and O n5{3 2 respectively, and our construction is randomized Las Vegas. As a corollary we can compute an ` estimate ˘ ˜ vq for all pairs of nodes in G satisfying dG pu, vq ď dpu, ˜ vq ď 2dG pu, vq ` 1 in time O n2 . This dpu, ` 2 ˘ improves upon the O n log n algorithm by Baswana and Kavitha [8]. Preliminaries For a graph G and two nodes u, v we denote the distance from u to v in G by dG pu, vq. All graphs considered in this paper are unweighted, and unless otherwise specified they are undirected as well. For an undirected graph G an a node u the neighbourhood of u is the set of nodes adjacent to u and is denoted by ΓG puq. Overview In Section 2 we introduce the clustering we˘ use when constructing the spanners. In ` 4{3 ` 2˘ Section 3 we show how to create an 8-spanner with O n edges in O n time and thereby prove Theorem 2. In Section 4 we provide the details on how to give an improved p2, 1q-distance oracle. 2 Clustering Our construction of additive spanners uses standard clustering techniques. We present our clustering framework below. Let G “ pV, Eq be a graph with n vertices and m edges. We let t be a parameter that can depend on G. For a sequence u1 , . . . , u` of nodes we define the clusters Ci , i P t1, . . . , `u by Ci “ pΓG pui q Y tui uq z pC1 Y . . . Y Ci´1 q . Furthermore we also define graphs G0 , G1 , . . . , G` in the following way. We let G0 “ G, and for i ą 0 we let Gi be the subgraph of G that contains an edge pu, vq if not both u and v are contained in C1 Y. . .YCi . From each node ui we let Ti be a BFS tree in Gi´1 rooted at ui . Definition 1. A sequence u1 , . . . , u` is called a t-clustering if the following requirements are satisfied. • The node ui maximizes pΓG pui q Y tui uq z pC1 Y . . . Y Ci´1 q. • Every cluster Ci contains at least t nodes. • For every node v we have |pΓG pvq Y tvuq z pC1 Y . . . Y C` q| ă t. We say that a node v is clustered if v P C1 Y . . . Y C` and unclustered otherwise. We note that since every cluster Ci contains at least t nodes and the clusters are disjoint we have ` ď nt . Lemma 1. Let u1 , . . . , u` be a t-clustering. Then the number of edges in G` is at most nt. ř Proof. The number of edges in G` is bounded by the sum vPV |pΓG pvqq z pC1 Y . . . Y C` q|, which is clearly less than nt. Lemma 2. Let u1 , . . . , u` be a t-clustering of G “ pV, Eq and let u, v P V be a pair of nodes. Assume that some shortest path from u to v in G is not contained in G` from Lemma 1. Then there exists an index i P t1, 2, . . . , `u such that dTi pui , uq ` dTi pui , vq ď dG pu, vq ` 2 . Proof. Consider a shortest path p from u to v that is not contained in G` and let w be a clustered node on p such that w P Ci . We choose w such that i is smallest possible. By choosing i smallest possible p is contained in Gi´1 . Furthermore since the distance from w to ui is at most 1 we see that dGi´1 pui , uq ` dGi´1 pui , vq ď dGi´1 pw, uq ` dGi´1 pw, vq ` 2 “ dG pu, vq ` 2 . Since Ti is a is shortest path tree in Gi´1 the conclusion follows. 3 Lemma 3. Given a graph G and a parameter t ą 0 we can construct a t-clustering u1 , . . . , u` , the corresponding BFS trees T1 , . . . , T` and G` in Opn2 q time. Proof. The algorithm will work by finding the nodes u1 , . . . , u` consecutively, i.e. first u1 , then u2 and so on. The algorithm will maintain a graph G1 . In the beginning of the algorithm we have G1 “ G0 , and after we add ui we will alter G1 such that G1 “ Gi . The total cost of altering all G1 will be Opmq “ Opn2 q. We find ui by looking at all nodes in G1 “ Gi´1 and count the number of neighbours not in C1 Y . . . Y Ci´1 . Since Gi´1 has at most n |Ci | edges this takes Opn |Ci |q time. Then the algorithm finds a BFS tree from ui in Gi´1 in Opn |Ci |q time. Hence the total time used by the algorithm is: ¸ ˜ ` ÿ n |Ci | “ Opn2 q . O m` i“1 3 Constructing Op1q-Spanners ` ˘ ` ˘ In this section we present our construction of an 8-spanner with O n4{3 edges in O n2 time. As a ` 3{2 ˘ warmup edges ` 2 ˘we show how we can use the clustering from Section 2 to give a 2-spanner with O n in O n time. Theorem 1. There exists ` an ˘ algorithm that given a graph G with n nodes constructs a 2-spanner of G with ď 2n3{2 edges in O n2 time. ? Proof. Let t “ n and construct a t-clustering u1 , . . . , u` with Lemma 3. Let H “ T1 Y . . . Y T` Y G` . ? The number of edges in H is at most n` ` nt ď 2n n by Lemma 1 and the fact that ` ď nt . Now we just need to prove that H is a 2-spanner. Let u, v be arbitrary nodes and let p be a shortest path from u to v in G. We wish to prove that dH pu, vq ď dG pu, vq ` 2 . (1) If p is contained in G` then (1) is obviously true. Otherwise there exists an index i such that dTi pu, vq ď dG pu, vq ` 2 by Lemma 2, and (1) is true since Ti Ď H. ˘ ` ˘ ` Next we turn to showing how to create an 8-spanner H with O n4{3 edges in O n2 time. The idea is the following. We start by creating a t-clustering u1 , . . . , u` with t “ n1{3 and ` ď n2{3 . Using the BFS trees T1 , . . . , T` along with Lemma 2 we can then get an additive 2-approximation `of d˘G pui , uj q for all pairs of indices i, j, which we will call δi,j . The calculation of the BFS trees in O n2 time relies on an idea similar to one in [5]. The BFS trees also gives us a path from ui to uj that is at most 2 longer than the shortest path. If we add all these shortest paths to our spanner along with G` and the neighbours in Ci of each ui we will get a 6-spanner. Unfortunately, adding a path could require ` ˘adding up to Ωp`q edges, and since there are `2 pairs we can only guarantee that the spanner has O `3 edges, ` ˘ which is O n2 if ` « n2{3 . (We only need to add edges on the path that are not already in G` ) Instead we use an argument similar to the path-buying argument from [9] and the construction from [21]. We add the path from ui to uj unless we can guarantee that there is already an additive 2-approximation of this path in the spanner already. We do this by maintaining an upper bound ∆i,j on the distance from ui to uj in the spanner H. We then argue that if we add a path of with k edges not already in the spanner, then there are pairs ui1 , uj 1 for which the upper bound ∆`i1 ,j 1 is ˘ ˘ improved. Then, this will ` Ωpkq imply that at most O `2 edges are added giving an upper bound of O n4{3 on the number of edges in H. After this informal discussion of the construction we turn to the details. The algorithm is given a graph G “ pV, Eq with n nodes and m edges, and will return a spanner H “ pV, F q. Initially F “ H 4 and we will add edges to H such that H becomes a 8-spanner ` ˘ of G. The algorithm starts by creating a t-clustering u1 , . . . , u` with t “ n1{3 using Lemma 3 in O n2 time. Since ` ď nt we have ` ď n2{3 . Then we add edges from ui to all nodes in Ci z tui u to H for all i P t1, 2, . . . , `u. We add at most n edges this way. Then we add all edges from G` to H. This adds at most nt “ n4{3 edges to H. We give each node u P V a color cpuq P t0, 1, 2, . . . , `u. If u is unclustered then u has color cpuq “ 0. Otherwise cpuq “ i where i is the unique index such that u P Ci . For each pair of indices i, j P t1, 2, . . . , `u we define δi,j by: δi,j “ min kPt1,2,...,`u tdTk puk , ui q ` dTk puk , uj qu . (2) We first note that for a choice of i, j we can calculate the` right ˘ hand side of (2) in Op`q time since we are taking the minimum over ` different values. So in O `3 time the algorithm calculates δi,j for all ` ˘ pairs of indices i, j. Since ` ď n2{3 this is within the O n2 time bound. As a consequence of Lemma 2 we get that δi,j is a good approximation of dG pui , uj q, more precisely: dG pui , uj q ď δi,j ď dG pui , uj q ` 2 . (3) We now define Ti1 to be the tree obtained from Ti by contracting each edge in G` . Since an edge is contained in G` iff at least one of its endpoints is unclustered we˘can construct Ti1 from Ti in Opnq time. ` 5{3 time. We note that the shortest path The algorithm does so for all i P t1, 2, . . . , `u in Opn`q “ O n between two nodes u, v in Ti1 contains exactly the edges on the shortest path between u, v in Ti excluding the edges that are contained in G` . The algorithm initializes ∆i,j “ 8 for all pairs of indices i, j with i ‰ j and let ∆i,i “ 0 for all i. We will maintain that ∆i,j is an upper bound on dH pui , uj q throughout the algorithm. Now the algorithm goes through all pairs ui , uj and adds an almost-shortest path between the nodes if needed. Specifically, we do the following: Algorithm 1 1 For each pair of indices i, j P t1, 2, . . . , `u: 2 For all k P t1, 2, . . . , `u: 3 Set ∆i,j :“ min t∆i,j , ∆i,k ` ∆k,j u. 4 If ∆i,j ą δi,j ` 2 do : 5 Find a k P t1, 2, . . . , `u such that dTk puk , ui q ` dTk puk , uj q “ δi,j . 6 Find the path p from ui to uj in Tk1 . 7 Add all edges from p to H . 8 Write p “ pw0 , w1 , w2 , . . . , ws´1 q. 9 For all x P t0, 1, 2, ..., s ´ 1u: 10 Set y :“ dTk pui , wx q. ( 11 Set ∆i,cpwx q :“ min ∆i,cpwx q , y ` 1 ( 12 Set ∆cpwx q,j :“ min ∆cpwx q,j , pδi,j ´ yq ` 1 1 Let L be an upper bound on the ` 3number ˘of nodes of the path p from ui to uj in Tk on line 6. Then 2 Algorithm 1 can implemented in O ` ` ` L `time. ˘ Hence ` we ˘ just need to prove that L “ Op`q in order to conclude that it can be implemented in O `3 “ O n2 time. This follows from the fact that p is an almost shortest path and the following reasoning. If p contained ą C` nodes for some sufficiently large constant C it would contain more than C nodes of the same color. Since nodes of the same color have distance at most 2 in G this would imply that there was a much shorter path from u to v in G contradicting (3) if C was chosen large enough. The details with C “ 5 are given in the following lemma: Lemma 4. The path p contains no nodes of color 0, and at most 5 nodes of each color ‰ 0. Proof. Obviously p does not contain a node with color 0, since all its incident edges would be contained in G` and hence not in Tk1 . Now assume for the sake of contradiction that p contains 6 nodes of some 5 color r ‰ 0. When traversing p from ui to uj let α and β be the first and the last node of color r respectively. The distance from α to β when following p must be at least 5 by assumption. On the other hand α and β have distance at most 2 in G. So there exists a path in G from ui to uj that is at least 3 edges shorter that p. This contradicts (3). Hence the assumption was wrong and p contains at most 5 nodes of each color ‰ 0. Since there are ` ` ˘different colors ‰ 0 the path p contains at most 5` nodes and the running time of Algorithm 1 is O n2 . So now we just need to prove that H is an 8-spanner and that H has at most ` ˘ O n4{3 edges. We start by proving that H is an 8-spanner. Here we will utilize that the ∆i,j is an upper bound on the distance from ui to uj in H. Furthermore, Algorithm 1 guarantees that ∆i,j ď δi,j ` 2. Together with (3) this gives that dH pui , uj q ď dG pui , uj q ` 4 . (4) Lemma 5. The subgraph H of G is an additive 8-spanner of G. Proof. Assume for the sake of contradiction that H is not an additive 8-spanner and let u, v be a pair of nodes with shortest possible distance in G such that: dH pu, vq ą dG pu, vq ` 8 . (5) Say that dG pu, vq “ D and let p “ pw0 , w1 , . . . , wD q be a shortest path from u to v in G where w0 “ u and wD “ v. Since the pair pu, vq has the smallest possible distance in G such that (5) holds and dG pw1 , vq “ D ´ 1 we have dH pw1 , vq ď pD ´ 1q ` 8. In particular the edge pu, w1 q is not in H as it would contradict (5). Hence u cannot be unclustered, as all the edges incident to an unclustered node is contained in G` and therefore H. With the same reasoning we conclude that v is clustered. Let the colors of u and v be i and j respectively. The distances from u and v to ui and uj respectively are at most 1. Combining this insight with (4) we get: dH pu, vq ď dH pui , uj q ` 2 ď dG pui , uj q ` 6 ď dG pu, vq ` 8 . But this contradicts the assumption (5). Hence the assumption was wrong and H is an additive 8-spanner of G. ` ˘ Lastly, we need to prove that H contains no more than O n4{3 edges. Informally, we argue the following way. Whenever the s ´ 1 edges of p are added to H on line 7 of Algorithm 1 there are Ωpsq different colors on p. For each color r on p we then argue that either ∆i,r or ∆r,j are made smaller on line 11 or 12 of Algorithm 1. Lastly, we argue that ∆i,j can only be updated ` ˘ Op1q times, and since there are `2 ď n4{3 variables ∆i,j this implies that Algorithm 1 only adds O n4{3 edges to H. This intuition is formalized in Lemma 6 bellow: Lemma 6. Algorithm 1 adds no more than 25`2 edges to H. Proof. Say that the algorithm adds the edges from the path p “ pw0 , w1 , . . . , ws´1 q on line 7 of Algorithm 1 where w0 “ ui , ws´1 “ uj . First we note that since dG pui , uj q ě δi,j ´ 2 by (3) we have that dG pui , wx q ě y ´ 2 for every x P t0, 1, . . . , s ´ 1u, where we consider y to be a function of x defined by y “ dTk pui , wx q as on line 10. Now fix x and let r “ cpwx q. Then there is an edge between wx and ur and therefore dG pui , ur q ě y ´ 3, i.e. y ` 1 ď dG pui , ur q ` 4. So if Algorithm 1 decreases ∆i,r on line 11 we have ∆i,r ď dG pui , ur q ` 4 after it is decreased. Since ∆i,r is an upper bound on dH pui , ur q and therefore also an upper bound on dG pui , ur q we see that ∆i,r can be decreased at most 5 times for each choice of i, r. By symmetry we see that we can also decrease ∆r,j on line 12 at most 5 times. Since there are `2 pairs of indices the algorithm can change the values of ∆i,r or ∆r,j on line 11 and 12 of Algorithm 1 at most 5`2 times. 6 Let r be a color on p. After the execution of lines 9-12 we have ∆i,r ` ∆r,j ď δi,j ` 2 . Due to the execution of lines 2 and 3 this was not the case before. Hence either ∆i,r or ∆r,j were updated. By Lemma 4 there are at least 5s colors on p, so if the algorithm adds A edges in total it makes at least A5 updates of upper bounds ∆i,r or ∆r,j . Since there can be at most 5`2 such updates we conclude that A5 ď 5`2 and that Algorithm 1 adds no more than 5`2 edges. ` ˘ To summarize, the algorithm presented in this section runs in O n2 time and gives an additive ` ˘ 8-spanner with no more than 26n4{3 ` n “ O n4{3 edges. We have made no attempt to optimize the constant in the O-notation. Hence we get: Theorem ` 2. ˘ There exists ` an ˘ algorithm that given a graph G with n nodes constructs a 8-spanner of G with O n4{3 edges in O n2 time. 4 Distance Oracles In the following` we ˘show how to modify the construction by [28] to obtain a p2, 1q-distance ` Sommer ˘ oracle of size O n5{3 that can be constructed in expected O n2 time. ` Let ˘ G be a given graph, ` 4{3 ˘and H an 8-spanner of G constructed by Theorem ` 5{3 ˘2. H is constructed in 2 O n time and has O n edges. During the construction we use only O n space. ` ˘ 1{3 Let u1 , u2 , . . . , u` be a n -clustering of G. Using Lemma 3 we obtain T1 , . . . , T` and G` in O n2 time. For each node v we define four portals p1 pvq, p2 pvq, p3 pvq, p4 pvq. We define p1 pvq “ ui , where ui is chosen such that the distance between v and ui in Ti is minimized. In case of ties we choose the node ui with the lowest index i. The node pj`1 pvq for j “ 1, 2, 3 is chosen depending on pj pvq. If pj pvq “ u1 we let pj`1 pvq “ u1 . Otherwise pj pvq “ ui for some index i. We let pj`1 pvq “ ui1 where ui1 is chosen among u1 , u2 , . . . , ui´1 such that the distance between ui1 and v in Ti1 is minimized. In case ` 5{3of ˘ ties we 1 choose the node ui1 with the lowest index i . The portals for all nodes can be found in O n time. We will use the following lemma by Pǎtraşcu and Roditty [23] to construct a p2, 1q-distance oracle ` 5{3 ˘ for G` , that uses space O n . ˘ ` Lemma 7 ([23]). For any unweighted, undirected graph, there exists a distance oracle of size O n5{3 that, given any nodes u and v at distance d, returns a` distance ˘ of at most 2d ` 1 in constant time. The distance oracle can be constructed in expected time O mn2{3 . ` ˘ In the proof in [23] they only claim a running time of O mn2{3 ` n7{3 , however, this can be fixed to ` ˘ give the correct running time of O mn2{3 [25]. By [23, Claim 9] it is easy to see how to get a running ` 2{3 ˘ time of O mn ` n2 which suffice for our purposes. We are now ready to define the distance oracle. For each i “ 1, 2, . . . , ` we store the distances dT`i pui , vq ˘ and `dH2pu ˘ i , vq for all nodes v. The distances dH pui , vq can be calculated using a BFS in time 4{3 O `n “ O n . For each node v we store its portals pj pvq, j “ 1, 2, 3, 4. We augment this distance oracle with the Pǎtraşcu-Roditty distance oracle from Lemma 7 for G` . We now show how to use the distance oracle to obtain approximate distances for a query u, v. We let δP R pu, vq be the approximate distance in G` returned by the Pǎtraşcu-Roditty distance oracle. We define δj pu, vq in the following way. Let pj puq “ ui . Then δj pu, vq “ dTi pui , uq ` min tdTi pui , vq, dH pui , vqu. The distance returned by the distance oracle is the minimum of δP R pu, vq, δj pu, vq and δj pv, uq for j “ 1, 2, 3, 4. We will now argue that if the the distance between u and v is d, then the distance oracle returns a distance between d and 2d ` 1. The distance returned is obviously at least d, so we just need to show that it is at most 2d ` 1. Consider a shortest path between u and v in G. If there is at most one node 7 on the shortest path which is incident to a node ui in the clustering then the shortest path is contained in G` , and therefore: δP R pu, vq ď 2dG` pu, vq ` 1 “ 2d ` 1 . So assume that there exists a edge on the shortest path not in G` . Let i be the smallest index such that there is an edge pz, tq on the shortest path with z, t P C1 Y . . . Y Ci . Say that z is closer to u than to v in G. Assume that z P Ci and t P Ci1 for some index i1 ď i (the case where z P Ci1 and t P Ci is handled symmetrically). Since the shortest path is contained in Gi´1 and Gi1 ´1 we have that dTi pui , uq ` dTi1 pui1 , vq ď d ` 1 and therefore: min tdTi pui , uq, dTi pui , vqu ď d`1 . 2 Assume that dTi pui , uq ď d`1 2 . The other case is handled similarly. Say that pj puq “ ukj for j “ 1, 2, 3, 4. First assume that kj ą i for all j “ 1, 2, 3, 4. Then we conclude that dTk1 pp1 puq, uq ď dTi pui , uq ´ 4. The distance returned by the distance oracle is at most δ1 pu, vq ď dTk1 pp1 puq, uq ` dH pp1 puq, vq ď 2dTk1 pp1 puq, uq ` dH pu, vq ď 2pdTi pui , uq ´ 4q ` d ` 8 ď 2d ` 1 . Now assume that kj ď i for some j P t1, 2, 3, 4u and let j be the smallest index such that kj ď i. By definition we have that dTkj ppj puq, uq ď dTi pui , uq. Furthermore the shortest path is contained in Gj´1 and therefore dTkj ppj puq, vq ď dTkj ppj puq, uq ` dG pu, vq. The distance returned is at most δj pu, vq ď dTkj ppj puq, uq ` dTkj ppj puq, vq ď 2dTkj ppj puq, uq ` d ď 2dTi pui , uq ` d ď 2d ` 1 . We conclude that the distance returned by the distance oracle is always between d and 2d ` 1. The result is summarized in Theorem 3. ˘ ` Theorem 3. For any unweighted, undirected graph, there exists a distance oracle of size O n5{3 that, given any nodes u and v at distance d, returns a distance ` ˘ of at most 2d ` 1 in constant time. The distance oracle can be constructed in expected time O n2 . Acknowledgements. The author would like to thank Christian Sommer for helpful discussions on the application of the 8-spanner to his construction of distance oracles. 8 References [1] Amir Abboud and Greg Bodwin. The 4/3 additive spanner exponent is tight. In Proc. 48th ACM Symposium on Theory of Computing (STOC), pages 351–361, 2016. [2] Ittai Abraham and Cyril Gavoille. On approximate distance labels and routing schemes with affine stretch. In Distributed Computing - 25th International Symposium, DISC 2011, Rome, Italy, September 20-22, 2011. Proceedings, pages 404–415, 2011. [3] Rachit Agarwal. The space-stretch-time tradeoff in distance oracles. In Algorithms - ESA 2014 - 22th Annual European Symposium, Wroclaw, Poland, September 8-10, 2014. Proceedings, pages 49–60, 2014. [4] Rachit Agarwal and Philip Brighten Godfrey. Brief announcement: a simple stretch 2 distance oracle. In ACM Symposium on Principles of Distributed Computing, PODC ’13, Montreal, QC, Canada, July 22-24, 2013, pages 110–112, 2013. [5] Donald Aingworth, Chandra Chekuri, Piotr Indyk, and Rajeev Motwani. Fast estimation of diameter and shortest paths (without matrix multiplication). SIAM J. Comput., 28(4):1167–1181, 1999. See also SODA’96. [6] Surender Baswana, Akshay Gaur, Sandeep Sen, and Jayant Upadhyay. Distance oracles for unweighted graphs: Breaking the quadratic barrier with constant additive error. In Automata, Languages and Programming, 35th International Colloquium, ICALP 2008, Reykjavik, Iceland, July 7-11, 2008, Proceedings, Part I: Tack A: Algorithms, Automata, Complexity, and Games, pages 609–621, 2008. [7] Surender Baswana, Vishrut Goyal, and Sandeep Sen. All-pairs nearly 2-approximate shortest paths in I time. Theor. Comput. Sci., 410(1):84–93, 2009. [8] Surender Baswana and Telikepalli Kavitha. Faster algorithms for all-pairs approximate shortest paths in undirected graphs. SIAM Journal on Computing, 39(7):2865–2896, 2010. [9] Surender Baswana, Telikepalli Kavitha, Kurt Mehlhorn, and Seth Pettie. Additive spanners and (alpha, beta)-spanners. ACM Trans. Algorithms, 7(1):5, 2010. See also SODA’05. [10] Surender Baswana and Sandeep Sen. Approximate distance oracles for unweighted graphs in expected o (n 2) time. ACM Transactions on Algorithms (TALG), 2(4):557–577, 2006. [11] Clark T Benson. Minimal regular graphs of girth eight and twelve. Canad. J. Math, 18(1):94, 1966. [12] Piotr Berman and Shiva Prasad Kasiviswanathan. Faster approximation of distances in graphs. In Workshop on Algorithms and Data Structures, pages 541–552. Springer, 2007. [13] Greg Bodwin and Virginia Vassilevska Williams. Better distance preservers and additive spanners. In Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2016, Arlington, VA, USA, January 10-12, 2016, pages 855–872, 2016. [14] Gregory Bodwin and Virginia Vassilevska Williams. Very sparse additive spanners and emulators. In Proceedings of the 2015 Conference on Innovations in Theoretical Computer Science, ITCS 2015, Rehovot, Israel, January 11-13, 2015, pages 377–382, 2015. [15] Shiri Chechik. New additive spanners. In Proc. 24th ACM/SIAM Symposium on Discrete Algorithms (SODA), pages 498–512, 2013. 9 [16] Shiri Chechik. Approximate distance oracles with constant query time. In Proceedings of the 46th Annual ACM Symposium on Theory of Computing, pages 654–663. ACM, 2014. [17] Shiri Chechik. Approximate distance oracles with improved bounds. In Proceedings of the FortySeventh Annual ACM on Symposium on Theory of Computing, pages 1–10. ACM, 2015. [18] Dorit Dor, Shay Halperin, and Uri Zwick. All-pairs almost shortest paths. SIAM Journal on Computing, 29(5):1740–1759, 2000. See also FOCS’96. [19] Michael Elkin and David Peleg. p1 ` ε, βq-spanner constructions for general graphs. SIAM Journal on Computing, 33(3):608–631, 2004. See also STOC’01. [20] Paul Erdős. Extremal problems in graph theory. In In “Theory of Graphs and its Applications,” Proc. Sympos. Smolenice. Citeseer, 1964. [21] Mathias Bæk Tejs Knudsen. Additive spanners: A simple construction. In Proc. 14th Scandinavian Workshop on Algorithm Theory (SWAT), pages 277–281, 2014. [22] Seth Pettie. Low distortion spanners. ACM Trans. Algorithms, 6(1):7:1–7:22, 2009. [23] Mihai Pǎtraşcu and Liam Roditty. Distance oracles beyond the thorup–zwick bound. SIAM Journal on Computing, 43(1):300–311, 2014. [24] Mihai Pǎtraşcu, Liam Roditty, and Mikkel Thorup. A new infinity of distance oracles for sparse graphs. In Foundations of Computer Science (focs), 2012 Ieee 53rd Annual Symposium on, pages 738–747. IEEE, 2012. [25] Liam Roditty. personal communication. [26] Liam Roditty, Mikkel Thorup, and Uri Zwick. Deterministic constructions of approximate distance oracles and spanners. In International Colloquium on Automata, Languages, and Programming, pages 261–272. Springer, 2005. [27] Christian Sommer. Shortest-path queries in static networks. ACM Computing Surveys (CSUR), 46(4):45, 2014. [28] Christian Sommer. All-pairs approximate shortest paths and distance oracle preprocessing. In LIPIcs-Leibniz International Proceedings in Informatics, volume 55. Schloss Dagstuhl-LeibnizZentrum fuer Informatik, 2016. [29] Christian Sommer, Elad Verbin, and Wei Yu. Distance oracles for sparse graphs. In Foundations of Computer Science, 2009. FOCS’09. 50th Annual IEEE Symposium on, pages 703–712. IEEE, 2009. [30] Mikkel Thorup and Uri Zwick. Approximate distance oracles. Journal of the ACM (JACM), 52(1):1–24, 2005. [31] Rephael Wenger. Extremal graphs with no c4’s, c6’s, or c10’s. Journal of Combinatorial Theory, Series B, 52(1):113–116, 1991. [32] David P. Woodruff. Lower bounds for additive spanners, emulators, and more. In Proc. 47th IEEE Symposium on Foundations of Computer Science (FOCS), pages 389–398, 2006. [33] David P. Woodruff. Additive spanners in nearly quadratic time. In Proc. 37th International Colloquium on Automata, Languages and Programming (ICALP), pages 463–474, 2010. [34] Christian Wulff-Nilsen. Approximate distance oracles with improved preprocessing time. In Proceedings of the twenty-third annual ACM-SIAM symposium on Discrete Algorithms, pages 202–208. Society for Industrial and Applied Mathematics, 2012. 10
8cs.DS
Basic models and questions in statistical network analysis Miklós Z. Rácz ∗ with Sébastien Bubeck † arXiv:1609.03511v1 [math.ST] 12 Sep 2016 September 13, 2016 Abstract Extracting information from large graphs has become an important statistical problem since network data is now common in various fields. In this minicourse we will investigate the most natural statistical questions for three canonical probabilistic models of networks: (i) community detection in the stochastic block model, (ii) finding the embedding of a random geometric graph, and (iii) finding the original vertex in a preferential attachment tree. Along the way we will cover many interesting topics in probability theory such as Pólya urns, large deviation theory, concentration of measure in high dimension, entropic central limit theorems, and more. Outline: • Lecture 1: A primer on exact recovery in the general stochastic block model. • Lecture 2: Estimating the dimension of a random geometric graph on a high-dimensional sphere. • Lecture 3: Introduction to entropic central limit theorems and a proof of the fundamental limits of dimension estimation in random geometric graphs. • Lectures 4 & 5: Confidence sets for the root in uniform and preferential attachment trees. Acknowledgements These notes were prepared for a minicourse presented at University of Washington during June 6–10, 2016, and at the XX Brazilian School of Probability held at the São Carlos campus of Universidade de São Paulo during July 4–9, 2016. We thank the organizers of the Brazilian School of Probability, Paulo Faria da Veiga, Roberto Imbuzeiro Oliveira, Leandro Pimentel, and Luiz Renato Fontes, for inviting us to present a minicourse on this topic. We also thank Sham Kakade, Anna Karlin, and Marina Meila for help with organizing at University of Washington. Many thanks to all the participants who asked good questions and provided useful feedback, in particular Kira Goldner, Chris Hoffman, Jacob Richey, and Ryokichi Tanaka in Seattle, and Vladimir Belitsky, Santiago Duran, Simon Griffiths, and Roberto Imbuzeiro Oliveira in São Carlos. ∗ † Microsoft Research; [email protected]. Microsoft Research; [email protected]. 1 1 Lecture 1: A primer on exact recovery in the general stochastic block model Community detection is a fundamental problem in many sciences, such as sociology (e.g., finding tight-knit groups in social networks), biology (e.g., detecting protein complexes), and beyond. Given its importance, there have been a plethora of algorithms developed in the past few decades to detect communities. But how can we test whether an algorithm performs well? What are the fundamental limits to any community detection algorithm? Often in real data the ground truth is not known (or there is not even a well-defined ground truth), so judging the performance of algorithms can be difficult. Probabilistic generative models can be used to model real networks, and even if they do not fit the data perfectly, they can still be useful: they can act as benchmarks for comparing different clustering algorithms, since the ground truth is known. Perhaps the most widely studied generative model that exhibits community structure is the stochastic block model (SBM). The SBM was first introduced in sociology [29] and was then studied in several different scientific communities, including mathematics, computer science, physics, and statistics [18, 19, 27, 9, 35, 44].1 It gives a distribution on graphs with n vertices with a hidden partition of the nodes into k communities. The relative sizes of the communities, and the edge densities connecting communities are parameters of the general SBM. The statistical inference problem is then to recover as much of the community structure as possible given a realization of the graph, but without knowing any of the community labels. 1.1 The stochastic block model and notions of recovery The general stochastic block model is a distribution on graphs with latent community structure, and it has three parameters: n, the number of vertices; a probability distribution p = (p1 , . . . , pk ) that describes the relative sizes of the communities; and Q ∈ [0, 1]k×k , a symmetric k × k matrix that describes the probabilities with which two given vertices are connected, depending on which communities they belong to. The number of communities, k, is implicit in this notation; in these notes we assume that k is a fixed constant. A random graph from SBM(n, p, Q) is defined as follows: • The vertex set of the graph is V = {1, . . . , n} ≡ [n]. • Every vertex v ∈ V is independently assigned a (hidden) label σv ∈ [k] from the probability distribution p on [k]. That is, P (σv = i) = pi for every i ∈ [k]. • Given the labels of the vertices, each (unordered) pair of vertices (u, v) ∈ V × V is connected independently with probability Qσu ,σv . Example 1.1 (Symmetric communities). A simple example to keep in mind is that of symmetric communities, with more edges within communities than between communities. This is modeled by the SBM with pi = 1/k for all i ∈ [k] and Qi,j = a if i = j and Qi,j = b otherwise, with a > b > 0. We write G ∼ SBM(n, p, Q) for a graph generated according to the SBM without the hidden vertex labels revealed. The goal of a statistical inference algorithm is to recover as many labels as possible using only the underlying graph as an observation. There are various notions of success that are worth studying. 1 Disclaimer: the literature on community detection is vast and rapidly growing. It is not our intent here to survey this literature; we refer the interested reader to the papers we cite for further references. 2 Figure 1: A schematic of the general stochastic block model. • Weak recovery (also known as detection). An algorithm is said to weakly recover or detect the communities if it outputs a partition of the nodes which is positively correlated with the true partition, with high probability (whp)2 . • Partial recovery. How much can be recovered about the communities? An algorithm is said to recover communities with an accuracy of α ∈ [0, 1] if it outputs a labelling of the nodes which agrees with the true labelling on a fraction α of the nodes whp. An important special case is when only o(n) vertices are allowed to be misclassified whp, known as weak consistency or almost exact recovery. • Exact recovery (also known as recovery or strong consistency). The strongest notion of reconstruction is to recover the labels of all vertices exactly whp. When this is not possible, it can still be of interest to understand which communities can be exactly recovered, if not all; this is sometimes known as “partial-exact-recovery”. In all the notions above, the agreement of a partition with the true partition is maximized over all relabellings of the communities, since we are not interested in the specific original labelling per se, but rather the partition (community structure) it induces. The different notions of recovery naturally lead to studying different regimes of the parameters. For weak recovery to be possible, many vertices in all but one community should be non-isolated (in the symmetric case this means that there should be a giant component), requiring the edge probabilities to be Ω (1/n). For exact recovery, all vertices in all but one community should be non-isolated (in the symmetric case this means that the graph should be connected), requiring the edge probabilities to be Ω (ln(n)/n). In these regimes it is natural to scale the edge probability matrices accordingly, i.e., to consider SBM (n, p, Q/n) or SBM (n, p, ln (n) Q/n), where Q ∈ Rk×k + . There has been lots of work in the past few years understanding the fundamental limits to recovery under the various notions discussed above. For weak recovery there is a sharp phase transition, the threshold of which was first conjectured in [21]. This was proven first for two symmetric communities [39, 40] and then for multiple communities [3]. Partial recovery is less well understood, and finding the fraction of nodes that can be correctly recovered for a given set of parameters is an open problem; see [41] for results in this direction for two symmetric communities. In this lecture we are interested in exact recovery, for which Abbe and Sandon gave the value of the threshold for the general SBM, and showed that a quasi-linear time algorithm works all the way 2 In these notes “with high probability” stands for with probability tending to 1 as the number of nodes in the graph, n, tends to infinity. 3 to the threshold [2] (building on previous work that determined the threshold for two symmetric communities [1, 42]). The remainder of this lecture is an exposition of their main results and a few of the key ideas that go into proving and understanding it. 1.2 From exact recovery to testing multivariate Poisson distributions Recall that we are interested in the logarithmic degree regime for exact recovery, i.e., we consider G ∼ SBM(n, p, ln(n)Q/n), where Q ∈ Rk×k is independent of n. We also assume that the com+ munities have linear size, i.e., that p is independent of n, and pi ∈ (0, 1) for all i. Our goal is to recover the labels of all the vertices whp. As a thought experiment, imagine that not only is the graph G given, but also all vertex labels are revealed, except for that of a given vertex v ∈ V . Is it possible to determine the label of v? Figure 2: Suppose all community labels are known except that of vertex v. Can the label of v be determined based on its neighbors’ labels? Understanding this question is key for understanding exact recovery, since if the error probability of this is too high, then exact recovery will not be possible. On the other hand, it turns out that in this regime it is possible to recover all but o(n) labels using an initial partial recovery algorithm. The setup of the thought experiment then becomes relevant, and if we can determine the label of v given the labels of all the other nodes with low error probability, then we can correct all errors made in the initial partial recovery algorithm, leading to exact recovery. We will come back to the connection between the thought experiment and exact recovery; for now we focus on understanding this thought experiment. Given the labels of all vertices except v, the information we have about v is the number of nodes in each community it is connected to. In other words, we know the degree profile d(v) of v, where, for a given labelling of the graph’s vertices, the i-th component di (v) is the number of edges between v and the vertices in community i. The distribution of the degree profile d(v) depends on the community that v belongs to. Recall that the community sizes are given by a multinomial distribution with parameters n and p, and hence the relative size of community i ∈ [k] concentrates on pi . Thus if σv = j, the degree profile d(v) = (d1 (v), . . . , dk (v)) can be approximated by independent binomials, with di (v) approximately distributed as Bin (npi , ln(n)Qi,j /n), where Bin(m, q) denotes the binomial distribution with m trials and success probability q. In this regime, the binomial distribution is well-approximated by a Poisson distribution of the same mean. In particular, Le Cam’s inequality gives that TV (Bin (na, ln(n)b/n) , Poi (ab ln(n))) ≤ 4 2ab2 (ln(n))2 , n where Poi (λ) denotes the Poisson distribution with mean λ, and TV denotes the total variation distance3 . Using the additivity of the Poisson distribution and the triangle inequality, we get that    ! 2 X (ln (n)) pi Qi,j ei  = O TV L (d(v)) , Poi ln (n) , n i∈[k] where L (d(v)) denotes the law of d(v) conditionally on σv = j and ei is the i-th unit vector. Thus thePdegree profile of a vertex in community j is approximately Poisson distributed with mean ln (n) i∈[k] pi Qi,j ei . Defining P = diag(p), this can be abbreviated as ln (n) (P Q)j , where (P Q)j denotes the j-th column of the matrix P Q. We call the quantity (P Q)j the community profile of community j; this is the quantity that determines the distribution of the degree profile of vertices from a given community. Our thought experiment has thus been reduced to a Bayesian hypothesis testing problem between k multivariate Poisson distributions. The prior on the label of v is given by p, and we get to observe the degree profile d(v), which comes from one of k multivariate Poisson distributions, which have mean ln(n) times the community profiles (P Q)j , j ∈ [k]. 1.3 Testing multivariate Poisson distributions We now turn to understanding the testing problem described above; the setup is as follows. We consider a Bayesian hypothesis testing problem with k hypotheses. The random variable H takes values in [k] with prior given by p, i.e., P (H = j) = pj . We do not observe H, but instead we observe a draw from a multivariate Poisson distribution whose mean depends on the realization of H: given H = j, the mean is λ(j) ∈ Rk+ . In short: D | H = j ∼ Poi (λ(j)) , j ∈ [k]. In more detail: P (D = d | H = j) = Pλ(j) (d) , d ∈ Zk+ , where Pλ(j) (d) = Y Pλi (j) (di ) i∈[k] and λi (j)di −λi (j) e . di ! Our goal is to infer the value of H from a realization of D. The error probability is minimized by the maximum a posteriori (MAP) rule, which, upon observing D = d, selects Pλi (j) (di ) = arg max P (D = d | H = j) pj j∈[k] as an estimate for the value of H, with ties broken arbitrarily. Let Pe denote the error of the MAP estimator. One can think of the MAP estimator as a tournament of k − 1 pairwise comparisons of the hypotheses: if P (D = d | H = i) pi > P (D = d | H = j) pj then the MAP estimate is not j. The probability that one makes an error during such a comparison is exactly X Pe (i, j) := min {P (D = x | H = i) pi , P (D = x | H = j) pj } . (1.1) x∈Zk+ 3 Recall that the total variation distance between two random P variables X and Y taking values in a finite space X with laws µ and ν is defined as TV (µ, ν) ≡ TV (X, Y ) = 21 x∈X |µ (x) − ν (x)| = supA |µ (A) − ν (A)|. 5 For finite k, the error of the MAP estimator is on the same order as the largest pairwise comparison error, i.e., maxi,j Pe (i, j). In particular, we have that X 1 X Pe (i, j) ≤ Pe ≤ Pe (i, j) . k−1 i<j (1.2) i<j Exercise 1.1. Show (1.2). Thus we desire to understand the magnitude of the error probability Pe (i, j) in (1.1) in the particular case when the conditional distribution of D given H is a multivariate Poisson distribution with mean vector on the order of ln (n). The following result determines this error up to first order in the exponent. Lemma 1.2 (Abbe and Sandon [2]). For any c1 , c2 ∈ (0, ∞)k with c1 6= c2 and p1 , p2 > 0, we have ! ln ln(n) X  −D+ (c1 ,c2 )− 2 ln(n) min Pln(n)c1 (x) p1 , Pln(n)c2 (x) p2 = O n , (1.3) x∈Zk+ X  min Pln(n)c1 (x) p1 , Pln(n)c2 (x) p2 = Ω k ln ln(n) −D+ (c1 ,c2 )− 2 ln(n) n ! , (1.4) x∈Zk+ where D+ (c1 , c2 ) = max t∈[0,1] X  tc1 (i) + (1 − t) c2 (i) − c1 (i)t c2 (i)1−t . (1.5) i∈[k] We do not go over the proof of this statement—which we leave to the reader as a challenging exercise—but we provide some intuition in the univariate case. Figure 3 illustrates the probability mass function of two Poisson distributions, with means λ = 20 and µ = 30, respectively. Observe that min {Pλ (x) , Pµ (x)} decays rapidly away from xmax := arg maxx∈Z+ min {Pλ (x) , Pµ (x)}, so Figure 3: Testing univariate Poisson distributions. The figure plots the probability mass function of two Poisson distributions, with means λ = 20 and µ = 30, respectively. 6 P we can obtain a good estimate of the sum x∈Z+ min {Pλ (x) , Pµ (x)} by simply estimating the term min {Pλ (xmax ) , Pµ (xmax )}. Now observe that xmax must satisfy Pλ (xmax ) ≈ Pµ (xmax ); after λ−µ some algebra this is equivalent to xmax ≈ log(λ/µ) . Let t∗ denote the maximizer in the expression of ∗ ∗ D+ (λ, µ) in (1.5). By differentiating in t, we obtain that t∗ satisfies λ − µ − log (λ/µ) · λt µ1−t = 0, ∗ ∗ ∗ ∗ λ−µ . Thus we see that xmax ≈ λt µ1−t , from which, after some algebra, we and so λt µ1−t = log(λ/µ) get that Pλ (xmax ) ≈ Pµ (xmax ) ≈ exp (−D+ (λ, µ)). The proof of (1.4) in the multivariate  case follows along the same lines: the single term corresponding to xmax := arg maxx∈Zk min Pln(n)c1 (x) , Pln(n)c2 (x) gives the lower bound. For the + upper bound of (1.3) one has to show that the other terms do not contribute much more. Exercise 1.2. Prove Lemma 1.2. Our conclusion is thus that the error exponent in testing multivariate Poisson distributions is given by the explicit quantity D+ in (1.5). The discussion in Section 1.2 then implies that D+ plays an important role in the threshold for exact recovery. In particular, it intuitively follows from Lemma 1.2 that a necessary condition for exact recovery should be that   min D+ (P Q)i , (P Q)j ≥ 1. i,j∈[k],i6=j   Suppose on the contrary that D+ (P Q)i , (P Q)j < 1 for some i and j. This implies that the  error probability in the testing problem is Ω nε−1 for some ε > 0 for all vertices in communities i and j. Since the number of vertices in these communities is linear in n, and most of the hypothesis testing problems are approximately independent, one expects there to be no error in the testing Ω(n) problems with probability at most 1 − Ω nε−1 = exp (−Ω (nε )) = o(1). 1.4 Chernoff-Hellinger divergence Before moving on to the threshold for exact recovery in the general SBM, we discuss connections of D+ to other, well-known measures of divergence. Writing  X Dt (µ, ν) := tµ (x) + (1 − t) ν (x) − µ (x)t ν (x)1−t x∈[k] we have that D+ (µ, ν) = max Dt (µ, ν) . t∈[0,1] For any fixed t, Dt can be written as Dt (µ, ν) = X  ν (x) ft x∈[k] µ (x) ν (x)  , where ft (x) = 1 − t + tx − xt , which is a convex function. Thus Dt is an f -divergence, part of a family of divergences that generalize the Kullback-Leibler (KL) divergence (also known as relative entropy), which is obtained for f (x) = x ln(x). The family of f -divergences with convex f share many useful properties, and hence have been widely studied in information theory and √ 2 √ statistics. The special case of D1/2 (µ, ν) = 12 µ − ν 2 is known Hellinger divergence. P as the t The Chernoff divergence is defined as C∗ (µ, ν) = maxt∈(0,1) − log x µ(x) ν(x)1−t , and so if µ and ν are probability vectors, then D+ (µ, ν) = 1 − e−C∗ (µ,ν) . Because of these connections, Abbe and Sandon termed D+ the Chernoff-Hellinger divergence. While the quantity D+ still might seem mysterious, even in light of these connections, a useful point of view is that Lemma 1.2 gives D+ an operational meaning. 7 1.5 Characterizing exact recoverability using CH-divergence Going back to the exact recovery problem in the general SBM, let us jump right in and state the recoverability threshold of Abbe and Sandon: exact recovery in SBM(n, p, ln(n)Q/n) is possible if and only if the CH-divergence between all pairs of community profiles is at least 1. Theorem 1.3 (Abbe and Sandon [2]). Let k ∈ Z+ denote the number of communities, let p ∈ (0, 1)k with kpk1 = 1 denote the community prior, let P = diag(p), and let Q ∈ (0, ∞)k×k be a symmetric k × k matrix with no two rows equal. Exact recovery is solvable in SBM (n, p, ln(n)Q/n) if and only if   min D+ (P Q)i , (P Q)j ≥ 1. (1.6) i,j∈[k],i6=j This theorem thus provides an operational meaning to the CH-divergence for the community recovery problem. Example 1.4 (Symmetric communities). Consider again k symmetric communities, that is, pi = 1/k for all i ∈ [k], Qi,j = a if i = j, and Qi,j = b otherwise, with a, b > 0. Then exact recovery is solvable in SBM (n, p, ln(n)Q/n) if and only if √ √ √ a − b ≥ k. (1.7) We note that in this case D+ is the same as the Hellinger divergence. Exercise 1.3. Deduce from Theorem 1.3 that (1.7) gives the threshold in the example above. 1.5.1 Achievability Let us now see how Theorem 1.3 follows from the hypothesis testing results, starting with the achievability. When the condition (1.6) holds, then Lemma 1.2 tells us that in the hypothesis testing problem between Poisson distributions the error of the MAP estimate is o(1/n). Thus if the setting of the thought experiment described in Section 1.2 applies to every vertex, then by looking at the degree profiles of the vertices we can correctly reclassify all vertices, and the probability that we make an error is o(1) by a union bound. However, the setting of the thought experiment does not quite apply. Nonetheless, in this logarithmic degree regime it is possible to partially reconstruct the labels of the vertices, with only o(n) vertices being misclassified. The details of this partial reconstruction procedure would require a separate lecture—in brief, it determines whether two vertices are in the same community or not by looking at how their log(n) size neighborhoods interact—so now we will take this for granted. It is possible to show that there exists a constant δ such that if one estimates the label of a vertex v based on classifications of its neighbors that are wrong with probability x, then the probability of misclassifying v is at most nδx times the probability of error if all the neighbors of v were classified correctly. The issue is that the standard partial recovery algorithm has a constant error rate for the classifications, thus the error rate of the degree profiling step could be nc times as large asthe error in the  hypothesis testing problem, for some c > 0. This is an issue when mini6=j D+ (P Q)i , (P Q)j < 1 + c. To get around this, one can do multiple rounds of more accurate classifications. First, one obtains a partial reconstruction of the labels with an error rate that is a sufficiently low constant. After applying the degree-profiling step to each vertex, the classification error at each vertex is now 0 O(n−c ) for some c0 > 0. Hence after applying another degree-profiling step to each vertex, the −c0 classification error at each vertex will now be at most nδ×O(n ) × o(1/n) = o(1/n). Thus applying a union bound at this stage we can conclude that all vertices are correctly labelled whp. 8 1.5.2 Impossibility The necessity of condition (1.6) was already described at a high level at the end of Section 1.3. Here we give some details on how to deal with the dependencies that arise. Assume that (1.6)  does not hold,  and let i and j be two communities that violate the condition, i.e., for which D+ (P Q)i , (P Q)j < 1. We want to argue that vertices in communities i and j cannot all be distinguished, and so any classification algorithm has to make at least one error whp. An important fact that we use is that the lower bound (1.4) arises from a particular choice of degree profile that is both likely for the two communities. Namely, define the degree profile x by j k ∗ 1−t∗ x` = (P Q)t`,i (P Q)`,j ln (n)   for every ` ∈ [k], where t∗ ∈ [0, 1] is the maximizer in D+ (P Q)i , (P Q)j , i.e., the value for     which D+ (P Q)i , (P Q)j = Dt∗ (P Q)i , (P Q)j . Then Lemma 1.2 tells us that for any vertex in community i or j, the probability that it has degree profile x is at least   Ω n−D+ ((P Q)i ,(P Q)j ) / (ln (n))k/2 ,  which is at least Ω nε−1 for some ε > 0 by assumption. To show that this holds for many vertices in communities i and j at once, we first select a random set S of n/ (ln (n))3 vertices. Whp the intersection of S with any community ` is within √ n of the expected value p` n/ (ln (n))3 , and furthermore a randomly selected vertex in S is not connected to any other vertex in S. Thus the distribution of a vertex’s degree profile excluding connections to vertices in S is essentially a multivariate Poisson distribution as before. We call a vertex in S ambiguous if for each ` ∈ [k] it has exactly x` neighbors in community ` that are not in S. By Lemma 1.2  we have that a vertex in S that is in community i or j is ambiguous with probability Ω nε−1 . By definition, for a fixed community assignment and choice of S, there is no dependence on whether two vertices are ambiguous. Furthermore, due to the choice of the size of S, whp there are at least ln (n) ambiguous vertices in community i and at least ln (n) ambiguous vertices in community j that are not adjacent to any other vertices in S. These 2 ln (n) are indistinguishable, so no algorithm classifies all of them correctly with probability greater than ln(n) 1/ 2ln(n) , which tends to 0 as n → ∞. 1.5.3 The finest exact partition recoverable We conclude by mentioning that this threshold generalizes to finer questions. If exact recovery is not possible, what is the finest partition that can be recovered? We say that exact recovery is solvable for a community partition [k] = tts=1 As , where As is a subset of [k], if there exists an algorithm that whp assigns to every vertex an element of {A1 , . . . , At } that contains its true community. The finest partition that is exactly recoverable can also be expressed using CH-divergence in a similar fashion. It is the largest collection of disjoint subsets such that the CH-divergence between these subsets is at least 1, where the CH-divergence between two subsets is defined as the minimum of the CH-divergences between any two community profiles in these subsets. Theorem 1.5 (Abbe and Sandon [2]). Under the same settings as in Theorem 1.3, exact recovery is solvable in SBM (n, p, ln(n)Q/n) for a partition [k] = tts=1 As if and only if   D+ (P Q)i , (P Q)j ≥ 1 for every i and j in different subsets of the partition. 9 2 Lecture 2: Estimating the dimension of a random geometric graph on a high-dimensional sphere Many real-world networks have strong structural features and our goal is often to recover these hidden structures. In the previous lecture we studied the fundamental limits of inferring communities in the stochastic block model, a natural generative model for graphs with community structure. Another possibility is geometric structure. Many networks coming from physical considerations naturally have an underlying geometry, such as the network of major roads in a country. In other networks this stems from a latent feature space of the nodes. For instance, in social networks a person might be represented by a feature vector of their interests, and two people are connected if their interests are close enough; this latent metric space is referred to as the social space [28]. In such networks the natural questions probe the underlying geometry. Can one detect the presence of geometry? If so, can one estimate various aspects of the geometry, e.g., an appropriately defined dimension? In this lecture we study these questions in a particularly natural and simple generative model of a random geometric graph: n points are picked uniformly at random on the d-dimensional sphere, and two points are connected by an edge if and only if they are sufficently close.4 We are particularly interested in the high-dimensional regime, motivated by recent advances in all areas of applied mathematics, and in particular statistics and learning theory, where highdimensional feature spaces are becoming the new norm. While the low-dimensional regime has been studied for a long time in probability theory [43], the high-dimensional regime brings about a host of new and interesting questions. 2.1 A simple random geometric graph model and basic questions Let us now define more precisely the random geometric graph model we consider and the questions we study. In general, a geometric graph is such that each vertex is labeled with a point in some metric space, and an edge is present between two vertices if the distance between the corresponding labels is smaller than some prespecifiedthreshold. We focus on the case where the underlying metric space is the Euclidean sphere Sd−1 = x ∈ Rd : kxk2 = 1 , and the latent labels are i.i.d. uniform random vectors in Sd−1 . We denote this model by G(n, p, d), where n is the number of vertices and p is the probability of an edge between two vertices (p determines the threshold distance for connection). This model is closely related to latent space approaches to social network analysis [28]. Slightly more formally, G(n, p, d) is defined as follows. Let X1 , . . . , Xn be independent random vectors, uniformly distributed on Sd−1 . In G(n, p, d), distinct vertices i ∈ [n] and j ∈ [n] are connected by an edge if and only if hXi , Xj i ≥ tp,d , where the threshold value tp,d ∈ [−1, 1] is such that P (hX1 , X2 i ≥ tp,d ) = p. For example, when p = 1/2 we have tp,d = 0. The most natural random graph model without any structure is the standard Erdős-Rényi random graph G(n, p), where any two of the n vertices are independently connected with probability p. We can thus formalize the question of detecting underlying geometry as a simple hypothesis testing question. The null hypothesis is that the graph is drawn from the Erdős-Rényi model, while the alternative is that it is drawn from G(n, p, d). In brief: H0 : G ∼ G(n, p), H1 : G ∼ G(n, p, d). (2.1) To understand this question, the basic quantity we need to study is the total variation distance between the two distributions on graphs, G(n, p) and G(n, p, d), denoted by TV (G(n, p), G(n, p, d)); 4 This lecture is based on [14]. 10 recall that the total variation distance between two probability measures P and Q is defined as TV (P, Q) = 12 kP − Qk1 = supA |P (A) − Q(A)|. We are interested in particular in the case when the dimension d is large, growing with n. It is intuitively clear that if the geometry is too high-dimensional, then it is impossible to detect it, while a low-dimensional geometry will have a strong effect on the generated graph and will be detectable. How fast can the dimension grow with n while still being able to detect it? Most of this lecture will focus on this question. If we can detect geometry, then it is natural to ask for more information. Perhaps the ultimate goal would be to find an embedding of the vertices into an appropriate dimensional sphere that is a true representation, in the sense that the geometric graph formed from the embedded points is indeed the original graph. More modestly, can the dimension be estimated? We touch on this question at the end of the lecture. 2.2 The dimension threshold for detecting underlying geometry The high-dimensional setting of the random geometric graph G(n, p, d) was first studied by Devroye, György, Lugosi, and Udina [22], who showed that if n is fixed and d → ∞, then TV (G(n, p), G(n, p, d)) → 0, that is, geometry is indeed lost in high dimensions. More precisely, they show that this conver2 gence happens when d  n7 2n /2 .5 This follows by observing that for fixed n, the multivariate central limit theorem implies that as d → ∞, the inner products of the latent vectors converge in distribution to a standard Gaussian:     1 d→∞ √ hXi , Xj i =⇒ N 0, I(n) . 2 d {i,j}∈([n] 2 ) The Berry-Esseen theorem gives a convergence rate, which then graph  to show that for any pallows 2 /2 n 7 n /d ; the factor of 2 comes G on n vertices, |P (G(n, p) = G) − P (G(n, p, d) = G)| = O from applying this bound to every term in the L1 distance. However, the result above is not tight, and we seek to understand the fundamental limits to detecting underlying geometry. The dimension threshold for dense graphs was recently found in [14], and it turns out that it is d ≈ n3 , in the following sense. Theorem 2.1 (Bubeck, Ding, Eldan, Rácz [14]). Let p ∈ (0, 1) be fixed. Then  0, if d  n3 , TV (G(n, p), G(n, p, d)) → 1, if d  n3 . (2.2) (2.3) Moreover, in the latter case there  exists a computationally efficient test to detect underlying geom3 etry (with running time O n ). Most of the lecture will be devoted to understanding this theorem. At the end we will consider this same question for sparse graphs (where p = c/n), where determining the dimension threshold is an intriguing open problem. 5 Throughout these notes we use standard asymptotic notation; for instance, f (t)  g (t) as t → ∞ if limt→∞ f (t) /g (t) = 0. 11 2.3 The triangle test A natural test to uncover geometric structure is to count the number of triangles in G. Indeed, in a purely random scenario, vertex u being connected to both v and w says nothing about whether v and w are connected. On the other hand, in a geometric setting this implies that v and w are close to each other due to the triangle inequality, thus increasing the probability of a connection between them. This, in turn, implies that the expected number of triangles is larger in the geometric setting, given the same edge density. Let us now compute what this statistic gives us. Figure 4: Given that u is connected to both v and w, v and w are more likely to be connected under G(n, p, d) than under G(n, p). For a graph G, let A denote its adjacency matrix, i.e., Ai,j = 1 if vertices i and j are connected, and 0 otherwise. Then TG (i, j, k) := Ai,j Ai,k Aj,k is the indicator variable that three vertices i, j, and k form a triangle, and so the number of triangles in G is X TG (i, j, k) . T (G) := {i,j,k}∈([n] 3 )  By linearity of expectation, for both models the expected number of triangles is n3 times the probability of a triangle between three specific vertices. For the Erdős-Rényi random graph the edges are independent, so the probability of a triangle is p3 , and thus we have   n 3 E [T (G(n, p))] = p . 3 For G(n, p, d) it turns out that for any fixed p ∈ (0, 1) we have    Cp 3 P TG(n,p,d) (1, 2, 3) = 1 ≈ p 1 + √ (2.4) d for some constant Cp > 0, which gives that     Cp n 3 . E [T (G(n, p, d))] ≥ p 1+ √ 3 d Showing (2.4) is somewhat involved, but in essence it follows from the concentration of measure phenomenon onthe sphere, namely that most of the mass on the high-dimensional sphere is located √  in a band of O 1/ d around the equator. We sketch here the main intuition for p = 1/2, which is illustrated in Figure 5. Let X1 , X2 , and X3 be independent uniformly distributed points in Sd−1 . Then  P TG(n,1/2,d) (1, 2, 3) = 1 = P (hX1 , X2 i ≥ 0, hX1 , X3 i ≥ 0, hX2 , X3 i ≥ 0) = P (hX2 , X3 i ≥ 0 | hX1 , X2 i ≥ 0, hX1 , X3 i ≥ 0) P (hX1 , X2 i ≥ 0, hX1 , X3 i ≥ 0) 1 = × P (hX2 , X3 i ≥ 0 | hX1 , X2 i ≥ 0, hX1 , X3 i ≥ 0) , 4 12 where the last equality follows by independence. √ So what remains is to show that this latter conditional probability is approximately 1/2 + c/ d. To compute this conditional probability what we really need to know is the typical angle is between X1 and X2 . By rotational invariance we may assume that X1 = (1, 0, 0, . . . , 0), and hence hX1 , X2 i = X2 (1), the first coordinate of X2 . One way to generate X2 is to sample a d-dimensional standard Gaussian and then normalize it by√its length. Since the norm of a d-dimensional √ standard Gaussian is very well concentrated around d, it follows that X2 (1) is on the order of 1/ d. Conditioned on X2 (1) ≥ 0, this typical angle gives the boost in the conditional probability that we see. See Figure 5 for an illustration. Figure 5: If X1 and X2 are two independent uniform points on the d-dimensional sphere Sd−1 , √ then their inner product hX1 , X2 i is on the order of 1/ d due to the concentration of measure phenomenon √ on the sphere. This then implies that the probability of a triangle in G(n, 1/2, d) is (1/2)3 + c/ d for some constant c > 0.  √  Thus we see that the boost in the number of triangles in the geometric setting is Θ n3 / d in expectation:   n Cp √ . E [T (G(n, p, d))] − E [T (G(n, p))] ≥ 3 d To be able to tell apart the two graph distributions based on the number of triangles, the boost in expectation needs to be much greater than the standard deviation. Exercise 2.1. Show that        n n 4 3 6 Var (T (G (n, p))) = p −p + p5 − p6 3 4 2 and that Var (T (G (n, p, d))) ≤ n4 . 13 Exercise 2.2. Show that if |E [T (G(n, p, d))] − E [T (G(n, p))]|  max np o p Var (T (G (n, p))), Var (T (G (n, p, d))) , then TV (G(n, p), G(n, p, d)) → 1. √ √ Putting together Exercises 2.1 and 2.2 we see that TV (G(n, p), G(n, p, d)) → 1 if n3 / d  n4 , which is equivalent to d  n2 . 2.4 Signed triangles are more powerful While triangles detect geometry up until d  n2 , are there even more powerful statistics that detect geometry for larger dimensions? One can check that longer cycles also only work when d  n2 , as do several other natural statistics. Yet it turns out that the underlying geometry can be detected even when d  n3 . The simple idea that leads to this improvement is to consider signed triangles. We have already noticed that triangles are more likely in the geometric setting than in the purely random setting. This also means that induced wedges (i.e., when there are exactly two edges among the three possible ones) are less likely in the geometric setting. Similarly, induced single edges are more likely, and induced independent sets on three vertices are less likely in the geometric setting. Figure 6 summarizes these observations. Figure 6: This figure summarizes which patterns are more or less likely in the geometric setting than in the purely random setting. The signed triangles statistic reweights the different patterns with positive and negative weights. The signed triangles statistic incorporates these observations by giving the different patterns positive or negative weights. More precisely, we define X τ (G) := (Ai,j − p) (Ai,k − p) (Aj,k − p) . {i,j,k}∈([n] 3 ) The key insight motivating this definition is that the variance of signed triangles is much smaller than the variance of triangles, due to the cancellations introduced by the centering of the adjacency  matrix: the Θ n4 term vanishes, leaving only the Θ n3 term. Exercise 2.3. Show that E [τ (G(n, p))] = 0 and   n 3 Var (τ (G(n, p))) = p (1 − p)3 . 3 14 On the other hand it can be shown that √ E [τ (G(n, p, d))] ≥ cp n3 / d, (2.5) so the gap between the expectations remains. Furthermore, it can also be shown that the variance also decreases for G(n, p, d) and we have Var (τ (G(n, p, d))) ≤ n3 + 3n4 . d (2.6) Putting everything together and using √Exercise p 2.2 for the signed triangles statistic τ , 3we get 3 that TV (G(n, p), G(n, p, d)) → 1 if n / d  n3 + n4 /d, which is equivalent to d  n . This concludes the proof of (2.3) from Theorem 2.1. 2.5 Barrier to detecting geometry: when Wishart becomes GOE We now turn to proving (2.2), which, together with (2.3), shows that the threshold dimension for detecting geometry is n3 . This also shows that the signed triangle statistic is near-optimal, since it can detect geometry whenever d  n3 . There are essentially three main ways to bound the total variation of two distributions from above: (i) if the distributions have nice formulas associated with them, then exact computation is possible; (ii) through coupling the distributions; or (iii) by using inequalities between probability metrics to switch the problem to bounding a different notion of distance between the distributions. Here, while the distribution of G(n, p, d) does not have a nice formula associated with it, the main idea is to view this random geometric graph as a function of an n × n Wishart matrix with d degrees of freedom—i.e., a matrix of inner products of n d-dimensional Gaussian vectors—denoted by W (n, d). It turns out that one can view G(n, p) as (essentially) the same function of an n×n GOE random matrix—i.e., a symmetric matrix with i.i.d. Gaussian entries on and above the diagonal— denoted by M (n). The upside of this is that both of these random matrix ensembles have explicit densities that allow for explicit computation. We explain this connection here in the special case of p = 1/2 for simplicity; see [14] for the case of general p. Recall that if Y1 is a standard normal random variable in Rd , then Y1 / kY1 k is uniformly distributed on the sphere Sd−1 . Consequently we can view G (n, 1/2, d) as a function of an appropriate Wishart matrix, as follows. Let Y be an n × d matrix where the entries are i.i.d. standard normal random variables, and let W ≡ W (n, d) = Y Y T be the corresponding n × n Wishart matrix. Note p that Wii = hYi , Yi i = kYi k2 and so hYi / kYi k , Yj / kYj ki = Wij / Wii Wjj . Thus the n × n matrix A defined as ( 1 if Wij ≥ 0 and i 6= j Ai,j = 0 otherwise has the same law as the adjacency matrix of G (n, 1/2, d). Denote the map that takes W to A by H, i.e., A = H (W ). In a similar way we can view G (n, 1/2) as a function of an n×n matrix drawn from the Gaussian Orthogonal Ensemble (GOE). Let M (n) be a symmetric n × n random matrix where the diagonal entries are i.i.d. normal random variables with mean zero and variance 2, and the entries above the diagonal are i.i.d. standard normal random variables, with the entries on and above the diagonal all independent. Then B = H (M (n)) has the same law as the adjacency matrix of G(n, p). Note that B only depends on the sign of the √ off-diagonal elements of M (n), so in the definition of B we can replace M (n) with M (n, d) := dM (n) + dIn , where In is the n × n identity matrix. 15 We can thus conclude that TV (G(n, 1/2, d), G(n, 1/2)) = TV (H (W (n, d)) , H (M (n, d))) ≤ TV (W (n, d), M (n, d)) . 2 The densities of these two random matrix ensembles are well known. Let P ⊂ Rn denote the cone of positive semidefinite matrices. When d ≥ n, W (n, d) has the following density with respect to the Lebesgue measure on P:  1 (det (A)) 2 (d−n−1) exp − 21 Tr (A) fn,d (A) := 1 , Q 1 2 2 dn π 4 n(n−1) ni=1 Γ 12 (d + 1 − i) where Tr (A) denotes the trace of the matrix A. It is also known that the density of a GOE random  1 n 2 matrix with respect to the Lebesgue measure on Rn is A 7→ (2π)− 4 n(n+1) 2− 2 exp − 14 Tr A2 2 and so the density of M (n, d) with respect to the Lebesgue measure on Rn is    1 Tr (A − dIn )2 exp − 4d . gn,d (A) := 1 n (2πd) 4 n(n+1) 2 2 These explicit formulas allow for explicit calculations. In particular, one can show that the log-ratio of the densities is o(1) with probability 1 − o(1) according to the measure induced by M (n, d). This follows from writing out the Taylor expansion of the log-ratio of the densities and using known results about the empirical spectral distribution of Wigner matrices (in particular that it converges to a semi-circle law). The outcome of the calculation is the following result, proven independently and simultaneously by Bubeck et al. and Jiang and Li. Theorem 2.2 (Bubeck, Ding, Eldan, Rácz [14]; Jiang, Li [31]). Define the random matrix ensembles W (n, d) and M (n, d) as above. If d/n3 → ∞, then TV (W (n, d) , M (n, d)) → 0. We conclude that it is impossible to detect underlying geometry whenever d  n3 . 2.6 Estimating the dimension Until now we discussed detecting geometry. However, the insights gained above allow us to also touch upon the more subtle problem of estimating the underlying dimension d. Dimension estimation can also be done by counting the “number” of signed triangles as in Section 2.4. However, here it is necessary to have a bound on the difference of the expected number of signed triangles between consecutive dimensions; the lower bound of (2.5) is not enough. Still, we believe that the right hand side of (2.5) should give the true value of the expected value for an appropriate constant cp , and hence we expect to have that  3  n E [τ (G(n, p, d))] − E [τ (G(n, p, d + 1))] = Θ . (2.7) d3/2 Thus, using the variance bound in (2.6), p we get that dimension estimation should be possible using 3 3/2 signed triangles whenever n /d  n3 + n4 /d, which is equivalent to d  n. Showing (2.7) for general p seems involved; Bubeck et al. showed that it holds for p = 1/2, which can be considered as a proof of concept. We thus have the following. 16 Theorem 2.3 (Bubeck, Ding, Eldan, Rácz [14]). There exists a universal constant C > 0 such that for all integers n and d1 < d2 , one has  TV (G(n, 1/2, d1 ), G(n, 1/2, d2 )) ≥ 1 − C d1 n 2 . This result is tight, as demonstrated by a result of Eldan [24], which states that when d  n, the Wishart matrices W (n, d) and W (n, d + 1) are indistinguishable. By the discussion in Section 2.5, this directly implies that G(n, 1/2, d) and G(n, 1/2, d + 1) are indistinguishable. Theorem 2.4 (Eldan [24]). There exists a universal constant C > 0 such that for all integers n < d, s  d+1 2 TV (G(n, 1/2, d), G(n, 1/2, d + 1)) ≤ TV (W (n, d), W (n, d + 1)) ≤ C − 1. d−n 2.7 The mysterious sparse regime The discussion so far has focused on dense graphs, i.e., assuming p ∈ (0, 1) is constant, where Theorem 2.1 tightly characterizes when the underlying geometry can be detected. The same questions are interesting for sparse graphs as well, where the average degree is constant or slowly growing with n. However, since there are so few edges, this regime is much more challenging. It is again natural to consider the number of triangles as a way to distinguish between G(n, c/n) and G(n, c/n, d). A calculation shows that this statistic works whenever d  log3 (n). Theorem 2.5 (Bubeck, Ding, Eldan, Rácz [14]). Let c > 0 be fixed and assume d/ log3 (n) → 0. Then   c  c  TV G n, , G n, , d → 1. n n In contrast with the dense regime, in the sparse regime the signed triangle statistic τ does not give significantly more power than the triangle statistic T . This is because in the sparse regime, with high probability, the graph does not contain any 4-vertex subgraph with at least 5 edges, which is where the improvement comes from in the dense regime. The authors also conjecture that log3 (n) is the correct order where the transition happens. Conjecture 2.6 (Bubeck, Ding, Eldan, Rácz [14]). Let c > 0 be fixed and assume d/ log3 (n) → ∞. Then   c  c  TV G n, , G n, , d → 0. n n The main reason for this conjecture is that, when d  log3 (n), G(n, c/n) and G(n, c/n, d) seem to be locally equivalent; in particular, they both have the same Poisson number of triangles asymptotically. Thus the only way to distinguish between them would be to find an emergent global property which is significantly different under the two models, but this seems unlikely to exist. Proving or disproving this conjecture remains a challenging open problem. The best known bound is n3 from (2.2) (which holds uniformly over p). 17 3 Lecture 3: Introduction to entropic central limit theorems and a proof of the fundamental limits of dimension estimation in random geometric graphs Recall from the previous lecturethat the dimension threshold for detecting geometry in G(n, p, d) for constant p ∈ (0, 1) is d = Θ n3 . What if the random geometric graph model is not G(n, p, d)? How robust are the results presented in the previous lecture? We have seen that the detection threshold is intimately connected to the threshold of when a Wishart matrix becomes GOE. Understanding the robustness of this result on random matrices is interesting in its own right, and this is what we will pursue in this lecture.6 Doing so also gives us the opportunity to learn about the fascinating world of entropic central limit theorems. 3.1 Setup and main result: the universality of the threshold dimension Let X be an n × d random matrix with i.i.d. entries from a distribution µ that has mean zero and variance 1. The n × n matrix XXT is known as the Wishart matrix with d degrees of freedom. As we have seen in the previous lecture, this arises naturally in geometry, where XXT is known as the Gram matrix of inner products of n points in Rd . The Wishart matrix also appears naturally in statistics as the sample covariance matrix, where d is the number of samples and n is the number of parameters.7 We refer to [16] for further applications in quantum physics, wireless communications, and optimization. We consider the Wishart matrix with the diagonal removed, and scaled appropriately:  1 Wn,d = √ XXT − diag XXT . d In many applications—such as to random graphs, as we have seen in the previous lecture—the diagonal of the matrix is not relevant, so removing it does not lose information. Our goal is to understand how large does the dimension d have to be so that Wn,d is approximately like Gn , which is defined as the n × n Wigner matrix with zeros on the diagonal and i.i.d. standard Gaussians above the diagonal. In other words, Gn is drawn from the Gaussian Orthogonal Ensemble (GOE) with the diagonal replaced with zeros. A simple application of the multivariate central limit theorem gives that if n is fixed and d → ∞, then Wn,d converges to Gn in distribution. The main result of Bubeck and Ganguly [16] establishes that this holds as long as d f  n3 under rather general conditions on the distribution µ. Theorem 3.1 (Bubeck and Ganguly [16]). If the distribution µ is log-concave8 and then TV (Wn,d , Gn ) → 0. On the other hand, if µ has a finite fourth moment and d n3 TV (Wn,d , Gn ) → 1. d n3 log2 (d) → ∞, (3.1) → 0, then (3.2) This result extends Theorems 2.1 and 2.2, and establishes n3 as the universal critical dimension (up to logarithmic factors) for sufficiently smooth measures µ: Wn,d is approximately Gaussian 6 This lecture is based on [16]. In statistics the number of samples is usually denoted by n, and the number of parameters is usually denoted by p; here our notation is taken with the geometric perspective in mind. 8 A measure µ with density f is said to be log-concave if f (·) = e−ϕ(·) for some convex function ϕ. 7 18 if and only if d is much larger than n3 . For random graphs, as seen in Lecture 2, this is the dimension barrier to extracting geometric information from a network: if the dimension is much greater than the cube of the number of vertices, then all geometry is lost. In the setting of statistics this means that the Gaussian approximation of a Wishart matrix is valid as long as the sample size is much greater than the cube of the number of parameters. Note that for some statistics of a Wishart matrix the Gaussian approximation is valid for much smaller sample sizes (e.g., the largest eigenvalue behaves as in the limit even when the number of parameters is on the same order as the sample size [34]). To distinguish the random matrix ensembles, we have seen in Lecture 2 that signed triangles work up until the threshold dimension in the case when µ is standard normal. It turns out that the same statistic works in this more general setting; when the entries of the matrices are centered,  this statistic can be written as A 7→ Tr A3 . Similarly to the calculations in Section 2.4, one √   can show that under the two measures Wn,d and Gn , the mean of Tr A3 is 0 and Θ n3 / d ,   respectively, whereas the variances are Θ n3 and Θ n3 + n5 /d2 , respectively. Then (3.2) follows by an application of Chebyshev’s inequality. We leave the details as an exercise for the reader. We note that for (3.1) to hold it is necessary to have some smoothness assumption on the distribution µ. For instance, if µ is purely atomic, then so is the distribution of Wn,d , and thus its total variation distance to Gn is 1. The log-concave assumption gives this necessary smoothness, and it is an interesting open problem to understand how far this can be relaxed. 3.2 Pinsker’s inequality: from total variation to relative entropy Our goal is now to bound the total variation distance TV (Wn,d , Gn ) from above. In the general setting considered here there is no nice formula for the density of the Wishart ensemble, so TV (Wn,d , Gn ) cannot be computed directly. Coupling these two random matrices also seems challenging. In light of these observations, it is natural to switch to a different metric on probability distributions that is easier to handle in this case. We refer the reader to the excellent paper [26] which gathers ten different probability metrics and many relations between then. Here we use Pinsker’s inequality to switch to relative entropy: 1 TV (Wn,d , Gn )2 ≤ Ent (Wn,d k Gn ) , 2 (3.3) where Ent (Wn,d k Gn ) denotes the relative entropy of Wn,d with respect to Gn . In the following subsection we provide a brief introduction to entropy; the reader familiar with the basics can safely skip this. We then turn to entropic central limit theorems and techniques involved in their proof, before finally coming back to bounding the right hand side in (3.3). 3.3 A brief introduction to entropy The entropy of a discrete random variable X taking values in X is defined as X H(X) ≡ H(p) = − p (x) log (p (x)) , x∈X where p denotes the probability mass function of X. The log is commonly taken to have base 2, in which case entropy is measured in bits; if one considers the natural logarithm ln then it is measured in nats. Note that entropy is always nonnegative, since p(x) ≤ 1 for every x ∈ X . This is a measure of uncertainty of a random variable. It measures how much information is required 19 on average to describe the random variable. Many properties of entropy agree with the intuition of what a measure of information should be. A useful way of thinking about entropy is the following: if we have an i.i.d. sequence of random variables and we know that the source distribution is p, then we can construct a code with average description length H(p). Example 3.2. If X is uniform on a finite space X , then H(X) = log |X |. For continuous random variables the differential entropy is defined as Z h (X) ≡ h (f ) = − f (x) log f (x) dx, where f is the density of the random variable X. Example 3.3. If X is uniform on the interval [0, a], then h(X) = log (a). If X is Gaussian with mean zero and variance σ 2 , then h(X) = 21 log 2πeσ 2 . Note that these examples show that differential entropy can be negative. One way to think of differential entropy is to think of 2h(X) as “the volume of the support”. The relative entropy of two distributions P and Q on a discrete space X is defined as D (P k Q) = X P (x) log x∈X P (x) . Q(x) For two distributions with densities f and g the relative entropy is defined as Z f (x) D (f k g) = f (x) log . g(x) x∈X Relative entropy is always nonnegative; this follows from Jensen’s inequality. Relative entropy can be interpreted as a measure of distance between two distributions, although it is not a metric: it is not symmetric and it does not obey the triangle inequality. It can be thought of as a measure of inefficiency of assuming that the source distribution is q when it is really p. If we use a code for distribution q but the source is really from p, then we need H(p) + D(p k q) bits on average to describe the random variable. In the following we use Ent to denote all notions of entropy and relative entropy. We also slightly abuse notation and interchangeably use a random variable or its law in the argument of entropy and relative entropy. Entropy and relative entropy satisfy useful chain rules; we leave the proof of the following identities as an exercise for the reader. For entropy we have: Ent (X1 , X2 ) = Ent (X1 ) + Ent (X2 | X1 ) . For relative entropy we have: Ent ((Y1 , Y2 ) k (Z1 , Z2 )) = Ent (Y1 k Z1 ) + Ey∼λ1 Ent (Y2 | Y1 = y k Z2 | Z1 = y) , (3.4) where λ1 is the marginal distribution of Y1 and Y2 | Y1 = y denotes the distribution of Y2 conditionally on the event {Y1 = y}. 20 Let φ denote the density of γn , the n-dimensional standard Gaussian distribution, and let f be an isotropic density with mean zero, i.e., a density for which the covariance matrix is the identity In . Then Z Z 0 ≤ Ent (f k φ) = f log f − f log φ Z Z = f log f − φ log φ = Ent (φ) − Ent (f ) , where the second equality follows from the fact that log φ (x) is quadratic in x, and the first two moments of f and φ are the same by assumption. We thus see that the standard Gaussian maximizes entropy among isotropic densities. 3.4 An introduction to entropic CLTs At this point we are ready to state the entropic central limit theorem. The central limit theorem states that if Z1 , Z2 , . . . are i.i.d. real-valued random variables with zero mean and unit variance, √ then Sm := (Z1 + · · · + Zm ) / m converges in distribution to a standard Gaussian random variable as m → ∞. There are many other senses in which Sm converges to a standard Gaussian, the entropic CLT being one of them. Theorem 3.4 (Entropic CLT). Let Z1 , Z2 , . . . be i.i.d. real-valued random variables with zero mean √ and unit variance, and let Sm := (Z1 + · · · + Zm ) / m. If Ent (Z1 k φ) < ∞, then Ent (Sm ) % Ent (φ) as m → ∞. Moreover, the entropy of Sm increases monotonically, i.e., Ent (Sm ) ≤ Ent (Sm+1 ) for every m ≥ 1. The condition Ent (Z1 k φ) < ∞ is necessary for an entropic CLT to hold; for instance, if the Zi are discrete, then h (Sm ) = −∞ for all m. The entropic CLT originates with Shannon in the 1940s and was first proven by Linnik [37] in 1959 (without the monotonicity part of the statement). The first proofs that gave explicit convergence rates were given independently and at roughly the same time by Artstein, Ball, Barthe, and Naor [6, 4, 5], and Johnson and Barron [33] in the early 2000s, using two different techniques. The fact that Ent (S1 ) ≤ Ent (S2 ) follows from the entropy power inequality, which goes back to Shannon [48] in 1948. This implies that Ent (Sm ) ≤ Ent (S2m ) for all m ≥ 0, and so it was naturally conjectured that Ent (Sm ) increases monotonically. However, proving this turned out to be challenging. Even the inequality Ent (S2 ) ≤ Ent (S3 ) was unknown for over fifty years, until Artstein, Ball, Barthe, and Naor [4] proved in general that Ent (Sm ) ≤ Ent (Sm+1 ) for all m ≥ 1. In the following we sketch some of the main ideas that go into the proof of these results, in particular following the techniques of Artstein, Ball, Barthe, and Naor [6, 4, 5]. 3.5 From relative entropy to Fisher information Our goal is to show that some random variable Z, which is a convolution of many i.i.d. random variables, is close to a Gaussian G. One way to approach this is to interpolate between the two. There are several ways of doing this; for our purposes interpolation along the Ornstein-Uhlenbeck semigroup is most useful. Define p Pt Z := e−t Z + 1 − e−2t G 21 for t ∈ [0, ∞), and let ft denote the density of Pt Z. We have P0 Z = Z and P∞ Z = G. This semigroup has several desirable properties. For instance, if the density of Z is isotropic, then so is ft . Before we can state the next desirable property that we will use, we need to introduce a few more useful quantities. For a density function f : Rn → R+ , let Z h i ∇f (∇f )T I (f ) := = E (∇ log f ) (∇ log f )T f be the Fisher information matrix. The Cramér-Rao bound states that Cov (f )  I (f )−1 . More generally this holds for the covariance of any unbiased estimator of the mean. The Fisher information is defined as I (f ) := Tr (I (f )) . It is sometimes more convenient to work with the Fisher information distance, defined as J(f ) := I(f ) − I(φ) = I(f ) − n. Similarly to the discussion above, one can show that the standard Gaussian minimizes the Fisher information among isotropic densities, and hence the Fisher information distance is always nonnegative. Now we are ready to state the De Bruijn identity [49], which characterizes the change of entropy along the Ornstein-Uhlenbeck semigroup via the Fisher information distance: ∂t Ent (ft ) = J (ft ) . This implies that the relative entropy between f and φ—which is our quantity of interest—can be expressed as follows: Z ∞ Ent (f k φ) = Ent (φ) − Ent (f ) = J (ft ) dt. (3.5) 0 Thus our goal is to bound the Fisher information distance J(ft ). 3.6 Bounding the Fisher information distance We first recall a classical result by Blachman [10] and Stam [49] that shows that Fisher information decreases under convolution. Theorem 3.5 (Blachman [10]; Stam [49]). Let Y1 , . . . , Yd be independent random variables taking values in R, and let a ∈ Rd be such that kak2 = 1. Then I d X ! ai Yi ≤ i=1 d X a2i I (Yi ) . i=1 In the i.i.d. case, this bound becomes kak22 I (Y1 ). Artstein, Ball, Barthe, and Naor [6, 4] gave the following variational characterization of the Fisher information, which gives a particularly simple proof of Theorem 3.5. 22 Theorem 3.6 (Variational characterization of Fisher information [6, 4]). Let w : Rd → (0, ∞) be a sufficiently smooth9 density on Rd , let a ∈ Rd be a unit vector, and let h be the marginal of w in direction a. Then we have  Z  div (pw) 2 I (h) ≤ w (3.6) w Rd for any continuously differentiable vector p : Rd → Rd with the property that for every x, R field hp (x) , ai = 1. Moreover, if w satisfies kxk2 w (x) < ∞, then there is equality for some suitable vector field p. The Blachman-Stam theorem follows from this characterization by taking the constant vector field p ≡ a. Then we have div (pw) = h∇w, ai, and so the right hand side of (3.6) becomes aT I (w) a, where recall that I is the Fisher information matrix. In the setting of Theorem 3.5 the density w of (Y1 , . . . , Yd ) is a product density: w (x1 , . . . , xd ) = f1 (x1 )×· · ·×fd (xd ), where fi is the density of Yi . Consequently the Fisher matrix is a diagonal matrix, I (w) = diag (I (f1 ) , . . . , I (fd )), Pdinformation T 2 and thus a I (w) a = i=1 ai I (fi ), concluding the proof of Theorem 3.5 using Theorem 3.6. Given the characterization of Theorem 3.6, one need not take the vector field to be constant; one can obtain more by optimizing over the vector field. Doing this leads to the following theorem, which gives a rate of decrease of the Fisher information distance under convolutions. Theorem 3.7 (Artstein, Ball, Barthe, and Naor [6, 4, 5]). Let Y1 , . . . , Yd be i.i.d. random variables with a density having a positive spectral gap c.10 Then for any a ∈ Rd with kak2 = 1 we have that ! d X 2 kak44 J ai Yi ≤ J (Y1 ) . c + (2 − c) kak44 i=1 When a = √1 1, d then 2kak44 c+(2−c)kak44 = O (1/d), and thus using (3.5) we obtain a rate of convergence of O (1/d) in the entropic CLT. A result similar to Theorem 3.7 was proven independently and roughly at the same time by Johnson and Barron [33] using a different approach involving score functions. 3.7 A high-dimensional entropic CLT The techniques of Artstein, Ball, Barthe, and Naor [6, 4, 5] generalize to higher dimensions, as was recently shown by Bubeck and Ganguly [16]. A result similar to Theorem 3.7 can be proven, from which a high-dimensional entropic CLT follows, together with a rate of convergence, by using (3.5) again. Theorem 3.8 (Bubeck and Ganguly [16]). Let Y ∈ Rd be a random vector with i.i.d. entries from a distribution ν with zero mean, unit variance, and spectral gap c ∈ (0, 1]. Let A ∈ Rn×d be a matrix such that AAT = In , the n × n identity matrix. Let ε = maxi∈[d] AT A i,i and ζ =  maxi,j∈[d],i6=j AT A i,j . Then we have that   Ent (AY k γn ) ≤ n min 2 ε + ζ 2 d /c, 1 Ent (ν k γ1 ) , where γn denotes the standard Gaussian measure in Rn . R R It is enough that w is continuously twice differentiable and satisfies k∇wk2 /w < ∞ and kHess (w)k < ∞. 10 We say that a random variable has spectral gap c if for every sufficiently smooth g, we have Var (g) ≤ 1c Eg 02 . In particular, log-concave random variables have a positive spectral gap, see [11]. 9 23 To interpret this result, consider the case where the matrix A is built by picking rows one after the other uniformly at random on the Euclidean sphere in Rd , conditionally on being orthogonal to previous rows (to satisfy the isotropicity condition AAT = In ). We then expect to have ε ' n/d √ and ζ ' n/d (we leave the details as an exercise for the reader), and so Theorem 3.8 tells us that Ent (AY k γn ) . n2 /d. 3.8 Back to Wishart and GOE We now turn our attention back to bounding the relative entropy Ent (Wn,d k Gn ) between the n × n Wishart matrix with d degrees of freedom (with the diagonal removed), Wn,d , and the n × n GOE matrix (with the diagonal removed), Gn ; recall (3.3). Since the Wishart matrix contains the (scaled) inner products of n vectors in Rd , it is natural to relate Wn+1,d and Wn,d , since the former comes from the latter by adding an additional d-dimensional vector to the n vectors already present. Specifically, we have the following: ! √1 XX Wn,d d Wn+1,d = , √1 (XX)T 0 d where X is a d-dimensional random vector with i.i.d. entries from µ, which are also independent from X. Similarly we can write the matrix Gn+1 using Gn :   Gn γ n Gn+1 = . γnT 0 This naturally suggests to use the chain rule for relative entropy and bound Ent (Wn,d k Gn ) by induction on n. By (3.4) we get that h  i Ent (Wn+1,d k Gn+1 ) = Ent (Wn,d k Gn ) + EWn,d Ent √1d XX | Wn,d k γn . By convexity of the relative entropy we also have that h  i h  i EWn,d Ent √1d XX | Wn,d k γn ≤ EX Ent √1d XX | X k γn . Thus our goal is to understand and bound Ent (AX k γn ) for A ∈ Rn×d , and then apply the bound to A = √1d X (followed by taking expectation over X). This is precisely what was done in Theorem 3.8, the high-dimensional entropic CLT, for A satisfying AAT = In . Since A = √1 X d does not necessarily satisfy AAT = In , we have to correct for the lack of isotropicity. This is the content of the following lemma, the proof of which we leave as an exercise for the reader. Lemma 3.9 ([16]). Let A ∈ Rn×d and Q ∈ Rn×n be such that QA (QA)T = In . Then for any isotropic random variable X taking values in Rd we have that  n 1 1 Ent (AX k γn ) = Ent (QAX k γn ) + Tr AAT − + log |det (Q)| . (3.7) 2 2 2 −1/2  We then apply this lemma with A = √1d X and Q = d1 XXT . Observe that ETr AAT =  1 T = 1 × n × d = n, and hence in expectation the middle two terms of the right hand d ETr XX d side of (3.7) cancel each other out.  The last term in (3.7), − 41 log det d1 XXT , should be understood as the relative entropy between a centered Gaussian with covariance given by d1 XXT and a standard Gaussian in Rn . Controlling 24 the expectation of this term requires studying the probability that XXT is close to being noninvertible, which requires bounds on the left tail of the smallest singular of X. Understanding the extreme singular values of random matrices is a fascinating topic, but it is outside of the scope of these notes, and so we refer the reader to [16] for more details on this point. Finally, the high-dimensional entropic CLT can now be applied to see that Ent (QAX k γn ) . n2 /d. From the induction on n we get another factor of n, arriving at Ent (Wn,d k Gn ) . n3 /d. We conclude that the dimension threshold is d ≈ n3 , and the information-theoretic proof that we have outlined sheds light on why this threshold is n3 . 25 4 Lectures 4 & 5: Confidence sets for the root in uniform and preferential attachment trees In the previous lectures we studied random graph models with community structure and also models with an underlying geometry. While these models are important and lead to fascinating problems, they are also static in time. Many real-world networks are constantly evolving, and their understanding requires models that reflect this. This point of view brings about a host of new interesting and challenging statistical inference questions that concern the temporal dynamics of these networks. In the last two lectures we will study such questions: given the current state of a network, can one infer the state at some previous time? Does the initial seed graph have an influence on how the network looks at large times? If so, is it possible to find the origin of a large growing network? We will focus in particular on this latter question. More precisely, given a model of a randomly growing graph starting from a single node, called the root, we are interested in the following question. Given a large graph generated from the model, is it possible to find a small set of vertices for which we can guarantee that the root is in this set with high probability? Such root-finding algorithms can have applications to finding the origin of an epidemic or a rumor. 4.1 Models of growing graphs A natural general model of randomly growing graphs can be defined as follows. For n ≥ k ≥ 1 and a graph S on k vertices, define the random graph G(n, S) by induction. First, set G(k, S) = S; we call S the seed of the graph evolution process. Then, given G(n, S), G(n + 1, S) is formed from G(n, S) by adding a new vertex and some new edges according to some adaptive rule. If S is a single vertex, we write simply G(n) instead of G(n, S). There are several rules one can consider; here we study perhaps the two most natural rules: uniform attachment and preferential attachment. Moreover, for simplicity we focus on the case of growing trees, where at every time step a single edge is added. Uniform attachment trees are perhaps the simplest model of randomly growing graphs and are defined as follows. For n ≥ k ≥ 1 and a tree S on k vertices, the random tree UA(n, S) is defined as follows. First, let UA(k, S) = S. Then, given UA(n, S), UA(n + 1, S) is formed from UA(n, S) by adding a new vertex u and adding a new edge uv where the vertex v is chosen uniformly at random among vertices of UA (n, S), independently of all past choices. In preferential attachment the vertex is chosen with probability proportional to its degree [38, 7, 12]. For a tree T denote by dT (u) the degree of vertex u in T . For n ≥ k ≥ 2 and a tree S on k vertices we define the random tree PA(n, S) by induction. First, let PA(k, S) = S. Then, given PA(n, S), PA(n + 1, S) is formed from PA(n, S) by adding a new vertex u and a new edge uv where v is selected at random among vertices in PA(n, S) according to the following probability distribution: P (v = i | PA(n, S)) = dPA(n,S) (i) . 2 (n − 1) Figure 7: Growing trees: add a new vertex u and attach it to an existing vertex v according some adaptive probabilistic rule. 26 4.2 Questions: detection and estimation The most basic questions to consider are those of detection and estimation. Can one detect the influence of the initial seed graph? If so, is it possible to estimate the seed? Can one find the root if the process was started from a single node? We introduce these questions in the general model of randomly growing graphs described above, even though we study them in the special cases of uniform and preferential attachment trees later. The detection question can be rephrased in the terminology of hypothesis testing. Given two potential seed graphs S and T , and an observation R which is a graph on n vertices, one wishes to test whether R ∼ G(n, S) or R ∼ G(n, T ). The question then boils down to whether one can design a test with asymptotically (in n) nonnegligible power. This is equivalent to studying the total variation distance between G(n, S) and G(n, T ), so we naturally define δ(S, T ) := lim TV(G(n, S), G(n, T )), n→∞ where G(n, S) and G(n, T ) are random elements in the finite space of unlabeled graphs with n vertices. This limit is well-defined because TV(G(n, S), G(n, T )) is nonincreasing in n (since if G(n, S) = G(n, T ), then the evolution of the random graphs can be coupled such that G(n0 , S) = G(n0 , T ) for all n0 ≥ n) and always nonnegative. If the seed has an influence, it is natural to ask whether one can estimate S from G(n, S) for large n. If so, can the subgraph corresponding to the seed be located in G(n, S)? We study this latter question in the simple case when the process starts from a single vertex called the root.11 A root-finding algorithm is defined as follows. Given G(n) and a target accuracy ε ∈ (0, 1), a rootfinding algorithm outputs a set H (G(n), ε) of K(ε) vertices such that the root is in H (G(n), ε) with probability at least 1 − ε (with respect to the random generation of G(n)). An important aspect of this definition is that the size of the output set is allowed to depend on ε, but not on the size n of the input graph. Therefore it is not clear that root-finding algorithms exist at all. Indeed, there are examples when they do not exist: consider a path that grows by picking one of its two ends at random and extending it by a single edge. However, it turns out that in many interesting cases root-finding algorithms do exist. In such cases it is natural to ask for the best possible value of K(ε). 4.3 The influence of the seed Consider distinguishing between a preferential attachment tree started from a star with 10 vertices, S10 , and a preferential attachment tree started from a path with 10 vertices, P10 . Since the preferential attachment mechanism incorporates the rich-get-richer phenomenon, one expects the degree of the center of the star in PA(n, S10 ) to be significantly larger than the degree of any of the initial vertices in the path in PA(n, P10 ). This intuition guided Bubeck, Mossel, and Rácz [17] when they initiated the theoretical study of the influence of the seed in preferential attachment trees. They showed that this intuition is correct: the limiting distribution of the maximum degree of the preferential attachment tree indeed depends on the seed. Using this they were able to show that for any two seeds S and T with at least 3 vertices12 and different degree profiles we have δPA (S, T ) > 0. 11 In the case of preferential attachment, starting from a single vertex is not well-defined; in this case we start the process from a single edge and the goal is to find one of its endpoints. 12 This condition is necessary for a simple reason: the unique tree on 2 vertices, S2 , is always followed by the unique tree on 3 vertices, S3 , and hence δ(S2 , S3 ) = 0 for any model of randomly growing trees. 27 However, statistics based solely on degrees cannot distinguish all pairs of nonisomorphic seeds. This is because if S and T have the same degree profiles, then it is possible to couple PA(n, S) and PA(n, T ) such that they have the same degree profiles for every n. In order to distinguish between such seeds, it is necessary to incorporate information about the graph structure into the statistics that are studied. This was done successfully by Curien, Duquesne, Kortchemski, and Manolescu [20], who analyzed statistics that measure the geometry of large degree nodes. These results can be summarized in the following theorem. Theorem 4.1. The seed has an influence in preferential attachment trees in the following sense. For any trees S and T that are nonisomorphic and have at least 3 vertices, we have δPA (S, T ) > 0. In the case of uniform attachment, degrees do not play a special role, so initially one might even think that the seed has no influence in the limit. However, it turns out that the right perspective is not to look at degrees but rather the sizes of appropriate subtrees (we shall discuss such statistics later). By extending the approach of Curien et al. [20] to deal with such statistics, Bubeck, Eldan, Mossel, and Rácz [15] showed that the seed has an influence in uniform attachment trees as well. Theorem 4.2. The seed has an influence in uniform attachment trees in the following sense. For any trees S and T that are nonisomorphic and have at least 3 vertices, we have δUA (S, T ) > 0. These results, together with a lack of examples showing opposite behavior, suggest that for most models of randomly growing graphs the seed has influence. Question 4.3. How common is the phenomenon observed in Theorems 4.1 and 4.2? Is there a natural large class of randomly growing graphs for which the seed has an influence? That is, models where for any two seeds S and T (perhaps satisfying an extra condition), we have δ(S, T ) > 0. Is there a natural model where the seed has no influence? The extra condition mentioned in the question could be model-dependent, but should not be too restrictive. It would be fascinating to find a natural model where the seed has no influence in a strong sense. Even for models where the seed does have an influence, proving the statement in full generality is challenging and interesting. 4.4 Finding Adam These theorems about the influence of the seed open up the problem of finding the seed. Here we present the results of Bubeck, Devroye, and Lugosi [13] who first studied root-finding algorithms in the case of uniform attachment and preferential attachment trees. They showed that root-finding algorithms indeed exist for preferential attachment trees and that the size of the best confidence set is polynomial in 1/ε. Theorem 4.4. There exists a polynomial time root-finding algorithm for preferential attachment 2 trees with K(ε) ≤ c log ε(1/ε) for some finite constant c. Furthermore, there exists a positive constant 4 0 0 c such that any root-finding algorithm for preferential attachment trees must satisfy K(ε) ≥ cε . They also showed the existence of root-finding algorithms for uniform attachment trees. In this model, however, there are confidence sets whose size is subpolynomial in 1/ε. Moreover, the size of any confidence set has to be at least superpolylogarithmic in 1/ε. Theorem 4.5. There  exists apolynomial time root-finding algorithm for uniform attachment trees with K(ε) ≤ exp c loglog(1/ε) for some finite constant c. Furthermore, there exists a positive log(1/ε) 0 constant  pc such that  any root-finding algorithm for uniform attachment trees must satisfy K(ε) ≥ 0 exp c log(1/ε) . 28 These theorems show an interesting quantitative difference between the two models: finding the root is exponentially more difficult in preferential attachment than in uniform attachment. While this might seem counter-intuitive at first, the reason behind this can be traced back to the rich-get-richer phenomenon: the effect of a rare event where not many vertices attach to the root gets amplified by preferential attachment, making it harder to find the root. In the remaining part of these lectures we explain the basic ideas that go into proving Theorems 4.4 and 4.5 and prove some simpler special cases. Before we do so, we give a primer on Pólya urns, whose variants appear throughout the proofs. If the reader is familiar with Pólya urns, then the following subsection can be safely skipped. 4.5 Pólya urns: the building blocks of growing graph models While uniform attachment and preferential attachment are arguably the most basic models of randomly growing graphs, the evolution of various simple statistics, such as degrees or subtree sizes, can be described using even simpler building blocks: Pólya urns. This subsection aims to give a brief introduction into the well-studied world of Pólya urns, while simultaneously showing examples of how these urn models show up in uniform attachment and preferential attachment. 4.5.1 The classical Pólya urn The classical Pólya urn [23] starts with an urn filled with b blue balls and r red balls. Then at every time step you put your hand in the urn, without looking at its contents, and take out a ball sampled uniformly at random. You observe the color of the ball, put it back into the urn, together with another ball of the same color. This process is illustrated in Figure 8. Figure 8: A realization of Pólya’s urn with b = 3 blue balls and r = 2 red balls initially. We are interested in the fraction of blue and red balls in the urn at large times. Let Xn denote the number of blue balls in the urn when there are n balls in the urn in total; initially we have Xb+r = b. Furthermore, let xn = Xn /n denote the fraction of blue balls when there are n balls in total. Let us start by computing the expected increase in the number of blue balls at each time step:     Xn Xn 1 E [Xn+1 | Xn ] = (Xn + 1) × + Xn × 1 − = 1+ Xn . n n n Dividing this by (n + 1) we obtain that E [xn+1 | Fn ] = xn , where Fn denotes the filtration of the process up until time n (when there are n balls in the urn); since Xn is a Markov process, this is equivalent to conditioning on Xn . Thus the fraction of blue balls does not change in expectation; in other words, xn is a martingale. Since xn is also bounded (xn ∈ [0, 1]), it follows that xn converges almost surely to a limiting random variable. Readers 29 not familiar with martingales should not be discouraged, as it is simple to see heuristically that xn converges: when there are n balls in the urn, the change in xn is on the order of 1/n, which converges to zero fast enough that one expects xn to converge.13 Our next goal is to understand the limiting distribution of xn . First, let us compute the probability of observing the first five draws as in Figure 8, starting with a blue ball, then a red, then two blue ones, and lastly another red: this probability is 35 × 26 × 74 × 58 × 39 . Notice that the probability of obtaining 3 blue balls and 2 red ones in the first 5 draws is the same regardless of the order in which we draw the balls. This property of the sequence Xn is known as exchangeability and has several useful consequences (most of which we will not explore here). It follows that the probability of seeing k blue balls in the first n draws takes on the following form:   n b (b + 1) . . . (b + k − 1) × r (r + 1) . . . (r + n − k − 1) P (Xn+b+r = b + k) = k (b + r) (b + r + 1) . . . (b + r + n − 1) From this formula one can read off that Xn+b+r − b is distributed according to the beta-binomial distribution with parameters (n, b, r). An alternative way of sampling from the beta-binomial distribution is to first sample a probability p from the beta distribution with parameters b and r Γ(b+r) b−1 (having density x 7→ Γ(b)Γ(r) x (1 − x)r−1 1{x∈[0,1]} ), and then conditionally on p, sample from the binomial distribution with n trials and success probability p. Conditionally on p, the strong law of large numbers applied to the binomial distribution thus tells us that (Xn+b+r − b) /n converges almost surely to p. Since xn = (Xn+b+r − b) /n + o(1), it follows that xn → p almost surely. We have thus derived the following theorem. Theorem 4.6. Let xn denote the fraction of blue balls at time n (when there are n balls in total) in a classical Pólya urn which starts with b blue balls and r red balls. Then lim xn = x n→∞ almost surely, where x ∼ Beta (b, r). Example 4.7. The classical Pólya urn shows up in uniform attachment trees as it describes the evolution of subtree sizes as follows. Pick an edge of a tree, such as edge e in tree S in Figure 9, Figure 9: The subtree sizes in uniform attachment trees evolve according to the classical Pólya urn. with endpoints v` and vr . This edge partitions the tree into two parts on either side of the edge: a   The reader can convince themselves that E (xn+1 − xn )2 Fn = P time N onwards is bounded by n≥N (n + 1)−2 ≤ 1/N . 13 30 xn (1−xn ) , (n+1)2 and so the sum of the variances from subtree under v` and a subtree under vr . The sizes of these subtrees (i.e., the number of vertices they contain) evolve exactly like the classical Pólya urn described above (in the example depicted in Figure 9 we have b = 6 and r = 2 initially). 4.5.2 Multiple colors A natural generalization is to consider multiple colors instead of just two. Let m be the number of colors, let X n = (Xn,1 , . . . , Xn,m ) denote the number of balls of each color when there are n balls in the urn in total, and let xn = X n /n. Assume that initially there are ri balls of color i. In this case the fraction of balls of each color converges to the natural multivariate generalization of the beta distribution: the Dirichlet distribution. The Dirichlet distribution with parameters (r1 , . . . , rm ), denoted Dir (r1 , . . . , rm ), has density x = (x1 , . . . , xm ) 7→ P Γ( m r) P Qm i=1 i xr1 −1 . . . xrm −1 1 . m 1 {∀i : xi ∈[0,1], m i=1 xi =1} i=1 Γ(ri ) It has several natural properties that one might expect, for instance the aggregation property, that if one groups coordinates i and j together, then the resulting distribution is still Dirichlet, with parameters ri and rj replaced by ri + rj . This also implies that the univariate marginals are beta distributions. The convergence result for multiple colors follows similarly to the one for two colors, so we simply state the result. Theorem 4.8. Let xn denote the fraction of balls of each color at time n (when there are n balls in total) in a classical Pólya urn of m colors which starts with ri balls of color i. Then lim xn = x n→∞ almost surely, where x ∼ Dir (r1 , . . . , rm ). Example 4.9. A Pólya urn with multiple colors shows up in uniform attachment trees when we partition the tree into multiple subtrees. Picking a subtree of m vertices as highlighted in bold in Figure 10: The sizes of multiple subtrees in uniform attachment trees evolve according to a Pólya urn with multiple colors. Figure 10, the tree is partitioned into m subtrees. The sizes of these subtrees (i.e., the number of vertices they contain) evolve exactly like the classical Pólya urn with m colors described above. 31 4.5.3 Adding multiple balls at a time It is also natural to consider adding more than one extra ball at each time step. The effect of this is to change the parameter of the limiting Dirichlet distribution. Theorem 4.10. Let xn denote the fraction of balls of each color at time n (when there are n balls in total) in a Pólya urn of m colors which starts with ri balls of color i and where k balls of the same color are added at each time step. Then lim xn = x n→∞ almost surely, where x ∼ Dir (r1 /k, . . . , rm /k). Example 4.11. Pólya urns where two balls of the same color are added at each time step appear in preferential attachment trees as follows. Consider partitioning the tree into m subtrees as in Figure 10, but now define the size of a subtree to be the sum of the degrees of the vertices in it. Consider which subtree the new incoming vertex attaches to. In the preferential attachment process each subtree is picked with probability proportional to its size and whichever subtree is picked, the sum of the degrees (i.e., the size) increases by 2 due to the new edge. Thus the subtree sizes evolve exactly according to a Pólya urn described above with k = 2. 4.5.4 More general urn models More generally, one can add some number of balls of each color at each time step. The replacement rule is often described by a replacement matrix of size m × m, where the ith row of the matrix describes how many balls of each color to add to the urn if a ball of color i is drawn. The urn models studied above correspond to replacement matrices that are a constant multiple of the identity. The literature on general replacement matrices is vast and we do not intend to discuss it here; our goal is just to describe the simple case when the replacement matrix is ( 21 01 ). We refer to [30] for detailed results on triangular replacement matrices, and to the references therein for more general replacement rules. The urn model with replacement matrix ( 21 01 ) can also be described as the classical Pólya urn with two colors as described in Section 4.5.1, but in addition a blue ball is always added at each time step. It is thus natural to expect that there will be many more blue balls than red balls in √ the urn at large times. It turns out that the number of red balls at time n scales as n instead of linearly in n. The following result is a special case of what is proved in [30]. Theorem 4.12. Let (Xn , Yn ) denote the number of blue and red balls, respectively, at time n (when there are n balls in total) in a Pólya urn with replacement matrix ( 21 01 ). Assume that initially there √ are some red balls in the urn. Then Yn / n converges in distribution to a nondegenerate random variable. Example 4.13. The evolution of the degree of any given vertex in a preferential attachment tree can be understood through such a Pólya urn. More precisely, fix a vertex v in the tree, let Yn denote the degree of v when there are n vertices in total, and let Xn denote the sum of the degrees of all other vertices. Then (Xn , Yn ) evolves exactly according to a Pólya urn with replacement matrix √ ( 21 01 ). This implies that the degree of any fixed vertex scales as n in the preferential attachment tree. 4.6 Proofs using Pólya urns With the background on Pólya urns covered, we are now ready to understand some of the proofs of the results concerning root-finding algorithms from [13]. 32 4.6.1 A root-finding algorithm based on the centroid We start by presenting a simple root-finding algorithm for uniform attachment trees. This algorithm is not optimal, but its analysis is simple and highlights the basic ideas. For a tree T , if we remove a vertex v ∈ V (T ), then the tree becomes a forest consisting of disjoint subtrees of the original tree. Let ψT (v) denote the size (i.e., the number of vertices) of the largest component of this forest. For example, in Figure 9 if we remove vr from S, then the tree breaks into a singleton and a star consisting of 6 vertices; thus ψS (vr ) = 6. A vertex v that minimizes ψT (v) is known as a centroid of T ; one can show that there can be at most two centroids. We define the confidence set Hψ by taking the set of K vertices with smallest ψ values. Theorem 4.14. [13] The centroid-based Hψ defined above is a root-finding algorithm for the uniform attachment tree. More precisely, if K ≥ 25 log(1/ε) , then ε lim inf P (1 ∈ Hψ (UA (n)◦ )) ≥ 1 − n→∞ 4ε , 1−ε where 1 denotes the root, and UA (n)◦ denotes the unlabeled version of UA (n). Proof. We label the vertices of the uniform attachment tree in chronological order. We start by introducing some notation that is useful throughout the proof. For 0 ≤ i ≤ k, denote by Ti,k the tree containing vertex i in the forest obtained by removing in UA (n) all edges between vertices {1, . . . , k}. Also, let |T | denote the size of a tree T , i.e., the number of vertices it contains. Note that the vector (|T1,k | , . . . , |Tk,k |) evolves according to the classical Pólya urn with k colors as described in Section 4.5.2, with initial state (1, . . . , 1). Therefore, by Theorem 4.8, the normalized vector (|T1,k | , . . . , |Tk,k |) /n converges in distribution to a Dirichlet distribution with parameters (1, . . . , 1). Now observe that P (1 ∈ / Hψ ) ≤ P (∃i > K : ψ (i) ≤ ψ (1)) ≤ P (ψ (1) ≥ (1 − ε) n) + P (∃i > K : ψ (i) ≤ (1 − ε) n) . We bound the two terms appearing above separately, starting with the first one. Note that ψ (1) ≤ max {|T1,2 | , |T2,2 |}, and both |T1,2 | /n and |T2,2 | /n converge in distribution to a uniform random variable in [0, 1]. Hence a union bound gives us that lim sup P (ψ (1) ≥ (1 − ε) n) ≤ 2 lim P (|T1,2 | ≥ (1 − ε) n) = 2ε. n→∞ n→∞ For the other term, first observe that for any i > K we have K X ψ (i) ≥ min 1≤k≤K |Tj,K | . j=1,j6=k Now using the results on PPólya urns from Section 4.5 we have that for every k such that 1 ≤ k ≤ K, the random variable n1 K j=1,j6=k |Tj,K | converges in distribution to the Beta (K − 1, 1) distribution. Hence by a union bound we have that   K X lim sup P (∃i > K : ψ (i) ≤ (1 − ε) n) ≤ lim P ∃1 ≤ k ≤ K : |Tj,K | ≤ (1 − ε) n n→∞ n→∞ j=1,j6=k K−1 ≤ K (1 − ε) 33 . Putting together the two bounds gives that lim sup P (1 ∈ / Hψ ) ≤ 2ε + K (1 − ε)K−1 , n→∞ which concludes the proof due to the assumption on K. The same estimator Hψ works for the preferential attachment tree as well, if one takes K ≥ 2 C log ε(1/ε) 4 for some positive constant C. The proof mirrors the one above, but involves a few additional steps; we refer to [13] for details. For uniform attachment the bound on K given by Theorem 4.14 is not optimal. It turns out that it is possible to write down the maximum likelihood estimator (MLE) for the root in the uniform attachment model; we do not do so here, see [13]. One can view the estimator Hψ based on the centroid as a certain “relaxation” of the MLE. By constructing a certain “tighter” relaxation of the MLE, one can obtain a confidence set with size subpolynomial in 1/ε as described in Theorem 4.5. The analysis of this is the most technical part of [13] and we refer to [13] for more details. 4.6.2 Lower bounds As mentioned above, the MLE for the root can be written down explicitly. This aids in showing a lower bound on the size of a confidence set. In particular, Bubeck et al. [13] define a set of trees whose probability of occurrence under the uniform attachment model is not too small, yet the MLE provably fails, giving the lower bound described in Theorem 4.5. We refer to [13] for details. On the other hand, for the preferential attachment model it is not necessary to use the structure of the MLE to obtain a lower bound. A simple symmetry argument suffices to show the lower bound in Theorem 4.4, which we now sketch. First observe that the probability of error for the optimal procedure is non-decreasing with n, since otherwise one could simulate the process to obtain a better estimate. Thus it suffices to show that the optimal procedure must have a probability of error of at least ε for some finite n. We show that there is some finite n such that with probability at least 2ε, the root is isomorphic to at least 2c/ε vertices in PA(n). Thus if a procedure outputs at most c/ε vertices, then it must make an error at least half the time (so with probability at least ε).  √ 1 Observe that the probability that the root is a leaf in PA(n) is 12 × 34 ×· · ·× 1 − 2n = Θ (1/ n).  By choosing n = Θ 1/ε2 , this happens with probability Θ (ε). Furthermore, conditioned on the √ root being a leaf, with constant probability vertex 2 is connected to Θ ( n) = Θ (1/ε) leaves (here we use Theorem 4.12), which are then isomorphic to the root. 4.7 Outlook: open problems and extensions There are many open problems and further directions that one can pursue; the four main papers we have discussed [17, 20, 15, 13] contain 20 open problems and conjectures alone. For instance, can the bounds on the size of the optimal confidence set be improved and ultimately tightened? What about other tree growth models? What happens when we lose the tree structure and consider general graphs, e.g., by adding multiple edges at each time step? When the tree growth model is not as combinatorial as uniform attachment or preferential attachment, then other techniques might be useful. In particular, many tree growth models can be embedded into continuous time branching processes and then the full machinery of general branching processes can be brought to the fore and applied; see [45, 8] and the references therein for such results. This approach can also be used to obtain finite confidence sets for the root, as demonstrated recently in [32] for sublinear preferential attachment trees. 34 A closely related problem to those discussed in these lectures is that of detecting the source of a diffusion spreading on an underlying network. The results are very similar to those above: the rumor source can be efficiently detected in many settings, see, e.g., [46, 47, 36]. A different twist on this question is motivated by anonymous messaging services: can one design protocols for spreading information that preserve anonymity by minimizing the probability of source detection? Fanti et al. [25] introduced a process, termed adaptive diffusion, that indeed achieves this goal. Understanding the tradeoffs between privacy and other desiderata is timely and should lead to lots of interesting research. 35 References [1] E. Abbe, A. S. Bandeira, and G. Hall. Exact recovery in the stochastic block model. IEEE Transactions on Information Theory, 62(1):471–487, 2016. [2] E. Abbe and C. Sandon. Community detection in general stochastic block models: fundamental limits and efficient recovery algorithms. In Proceedings of the 56th Annual IEEE Symposium on Foundations of Computer Science (FOCS). IEEE, 2015. [3] E. Abbe and C. Sandon. Detection in the stochastic block model with multiple clusters: proof of the achievability conjectures, acyclic BP, and the information-computation gap. Preprint available at http://arxiv.org/abs/1512.09080, 2015. [4] S. Artstein, K. Ball, F. Barthe, and A. Naor. Solution of Shannon’s problem on the monotonicity of entropy. Journal of the American Mathematical Society, 17(4):975–982, 2004. [5] S. Artstein, K. M. Ball, F. Barthe, and A. Naor. On the rate of convergence in the entropic central limit theorem. Probability Theory and Related Fields, 129(3):381–390, 2004. [6] K. Ball, F. Barthe, and A. Naor. Entropy jumps in the presence of a spectral gap. Duke Mathematical Journal, 119(1):41–63, 2003. [7] A.-L. Barabási and R. Albert. 286(5439):509–512, 1999. Emergence of scaling in random networks. Science, [8] S. Bhamidi. Universal techniques to analyze preferential attachment trees: Global and Local analysis. Available online at http://www.unc.edu/~bhamidi/preferent.pdf, 2007. [9] P. J. Bickel and A. Chen. A nonparametric view of network models and Newman–Girvan and other modularities. Proceedings of the National Academy of Sciences, 106(50):21068–21073, 2009. [10] N. Blachman. The convolution inequality for entropy powers. IEEE Transactions on Information Theory, 11(2):267–271, 1965. [11] S. G. Bobkov. Isoperimetric and analytic inequalities for log-concave probability measures. The Annals of Probability, 27(4):1903–1921, 1999. [12] B. Bollobás, O. Riordan, J. Spencer, and G. Tusnády. The Degree Sequence of a Scale-Free Random Graph Process. Random Structures & Algorithms, 18(3):279–290, 2001. [13] S. Bubeck, L. Devroye, and G. Lugosi. Finding Adam in random growing trees. Random Structures & Algorithms, to appear, 2016. [14] S. Bubeck, J. Ding, R. Eldan, and M. Z. Rácz. Testing for high-dimensional geometry in random graphs. Random Structures & Algorithms, 49(3):503–532, 2016. [15] S. Bubeck, R. Eldan, E. Mossel, and M. Z. Rácz. From trees to seeds: on the inference of the seed from large trees in the uniform attachment model. Bernoulli, to appear, 2016. [16] S. Bubeck and S. Ganguly. Entropic CLT and phase transition in high-dimensional Wishart matrices. Preprint available at http://arxiv.org/abs/1509.03258, 2015. 36 [17] S. Bubeck, E. Mossel, and M. Z. Rácz. On the influence of the seed graph in the preferential attachment model. IEEE Transactions on Network Science and Engineering, 2(1):30–39, 2015. [18] T. N. Bui, S. Chaudhuri, F. T. Leighton, and M. Sipser. Graph bisection algorithms with good average case behavior. Combinatorica, 7(2):171–191, 1987. [19] A. Condon and R. M. Karp. Algorithms for Graph Partitioning on the Planted Partition Model. Random Structures and Algorithms, 18(2):116–140, 2001. [20] N. Curien, T. Duquesne, I. Kortchemski, and I. Manolescu. Scaling limits and influence of the seed graph in preferential attachment trees. Journal de l’École polytechnique — Mathématiques, 2:1–34, 2015. [21] A. Decelle, F. Krzakala, C. Moore, and L. Zdeborová. Asymptotic analysis of the stochastic block model for modular networks and its algorithmic applications. Physical Review E, 84(6):066106, 2011. [22] L. Devroye, A. György, G. Lugosi, and F. Udina. High-dimensional random geometric graphs and their clique number. Electronic Journal of Probability, 16:2481–2508, 2011. [23] F. Eggenberger and G. Pólya. Über die Statistik verketteter Vorgänge. ZAMM - Journal of Applied Mathematics and Mechanics / Zeitschrift für Angewandte Mathematik und Mechanik, 3(4):279–289, 1923. [24] R. Eldan. An efficiency upper bound for inverse covariance estimation. Israel Journal of Mathematics, 207(1):1–9, 2015. [25] G. Fanti, P. Kairouz, S. Oh, and P. Viswanath. Spy vs. Spy: Rumor Source Obfuscation. In ACM SIGMETRICS, volume 43, pages 271–284. ACM, 2015. [26] A. L. Gibbs and F. E. Su. On choosing and bounding probability metrics. International Statistical Review, 70(3):419–435, 2002. [27] M. Girvan and M. E. Newman. Community structure in social and biological networks. Proceedings of the National Academy of Sciences, 99(12):7821–7826, 2002. [28] P. D. Hoff, A. E. Raftery, and M. S. Handcock. Latent Space Approaches to Social Network Analysis. Journal of the American Statistical Association, 97(460):1090–1098, 2002. [29] P. W. Holland, K. B. Laskey, and S. Leinhardt. Stochastic blockmodels: First steps. Social Networks, 5(2):109–137, 1983. [30] S. Janson. Limit theorems for triangular urn schemes. Probability Theory and Related Fields, 134(3):417–452, 2006. [31] T. Jiang and D. Li. Approximation of Rectangular Beta-Laguerre Ensembles and Large Deviations. Journal of Theoretical Probability, 28:804–847, 2015. [32] V. Jog and P.-L. Loh. Analysis of centrality in sublinear preferential attachment trees via the CMJ branching process. Preprint available at http://arxiv.org/abs/1601.06448, 2016. [33] O. Johnson and A. Barron. Fisher information inequalities and the central limit theorem. Probability Theory and Related Fields, 129(3):391–409, 2004. 37 [34] I. M. Johnstone. On the distribution of the largest eigenvalue in principal components analysis. Annals of Statistics, 29(2):295–327, 2001. [35] B. Karrer and M. E. Newman. Stochastic blockmodels and community structure in networks. Physical Review E, 83(1):016107, 2011. [36] J. Khim and P.-L. Loh. Confidence sets for the source of a diffusion in regular trees. Preprint available at http://arxiv.org/abs/1510.05461, 2015. [37] Y. V. Linnik. An Information-Theoretic Proof of the Central Limit Theorem with Lindeberg Conditions. Theory of Probability & Its Applications, 4(3):288–299, 1959. [38] H. M. Mahmoud. Distances in random plane-oriented recursive trees. Journal of Computational and Applied Mathematics, 41(1-2):237–245, 1992. [39] L. Massoulié. Community detection thresholds and the weak Ramanujan property. In Proceedings of the 46th Annual ACM Symposium on Theory of Computing (STOC), pages 694–703. ACM, 2014. [40] E. Mossel, J. Neeman, and A. Sly. A proof of the block model threshold conjecture. Preprint available at http://arxiv.org/abs/1311.4115, 2013. [41] E. Mossel, J. Neeman, and A. Sly. Belief propagation, robust reconstruction, and optimal recovery of block models. In Proceedings of the 27th Conference on Learning Theory (COLT), 2014. [42] E. Mossel, J. Neeman, and A. Sly. Consistency thresholds for the planted bisection model. In Proceedings of the 47th Annual ACM on Symposium on Theory of Computing (STOC), pages 69–75. ACM, 2015. [43] M. Penrose. Random Geometric Graphs, volume 5 of Oxford Studies in Probability. Oxford University Press, 2003. [44] K. Rohe, S. Chatterjee, and B. Yu. Spectral clustering and the high-dimensional stochastic blockmodel. The Annals of Statistics, 39(4):1878–1915, 2011. [45] A. Rudas, B. Tóth, and B. Valkó. Random trees and general branching processes. Random Structures & Algorithms, 31(2):186–202, 2007. [46] D. Shah and T. Zaman. Rumors in a Network: Who’s the Culprit? IEEE Transactions on Information Theory, 57(8):5163–5181, 2011. [47] D. Shah and T. Zaman. Finding Rumor Sources on Random Trees. Preprint available at http://arxiv.org/abs/1110.6230v3, 2015. [48] C. E. Shannon. A Mathematical Theory of Communication. The Bell System Technical Journal, 27:379–423, 623–656, 1948. [49] A. J. Stam. Some inequalities satisfied by the quantities of information of Fisher and Shannon. Information and Control, 2(2):101–112, 1959. 38
10math.ST
Vision Based Railway Track Monitoring using Deep Learning Shruti Mittal, Dattaraj Rao General Electric ABSTRACT Computer vision based methods have been explored in the past for detection of railway track defects, but full automation has always been a challenge because both traditional image processing methods and deep learning classifiers trained from scratch fail to generalize that well to infinite novel scenarios seen in the real world, given limited amount of labeled data. Advancements have been made recently to make machine learning models utilize knowledge from a different but related domain. In this paper, we show that even though similar domain data is not available, transfer learning provides the model understanding of other real world objects and enables training production scale deep learning classifiers for uncontrolled real world data. Our models efficiently detect both track defects like sunkinks, loose ballast and railway assets like switches and signals. Models were validated with hours of track videos recorded in different continents resulting in different weather conditions, different ambience and surroundings. A track health index concept has also been proposed to monitor complete rail network. I. INTRODUCTION Railway network is one of the major components of any country’s infrastructure. Improper maintenance of the track infrastructure can cause major revenue loss and have bigger implications like loss of life due to accidents. At present, all the maintenance work is done manually by sending a dedicated team for rail inspection every few days. Railroad companies also need to maintain and keep updating GPS database of assets like signals, switches and mileposts to implement temporary speed restrictions between specific start and end points, enable railroad interoperability. Using high definition videos recorded by train passing through or by drones eliminates the need for repetitive manual inspection and alerts can be provided to maintenance crew to plan for track and asset maintenance in the region with high probability of damage. Onboard detection of these railway assets can also be used in operator assistance systems and onboard track defect detection or obstruction detection can help in early warning systems. Traditional image processing methods fail to accommodate variability in track seen and gives a lot of false positives. For example, a system trained to identify sunkinks or bent rails get affected by switches, double rails, support rails, and any straight line near track like a water pipe going along with track or platform edge at a station. Deep learning classifiers trained from scratch need a huge amount of data. Other than being expensive to label all the data, it is also difficult to obtain that many images of defective track because it is a rare scenario, as it should be! As a result, this works well on the cleaned up, manually filtered and constructed dataset. They even sometimes work on railway tracks present in deserted areas where there are limited distractions which could be covered in the negative dataset but they tend to fail whenever it sees something new. If there are tracks going through the city or through a region with a different kind of scenery than that covered in training dataset, these models tend to fail. GE Internal This brings into picture transfer learning. Classifiers proposed in this paper have been pretrained on ImageNet and COCO dataset before being trained on railway data. Being trained on millions of images from these datasets, models gain knowledge about thousands of different objects seen in real life. They learn about different backgrounds and when fine tuned on relevant data, understands its features much more effectively. They don’t get confused easily with other objects seen around and hence give much less false positives. II. RELATED WORKS At present, all the maintenance work is done manually by sending a dedicated team for rail inspection every few days. A complete new hardware system with a lot of sensors can automate a lot of this work but these setups require a separate team to go on the tracks to be inspected with the required instruments. A few vision based methods like [7], [10] have also been explored for rail track defect detection. But due to lack of sufficient labeled data they have stayed limited to conventional image processing methods. The defects like sunkinks or broken track are seen once in a while, however, for training a convolutional classifier, it needs thousands of images of each category. Also, labeling all the video data for this is a very time-consuming task. Both these issues have resulted in very limited work like in [8], [9] being done to explore machine learning in vision based track defect detection. Recently, techniques like data augmentation and transfer learning [5] have shown that efficient deep learning models can be trained even with small amount of data. New models like inception [3] have been developed to maximize use of information available from limited dataset. Also, tensorflow and keras have released models [11], [12] pretrained on datasets like ImageNet and COCO containing millions of labelled images enabling training of new models using limited computational resources. III. BACKGROUND In recent times, convolutional neural networks have become quite popular for image related tasks. Unlike conventional neural networks, their 2D architecture helps them to extract localized features of images well and their weight sharing provides translational invariance for structures detected along with protecting them from overfitting and enabling training with limited computing resources. Stacking those convolutional layers, enables the model to learn more complicated features. CNNs have proved that given sufficient data, the task of image classification with accuracy similar to or even at times better than that of humans is no longer hard for computers. These CNNs have been improved upon in a lot of ways to use fewer parameters to be more computationally efficient and avoid overfitting, to learn much more complicated features by going deeper and to handle tasks of multiple object detection and segmentation in addition to image classification by using region proposal networks. 3.1 Inception Google came up with the Inception module [3] in 2014 in which they proposed, instead of stacking convolutional layers in a sequential manner, if convolutions with different filter sizes can be processed in parallel and then concatenated and fed to next layer, model will be retaining a lot of useful information about features of different sizes which were lost otherwise. The computational burden added due to this was compensated for by using 1x1 convolutions which enabled controlling number of input channels for the next layer without losing important spatial information and without increasing number of trainable parameters. These techniques resulted in models which were computationally very efficient and giving state of the art accuracy. GE Internal 3.2 ResNet Residual Learning framework was introduced by Microsoft [2] in late 2015. The basic idea behind it is that the inputs of a lower layer are added to the inputs of a higher layer due to which higher layers make inference based on both the extracted feature maps and the original inputs. It was observed that due to this change, now the layers only need to learn a residual function instead of an unreferenced function or in other words, layers are now learning only the incremental change in the original input which can help overall model to classify correctly. This also provided a highway route for the error to propagate to lower layers during back propagation enabling training of much deeper networks compared to what were possible earlier and hence a considerable gain in the model accuracy. 3.3 Faster R-CNN Due to their inherent architecture, a simple CNN model cannot tell the location of the object it detected. To take image classification to the next step of object detection and be able to draw a bounding box, region based CNNs were introduced in 2013. They use a region proposal method to identify bounding boxes with highest probability to contain an object and then classification is run for the image inside those boxes. In 2016, faster RCNN [1] was introduced which instead of using a separate region proposal method, integrated it with CNN model so that the same feature maps created can be used both for proposing bounding boxes and classification. Using CNN feature maps resulted in higher quality region proposals and also greatly reduced the overall processing time. 3.4 Transfer Learning All the improvements on CNN mentioned above, have one big limitation - need of huge amount of labeled data, which is not always available in real world scenarios. This brings into picture Transfer Learning which basically refers to learning features from labeled dataset of another problem and utilizing that knowledge to solve the issue in hand. The initial layers in a CNN model extract low level features like edges, corners, pixel intensities while final layers combine this low-level information to make more problem specific feature maps so that they can execute the final task of classification or recognition. Transfer learning proposes keep the weights in lower layers intact providing the model good initial feature extractors and then fine-tune only the final layers for your specific problem with limited data. IV. EXPERIMENTS AND RESULTS Currently 100 GB of full HD videos are being collected per day from cameras mounted on top of a few locomotives. These videos are used to pursue video analytics with two objectives – one is track defects detection and the other is railway assets mapping. The GPU used to run these models is Titan X. For some models, speed on CPU has also been reported. That is a system with 4 cores, i7-6600U @2.6 GHz and 8 GB RAM. 4.1 Track Defects Railway track defects can be categorized as follows – one is issues with track itself like broken track or misalignment also known as sunkinks in which part of track expands due to heat and gets bent due to lack of space. Other category is issues in between the tracks like loose ballast or missing crosstie which reduces the load bearing capacity of tracks and hence that region is more likely to see a rail damage in near future. Track defects from category 1 are safety critical issues and can result in derailment. Thus, a small number of false positives are acceptable but there should not be any false negative for these. Category 2 defects provide priority to maintenance crews. So, these models should have very less false positives. However, if in a particular region with loose ballast, even if it detected some of the frames as loose ballast, it is good enough to identify the region which needs maintenance and we do not need to know one off cases. Thus, false negatives in this case are GE Internal acceptable. We have trained binary classifiers for one defect in each of these categories. The classifiers were trained using cropped region of interest of the frame marked by green rectangle in the results. 4.1.1 Loose Ballast Detector A track is identified as having loose ballast when it doesn’t have sufficient amount of gravel distributed in between tracks making depth of cross ties visible. In case of insufficient ballast, the load of the loco doesn’t get evenly distributed leading to the breakage of cross ties and eventually track. Both resnet-50 and inception models, pretrained on ImageNet data were first tried by replacing their top layer by a two node softmax layer. The models were trained using just 181 positives and 340 negative images. These images were however augmented using mirroring, rotation, image shift and varied brightness. The trained models were tested on 25000 samples from a route covering 470 kms. Inception model claimed 88.9% of the track as having loose ballast while Resnet claimed only 1.5% of the track as defective. As explained earlier, as this is a defect that triggers maintenance in the region, even if it detects only some of the actual frames containing loose ballast, it is good enough to identify the region. Hence, false negatives are easily acceptable in this case but not a lot of false positives, making ResNet a preferred choice of model for this, which was optimized further. Table 1: Results for Loose Ballast Models Inception-v3 (Top Modified) Videos Processed 9 hrs Predicted Positive (# of 88.9% Positives/Total) Precision (TP/FP+TP) 0.07% Recall (TP/TP+FN) 100% ResNet 50 (Top Modified) 9 hrs 1.5% ResNet 50 (Optimized) 9 hrs 0.16% ResNet 50 (Optimized) 32 hrs 0.46% 58.7% 90.6% 95.2% 25% 96% NA After tuning the model for meta parameters - # of trainable layers, activation function in fully connected layers, amount of regularization, the final optimized model had following architecture. The initial layers of the model were kept frozen while top ten layers were trainable. Two fully connected layers and a softmax layer were added instead of the top layer of original model. Dropout was also added before these layers. Trained model was validated on 32 hrs worth of data, spread over a month and 0.46% of the track covered was identified as having loose ballast with a precision of 96%. Recall could not be calculated for 32 hrs of data as it would need labelling of all the actual cases of loose ballast in the all the videos. As distribution of gravels is not a very straight forward feature to identify, training deeper models was helpful as it could understand more complicated features. (a) (b) Figure 1: (a) shows a good ballast condition, (b) shows a loose ballast case being detected GE Internal 4.1.2 Sunkink Detector In order to detect a sunkink, model just needs to identify if the tracks are almost straight and parallel or not. This was first attempted using basic image processing –perspective transform, filtering and edge detection. This method worked quickly for detection of a sunkink in initial videos. In the processed image, shown in Figure 2, thick white lines were identified as track. If the horizontal coordinates of left or right track varied quickly in a zig zag fashion, a sunkink was flagged. However, when this method was tried on multiple videos, it was observed, filtering techniques fail to detect track with the changes in ambience and lighting conditions. Even when filtering was made more robust, presence of switches, support rails, any straight bright object like pipes, fences, pillars or platform edge near track were creating distractions. Using fixes like accepting track coordinates only when track width is within limits or predicting track position based on where track was detected in the last frame helped to some extent but still the number of false positives in any new video were a lot. (a) (b) (c) Figure 2: (a) ROI in the frame, (b) Image after perspective transformed with Gauge measurements from processed frame (c) Processed ROI It was felt after this experiment that to get a model which can be deployed in real world with new tracks in every run, conventional image processing might be the harder way to go, and simulating data to train a deep learning model might give better results. Positive scenarios of sunkinks were crudely simulated from good track images using MS Paint – surrounding ties were cropped and pasted on the track segment, then bent track was drawn on it by picking local color of track and its shadow. These images are shown in Figure 3. Basic dataset was made using just 50 positives and 100 negative images. 20% of these images were used as test dataset. For the training/testing, these images were further augmented using rotation, mirroring and image shifts. Trained models were cross validated on six 12-sec sunkink videos, professionally simulated using good videos obtained from a different terrain. Inception-v3 and Resnet-50 both the models, pretrained on ImageNet data were tried with a softmax layer at the end replacing the top layer of original model. Resnet model was also tried with top 10 network layers made trainable. Resnet model with extra trainable layers couldn’t identify even 1 new sunkink resulting in an invalid precision, however resnet model with just top layer as trainable could detect 3 out of 6 sunkinks without giving any false positive. As very limited data was available, more trainable layers lead to an overfitted model. Inception model could detect all the sunkinks but also gave a false positive. It could also run real time on CPU. Inception architecture learns features with minimum number of trainable parameters, as a result of which it could work with even such a small dataset. These models were not getting distracted by switches or nearby platforms like conventional image processing methods. As sunkink is a severe rail defect which can cause derailment, running onboard is a critical requirement making inception a preferred choice among deep learning models. GE Internal Table 2: Inception vs Resnet for Sunkink Inception-v3 Resnet-50 Resnet-50 w/ top 10 layers trainable Speed (Frames processed 18 on GPU, 6 on 8 on GPU, Not running on 8 on GPU, Not running per sec) CPU CPU on CPU Asset Level Accuracy 6/6 3/6 0/6 False Positives 1 0 0 Precision 97.5% 100% Invalid (a) (b) (c) Figure 3: (a) and (b) Training images simulated in paint, (c) Sunkink being detected in a video with professionally simulated sunkink 4.2 Railway Assets As per Association of American Railroads regulations, companies need to maintain a GPS database of all their railroad assets which can be used by another operator driving a loco on their route. It helps in implementing dynamic speed limits in between two identified landmarks. Switch location known in advance helps the operator to stay alert in the region and onboard switch status detection at low speeds in yard can help prevent accidents. Signal color detection onboard can be used in operator assistance systems and hence avoiding having two operators onboard. 4.2.1 Switch Detector If seen in terms of image features to be recognized, switches are very similar to sunkinks. It’s just that now a different shape of the track needs to be flagged. So, same architecture as sunkink model was tested at switches dataset. Simulating data for sunkinks is harder, but switches are available readily and labelling images for them is easier, so a much more robust model could be trained. 1408 positives and 4000 negatives were used. Data was further augmented with mirroring, image shifts and varied brightness. GE Internal Table 3: Resnet vs Inception for Switch Detection Videos Processed Precision Recall Resnet 50 9 hrs 53.8% 32.2% Inception v3 9 hrs 94.9% 83.2% Inception v3 32 hrs 95.6% NA Similar to sunkinks, both the resnet 50 and inception v3 models, pretrained on imagenet data, with top layer modified, were tried for switches. Here also inception v3 model turns out to be preferable. The model could detect 83% of the switches in route with a precision value of 95%. It doesn’t get confused with vipers on windshield and works even if it’s raining. Recall couldn’t be calculated as it needed labelling of 32 hrs of video to identify actual number of switches. (a) (c) (b) (d) Figure 4: (a) and (b) shows switch detection working in rains, (c) and (d) shows model not getting confused with support rails 4.2.2 Signal Color Detector As there can be multiple signals present in a single frame, to be able to identify them individually so that their color can be detected, region based CNN models, pretrained on COCO dataset which provides bounding box labels as well has been used for signal detection. Another benefit was COCO dataset already includes road signals as one of the categories. Availability of all the labeled data set helped in model being able to adapt well to different regions with varied weather conditions. Once the signal is detected, red and green color masks are applied on the image part inside the predicted bounding box to identify signal color. As the same signal is seen in multiple frames, even identification in any one of them is good. Thus, false positives were needed to be avoided but false negatives were fine. To handle this, if a signal was identified, but no proper color could be detected, it was ignored. This greatly helped in reducing false positives. Around 30 hrs of video spanning 700 kms of route was processed in multiple runs in sunny/cloudy weather conditions, afternoon/early morning timings. GE Internal Faster R-CNN model and Single Shot Detector (SSD) model [4] were tried for this. Results are shown in Table 4. SSD model could process frames way faster than FRCNN but its detection accuracy was too low to be considered as a viable option. Using FRCNN, 30 hrs of videos were processed in which 93% of the signals present enroute could be identified with a precision of 99.4%. Detected signals included overhead signals, signals in metal cage, single light signals, triple light signals, etc. It was also observed, glare in sunny days was reducing accuracy and better performance was seen in early morning videos or cloudy weather. Though the model could detect daytime signals easily, for night time, asset level detection accuracy was as low as 20%. It was easier for it to detect night signals which were not too much refracted or blurred. Table 4: Results for Signal Color Detection Time Processed Assets Detected Asset Level Accuracy Precision Running Time (fps) SSD Faster R-CNN Faster R-CNN 1 hr 1 hr 30 hrs 11/51 47/51 411/440 21.5% 92.1% 93.3% 98.4% 98.6% 99.4% 1 fps on CPU, 15 fps on 0.1 fps on CPU, 2 fps on 0.1 fps on CPU, 2 fps on GPU GPU GPU (a) (c) (b) (d) Figure 5: (a) Signal Detection in Metal box, (b) Overhead Signal Detection, (c) Signal Detection in Cloudy Weather, (d) Night time Signal Detection GE Internal 4.3 Track Health Index To monitor the alerts for different track defects for a complete railway network in a region, a track health index has been proposed. All the track defects that can be identified will be given a weightage based on their severity. Defects like sunkink or broken track can cause derailment and hence will have higher weightage then something like loose ballast or vegetation overgrowth. THI value can be calculated as defined in Equation 1. 𝑇𝐻𝐼 = 1 − min(1, ∑ (𝐶𝑜𝑛𝑓𝑖𝑑𝑒𝑛𝑐𝑒𝑃𝑒𝑟𝑐𝑒𝑛𝑡 ∗ 𝐷𝑒𝑓𝑒𝑐𝑡𝑊𝑒𝑖𝑔ℎ𝑡𝑎𝑔𝑒)) 𝑐𝑙𝑎𝑠𝑠𝑒𝑠 Equation 1 In Equation 1, confidence percent denotes model’s output probability for that defect to exist and defect weightage is the weight assigned to the particular defect based on its severity. For now, when we are working with just two defects, sunkink was assigned a weightage of 1 and loose ballast was assigned a weightage of 0.5. As more and more defects will be added in future, just the weights of different defects can be modified in the same formula. If for frame 1, a model is 80% sure that this is a case of loose ballast, THI for that frame would be 60%. For the category 2 defects, these THI values will be averaged over all the frames analyzed in a particular track segment to get the overall segment health. However, as category 1 defects do not spread over area and even a single occurrence is sufficient to cause derailment, the frames containing these defects will be flagged immediately. Figure 6: Railway network with simulated Track Health Index mapped V. CONCLUSION From the experiments on rail domain data, it was observed that even in the cases where labeled data is not that readily available, using techniques like data augmentation and transfer learning can help in training deep learning models with decent accuracy. Models were trained to identify track defects like loose ballast and sunkinks and assets like switches and signals. From the performance of ResNet and Inception model in different cases, it was observed that Inception model could learn from a smaller dataset without overfitting. Multiple sized filters which are used in parallel in inception helps transmit more information to subsequent layers and hence tend to give better accuracy. However, if the feature to be detected is a little complex as was the case of loose ballast, deeper trainable model like ResNet work better. A comparison of SSD and Faster R-CNN models was also made for railway signals and it was observed that though SSD’s lighter architecture makes it more desirable for real time detection but it’s accuracy for new data is too low, making Faster R-CNN a more suited GE Internal option despite higher computing resources requirement. Using all these detections, concept of track health index is proposed to enable monitoring and assess maintenance requirements for complete railway network. VI. REFERENCES 1. Ren, Shaoqing, Kaiming He, Ross Girshick, and Jian Sun. "Faster R-CNN: Towards real-time object detection with region proposal networks." In Advances in neural information processing systems, pp. 91-99. 2015. 2. He, Kaiming, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. "Deep residual learning for image recognition." In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778. 2016. 3. Szegedy, Christian, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. "Going deeper with convolutions." In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1-9. 2015. 4. Liu, Wei, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed, Cheng-Yang Fu, and Alexander C. Berg. "Ssd: Single shot multibox detector." In European conference on computer vision, pp. 21-37. Springer, Cham, 2016. 5. Sebastian Ruder, Transfer Learning - Machine Learning's Next Frontier, http://ruder.io/transfer-learning/ 6. Adit Deshpande, Understanding CNNs, https://adeshpande3.github.io/adeshpande3.github.io/The-9-DeepLearning-Papers-You-Need-To-Know-About.html 7. Karakose, Mehmet, Orhan Yaman, Mehmet Baygin, Kagan Murat, and Erhan Akin. "A New Computer Vision Based Method for Rail Track Detection and Fault Diagnosis in Railways." (2017). 8. Faghih-Roohi, Shahrzad, Siamak Hajizadeh, Alfredo Núñez, Robert Babuska, and Bart De Schutter. "Deep convolutional neural networks for detection of rail surface defects." In Neural Networks (IJCNN), 2016 International Joint Conference on, pp. 2584-2589. IEEE, 2016. 9. Gibert, Xavier, Vishal M. Patel, and Rama Chellappa. "Deep Multitask Learning for Railway Track Inspection." IEEE Transactions on Intelligent Transportation Systems 18, no. 1 (2017): 153-164. 10. Vijaykumar, V. R., and S. Sangamithirai. "Rail defect detection using Gabor filters with texture analysis." In Signal Processing, Communication and Networking (ICSCN), 2015 3rd International Conference on, pp. 1-6. IEEE, 2015. 11. Tensorflow detection model zoo, https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md 12. Keras image classification models, https://keras.io/applications/ GE Internal
1cs.CV
arXiv:1702.07676v2 [math.MG] 5 Dec 2017 CRITERIA FOR STRICT MONOTONICITY OF THE MIXED VOLUME OF CONVEX POLYTOPES FRÉDÉRIC BIHAN AND IVAN SOPRUNOV Abstract. Let P1 , . . . , Pn and Q1 , . . . , Qn be convex polytopes in Rn such that Pi ⊂ Qi . It is well-known that the mixed volume has the monotonicity property: V (P1 , . . . , Pn ) ≤ V (Q1 , . . . , Qn ) . We give two criteria for when this inequality is strict in terms of essential collections of faces as well as mixed polyhedral subdivisions. This geometric result allows us to characterize sparse polynomial systems with Newton polytopes P1 , . . . , Pn whose number of isolated solutions equals the normalized volume of the convex hull of P1 ∪ · · · ∪ Pn . In addition, we obtain an analog of Cramer’s rule for sparse polynomial systems. 1. Introduction The mixed volume is one of the fundamental notions in the theory of convex bodies. It plays a central role in the Brunn–Minkowski theory and in the theory of sparse polynomial systems. The mixed volume is the polarization of the volume form on the space of convex bodies in Rn . More precisely, let K1 , . . . , Kn be n convex bodies in Rn and Voln (K) the Euclidean volume of a body K ⊂ Rn . Then the mixed volume of K1 , . . . , Kn is n X 1 X (1.1) V (K1 , . . . , Kn ) = (−1)n+m Voln (Ki1 + · · · + Kim ), n! m=1 i1 <···<im Rn where K + L = {x + y ∈ | x ∈ K, y ∈ L} denotes the Minkowski sum of bodies K and L. It is not hard to see from the definition that the mixed volume is symmetric, multilinear with respect to Minkowski addition, invariant under translations, and coincides with the volume on the diagonal, i.e. V (K, . . . , K) = Voln (K). What is not apparent from the definition is that it satisfies the following monotonicity property, see [11, (5.25)]. If L1 , . . . , Ln are convex bodies such that Ki ⊆ Li for 1 ≤ i ≤ n then V (K1 , . . . , Kn ) ≤ V (L1 , . . . , Ln ). The main goal of this paper is to give a geometric criterion for strict monotonicity in the class of convex polytopes. We give two equivalent criteria in terms of essential collections of faces and Cayley polytopes, see Theorem 3.3 and Theorem 4.4. The first criterion is especially simple when all Li are equal (Corollary 3.7) which is the situation in our application to sparse polynomial systems. In the general case of convex bodies this is still an open problem, see [11, pp. 429–431] for special cases and conjectures. 2010 Mathematics Subject Classification. Primary 52A39, 52B20, 14M25; Secondary 13P15. Key words and phrases. convex polytope, mixed volume, Newton polytope, sparse polynomial system, BKK bound. 1 2 FRÉDÉRIC BIHAN AND IVAN SOPRUNOV The role of mixed volumes in algebraic geometry originates in the work of Bernstein, Kushnirenko, and Khovanskii, who gave a vast generalization of the classical Bézout formula for the intersection number of hypersurfaces in the projective space, see [1, 6, 7]. This beautiful result, which links algebraic geometry and convex geometry through toric varieties and sparse polynomial systems, is commonly known as the BKK bound. Consider an n-variate Laurent polynomial system f1 (x) = · · · = fn (x) = 0 over an algebraically closed field K. The support Ai of fi is the set of exponent vectors in Zn of the monomials appearing with a non-zero coefficient in fi . The Newton polytope Pi of fi is the convex hull of Ai . The BKK bound states that the number of isolated solutions of the system in the algebraic torus (K∗ )n = (K \ {0})n is at most n! V (P1 , . . . , Pn ). Systems that attain this bound must satisfy a non-degeneracy condition, which means that certain subsystems (predicting solutions “at infinity”) have to be inconsistent, see Theorem 5.1. However, the non-degeneracy condition may be hard to check. Let A = ∪ni=1 Ai be the total support of the system and choose an order of its elements, A = {a1 , . . . , a` }. Then the system can be written in a matrix form (1.2) C xA = 0, where C ∈ Kn×` is the matrix of coefficients, A ∈ Zn×` is the matrix of exponents whose columns are a1 , . . . , a` , and xA is the transpose of (xa1 , . . . , xa` ), see Section 5. The solution set of (1.2) in (K∗ )n does not change after left multiplication of C by a matrix in GLn (K). Such an operation does not preserve the individual supports of (1.2) in general, but preserves the total support A, see Remark 5.3. Furthermore, let Ā ∈ Z(n+1)×` be the augmented exponent matrix, obtained by appending a first row of 1 to A. Then left multiplication of Ā by a matrix in GLn+1 (Z) with first row (1, 0, . . . , 0) corresponds to a monomial change of coordinates of the torus (K∗ )n and a translation of A, hence, does not change the number of solutions of the system in (K∗ )n , see Section 5. Assume all Newton polytopes of a system (1.2) are equal to some polytope Q. Then the number of isolated solutions of (1.2) is at most n!V (Q, . . . , Q) = n! Voln (Q), by the BKK bound. In Section 5 we characterize systems that reach (or do not reach) this bound. This characterization follows from the geometric criterion of Corollary 3.7, but it has a natural interpretation in terms of the coefficient matrix C and the augmented exponent matrix Ā, see Theorem 5.5. In particular, it says that if Q has a proper face such that the rank of the corresponding submatrix of C (obtained by selecting the columns indexed by points of A which belong to that face) is strictly less than the rank of the corresponding submatrix of Ā, then (1.2) has strictly less than n! Voln (Q) isolated solutions in (K∗ )n . Naturally, this characterization is invariant under the actions on C and Ā described above. Another consequence of Theorem 5.5 can be thought of as a generalization of Cramer’s rule for linear systems. Linear systems occur when each Pi is contained in the standard unit simplex ∆ in Rn . The BKK bound for systems with all Newton polytopes equal to ∆ is just 1 = n! Voln (∆) and, by Cramer’s rule, if all maximal minors of the coefficient matrix C are non-zero, then the system (1.2) has precisely one solution in (K∗ )n . We generalize this to an arbitrary Newton polytope Q: If CRITERIA FOR STRICT MONOTONICITY OF THE MIXED VOLUME 3 no maximal minor of C vanishes then the system (1.2) has the maximal number n! Voln (Q) of isolated solutions in (K∗ )n , see Corollary 5.7. Acknowledgement. This project began at the Einstein Workshop on Lattice Polytopes at Freie Universität Berlin in December 2016. We are grateful to Mónica Blanco, Christian Haase, Benjamin Nill, and Francisco Santos for organizing this wonderful event and to the Harnack Haus for their hospitality. We thank Gennadiy Averkov and Christian Haase for fruitful discussions. Finally, we are thankful to the anonymous referee for their comments and suggestions that led to a substantial improvement of the exposition. 2. Preliminaries In this section we recall necessary definitions and results from convex geometry and set up notation. In addition, we recall the notion of essential collections of polytopes for which we give several equivalent definitions, as well as define mixed polyhedral subdivisions and the combinatorial Cayley trick. Throughout the paper we use [n] to denote the set {1, . . . , n}. Mixed Volume. For a convex body K in Rn the function hK : Rn → R, given by hK (u) = max{hu, xi | x ∈ K} is the support function of K . Here hu, xi is the standard scalar product in Rn . For every u ∈ Rn , we write HK (u) to denote the supporting hyperplane for K with outer normal u HK (u) = {x ∈ Rn | hu, xi = hK (u)}. Throughout the paper we use K u = K ∩ HK (u) to denote the face of K corresponding to the supporting hyperplane HK (u). Since HK (u) and K u are invariant under rescaling u by a non-zero scalar, we often assume that when u 6= 0, it lies in the unit sphere Sn−1 ⊂ Rn . Clearly, for u = 0 we have HK (u) = Rn and K u = K . Let V (K1 , . . . , Kn ) be the n-dimensional mixed volume of n convex bodies K1 , . . . , Kn in Rn , see (1.1). We have the following equivalent characterization. Theorem 2.1. [11, Theorem 5.1.7] Let λ1 , . . . , λn be non-negative real numbers. Then Voln (λ1 K1 + · · · + λn Kn ) is a polynomial in λ1 , . . . , λn whose coefficient of the monomial λ1 · · · λn equals V (K1 , . . . , Kn ). Essential Collections. Throughout the paper we use “collection” as a synonym for “multiset”. Let K1 , . . . , Km be convex bodies in Rn , not necessarily distinct. We say that a collection {K1 , . . . , Km } is essential if for any subset I ⊂ [m] of size at most n we have (2.1) dim X Ki ≥ |I|. i∈I Note that every sub-collection of an essential collection is essential. Also {K, . . . , K}, where K is repeated m times, is essential if and only if dim K ≥ m. 4 FRÉDÉRIC BIHAN AND IVAN SOPRUNOV The following well-known result asserts that essential collections of n convex bodies characterize positivity of the mixed volume. Theorem 2.2. [11, Theorem 5.1.8] Let K1 , . . . , Kn be n convex bodies in Rn . The following are equivalent: (1) V (K1 , . . . , Kn ) > 0; (2) There exist segments Ei ⊂ Ki for 1 ≤ i ≤ n with linearly independent directions; (3) {K1 , . . . , Kn } is essential. Another useful result is the inductive formula for the mixed volume, see [11, Theorem 5.1.7, (5.19)]. We present a variation of this formula for polytopes. Recall that a polytope P ⊂ Rn is the convex hull of finitely many points in Rn . Furthermore, P is a lattice polytope if its vertices belong to the integer lattice Zn ⊂ Rn . Let K be a convex body and Q2 , . . . , Qn be polytopes in Rn . Given u ∈ Sn−1 , let V (Qu2 , . . . , Qun ) denote the (n−1)-dimensional mixed volume of Qu2 , . . . , Qun translated to the orthogonal subspace u⊥ . Then we have 1 X (2.2) V (K, Q2 . . . , Qn ) = hK (u)V (Qu2 , . . . , Qun ). n n−1 u∈S Note that the above sum is finite, since there are only finitely many u ∈ Sn−1 for which {Qu2 , . . . , Qun } is essential. Namely, these u are among the outer unit normals to the facets of Q2 + · · · + Qn . Remark 2.3. There is a reformulation of (2.2) that is more suitable for lattice polytopes. It is not hard to see that n! Vol(P ) is an integer for any lattice polytope. This implies that n!V (P1 , . . . , Pn ) is also an integer for any collection of lattice polytopes P1 , . . . , Pn . Recall that a vector u ∈ Zn is primitive if the greatest common divisor of its components is 1. Given lattice polytopes P, Q2 , . . . , Qn we have X (2.3) n!V (P, Q2 . . . , Qn ) = hP (u)(n − 1)!V (Qu2 , . . . , Qun ), u primitive where the (n − 1)-dimensional mixed volume is normalized such that the volume of the parallelepiped spanned by a lattice basis for u⊥ ∩ Zn equals one. Note that the terms in the sum are non-negative integers, which, as above, equal zero for all but finitely many primitive u ∈ Zn . Cayley Polytopes and Combinatorial Cayley Trick. Let P1 , . . . , Pk ⊂ Rn be convex polytopes. The associated Cayley polytope C(P1 , . . . , Pk ) is the convex hull in Rn × Rk of the union of the polytopes Pi ×{ei } for i = 1, . . . , k , where {e1 , . . . , ek } is the standard basis for Rk . Let (x, y) = (x1 , . . . , xn , y1 , . . . , yk ) be coordinates on Rn × Rk and let π1 : Rn × Rk → Rn and π2 : Rn × Rk → Rk be the projections defined by π1 (x, y) = x and π2 (x, y) = y , respectively. Note that π2 (C(P1 , . . . , Pk )) is the (k − 1)-dimensional CRITERIA FOR STRICT MONOTONICITY OF THE MIXED VOLUME simplex ∆k−1 defined by every y ∈ ∆k−1 we have (2.4) Pk i=1 yi 5 = 1 and yi ≥ 0 for 1 ≤ i ≤ k . Furthermore, for π2−1 (y) ∩ C(P1 , . . . , Pk ) = (y1 P1 + · · · + yk Pk ) × {y}. Note that when all yi > 0 the preimage π2−1 (y) ∩ C(P1 , . . . , Pk ) has dimension equal to dim(P1 + · · · + Pk ). This implies that (2.5) dim C(P1 , . . . , Pk ) = dim(P1 + · · · + Pk ) + k − 1. If dim Pi ≥ 1 for i = 1, . . . , k , then the Cayley polytope C(P1 , . . . , Pk ) ⊂ Rn+k , as well as the Minkowski sum P1 + · · · + Pk , is called fully mixed. The following result is an immediate consequence of (2.5). Lemma 2.4. Consider polytopes P1 , . . . , Pn ⊂ Rn . Then the following conditions are equivalent. (1) The Cayley polytope C(P1 , . . . , Pn ) is a fully mixed (2n − 1)-dimensional simplex. (2) P1 , . . . , Pn are segments with linearly independent directions. Remark 2.5. Let P1 , . . . , Pn be polytopes in Rn . From Theorem 2.2 and Lemma 2.4, we have V (P1 , . . . , Pn ) > 0 if and only if C(P1 , . . . , Pn ) contains a fully mixed (2n−1)dimensional simplex C(E1 , . . . , En ). Let τC be any polyhedral subdivision of C(P1 , . . . , Pk ) with vertices in ∪ki=1 Pi ×{ei }. Consider any full-dimensional polytope Cσ of τC . Then it intersects each hyperplane yi = 1 along a non-empty face σi × {ei } ⊂ Pi × {ei } for 1 ≤ i ≤ k , and it follows that Cσ = C(σ1 , . . . , σk ). Therefore, τC consists of the set of all the polytopes  C(σ1 , . . . , σk ) together with their faces. Taking the image under π1 of π2−1 k1 , . . . , k1 ∩C(P1 , . . . , Pn ) we obtain, by (2.4), the Minkowski sum P1 + · · · + Pk (up to dilatation by k1 ) together with a polyhedral subdivision by polytopes σ1 + · · · + σk , where σi ⊂ Pi for 1 ≤ i ≤ k . This defines a correspondence from the set of all polyhedral subdivisions of C(P1 , . . . , Pk ) with vertices in ∪ki=1 Pi ×{ei } to a set of polyhedral subdivisions of P1 + · · · + Pk which are called mixed. Note that τC is uniquely determined by the corresponding mixed subdivision of P1 + · · · + Pk . This one-to-one correspondence is commonly called the combinatorial Cayley trick or simply the Cayley trick, see [8], [13] or [2], for instance. A mixed polyhedral subdivision of P1 + · · · + Pk is called pure if the corresponding subdivision of C(P1 , . . . , Pk ) is a triangulation. Let σ1 + · · · + σk be a polytope in a pure mixed polyhedral subdivision of P1 + · · · + Pk . Then each σi is a simplex since σi × {ei } is a face of the simplex C(σ1 , . . . , σk ). If furthermore k = n and dim(σ1 + · · · + σn ) = n, then σ1 + · · · + σn is fully mixed if and only if C(σ1 , . . . , σn ) is a fully mixed (2n−1)-dimensional simplex, equivalently, σ1 , . . . , σn are segments with linearly independent directions (see Lemma 2.4). The following result is well-known, see [9, Theorem 2.4] or [4, Theorem 6.7]. Lemma 2.6. For convex polytopes P1 , . . . , Pn in Rn , the quantity n! V (P1 , . . . , Pn ) is equal to the sum of the Euclidean volumes of the fully mixed polytopes in any pure mixed polyhedral subdivision of P1 + · · · + Pn . 6 FRÉDÉRIC BIHAN AND IVAN SOPRUNOV 3. First criterion In this section we present our first criterion for strict monotonicity of the mixed volume and its corollaries. Definition 3.1. Let K be a subset of a convex polytope A and let F ⊂ A be a facet. We say K touches F when the intersection K ∩ F is non-empty. We will often make use of the following proposition, which gives a criterion for strict monotonicity in a very special case, see [11, page 282]. Proposition 3.2. Let P1 , Q1 , . . . , Qn be convex polytopes in Rn and P1 ⊆ Q1 . Then V (P1 , Q2 , . . . , Qn ) = V (Q1 , Q2 , . . . , Qn ) if and only if P1 touches every face Qu1 for u in the set U = {u ∈ Sn−1 | {Qu2 , . . . , Qun } is essential}. The above statement easily follows from (2.2) and the observation hP1 (u) ≤ hQ1 (u) with equality if and only if P1 touches Qu1 . See [11, Sec 5.1] for details. Here is the first criterion for strict monotonicity. Theorem 3.3. Let P1 , . . . , Pn and Q1 , . . . , Qn be convex polytopes in Rn such that Pi ⊆ Qi for every i ∈ [n]. Given u ∈ Sn−1 consider the set Tu = {i ∈ [n] | Pi touches Qui }. Then V (P1 , . . . , Pn ) < V (Q1 , . . . , Qn ) if and only if there exists u ∈ Sn−1 such that the collection {Qui | i ∈ Tu } ∪ {Qi | i ∈ [n] \ Tu } is essential. Proof. Assume that there exists u ∈ Sn−1 such that the collection {Qui | i ∈ Tu } ∪ {Qi | i ∈ [n] \ Tu } is essential. Note that Tu is a proper subset of [n], otherwise {Qui | i ∈ Tu } is a collection of n polytopes contained in translates of an (n − 1)dimensional subspace, hence, cannot be essential. Without loss of generality we may assume that [n] \ Tu = {1, . . . , k} for some k ≥ 1. In other words, we assume the collection (3.1) {Q1 , . . . , Qk , Quk+1 , . . . , Qun } is essential. Since Pi does not touch Qui for 1 ≤ i ≤ k there is a hyperplane H = {x ∈ Rn | hx, ui = hQi (u) − ε} which separates Pi and Qui . Let H+ be the half-space containing Pi . Then the truncated polytope Q̃i = Qi ∩ H+ satisfies Pi ⊆ Q̃i ⊂ Qi . We claim that, after a possible renumbering of the first k of the Qi , the collection (3.2) {Q˜u , . . . , Q˜u , Qu , . . . , Qu } 2 k k+1 n is essential. Indeed, since (3.1) is essential, by Theorem 2.2 there exist n segments Ei ⊂ Qi with linearly independent directions such that Ei ⊂ Qui for k < i ≤ n. Replace the first k of the segments with their projections onto Q˜u1 , . . . , Q˜uk . By Lemma 3.4 below, after a possible renumbering of the first k segments, we obtain n − 1 segments E2 , . . . , En with linearly independent directions such that Ei ⊂ Q˜ui for 2 ≤ i ≤ k and Ei ⊂ Qui for k < i ≤ n. By Theorem 2.2, the collection (3.2) is essential. Now, by Proposition 3.2 and since P1 does not touch Qu1 , we obtain V (P1 , Q̃2 , . . . , Q̃k , Qk+1 , . . . , Qn ) < V (Q1 , Q̃2 , . . . , Q̃k , Qk+1 , . . . , Qn ). CRITERIA FOR STRICT MONOTONICITY OF THE MIXED VOLUME 7 Finally, by monotonicity we have V (P1 , . . . , Pn ) ≤ V (P1 , Q̃2 , . . . , Q̃k , Qk+1 , . . . , Qn ) and V (Q1 , Q̃2 , . . . , Q̃k , Qk+1 , . . . , Qn ) ≤ V (Q1 , . . . , Qn ). Therefore, V (P1 , . . . , Pn ) < V (Q1 , . . . , Qn ). Conversely, assume V (P1 , . . . , Pn ) < V (Q1 , . . . , Qn ). Then, by monotonicity, for some 1 ≤ k ≤ n we have V (P1 , . . . , Pk−1 , Pk , Qk+1 , . . . , Qn ) < V (P1 , . . . , Pk−1 , Qk , Qk+1 , . . . , Qn ). u , Qu , . . . , Qu } is By Proposition 3.2 there exists u ∈ Sn−1 such that {P1u , . . . , Pk−1 n k+1 essential and k 6∈ Tu . By choosing a segment in Qk not parallel to the orthogonal hyperplane u⊥ (which exists since Pk ⊂ Qk , but Pk does not touch Quk ) we see that u {P1u , . . . , Pk−1 , Qk , Quk+1 , . . . , Qun } is essential. It remains to notice that Piu ⊆ Qui for i ∈ Tu and, hence, the collection {Qui | i ∈ Tu } ∪ {Qi | i ∈ [n] \ Tu } is essential as well.  Lemma 3.4. Let {v1 , . . . , vk , vk+1 , . . . , vn } be a basis for Rn where vk+1 , . . . , vn belong to a hyperplane H ⊂ Rn . Let π denote the orthogonal projection onto H . Then, after a possible renumbering of the first k vectors, the set {π(v2 ), . . . , π(vk ), vk+1 , . . . , vn } is a basis for H . Proof. Clearly, the set {π(v1 ), π(v2 ), . . . , π(vk ), vk+1 , . . . , vn } spans H . Starting with the linearly independent set {vk+1 , . . . , vn } we can extend it to a basis for H by appending k − 1 vectors from {π(v1 ), . . . , π(vk )}.  Remark 3.5. Note that if Q1 , . . . , Qn are n-dimensional then {Qui | i ∈ Tu } ∪ {Qi | i ∈ [n] \ Tu } is essential if and only if {Qui | i ∈ Tu } is essential. (This can be readily seen from (2.1).) In this case we can simplify the criterion of Theorem 3.3 as follows: V (P1 , . . . , Pn ) < V (Q1 , . . . , Qn ) if and only if there exists u ∈ Sn−1 such that the collection {Qui | i ∈ Tu } is essential. Remark 3.6. After the initial submission of our paper to arxiv.org we were informed by Maurice Rojas that a similar criterion for rational polytopes appeared in his paper [10, Corollary 9]. The proof of his criterion is algebraic and is based on the BKK bound. We are thankful to Maurice Rojas for pointing that out. A particular instance of Theorem 3.3, especially important for applications to polynomial systems, is the case when P1 , . . . , Pn are arbitrary polytopes and Q1 , . . . , Qn are equal to the same polytope Q. We will assume that Q is n-dimensional, otherwise {P1 , . . . , Pn } is not essential and, hence, both V (P1 , . . . , Pn ) and V (Q, . . . , Q) = Voln (Q) are zero. Then the strict monotonicity has the following simple geometric interpretation. Corollary 3.7. Let P1 , . . . , Pn be polytopes in Rn contained in an n-dimensional polytope Q. Then V (P1 , . . . , Pn ) < Voln (Q) if and only if there is a proper face of Q of dimension t which is touched by at most t of the polytopes P1 , . . . , Pn . Proof. By Theorem 3.3 and Remark 3.5, we have V (P1 , . . . , Pn ) < Voln (Q) if and only if there exists u ∈ Sn−1 such that the collection {Qu , . . . , Qu }, where Qu is repeated |Tu | times, is essential. The last condition is equivalent to dim Qu ≥ |Tu |. 8 FRÉDÉRIC BIHAN AND IVAN SOPRUNOV This precisely means that the face Qu is touched by at most dim Qu of the polytopes.  Note that in particular, if a vertex of Q does not belong to any of the polytopes P1 , . . . , Pn , then V (P1 , . . . , Pn ) < Voln (Q). Example 3.8. Let P1 , P2 be convex polytopes in R2 and Q be the convex hull of their union. Then Corollary 3.7 shows that V (P1 , P2 ) < V (Q) if and only if either P1 or P2 does not touch some edge of Q. Remark 3.9. One can obtain a more direct proof of Corollary 3.7 by modifying the proof of Theorem 2.6 in [12]. In the case when Q equals the convex hull of P1 ∪ · · · ∪ Pn , several sufficient conditions for V (P1 , . . . , Pn ) = Voln (Q) were found by Tianran Chen in [3] whose preprint appeared on arxiv.org shortly after ours. Chen studies other applications of Corollary 3.7 to sparse polynomial systems from the computational complexity point of view. Example 3.10. Let A be a finite set in Rn with n-dimensional convex hull Q and choose a subset {a1 , . . . , an } ⊂ A. Define Ai = (A \ {a1 , . . . , an }) ∪ {ai } for 1 ≤ i ≤ n and let Pi be the convex hull of Ai . Then Corollary 3.7 leads to V (P1 , . . . , Pn ) = Voln (Q). Indeed, for any I ⊂ [n] of size n − t and any face F ⊂ Q of dimension t we have | ∪i∈I Ai | = |A| − t and |F ∩ A| ≥ t + 1. Therefore, the subsets ∪i∈I Ai and F ∩ A cannot be disjoint, i.e. every face F of dimension t is touched by the union of any n − t of the Pi . This shows that every face F of dimension t is touched by at least t + 1 of the Pi and we can apply Corollary 3.7. Going back to the statement of Corollary 3.7 it seems natural to ask: If there is a dimension t face of Q not touched by more than n − t polytopes among P1 , . . . , Pn , can the inequality V (P1 , . . . , Pn ) < Voln (Q) be improved? The answer is clearly no in the class of all polytopes: For any ε > 0, take Pi = (1 − ε)Q for 1 ≤ i ≤ n, then V (P1 , . . . , Pn ) = (1 − ε)n Voln (Q) and no face of Q is touched by any of the Pi . However, one might expect an improvement in the class of lattice polytopes. We present such an improvement of Corollary 3.7 in Proposition 3.11. Let P ⊂ Q be lattice polytopes and u ∈ Zn primitive. We can define the lattice distance from P to Q in the direction of u as the difference hQ (u) − hP (u). Note that this is a non-negative integer. Proposition 3.11. Let P1 , . . . , Pn be lattice polytopes in Rn contained in an ndimensional lattice polytope Q. Suppose there exists a facet Qv ⊂ Q, for some primitive v ∈ Zn , which is not touched by P1 , . . . , Pm , for some m ≥ 1. Moreover, suppose v that {P1v , . . . , Pm−1 } is essential. Then n! Vol Q − n! V (P1 , . . . , Pn ) ≥ l1 + · · · + lm , where li ≥ 1 is the lattice distance from Pi to Q in the direction of v . v Proof. By the essentiality of {P1v , . . . , Pm−1 } and since dim Qv = n−1 it follows that v , Qv , . . . , Qv }, where Qv is repeated for any 1 ≤ i ≤ m the collection {P1v , . . . , Pi−1 n − i times, is essential. Applying (2.3) from Remark 2.3 we obtain CRITERIA FOR STRICT MONOTONICITY OF THE MIXED VOLUME 9 n!V (P1 , . . . , Pi−1 , Q, . . . , Q) − n!V (P1 , . . . , Pi , Q, . . . , Q) = | {z } | {z } n−i+1 X (hQ (u) − hPi (u)) (n − 1)!V n−i u (P1u , . . . , Pi−1 , Qu , . . . , Qu ) ≥ u primitive v (hQ (v) − hPi (v)) (n − 1)!V (P1v , . . . , Pi−1 , Qv , . . . , Qv ) ≥ hQ (v) − hPi (v) = li , v , Qv , . . . , Qv } is eswhere the last inequality follows from the fact that {P1v , . . . , Pi−1 v v v v sential and, hence, (n−1)!V (P1 , . . . , Pi−1 , Q , . . . , Q ) is a positive integer. Summing up these inequalities for 1 ≤ i ≤ m we produce n! Vol Q − n! V (P1 , . . . , Pm , Q, . . . , Q) ≥ l1 + · · · + lm . | {z } n−m Now the required inequality follows by the monotonicity of the mixed volume.  Note that the case of m = 1 and l1 = 1 recovers an instance of Corollary 3.7 u with t = n − 1. In this case the condition that {P1u , . . . , Pm−1 } is essential is void. We remark that in general this condition cannot be removed. Indeed, let Q = conv{0, e1 , . . . , en } be the standard n-simplex, Qu one of its facets, and Pi ⊂ Q for 1 ≤ i ≤ n. Then if P1 , . . . , Pm equal the vertex of Q not contained in Qu , then 0 = n!V (P1 , . . . , Pn ) = n!Vn (Q) − 1, regardless of m. It would be interesting to obtain a more general statement than Proposition 3.11 which deals with smaller dimensional faces, rather than facets. Remark 3.12. Given a polytope Q, Corollary 3.7 provides a characterization of collections P1 , . . . , Pn such that Pi ⊂ Q for 1 ≤ i ≤ n and V (P1 , . . . , Pn ) = Voln (Q). Clearly, when Q and the Pi are lattice polytopes there are only finitely many such collections. Describing them explicitly is a hard combinatorial problem, in general. In the case when Q is the standard simplex we have Voln (Q) = 1/n!. On the other hand, since n!V (P1 , . . . , Pn ) is an integer when the Pi are lattice polytopes, Theorem 2.2 implies the following: For lattice polytopes P1 , . . . , Pn contained in the standard simplex Q we have V (P1 , . . . , Pn ) = Voln (Q) if and only if {P1 , . . . , Pn } is essential. This is a particular case of a much deeper result by Esterov and Gusev, who described all collections of lattice polytopes {P1 , . . . , Pn } satisfying V (P1 , . . . , Pn ) = 1/n!, see [5]. 4. Second Criterion In this section, we obtain another criterion for the strict monotonicity property (Theorem 4.4) based on mixed polyhedral subdivisions and the combinatorial Cayley trick. We first present a result about faces of Cayley polytopes which will be useful. Consider convex polytopes P1 , . . . , Pk ⊂ Rn . Recall that the Cayley polytope C(P1 , . . . , Pk ) is the convex hull in Rn+k of the union of the polytopes Pi × {ei } for 1 ≤ i ≤ k , where {e1 , . . . , ek } is the standard basis of Rk (see Section 2). Lemma 4.1. Let (u, v) be a vector in Rn × Rk with v = (v1 , . . . , vk ). Then hC(P1 ,...,Pk ) (u, v) = max{hPi (u) + vi | i ∈ [k]}. 10 FRÉDÉRIC BIHAN AND IVAN SOPRUNOV Moreover, C(P1 , . . . , Pk )(u,v) is the convex hull in Rn ×Rk of the union of the polytopes Piu × {ei } for i in the set I = {i ∈ [k] | hC(P1 ,...,Pk ) (u, v) = hPi (u) + vi }. Proof. Let (x, y) ∈ Rn × Rk be a point of C(P1 , . . . , Pk ). There exist αi ∈ R≥0 and P P points xi ∈ Pi for i ∈ [k] such that (x, y) = ki=1 αi (xi , ei ) and ki=1 αi = 1. Then P h(u, v), (x, y)i = ki=1 αi (hu, xi i + vi ) is bounded above by max{hPi (u) + vi | i ∈ [k]}. Moreover, this bound is attained if and only if hu, xi i + vi = max{hPi (u) + vi | i ∈ [k]} for all i such that αi > 0. Since hu, xi i+vi ≤ hPi (u)+vi ≤ max{hPi (u)+vi | i ∈ [k]}, the latter condition is equivalent to xi ∈ Piu with i ∈ I .  Remark 4.2. The polytope C(P1 , . . . , Pk ) is contained in the hyperplane {(x, y) ∈ Pk (u,v) = C(P , . . . , P ) for u = 0 and Rn × Rk | 1 k i=1 yi = 1}. Therefore, C(P1 , . . . , Pk ) v = (λ, . . . , λ) for any non-zero λ ∈ R. Moreover, if dim(P1 + · · · + Pk ) = n, then C(P1 , . . . , Pk )(u,v) = C(P1 , . . . , Pk ) only if u = 0 and v = (λ, . . . , λ) with λ ∈ R, by (2.5). Before stating the main result of this section, we need a technical lemma about regular polyhedral subdivisions (see, for example, [8] for a reference on this topic). Let A be a finite set in Rn and let A denote the convex hull of A. A polyhedral subdivision τ of A with vertices in A is called regular if there exists a map h : A → R such that τ is obtained by projecting the lower faces of the convex-hull  of {(a, h(a)) | a ∈ A} via the projection Rn+1 → Rn forgetting the last coordinates. Here a lower face of  is a face of a facet of  with an inward normal vector with positive last coordinate. Intuitively, this is a face that can be seen from below in the direction of en+1 .The union of the lower faces of  is the graph of a convex piecewise linear map ĥ : A → R whose domains of linearity are the polytopes of τ . We say that h (respectively ĥ) certifies the regularity of τ and that τ is induced by h (respectively ĥ). Note that for h generic enough any n + 2 points of {(a, h(a)) | a ∈ A} are affinely independent (i.e. do not lie on a hyperplane), hence the induced subdivision τ is a triangulation. Lemma 4.3. Let A1 , A2 be finite subsets of Rn and A1 , A2 their convex hulls. (1) If A1 ⊂ A2 and if τ1 is a regular polyhedral subdivision (respectively a regular triangulation) of A1 with vertices in A1 , then there exists a regular polyhedral subdivision (respectively a regular triangulation) τ2 of A2 with vertices in A2 such that τ1 ⊂ τ2 . (2) Assume that the relative interiors of A1 and A2 do not intersect. Let A = A1 ∪ A2 and let A denote the convex hull of A. If τ1 is a regular polyhedral subdivision (respectively a regular triangulation) of A1 with vertices in A1 and τ2 is a regular polyhedral subdivision (respectively a regular triangulation) of A2 with vertices in A2 , then there exists a regular polyhedral subdivision (respectively a regular triangulation) τ of A with vertices in A such that τ1 ∪ τ2 ⊂ τ . Proof. (1) Consider a map H : A2 → R which vanishes on A1 and takes positive values on A2 \A1 . Then, this map certifies the regularity of a polyhedral subdivision τ̃2 CRITERIA FOR STRICT MONOTONICITY OF THE MIXED VOLUME 11 of A2 with vertices in A2 and which contains A1 . Now consider a regular polyhedral subdivision τ1 of A1 with vertices in A1 whose regularity is certified by h1 : A1 → R. Then, for  > 0 small enough, the function h2 : A2 → R defined by h2 (a) = H(a) + h1 (a) if a ∈ A1 and by h2 (a) = H(a) otherwise certifies a regular polyhedral subdivision τ2 of A2 with vertices in A2 such that τ1 ⊂ τ2 . Finally, if τ1 is a triangulation and if the values of H on A2 \ A1 are generic enough, then τ2 is a triangulation. (2) Consider a regular polyhedral subdivision (respectively a regular triangulation) τi of Ai with vertices in Ai for i = 1, 2. Let hi : Ai → R be a function certifying the regularity of τi . Since the relative interiors of the convex sets A1 and A2 do not intersect, there is a hyperplane which separates A1 and A2 . This means that there exist u ∈ Rn and c ∈ R such that A1 ⊂ B− = {x ∈ Rn | hu, xi ≤ c}, A2 ⊂ B+ = {x ∈ Rn | hu, xi ≥ c} and A1 , A2 are not both contained in the separating hyperplane B+ ∩B− . Let H : A → R be a piecewise linear map which vanishes on B− and positive on B+ \B− . For  > 0 consider h : A → R defined by h(a) = H(a)+hi (a) if a ∈ Ai . If  is small enough and generic, the map h certifies the regularity of a polyhedral subdivision (respectively a regular triangulation) τ of A such that τ1 ∪ τ2 ⊂ τ .  Recall that for convex polytopes Q1 , . . . , Qn in Rn , we have V (Q1 , . . . , Qn ) > 0 if and only if the collection {Q1 , . . . , Qn } is essential, which is equivalent to the existence of a fully mixed (2n − 1)-dimensional simplex C(E1 , . . . , En ) contained in C(Q1 , . . . , Qn ), see Theorem 2.2 and Remark 2.5. We now describe a generalization of these equivalences. Consider convex polytopes Pi ⊆ Qi ⊂ Rn for 1 ≤ i ≤ n. For any non-zero vector u ∈ Rn define convex polytopes Intuitively, Bi,u the vector u. Bi,u = {x ∈ Qi | hu, xi ≥ hPi (u) , 1 ≤ i ≤ n. is the part of Qi lying on top of Pi if one looks in the direction of Theorem 4.4. Let P1 , . . . , Pn and Q1 , . . . , Qn be convex polytopes in Rn such that Pi ⊆ Qi for every i ∈ [n]. The following conditions are equivalent: (1) V (P1 , . . . , Pn ) < V (Q1 , . . . , Qn ), (2) there exists a fully mixed (2n − 1)-dimensional simplex C(E1 , . . . , En ) contained in the relative closure of C(Q1 , . . . , Qn ) \ C(P1 , . . . , Pn ), (3) there exists a non-zero vector u ∈ Rn such that the collection {B1,u , . . . , Bn,u } is essential. Proof. First we note that if dim(Q1 + · · · + Qn ) < n, then none of the conditions (1), (2) and (3) holds. Indeed, if dim(Q1 + · · · + Qn ) < n, then V (P1 , . . . , Pn ) = V (Q1 , . . . , Qn ) = 0. Moreover, dim C(Q1 , . . . , Qn ) < 2n − 1 by (2.5) and, thus, C(Q1 , . . . , Qn ) cannot contain a (2n − 1)-dimensional simplex. Finally, (3) does not hold since otherwise Q1 + · · · + Qn would contain a fully mixed polytope which has dimension n. When (P1 , . . . , Pn ) = (Q1 , . . . , Qn ), we also conclude that none of the conditions (1), (2) and (3) holds for obvious reasons. Assume now that (P1 , . . . , Pn ) 6= (Q1 , . . . , Qn ) and dim(Q1 + · · · + Qn ) = n. Write (0, 1) for the vector (u, v) with u = (0, . . . , 0) ∈ Rn and v = (1, . . . , 1) ∈ Rn . Then C(Q1 , . . . , Qn ) has dimension 2n − 1 and its affine span is a hyperplane orthogonal 12 FRÉDÉRIC BIHAN AND IVAN SOPRUNOV to (0, 1), see Remark 4.2. Consider a fully mixed simplex CE = C(E1 , . . . , En ) ⊂ C(Q1 , . . . , Qn ). Here E1 , . . . , En are segments with linearly independent directions contained in Q1 , . . . , Qn , respectively, and CE is the convex hull of the union ∪ni=1 Ei × {ei }, by Lemma 2.4. Since C(P1 , . . . , Pn ) and CE are convex sets contained in a hyperplane orthogonal to (0, 1), the simplex CE is contained in the relative closure of C(Q1 , . . . , Qn ) \ C(P1 , . . . , Pn ) if and only if there is a vector (u, v) ∈ Rn × Rn such that (u, v) and (0, 1) are not collinear and (4.1) CE ⊂ {(x, y) ∈ Rn × Rn | hu, xi + hv, yi ≥ hC(P1 ,...,Pn ) (u, v)}. Note that the hyperplane defined by hu, xi + hv, yi = hC(P1 ,...,Pn ) (u, v) is a supporting hyperplane of C(P1 , . . . , Pn ) and (4.1) means that this hyperplane separates C(P1 , . . . , Pn ) and CE . Recall that dim CE = 2n − 1 and thus CE cannot be contained in this supporting hyperplane since otherwise it would be contained in the intersection of two distinct hyperplanes. Since CE is the convex-hull of the union of the polytopes Ei × {ei } for 1 ≤ i ≤ n, we see that (4.1) is equivalent to (4.2) Ei ⊂ {x ∈ Rn | hu, xi ≥ hC(P1 ,...,Pn ) (u, v) − vi , 1 ≤ i ≤ n}. By Lemma 4.1, we have hC(P1 ,...,Pn ) (u, v) = max{hPi (u) + vi | 1 ≤ i ≤ n}. For u = 0 equation (4.2) implies v1 = · · · = vn , which contradicts the fact that (u, v) and (0, 1) are not collinear (note that hPi (u) = 0 when u = 0). Therefore, if (4.2) holds, then u 6= 0. Moreover, we get Ei ⊂ Bi,u for 1 ≤ i ≤ n since hC(P1 ,...,Pn ) (u, v) − vi ≥ hPi (u). Consequently, (4.2) implies that {B1,u , . . . , Bn,u } is essential, as the Ei have linearly independent directions (see Theorem 2.2.) We have proved the implication (2) ⇒ (3). Assume (3) holds and let u ∈ Rn be a non-zero vector such that {B1,u , . . . , Bn,u } is essential. Let Ei ⊂ Bi,u , for 1 ≤ i ≤ n, be segments with linearly independent directions and choose v = (v1 , . . . , vn ) ∈ Rn such that hP1 (u)+v1 = · · · = hPn (u)+vn . Then, by Lemma 4.1, hC(P1 ,...,Pn ) (u, v) = hPi (u) + vi for 1 ≤ i ≤ n and (4.2) follows from Ei ⊂ Bi,u , 1 ≤ i ≤ n. Since (4.2) is equivalent to (2), we conclude that (3) ⇒ (2). Now assume that (2) holds. Then, there exists a fully mixed (2n − 1)-dimensional simplex CE satisfying (4.1). It follows then from Lemma 4.3 that there exists a triangulation of C(Q1 , . . . , Qn ) with vertices in ∪ni=1 Qi ×{ei } which contains CE and restricts to a triangulation of C(P1 , . . . , Pn ). Indeed, we may apply part (2) of Lemma 4.3 to the set of vertices A1 of CE and to the set of vertices A2 of C(P1 , . . . , Pn ). Taking for τ1 the trivial triangulation of CE and for τ2 any regular triangulation induced by a generic function h2 , we get the existence of a regular triangulation of the convex hull of A = A1 ∪ A2 which contains CE and τ2 . Applying part (1) of Lemma 4.3 to A ⊂ A ∪ V where V is the set of vertices of C(Q1 , . . . , Qn ) gives a regular triangulation of C(Q1 , . . . , Qn ) as required. By the combinatorial Cayley trick, this corresponds to a pure mixed subdivision τQ of Q1 + · · · + Qn restricting to a pure mixed subdivision τP of P1 + · · · + Pn and a fully mixed polytope E contained in τQ \ τP . Therefore, V (P1 , . . . , Pn ) < V (Q1 , . . . , Qn ) by Lemma 2.6. This proves the implication (2) ⇒ (1). Assume now that V (P1 , . . . , Pn ) < V (Q1 , . . . , Qn ). Then, as in the proof of Theou , Qu , . . . , Qu } rem 3.3, there exist u ∈ Sn−1 and 1 ≤ k ≤ n such that {P1u , . . . , Pk−1 n k+1 u is essential and Pk does not touch Qk . By choosing a segment in Bk,u not parallel CRITERIA FOR STRICT MONOTONICITY OF THE MIXED VOLUME 13 to the hyperplane u⊥ , which exists since Pk does not touch Quk , we conclude that u ,B u u u {P1u , . . . , Pk−1 k,u , Qk+1 , . . . , Qn } is essential as well. It remains to note that Pi u and Qi are contained in Bi,u for i 6= k , 1 ≤ i ≤ n. We have proved the implication (1) ⇒ (2).  Remark 4.5. Note that if Pi touches Qui then Bi,u = Qui and if Pi does not touch Qui then dim Bi,u = dim Qi . Therefore, the condition (3) in the above theorem is equivalent to the condition in Theorem 3.3. 5. Polynomial systems Consider a finite set A = {a1 , . . . , a` } ⊂ Zn where ` = |A|. Let (a1j , . . . , anj ) be the coordinates of aj for 1 ≤ j ≤ `. Consider a Laurent polynomial system with coefficients in an algebraically closed field K f1 (x) = · · · = fn (x) = 0, (5.1) P` a a where fi (x) = j=1 cij xaj and xaj stands for the monomial x11j · · · xnnj . We assume that no polynomial fi is the zero polynomial. Call Ai = {aj ∈ A | cij 6= 0} the individual support of fi . We may assume that for any 1 ≤ j ≤ ` there exists i such that cij 6= 0. Then A = ∪ni=1 Ai is called the total support of the system (5.1). The Newton polytope Pi of fi is the convex hull of Ai and the Newton polytope Q of the system (5.1) is the convex hull of A. The matrices C = (cij ) ∈ Kn×` and A = (aij ) ∈ Zn×` are the coefficient and exponent matrices of the system, respectively. Choose u ∈ Sn−1 and let Aui = Piu ∩ Ai . Then the restricted system corresponding to u is the system f1u (x) = · · · = fnu (x) = 0, P where fiu (x) = `j=1 cuij xaj with cuij = cij if aj ∈ Aui and cuij = 0, otherwise. Finally, a system (5.1) is called non-degenerate if for every u ∈ Sn−1 the corresponding restricted system is inconsistent. The relation between mixed volumes and polynomial systems originates in the following fundamental result, known as the BKK bound, discovered by Bernstein, Kushnirenko, and Khovanskii, see [1, 6, 7]. Theorem 5.1. The system (5.1) has at most n! V (P1 , . . . , Pn ) isolated solutions in (K∗ )n counted with multiplicity. Moreover, it has precisely n! V (P1 , . . . , Pn ) solutions in (K∗ )n counted with multiplicity if and only if it is non-degenerate. Remark 5.2. Systems with fixed individual supports and generic coefficients are non-degenerate. Moreover, the non-degeneracy condition is not needed if one passes to the toric compactification XP associated with the polytope P = P1 + · · · + Pn . Namely, a system has at most n! V (P1 , . . . , Pn ) isolated solutions in XP counted with multiplicity, and if it has a finite number of solutions in XP then this number equals n! V (P1 , . . . , Pn ) counted with multiplicity. 14 FRÉDÉRIC BIHAN AND IVAN SOPRUNOV There are two operations on (5.1) that preserve its number of solutions in the torus (K∗ )n : Left multiplication of C by an element of GLn (K) and left multiplication of the augmented exponent matrix   1 ··· 1 Ā = ∈ Z(n+1)×` A by a matrix in GLn+1 (Z) whose first row is (1, 0, . . . , 0). The first operation obviously produces an equivalent system. The second operation amounts to applying an invertible affine transformation with integer coefficients a 7→ b + `(a) on the total support A ⊂ Zn . Here b ∈ Zn is a translation vector and ` : Rn → Rn is a linear map whose matrix with respect to the standard basis belongs to GLn (Z). A basic result of toric geometry says that there is a monomial change of coordinates x 7→ y of the torus (K∗ )n so that xa = y `(a) for any a ∈ (K∗ )n . Moreover, translating A by b amounts to multiplying each equation of (5.1) by the monomial xb . Thus starting from (5.1), we get a system with same coefficient matrix, total support b + `(A), and the same number of solutions in (K∗ )n . Remark 5.3. Consider a non-degenerate system with coefficient matrix C . While left multiplication of C by an invertible matrix does not preserve the individual supports and Newton polytopes in general, it preserves the total support of the system. Indeed, since A is the total support of the system, no column of C is zero, and thus no column of C can become zero after left multiplication by an invertible matrix. Example 5.4. Assume that (5.1) has precisely n! Voln (Q) solutions in (K∗ )n counted with multiplicity and C has a non-zero maximal minor. Up to renumbering, we may assume that this minor is given by the first n columns of C . Left multiplication of (5.1) by the inverse of the corresponding submatrix of C gives an equivalent system with invidual supports A0i ⊂ A00i = (A \ {a1 , . . . , an }) ∪ {ai } for 1 ≤ i ≤ n. Thus, this new system has precisely n! Voln (Q) solutions in (K∗ )n counted with multiplicity. By Theorem 5.1 this number of solutions is at most n! V (P10 , . . . , Pn0 ), where Pi0 is the convex hull of A0i . On the other hand, by monotonicity of the mixed volume we have V (P10 , . . . , Pn0 ) ≤ V (P100 , . . . , Pn00 ) ≤ Voln (Q). We conclude that V (P10 , . . . , Pn0 ) = V (P100 , . . . , Pn00 ) = Voln (Q). The second equality is also a consequence of Corollary 3.7, see Example 3.10. Theorem 5.5. Assume dim Q = n. If a system (5.1) has n! Voln (Q) isolated solutions in (K∗ )n counted with multiplicity, then for any proper face F of Q the submatrix CF ∈ Kn×|F | of C with columns indexed by F = {j ∈ [`] , aj ∈ F ∩ A} satisfies rank CF ≥ dim F + 1, or equivalently, (5.2) rank CF ≥ rank ĀF . Conversely, if (5.2) is satisfied for all proper faces F of Q and if the system (5.1) is non-degenerate, then it has precisely n! Voln (Q) isolated solutions in (K∗ )n counted with multiplicity. CRITERIA FOR STRICT MONOTONICITY OF THE MIXED VOLUME 15 Proof. First, note that for any proper face F of Q we have rank ĀF = dim F + 1. Consider a proper face F of Q of codimension s ≥ 1 and assume that rank CF ≤ dim F = n − s. Then there exist an invertible matrix L and I ⊂ [n] of size |I| = s such that the submatrix of C 0 = LC with rows indexed by I and columns indexed by F is the zero matrix. The matrix C 0 is the coefficient matrix of an equivalent system with the same total support, see Remark 5.3. Denote by P10 , . . . , Pn0 the individual Newton polytopes of this equivalent system. Then the polytopes Pi0 for i ∈ I do not touch the face F of Q, as I corresponds to the zero submatrix of C 0 . Since dim F = n − s and |I| = s, it follows then from Corollary 3.7 that V (P10 , . . . , Pn0 ) < Voln (Q). Theorem 5.1 applied to the system with coefficient matrix C 0 gives that it has at most n!V (P10 , . . . , Pn0 ) < n! Voln (Q) isolated solutions in (K∗ )n counted with multiplicity. The same conclusion holds for the equivalent system (5.1). Therefore, if (5.1) has n! Voln (Q) isolated solutions in (K∗ )n counted with multiplicity, then (5.2) is satisfied for all proper faces F of Q. Conversely, assume that (5.1) is non-degenerate and that (5.2) is satisfied for all proper faces F of Q. Then (5.1) has n! V (P1 , . . . , Pn ) isolated solutions in (K∗ )n counted with multiplicity by Theorem 5.1. Suppose that V (P1 , . . . , Pn ) < Voln (Q). Then by Corollary 3.7 there exists a proper face F of Q of codimension s ≥ 1 and I ⊂ [n] of size |I| = s such that the polytopes Pi for i ∈ I do not touch F . But then rank CF ≤ n−s = dim F , which gives a contradiction. Thus V (P1 , . . . , Pn ) = Voln (Q) and (5.2) has n! Voln (Q) isolated solutions in (K∗ )n counted with multiplicity.  As an immediate consequence of Theorem 5.5 from which we keep the notation, we get the following corollary. Corollary 5.6. Consider any Laurent polynomial system (5.1) with dim Q = n. If there exists a proper face F of Q such that rank CF < rank ĀF , then the system has either infinitely many solutions or strictly less than n! Voln (Q) solutions in (K∗ )n counted with multiplicity. Proof. Assume the existence of a proper face F of Q such that rank CF < rank ĀF . If (5.1) has precisely n! Voln (Q) solutions in (K∗ )n counted with multiplicity, then it is non-degenerate by Theorem 5.1 and thus rank CF ≥ rank ĀF by Theorem 5.5, a contradiction.  A very nice consequence of Theorem 5.5 is the following result, which can be considered as a generalization of Cramer’s rule to polynomial systems. Corollary 5.7. Assume that dim Q = n and that no maximal minor of C vanishes. Then the system (5.1) has the maximal number of n! Voln (Q) isolated solutions in (K∗ )n counted with multiplicity. Proof. Note that ` ≥ n + 1 since dim Q = n (recall that ` is the number of columns of C ). Thus a maximal minor of C has size n and the fact that no maximal minor of C vanishes implies that for any J ⊂ [`] the submatrix of C with rows indexed by [n] and columns indexed by J has maximal rank. This rank is equal to n if |J| ≥ n or to |J| if |J| < n. Since |F| ≥ dim F + 1 = rank ĀF for any face F of Q, we get that rank CF ≥ rank ĀF for any proper face F of Q. Moreover, no restricted system is consistent for otherwise this would give a non-zero vector in the kernel of the 16 FRÉDÉRIC BIHAN AND IVAN SOPRUNOV corresponding submatrix of C . Thus (5.1) is non-degenerate and the result follows from Theorem 5.5.  When the polytope Q = conv{0, e1 , . . . , en } is the standard simplex, the system (5.1) is linear and it has precisely n! Voln (Q) = 1 solution in (K∗ )n if and only if no maximal minor of C ∈ Kn×(n+1) vanishes, in accordance with Cramer’s rule for linear systems. 6. Examples We conclude with a few examples illustrating the results of the previous section. Example 6.1. Let A1 = {(0, 0), (1, 2), (2, 1)} and A2 = {(2, 0), (0, 1), (1, 2)} be individual supports, and A = A1 ∪ A2 the total support of a system. The Newton polytopes P1 = conv A1 , P2 = conv A2 , and Q = conv A are depicted in Figure 1, where the vertices of P1 and P2 are labeled by {1, 2, 3} and {4, 5, 2}, respectively. We use the labeling in Figure 1 to order the columns of the augmented matrix Figure 1. The mixed volume of the two triangles equals the volume of the pentagon.   1 1 1 1 1 Ā = 0 1 2 2 0 . 0 2 1 0 1 A general system with these supports has the following coefficient matrix   c11 c12 c13 0 0 C= , 0 c22 0 c24 c25 where cij ∈ K are non-zero. One can see that each edge of Q is touched by both P1 and P2 , hence, V (P1 , P2 ) = Vol2 (Q), see Example 3.8. Also one can check that the rank conditions rank CF ≥ rank ĀF are satisfied for every face F of Q. (In fact, both ranks equal 2 when F is an edge and 1 when F is a vertex.) Example 6.2. Now we modify the previous example slightly, keeping A1 the same and changing one of the points in A2 , so A2 = {(2, 0), (0, 1), (1, 1)}, see Figure 2. The augmented exponent matrix and the coefficient matrix are as follows.     1 1 1 1 1 1 c11 c12 c13 0 0 0   Ā = 0 1 2 2 0 1 , C = . 0 0 0 c24 c25 c26 0 2 1 0 1 1 CRITERIA FOR STRICT MONOTONICITY OF THE MIXED VOLUME 17 Figure 2. The mixed volume of the two triangles is less than the volume of the pentagon. This time the edge of Q labeled by F = {2, 3} is not touched by P2 and, hence, V (P1 , P2 ) < Vol2 (Q). Also, the rank condition for F = {2, 3} fails: rank CF = 1 and rank ĀF = 2. Example 6.3. Consider a system defined by the following trix and coefficient matrix    1 1 1 1 1 1 1 3 5 0 1 1 0 0 0  , C =  1 1 −3 Ā =  0 0 1 1 0 1 1 3 1 0 0 0 0 1 1 augmented exponent ma1 −2 3 1 3 −1  2 −1  . 1 Here P1 = P2 = P3 = Q which is a prism depicted in Figure 3. We label the vertices of Q using the order of the columns in Ā. The submatrix of C corresponding Figure 3. The Newton polytope of the system in Example 6.3. to the edge F labeled {5, 6} has rank 1 which is less than dim F + 1. Therefore the associated system has less than 3! Vol3 (Q) = 3 isolated solutions in (C∗ )3 . (In fact, it has two solutions.) In particular, this is a degenerate system. In the following very particular situation, the rank condition (5.2) in Theorem 5.5 implies the non-degeneracy of the system. 18 FRÉDÉRIC BIHAN AND IVAN SOPRUNOV Remark 6.4. Assume that P1 = P2 = · · · = Pn = Q with dim Q = n and any proper face F of Q is a simplex which intersects A only at its vertices. Assume furthermore that rank CF ≥ rank ĀF for any proper face F of Q. Then (5.1) is non-degenerate and thus has precisely n! Voln (Q) solutions in (K∗ )n counted with multiplicity according to Theorem 5.1. Indeed, if F is a proper face of Q, then the corresponding restricted system has total support F ∩ A. If this restricted system is consistent, then there is a non-zero vector in the kernel of CF and thus rank CF < |F ∩ A| = 1 + dim F which gives a contradiction. References [1] D. N. Bernstein, The number of roots of a system of equations, Funct. Anal. and Appl. 9 (2), (1975) 183–185. [2] B. Bertrand and and F. Bihan, Intersection multiplicity numbers between tropical hypersurfaces, Algebraic and combinatorial aspects of tropical geometry, Contemp. Math., vol. 589, Amer. Math. Soc., Providence, RI, 2013, pp. 1–19. [3] T. Chen, Unmixing the mixed volume computation, preprint arXiv:1703.01684 [4] D. Cox, J. Little and D. O’Shea, Using Algebraic Geometry, Graduate texts in mathematics v. 185. Springer, New York, (2005). [5] A. Esterov and G. Gusev, Systems of equations with a single solution, Journal of Symbolic Computation Volume 68, Part 2, (2015) 116–130 [6] A. G. Khovanskii, Newton polyhedra and the genus of complete intersections, Funct. Anal. Appl., 12 (1978), pp. 38-46. [7] A. G. Kushnirenko, Newton polyhedra and Bezout’s theorem (Russian) Funkcional. Anal. i Prilozhen. 10, no. 3, (1976) 82–83. [8] B. Huber, J. Rambau and F. Santos, The Cayley trick, lifting subdivisions and the BohneDress theorem on zonotopal tilings, J. Eur. Math. Soc. (JEMS) 2 (2000),no. 2, 179–198. [9] B. Huber and B. Sturmfels, A polyhedral method for solving sparse polynomial systems, Math. Comp. 64 (1995), no. 212, 1541–1555 [10] M. Rojas, A convex geometric approach to counting the roots of a polynomial system, Theoretical Computer Science 133 (1994) 105–140 [11] R. Schneider, Convex Bodies: the Brunn–Minkowski Theory. 2nd edition, Encyclopedia of Mathematics and its Applications 151, Cambridge University Press, Cambridge 2014. [12] I. Soprunov, A. Zvavitch, Bezout Inequality for Mixed Volumes, Int Math Res Notices (2016) 2016 (23): 7230–7252. [13] B. Sturmfels. On the Newton polytope of the resultant. Journal of Algebraic Combinatorics 3 (1994), 207–236. (Frédéric Bihan) Département de Mathématiques LAMA, Université Savoie Mont Blanc, France E-mail address: [email protected] (Ivan Soprunov) Department of Mathematics, Cleveland State University, Cleveland, OH USA E-mail address: [email protected]
0math.AC
Fast initial guess estimation for digital image correlation Peihan Tua,* a Guangdong University of Technology, School of Automation, Waihuanxi Road, Guangzhou, China, 510006 Abstract. Digital image correlation (DIC) is a widely used optical metrology for quantitative deformation measurement due to its non-contact, low-cost, highly precise feature. DIC relies on nonlinear optimization algorithm. Thus it is quite important to efficiently obtain a reliable initial guess. The most widely used method for obtaining initial guess is reliability-guided digital image correlation (RG-DIC) method, which is reliable but path-dependent. This path-dependent method limits the further improvement of computation speed of DIC using parallel computing technology, and error of calculation may be spread out along the calculation path. Therefore, a reliable and pathindependent algorithm which is able to provide reliable initial guess is desirable to reach full potential of the ability of parallel computing. In this paper, an algorithm used for initial guess estimation is proposed. Numerical and real experiments show that the proposed algorithm, adaptive incremental dissimilarity approximations algorithm (A-IDA), has the following characteristics: 1) Compared with inverse compositional Gauss-Newton (IC-GN) sub-pixel registration algorithm, the computational time required by A-IDA algorithm is negligible, especially when subset size is relatively large; 2) the efficiency of A-IDA algorithm is less influenced by search range; 3) the efficiency is less influenced by subset size; 4) it is easy to select the threshold for the proposed algorithm. Keywords: digital image correlation, fast algorithm, computer vision, deformation measurement. *First Author, E-mail: [email protected] 1. Introduction Digital image correlation (DIC) is a convenient, non-contact and low-cost tool for full-field deformation measurement [1]. During the past several years, significant progresses have been made in terms of the accuracy, robustness and efficiency of DIC. In the aspect of accuracy, several sub-pixel registration algorithms have been developed, including the correlation coefficient curve-fitting method (CCCFM) [2], the gradient-based method (GBM) [3, 4], and the classic Newton-Raphson algorithm [5, 6] with forward additive mapping strategy (FA-NR). CCCFM and GBM algorithm are fast but not considered the influence of strain. Though FA-NR algorithm gives a better performance in terms of the accuracy of DIC, the computation cost is expensive. The problem became increasingly critical with the rapid increment of the number of the point of interest (POI). Recently, it is a trend to develop adaptive 1 DIC algorithm. By optimize either the selection of subset size or sampling locations in subsets, researchers obtain more accurate and precise displacement and strain fields [7, 8]. Moreover, principles from p-adaptive finite element analysis are introduced to obtain a self-adapting higher order mesh in the finite-element-based global DIC algorithms [9]. These methods, though improve the accuracy of DIC, are computed more expensively due to the introduction of new parameters. The reduction of computation complexity is desirable for the real-time DIC. In view of robustness, it is improved in some specific situations, which greatly expands the usage of DIC. To measure a large deformation, Pan et al developed a novel approach to ensure the rapid and correct convergence of the nonlinear optimization algorithm by providing an accurate and reliable initial guess [10]. Poissant proposed a “sutset splitting” procedure for discontinuous displacement fields, for example, a crack [11]. Valle et al. proposed the Heaviside-based DIC method for the study of materials including multiple crossing cracks [12]. To circumvent the problem resulted from light reflections, DIC algorithm based on single minimization with several pairs of images where the reflections are located in different regions is proposed [13]. To decrease the influence of change in light condition, a weighted normalized gradient-based algorithm [14] is proposed due to the insensitivity of the gradient to the illumination variation. At the same time, inverse compositional Gauss-Newton (IC-GN) algorithm has been introduced to increase the efficiency of DIC. The main benefit of IC-GN over FA-NR is its computation efficiency advantage by eliminating repeated calculation of intensity gradients and the inverse of the Hessian matrix during the iterations [15]. Recently, with the rapid development of parallel computing technology, GPU-based DIC algorithms have also been noticed by researchers. However, DIC algorithm based on reliability-guided displacement tracking (RGDT) strategy is reliable but path-dependent [19], which limits the further improvement of computation 2 speed of DIC using parallel computing technology, and error of calculation may be spread out along the calculation path. To reduce these negative influences, Pan proposed an improved RGDT strategy using a two-section tracking scheme [16] to give play to the ability of parallel computing. Jiang et al. developed a path-independent fast Fourier transform-based cross correlation (FFT-CC) algorithm to estimate the initial guess [17, 18], while it is sensitive to small deformation and only applied to rectangular subset. Wu et al proposed an efficient integer-pixel search scheme with combination of an improved particle swarm optimization (PSO) algorithm and the block-based gradient descent search (BBGDS) algorithm [20], but it cannot guarantee the optimum because the search may be trapped in a local region. A reliable and path-independent algorithm which is able to provide reliable initial guess is desirable to reach full potential of the ability of parallel computing. In this paper, a template matching algorithm called incremental dissimilarity approximations (IDA) is introduced into DIC, which overcomes the deficiencies of FFT-CC algorithm and the algorithm adopting PSO and BBGDS. IDA is proposed in 2009 by Tombari for fast template matching [21]. It prunes most subset candidates using a threshold with little addition/subtraction operations, which reduce the computation complexity. The original IDA is based on sum absolute difference (SAD) or sum square difference (SSD) criteria. Though SAD and SSD are efficient to calculate, they are influenced by speckle pattern, subset size and image noise, thus the threshold required by IDA is also influenced by these factors. For simpler setup of the threshold, adaptive scheme with modified SAD is applied in improved IDA algorithm. The numerical and real experiments show that the initial guess obtained by adaptive IDA (A-IDA) algorithm is able to make IC-GN algorithm converge fast without sacrifice of accuracy. 3 This paper is organized as follows: section 2 gives a brief introduction of DIC; in section 3, the principles of A-IDA algorithm are presented; section 4 examines the feasibility and effectiveness of the proposed algorithm; section 5 concludes our work. 2. Basic Principle of DIC In traditional DIC, a square subset located at the center of an interested point (x0, y0) is selected as reference subset f(x, y) with a size of N ×N pixels (N is an odd number) in the reference image. Then DIC algorithms find the target subset g(x, y) in the target image. Using first-order warp function, the relationship between (x, y) and (x, y) is given as x  x0  x  u  u x x  u y y y   y0  y  v  v x x  v y y , . (1) Where u and v are the displacement components of the interested point (x0, y0) in x-axis and yaxis; ux, uy, vx and vy represent their gradient components; Δx and Δy are the distances between (x0, y0) and (x, y) in x-axis and y-axis, respectively. To obtain the target subset with speed, accuracy and robustness, the standard displacement tracking algorithm in path-independent DIC [18, 20] can be simply described as a two-step procedure: a) Obtain initial guess using integer-pixel registration. In this step, the following zero-normalized cross-correlation (ZNCC) criterion is often used: C ZNCC    f ( x, y)  f  g ( x, y)  g    f ( x, y)  f   g ( x, y)  g  m x,y m 2 x,y m 2 x,y . (2) m b) Optimize displacement parameters using nonlinear optimization methods, such as FA-NR and IC-GN algorithms. IC-GN is more efficient than FA-NR and with approximately equivalent accuracy. For IC-GN algorithm, the following zero-normalized sum of squared differences (ZNSSD) criterion is used: 4 C ZNSSD     x, y     where f m  f ( x, y )  f m  f ( x, y )  f    2 x, y 1 N2 m  x, y g ( x , y )  g m g ( x, y )  g  2 x, y m 1 N2 f ( x, y ) , g m   x,y      2 , (3) g ( x, y ) . 3. Theory 3.1. Standard IDA algorithm For simplicity, given a vector A of length k as target image, S is a one-dimensional reference subset with a length of r. As S slides on A, there are k – r + 1 candidate target vectors C (onedimensional target subset). For reference subset S and each candidates C, they are correspondingly divided into p sub-vectors [21]: si, ci, i = 1,… p (it is not necessary for p sub-vectors to contain the same number of components). Partial sum absolute difference (PSAD) is defined as PSAD(i)  num( si or ci ) s i,j  ci,j . (4) j 1 Partial one-norm (PON) is defined as PON( S , i )  num( si or ci ) num( si or ci ) j 1 j 1  si,j , PON(C , i )  c i,j , (5) where num(•) represents the number of components in si (ci). si, j (ci, j) represents the jth component in si (ci). Then, the following inequality is established by using triangular inequality principal PSAD( i )  PON( S , i )  PON( C , i ) i  1,... p . (6)  PSAD(i)   PON( S , i)  PON(C, i) . (7) In addition, SAD  p p i 1 i 1 According to Eq. (6) and (7), a threshold th can be set to discriminate the matching and nonmatching candidates for the dissimilarity criterion SAD. 5 p  PON( S , i)  PON(C, i)  th . (8) i 1 If Eq. (8) does not hold, which means C is not a nonmatching candidate, a tighter lower bound can be obtained by replacing the left term of Eq. (8) by the use of triangular inequality principal. p PSAD(t )   PON(S , i)  PON(C, i)  th t  1,... p , (9) i 1,i  t In fact, this process is repeated until SAD between S and C is calculated or a pruning condition based on a tighter lower bound is satisfied.  p SAD   PON(S , i)  PON(C, i)  p PSAD(i )  ...  PSAD(q)  PSAD(t )  i 1 i 1,i t ,i  q  PON(S , i)  PON(C, i) p PASD(t )  (10) i 1,i t  PON(S , i)  PON(C, i)  th p  i 1 Finally, p SAD   PSAD(i)  th , (11) i 1 If Eq. (11) does not hold, then C is a matching candidate. The target subset can be obtained from the set of matching candidates by selecting the candidate with minimum SAD. It seems to be unclear why this algorithm can improve the speed of template matching (integerpixel registration). The reasons are that a) PON can be pre-computed quickly and independently using fast incremental calculation schemes [22], while PSAD (thus SAD) cannot; b) A large number of calculations are spared if candidates are pruned by Eq. (8). In fact, Eq. (8) prunes most of nonmatching candidates if a proper threshold is selected. c) The tighter the lower bound is, computationally the more demanding function is calculated. For two-dimensional rectangular subset, S and C are partitioned into p equally sized rectangular regions along the rows. It should be noted that irregular subset can also be used in IDA 6 algorithms by partitioning it into p irregular parts. In this work, only rectangular subset is considered. 3.2. Adaptive IDA (A-IDA) algorithms According to section 3.1, the threshold is very critical because it determines whether the algorithm can succeed in obtaining the target subset with integer-pixel accuracy. When threshold is small, IDA algorithm will probably fail without obtaining target subset. When threshold is large, the efficiency reduces and sometimes is even lower than simple integer-pixel searching. First of all, to overcome these deficiencies, the single values th is modified to a simple equation th   S k S  2 , where S represents the average of S. Combined with this modification, a new A- kS IDA algorithm is proposed by adjusting the value th adaptively. The detailed descriptions of A-IDA algorithm are as follows. Step 1: Standard IDA algorithm with modified threshold th0 is used to discriminate all the candidates. A series of sets A1, A2, A3, … Ap+1 are created by collecting the candidates which are pruned by different inequalities in Eq. (10) (the right term of these inequities is “th”). There are p + 1 sets which corresponds to p + 1 inequalities. For example, if the left term of an inequality is p PASD (q)  PASD (t )   PON (S , i)  PON (C, i) , then a candidate pruned by this inequality belongs i 1, i  t , i  q to A3. Step 2: Check whether the top (with the biggest subscript) nonempty set ATN is Ap+1. If not, then that’s mean the matching candidates are not obtained and the algorithm proceeds to step 3. Otherwise, pick the candidate with minimum SAD which belongs to ATN (Ap+1) as target image with integer-pixel accuracy. 7 Step 3: Let th  th + dth and repeat step 1 which now discriminates the candidates within ATN. dth, which is equal to 1, is the increment of adaptive threshold in A-IDA algorithm. From the description of the A-IDA algorithm, it is evident that initial threshold th0 is easier to be determined due to the introduction of adaptive scheme (Step 3). Moreover, the modified threshold is less influenced by subset size but highly influenced by speckle patterns and image noises. Therefore, pre-processed speckle images are used in the process of integer-pixel registration. The speckle images are blurred using normalized box filter [22], and then the histograms of the speckle images are equalized [23]. Image blurring is able to reduce the influence of image noise on the threshold. Histogram equalization (HE) can reduce the influence of the variation of speckle patterns on it and increase the difference between reference subset and nonmatching candidate. With the help of the two pre-processed methods, the setup of threshold of A-IDA is relatively fixed in the application of DIC. Fig. 1 presents a flow chart that describes the procedures of the proposed A-IDA algorithm, where the lower subscript q, which is to the right of “Eq. (10)”, indicates qth inequality (from the right) in Eq. (10). 8 Fig. 1 The flow chart of the newly proposed A-IDA algorithm 3.3. Inverse Compositional Gauss-Newton Algorithm Compared with FA-NR algorithm, IC-GN is more efficient to compute mainly due to its avoidance of repeatedly calculating Hessian matrix. The principle is briefly introduced in this section. More details can be found in [15]. Consider the ZNSSD criterion with an affine warp function CZNSSD     f (x  W(ξ ; p))  f g (x  W(ξ ; p))  g     f g   uy 1  u x  W (ξ ; p )   v x 1 vy  0 0 2 , (12) u   x  v  y  . 1   1  (13) Where f (x), g (x) denotes the gray level at global pixel coordinates x; f , g represent the average of reference and target subsets; ξ = [x, y, 1]T is the local coordinates in reference or target 9 subsets; f   f (x  W(ξ ; p))  f  2 and g  g (x  W(ξ ; p))  g  ; p = [u, ux, uy, v, vx, vy]T and its 2 increment p = [u, ux, uy, v, vx, vy]T. Eq. (12) is a least-square problem, which can be solved from Eq. (14) by minimizing CZNSSD with respect to p p  H 616    T  W    f  f    f (x   )  f  g (x  W( ; p))  g  . p 61  g   (14) Different from FA-NR algorithm, the warp function of the target subset is updated in the following way W ( ; p)  W ( ; p)  W -1 ( ; p) . (15) The iteration calculation is repeated until convergence conditions p  0.001 are satisfied. IC-GN algorithm is approved as an efficient method for sub-pixel registration in DIC. Compared with FA-NR, IC-GN is more suitable to implement in the real-time DIC, due to its constant parameters in the iteration calculation, for example, Hessian matrix. Particularly, Pan et al. [15] used interpolation coefficient look-up table for bicubic interpolation, which further reduce the redundant computation in IC-GN algorithm. These pre-computations, at the beginning of ICGN algorithm, make IC-GN algorithm more efficient and keep the same accuracy as that of FANR. 4. Experimental Verification To demonstrate the performance of the proposed algorithm, numerical and real experiments are conducted in the aspects of speed and accuracy. The proposed method was coded using C++ language and run on a laptop computer (Inter(R) Core (TM) i7-4510U CPU with main frequency 2.00GHz, 4GB RAM). 10 4.1. Numerical experiment As shown in Fig. 2, 8bit speckle images with a size of 300 × 300 pixels are numerically generated, which contain 3000 speckles with a radius of 3 pixels. Gaussian noise with mean 0, variance 4 is added into these speckle images. The speckle images used in A-IDA algorithm are pre-processed using box filter [22] with blurring kernel size 15 × 15 pixels and histogram equalization [23]. It should be noted that the time of preprocessing is negligible compared with those of A-IDA and IC-GN algorithms, thus the data is not given in the paper. A region of interest (ROI) centered at (150, 150) of the reference image is of size 200 × 200 pixels. There are 101 × 101 = 10201 interested points regularly distributed in the ROI. The grid step is 2 pixels. Rigid body translation is applied to the reference images, varying from 0 to 21. The step is 1.05 pixels. The subset size ranged between 21 × 21 and 63 × 63 pixels are investigated in the numerical experiments and the step is 6 pixels. In the process of integer-pixel registration, the search range in x-axis is [-5, +5] pixels. The search range in y-axis varies from [-5, 15] to [-5, 45] pixels. The initial threshold th0 is also investigated in the numerical experiments, which varies from 0.5 to 6 and the step is 0.5. In the process of IC-GN algorithm, the subset is of the same size as that used in A-IDA algorithm, and the convergence conditions of the algorithms are set be the norm of the incremental displacement vector being equal to or less than 10-4 pixels. In the numerical experiments, the basic parameters are: 33 × 33 pixels subset, th0 = 1, search range in y-axis [-5, 45] and 10.50 pre-set displacement. The others parameters are unchanged when one of these variables is investigated in the experiments. Fig. 3 shows the mean bias error and standard deviation [15] of the rigid body translation experiments. Tables 1–4 show the average computational time at each POI with respect to pre-set displacement, search range, subset size and initial threshold, respectively. From these tables, it can 11 be concluded: 1) the computational time consumed by A-IDA is about one-sixth of that by IC-GN algorithm (Table 1); 2) the average computational time is less influenced by search range; the experiments show the growth of computational time is slower than linear growth with respect to search range (Table 2); as the search range in y-axis is [-5, +15], the average computational time at each POI is 0.06 ms; as the search range in y-axis is [-5, +45], it is 0.10ms; 3) the efficiency is less influenced by subset size; as subset size increases from 21 to 63 (Table 3), the average computational time at each POI increases from 0.11 to 0.15 ms; hence, it is evident that the computational time required by A-IDA algorithm will become negligible compared with that by IC-GN algorithm with the increment of subset size; 4) it is easy to select the initial threshold (Table 4); the variation of computational time is smaller than 0.1 ms as the threshold th0 increases from 0.5 to 6.0; the selection of the threshold has less influence on the efficiency. Fig. 2 Reference image and ROI Fig. 3 Mean bias and standard deviation error of rigid body translation experiments; subset size 33, th0 = 1, search range in y-axis [-5, 45] 12 Table 1 Average computational time at each POI with respect to pre-set displacement using A-IDA and IC-GN algorithm; subset size 33 × 33 pixels, th0 = 1, search range in y-axis [-5, 45] Average computational time (ms) A-IDA IC-GN 0.10 0.55 0.10 0.57 0.10 0.57 0.10 0.60 0.11 0.61 0.10 0.62 0.10 0.62 0.10 0.65 0.10 0.65 0.10 0.64 0.10 0.63 0.10 0.63 0.10 0.62 0.10 0.62 0.10 0.63 0.11 0.61 0.10 0.60 0.10 0.57 0.10 0.55 0.10 0.54 Pre-set displacement (pixel) 1.05 2.10 3.15 4.20 5.25 6.30 7.35 8.40 9.45 10.50 11.55 12.60 13.65 14.70 15.75 16.80 17.85 18.90 19.95 21.00 Table 2 Average computational time at each POI with respect to search range; pre-set displacement 10.50 pixels, subset size 33 × 33 pixels, th0 = 1 search range in y-axis (pixel) [-5, 15] Average computational time (ms) 0.06 [-5, 25] 0.07 [-5, 35] 0.08 [-5, 45] 0.10 Table 3 Average computational time at each POI with respect to subset size; pre-set displacement 10.50 pixels, th0 = 1, search range in y-axis [-5, 45] Subset size (pixel) Average computational time (ms) 21 0.11 27 0.12 33 0.11 39 0.12 45 0.12 51 0.14 57 0.14 63 0.15 Table 4 Average computational time at each POI with respect to initial threshold; pre-set displacement 10.50 pixels, subset size 33 × 33 pixels, search range in y-axis [-5, 45] 13 threshold th0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 Average computational time (ms) 0.17 0.10 0.11 0.11 0.11 0.13 0.13 0.16 0.16 0.18 0.20 0.21 4.2. Experiment using real data The reference and target images are downloaded from DIC challenge datasets [24]. A ROI with a size of 200 × 200 pixels is located at (800, 200) of the reference image, as shown in Fig. 4. There are 101 × 101 POIs regularly distributed in each reference image with a grid step 2 pixels. The subset size is 33 × 33 pixels with p = 3. The search ranges are [-20, +20] and [-5, +5] in x-axis and y-axis, respectively. The speckle images used in A-IDA algorithm are pre-processed using box filter [22] with a blurring kernel size of 15 × 15 pixels and histogram equalization technique [23]. The initial threshold th0, which varies from 0.5 to 6, is investigated in the real experiments. Fig. 5 shows the displacement fields u and v in x-axis and y-axis. Table 5 shows the average computational time with respect to th0 at each POI consumed by A-IDA and IC-GN algorithm. The efficiencies of A-IDA in numerical and real experiments are almost at the same level, but the computational time of IC-GN in real experiments is slower than that in numerical experiments. That’s because the shape change of the subset which makes IC-GN algorithm require more iterations to satisfy the convergent condition. Moreover, although the speckle images are very different from those generated in numerical experiments, the influence of th0 in real experiments on efficiency is approximately the same as that in numerical experiments. 14 Fig. 4 Reference image and the ROI Fig. 5 Displacement fields in x-axis and y-axis Table 5 Average computational time with respect to th0 at each POI using A-IDA and IC-GN algorithm in the real experiments; subset size is 33 × 33 pixels with p = 3 and the search ranges are [-20, +20] and [-5, +5] in x-axis and y-axis, respectively 0.5 1.0 Average computational time (ms) A-IDA IC-GN 0.16 0.81 0.11 0.83 1.5 0.11 0.83 2.0 0.12 0.81 2.5 0.11 0.80 3.0 0.13 0.80 3.5 0.13 0.80 4.0 0.16 0.81 4.5 0.17 0.83 5.0 5.5 6.0 0.19 0.19 0.20 0.81 0.81 0.82 th0 5. Discussion and Conclusion It should be noted that p also influences the performance of the proposed algorithm. In most cases, the A-IDA algorithm is more efficient if a higher p is used with bigger templates [21]. In practical use, the p ranged between 3 and 8 is recommended. In addition, all the subset sizes are 15 divisible by p = 3 in this paper. In fact, divisibility is not mandatory. Intuitively, however, the most efficient way is to divide the subset into several equally sized rectangular regions. In this paper, an initial guess estimation algorithm, A-IDA, is proposed for DIC. The proposed algorithm has the following characteristics: 1) Compared with IC-GN algorithm, the computational time required by A-IDA algorithm is negligible, especially when subset size is relatively large; 2) the efficiency of A-IDA algorithm is less influenced by search range; the experiments show the growth of computational time is slower than linear growth with respect to search range; 3) the efficiency is less influenced by subset size; as subset size increases from 21 to 63, the average computational time at each POI increases from 0.11 to 0.15 ms; 4) it is easy to select the initial threshold th0; both numerical and real experiments show that the variation of computational time is smaller than 0.1 ms as th0 increases from 0.5 to 6.0; the selection of the threshold has less influence on the efficiency. Acknowledgments The author is grateful to Dr. Zhenyu Jiang (South China University of Technology) for discussions and DIC community for providing high-quality, open-access DIC dataset. Reference 1. Pan B, Qian K, Xie H et al., “Two-dimensional digital image correlation for in-plane displacement and strain measurement: a review,” Meas. Sci. Technol. 20(6), 062001 (2009) 2. Chen DJ, Chiang FP, Tan YS, Don HS, “Digital speckle-displacement measurement using a complex spectrum method,” Appl. Opt. 32, 1839–1849 (1993) 3. Zhou P. “Subpixel displacement and deformation gradient measurement using digital image/speckle correlation (DISC),” Opt. Eng. 40, 1613–1620 (2001) 16 4. Zhang J, Jin G, Ma S, Meng L, “Application of an improved sub-pixel registration algorithm on digital speckle correlation measurement,” Opt. Laser Technol. 35, 533–542 (2003) 5. Bruck HA, McNeill SR, Sutton MA, Peters WH, “Digital image correlation using Newton–Raphson method of partial differential correction,” Exp. Mech. 29, 261–267 (1989) 6. Vendroux G, Knauss WG, “Submicron deformation field measurements: Part 2. Improved digital image correlation,” Exp. Mech. 38, 86–92 (1998) 7. Yuan Y, Huang J, Fang J, et al, “A self-adaptive sampling digital image correlation algorithm for accurate displacement measurement,” Opt. Lasers Eng. 65, 57–63 (2015) 8. Huang J, Pan X, Peng X, et al, “Digital Image Correlation with Self-Adaptive Gaussian Windows,” Exp. Mech. 53(3), 505–512 (2013) 9. Wittevrongel L, Lava P, Lomov SV, Debruyne D, “A self-adaptive global digital image correlation algorithm,” Exp. Mech. 55, 361–378 (2015) 10. Zhou Y, Pan B, Chen Y Q, “Large deformation measurement using digital image correlation: a fully automated approach,” Appl. Opt. 51(31), 7674–7683 (2012) 11. Poissant J, Barthelat F, “A Novel “Subset Splitting” Procedure for Digital Image Correlation on Discontinuous Displacement Fields,” Exp. Mech. 50(3), 353–364 (2010) 12. Valle V, Hedan S, Cosenza P, et al, “Digital Image Correlation Development for the Study of Materials Including Multiple Crossing Cracks,” Exp. Mech. 55(2), 379–391 (2015) 13. Poncelet M, Leclerc H, “A Digital Image Correlation Algorithm with Light Reflection Compensation,” Exp. Mech. 55(7), 1317–1327 (2015) 14. Xu J, Moussawi A, Gras R, et al, “Using Image Gradients to Improve Robustness of Digital Image Correlation to Non-uniform Illumination: Effects of Weighting and Normalization Choices,” Exp. Mech. 55(5), 963–979 (2015) 15. Pan, B., Li, K. and Tong, W, “Fast, robust and accurate digital image correlation calculation without redundant computations,” Exp. Mech. 53(7), 1277–1289 (2013) 17 16. Pan B, Tian L, “Superfast robust digital image correlation analysis with parallel computing,” Opt. Eng. 54(3), 034106 (2015) 17. Zhang L, Wang T, Jiang Z, et al, “High accuracy digital image correlation powered by GPU-based parallel computing,” Opt. Lasers Eng. 69, 7–12 (2015) 18. Jiang Z, Qian K, Miao H, et al, “Path-independent digital image correlation with high accuracy, speed and robustness,” Opt. Lasers Eng. 65, 93–102 (2015) 19. Pan B, “Reliability-guided digital image correlation for image deformation measurement,” Appl. Opt. 48(8), 1535–1542 (2009) 20. Wu R, Kong C, Li K, et al, “Real-Time Digital Image Correlation for Dynamic Strain Measurement,” Exp. Mech. 56(5), 833–843 (2016) 21. Tombari F, Mattoccia S, Stefano L D, et al, “Full-Search-Equivalent Pattern Matching with Incremental Dissimilarity Approximations,” IEEE Trans. Pattern Anal. Mach. Intell. 31(1), 129–141 (2009) 22. M. McDonnel, “Box-Filtering Techniques,” Comput. Graph. Image Proc. 17, 65–70 (1981) 23. Stark J A, “Adaptive image contrast enhancement using generalizations of histogram equalization,” IEEE Trans. Image Proc. 9(5), 889-896 (2000) 24. https://sem.org/dic-challenge/. Caption List Fig. 1 The flow chart of the newly proposed A-IDA algorithm Fig. 2 Reference image and ROI Fig. 3 Mean bias and standard deviation error of rigid body translation experiments; subset size 33, th0 = 1, search range in y-axis [-5, 45] Fig. 4 Reference image and the ROI Fig. 5 Displacement fields in x-axis and y-axis 18 Table 1 Average computational time at each POI with respect to pre-set displacement using AIDA and IC-GN algorithm; subset size 33 × 33 pixels, th0 = 1, search range in y-axis [-5, 45] Table 2 Average computational time at each POI with respect to search range; pre-set displacement 10.50 pixels, subset size 33 × 33 pixels, th0 = 1 Table 3 Average computational time at each POI with respect to subset size; pre-set displacement 10.50 pixels, th0 = 1, search range in y-axis [-5, 45] Table 4 Average computational time at each POI with respect to initial threshold; pre-set displacement 10.50 pixels, subset size 33 × 33 pixels, search range in y-axis [-5, 45] Table 5 Average computational time with respect to th0 at each POI using A-IDA and IC-GN algorithm in the real experiments; subset size is 33 × 33 pixels with p = 3 and the search ranges are [-20, +20] and [-5, +5] in x-axis and y-axis, respectively 19
1cs.CV
A neuromorphic hardware framework based on population coding Chetan Singh Thakur, Tara Julia Hamilton, Runchun Wang, Jonathan Tapson and André van Schaik The MARCS Institute, University of Western Sydney, Kingswood 2751, NSW, Australia Email: [email protected] Abstract—In the biological nervous system, large neuronal populations work collaboratively to encode sensory stimuli. These neuronal populations are characterised by a diverse distribution of tuning curves, ensuring that the entire range of input stimuli is encoded. Based on these principles, we have designed a neuromorphic system called a Trainable Analogue Block (TAB), which encodes given input stimuli using a large population of neurons with a heterogeneous tuning curve profile. Heterogeneity of tuning curves is achieved using random device mismatches in VLSI (Very Large Scale Integration) process and by adding a systematic offset to each hidden neuron. Here, we present measurement results of a single test cell fabricated in a 65nm technology to verify the TAB framework. We have mimicked a large population of neurons by re-using measurement results from the test cell by varying offset. We thus demonstrate the learning capability of the system for various regression tasks. The TAB system may pave the way to improve the design of analogue circuits for commercial applications, by rendering circuits insensitive to random mismatch that arises due to the manufacturing process. Keywords—Neuromorphic Engineering; Analogue Integrated Circuit Design; Stochastic Electronics; Neural Network Hardware; Neural Population Coding I. INTRODUCTION Semiconductor technology has evolved from discrete single transistors of the 1960’s to multi-billion-transistor microprocessors and memory chips of today. This exponential growth in circuit density follows the famous Moore’s law, which states that the density of transistors doubles every two years [1]. In the last two decades, IC technology has advanced to nanometre fabrication process technologies. Many physical and quantum mechanical effects that were not relevant in larger process technologies become significant in nanometre designs [2]. These effects lead to problems such as high levels of electrical noise, process mismatch, interconnect bottlenecks, high element failure rate, and power limitations. The result is a serious risk of suboptimal designs and thus poor performance and poor manufacturing yield. These issues render traditional approaches to analogue IC design inadequate and create significant challenges in the field of design technology. Additionally, analogue circuits are more prone to failure in nanometre designs when compared to digital circuits because of their dependence on slight variations of the process, severe impact of noise and leakage currents, influence of external unknown fields and susceptibility to slight changes in layout. These effects may be minimised by increasing device size, however, this increases the size of an IC and hence can be prohibitive in large system-on-chip (SOC) designs [3][4]. Neurobiological processing systems, such as the brain, are remarkable computational devices. Despite their slow speed, they outperform today’s modern computers in various tasks such as vision, audition, and motor control. Issues such as cell death and non-homogeneity of neurons in a neurobiological system can be considered equivalent to transistor failure and device mismatch in an IC, respectively. Over the course of evolution, biological systems have evolved to cope with these issues to ensure survival. A set of neurons works collectively and distributively to encode information in the nervous system. Each neuron in such a population has a distribution of responses over some set of input stimuli. The individual neuronal firing rates vary nonlinearly according to the input, and allow decoding of the input value by linearly combining the response of many neurons [5]. In a similar manner, the neuromorphic system that we have described encodes the input stimulus using a large pool of nonlinear neurons, and decodes the desired function by linearly combining responses of neurons. Neuromorphic systems offer an attractive alternative to conventional technology, and have enormous potential for future artificial information processing and behaviour systems [6]. Various applications such as sensor networks, military applications and aerospace require electronic systems with small area, high speed, small weight, and low power consumption. Thus, it is imperative to implement customised neural networks in hardware rather than in software [7]. Analogue neural network hardware is preferable to its digital counterpart in systems requiring small area, low power consumption. Moreover, the former is advantageous owing to high speed resulting from asynchronous updating, and ease of interface with a large set of real world sensors, which are themselves analogue. However, a major drawback of analogue implementation is random device mismatch. We have addressed this issue in our work and exploited random device mismatch as a constructive feature, instead of avoiding it as a bane. In this paper, we present a novel IC architecture called a Trainable Analogue Block (TAB) that incorporates neuromorphic principles such as low power consumption, fault tolerance and adaptive learning. To our knowledge, our work is the first of its kind to present measurement results of the TAB, which employs random device mismatch to implement a neural network. The TAB implementation is based on the LSHDI (Linear Solutions of Higher Dimensional Interlayers) framework [8], which will be explained in detail in section III. We present the measurements of the building blocks of our TAB hardware implementation in section IV, algorithm for offline learning in section V, mathematical proof for importance of heterogeneity of tuning curves in section VI, and capability of the TAB to learn various regression tasks in section VII. Section VIII presents a comparison of our work to previously published works and the conclusions of our study. In contrast to existing analogue circuits, TAB architecture embraces random device mismatch. Thus, the reduced device matching in newer technologies serves as an advantage, rather than something that needs to be engineered out of the design. A further significant advantage of this approach is that once manufactured, the same TAB can be reused for many different purposes. The same architecture can be used in different manufacturing technologies, as it can be trained after fabrication to perform a desired operation. This will lead to a significantly reduced design cycle for analogue circuits, with an associated reduction in design cost, and a speed-up of the technological progress. The TAB framework may pave the way for a new kind of circuit paradigm, called stochastic electronics, which will use hardware variability to achieve their engineering goal [9]. II. NEURAL POPULATION CODING Biological neurons encode input stimuli such as motion, position, colours, and sound into neuronal firing. The encoded information is represented by a set of neurons in a collective and distributed manner, referred as population coding. In population coding, the firing rate or the rate code of individual neurons governs information encoding. Population coding is robust to neuronal cell damage, as the information is encoded across a large set of neurons [10]. As examples of rate coding, neurons in monkeys, cricket, barn owl, cats, bats and rats encode direction of arm movements [11], direction of a wind stimulus [12], direction of a sound stimulus [13], saccade direction [14], echo delay [15] and position of the rat in its environment [16] respectively. The tuning curve of a neuron is defined as its average firing rate as a function of input stimulus intensity. Various neuronal tuning curves have been identified, such as the cosine tuning curve of motor cortical neurons [17], Gaussian tuning curves of cortical V1 neurons, and sigmoidal tuning curve of stereo V1 neurons. In a similar manner, we have encoded physical quantities into population of neurons by their tuning curves instead of individual spikes in the TAB framework. In our system, inputs are voltage signals, which could be outputs from an array of sensors representing physical quantities of the world. The input stimulus is encoded via the tuning curves of an ensemble of neurons, a phenomenon referred as population encoding. Neurons within the same cortical column have highly heterogeneous responses to the same input stimulus. The heterogeneity of neuronal responses has been thought to be beneficial for sensory coding when stimuli are decoded from the population response [18][19]. The shape of tuning curves of individual neurons, and the heterogeneity of neuronal responses affect the quality of population coding and the accuracy of information processing in the cortex [20]. We have adapted a similar concept of using heterogeneous population of neurons in a TAB. The significance of heterogeneity of tuning curves is presented in detail in section VI. As an ensemble of neurons encodes information, decoding the full population response requires procedures for combining the firing rates of many neurons into a population ensemble estimate. One of the popular reconstruction methods known as population vector method was developed by Georgopoulos and collaborators, for coding of the direction of arm movement in monkeys [11]. Abbott et al have discussed various decoding methods, some of which are complex methods based on statistical approaches and use response probabilities, such as Maximum Likelihood Estimation, Bayesian Estimation. Other methods use response tuning curves, such as Least Square Estimation, Projection Method, Vector Method, and Optimal Linear Estimation [21]. In general, each neuron contributes a basis function in this space of variables whenever it fires, and the best estimate of the physical variables is computed from the sum of these functions weighted by the spike rate occurring in each neuron. In our TAB system, we have used a similar approach to decode the stimulus, which is explained in section V. III. TAB FRAMEWORK The TAB framework (Fig. 1) utilises the LSHDI (Linear Solutions of Higher Dimensional Interlayers) principle similar to neural population coding. One of the earliest work in the neural network community, which is based on the LSHDI principle was the Functional-link net computing (FLNN) proposed by Pao et al in 1992 [22]. Similar work was proposed by Schmidt et al in the same year, which however did not attract much attention [23]. In 2006, Huang et al proposed a similar concept as Extreme Learning Machine (ELM) [24], which has attracted widespread attention in the neural network community. The Neural Engineering Framework (NEF) [25] is another example of a network based on the LSHDI principle, which performs spike-based computation and is quite popular in the neuromorphic engineering community. LSHDI networks are represented as having three layers of neurons – input, hidden and output layers, in a feedforward structure [8]. These networks differ from similar neural network architectures in several ways – (i) the hidden layer is usually much larger than the input layer, (ii) the each neuron. Systematic offset may not be required if there is sufficient random variation among transistors to produce a distinct tuning curve for each neuron, but is a failsafe method to spread the tuning curves of the neurons. The first version of a TAB that we present here has a simple configuration, with a single input voltage and a single output current (single input-single output, SISO). In this section, the VLSI implementation of the major building blocks of the TAB, namely the Hidden Neuron and the Output Weight are described. Fig. 1. Architecture of the TAB framework. The input layer neurons/nodes are connected to a larger number of non-linear hidden layer neurons via random weights and controllable offsets, O1 to OM. The connections from the hidden layer neurons to the output neurons are linear, with trainable weights, and the output neurons generate a linear sum of their inputs. connections between the input layer and the hidden layer are randomly generated, and (iii) the connections do not change during the network training. As a result, the inputs are randomly projected from their original input dimensionality to a nonlinear hidden layer of neurons of a much higher dimensionality. Input data points, which are not linearly separable in their current space, allow a linear hyperplane in the higher dimensional space that approximates a desired function as a regression solution, or represents a classification boundary for the input-output relationship. The output layer neurons need therefore compute only a linearly weighted sum of the hidden layer values in order to solve the problem, hence the name Linear Solutions of Higher Dimensional Interlayers (LSHDI) [8]. These linear weights are determined analytically by calculating the product of the pseudoinverse of the hidden layer activations with the desired output values [26]. IV. BUILDING BLOCKS OF THE TAB IC We have designed a test cell, comprising of a Hidden Neuron block and an Output Weight block of the proposed TAB architecture in 65nm technology. Additionally, the TAB architecture allows us to design a major part of the circuit with the lowest possible feature size in order to maximise mismatch among the transistor parameters, because device mismatch is inversely proportional to device area. More importantly, we have added an extra controllable offset (Fig. 1) for each hidden layer neuron to ensure that each hidden neuron performs a different nonlinear operation to the input. This systematic offset is fixed but different for A. Hidden Neuron Neuroscientists have clearly demonstrated that individual biological neurons respond selectively to various stimuli like sound, motion, images and so on [27]. Each neuron has a distinct tuning curve, which is found by presenting varied input stimuli to the neuron and recording its firing rate. Each neuron encodes the input stimuli according to its tuning curve. Similarly, each artificial neuron on our chip encodes input differently according to its distinct tuning curve. In the TAB system described here, a simple neuronal tuning curve is implemented using a differential pair, which performs a hyperbolic tangent (tanh) nonlinear operation on its input, similar to sigmoidal tuning curve of stereo V1 neurons in the cortex. The circuit is illustrated in Fig. 2A. M1 and M2 constitute the differential pair, and the sharing of currents between M1 and M2 depends on their respective gate voltage, Vin (input voltage) and Vref (constant reference voltage). If all MOSFETs (‘metal–oxide–semiconductor field-effect transistors’) are operating in weak-inversion and at saturation, with the slope factor, n ranging from 1.1 to 1.5, then currents in M1 and M2 transistors can be approximated as: I1 = Ib[exp(Vin/nUT)] / [exp(Vin/nUT) + exp(Vref/nUT)] (1) I2 = Ib[exp(Vref/nUT)] / [exp(Vin/nUT) + exp(Vref/nUT)] (2) With ideal transistors, the output currents, I1 and I2, are a function of the input differential voltage between Vin (ramp input) and Vref (constant input) and their difference is identical to the mathematical tanh function. The current I1 saturates to the maximum bias current if Vin is higher than Vref by more than 4 UT (100 mV), where UT is the thermal voltage. In the TAB system, each neuron receives a systematically different Vref, which results in a different nonlinear curve for each neuron. The fact that the transistors are not ideal, as assumed in (1) and (2) results in further deviations from the tanh curve, as shown in Fig. 2B. Itanh is copied from I1 using a current mirror that connects to the Output Weight block. Vb is the voltage at the M3 transistor that sets the bias current, typically in the range of a few nanoamperes (nA). Fig. 2B shows the tuning curves of a single hidden neuron while varying Vref. In the actual TAB, each neuron will have only one such tuning curve depending on its own Fig. 3. Output Weight Block. A. Schematic of the Output Weight block. Splitter circuit consisting of MR and the two M2R transistors form the R2R network, which gets repeated 13 times in the block. The octave splitter is terminated with a single MR transistor. B. Measured current profile of the Output Weight block as a function of the binary weights (13 bits) of the Hidden Neuron block. Fig. 2. Hidden Neuron Block. This block implements the tanh nonlinear activation function for the TAB framework. A. Schematic of the Hidden Neuron block. B. Measured tuning curves of the hidden neuron as a function of Vin. Each curve corresponds to different offset Vref . Vref, and dependent on process variations such as offset mismatch between the transistors in the differential pairs, bias current mismatch due to variability in M3 and current mirror mismatch. This illustrates the variation that can be achieved at each hidden neuron by changes in Vref alone. B. Output Weight In the LSHDI framework, there exists a linear relationship between the hidden layer and the output layer. These layers are connected via the Output Weight block. In our TAB SISO chip, the weight is controlled by a binary number. Using simulations, we have found that 11-bits per weight are sufficient for learning various functions. Using more than 11-bits per weight does not improve learning significantly. In the designed test cell, however, we have used a 13-bit binary number for testing purposes. This binary number controls output weights by controlling the amount of current that flows from the hidden layer neurons to the output layer neurons. We have implemented binary weighted connections using a splitter circuit (Fig. 3A) [28]. Each current branch is controlled through a digital binary switch. The input current, Itanh, which is the output of the neuron block, is divided successively to form a geometrically-spaced series of smaller currents. At each branch, a fixed fraction of the current is split off, while the remainder continues to later branches. The last stage is sized to terminate the line as though it were infinitely long. The current splitter principle accurately splits currents over 20 octaves, spanning from weak to strong inversion of transistors, dependent only on the effective device geometry. MR and the two M2R transistors form an R2R network, and the octave splitter is terminated with a single MR transistor. The splitter has N stages; the current at the kth stage is (Itanh/2k). The final current is the same as the penultimate current. The transistor sizes of MR and M2R are equal. The reference voltage for the p-FET gates in the splitter is the master bias voltage Vgbias [28]. The lower half of the R2R block has two transistor switches that act as a binary synapse for every branch, and route the branch current to either useful current, Igood, or to current that goes to ground, Idump. Igood is mirrored to generate presynaptic current Iout for the output layer neuron. Fig. 3B shows the measured output current of the Output Weight block with respect to various binary weights. V. where, (1) 𝐻𝑀𝚡𝐿 OFFLINE LEARNING OF THE TAB IC Learning in the TAB framework is achieved by computing output weights to train the system for desired regression/classification tasks. Briefly, the LSHDI framework determines the output weights (between the large hidden layer and linear output neurons) analytically by calculating the product of the pseudoinverse of the hidden layer activations with the target outputs [29]. A novel algorithm used for offline learning on the TAB IC is discussed here. Let us consider a three-layer feedforward TAB network with L number of hidden neurons. Let G(.,.,.) be a real-valued function so that G(wi(1), bi(1), oi(1), x) is the output of the ith hidden neuron, corresponding to the input vector x ϵ ℝm and the random input weight vector wi(1) = (wi1(1),… wim(1)), where wis(1) is the weight of the connection between the ith hidden neuron and sth neuron of the input layer. Random bias vector bi(1) ϵ ℝ and the random input weight vector wi(1) both arise due to random mismatch of the transistors. Systematic offset oi(1) ϵ ℝ is added to make sure each neuron exhibits distinct tuning curve, which is an essential requirement for learning in LSHDI framework, discussed in detail in section VI. The output function f(.) is given by: L f(x) = Ʃ wi(2) G(wi(1), bi(1), oi(1), x) 𝑊 Suppose, for a training data set {(xn, yn)}n=1,2..C , xn = (xn1,…, xnm) ϵ ℝm denotes the input vector, yn = (yn1,…, ynk) ϵ ℝk is its corresponding output vector, and C is the total number of input data patterns. Let the values of the input weight vectors, wi(1) ϵ ℝm, the bias, bi(1) ϵ ℝ, be randomly assigned and oi(1) ϵ ℝ, be assigned systematically. Then, the standard TAB framework with L number of hidden neurons approximates the input samples with zero error if and only if there exists wi(2) ϵ ℝk such that: L yn = Ʃ wi(2) G(wi(1), bi(1), oi(1), xn) where, n = 1,2,..C (5) i=1 The above set of equations can be rewritten in the following matrix form as: HW(2) = Y (6) ⎬ ⎪ ⎭ , 𝑌𝐶𝚡𝐾 = ⎧ ⎪ ⎨ ⎪ ⎩ 𝑦1 ∶ ∶ ∶ 𝑦𝐶 where, H is the Moore-Penrose pseudoinverse of the matrix H. ⎫ ⎪ ⎬ ⎪ ⎭ (8) (9) generalised The output weight calculation can be summarised as follows: Input: Training set{(xn, yn)}n=1,2..C , xn ϵ ℝm and yn ϵ ℝk, L is the number of hidden neurons, and the activation function is g(.) 2. 3. 4. where, g: ℝ  ℝ is the activation function. ⎨ ⎪ ⎩ ⎫ ⎪ + where, wi(2) = (w1i(2),… wki(2)) ϵ ℝk is the weight vector where wji(2) ϵ ℝ is the weight connecting the ith hidden neuron with the jth neuron of the output layer. Here, G(.,.,.) takes the following form: (4) LxK = (2) w1 : : : (2) wL W(2) = H+Y 1. G(wi, bi, x) = g(wi(1).x + bi(1) + oi(1)) (2) ⎧ ⎪ (7) Here, the ith column of H will be the output of the ith hidden neuron for all the input training data samples (x1,…, xm). Further, the matrix H need not be a square matrix. Under the assumption that the activation function g(.) is infinitely differentiable, it has been shown that for fixed input weight vectors, wi(1), and biases, bi(1), oi(1), the least squares solution W(2) for the matrix (6) is: (3) i=1 (1) ⎧ 𝐺�𝑤1 , 𝑏1 , 𝑜1 , 𝑥1 � … … 𝐺�𝑤𝐿 , 𝑏𝐿 , 𝑜𝐿 , 𝑥1 � ⎫ : ∶ ⎪ ⎪ : ∶ = ⎨ ⎬ : ∶ ⎪ ⎪ (1) (1) ⎩𝐺�𝑤1 , 𝑏1 , 𝑜1 , 𝑥𝐶 � … … 𝐺�𝑤𝐿 , 𝑏𝐿 , 𝑜𝐿 , 𝑥𝐶 �⎭ For i = 1,2,…L, randomly assign the input weight vector wi(1) ϵ ℝm, random bias bi(1) ϵ ℝ and systematic offset oi(1) ϵ ℝ. Determine the matrix H defined by the (7). Calculate H+. Calculate the output weights matrix as W(2) = H+Y, where Y is given by (8). Output: Network with the determined output weight vectors wi(2) ϵ ℝk for the randomly chosen weight vectors wi(1) ϵ ℝm, bias bi(1) ϵ ℝ and systematic offset oi(1) ϵ ℝ for i = 1,2,…L will compute the estimated output value ŷ for any input test sample x ϵ ℝm using the following formula: L ŷ=Ʃ i=1 VI. wi(2) g(wi(1).x + bi(1) + oi(1)) (10) IMPORTANCE OF HETEROGENEITY OF TUNING CURVES It has been demonstrated that in a neurobiological system, individual neurons exhibit highly heterogeneous responses when presented with the same stimuli. This heterogeneity has been shown to improve the information encoded in the neuronal population activity by decreasing the neuronal correlations. Diversity of orientation tuning curve profiles of individual neurons proves beneficial for sensory coding when stimulus orientation is decoded from the population response [18]. Similarly, we show that the tuning curves of neurons in our TAB framework should be heterogeneous so as to have the highest information encoding capacity. Let us revisit equation (6) and find W(2) analytically: Y = HW(2) HTY = HTHW(2) (HTH)-1HTY= W(2) Then estimated output, in a particular technology until after manufacturing. For example, older technologies with large feature sizes generally have a low degree of mismatch, which would limit the learning capability of a TAB. This risk is attenuated by introducing a fixed and distinct systematic offset (Fig. 1) for each hidden layer neuron of the TAB. The systematic offset ensures that all tuning curves are distinct and independent, thus improving the encoding capacity of the system. We have found in simulations that if the neuronal tuning curves are too similar, the system requires an extremely large number of hidden neurons to learn even simple functions. VII. LEARNING RESULTS Ŷ = HW(2) = H((HTH)-1HTY) The error of the system, which is the difference between estimated Ŷ and actual Y, is given as: In this section, we describe the learning capability of the TAB system in software using the measured results of the E = (Y-Ŷ) E = (Y-H(HTH)-1HTY) E = Y(I-H(HTH)-1HT) where, I is the identity matrix. For E=0, I = H(HT H)-1HT (11) If matrix H is a full column rank matrix, or equivalently, columns of the matrix H are linearly independent, then, I = HH+ (12) where, H is the measured matrix containing the hidden neuron output across the range of input values and H+= (HT H)-1HT is the pseudoinverse of a matrix [30]. Equation (11) implies that any input vector xi is perfectly encoded when the ith row of the RHS matrix is equal to the ith row of the identity matrix I. Thus, the encoding capacity of the network is proportional to the number of rows that are equal between the matrices on both sides of equation (11). Mathematically, the more the number of tunning curves of the hidden neurons are independent, the higher is the encoding capacity of the TAB system. Tuning curves of individual neurons are independent in a heterogeneous neuron population, which thus increases the encoding of information [18],[31]. This is a very important observation, and is essential for optimal learning in an LSHDI network. In the next section, we discuss how we can maximise the encoding capacity of the TAB. Role of systematic offset: When a population of biological neurons is presented an input stimulus, the neuronal responses vary widely owing to variations in neuronal response properties, such as mean firing rate, receptive field location, and stimulus selectivity. Such heterogeneity of responses results in faithful encoding of information covering the whole range of input stimuli. We have tried to create a heterogeneous population of neurons in our TAB system by exploiting randomness (fixed-pattern transistor mismatch) and variability arising due to the fabrication process. An element of risk and uncertainty is present here, as one cannot be certain there would be sufficient mismatch Fig. 4. Learning curves for the regression functions – A. sin, B. cube, C. sinc. The red curve represents the target function, and the blue curve represents learnt function. building blocks. We have used the hidden neuron’s tuning curves with respect to different Vref voltages (34 in total). The TAB architecture was trained to implement various functions such as sin (Fig. 4A), cube (Fig. 4B), and sinc (Fig. 4C). The learning capability of an LSHDI network depends on the number of hidden layer neurons [8]. As evident from Fig. 4, 34 neurons are sufficient to learn simple functions such as sin and cube, but for complex function like sinc (Fig. 4C), a higher number of neurons is needed for more accurate performance. We have calculated the output weights externally using offline learning method as discussed in section V. The results suggest that the system can be successfully trained to perform the various regression tasks. VIII. CONCLUSIONS In this paper, we have described a novel framework that exploits device mismatch in circuits and performs reliable computation. We have presented measurement results of the building blocks of the TAB IC implementation. Additionally, we have shown the potential learning capability of the TAB system. In IC technology, random device mismatch is a major problem which always leads to a suboptimal design. It may be minimised to some extent in higher process technology (>100nm) with large device area and good design effort, which however increases production costs significantly. Other research groups have also suggested using random device mismatch in their architecture [32], [33]. However, there are major differences in their architecture compared to ours. Basu et al [32] have shown a spiking neuron-based framework which converts analogue input into spikes and translates them into spike rate using counter for each neuron and the rest of the computation is performed in digital controller. Kudithipudi et al [33] have developed a memristor-based network in software simulations, which has many practical issues to be considered in chip implementation. The amount of random mismatch depends on process technology – it is low for a process technology with a large feature size, and vice versa. It also varies from chip to chip. Both [32] and [33] have used software simulations explicitly generates the desired distribution of randomness (variance) which then leads to distinct tuning curves for the entire input range. In their system, the input layer weights of the LSHDI network only rely on this random mismatch obtained from fabrication, which may not be sufficient to generate diverse neuronal tuning curves. In our implementation we avoid this issue by providing an alternative to obtain the systematic offset generated through the resistive polyline, which generates a different Vref voltage for each neuron to ensure that each neuron has a different tuning curve. An LSHDI network has a large number of hidden neurons. Both previous designs have represented the input variable as a current. Kudithipudi et al group have used a resistor before the differential amplifier to convert the total input current to a voltage. They require resistors in the range of few mega-ohms to operate their system in the subthreshold region. In the sub-threshold region, the differential amplifier will get saturated as the differential voltage goes above 4UT (~100mV). Since an LSHDI network requires a large number of hidden neurons, using many resistors in the design will increase the chip area unrealistically. Also, current would increase as a multiple of the number of inputs and may affect the chip adversely. The above system also uses memristors. This might be a good alternative, but memristors are still in the research phase, and may cause problems in physical realisation [34]. Here, we have presented measurement results of a test cell in a TAB framework. We have shown the learning capability of the TAB system for various regression tasks. Future work will aim to test the learning capability of a complete TAB chip and will include quantification of the random variations across the hidden neurons. The TAB system is designed using neuromorphic principles based on stochastic computation, which has the advantages of low power consumption, adaptability to local change and the ability to learn. This system may help overcome limitations of analogue IC design at low process nodes and will drive the integration process with digital blocks in the same circuit and process node. This may find applications in analogue/digital converters (ADCs) and digital-to-analogue converters (DACs) for submicron mixed signal chips such as those used in mobile processor chips and data acquisition chips. We know that TABs require a large number of hidden layer nodes and connections to and from these nodes; however, unlike custom analogue design, minimum sized transistors can be used and no specialised layout techniques will be required. Furthermore, as the TAB framework desires large random mismatch among devices and as mismatch is inversely proportional to device area, it could lead to significant reductions in chip area and manufacturing costs. REFERENCES [1] [2] [3] [4] [5] [6] [7] G. E. Moore, “Cramming More Components Onto Integrated Circuits,” Proc. IEEE, vol. 86, no. 1, pp. 82–85, Jan. 1998. A. Papanikolaou, M. Miranda, H. Wang, F. Catthoor, M. Satyakiran, P. Marchal, B. Kaczer, C. Bruynseraede, and Z. Tokei, “Reliability issues in deep deep sub-micron technologies: time-dependent variability and its impact on embedded system design,” in 2006 IFIP International Conference on Very Large Scale Integration, 2006, vol. 249, pp. 342–347. P. Kinget, “Device mismatch and tradeoffs in the design of analog circuits,” IEEE J. Solid-State Circuits, vol. 40, no. 6, pp. 1212–1224, Jun. 2005. A. Marshall, “Mismatch and Noise in Modern IC Processes,” Synth. Lect. Digit. Circuits Syst., vol. 4, no. 1, pp. 1–140, Jan. 2009. A. Pouget, P. Dayan, and R. S. Zemel, “Inference and computation with population codes.,” Annu. Rev. Neurosci., vol. 26, pp. 381–410, 2003. S. C. Liu and T. Delbruck, “Neuromorphic sensory systems,” Curr. Opin. Neurobiol., vol. 20, pp. 288–295, 2010. S. DRAGHICI, “NEURAL NETWORKS IN ANALOG HARDWARE — DESIGN AND IMPLEMENTATION ISSUES,” International Journal of Neural Systems, vol. 10. pp. 19–42, 2000. [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] J. C. Tapson, G. K. Cohen, S. Afshar, K. M. Stiefel, Y. Buskila, R. M. Wang, T. J. Hamilton, and A. van Schaik, “Synthesis of neural networks for spatio-temporal spike pattern recognition and processing,” Front. Neurosci., vol. 7, p. 153, Jan. 2013. T. J. Hamilton, S. Afshar, A. van Schaik, and J. Tapson, “Stochastic Electronics: A Neuro-Inspired Design Paradigm for Integrated Circuits,” Proc. IEEE, vol. 102, no. 5, pp. 843–859, May 2014. A. Pouget, P. Dayan, and R. Zemel, “Information processing with population codes.,” Nat. Rev. Neurosci., vol. 1, no. November, pp. 125–132, 2000. A. P. Georgopoulos, A. B. Schwartz, and R. E. Kettner, “Neuronal population coding of movement direction.,” Science, vol. 233, pp. 1416–1419, 1986. J. P. Bacon and R. K. Murphey, “Receptive fields of cricket giant interneurones are related to their dendritic structure.,” J. Physiol., vol. 352, pp. 601–623, 1984. E. I. Knudsen and M. Konishi, “A neural map of auditory space in the owl.,” Science, vol. 200, pp. 795–797, 1978. J. A. Van Gisbergen, A. J. Van Opstal, and A. A. Tax, “Collicular ensemble coding of saccades based on vector summation.,” Neuroscience, vol. 21, pp. 541–555, 1987. W. E. O’Neill and N. Suga, “Target range-sensitive neurons in the auditory cortex of the moustache bat.,” Science (80-. )., vol. 203, pp. 69–72, 1979. J. O’Keefe and J. Dostrovsky, “The hippocampus as a spatial map. Preliminary evidence from unit activity in the freelymoving rat.,” Brain Res., vol. 34, pp. 171–175, 1971. B. Amirikian and A. P. Georgopulos, “Directional tuning profiles of motor cortical cells,” Neurosci. Res., vol. 36, pp. 73–79, 2000. M. I. Chelaru and V. Dragoi, “Efficient coding in heterogeneous neuronal populations.,” Proc. Natl. Acad. Sci. U. S. A., vol. 105, no. 42, pp. 16344–9, Oct. 2008. M. Rigotti, O. Barak, M. R. Warden, X.-J. Wang, N. D. Daw, E. K. Miller, and S. Fusi, “The importance of mixed selectivity in complex cognitive tasks.,” Nature, vol. 497, no. 7451, pp. 585– 90, May 2013. A. S. Ecker, P. Berens, A. S. Tolias, and M. Bethge, “The Effect of Noise Correlations in Populations of Diversely Tuned Neurons,” Journal of Neuroscience, vol. 31, no. 40. pp. 14272– 14283, 2011. E. Salinas and L. F. Abbott, “Vector reconstruction from firing rates,” J. Comput. Neurosci., vol. 1, no. 1–2, pp. 89–107, Jun. 1994. [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] Y.-H. Pao and Y. Takefuji, “Functional-link net computing: theory, system architecture, and functionalities,” Computer (Long. Beach. Calif)., vol. 25, no. 5, pp. 76–79, May 1992. W. F. Schmidt, M. A. Kraaijveld, and R. P. W. Duin, “Feedforward neural networks with random weights,” in Proceedings., 11th IAPR International Conference on Pattern Recognition. Vol.II. Conference B: Pattern Recognition Methodology and Systems, pp. 1–4. G.-B. Huang, Q.-Y. Zhu, and C.-K. Siew, “Extreme learning machine: Theory and applications,” Neurocomputing, vol. 70, no. 1–3, pp. 489–501, Dec. 2006. T. C. Stewart and C. Eliasmith, “Large-Scale Synthesis of Functional Spiking Neural Circuits,” Proc. IEEE, vol. 102, no. 5, pp. 881–898, May 2014. J. Tapson and A. van Schaik, “Learning the pseudoinverse solution to network weights,” Neural Netw., vol. 45, pp. 94–100, Sep. 2013. L. F. Abbott, “Theoretical neuroscience rising,” Neuron, vol. 60, no. 3, pp. 489–95, Nov. 2008. T. Delbrück and A. Van Schaik, “Bias Current Generators with Wide Dynamic Range,” Analog Integr. Circuits Signal Process., vol. 43, no. 3, pp. 247–268, Jun. 2005. J. Tapson and A. van Schaik, “Learning the pseudoinverse solution to network weights,” Neural Networks, vol. 5, 2013. R. Penrose and J. a. Todd, “A generalized inverse for matrices,” Math. Proc. Cambridge Philos. Soc., vol. 51, no. July, p. 406, 1955. C. Eliasmith and C. H. Anderson, Neural Engineering (Computational Neuroscience Series): Computational, Representation, and Dynamics in Neurobiological Systems. MIT Press Cambridge, MA, USA, 2002, p. 256. E. Yao, S. Hussain, A. Basu, and G.-B. Huang, “Computation using mismatch: Neuromorphic extreme learning machines,” 2013 IEEE Biomed. Circuits Syst. Conf., no. 1, pp. 294–297, Oct. 2013. C. Merkel and D. Kudithipudi, “A current-mode CMOS/memristor hybrid implementation of an extreme learning machine,” Proc. 24th Ed. Gt. lakes Symp. VLSI - GLSVLSI ’14, no. 3, pp. 241–242, 2014. P. Meuffels and R. Soni, “Fundamental issues and problems in the realization of memristors,” arXiv Prepr. arXiv1207.7319, vol. 2012, pp. 1–14, 2012.
9cs.NE