Gate G24 · Compilation
TKET grades the reductions
Every reduction claim on this site has so far been produced by our own rewriter and checked on the emulator — one toolchain marking its own homework. TKET is Quantinuum's production compiler, with an entirely separate optimiser and its own rebase onto the H-series native gate set. This gate rebuilds six circuit families as pytket circuits, runs them through TKET at optimisation levels 0, 1 and 2, and puts the resulting two-qubit counts next to the Nadarasa-reduced forms. Where the two agree, the reduction has independent corroboration. Where TKET wins, that is a gap to close.
What this lane actually runs
The extension's QuantinuumAPIOffline handler supplies the H2-2 device model without any credentials, project or job submission, so compilation targets the real native gate set at zero cost. Nothing is sent anywhere; the hardware switch documented in the benchmark suite is untouched.
- Device model
- H2-2
- Optimisation levels
- 0, 1, 2
- Two-qubit natives
- TK2, ZZMax, ZZPhase
- Shots per confirmation
- 512
No count in the tables below was allowed through until the compiled circuit was proved equal to its source on the full state space, up to global phase. Worst distance across all 36 rows: 6.33e-15. A circuit that fails the oracle is recorded as a failure and never scored — an optimiser that quietly changes semantics would otherwise look like the best optimiser in the table.
1 — Nadarasa reduction vs TKET optimiser
| Family | Qubits | Baseline 2q | Nadarasa 2q | TKET L2 on baseline | TKET L2 on Nadarasa | Verdict |
|---|---|---|---|---|---|---|
| G1Coset-phase parity ladder | 4 | 6 | 6 | 5 | 5 | both agree |
| G33-qubit QFT / AQFT_k=1 | 3 | 4 | 3 | 3 | 2 | not scored |
| G4Feed-forward conditional core | 2 | 3 | 1 | 1 | 1 | both agree |
| G16Ethylene QPDE interference cell | 2 | 4 | 2 | 1 | 1 | both agree |
| G21ADAPT-GQE H2 UCCSD excitation | 2 | 2 | 1 | 1 | 1 | both agree |
| G23Simon oracle, n = 3 | 6 | 5 | 3 | 5 | 3 | Nadarasa ahead |
Across 5 scored families: 4 where TKET independently reaches the same two-qubit count the rewriter reaches, 1 where the Nadarasa form is still ahead, 0 where TKET is ahead. The agreements are the useful part — for the QPDE cell, the UCCSD excitation and the feed-forward core, a production compiler with no knowledge of rules (N), (M) or (P) lands on exactly the reduced form, which is much stronger evidence than our own emulator agreeing with our own rewriter.
Where the two disagree, and why
G23 is the one family the optimiser does not crack. The Simon oracle emits CX(pivot, n+pivot) twice — once in the copy layer, once in the mask layer — separated by other CXs on unrelated wires. Cancelling them is an involution argument over commuting parity gates, which is exactly what rule (M) is for and what a peephole pass sweeping local windows does not see. Five two-qubit gates become three, a 40% cut that survives TKET's own level-2 pass on the reduced form.
G3 is excluded from scoring entirely. The AQFT band truncation drops a π/4 controlled phase, so it is an approximation, not a rewrite — no correctness-preserving compiler is allowed to find it. Listing it as a win would be comparing a compiler against a modelling decision.
2 — Every compile row
| Family | Variant | Level | Gates | 2q | Depth | 2q depth | Compile s | Oracle |
|---|---|---|---|---|---|---|---|---|
| G1 | raw | 0 | 15 → 47 | 6 → 6 | 25 | 6 | 0.011 | 4.5e-15 |
| G1 | raw | 1 | 15 → 22 | 6 → 6 | 14 | 6 | 0.026 | 4.4e-15 |
| G1 | raw | 2 | 15 → 19 | 6 → 5 | 12 | 5 | 0.107 | 3.3e-15 |
| G1 | nadarasa | 0 | 15 → 47 | 6 → 6 | 21 | 4 | 0.015 | 4.8e-15 |
| G1 | nadarasa | 1 | 15 → 20 | 6 → 6 | 10 | 4 | 0.020 | 3.5e-15 |
| G1 | nadarasa | 2 | 15 → 20 | 6 → 5 | 8 | 3 | 0.076 | 3.2e-15 |
| G3 | raw | 0 | 7 → 21 | 4 → 3 | 13 | 3 | 0.011 | 2.4e-15 |
| G3 | raw | 1 | 7 → 11 | 4 → 3 | 6 | 3 | 0.014 | 4.0e-15 |
| G3 | raw | 2 | 7 → 11 | 4 → 3 | 6 | 3 | 0.070 | 4.1e-15 |
| G3 | nadarasa | 0 | 6 → 16 | 3 → 2 | 12 | 2 | 0.007 | 2.5e-15 |
| G3 | nadarasa | 1 | 6 → 10 | 3 → 2 | 6 | 2 | 0.015 | 1.5e-15 |
| G3 | nadarasa | 2 | 6 → 10 | 3 → 2 | 6 | 2 | 0.067 | 1.5e-15 |
| G4 | raw | 0 | 4 → 17 | 3 → 3 | 13 | 3 | 0.006 | 1.3e-15 |
| G4 | raw | 1 | 4 → 6 | 3 → 1 | 4 | 1 | 0.013 | 6.8e-16 |
| G4 | raw | 2 | 4 → 7 | 3 → 1 | 4 | 1 | 0.029 | 1.2e-15 |
| G4 | nadarasa | 0 | 2 → 7 | 1 → 1 | 5 | 1 | 0.003 | 1.3e-15 |
| G4 | nadarasa | 1 | 2 → 6 | 1 → 1 | 4 | 1 | 0.007 | 6.9e-16 |
| G4 | nadarasa | 2 | 2 → 6 | 1 → 1 | 4 | 1 | 0.019 | 1.2e-15 |
| G16 | raw | 0 | 11 → 31 | 4 → 4 | 22 | 4 | 0.011 | 1.6e-15 |
| G16 | raw | 1 | 11 → 12 | 4 → 4 | 10 | 4 | 0.026 | 1.1e-15 |
| G16 | raw | 2 | 11 → 6 | 4 → 1 | 4 | 1 | 0.026 | 1.9e-15 |
| G16 | nadarasa | 0 | 7 → 11 | 2 → 2 | 7 | 2 | 0.001 | 8.8e-16 |
| G16 | nadarasa | 1 | 7 → 7 | 2 → 2 | 5 | 2 | 0.012 | 8.9e-16 |
| G16 | nadarasa | 2 | 7 → 6 | 2 → 1 | 4 | 1 | 0.015 | 1.2e-15 |
| G21 | raw | 0 | 7 → 17 | 2 → 2 | 13 | 2 | 0.009 | 1.4e-15 |
| G21 | raw | 1 | 7 → 8 | 2 → 2 | 6 | 2 | 0.022 | 9.8e-16 |
| G21 | raw | 2 | 7 → 5 | 2 → 1 | 3 | 1 | 0.034 | 8.8e-16 |
| G21 | nadarasa | 0 | 5 → 7 | 1 → 1 | 5 | 1 | 0.001 | 7.6e-16 |
| G21 | nadarasa | 1 | 5 → 5 | 1 → 1 | 3 | 1 | 0.009 | 8.1e-16 |
| G21 | nadarasa | 2 | 5 → 5 | 1 → 1 | 3 | 1 | 0.020 | 8.1e-16 |
| G23 | raw | 0 | 11 → 37 | 5 → 5 | 12 | 3 | 0.012 | 6.3e-15 |
| G23 | raw | 1 | 11 → 23 | 5 → 5 | 6 | 3 | 0.028 | 5.4e-15 |
| G23 | raw | 2 | 11 → 23 | 5 → 5 | 6 | 3 | 0.091 | 5.2e-15 |
| G23 | nadarasa | 0 | 9 → 27 | 3 → 3 | 10 | 2 | 0.010 | 5.5e-15 |
| G23 | nadarasa | 1 | 9 → 18 | 3 → 3 | 5 | 2 | 0.024 | 5.8e-15 |
| G23 | nadarasa | 2 | 9 → 18 | 3 → 3 | 5 | 2 | 0.086 | 5.9e-15 |
Level 0 is rebase-only and shows what the native gate set costs before any optimisation; levels 1 and 2 add TKET's peephole and two-qubit resynthesis passes. Note that level 0 already reduces some two-qubit counts: the rebase itself maps a CX–Rz–CX sandwich onto a single ZZPhase, so part of what looks like optimisation is really the native gate set being a better fit for phase-type circuits than the CX basis they were written in.
3 — Selene confirmation of the compiled circuits
Gate counts are a static claim. To close the loop, each level-2 compiled circuit is transpiled from its native TKET ops (PhasedX, Rz, ZZPhase, ZZMax) into the matching guppylang.std.qsystem calls and sampled on Selene at 512 shots, then compared against the exact distribution of the original source circuit. Both sides use half-turns, so the transpile is one-to-one with no angle conversion.
| Family | Variant | Qubits | Guppy ops | TVD vs exact | 4σ envelope | Verdict |
|---|---|---|---|---|---|---|
| G1 | raw | 4 | 23 | 0.0156 | 0.1250 | within |
| G1 | nadarasa | 4 | 24 | 0.0058 | 0.1250 | within |
| G3 | raw | 3 | 15 | 0.0410 | 0.1250 | within |
| G3 | nadarasa | 3 | 14 | 0.0664 | 0.1250 | within |
| G4 | raw | 2 | 11 | 0.0137 | 0.1250 | within |
| G4 | nadarasa | 2 | 10 | 0.0273 | 0.1250 | within |
| G16 | raw | 2 | 10 | 0.0032 | 0.1250 | within |
| G16 | nadarasa | 2 | 10 | 0.0325 | 0.1250 | within |
| G21 | raw | 2 | 9 | 0.0123 | 0.1250 | within |
| G21 | nadarasa | 2 | 9 | 0.0084 | 0.1250 | within |
| G23 | raw | 6 | 27 | 0.0898 | 0.1250 | within |
| G23 | nadarasa | 6 | 22 | 0.0469 | 0.1250 | within |
All 12 rows land inside the 4σ binomial envelope, worst total-variation distance 0.0898. Two independent compilers, one emulator, same distributions.
4 — Honest limits
- Offline compilation only: QuantinuumAPIOffline supplies the H2-2 gate set and no job is submitted, so no HQCs are consumed and no number here is hardware-measured.
- Every gate count is reported only after the compiled circuit was proved equal to its source up to global phase.
- G3 is an approximation family (AQFT band truncation), so TKET cannot reach the Nadarasa form without changing semantics; it is excluded from win/loss scoring.
- Optimisation-level runtimes are pytket wall-clock inside the Lovable sandbox and are comparative only.
- Six families at two to six qubits is a sample, not a survey. The agreements say the reductions are reachable by a production compiler on these circuits; they do not establish that the rules generalise.
References
- TKET documentation hub
Entry point for the compiler, extensions and API references.
- TKET user guide
Circuit construction, compilation passes and backend workflows.
- pytket API docs
Reference for Circuit, OpType, passes and predicates.
- pytket-quantinuum extension
QuantinuumBackend, offline API handler and device gate sets.
- pytket-quantinuum on GitHub
Source for the extension used by this compile lane.
- Quantinuum Systems
H-series device specifications behind the H2-2 gate set targeted here.