In Part I, we introduced a general framework for constructing logical gates in quantum CSS codes from cohomology invariants, focusing on cup products and their generalizations from topological to qLDPC codes. In particular, we produced a family of
Ck−1Z logical gates that we called copy-cup on
k copies of the same quantum code implemented by finite-depth circuits. Here, we vastly extend this framework by introducing twists incorporating code automorphisms, higher twisted cohomology operations, and folding operations in relative cohomology. The framework includes operations lifting coefficients from
Z/2 to
Z/2k, enabling all diagonal logical gates such as single-qubit rotations
R(2π/2k). Composing these operations with maps that select cohomology classes yields addressable logical gates. Examples include addressable
T gates on three- and four-tori and gates in qLDPC codes beyond topological ones. We introduce cohomology operations, such as the higher twisted Pontryagin powers, that to our knowledge have not previously appeared in the mathematics literature. These operations arise from
E∞-structures on cochains, with explicit constructions using cyclic resolutions and the surjection operad. We expect these results to be of independent interest in homotopy theory. Our formalism applies much more broadly to chain complexes carrying suitable operadic structures, and we expect this operadic perspective to uncover further connections between homotopy theory and fault-tolerant quantum gates.
Fault-tolerant quantum computation can incur a substantial resource cost when a desired logical operation must be constructed from a restricted set of logical primitives. To make such operations directly available, we introduce irrep surface codes (ISCs), two-dimensional topological quantum error-correcting codes engineered to transversally implement a prescribed set of logical gates. The target logical gates only need to satisfy two conditions: (i) they generate a finite group, which, up to global phases, is forced by the Eastin-Knill theorem, and (ii) they are irreducible, meaning that any operator commuting with the set of gates must be proportional to the identity. This accommodates arbitrary finite groups of diagonal gates and arbitrary reversible classical gates, since each can be embedded into a larger irreducible finite group of gates. It also enables logical gates outside every finite level of the Clifford hierarchy. To incorporate these operations into surface-code computations, we further develop lattice-surgery protocols to transfer the encoded information between surface codes and ISCs obeying one of two sufficient conditions. Together, these results establish a systematic method for tailoring topological codes to desired logical operations and integrating them into conventional computations.