Abstract
Magic-state distillation is one of the leading overheads in fault-tolerant quantum computation.
Existing methods for finding distillation factories require a transversal gate to act correctly on the entire codespace — a nonlinear constraint that limits both generality and search efficiency. We introduce a strictly weaker condition, requiring only that the distillation circuit act as the identity on a single input state. This borrowed-identity condition is linear, applies uniformly across all levels of the Clifford hierarchy, and unifies T-gate, CS-gate, and CCZ-gate factories within a single framework. A brute-force search under this condition recovers all known distance-2 factories within the search range — including entangled-output factories previously outside the scope of any numerical search — and reveals malleable parent circuits whose output magic-state type is selected during compilation rather than baked into separate hard-coded factory designs. The same search, unoptimized, produces 21,920 valid factories across three (non-Pauli) Clifford-hierarchy levels in ∼9 seconds on a standard laptop.