Algebraic Structure Helps in Finding and Using Almost-Symmetries

Igor L. Markov Department of EECS, The University of Michigan, Ann Arbor, MI 48109-2122 [email protected]

Abstract other optimization problems in natural sciences. A rich literature exists on semantic symmetries of Boolean Many successful uses of symmetries in dis- functions and describes many uses in synthesis and op- crete computational problems rely on - timization of digital circuits [21, ibid]. For example, in theoretical properties. For example, large a given VLSI layout one may permute the input pins sets of permutational symmetries can be of a single AND gate or a whole 64-bit multiplier to compactly represented by small sets of gen- improve wiring congestion by uncrossing wires [6]. erators and manipulated using stabilizer- Identifying and using a greater variety of symme- chain algorithms. While almost-symmetries tries often improves computational efficiency. Hence, may be more numerous than symmetries, it is natural to relax the notion of symmetry and no group-like properties or efficient algo- deal with almost-symmetries which retain useful prop- rithms are currently known for them. In erties, occur more often and have greater impact. this work, we identify an algebraic structure Such extensions have already been studied for tilings formed by almost-symmetries and, using it, and partial differential equations in Mathematics [22; develop a complete “life-cycle” for almost- 12], quasicrystals and approximate conservation laws symmetries, including their discovery, com- in Physics [16; 22], stars and planets in Astrophysics pact representation and symmetry-breaking. [23], molecular configurations in Chemistry [17; 9] and computational problems in Artificial Intelligence [15]. To be useful, the effort to exploit symmetries or 1 Introduction almost-symmetries should be justified by tangible ben- A structure-preserving reversible transformation of a efits, especially when symmetry-agnostic processing is structured object is often called a symmetry (or auto- possible [14; 8]. Such trade-offs are poorly understood morphism), with prime examples being (1) a permu- for almost-symmetries. In Section 2 we show that for tation of vertices of a given graph, that maps edges regular symmetries, computational improvements can to edges and preserves vertex labels, (2) a permuta- only be achieved by using the algebraic structure of tion of variables in a system of constraints, that pre- symmetries. The latter observation is driving much of serves the system, (3) a permutation of possible values our work on almost-symmetries as outlined below. of some variables, such as the simultaneous negation Existing techniques for using symmetries tend to be of two Boolean (or two integer) variables, (4) a permu- undermined by the freedom of choice. Namely, all tation of input and output variables of a Boolean func- computational techniques cited above assume simulta- tion that leaves the function invariant. Computational neous constraints, as in Boolean satisfiability, but are applications often involve finite domains. For exam- not sensitive to alternative constraints involving multi- ple, identifying a pair of symmetric variables x and y in ple variables [11]. In another example, the behavior an equation allows one to introduce the additional con- of digital circuits is often left underspecified on in- straint x ≤ y so as to reduce the amount of searching by valid inputs (resolved later so as to simplify the de- up to 25%, or closer to 50% for non-Boolean variables. sign), which leads to Boolean functions with don’t- Combining many such symmetries sometimes reduces cares. In Section 3 we attempt to generalize symme- the complexity of search, proofs or refutations from ex- tries to these cases, but discover that natural ”almost- ponential to polynomial, both in provable lower bounds symmetries” cannot be composed as freely as regular [18] and empirical performance [1]. Recent progress symmetries. Therefore almost-symmetries do not form in understanding and manipulating symmetries accel- groups, cosets, semi-groups, monoids, groupoids, or erates the solution of large, practical Boolean equa- other named algebraic structures. However, in Section tions [1], instances of Integer Linear Programming [3; 4 we identify another algebraic structure that character- 4], and other discrete problems. This is often accom- izes almost-symmetries and helps to compactly repre- plished through the use of fast symmetry detection [20; sent them. This facilitates symmetry-finding in Section 8] and symmetry-breaking techniques [7; 13; 2]. A 5 and almost-symmetry-breaking in Section 7. Section broad range of affected applications include (i) formal 6 discusses generalizations and applications of almost- verification of microprocessors and software, (ii) opti- symmetries. We articulate open problem in Section 8 mal scheduling and planning, (iii) protein folding and and discuss our ongoing work in the Appendix B. 2 Necessary Background 3 Possible Notions of Almost-symmetries Below we review a representative modern paradigm for Semantic symmetries include syntactic ones and form exploiting syntactic symmetries in search and discrete the same algebraic structure. However, using all se- optimization [1; 2], and then contrast it with seman- mantic symmetries is often computationally impracti- tic (functional) symmetries and related notions of in- cal. The same can be expected for almost-symmetries. terchangeability and substitutability [24]. In order to relax the notion of symmetry, one con- Finding and representing symmetries efficiently. siders transformations that do not necessarily preserve Consider an instance of constraint-programming or the structure in question. One known possibility is combinatorial optimization where all constraints must that of conditional symmetries that arise in the course be simultaneously satisfied. To identify its syntactic of constraint-solving algorithms based on backtrack- symmetries, all variables, constraints and optimization ing [13; 24]. Such algorithms work by assigning trial objectives are represented by labeled vertices in a graph values to variables, which simplifies the original prob- G where occurrences of variables are represented by lem instance and potentially facilitates new symme- edges, e.g., a forest of parse trees (uses of hypergraphs tries. Given that conditional symmetries may exist in or graph gadgets are allowed and do not affect our dis- an exponential number of different contexts, it may be cussion). The graph is constructed in such a way that difficult to batch symmetry-detection and symmetry- the group Hsym of symmetries of the original problem breaking with as much efficiency as for unconditional is isomorphic to the graph’s group of symmetries. A typical conditional symmetry is appli- Aut(G), which can be found by advanced software cable in a considerably smaller scope than a regular tools such as NAUTY [20] or SAUCY [8]. Aut(G) symmetry and therefore holds less promise to acceler- is captured in a compact form by an unordered list of ate constraint-solving.1 Yet, much of what we propose group generators, which cannot be much larger than in this paper works for conditional symmetries as well. |G|. Having a group isomorphism, rather than an ar- Almost-symmetries are commonly defined as sym- bitrary one-to-one mapping between two sets, ensures metries of slightly modified objects [15]. For example, that sets of generators of Aut(G) map onto those of adding or removing one constraint can make the overall Hsym. Also, NAUTY and SAUCY would not have been set of constraints more symmetric. This may seem like applicable if symmetries did not form groups. a generalization of conditional symmetries, whose con- Using symmetries in search. For a given symmetry, ditions can be viewed as constraints of a special kind. a symmetry-breaking predicate (SBP) is a set of addi- However, conditional symmetries rely on the interpre- tional constraints added to the original constraints to tation of their conditions, i.e., assigned values are used prevent redundant search through symmetric branches. to simplify constraints, whereas almost-symmetries are For multiple symmetries, compatibility is ensured by often formulated entirely in terms of syntactic manip- lex-leader SBP constructions [7] which have recently ulations on the set of constraints and promise greater been improved [2]. It is often best to generate SBPs computational efficiency. We note that such differences for group generators only [1], thus adding very few are only meaningful in the context of specific search constraints (breaking fewer symmetries does not affect procedures and can be ignored at first. Therefore we π correctness). In practice, the SBPs for symmetries 1 focus on labeled graphs, except in Section 7. and π2 make the addition of an SBP for products of π π A popular example of an almost-symmetry of a 1 and 2 (and products of their powers) essentially graph is a symmetry of the graph derived by adding [ ] unnecessary 2 . Group properties are crucial in other or removing a small number of edges [19]. However, paradigms for using symmetries, where efficiency calls we are first going to warm up by studying a different [ ] for algorithms based on stabilizer chains 14 . relaxation of graph symmetries that deals with vertex Functional symmetries & don’t cares. A Boolean labels instead of edges, motivated by functions with function f with n input bits can be captured by a truth n don’t-cares (see Section 2). From now on we are go- table with 2 lines and one output column filled with ing to perceive vertex labels as colors — recall that a 0s and 1s. Permutational and negational symmetries of graph symmetry is a permutation of vertices that maps f can be captured as symmetries of its truth table, or each vertex to a vertex of the same color and maps ev- as automorphisms of the n-dimensional Boolean ery pair of vertices connected by an edge to another whose vertices represent the lines of the truth table and such pair. The color-related limitation can be relaxed are labeled 0 or 1 (see further optimizations in [6]). by introducing the chameleon color: a chameleon ver- Such symmetries can be generalized to non-Boolean tex can be mapped to a chameleon vertex or a vertex domains and in that form subsume Freuder’s notions of any regular color. Additionally, a vertex of a regular of interchangeability and substitutability [10], allow- color can be mapped to a chameleon vertex.2 ing simultaneous variable permutations and value sub- stitutions even when a particular representation of f is 1 not symmetric. Application-derived functions are often Symmetry-breaking for two symmetric Boolean vari- ables reduces the solution space by 25%. However, when partially defined, i.e., some of the output values can be such a symmetry is conditional on fixed values of three other resolved later. Such output don’t-care conditions can Boolean variables, the 25% reduction applies only to 1/8 of be captured by asterisks in the truth table or by yet- 1 the solution space, thus the overall reduction is only by 3 3 %. undefined vertex labels in the Boolean cube. 2Our definition extends to several chameleon colors com- Disjunctive constraints [11] can be modeled by patible with different sets of regular colors, and even a hier- graphs with removable edges, also suggesting that we archy of chameleon colors. However, most of the discussion study almost-symmetries of graphs first. that follows would still apply to such extensions. 4 Algebraic Structure in Now consider all possible color specializations of Almost-symmetries of Graphs the chameleon vertices (which are just partitions of this vertex set into as many cells as we have regular colors). As long as the n vertices of the graph remain fixed, In each case we obtain a regular labeled graph with almost-symmetries are permutations from Sn. Thus a group of symmetries, and each almost-symmetry is • products of almost-symmetries are unambiguous, contained in at least one of those groups. To rephrase, • the identity permutation is an almost-symmetry, • each almost-symmetry has a unique inverse. The set of almost-symmetries is a set-theoretic union of subgroups of S . Unfortunately, almost-symmetries are not closed un- n der compositional product. For example, consider a In an irredundant union-of-subgroups expression no π 3-vertex graph with no edges, the permutation 1 that subgroups can be skipped. Greedy removal of redun- swaps the blue vertex v1 with the chameleon vertex v2, dant subgroups from an expression ensures irredun- π and 2 that swaps v2 with the red vertex v3. The prod- dancy, but not the smallest size. Even solving the (im- π π uct 1 · 2 maps the blue vertex v1 to the red vertex plicit) set-covering problem for given subgroups may v3, which is forbidden. Worse, a power of an almost- not produce a union with fewest subgroups possible. 3 symmetry may not be an almost-symmetry. We cannot Observe that all relevant subgroups are contained fix all products, but we can fix the powers. in the group Aut(G ∗) of the unlabeled (colorless) graph ∗ and contain all automorphisms of We further restrict almost-symmetries to those G ∗ whose cycles do not mix chameleon vertices with automorphisms of the underlying unlabeled G regular vertices. Such permutations form a sub-group graph ∗ with the property that each cycle con- G that can be recovered in two steps: (1) construct the la- tains vertices of no more than one regular color. beled graph G ] by specializing all chameleon vertices This constraint is justified by considerations of to a color that has not been used before, (2) finding ] group theory and symmetry-breaking. First, since reg- Aut(G ). The algebraic structure described above is vi- ular symmetries are almost-symmetries and use the sualized in Figure 1. In practice the intersection of sub- ] same compositional product, they form a subgroup of groups can be larger than Aut(G ), e.g., consider two whatever structure almost-symmetries form. To this disconnected vertices v1 (blue) and v2 (chameleon), for ] end, it is natural to seek additional subgroups. How- which Aut(G ) = {( )} but the only non-trivial almost- ever, if powers of π are not almost-symmetries, then π symmetry (12) generates a larger subgroup. cannot be in any subgroup of almost-symmetries. Sec- ond, given two almost-symmetries that have different Our analysis suggests that solutions to the graph contexts and do not form a product, their symmetry- almost-automorphism problem can be represented breaking predicates can be extended by preconditions by subgroup generators arranged in potentially- and conjoined (Section 7). However, this mechanism overlapping unordered lists — one lists per sub- fails on powers of an almost-symmetry. group of Sn in the union-of-subgroups structure. With their compositional product defined only par- Edge-based almost-symmetries discussed earlier tially, almost-symmetries do not form groups, semi- also form a union of subgroups of Sn, taken over groups or monoids. They do not form cosets because the various modifications of the original graph, and any coset containing the identity permutation ( ) must all powers of such almost-symmetries remain almost- be a subgroup. We can also try groupoids (also known symmetries. Furthermore, edge-based and color-based as a virtual groups), which allow for partially-defined relaxations of graph symmetries can be combined, products but requires associativity. The latter property α β γ α β γ α β γ and the resulting almost-symmetries still form a set- states that ∀ , , , if either ( · ) · or · ( · ) is de- theoretic union of subgroups of S . fined, then both are defined and equal (we ignore other n 3 axioms of a groupoid for now). Given that the compo- Consider Z2 × Z2, the symmetry group of the letter H sitional product of almost-symmetries is inherited from represented by the union of its three two-element subgroups. Sn, there can be no problems with equality. However, it is possible that only one of the two products is defined. In the above example with vertices v1,v2,v3 and per- Sn π π π π mutations 1 = (12), 2 = (23), the product 1 · 2 was Aut(G ∗) not a valid almost-symmetry. Now consider the prod- π π π π π π π π ucts ( 1 · 1) · 2 and 1 · ( 1 · 2). Since 1 · 1 = ( ), ] G1 Aut(G ) the former is defined (= π2), but (π1 · π2) is not. Before we reveal an algebraic structure compatible with these properties, we offer the following obser- vation. For any given color-based almost-symmetry G2 G3 of a graph, there is a specialization of colors for the graph’s chameleon vertices that turns the almost- symmetry into a regular symmetry. Indeed, each cycle Figure 1: Algebraic structure in almost-symmetries — can include vertices at most one regular color, to which ] a set-union of subgroups: Aut(G ) ⊆ G1 ∪ G2 ∪ G3 ⊆ all chameleon vertices in this cycle can be specialized. Aut(G ∗). All shapes represent groups or subgroups, If all vertices in the cycle are chameleon-colored, spe- and illustrate containment relations geometrically. cialize all of them to any existing color. 5 Finding Almost-Symmetries 4A. If a cell contains only chameleon vertices, then To find almost-symmetries and represent them com- specialize all vertices to one arbitrary color. pactly by lists of lists of permutations, we extend 4B. If a cell contains chameleon vertices and vertices a common graph-automorphism algorithm, used in of one regular color, then specialize all chameleon solvers NAUTY [20] and SAUCY [8], to handle color- vertices to this regular color. based almost-symmetries. Since color specializations 5. In a non-trivial cell without chameleon vertices, are partitions of the set of chameleon vertices, we are invoke traditional branching in the hope that looking to capture all almost-symmetries by a small set some cells with chameleon vertices will be re- of such partitions. Fortunately, a great deal of parti- fined through adjacencies. This rule does not tion refinement is already performed the above graph- use traditional branching in cells with unspecified automorphism algorithm, which we describe next. chameleon vertices due to difficulties with color First, vertices of a given graph are differentiated by assignment, implied in some, but not all branches. degree, creating an initial partition to separate vertices 6. Branch on chameleon vertices in cell j with the that cannot possibly be symmetric. The cells of this smallest branching factor as follows: partition will be gradually split further. In particu- lar, immediate refinement is based on external adjacen- • Specialize all k j chameleon vertices in cell j at cies, e.g., two vertices in the same cell m1 cannot be once — otherwise splitting and traditional branch- symmetric if one is adjacent to a vertex cell m2 and ing will not work (Rules 2 and 5). the other is not adjacent to any vertex in m2 [8, Fig- • Assign only c j regular colors used in cell j. ] k j ure 1 . Such refinements can be exhausted by an ef- • Select j to minimize branching factor c j . ficient procedure due to Hopcroft. After that, the al- Symmetry generators accumulated since the last gorithm resorts to (traditional) branching by, concep- branching on chameleon vertices can only be used in tually, picking a non-singleton cell and mapping its that branch, hence we output a new subgroup upon re- lowest-indexed vertex v to another vertex v (for more i j turning from the lowest-level chameleon branch. details, see [20; 8]). This may trigger another round Rule 2, 3 (immediate refinement) and Rules 4A, 4B of immediate partition refinement — neighbors of v i (dominant colors) perform constraint propagation, in- can only map to neighbors of v . The overall algo- j terleaved with two types of branching (Rules 5 and rithm proceeds by alternating between branching and 6). Pruning by accumulated symmetry ensures that refinement until all vertices in some cells are mapped to generators of each subgroup are irredundant. For other vertices (or themselves), which allows one to test many graphs, constraint propagation alone will spe- the resulting permutation for being a symmetry of the cialize all chameleon vertices, and for most randomly- original graph [8, Figure 2]. Confirmed symmetries are generated graphs no branching will be invoked at all. accumulated,4 and the algorithm backtracks to explore However, even when almost-symmetries form a group, other branches of the search tree. With appropriate chameleon branching may be necessary, as shown in pruning [20], the algorithm ignores all branches lead- Figure 2. This example also shows that our algo- ing only to symmetries expressible as compositions of rithm may produce redundant unions-of-subgroups and accumulated symmetries. This ensures that group gen- therefore needs post-processing. However, in general, erators at the output are irredundant and can implicitly delayed branching on chameleon vertices and the min- express an exponential number of symmetries in poly- imization of branching factors lead to more compact nomial space. union-of-subgroup expressions. The core algorithm Our extended algorithm leverages existing partition- above allows a number of engineering improvements, refinement techniques and interleaves traditional e.g., its decoupled branching on chameleon vertices branching with branching on colors of chameleon ver- can honor color-based constraints and preferences. tices. Since each branching on a chameleon vertex may create different subgroups in the union-of-subgroups structure, we seek to delay such branching and de- v1 v2 v5 crease the branching factor. The algorithm repeatedly applies rules from the following prioritized list.

1. Since all almost-symmetries of a given graph v4 v3 v8 v7 v6 G are in Aut(G ∗), apply an existing graph- automorphism algorithm to G ∗ (i.e., ignore vertex colors) until it needs branching or terminates. Figure 2: A graph with three red vertices (v1, v2, v3), 2. Any cell with vertices of more than one regular two blue vertices (v5, v7) and three chameleon vertices color, but no chameleon vertices, must be split (v4, v8, v6). Rule 1 separates v8 from other vertices, and immediately. Cells containing chameleon vertices Rule 4A colors v8 red. The remaining cell cannot be cannot be split based on internal vertex colors. split (Rule 2), and traditional branching is not allowed in it (Rule 5). Therefore, Rule 6 must be applied with 3. Apply partition refinement based on adjacencies branching factor 4 — on two vertices (v4,v6) with two to cells of regular colors. colors. Three of those branches produce non-trivial 4For graphs in engineering applications it is relatively almost-symmetries after traditional branching (Rule 5), rare to reject potential symmetries at this stage, but such but one of the resulting subgroups contains two others. bad leaves are common for highly symmetric Cayley graphs. Indeed, every almost-symmetry becomes a symmetry With no bad leaves, the algorithm runs in polynomial time. when v4 is colored red and v6 is colored blue. 6 Generalizations and Applications 7 Almost-symmetry-breaking Here we discuss other potential notions of almost- Existing approaches to exploiting symmetries in search symmetry in graphs, with an eye on algebraic structure. include pre-processing with symmetry-breaking pred- To bridge the gap between color-based and edge- icates (SBPs), symmetry-breaking during search [13; based almost-symmetries in graphs one can introduce 14] and symmetry-breaking by dominance. The first chameleon edges whose end-vertices may be mapped approach is largely independent of the search al- into other pairs of vertices that are either connected gorithm, while the last two require implementation by edges or not. In other words, we classify all pairs changes and typically have greater overhead [4]. Since of vertices into regular edges, chameleon edges, and in this work we only seek to demonstrate a com- non-edges, so as to prohibit mapping edges to non- plete and sufficiently general “life-cycle” for almost- edges and vice versa. Just as in the case of color- symmetries, we focus on pre-processing from now on. based almost-symmetries, ensuring that all powers of We do hope that the discussion below will also be use- an almost-symmetry are, too, almost-symmetries is ful in future work targeting specific search algorithms. tricky. For example, consider the five-vertex graph As mentioned in Section 2, the group isomorphism in Figure 3 with one regular edge and two chameleon Hsym ' Aut(G) is important when computing symme- edges. The 4-cycle (2345) satisfies the constraints im- tries of non-graph objects — it allows one to pull back posed so far, but its square (24)(35) swaps the regular group generators that are critical to efficient symmetry- edge (v1,v2) with the non-edge (v1,v4), which is pro- breaking [1]. We now define isomorphism of almost- hibited. To ensure that powers of almost-symmetries symmetries so that descriptions of almost-symmetries do not map edges to/from non-edges, one can impose in terms of generators always map to valid descriptions. an additional restriction similar to that in Section 4. An isomorphism of almost-symmetries is a one- For a given vertex-permutation π ∈ Sn, define to-one mapping γ such that ∀ almost-symmetries its action on pairs of vertices by means of π1,π2, their product π1 · π2 is defined if and only π π π π n γ π γ π e(vi,v j) := ( (vi), (v j)) so that e ∈ S( ). We if the product ( 1) · ( 2) is defined, in which 2 γ π π γ π γ π prohibit each permutation π whose πe has at least case we require that ( 1 · 2) = ( 1) · ( 2). one cycle containing both an edge and a non-edge. Isomorphism-of-symmetries proofs for graph con- According to this restriction, a chameleon edge in a structions (that model constraints and objective func- cycle without edges (in a particular almost-symmetry) tions) [1; 3] all extend to almost-symmetries. Omit- can be resolved into a non-edge, and in a cycle with ting details, each such graph construction defines an edges — into an edge. This subsumes the popular isomorphism of containing Sk groups (for k initial view of graph almost-symmetries as symmetries of variables and k graph vertices), and this mapping re- modified graphs [19]: if a given edge can be modi- mains an isomorphism on every subgroup in the union. fied, it should be viewed as a chameleon edge. One Hence, if either of the two permutations γ(π1) · γ(π2) can additionally constrain the number of instantiated and π1 · π2 is in a valid subgroup, then so is the other. edges or handle chameleon edges with preference for When defining SBPs, the key issue is not to prohibit non-edges/edges. Such almost-symmetries, too, form all good solutions. To aid in this, we build global SBPs unions of subgroups. from known lex-leader SBPs [2] for every generator of Almost-symmetries of functions with don’t-cares almost-symmetries. In particular, generator SBPs can are isomorphic to almost-symmetries of labeled be conjoined within subgroups because the respective graphs, as explained in Section 2. We now discuss dis- almost-symmetries can be freely composed. When the junctive constraints using the DNF-SAT instance ac + union of subgroups is derived from a disjunctive con- bc as example. This formula has one non-trivial per- straint, we can OR all subgroup SBPs because the lex- mutational symmetry (ab), with SBP (a ≤ b) = a0 + b. smallest assignment satisfying a disjunctive term will We can also swap either (a with c) or (b with c), but not satisfy one of subgroup SBPs. Yet, for a general CSP, a both. The obvious almost-symmetry-breaking predi- unique overall solution may violate all subgroup SBPs, cate (a ≤ c)+(b ≤ c) = (a0 +c)+(b0 +c) = a0 +b0 +c which suggests additional conditions per subgroup Gi. removes the non-solution 110 allowed by a0 + b. We propose to pick lex-leaders only among those as- signments that enable almost-symmetries in Gi. v v 5 2 For almost-symmetries gi1,gi2,...,gim from sub- Ψ Φ group Gi, we build their SBP as (Gi) := ( Gi ⇒ (∧ jψ(gi j)) where ψ(g1 j) is a lex-leader SBP for Φ v1 the permutation gi j and Gi is a pre-condition. The overall SBP for ∪iGi then ∧iΨ(Gi).

For function f , ΦG is (ideally the weakest) specializa- v4 v3 i tion of don’t-cares that turns gi j,∀ j into symmetries. For a constraint graph, if turning gi j into symmetries Φ Figure 3: A graph with one regular and two chameleon requires adding (or removing) an edge, then Gi ex- edges illustrating difficulties in ensuring that powers of presses the new constraint represented by this edge (or almost-symmetries are, too, almost-symmetries. Con- its negation). When a good precondition is hard to ◦ Φ Ψ sider a clockwise 45 -rotation about the center. build, we can skip Gi by assuming Gi = 0, (Gi) = 1. 8 Conclusions and Ongoing Work References In this paper we have studied almost-symmetries of [1] F. A. Aloul, A. Ramani, I. L. Markov, and K. A. several kinds, demonstrating that they possess the Sakallah, “Solving Difficult Instances of Boolean Sat- isfiability in the Presence of Symmetry”, IEEE Trans. structure of a set-theoretic union of subgroups of Sn. on CAD, Sep. 2003, pp. 1117-1137. We explained how almost-symmetries can be com- [2] F. A. Aloul, I. L. Markov, and K. A. Sakallah, “Efficient pactly represented, computed for a labeled graph and SymmetryBreaking for Boolean Satisfiability,” in Proc. used for symmetry-breaking. IJCAI ‘03, pp. 271-282. Open questions span abstract algebra, computational [3] F. A. Aloul, A. Ramani, I. L. Markov and K. A. complexity, algorithm design as well as applications in Sakallah, “Symmetry-Breaking for Pseudo-Boolean search and optimization. While groups (of symme- Formulas”, in Proc. ASPDAC ‘04, pp. 884-887. [4] F. A. Aloul, A. Ramani, I. L. Markov and K. A. tries) admit a complete abstract characterization and Sakallah, “Dynamic Symmetry-Breaking for Improved have many known properties, such a theory is not Boolean Optimization”, ASPDAC ‘05, pp. 445-450. yet available for the union-of-subgroups structure (can [5] L. Babai and E. M. Luks, “Canonical Labeling of any union-of-subgroups appear as a set of almost- Graphs”, in Proc. STOC`83, pp. 171-183. symmetries?). Regarding worst-case complexity, re- [6] K.-H. Chang, I. L. Markov and V. Bertacco, “Post- call that graph-automorphism is in NP, but is unlikely Placement Rewiring and Rebuffering by Exhaustive to be NP-complete. It cannot currently be solved in Search For Functional Symmetries”, Proc. ICCAD‘05. polynomial time, except in the bounded-degree case [7] J. Crawford, M. Ginsberg, E. Luks and A. Roy, [ ] “Symmetry-breaking Predicates For Search Problems”, 5 . While all graph automorphisms can be captured Int'l Conf. Principles of Knowledge Represent. & Rea- in poly-space by group generators, almost-symmetries soning (KR) ’96, pp. 148-159. may require exponential space even in the bounded- [8] P. T. Darga, M. H. Liffiton, K. A. Sakallah, and degree case — an example is given in Appendix A. Yet, I. L. Markov, “Exploiting Structure in Symmetry we believe that application-derived and “average-case” Detection for CNF”, in Proc. DAC ‘04, pp. 530-534. graphs can be solved quickly, as is the case for graph http://vlsicad.eecs.umich.edu/BK/SAUCY/ automorphism [8]. Extending symmetry-breaking dur- [9] J. D. Dunitz, “Symmetry Arguments in Chemistry”, Proc. Nat'l Acad. Sci. USA 1996; 93: 14260-14266. ing search [13; 14; 4] and by dominance to almost- [10] E. C. Freuder, “Eliminating Interchangeable Values in symmetries is another interesting direction. Constraint Satisfaction Problems”, in Proc. AAAI ‘91, Our discussion of algebraic structure in almost- pp. 227-233. symmetries of graphs also applies to functions with [11] E. C. Freuder and P. D. Hubbe, “Using Inferred Dis- don’t-cares and to disjunctive constraints. Other junctive Constraints to Decompose Constraint Satisfac- types of almost-symmetries may carry the union-of- tion Problems”, in Proc. IJCAI ‘93, pp. 254-260. subgroups structure with union taken over the allowed [12] W. Fushchych, W. Shtelen, “On Approximate Sym- metry and Approximate Solutions of Nonlinear Wave variants of the underlying object. The subgroups then Equations With Small Parameters”, J. Physics A, 1989, contain regular symmetries of the variant objects. A vol. 22, L887-L890. computational challenge is to minimize the number of [13] I. P Gent, B. M. Smith, “Symmetry Breaking in Con- subgroup terms in the union. Almost-symmetries can straint Programming”, in Proc. ECAI‘00, pp. 599-603. be captured using group generators — instead of the [14] I. Gent, W. Harvey, T. Kelsey, “Groups and Con- usual list of generators all of which are compatible, one straints: Symmetry breaking during search”, in Proc. needs a list of lists of generators, which are guaranteed CP ‘02, LNCS 2470, pp. 415-430, Springer. compatible only within a given list. This leads to a gen- [15] P. Gregory and A. Donaldson, “Concrete Applica- tions of Almost-Symmetry”, in Workshop on Almost- eralization of existing symmetry-breaking predicates Symmetry in Search, pp. 1-5, Comp. Sci. TR-2005-201, by means of preconditions. Unlike well-known con- Univ. of Glasgow, 2005. ditional symmetries, almost-symmetries do not depend [16] D. J. Gross, “The Role of Symmetry in Fundamental on the variable ordering and may be entirely syntactic, Physics”, Proc. Nat'l Acad. Sci. USA 1996; 93: 14256- which makes them potentially more numerous and eas- 14259. ier to find. On the other hand, conditional symmetries [17] M. E. Kellman, “Symmetry in Chemistry: From the Hydrogen Atom to Proteins”, Proc. Nat'l Acad. Sci. also form unions of subgroups and can be viewed as a USA 1996; 93: 14287-14294. type of semantic almost-symmetries. [18] B. Krishnamurthy, “Short Proofs For Tricky Formu- las”, Acta Informatica, vol. 22, pp.327–337, 1985. Appendix A: Exp-sized Union of Subgroups [19] D. Long and M. Fox, “Restoring Symmetries in Consider n + 2 disconnected vertices: v is red, v is Almost- Structures”, in Workshop on 1 2 Almost-Symmetry in Search, pp. 6-13, Comp. Sci. TR- blue, and n vertices are chameleon. All color special- n 2005-201, Univ. of Glasgow, 2005. izations are indexed by j = 0..2 −1 such that 1s in the [20] B. D. McKay, “Practical ”, Con- binary expansion of j correspond to red vertices. With gressus Numerantium 30(‘81), pp. 45-87. # j red vertices and n − # j blue vertices, G j ' S1+# j × [21] A. Mishchenko, “Fast Computation of Symmetries in S1+n−# j. No element of G j for any j maps v1 7→ v2, Boolean Functions”, IEEE Trans. on CAD, Nov. 2003, hence this is an invariant of ∪ jG j. However, ∀ i 6= j, pp. 1588-1593. [ ] the minimal subgroup containing Gi and G j contains a 22 P. J. Steinhardt “New Perspectives on Forbidden Sym- permutation that maps v 7→ v . Hence in any union- metries, Quasicrystals, and Penrose Tilings”, Proc. 1 2 Nat'l Acad. Sci. USA 1996; 93: 14267-14270. of-subgroups expression for almost-symmetries of the [23] V. Trimble, “Astrophysical symmetries”, Proc. Nat'l graph in question, each G j must be contained in a sep- Acad. Sci. USA 1996; 93: 14221-14224. arate term. Therefore, any list of lists of generators [24] Y. Zhang and E. Freuder, “Conditional Interchange- representing such an expression requires Ω(2n) space. ability and Substitutability”, in Proc. SymCon ‘04. Appendix B: Handling Chameleon Edges and only if the intervals labeling these vertices inter- We will now outline preliminary results on extend- sect. Without chameleon vertices, every vertex has a ing the algorithm from Section 5 to handle chameleon fixed degree, and the interval graph is a disjoint union edges, using the same overall framework that inter- of cliques (one per possible vertex degree). The cells of leaves branching and partition refinement. The sim- the degree-partition are connected components of the plest approach is to first branch on all chameleon edges interval graph, and can be found without building the and then continue the existing algorithm. This is indeed interval graph explicitly or traversing all of its edges. a correct overall algorithm, but will generate unions Chameleon vertices can make the interval graph a lot with the greatest possible number of subgroups. Fur- more complex, but vertices in different connected com- ther improvements need to delay branching as much ponents still cannot be mapped to each other, and con- as possible, identify chameleon edges that can be spe- nected components can still be found without build- cialized without branching, and let partition-refinement ing the interval graph explicitly or traversing all of its 0 prune unpromising branches. For example, if we know edges. The proposed Rule 1 is unconditional, just as Rule 1 it replaces. It builds an interval graph (or a re- that each of the two vertices vi and v j can only be mapped to itself, the chameleon edge connecting them duced version discussed below) and uses its connected can be specialized arbitrarily, without branching. components as an initial vertex partition. Some of the difficulties in generalizing partition The graph in Figure 3 has a connected interval graph, refinement to chameleon edges are largely the same but one can build a non-trivial example based on the as for chameleon vertices. Namely, the relation “a graph in Figure 2, whose interval graph consists of a given edge/vertex can be mapped to another given 7-clique and the disconnected vertex v8. Pick three edge/vertex by an almost-symmetry” is not transitive edges incident to v8 and color them chameleon. This and therefore is not an equivalence relation. The for- will leave v8 with at least four incident edges — more mer prevents free composition of almost-symmetries than any other vertex may have. The remaining 7 and the latter means that almost-symmetries do not vertices may still all have degree 3, suggesting that have orbits in the same sense that symmetries do. This the interval graph has not been affected. The inter- is what complicates splitting a cell with one blue, val graph defined so far can be reduced by removing one yellow and one chameleon vertex.5 In the pres- some edges. Namely, when two vertices connected by one chameleon edge have degree intervals m ,d ence of chameleon edges, each vertex with χi incident [ 1 ] and d,m respectively, these vertices cannot simulta- chameleon edges may have a range of (χi + 1) possi- [ 2] ble degrees depending on how those edges specialize. neously have the same degree (e.g., vertices v1 and v3 in Figure 3). From now on, we shall use this reduced In the graph from Figure 3, vertices v2 and v4 have de- interval graph (RIG). However, without new branch- grees 1 and 0 respectively, however vertices v3 and v5 may each have degrees 0 or 1 independently, and ver- pruning rules for chameleon edges, similar to rules Rules 4A and 4B, it is not useful to build an initial par- tex v1 may have degrees 1, 2 or 3. At this point, we see tition before specializing chameleon edges. that v4 cannot map to v1 and v2, but we cannot split v4 away vertices because v4 can map to v3, while v3 can We now use an idea from Section 6. map to v2. Thus, we have to branch on both chameleon edges from the start, and soon discover that the result- Label each pair of vertices by non-edge, edge ing four-subgroup union cannot be simplified — the or chameleon. Given a vertex-partition, induce initial branching factor could not have been reduced. a partition on the sets of vertex pairs (edge- To fathom the scale of additional changes required to partition) where each edge-cell corresponds to a improve the naive algorithm, we list several fundamen- pair of vertex-cells. Two pairs of vertices in dif- tal differences between chameleon edges and vertices. ferent edge-cells cannot be mapped to each other. 1. If chameleon edges are present, graph vertices do The concept of edge-partition facilitates analogues not have fixed degrees, which undermines the ini- (but not replacements) of Rules 3, 4A and 4B. tial degree partition in Rule 1. 2. Existing partition-refinement algorithms do not 3B Edge-cells that contain edges and non-edges, but work in the presence of chameleon edges, which no chameleon edges, should be split immediately. defeats Rule 3. 4C If an edge-cell contains only chameleon edges, 3. Unlike specializations of chameleon vertices, spe- then specialize all of them to non-edges (or, if de- cializations of multiple chameleon edges are not sired, specialize all to edges). vertex partitions. This obstructs possible ana- 4D If an edge-cell contains chameleon edges, but all logues of Rules 4A and 4B for chameleon edges. other vertex pairs in it are non-edges (edges), then The problem we have identified so far with the ini- specialize all chameleons to non-edges (edges). tial degree-partition (Rule 1) can be addressed effec- These rules can be incorporated into the process of tively as follows (Rule 10). After having computed inducing an edge-partition. An implementation can ig- the degree interval of each vertex, consider the cor- nore edge-cells consisting entirely of non-edges, which responding interval graph — it uses the original ver- improves efficiency for sparse graphs, and only keep tex set, but an edge between v and v is established if i j track of the remaining two types of cells: (i) edges only, 5Color information is used in traditional branching, but (ii) edges, non-edges and chameleons. partition refinement can often draw more implications from Rule 4D can be illustrated using our running exam- color information that eventually prune additional branches. ple with the graph from Figure 2 where three edges incident to v8 are changed into chameleons. The initial branching, which is likely to trigger combined refine- vertex partition separates v8 from 7 remaining vertices. ment again. At some point, we may have to branch on In the induced edge-partition, one particular edge-cell either chameleon edges or vertices – this branching is consists of vertex pairs (v8,v j), j = 1..7 and qualifies deliberately decoupled from traditional branching to (i) for Rule 4D. As a result, all chameleons are special- reduce the number of subgroups, and (ii) allow honor- ized to edges, and the degree intervals of some vertices ing chameleon-related constraints. Since the branch- get truncated. In general, the latter can cause the dele- ing factor of chameleon edges (=2) is smaller while tion of edges from the RIG and split some vertex cells. branching may have a greater impact, chameleon-edge This does not happen in our example, where we have branching is preferable apriori. Rather than branch specialized all chameleon edges without branching and on all remaining chameleon edges, we seek small can now fall back on Section 5. sets of chameleon edges such that specializing them We have not yet extended vertex-based partition- may split some connected components of the SRIG, refinement in Rule 3 to work with chameleon edges, at least in some branches. A good heuristic is to find which means that Rule 3 can only be applied after all small vertex-cuts in SRIG components and branch on chameleon edges are specialized. However, we can al- chameleon vertices incident to those vertices — the ready formulate the first non-trivial algorithm for find- idea is to truncate vertex degree intervals enough to dis- ing almost-symmetries with chameleon edges and ver- connect the cuts. tices. The algorithm first builds a RIG and finds its con- Future work. Algorithmic extensions outlined in nected components to build an initial degree partition. this appendix appear to address key challenges in han- If some vertex-cells can be split by colors as in Rules 2 dling chameleon edges and suggest that implementa- and/or 3, this is done and all edges in the RIG that con- tion efforts proceed by modifying existing software. nect newly-split cells are removed (we will abbreviate Here the main goal would be to add new functionality split RIG as SRIG). The presence of chameleon edges without affecting the current performance of NAUTY blocks partition refinement in Rule 3 so far. If there and/or SAUCY in cases without chameleon vertices is more than one vertex-cell, the algorithm induces a and edges. Note, however, that efficient data struc- non-trivial edge-partition. If any of Rules 3B, 4C and tures used for vertex-partition refinement need to be re- 4D trigger, some degree intervals can be adjusted, pos- worked to support edge-partitions and two-step variant sibly splitting vertex-cells. Some cells may be eligible of this classical algorithm. for Rules 2, 3, 4A and/or 4B. If the vertex-partition Closing remarks. While the handling of chameleon changes, the edge-partition must be refined, and so on. vertices and chameleon edges appear so different, they When this cycle stops, branching on chameleon edges can be reduced to each other via transformations with 3 can be considered, especially that the branching factor O(V ) overhead. First note that vertex colors can be is only 2 per edge (if we want to minimize the number simulated with vertex degrees if we add large numbers of subgroups, we should delay this branching further, of fake edges connecting existing vertices to new ver- as discussed below). tices of degree 1. Suppose M is the maximal vertex degree in the original graph (M < V − 1), then to sim- As it turns out, maintaining edge-partitions also al- 2 lows us to repair Rule 3. The first step is to reword im- ulate color k we can add kM < (V − 1) edges to each mediate partition-refinement without chameleon edges vertex of that color (more economical constructions are in terms of edge-partitions. Namely, each vertex is in- likely possible). cident to some edge-cells, regardless of its color, and To simulate chameleon vertex colors by chameleon a vertex-cell can be split so that only vertices incident edges, the newly-added edges can be chameleon. to exact same edge-cells remain in the same [sub-]cell. A different transformation allows one to simulate This is equivalent to the original partition-refinement chameleon edges by chameleon vertices — remove all by adjacency because edges incident to a given vertex- edges, add a new vertex vi j for each pair of existing cell can only be differentiated by their incident vertex- vertices vi,v j and establish pairs of edges: (vi j,vi) and cells on the other side. (vi j,v j). Now artificially increase the degree of newly added vertices to M + 1 by adding fake edges. If the The second step is to check that the two-step edge ei j existed in the original graph, color vi j pink, partition-refinement still works if we calculate inci- else color it violet. Similarly, chameleon edges can be dence to edge-cells through edges and chameleon- modeled by chameleon vertices. edges (without distinguishing them at this point). The two transformations just described allow us to The two-step refinement remains valid because edge- bound the conceptual differences between chameleon partition remains an equivalence relation even when edges and chameleon vertices, but are not necessarily chameleon edges are present. We replace Rule 3 with useful in practice. Rule 30 by swapping two-step partition-refinement for immediate partition-refinement. The improved algorithm, starts with Rule 10, at- tempts to refine the vertex-partition by Rule 2, then induces an edge-partition and applies Rules 3B, 4C and 4D, then tries color-related rules 4A and 4B, fol- lowed by Rule 30 and partition refinement. When such combined refinement stops, we first seek non-singleton cells without chameleon vertices and not incident to chameleon edges. In such cells we invoke traditional