Abstract
We investigate collections of reversible gates closed under parallel and serial composition. In order to better understand the structure of these collections of reversible gates, we investigate the lattice of closed sets and the maximal members of this lattice, that is, collections that are not all gates, but the addition of a single new gate will allow us to construct all gates. We find the maximal closed sets over a finite alphabet.
We then extend to ancilla and borrow closure for reversible gates. Here we find some structural results, including some examples.
Keywords: Reversible gates, Maximal closed classes, Permutation groups
Introduction
For a given finite set A, we investigate the collections of reversible gates, or bijections of
for all k. The work derived from Tomasso Toffoli’s work [14] and as such we call closed systems of bijections reversible Toffoli Algebras (RTAs). We also consider ancilla and borrow closure, where an extra input and output is allowed; an ancilla is provided and returned in a particular state, whereas a borrowed bit is provided and returned in an arbitrary state.
The work also relates to permutation group theory, as an RTA C is a
-indexed collection of permutations groups,
.
In previous papers, Aaronson, Grier and Schaeffer have determined all ancilla closed gates on a set of order 2 [1], and the author, together with Jarkko Kari and Ville Salo, has investigated generating sets [2, 3] and other themes.
In this paper, we determine the possible maximal closed systems, relying strongly on Liebeck, Praeger and Saxl’s work [11], and determine some properties of maximal borrow and ancilla closed RTAs.
We show that the maximal RTAs are defined by an index that defines the single arity at which the RTA is not the full set of bijections. We then show that for different indices and orders of A, only certain possibilities can arise. For ancilla and borrow closed RTAs we find that there is similarly an index below which the maximal RTAs are full symmetry groups and above which they are never full.
We start by introducing the background properties of RTAs and some permutation group theory. The next section is an investigation of maximality, with the main result, Theorem 4, taking up the main body of this section. We then investigate properties of borrow and ancilla closed RTAs.
Background
In this section we will introduce the necessary terminology.
Let A be a finite set.
is the set of permutations or bijections of A, Alt(A) the set of permutations of even parity. If
we will write
and
. We write permutations in cycle notation and act from the right. We write the action of a permutation
on an element
as
. A subgroup
is transitive if for all
there is a
such that
. We also say that G acts transitively on A. If for all distinct
and
there is a
such that
for all i, then we say G is n-transitive on A. A subgroup G of
acts imprimitively if there is a nontrivial equivalence relation
on A such that for all
, for all
,
. If there is no such equivalence relation, then G acts primitively on A.
Let G be a group of permutations of a set A. Let
. Then the wreath product
is a group of permutations acting on
. The elements of
are
with action defined as follows: for
,
.
Let
and
. We call
the set of n-ary reversible gates on A, B(A) the set of reversible gates. For
, let
be defined by
. We call this a wire permutation. Let
. In the case that
is the identity, we write
, the n-ary identity. Let
,
. Define the parallel composition as
with
. For
we can compose
in
. If they have distinct arities we “pad” them with identity, for instance
and
,
, then define
and we can thus serially compose all elements of B(A).
We call a subset
that includes
and is closed under
and
a reversible Toffoli algebra (RTA) based upon Toffoli’s original work [14]. These have also been investigated as permutation clones [8], with ideas from category theory [9] and as memoryless computation [6]. If we do not insist upon the inclusion of
, then we have reversible iterative algebras [3] in reference to Malcev and Post’s iterative algebras. For a set
we write
as the smallest RTA that includes F, the RTA generated by F.
Let C be an RTA. We write
for the elements of C of arity n. We will occasionally write
as
for clarity.
In any RTA C, the unary part
is found as a wreath product in all other parts,
because the wire permutations give us the right hand factor while
for
gives us the left hand side.
Let q be a prime power, GF(q) the field of order q,
the collection of affine invertible maps of
to itself. We note that for all
,
. For a prime p, let
be the RTA of affine maps over
.
We say that an RTA
is borrow closed if for all
,
implies that
. We say that an RTA
is ancilla closed if for all
,
with some
such that for all
, for all
,
and
implies that
. If an RTA is ancilla closed then it is borrow closed. For any prime power q,
is borrow and ancilla closed.
Maximality in Permutation Groups
In this section we introduce some results from permutation group theory that will be of use. The maximal subgroups of permutation groups have been determined.
Theorem 1
([11]). Let
. Then the maximal subgroups of
are conjugate to one of the following G.
(alternating)

(intransitive)
where
and 
(imprimitive)
where
, 
(affine)
where
, p a prime(diagonal)
where T is a nonabelian simple group,
and 
(wreath)
with
,
, 
(almost simple)
,
a nonabelian simple group, G acting primitively on A
Moreover, all subgroups of these types are maximal when they do not lie in
, except for a list of known exceptions.
It is worth noting that in the imprimitive case, A is a disjoint sum of k sets of order m, giving an equivalence relation with k equivalence classes of order m, the wreath product acts by reordering the equivalence classes as
, then acting as
on each equivalence class. In the wreath case, the set A is a direct product of k copies of a set of order m, the wreath product acts by permuting indices by
then acting as
on each index.
Lemma 1
Let A be a set of even order and
. Then
.
Proof
is generated by
acting on the first coordinate of
and
acting on coordinates.
The action of
on
is even because for each cycle in the first coordinate, the remaining
coordinates are untouched. Every cycle occurs
times, which is even, so the action of
lies in
.
is generated by
and the involution
. By the same argument, each cycle of the action occurs an even number of times, so the action of
and the involution
on
lies in
so we are done. 
We have a similar inclusion for affineness.
Lemma 2
For
,
.
Proof
is generated by the permutation matrices
and the matrix
. These bijections are even parity because they only act on two entries, thus have parity divisible by
modulo 2 which is 0. 
Lemma 3
Let A be even order. Then
iff 4 divides
.
Proof
The same argument as above applies for
. The action of
swaps
pairs. This is even iff 4 divides
. 
Maximality in RTAs
In this section, we will determine the maximal RTAs on a finite set A.
We have some generation results from other papers that will be useful.
Theorem 2
([2] Theorem 5.9]). Let A be odd. If
, then
.
Theorem 3
([3] Theorem 20]). If
then
for all
.
Lemma 4
Let
, then
is 3-transitive on
.
Proof
Let
. Let
be distinct. We show that we can map these to
. There are three cases. See Fig. 1.
Fig. 1.

Cases 1 and 2 in Lemma 4
Case 1: Suppose
all distinct. Let
. Let
. Then
satisfies the requirements.
Case 2: Suppose
contains two values, wlog suppose
. Let
. Let
. Let
. Then
will map a, b, c to the situation in the first case.
Case 3: Suppose
. Then one of
or
must contain at least two values, wlog let
be so. Then
will give us the Case 1 if
contains three values, Case 2 if
contains two values. 
The two following results are only relevant for even A.
Lemma 5
Let
,
. Then
.
Proof
For
, the result is shown by calculation in GAP [7] that
as a subgroup of
is
.
For
the result follows from Theorem 2.
Suppose
Since
, we have all 1-controlled permutations of A in C. By [3] Lemma 18, with
the set of all 3-cycles, we have all 2-controlled 3-cycles in C. Thus
.
is 3-transitive on
by Lemma 4, so we have all 3-cycles in C, so
. 
We know that this is not true for A of order 2, where
generates a group of order 1344 in
, which is of index 15 in
and is included in no other subgroup of
. However we find the following.
Lemma 6
Let
be even,
. Then
.
Proof
For A of order 4 or more, we use the same techniques as in Lemma 5.
For A of order 2, we calculate. We look at
as a subgroup of
. The wire permutations
are generated by (2, 9, 5, 3)(4, 10, 13, 7)(6, 11)(8, 12, 14, 15) and (5, 9)(6, 10)(7, 11)(8, 12). Then
is a subgroup of
acting on the indices
, generated by (1, 2, 3, 4, 5, 6, 7, 8)(9, 10, 11, 12, 13, 14, 15, 16) and (1, 2)(9, 10). It is a simple calculation to determine that this group is the entire alternating group
, so
. 
We can now state our main theorem.
Theorem 4
Let A be a finite set. Let M be a maximal sub RTA of B(A). Then
for exactly one i and M belongs to the following classes:
and
is one of the classes in Theorem 1.
,
, and
(up to conjugacy)
,
is odd and 
,
and 
,
and 
,
and
where T is a finite nonabelian simple group, with
(up to conjugacy)
,
and
is an almost simple group (up to conjugacy)
,
is even and 
Proof
Suppose
with
natural numbers such that
and
. Wlog,
, let
. Remember that compositions of mappings of arity at least j will also be of arity at least j, so
for all
. Then
because N contains all of
and
because
. Thus M was not maximal, proving our first claim.
For the rest of the proof, take M maximal with
. Then
is a maximal subgroup of
.
Suppose
. Then
and we are interested in the maximal subgroups of
. From Theorem 1 we know that these are in one of the 7 classes.
Suppose
. Then
so
is transitive on
. As
we also know that
. Assume
acts imprimitively on
with equivalence relation
. Let
,
with
. By the action of
acting on the ith coordinate we obtain
with
and
for all
. By the action of
on coordinates we can move this inequality to any index. Thus by transitivity we can show that
and is thus trivial, so our action cannot be imprimitive.
We now consider the cases of A odd and even separately.
Suppose
and
is odd. If
then
and
, so by Theorem 2 we have all of B(A) and thus M is not maximal, a contradiction. Thus we have
.
and
so M contains
. If
then by Theorem 1 this is maximal in
so
must be precisely this. So the case of A order 3 is left. We want to know which maximal subgroups of
contain
. There are 7 classes of maximal subgroups, we deal with them in turn.
Since
is odd on
,
.From the discussion above we know that
is transitive and primitive on
, so the second and third cases do not apply.The permutations in
can be written as affine maps in
and
can be written as
, the off diagonal
matrix over
, so
embeds in the affine general linear group. Thus
is one possibility.The diagonal case requires
for some nonabelian finite simple group T, a contradiction.The wreath case requires
, a contradiction.By [4] all G acting primitively on
with subgroups that are nonabelian finite simple groups are subgroups of
, and we have odd elements in M, so this is a contradiction.
Thus the only maximal subgroup is
.
Suppose
and
is even. We know from Theorem 3 that for
we can get all of
from
.
is maximal in
so we are done.
Thus we are left with 3 cases,
.
From Lemma 6 we know that for
,
is the only possibility.
From Lemma 5 we know that for
and
,
is the only possibility. For
we find that
generates a subgroup of
that is only included in
, so again
is the only possibility.
Thus we are left with the case
. From the above we know that the intransitive and imperfect cases cannot arise. Thus we need to consider the wreath, affine, diagonal and almost simple cases.
:
has order 8,
has order 24, so
is maximal and we are done.Case
: Lemma 3 above says that
so it is maximal by Theorem 1.Case
: Alternating is possible by inclusion. The affine case
lies in
by Lemma 2. Diagonal not possible by order. Almost simple not possible because all primitive groups of degree 16 lie in the alternating group
[4] .Case
: Alternating is always possible. If
for some m, then
might be possible, but lies in
by Lemma 2. Diagonal, almost simple might be possible, if
.

The Existence of Maximal RTAs
It is not immediately clear that all the classes of maximal RTAs can actually exist. So let us investigate a few small examples.
Let us take A of order 2. For
we find no nontrivial subgroups, so the maximal is
of order 1. For
case 4 gives us
of order 8 as a maximal subgroup. We note that
, i.e. all binary bijections are affine maps. For
we have
alternating as the only example, as we know from Toffoli [14] and others that the alternating bijections of arity i are generated by the collection of all permutations of arity less than i.
Taking A of order 3, we obtain a few more examples. For
we write
and we know that
has maximal subgroups
as well as
,
,
. These correspond in Theorem 1 to the alternating case and intransitive cases. For
we write
and note that the unary maps are all affine, that is, the set of affine maps
is identical to the permutations
. The binary affine maps
include all sums of unary affine maps and the wire permutation
. With the inclusion of the linear map
we obtain all affine maps. From Theorem 1 above we know this is maximal as a subgroup of
. For
we know that
generate all of B(A) so we are done.
For A of order 4 things get a touch more complex. For
we get a number of maximal subgroups.
is maximal. By fixing one element we obtain 4 maximal subgroups isomorphic to
as intransitive subgroups. By imposing an equivalance relation with two classes of two elements each (
or
or
) we obtain subgroups isomorphic to
that act imprimitively on A.
is of order 24, same as
, we see that the affine maps are precisely the permutations, not maximal. There is no nonabelian simple group to allow a diagonal maximal subgroup. The wreath product also fails by order, and no nonabelian simple group of order less than 24 exists, so the almost simple case cannot arise. For
we find
a maximal subgroup. For
we see that there are no nonabelian finite simple groups of order 16, so case 6 cannot arise. It can be shown by investigation of [4] that
cannot be an almost simple group.
For orders 5 and above, we know that the maximal RTAs for
can be obtained by permutation group analysis directly. For A of odd order we have the wreath case
maximal in
and none others. For A even we have the alternating and wreath cases easily constructible. We are left with the question whether, for A of order a multiple of 4, the diagonal or almost simple cases can actually arise.
The possibilities for the diagonal case with A of order equal to the order of a finite simple nonabelian group start with A of order 60. The other possibility is that
for some finite simple nonabelian group T. The only known result in this direction is in [13] where they show that symplectic groups Sp(4, p) where p is a certain type of prime, now known as NSW primes, have square order. The first of these groups is of order
corresponding to A of order
. We note that the sporadic simple groups have order that always contains a prime to the power one, so they are not of square order. We know that the Alternating group can never have order that is a square, as the highest prime less than n will occur exactly once in the order of the group. It might be possible that there are other finite simple groups of square order. As far as we are aware, there have been no further results in this direction.
Each of these possibilities is far beyond the expected useful arities for computational processes.
The other case is to look at almost simple groups. Let A be of order 4k, then we are looking for an almost simple action of degree
. In [4] we saw that all primitive actions of degree 16 are alternating, that is, they are subgroups of
. In order to find an example, we can hope to use results about primitive permutation groups of prime power [5] and product of two prime power [10] degrees, so we would be able to investigate A of order 4k for
. Once again this would include all examples of arities expected to be useful for computational processes.
Maximality with Borrow and Ancilla Closure
The strength of Theorem 4 is partially due to the fact that there is no effect of the existence of mappings of a certain arity in a given RTA on the size of the lower arity part, as there are no operators to lower the arity of a mapping. This does not apply with ancilla and borrow closure. In this section we collect some results about maximal ancilla and borrow closed RTAs. The following result reflects the first part of Theorem 4.
Lemma 7
Let
be a maximal borrow or ancilla closed RTA. Then there exists some
such that for all
,
and for all
,
.
Proof
Suppose
. Then for all
,
,
so by borrow closure
, so
for all
. As M is maximal, there must be a largest k for which
, since otherwise
.

We will call k the index of the maximal ancilla closed or borrow closed RTA.
From Theorem 2 we then note the following.
Lemma 8
Let
be odd. Then M maximal with index
are the only options.
In this case, we can say a bit more for index 2. If A is of order 3, then by the argument in Theorem 4 above, we find that
, the affine maps over a field of order 3. Otherwise A is at least 5 and
is no longer affine. See Lemma 11 below.
Similarly, we obtain the following, but see Corollary 1 below for a stronger result.
Lemma 9
Let
be even. Then M maximal with index
are the only options and for
,
.
Proof
We start by noting that for even
, for all
,
. Thus if
for some
, then
which is a contradiction, which shows the second part of the result.
Suppose
, so
. Then by Lemma 6
, so by Theorem 3
for all
. But we know that by borrow closure, this implies that
so M is in fact B(A). This is a contradiction, so
. 
Using similar arguments, we obtain the following.
Lemma 10
Let
. Then M maximal with index
are the only options and for
,
.
Proof
Suppose M is maximal with
. Then by Theorem 3 we obtain
for all
, which by the first argument in the previous Lemma, implies that M is not maximal.
Suppose M is maximal with
. We know that
. Then by Lemma 6 we find that
, by Theorem 3 we obtain all of
so by borrow closure all of
and thus M is not maximal. 
We obtain some examples of maximal borrow and ancilla closed RTA. The expression degenerate to describe maps where each output index depends only upon one input comes from [1].
Lemma 11
For
, the degenerate RTA Deg(A) generated by
is a maximal borrow closed RTA and maximal ancilla closed RTA.
Proof
Let Deg(A) be generated by
. Then
for all
which is maximal in
by Theorem 1. Thus any RTA N properly containing Deg(A) will have
for some
and thus
by Lemma 7. Let
, then
so
and by Lemmas 8 and 9,
, so Deg(A) is maximal. 
For
,
consists of affine maps, so
and thus cannot be maximal.
Corollary 1
Let
be even. Then M maximal with index
are the only options.
Proof
From Lemma 9 we know
are possible. Suppose M is maximal in B(A) with
.
Suppose
.
can be embedded in
represented on
with the tuples in
represented by the integers
, generated by the permutations
![]() |
and
. With the wire permutations we obtain a subgroup of
that is the alternating group, so
and by Theorem 3 we then get
and thus M is not maximal.
Suppose A is even with more than 6 elements. The degenerate RTA
because
, but because Deg(A) is maximal and
is a supergroup of
, M is all of B(A) and is not maximal. 
Lemma 12
Let A be of prime power order. Then
is a maximal borrow closed RTA and a maximal ancilla closed RTA.
Proof
Let
. Suppose M is not maximal, so
.
Let A be of odd order. For every i, except
with A of order 3,
is maximal in
by Theorem 1. Let
,
. Then
by subgroup maximality, so for all
,
. For all
,
so similarly
so
and M is maximal.
Let A be of even order, so a power of 2. Let
,
. We know from Lemma 2 above that
is not maximal, so the odd order argument above does not hold. By [12] we know that
or
. For all
,
so
or
. In both cases this means that
, as for all
, so
and M was maximal.
Because
is ancilla closed and maximal as borrow closed, there can be no ancilla closed RTA between
and B(A) so
is a maximal ancilla closed RTA. 
We look at a few concrete examples.
By [1] we know that for A of order 2, we have the following maximal ancilla closed RTAs.
The affine mappings,
The parity respecting mappings, which either preserve the number of 1s mod 2, or invert it,
The odd prime-conservative mappings, that preserve the number of 1s mod p, an odd prime.
The affine mappings have index 3, the parity respecting index 2 and the odd prime-conservative mappings have index 1.
It remains an open problem whether these are the borrow closed maximal RTAs over A of order 2.
For A of order 3, we know that the affine maps
is an index 2 maximal borrow closed RTA and a maximal ancilla closed RTA.
For A of order 4, we can say the following about index 2 maximals. There are the following inclusions,
where ASp is a group of order 11520 that consists of the affine maps where the linear part is a symplectic linear map in Sp(4, 2). If
then M includes the affine maps properly. We know that the affine maps are maximal, a contradiction.
for the affine maps that we know form a maximal borrow and ancilla closed RTA. It is possible that
or
for some maximal M.
For A of order 5 or more, we know that index 2 arises only for the degenerate RTA Deg(A).
Conclusion and Further Work
We have determined the maximal RTAs, using results from permutation group theory and some generation results.
As we have not been able to construct explicitly an example of a maximal RTA with
and
of diagonal or almost simple type, the conjecture remains that these are not, in fact, possible. We note however that if such examples exist, they will arise for A of order 8 or more, so will probably not be relevant for any practical reversible computation implementation.
In future work we aim to determine the weight functions as described by [8] for maximal RTAs, in order to determine whether they hold some interesting insights.
The results for borrow and ancilla closed RTAs are not as comprehensive. We hope to determine these in the foreseeable future. We note interestingly that for a state set of order 5 or more, Lemma 11 indicates that if we can implement all permutations of the state set, we need only have one non-degenerate gate in order to implement all gates under borrow or ancilla closure. Similarly we see that once we can implement all affine maps on a state set of prime power order, then only one nonaffine gate is needed to implement all gates. For the ancilla case, many of the techniques of [1] will prove useful. In the ancilla case, we know all maximal RTA with index 2 except for A of order 4.
Acknowledgements
Michael Guidici has helped extensively with understanding primitive permutations groups, for which I thank him greatly.
Footnotes
The research has been supported by Austrian Science Fund (FWF) research projects AR561 and P29931.
Contributor Information
Ivan Lanese, Email: ivan.lanese@gmail.com.
Mariusz Rawski, Email: mariusz.rawski@gmail.com.
Tim Boykett, Email: tim.boykett@jku.at, Email: tim@timesup.org.
References
- 1.Aaronson, S., Grier, D., Schaeffer, L.: The classification of reversible bit operations. Electron. Colloquium Comput. Complexity (66) (2015). https://eccc.weizmann.ac.il//report/2015/066/
- 2.Boykett T. Closed systems of invertible maps. J. Multiple-Valued Logic Soft Comput. 2019;32(5–6):565–605. [Google Scholar]
- 3.Boykett T, Kari J, Salo V. Finite generating sets for reversible gate sets under general conservation laws. Theor. Comput. Sci. 2017;701(C):27–39. doi: 10.1016/j.tcs.2016.12.032. [DOI] [Google Scholar]
-
4.Buekenhout F, Leemans D. On the list of finite primitive permutation groups of degree
50. J. Symb. Comput. 1996;22(2):215–225. doi: 10.1006/jsco.1996.0049. [DOI] [Google Scholar] - 5.Cai Q, Zhang H. A note on primitive permutation groups of prime power degree. J. Discrete Math. 2015;2:191–192. [Google Scholar]
- 6.Gadouleau M, Riis S. Memoryless computation: new results, constructions, and extensions. Theoret. Comput. Sci. 2015;562:129–145. doi: 10.1016/j.tcs.2014.09.040. [DOI] [Google Scholar]
- 7.The GAP Group: GAP - Groups, Algorithms, and Programming, Version 4.10.2 (2019). https://www.gap-system.org
- 8.Jeřábek E. Galois connection for multiple-output operations. Algebra Universalis. 2018;79(2):1–37. doi: 10.1007/s00012-018-0499-7. [DOI] [Google Scholar]
- 9.LaFont Y. Towards an algebraic theory of Boolean circuits. J. Pure Appl. Algebra. 2003;184:257–310. doi: 10.1016/S0022-4049(03)00069-0. [DOI] [Google Scholar]
- 10.Li CH, Li X. On permutation groups of degree a product of two prime-powers. Commun. Algebra. 2014;42(11):4722–4743. doi: 10.1080/00927872.2013.823500. [DOI] [Google Scholar]
- 11.Liebeck MW, Praeger CE, Saxl J. A classification of the maximal subgroups of the finite alternating and symmetric groups. J. Algebra. 1987;111(2):365–383. doi: 10.1016/0021-8693(87)90223-7. [DOI] [Google Scholar]
- 12.Mortimer B. Permutation groups containing affine groups of the same degree. J. Lond. Math. Soc. 1977;2(3):445–455. doi: 10.1112/jlms/s2-15.3.445. [DOI] [Google Scholar]
- 13.Newman M, Shanks D, Williams HC. Simple groups of square order and an interesting sequence of primes. Acta Arith. 1980;38(2):129–140. doi: 10.4064/aa-38-2-129-140. [DOI] [Google Scholar]
- 14.Toffoli T. Reversible computing. In: de Bakker J, van Leeuwen J, editors. Automata, Languages and Programming; Heidelberg: Springer; 1980. pp. 632–644. [Google Scholar]

