<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/logical-equivalence-is-not-physical-equivalence-in-quantum-compilation-vkuvb461l" -->

---
title: Logical Equivalence Is Not Physical Equivalence in...
description: Quantum circuit transpilers preserve unitary equivalence, but that guarantee says nothing about physical behavior on real hardware. Routing decisions, native...
canonical: https://daily.dev/posts/logical-equivalence-is-not-physical-equivalence-in-quantum-compilation-vkuvb461l
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Logical Equivalence Is Not Physical Equivalence in Quantum Compilation | daily.dev
og:description: Quantum circuit transpilers preserve unitary equivalence, but that guarantee says nothing about physical behavior on real hardware. Routing decisions, native...
og:url: https://daily.dev/posts/logical-equivalence-is-not-physical-equivalence-in-quantum-compilation-vkuvb461l
og:image: https://api.daily.dev/og/posts/Vkuvb461L.png
og:image:alt: Logical Equivalence Is Not Physical Equivalence in Quantum Compilation
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Logical Equivalence Is Not Physical Equivalence in Quantum Compilation

**[Mayckon Giovani](https://daily.dev/sources/esfmr9ikfccm0xofxzkg7)** · [@doomhammerhell](https://daily.dev/doomhammerhell) · 10 min read · 0 upvotes · 0 comments

## Summary

Quantum circuit transpilers preserve unitary equivalence, but that guarantee says nothing about physical behavior on real hardware. Routing decisions, native gate decomposition, scheduling, calibration drift, and parameter binding in variational algorithms can each silently change error rates, symmetry violation, and mitigation effectiveness even when the logical circuit is unchanged. The piece argues compiler correctness for quantum hardware needs two specifications: logical equivalence and physical validity, and that transpilation artifacts (layouts, seeds, calibration dependencies) should be treated as part of the experimental record rather than discarded preprocessing.

## Content

A transpiler can preserve the unitary of a quantum circuit and still make the experiment worse.

This is not a compiler bug.

Two circuits can be equivalent under the ideal circuit model while having very different behavior after mapping onto physical qubits. The difference comes from topology, native gate decomposition, pulse duration, crosstalk, calibration state, leakage, scheduling, and the particular observable being estimated.

That creates an awkward boundary between quantum algorithms and systems engineering.

The compiler is allowed to rewrite the circuit because those rewrites preserve ideal semantics. The hardware, however, does not implement ideal semantics.

The physical machine sees a different program.

## Unitary equivalence is too weak

Suppose two circuits implement the same logical operator. In an ideal simulator, replacing one with the other changes nothing except perhaps a global phase.

On hardware, the circuits can differ in:

- number of entangling gates;
- physical qubits selected;
- total execution duration;
- idle periods;
- direction of native two-qubit interactions;
- exposure to spectator errors;
- leakage probability;
- measurement assignment error.

The relevant equivalence relation is therefore conditioned on the machine.

A compiler can reduce gate count and still increase physical error.

Consider routing.

A logical CNOT between non-adjacent qubits usually requires some combination of SWAPs, remapping, or architecture-specific operations. Each SWAP may itself decompose into several entangling gates.

The logical circuit contains one interaction.

The physical circuit may contain many.

This is already familiar. The less obvious problem is that minimizing SWAP count is not necessarily the correct objective either.

Suppose path A requires fewer SWAPs but crosses a region containing two qubits with poor ECR fidelity. Path B is longer but uses a stable subset of the coupling graph.

A topology-only router prefers A.

A calibration-aware router may prefer B.

Neither decision is universally correct because average gate error still does not tell us how those errors affect the observable of interest.

The cost function depends on the computation.

## Native decomposition changes the error channel

Logical gates hide hardware-specific realization.

On one processor, a CNOT-like interaction may be synthesized using echoed cross-resonance operations. Another machine may expose CZ. Another may favor iSWAP-like interactions. Single-qubit corrections are inserted around those primitives to recover the desired logical operation.

Under ideal algebra, these decompositions are interchangeable.

Their physical error channels are not.

A coherent over-rotation in a native entangling gate can accumulate systematically across repeated decompositions. A stochastic approximation that assumes independent depolarizing noise will miss that structure.

This matters when the compiler performs algebraic simplification.

Imagine two adjacent rotations that theoretically cancel. Removing them shortens the circuit. Usually sensible.

But sometimes those operations were separating two physical interactions whose coherent errors partially canceled.

The optimized circuit is mathematically cleaner and physically worse.

The reverse can happen too. Additional randomized compiling operations may increase the gate count while converting coherent error into something closer to a stochastic channel, improving the behavior of the full computation.

Gate count alone cannot order these circuits.

## Depth is not a scalar reliability metric

Circuit depth is often used as shorthand for hardware difficulty.

Useful shorthand. Weak model.

A depth-100 circuit dominated by single-qubit Clifford operations is not comparable to a depth-100 circuit containing dense entangling layers.

Even two circuits with the same two-qubit depth can behave differently if one repeatedly stresses the same coupler while another distributes interactions across the chip.

Wall-clock duration matters as well.

Some native gates take much longer than others. Measurement and reset have different time scales. Dynamical decoupling may insert extra pulses during idle periods, increasing instruction count while reducing dephasing.

The schedule matters.

ASAP scheduling executes operations as early as dependencies permit. ALAP scheduling delays them toward the end of the available window. Both preserve circuit dependencies.

They expose qubits to different idle-time distributions.

For a qubit with short T1 or T2 relative to the scheduled gaps, the difference can be measurable.

The compiler has changed no logical gate.

It has changed the physical evolution.

## Parameterized circuits make this worse

Variational workloads expose another problem.

A transpiler often compiles a parameterized circuit once and later binds numerical parameter values. This is desirable because recompiling every iteration is expensive and may produce inconsistent mappings.

But parameter values themselves can affect physical behavior.

Certain rotations become nearly identity operations. Others combine with neighboring gates. Some parameter assignments produce states with very different sensitivity to coherent error or leakage.

If aggressive optimization is performed after parameter binding, the physical circuit may change from iteration to iteration.

Now the optimizer is no longer sampling only different parameter values.

It may also be sampling different circuit structures.

That introduces another source of non-stationarity into the objective.

Compile once and bind later, and you preserve structural consistency but potentially miss parameter-specific simplifications.

Bind first and optimize aggressively, and you reduce each individual circuit while changing the execution structure across the optimization path.

There is no free choice here.

The runtime needs to decide which invariant matters.

## Symmetry can disappear during lowering

Many quantum algorithms have algebraic structure that can be used for validation.

Particle number.

Parity.

Conserved spin sectors.

Stabilizer constraints.

Problem-specific symmetries.

The logical circuit may preserve these properties exactly.

A compiler transformation that is correct in the ideal model also preserves them mathematically. Physical execution can still violate them because different decompositions expose different error mechanisms.

This matters for symmetry verification.

Suppose a VQE workflow rejects measurement outcomes outside a conserved particle-number sector. A transpilation strategy that increases leakage into invalid sectors creates more rejected samples.

The logical algorithm has not changed.

The effective sampling cost has.

Another mapping may produce slightly worse average fidelity but much less symmetry violation, yielding a better estimator after post-selection.

A compiler optimized against device-wide gate fidelity will not necessarily discover this.

It would need an objective connected to the algorithm's acceptance condition.

## SABRE does not know your physics

Algorithms such as SABRE are effective because they treat routing as a constrained graph problem and search for mappings that reduce expected communication cost.

That is the right abstraction for one layer.

It is not the whole machine.

A SWAP heuristic normally does not know that qubit 17 showed elevated leakage in the previous calibration cycle, that a particular coupler has strong spectator effects under simultaneous drive, or that the observable you care about is unusually sensitive to a specific correlated error.

These facts live below or outside the logical routing problem.

The compiler stack therefore needs multiple cost models.

Qiskit, tket, Cirq, QIR-based stacks, and vendor-specific toolchains all separate compilation into passes because no single transformation captures the complete objective.

The difficult part is deciding what information should cross those pass boundaries.

Topology certainly should.

Calibration data probably should.

Pulse duration sometimes should.

Workload semantics may need to.

At that point compilation is no longer merely circuit rewriting. It becomes hardware-aware optimization under incomplete and time-dependent information.

## Calibration makes compilation expire

A compiled circuit is associated with a machine state, even if the artifact itself does not record one.

Suppose the compiler chooses physical qubits because their reported two-qubit fidelities are best at 10:00.

The job waits.

The backend is recalibrated at noon.

Execution begins at 12:30.

The circuit is syntactically valid. The topology may be unchanged. The assumptions that justified the original mapping may no longer hold.

This creates the concept of compilation staleness.

How stale is too stale?

There is no universal time threshold.

A mapping remains usable while the hardware properties relevant to that mapping remain within some acceptable region. A major change in readout error may barely matter for one circuit and invalidate another. Drift in an entangling gate used fifty times can matter much more than drift on an unused edge.

Compilation validity should therefore depend on the subset of calibration state actually consumed by the physical circuit.

That suggests storing a dependency set with the compiled artifact: physical qubits, couplers, gate calibrations, measurement channels, perhaps pulse-level assumptions.

If one of those dependencies changes substantially, the runtime has evidence that recompilation may be justified.

Timestamp comparison is crude.

Dependency-aware invalidation is better.

## Optimization level is an experimental variable

People routinely report the backend and number of shots while omitting the compiler configuration.

That is not enough.

Qiskit optimization level, routing seed, initial layout, basis translation, scheduling method, dynamical-decoupling pass, and synthesis choices can all change the executed circuit.

Different random routing seeds alone can produce circuits with noticeably different physical behavior.

If the experiment depends on one lucky mapping, that needs to be visible.

A reproducible quantum experiment should preserve the transpilation artifact or enough information to reconstruct it.

Source circuit alone is insufficient.

So is the statement:

"executed on backend X."

The physical circuit is part of the experimental record.

## Compilation can interfere with error mitigation

Zero-noise extrapolation gives a clean example.

One common method intentionally increases effective noise by folding gates while preserving the ideal unitary. The mitigation procedure assumes that these modified circuits represent controlled perturbations of the same computation.

Now insert an optimizing compiler after folding.

It may recognize identities introduced by the folding transformation and remove them.

The mitigation procedure asked for a noisier equivalent circuit.

The compiler helpfully optimized it back toward the original.

Both components did exactly what they were designed to do.

The experiment is now wrong.

Pass ordering becomes semantically significant.

The same issue appears with randomized compiling, dynamical decoupling, symmetry-preserving transformations, and calibration circuits.

Compiler correctness cannot be evaluated only pass by pass. Some transformations exist specifically to modify physical behavior while keeping logical behavior fixed.

A later optimization pass that sees only logical redundancy can erase their purpose.

## The compiler output needs provenance

For serious experiments, I would treat the transpilation record almost like a build artifact.

Keep the logical circuit.

Keep the final physical circuit.

Record the compiler version and backend target.

Preserve the initial and final layouts. The routing seed matters. So does the native gate basis. If scheduling or dynamical decoupling was applied, preserve that configuration too.

Then associate the artifact with the calibration state used to make hardware-aware decisions.

This still does not prove that the hardware executed the circuit correctly.

It gives you something much more basic: the ability to determine what program you actually asked the machine to execute.

Without that, two runs of the "same algorithm" may differ before the first microwave pulse is emitted.

## Compiler correctness needs two specifications

Traditional compiler correctness asks whether source and target programs preserve semantics.

Quantum hardware forces a second specification.

The first remains logical:

Does the transformed circuit implement the intended quantum operation?

The second is physical:

Does the transformation preserve the assumptions under which the algorithm's output remains usable on this machine?

Those specifications are not identical.

A circuit can satisfy the first and fail the second.

That is why transpilation belongs inside the experimental model, not outside it as preprocessing. The source circuit describes the algorithm. The transpiled circuit describes the computation the hardware was actually asked to approximate.

## Similar posts on daily.dev

- [How Quantum Connectivity Shapes What Your Quantum Computer Can Actually Compute](https://daily.dev/posts/how-quantum-connectivity-shapes-what-your-quantum-computer-can-actually-compute-nyb1ljube) · freeCodeCamp · 1 upvotes · 0 comments
- [Universal logical operations in a silicon quantum processor](https://daily.dev/posts/universal-logical-operations-in-a-silicon-quantum-processor-ex0bntd2c) · Nature · 0 upvotes · 0 comments
- [Microsoft Quantum, QOLAB Propose Higher Bar For ‘Scalable’ Logical Qubits](https://daily.dev/posts/microsoft-quantum-qolab-propose-higher-bar-for-scalable-logical-qubits-6wkh6bznj) · The Quantum Insider · 0 upvotes · 0 comments
- [Spooky action nearby: Entangling logical qubits without physical operations](https://daily.dev/posts/spooky-action-nearby-entangling-logical-qubits-without-physical-operations-wg6cde0rj) · Quantum Frontiers · 0 upvotes · 0 comments

---

Tags: [#quantum-computing](https://daily.dev/tags/quantum-computing), [#compiler-optimization](https://daily.dev/tags/compiler-optimization), [#qiskit](https://daily.dev/tags/qiskit)

[View this post on daily.dev](https://daily.dev/posts/logical-equivalence-is-not-physical-equivalence-in-quantum-compilation-vkuvb461l)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/logical-equivalence-is-not-physical-equivalence-in-quantum-compilation-vkuvb461l","headline":"Logical Equivalence Is Not Physical Equivalence in Quantum Compilation","text":"Quantum circuit transpilers preserve unitary equivalence, but that guarantee says nothing about physical behavior on real hardware. Routing decisions, native gate decomposition, scheduling, calibration drift, and parameter binding in variational algorithms can each silently change error rates, symmetry violation, and mitigation effectiveness even when the logical circuit is unchanged. The piece argues compiler correctness for quantum hardware needs two specifications: logical equivalence and physical validity, and that transpilation artifacts (layouts, seeds, calibration dependencies) should be treated as part of the experimental record rather than discarded preprocessing.","url":"https://daily.dev/posts/logical-equivalence-is-not-physical-equivalence-in-quantum-compilation-vkuvb461l","datePublished":"2026-09-23T15:16:42.071Z","dateModified":"2026-09-23T15:17:06.541Z","author":{"@type":"Person","name":"Mayckon Giovani","url":"https://daily.dev/doomhammerhell","image":"https://lh3.googleusercontent.com/a-/AOh14Gh9UsECZGVeOy-JKYr9axoxnpl3dtzC3xr1evYb=s100","description":"I'm a Principal Systems Engineer specializing in post-quantum cryptography, distributed systems, and","worksFor":{"@type":"Organization","name":"Stigning","logo":"https://media.daily.dev/image/upload/s--TWeT7PxM--/f_auto,q_auto/v1782805762/logos/stigning?_a=BAMAMicg0"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":80}},"image":"https://media.daily.dev/image/upload/s--RvxGws7H--/f_auto/v1790176603/posts/Vkuvb461L?_a=BAMAMicg0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/sources/esfmr9ikfccm0xofxzkg7","name":"Mayckon Giovani"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Mayckon Giovani","item":"https://daily.dev/sources/esfmr9ikfccm0xofxzkg7"},{"@type":"ListItem","position":3,"name":"Logical Equivalence Is Not Physical Equivalence in Quantum Compilation"}]}
```

