Abstract. Let n and r be positive integers with 1 < r < n, and let X n = {1, 2, . . . , n}. An r-set A and a partition π of X n are said to be orthogonal if every class of π meets A in exactly one element. We prove that if A 1 , A 2 , . . . , A ( n r ) is a list of the distinct r-sets of X n with |A i ∩ A i+1 | = r − 1 for i = 1, 2, . . . , n r taken modulo n r , then there exists a list of distinct partitions π 1 , π 2 , . . . , π ( n r ) such that π i is orthogonal to both A i and A i+1 . This result states that any constant weight Gray code admits a labeling by distinct orthogonal partitions. Using an algorithm from the literature on Gray codes, we provide a surprisingly efficient algorithm that on input (n, r) outputs an orthogonally labeled constant weight Gray code. We also prove a two-fold Gray enumeration result, presenting an orthogonally labeled constant weight Gray code in which the partition labels form a cycle in the covering graph of the lattice of all partitions of X n . This leads to a conjecture related to the Middle Levels Conjecture. Finally, we provide an application of our results to calculating minimal generating sets of idempotents for finite semigroups.2000 Mathematics Subject Classification. 94B25, 05A18, 20M20.
Introduction and background.We prove a combinatorics result concerning constant weight Gray codes, with application to minimal generating sets of finite semigroups. The paper contributes techniques, algorithms, and problems aimed at understanding the combinatorics of functions on finite sets and their efficient listing.Let X n = {1, 2 . . . , n}. In the 1950's Frank Gray [9] developed algorithms that for a positive integer n, list the 2 n subsets of X n in such a way that successive subsets differ minimally, having a singleton symmetric difference (including the first and last set). The lists, now known as Gray codes, were used by Gray to minimize errors in certain analog computer operations.For a given positive integer r with 1 ≤ r < n, refer to an r-element subset of X n as an r-set. Gray [9] also constructed listings of the r-sets of X n so that successive r-sets differ minimally, having two element symmetric difference (equivalently, successive rsets intersect in an (r − 1)-set). These r-set listings became known as constant weight Gray codes; we specify parameters by calling such a code a constant weight (n, r)-Gray code. A partition π of X n is said to be a weight-r partition if π has r classes. In the present paper, we prove that every (n, r)-Gray code admits what we call an orthogonal labeling by weight-r partitions. An orthogonal labeling of a constant weight (n, r)-Gray code leads to a listing of a minimal generating set for the finite semigroup K(n, r), consisting of all transformations on X n with image sets of r or fewer elements. We