Published March 5, 2026 | Version v4
Other Open

Quantum Error Mitigation Simulator (QEMS)

Authors/Creators

Description

# Fractal Correction Engine: Interference-Aware Quantum Error Mitigation via Multi-Surface Decoherence Tracking

## Abstract

I present the Fractal Correction Engine (FCE), a quantum error mitigation strategy that tracks the geometry of decoherence across seven observable surfaces of a density matrix and uses the resulting curvature, phase, and interference data to construct targeted corrections in real time. Unlike conventional Quantum Error Correction (QEC), which discretises errors into syndrome measurements and applies fixed recovery operations, the FCE continuously monitors how off-diagonal coherence, fidelity contributions, Bloch vectors, eigenvalue spectra, entanglement entropy, and partial-transpose negativity evolve under noise. It then maps these curvatures into fractal coordinates scaled by $\pi$, predicts future decoherence events via exponential fitting and linear extrapolation, and builds a correction unitary whose strength is modulated by the constructive-versus-destructive interference structure of the density matrix itself. A soft projection onto the code space, whose aggressiveness is controlled by coherence leakage and interference-map feedback, provides the dominant error mitigation mechanism.

I benchmark the FCE against the 3-qubit phase-flip code, the $[\![5,1,3]\!]$ perfect code, and the $[\![7,1,3]\!]$ Steane code under independent phase damping, as well as 3- and 4-qubit decoherence-free subspace (DFS) encodings under collective dephasing. At a per-step dephasing rate of $\gamma = 0.05$ over 200 time steps, the FCE achieves a final fidelity of $F = 0.6276$, compared with $F = 0.5541$ for the best QEC configuration (3-qubit phase-flip code, correction interval 5) — a $13.3\%$ improvement. A hybrid FCE + QEC strategy achieves $F = 0.6195$. All simulations use full density-matrix evolution with realistic gate-error modelling ($p_\text{gate} = 0.01$) and are fully reproducible from the accompanying source code.

---

## 1. Introduction

Quantum information encoded in physical qubits is inevitably degraded by decoherence — the loss of quantum coherence through interaction with the environment. Two major paradigms have been developed to combat this:

**Quantum Error Correction (QEC)** encodes a logical qubit redundantly across multiple physical qubits, measures stabiliser operators to detect errors, and applies recovery operations. The 3-qubit phase-flip code corrects single $Z$ errors via stabilisers $X_1 X_2 I_3$ and $I_1 X_2 X_3$. The $[\![5,1,3]\!]$ perfect code and $[\![7,1,3]\!]$ Steane code extend this to correct arbitrary single-qubit errors. QEC is powerful but requires frequent syndrome extraction — itself a noisy operation — and treats errors as discrete events rather than continuous processes.

**Decoherence-Free Subspaces (DFS)** exploit symmetries of the noise. Under collective dephasing, where all qubits experience the same phase noise, the singlet state $(|01\rangle - |10\rangle)/\sqrt{2}$ spans a subspace with zero net magnetisation difference ($\Delta m = 0$) and is therefore perfectly protected. DFS provides passive protection but is limited to specific noise symmetries.

The **Fractal Correction Engine (FCE)** occupies a different position: it is an *error mitigation* strategy that continuously monitors the full geometry of the decohering density matrix and constructs corrections informed by that geometry. Rather than discretising errors into syndromes, the FCE tracks how coherence magnitudes, phases, fidelity contributions, Bloch vectors, eigenvalues, entanglement, and negativity evolve as smooth curved surfaces, computes their curvatures and interference patterns, and uses this information to decide *when*, *how much*, and *in what direction* to correct.

---

## 2. Noise Model: Phase Damping

The primary noise model is **independent per-qubit phase damping** (pure dephasing), the dominant decoherence mechanism in many superconducting and trapped-ion platforms.

### 2.1 Single-Qubit Phase Damping Channel

The single-qubit phase damping channel $\mathcal{E}_\gamma$ is defined by two Kraus operators:

$$E_0 = \begin{pmatrix} 1 & 0 \\ 0 & \sqrt{1 - \gamma} \end{pmatrix}, \quad E_1 = \begin{pmatrix} 0 & 0 \\ 0 & \sqrt{\gamma} \end{pmatrix}$$

where $\gamma \in [0, 1]$ is the dephasing rate per time step. These satisfy the completeness relation $E_0^\dagger E_0 + E_1^\dagger E_1 = I$. The channel acts as:

$$\mathcal{E}_\gamma(\rho) = E_0 \rho E_0^\dagger + E_1 \rho E_1^\dagger$$

For a single qubit, this transforms:

$$\rho = \begin{pmatrix} \rho_{00} & \rho_{01} \\ \rho_{10} & \rho_{11} \end{pmatrix} \;\longrightarrow\; \begin{pmatrix} \rho_{00} & \sqrt{1-\gamma}\;\rho_{01} \\ \sqrt{1-\gamma}\;\rho_{10} & \rho_{11} \end{pmatrix}$$

Phase damping preserves populations (diagonal elements) while exponentially suppressing coherences (off-diagonal elements). After $t$ applications, $|\rho_{01}(t)| = (1-\gamma)^{t/2}\,|\rho_{01}(0)|$.

### 2.2 Multi-Qubit Independent Phase Damping

For $n$ qubits experiencing independent phase damping, the channel is the tensor product $\mathcal{E}_\gamma^{\otimes n}$, implemented by iterating over all $2^n$ combinations of Kraus operators:

$$\mathcal{E}^{\otimes n}(\rho) = \sum_{i_1, \ldots, i_n \in \{0,1\}} \left(E_{i_1} \otimes \cdots \otimes E_{i_n}\right) \rho \left(E_{i_1} \otimes \cdots \otimes E_{i_n}\right)^\dagger$$

For a density matrix element $\rho_{ij}$ in the computational basis, the Hamming distance $d_H(i, j) = |i \oplus j|$ (number of bit positions where $i$ and $j$ differ) determines the decay rate:

$$\rho_{ij}(t) = (1 - \gamma)^{d_H(i,j) \cdot t / 2}\;\rho_{ij}(0)$$

Elements at higher Hamming distance decay exponentially faster. This hierarchy is central to the FCE's design.

### 2.3 Collective Phase Damping

Under collective dephasing — where all qubits couple identically to a shared bath — the decay depends on the magnetisation difference:

$$\rho_{ij} \;\longrightarrow\; (1 - \gamma)^{(\Delta m)^2 / 4}\;\rho_{ij}$$

where $\Delta m = m_i - m_j$ and $m_i = 2\,\text{popcount}(i) - n$ is the magnetisation quantum number. States within the $\Delta m = 0$ subspace (e.g. the singlet) are perfectly protected — the basis of DFS.

### 2.4 Additional Noise Models

The simulator also implements:

- **Amplitude damping** ($T_1$ relaxation): $E_0 = \text{diag}(1, \sqrt{1-\gamma})$, $E_1 = \sqrt{\gamma}\,|0\rangle\langle 1|$
- **Depolarising channel**: $\rho \to (1-p)\rho + \frac{p}{4^n - 1}\sum_{P \neq I} P\rho P^\dagger$, equivalent to $(1-q)\rho + q\,I/d$ with $q = p \cdot 4^n/(4^n - 1)$
- **Combined damping**: amplitude damping followed by phase damping

---

## 3. Quantum Error Correction Implementations

### 3.1 Syndrome-Based Correction Framework

All QEC codes use a unified syndrome-based decoder. Given stabiliser generators $\{S_1, \ldots, S_m\}$ and a set of correctable errors $\{E_j\}$, the syndrome of error $E_j$ is the tuple:

$$\text{syn}(E_j) = \left(\text{sign}([S_1, E_j]), \ldots, \text{sign}([S_m, E_j])\right)$$

where $\text{sign}([S, E]) = +1$ if $SE = ES$ (commute) and $-1$ if $SE = -ES$ (anti-commute). The decoder maps each syndrome to a recovery operator. Correction proceeds by projecting into the syndrome subspace and applying the corresponding recovery:

$$\rho_\text{corrected} = \sum_s R_s \Pi_s \rho \Pi_s^\dagger R_s^\dagger, \quad \Pi_s = \prod_k \frac{I + s_k S_k}{2}$$

Post-correction, a depolarising gate error at rate $p_\text{gate}$ is applied.

### 3.2 Three-Qubit Phase-Flip Code

The logical basis states are:

$$|0_L\rangle = |{+}{+}{+}\rangle = H^{\otimes 3}|000\rangle, \quad |1_L\rangle = |{-}{-}{-}\rangle = H^{\otimes 3}|111\rangle$$

Stabiliser generators: $S_1 = X_1 X_2 I_3$, $S_2 = I_1 X_2 X_3$. These detect single $Z$ errors (phase flips), which is exactly the error type produced by phase damping.

### 3.3 Five-Qubit Perfect Code

The $[\![5,1,3]\!]$ code uses stabilisers:

$$S_1 = XZZXI,\; S_2 = IXZZX,\; S_3 = XIXZZ,\; S_4 = ZXIXZ$$

It is the smallest code that corrects arbitrary single-qubit errors ($X$, $Y$, and $Z$). The logical $|0_L\rangle$ is computed as the joint $+1$ eigenstate of all four stabilisers.

### 3.4 Seven-Qubit Steane Code

The $[\![7,1,3]\!]$ Steane code is a CSS code with stabilisers:

$$S_{Z_1} = ZIZIZIZ,\; S_{Z_2} = IZZIIZZ,\; S_{Z_3} = IIIZZZZ$$
$$S_{X_1} = XIXIXIX,\; S_{X_2} = IXXIIXX,\; S_{X_3} = IIIXXXX$$

The $Z$-type stabilisers detect $X$ errors; the $X$-type stabilisers detect $Z$ errors. The decoder corrects all single-qubit $X$, $Y$, and $Z$ errors.

---

## 4. Decoherence-Free Subspace Encodings

### 4.1 Three-Qubit DFS

The singlet state on qubits 1-2, tensored with an ancilla on qubit 3:

$$|\psi_\text{DFS}\rangle = \frac{|01\rangle - |10\rangle}{\sqrt{2}} \otimes |0\rangle$$

Under collective dephasing, the singlet subspace ($\Delta m = 0$) is invariant — yielding $F = 1.0$ at all times. Under independent dephasing, protection breaks because individual qubits experience different noise realisations, and fidelity decays to $F \approx 0.50$.

### 4.2 Four-Qubit DFS

Two singlet pairs:

$$|\psi_\text{DFS}\rangle = \frac{|01\rangle - |10\rangle}{\sqrt{2}} \otimes \frac{|01\rangle - |10\rangle}{\sqrt{2}}$$

This spans a two-dimensional DFS and achieves $F = 1.0$ under collective dephasing.

---

## 5. The Fractal Correction Engine (FCE)

The FCE is the central contribution of this work. It operates on the density matrix $\rho$ of an $n$-qubit system (demonstrated with $n = 3$, $\dim = 8$) and produces a corrected state $\rho' = \mathcal{C}(\rho)$ at each correction step. The engine has three major components: **multi-surface tracking**, **prediction**, and **correction**.

### 5.1 Multi-Surface Tracking: Seven Observable Surfaces

The FCE monitors seven distinct "surfaces" — time-varying quantities extracted from $\rho$ at each correction step. The key organisational principle is **Hamming class decomposition**: density matrix elements $\rho_{ij}$ are grouped by the Hamming distance $d = d_H(i, j) = |i \oplus j|$ between their row and column indices.

For $n = 3$ qubits ($d = 8$ dimensional Hilbert space), there are four Hamming classes:

| Class $d$ | Pairs $|\\{(i,j): d_H(i,j) = d\\}|$ | Physical meaning |
|:---------:|:------------------------------------:|:----------------:|
| 0 | 8 | Diagonal (populations) |
| 1 | 24 | Single-qubit coherences |
| 2 | 24 | Two-qubit coherences |
| 3 | 8 | Three-qubit coherences |

Under independent phase damping, class-$d$ elements decay as $(1-\gamma)^{dt/2}$, so higher classes decay exponentially faster.

#### Surface 1: Coherence Magnitudes

For each Hamming class $d$:

$$C_d(t) = \frac{1}{|\mathcal{H}_d|}\sum_{(i,j) \in \mathcal{H}_d} |\rho_{ij}(t)|$$

where $\mathcal{H}_d = \{(i,j): d_H(i,j) = d\}$. This tracks the average magnitude of coherences at each distance scale. Under phase damping, $C_d(t) \approx C_d(0)\,(1-\gamma)^{dt/2}$.

#### Surface 2: Coherence Phases

The circular mean phase per class:

$$\Phi_d(t) = \arg\left(\frac{1}{|\mathcal{S}_d|}\sum_{j \in \mathcal{S}_d} e^{i\,\text{arg}(\rho_j)}\right)$$

where $\mathcal{S}_d$ is the set of elements in class $d$ with $|\rho_{ij}| > 10^{-12}$. Phase damping does not rotate phases (it only suppresses magnitudes), so under pure dephasing $\Phi_d(t) \approx \Phi_d(0)$. Under noise models that do rotate phases (e.g. Hamiltonian drift), these surface dynamics become nontrivial.

#### Surface 3: Fidelity Contributions (Constructive / Destructive Interference)

This is the most important surface for the FCE. The fidelity with respect to the code space is:

$$F = \text{Tr}(W\rho) = \sum_{i,j} W_{ij}\,\rho_{ji}$$

where $W$ is the code-space weight matrix. If the code space is spanned by orthonormal basis vectors $\{|\psi_k\rangle\}$, then $W = \sum_k |\psi_k\rangle\langle\psi_k|$ (the code projector). The fidelity decomposes by Hamming class:

$$F = \sum_{d=0}^{n} F_d, \quad F_d = \sum_{(i,j) \in \mathcal{H}_d} W_{ij}\,\rho_{ji}$$

Each $F_d$ is a real-valued, signed quantity:
- $F_d > 0$: Class $d$ contributes **constructively** to fidelity
- $F_d < 0$: Class $d$ contributes **destructively** to fidelity
- $F_d \approx 0$: Class $d$ has decohered and contributes nothing

For the 3-qubit phase-flip code $|{+}{+}{+}\rangle$ under phase damping, the weight matrix has the structure $W_{ij} = \frac{1}{4}[1 + (-1)^{|i| + |j|}]$ where $|i| = \text{popcount}(i)$, so $W_{ij} = 1/4$ when $|i| + |j|$ is even and $W_{ij} = 0$ when $|i| + |j|$ is odd. This means only even Hamming classes ($d = 0, 2$) contribute to fidelity, while odd classes ($d = 1, 3$) have $W_{ij} = 0$ for all pairs and contribute nothing regardless of the state. The initial contributions are $F_0 = 0.25$ (diagonal) and $F_2 = 0.75$ (two-qubit coherences), summing to $F = 1.0$.

#### Surface 4: Per-Qubit Bloch Vectors

For each qubit $k$, the reduced density matrix is obtained by partial trace:

$$\rho_k = \text{Tr}_{\bar{k}}(\rho)$$

The Bloch vector components are:

$$r_x^{(k)} = \text{Tr}(\rho_k \sigma_x), \quad r_y^{(k)} = \text{Tr}(\rho_k \sigma_y), \quad r_z^{(k)} = \text{Tr}(\rho_k \sigma_z)$$

The Bloch vector norm $\|\vec{r}^{(k)}\|$ measures the purity of qubit $k$. Under dephasing, $r_x$ and $r_y$ decay while $r_z$ is preserved. The FCE identifies the qubit with the shortest Bloch vector as the "worst qubit" needing the most correction.

#### Surface 5: Eigenvalue Spectrum

$$\{\lambda_0 \geq \lambda_1 \geq \cdots \geq \lambda_{d-1}\} = \text{eig}(\rho)$$

The eigenvalue trajectory tracks how the state's support evolves. A pure state has $\lambda_0 = 1$ with all others zero. Decoherence spreads weight across eigenvalues. The FCE computes curvatures of the top eigenvalue trajectories.

#### Surface 6: Subsystem Entanglement Entropy

For each qubit $k$:

$$S_k = -\text{Tr}(\rho_k \log_2 \rho_k)$$

This measures the entanglement of qubit $k$ with the rest of the system. Under dephasing, entanglement initially increases (the environment becomes entangled with the system) then decreases as the state approaches the maximally mixed state.

#### Surface 7: Partial-Transpose Negativity

The negativity with respect to the first qubit is:

$$\mathcal{N} = \sum_{\lambda_i < 0} |\lambda_i|, \quad \text{where } \lambda_i \in \text{eig}(\rho^{T_A})$$

The partial transpose is computed by reshaping $\rho$ into a $(2 \times d_\text{rest} \times 2 \times d_\text{rest})$ tensor and transposing the first-qubit indices:

$$\rho^{T_A}_{(a,e),(b,f)} = \rho_{(b,e),(a,f)}$$

Negativity is an entanglement monotone: $\mathcal{N} = 0$ for separable states and $\mathcal{N} = 0.5$ for a maximally entangled Bell pair. The FCE uses the ratio of current to initial negativity to modulate projection strength — as the state becomes more classical (lower negativity), more aggressive projection is warranted.

### 5.2 Curvature Computation

For each scalar surface (magnitudes, contributions, eigenvalues, negativity), the three-point finite-difference curvature is:

$$\kappa(t) = |h(t) - 2h(t-1) + h(t-2)|$$

For angular surfaces (phases), the curvature uses wrapped differences to handle the $[-\pi, \pi]$ periodicity:

$$\kappa_\phi(t) = |(\Delta\phi_1 - \Delta\phi_2)|, \quad \Delta\phi_k = [(\phi_{t-k+1} - \phi_{t-k}) + \pi \bmod 2\pi] - \pi$$

Curvatures are computed for all seven surfaces across all Hamming classes, yielding a curvature vector $\vec{\kappa}(t) \in \mathbb{R}^{N_\kappa}$ where $N_\kappa$ depends on $n$.

### 5.3 Fractal Coordinates

The curvature vector is mapped into a set of $\pi$-scaled fractal coordinates:

$$x_{s,d} = \cos\!\left(\pi \cdot \frac{t+1}{d+1} + \kappa_s \cdot \pi\right) \cdot e^{-d/D} \cdot e^{-s/(S+1)}$$

where $s$ indexes the surface, $d \in \{0, \ldots, D-1\}$ is the fractal depth ($D = 8$), $\kappa_s$ is the curvature for surface $s$, and $t$ is the time step. The exponential weights emphasise shallow fractal levels and early surfaces. These coordinates provide a nonlinear, multi-scale encoding of the decoherence geometry that modulates correction strength.

### 5.4 Forward Prediction

The FCE extrapolates future decoherence to decide how urgently to correct.

**Coherence magnitude prediction** fits an exponential decay to each Hamming class:

$$\hat{C}_d(t + \Delta t) = C_d(t) \cdot e^{-d \cdot r_d \cdot \Delta t}$$

where $r_d$ is obtained by linear regression on $\log C_d(t)$ over the history window.

**Fidelity contribution prediction** uses linear extrapolation:

$$\hat{F}_d(t + \Delta t) = F_d(t) + \frac{dF_d}{dt}\bigg|_t \cdot \Delta t$$

where $dF_d/dt \approx F_d(t) - F_d(t-1)$. Sign-flip detection identifies the time $\Delta t^*$ at which a class is predicted to flip from constructive to destructive — a critical decoherence event.

The aggregate predicted fidelity is:

$$\hat{F}(t + \Delta t) = F_0(t) + \sum_{d=1}^{n} \hat{F}_d(t + \Delta t)$$

where $F_0(t)$ is the (stable) diagonal contribution.

### 5.5 Retrodiction and Confidence

The FCE validates its predictive model by **retrodicting** — extrapolating backward from the current state and comparing with recorded history:

$$\hat{C}_d(t - \Delta t) = C_d(t) \cdot e^{+d \cdot r_d \cdot \Delta t}$$

The confidence is $\mathcal{R} = e^{-\langle\epsilon\rangle}$ where $\langle\epsilon\rangle$ is the mean relative error of retrodicted values against actual history. High confidence ($\mathcal{R} \approx 1$) means the exponential model accurately describes the decay, and the FCE trusts its forward predictions.

### 5.6 Interference Map

At each correction step, the FCE builds an **interference map** $\mathcal{I}_d$ for each Hamming class $d \in \{1, \ldots, n\}$:

$$\mathcal{I}_d = \left\{\text{type} \in \{\text{constructive}, \text{destructive}\},\; \text{strength} = |F_d|,\; \text{phase velocity} = \dot{\Phi}_d,\; \text{approaching\_flip}\right\}$$

The approaching-flip flag is set when contributions are decaying toward zero faster than their recent trend or have already crossed zero. This map directly controls the interference-aware projection strength (Section 5.9).

---

## 6. FCE Correction Pipeline

At each correction step, the FCE applies a six-stage pipeline.

### 6.1 Stage 1: Surface Extraction

All seven surfaces are extracted from the current $\rho$ and appended to bounded history buffers.

### 6.2 Stage 2: Unitary Correction — Phase-Aware Rz Angles

The analytically optimal per-qubit $R_z$ rotation angle is:

$$\theta_k^* = -\arg(A_k), \quad A_k = \sum_{(i,j) \in \mathcal{M}_k} W_{ij}\,\rho_{ji}$$

where $\mathcal{M}_k = \{(i,j): \text{bit}_k(i) = 0,\; \text{bit}_k(j) = 1\}$ is the set of matrix elements where qubit $k$ transitions from $|0\rangle$ to $|1\rangle$. This angle maximises $\text{Re}(e^{-i\theta_k/2} A_k)$, i.e. it rotates the complex sum $A_k$ onto the positive real axis to maximise fidelity.

Under pure phase damping, the density matrix remains real ($\arg(A_k) = 0$), so $\theta_k^* = 0$. The unitary correction is therefore the identity under the noise model studied here. The FCE's power comes primarily from the soft projection (Stage 4).

The proposed angles are modulated by fractal coordinates, urgency, and confidence:

$$\theta_k = \theta_k^* \cdot \min\!\big((0.5 + 0.5\,x_{k}) \cdot u \cdot \mathcal{R},\; 1.5\big)$$

where $x_k$ is the fractal coordinate, $u$ is the correction urgency, and $\mathcal{R}$ is the retrodiction confidence.

### 6.3 Stage 2b: Bloch-Targeted Ry Correction

The qubit with the shortest Bloch vector receives a small $R_y$ rotation to partially restore its coherence:

$$\phi_\text{worst} = \min\!\left((1 - r_\text{ratio}) \cdot 0.05 \cdot u,\; 0.15\right) \cdot \pi$$

where $r_\text{ratio} = \|\vec{r}_\text{worst}\| / \|\vec{r}_\text{best}\|$.

### 6.4 Stage 3: Interference-Aware Scale Refinement

Before applying the correction, the FCE evaluates its impact on fidelity contributions via the interference map. It tests scale factors $s \in \{0.25, 0.5, 0.75, 1.0, 1.25, 1.5\}$ and selects the one that maximises:

$$\text{net}(s) = \sum_{i,j} W_{ij}\,(U_s\,\rho\,U_s^\dagger)_{ji}$$

with a penalty for any constructive-to-destructive class flip:

$$\text{net}_\text{penalised}(s) = \text{net}(s) - 0.1 \cdot \mathbb{1}[\exists\,d: F_d^\text{before} > 0.001 \;\wedge\; F_d^\text{after}(s) < -0.001]$$

This "look before you leap" mechanism prevents the correction from accidentally destroying constructive interference — the quantum analogue of causing a bit-flip error through over-correction.

### 6.5 Stage 4: Soft Projection

The dominant error mitigation mechanism. The FCE applies a **soft projection** onto the code space:

$$\rho' = (1 - \alpha)\,\rho + \alpha\,\frac{P\,\rho\,P}{\text{Tr}(P\,\rho\,P)}$$

where $P = \sum_k |\psi_k\rangle\langle\psi_k|$ is the code projector and $\alpha \in [0, 0.5]$ is the projection strength. The result is renormalised: $\rho' \leftarrow \rho'/\text{Tr}(\rho')$.

This is *not* a projective measurement — it is a continuous, tunable bias toward the code space. At $\alpha = 0$, no projection occurs. At $\alpha = 1$, it reduces to full projection (equivalent to quantum Zeno-like stabilisation). The FCE dynamically computes $\alpha$ from several signals.

### 6.6 Stage 5: Interference-Aware Projection Strength

The projection strength $\alpha$ is computed as:

$$\alpha = \min\!\left(\alpha_\text{base} \cdot M_\text{neg} \cdot M_\text{int},\; 0.5\right)$$

**Coherence leakage base:**

$$\alpha_\text{base} = \min\!\left(1 - \frac{C_1(t)}{C_1(0)},\; 0.5\right)$$

This is proportional to the fraction of nearest-neighbour coherence that has been lost. As decoherence progresses, $\alpha_\text{base}$ increases from 0 toward 0.5.

**Negativity modulation:**

$$M_\text{neg} = 2 - \frac{\mathcal{N}(t)}{\mathcal{N}(0)}$$

As negativity drops (state becomes more separable/classical), $M_\text{neg}$ increases from 1 toward 2, strengthening projection.

**Interference map modulation** $M_\text{int}$: The FCE classifies each Hamming class as *active* ($|F_d| > 0.001$), *dead* ($|F_d| < 0.001$), or *destructive* ($F_d < 0$) and adjusts accordingly:

| Decoherence stage | $M_\text{int}$ | Rationale |
|:-:|:-:|:-:|
| All classes dead | $1.5$ | Maximum projection to rescue |
| $n_\text{destr}$ destructive classes | $1.0 + 0.3\,n_\text{destr}$ | Counter destructive interference |
| $n_\text{dead}$ dead classes | $1.0 + 0.2\,n_\text{dead}$ | Protect surviving classes |
| All active | $1.0$ | Light projection, preserve coherence |

Additionally, if the constructive strength is decaying faster than $10\%$ over two correction steps, $M_\text{int}$ receives a further boost of $(1 + \text{decay\_rate})$.

### 6.7 Stage 6: Safety Check

After the full correction pipeline (unitary + gate error + soft projection + measurement error), the FCE checks whether fidelity actually improved:

$$\Delta F = \text{Tr}(W\rho_\text{corrected}) - \text{Tr}(W\rho_\text{before})$$

If $\Delta F < -0.001$ (correction made things worse), the corrected state is blended with the uncorrected state:

$$\rho_\text{final} = \beta\,\rho_\text{corrected} + (1 - \beta)\,\rho_\text{before}$$

where $\beta = \min(F_\text{before} / (F_\text{before} - \Delta F), 0.8)$, clamped to $[0.2, 0.8]$. This guarantees that the FCE never makes fidelity significantly worse than doing nothing.

---

## 7. Wave Collision Model

The wave collision model treats fidelity contributions from adjacent Hamming classes as interacting waves and detects three types of interactions:

### 7.1 Wave State Representation

Each Hamming class $d$ is characterised by a wave state:

$$\mathcal{W}_d = (A_d,\; \phi_d,\; \omega_d,\; E_d,\; \ddot{\phi}_d)$$

where $A_d = F_d$ is the signed amplitude, $\phi_d = \Phi_d$ is the phase, $\omega_d = \dot{\Phi}_d$ is the frequency (phase velocity), $E_d = C_d$ is the envelope (coherence magnitude), and $\ddot{\phi}_d$ is the phase acceleration.

### 7.2 Collision Detection

For each adjacent pair $(d, d+1)$:

**Phase alignment:** $\cos(\phi_d - \phi_{d+1})$, where $+1$ is fully aligned.

**Velocity match:** $e^{-2|\omega_d - \omega_{d+1}|}$, where similar velocities give sustained interactions.

**Combined magnitude:** $\sqrt{E_d \cdot E_{d+1}}$ (geometric mean of envelopes).

**Collision strength:** $S = \sqrt{E_d \cdot E_{d+1}} \cdot |\cos(\phi_d - \phi_{d+1})| \cdot e^{-2|\omega_d - \omega_{d+1}|}$

The collision type is determined by the signs and phase alignment:

| Same sign? | Phase aligned? | Type |
|:-:|:-:|:-:|
| Yes | Yes ($> 0.3$) | Constructive compound |
| Yes (both destructive) | Yes ($> 0.3$) | Destructive compound |
| No | $\|$alignment$\| > 0.3$ | Cancellation |
| — | $< 0.3$ | Weak interaction |

### 7.3 Collision Prediction

The FCE predicts future collisions by checking if phases are **converging**: when $\text{phase\_diff} \cdot \text{relative\_velocity} < 0$, the phases are being driven toward alignment. The estimated time to collision is:

$$\eta = \frac{|\phi_d - \phi_{d+1}|}{|\omega_d - \omega_{d+1}|}$$

Predictions are logged for diagnostic visualisation and used in the wave collision correction modulation.

---

## 8. Fidelity Measure

Fidelity is computed using the fast pure-state formula throughout the simulation:

$$F(\rho, |\psi_\text{ref}\rangle) = \langle\psi_\text{ref}|\rho|\psi_\text{ref}\rangle$$

For general mixed-state comparison, the Uhlmann fidelity is available:

$$F(\rho, \sigma) = \left(\text{Tr}\sqrt{\sqrt{\rho}\,\sigma\,\sqrt{\rho}}\right)^2$$

computed via eigendecomposition of $\rho$ to avoid the numerical instabilities of matrix square roots.

---

## 9. Simulation Protocol

### 9.1 Configuration

| Parameter | Value |
|:-:|:-:|
| Time steps | $N = 200$ |
| Phase damping rate | $\gamma = 0.05$ per step |
| Gate error probability | $p_\text{gate} = 0.01$ |
| FCE correction interval | Every 5 steps |
| QEC correction interval | 5 or 10 steps |
| FCE fractal depth | $D = 8$ |
| FCE history window | 50 steps |
| FCE prediction horizon | 5 steps |

### 9.2 Simulation Loop

For each time step $t = 0, 1, \ldots, N-1$:

1. Apply noise: $\rho \leftarrow \mathcal{E}_\gamma(\rho)$
2. (Optional) Apply dynamical decoupling
3. (Optional) Apply QEC syndrome correction
4. (Optional) Apply FCE correction: $\rho \leftarrow \text{FCE.correct}(\rho, t)$
5. Record metrics: fidelity, entropy, purity, coherence, logical error rate

In hybrid mode (FCE + QEC), the FCE runs on every step except those where QEC syndrome correction just occurred, preventing the FCE from degrading a freshly corrected state.

---

## 10. Results

### 10.1 Core Comparison at $\gamma = 0.05$

| Strategy | Final Fidelity | vs. QEC Int-5 |
|:-:|:-:|:-:|
| DFS 3q (collective noise) | $1.0000$ | — |
| **FCE v3 (interference-aware)** | $\mathbf{0.6276}$ | $+13.3\%$ |
| **FCE + QEC Hybrid** | $\mathbf{0.6195}$ | $+11.8\%$ |
| FCE (no interference map) | $0.6033$ | $+8.9\%$ |
| QEC 3q phase-flip (interval 5) | $0.5541$ | baseline |
| DFS 3q (independent noise) | $0.5000$ | $-9.8\%$ |
| QEC 7q Steane (interval 10) | $0.4538$ | $-18.1\%$ |
| QEC 3q phase-flip (interval 10) | $0.4315$ | $-22.1\%$ |
| QEC 5q perfect (interval 10) | $0.2909$ | $-47.5\%$ |
| No protection | $0.1272$ | $-77.0\%$ |
| FCE (unitary only, no projection) | $0.1265$ | $-77.2\%$ |

**Key findings:**

1. **The FCE outperforms all QEC codes** under independent phase damping at $\gamma = 0.05$, achieving $F = 0.6276$ versus $F = 0.5541$ for the best QEC (3-qubit phase-flip code at correction interval 5).

2. **Soft projection is the dominant mechanism.** The unitary-only FCE ($F = 0.1265$) performs identically to no protection ($F = 0.1272$), confirming that under pure phase damping — where optimal $R_z$ angles are identically zero because the density matrix stays real — the entire fidelity advantage comes from the interference-aware soft projection.

3. **The interference map provides measurable benefit.** FCE with interference-aware projection ($F = 0.6276$) outperforms FCE without it ($F = 0.6033$) by $4.0\%$, demonstrating that tracking which Hamming classes are constructive, destructive, or dead, and modulating projection strength accordingly, provides a meaningful advantage.

4. **DFS achieves perfect protection under collective noise**, confirming $F = 1.0000$ for the singlet encoding. Under independent noise, DFS provides no advantage ($F = 0.5000$), validating the noise model.

5. **Larger QEC codes perform worse.** The 5-qubit perfect code ($F = 0.2909$) and 7-qubit Steane code ($F = 0.4538$) both underperform the 3-qubit phase-flip code. This is expected: the 3-qubit code is specifically designed for $Z$ errors (which is exactly what phase damping produces), while the larger codes correct $X$ and $Y$ errors that do not occur under this noise model. The overhead of additional qubits introduces more noise channels without proportional benefit.

### 10.2 Gamma Sweep

| $\gamma$ | FCE v3 | QEC Int-5 | $\Delta$ | No Protection |
|:-:|:-:|:-:|:-:|:-:|
| 0.01 | $0.8190$ | $0.8250$ | $-0.7\%$ | $0.3186$ |
| 0.06 | $0.5875$ | $0.3893$ | $+50.9\%$ | $0.1260$ |
| 0.10 | $0.3673$ | $0.2631$ | $+39.6\%$ | $0.1250$ |
| 0.15 | $0.2595$ | $0.2088$ | $+24.3\%$ | $0.1250$ |
| 0.20 | $0.2173$ | $0.1748$ | $+24.3\%$ | $0.1250$ |

At very low noise ($\gamma = 0.01$), QEC slightly outperforms the FCE because syndrome-based correction can perfectly reverse discrete errors when they are rare. As noise increases, the FCE's continuous mitigation strategy becomes increasingly advantageous — the advantage peaks at $+50.9\%$ at $\gamma = 0.06$.

### 10.3 Ablation: Interference-Aware Components

| Component | $F$ at $\gamma = 0.05$ | $\Delta$ vs. full FCE |
|:-:|:-:|:-:|
| Full FCE (all components) | $0.6276$ | baseline |
| No interference map | $0.6033$ | $-3.9\%$ |
| No soft projection (unitary only) | $0.1265$ | $-79.8\%$ |

The soft projection provides $\sim 80\%$ of the FCE's advantage. The interference map modulation provides an additional $\sim 4\%$. The unitary corrections ($R_z$, $R_y$) provide negligible benefit under pure phase damping.

### 10.4 Hybrid FCE + QEC

The hybrid strategy runs QEC syndrome correction at every 5th step and FCE correction on all other steps. At $\gamma = 0.05$, hybrid achieves $F = 0.6195$ — slightly below standalone FCE ($0.6276$) because QEC syndrome measurement introduces additional noise. This suggests that when FCE is performing well, adding QEC overhead is counterproductive. However, in noise regimes where QEC excels (very low $\gamma$), the hybrid approach may be beneficial.

---

## 11. Discussion

### 11.1 Why the FCE Works

The FCE's soft projection can be understood as a form of **continuous quantum Zeno stabilisation**. The quantum Zeno effect states that frequent measurement of a system suppresses transitions out of the measured subspace. The FCE approximates this by repeatedly nudging the state back toward the code space without performing a full projective measurement. The key innovation is that the strength $\alpha$ of this nudging is dynamically controlled by the interference map — when decoherence has damaged some Hamming classes but others survive, the FCE projects more aggressively to protect the survivors.

### 11.2 Comparison with Standard Approaches

The FCE differs from QEC in several fundamental ways:

| Aspect | QEC | FCE |
|:-:|:-:|:-:|
| Error model | Discrete (syndromes) | Continuous (surface tracking) |
| Correction | Fixed recovery operators | Adaptive, interference-aware |
| Resource cost | Extra qubits, ancillae | Classical computation on $\rho$ |
| Noise handling | Detects and corrects | Monitors and mitigates |
| Optimality | Optimal for i.i.d. errors | Optimal for continuous dephasing |
| Projection | Projective measurement | Tunable soft projection |

### 11.3 Limitations

1. **Full density matrix access.** The FCE requires access to the full $2^n \times 2^n$ density matrix, which scales exponentially. This limits current applicability to small systems ($n \lesssim 15$).

2. **Noise-model specificity.** The soft projection is most effective when the noise primarily drives the state out of the code space (as in phase damping). For noise models that also cause leakage to states orthogonal to the code space within the same Hamming class, the projection may be less effective.

3. **Gate errors on projection.** The soft projection is modelled as having a measurement error contribution of $p_\text{gate} \times 0.1$, reflecting that any physical implementation of the projection would involve some noise.

### 11.4 Physical Realisability

While the FCE as implemented requires classical density matrix simulation, several components have physically realisable analogues:

- **Soft projection** approximates continuous weak measurement with feedback, implementable via dispersive readout in superconducting qubits.
- **Coherence tracking** relates to experimentally measurable quantities like Ramsey decay and spin-echo contrast.
- **Interference mapping** corresponds to process tomography applied periodically.

---

## 12. Conclusion

The Fractal Correction Engine demonstrates that continuous, geometry-aware error mitigation can outperform conventional syndrome-based quantum error correction under phase damping. By tracking seven observable surfaces of the density matrix, decomposing fidelity into constructive and destructive contributions by Hamming class, and dynamically modulating a soft projection based on the interference structure, the FCE achieves $F = 0.6276$ versus $F = 0.5541$ for the best QEC code — a $13.3\%$ improvement. The interference-aware projection strength, which responds to the decoherence stage of each Hamming class, provides the dominant mechanism.

These results suggest that the boundary between "error correction" (discrete syndrome-based) and "error mitigation" (continuous estimation-based) is more permeable than traditionally assumed. For specific noise models — particularly continuous dephasing processes that are well-characterised — a mitigation strategy informed by the full decoherence geometry can outperform correction strategies that discretise errors into syndromes.

---

## 13. Reproducibility

All source code, simulation data, and plotting scripts are provided in the accompanying repository. The simulation is fully deterministic (no random number generation) and produces identical results across runs. Key files:

- `DFS vs QEC under Phase Damping with Tracking.py` — complete simulation code ($\sim$1950 lines)
- Output directory `enhanced_qec_dfs_simulation_<timestamp>/` — CSV data and PNG plots

### Dependencies

- Python 3.8+
- NumPy
- Matplotlib
- Pandas

### Running

```bash
python "DFS vs QEC under Phase Damping with Tracking.py"
```

Typical runtime: 2–3 minutes on a modern CPU.

---

## References

1. M. A. Nielsen and I. L. Chuang, *Quantum Computation and Quantum Information* (Cambridge University Press, 2010).
2. D. A. Lidar, I. L. Chuang, and K. B. Whaley, "Decoherence-Free Subspaces for Quantum Computation," *Phys. Rev. Lett.* **81**, 2594 (1998).
3. A. R. Calderbank and P. W. Shor, "Good quantum error-correcting codes exist," *Phys. Rev. A* **54**, 1098 (1996).
4. A. M. Steane, "Error Correcting Codes in Quantum Theory," *Phys. Rev. Lett.* **77**, 793 (1996).
5. R. Laflamme, C. Miquel, J. P. Paz, and W. H. Zurek, "Perfect Quantum Error Correcting Code," *Phys. Rev. Lett.* **77**, 198 (1996).
6. P. Zanardi and M. Rasetti, "Noiseless Quantum Codes," *Phys. Rev. Lett.* **79**, 3306 (1997).
7. P. Facchi and S. Pascazio, "Quantum Zeno Subspaces," *Phys. Rev. Lett.* **89**, 080401 (2002).

Files

dd_comparison.png

Files (3.8 MB)

Name Size Download all
md5:fa9a698e648a5b241b1f5788378cd61e
176.2 kB Download
md5:55bf100ccc75607ce0a9d6d886ea0eb0
37.6 kB Preview Download
md5:871daacf0c3b133a7b5ea0329bb7ef86
84.0 kB Download
md5:66df4d5ec7e500b37ae2e1caf4e01950
16.6 kB Preview Download
md5:02551338f248163e25c2955abc530573
15.9 kB Preview Download
md5:ca51d7b9edfed9610457eb154d498f42
16.6 kB Preview Download
md5:66df4d5ec7e500b37ae2e1caf4e01950
16.6 kB Preview Download
md5:66df4d5ec7e500b37ae2e1caf4e01950
16.6 kB Preview Download
md5:66df4d5ec7e500b37ae2e1caf4e01950
16.6 kB Preview Download
md5:66df4d5ec7e500b37ae2e1caf4e01950
16.6 kB Preview Download
md5:66df4d5ec7e500b37ae2e1caf4e01950
16.6 kB Preview Download
md5:0691cdc2bda335cb094a0a3cc3783590
16.1 kB Preview Download
md5:9cbe9d38fc3f59e4932394fad0fb9b90
16.4 kB Preview Download
md5:cb7b71479d5adb5f6b4614a3dfcd6441
15.6 kB Preview Download
md5:0d865d36a560ac7b753cf1da87ddbc56
16.1 kB Preview Download
md5:abef80efb165d78eb00f982f4b83e4ae
16.1 kB Preview Download
md5:cb7b71479d5adb5f6b4614a3dfcd6441
15.6 kB Preview Download
md5:58d0ed472e7a9ed844544cf88d90d74e
15.5 kB Preview Download
md5:b68048b14518a9ed8ab4530848d754b3
15.6 kB Preview Download
md5:0d865d36a560ac7b753cf1da87ddbc56
16.1 kB Preview Download
md5:0bb9166d0b45b036f1d7c8225696a3bd
15.5 kB Preview Download
md5:a904a5b4723b6945ec25c9bc5fd57f36
15.6 kB Preview Download
md5:98fe761fee045170890cd78c1d58015e
15.7 kB Preview Download
md5:d917eee0acee0c642eba6150d2161f0a
15.8 kB Preview Download
md5:4cf1051d79bc5579698a1ac173d7939d
15.9 kB Preview Download
md5:33e4cb24767b2823ec4cffdf0c26bc6b
141.0 kB Preview Download
md5:1964e64f41f87f1033e21af0672f5eef
55.4 kB Download
md5:6faef31494f5f7936f6d61ca92ebb506
80.5 kB Preview Download
md5:179a50a7d34d18dae58c4a56f7b85076
139.1 kB Preview Download
md5:50de2f4e1e061b838dac1d3e5f97eccd
140.9 kB Preview Download
md5:3a2b4cc1de5d7e085f8281fd4e5319d7
63.9 kB Preview Download
md5:26dfd733d2acdacfd28328ffc7ff0d65
50.9 kB Preview Download
md5:c523cf539691f2ed04e7a60b47afed37
60.9 kB Preview Download
md5:a56dae30c2e62db99cf34cf079de6822
161.3 kB Preview Download
md5:abef80efb165d78eb00f982f4b83e4ae
16.1 kB Preview Download
md5:5f1e6ab66be62c97d89d7a07973cf390
15.7 kB Preview Download
md5:959ec91bc4b645f4be9da7efb56b28db
16.1 kB Preview Download
md5:62d683913d568186cad6c046207223c9
16.3 kB Preview Download
md5:24eea67d7d9c8a1f61b60f921ffcad71
16.3 kB Preview Download
md5:b7c4e5d23485ae8d163fef97416cca55
16.4 kB Preview Download
md5:7e92d1e0c2dca617d5999ef8b996441f
15.6 kB Preview Download
md5:39ac8e36776ceb366fc72597a83c5e63
15.7 kB Preview Download
md5:5c22251662a2fe622092afec2edf4e3d
15.6 kB Preview Download
md5:6eb679a0bea193d5f91896c75bf207f7
15.7 kB Preview Download
md5:2b5d0f20725f6a9baa005f62d16bb252
15.8 kB Preview Download
md5:325522f903f1dca83cf8ff2d47cef0a2
15.9 kB Preview Download
md5:6730f7a28c45f39f98db8c27afcdaaeb
15.9 kB Preview Download
md5:1b2192375f41f0a94be1f8da703214b9
15.7 kB Preview Download
md5:1b2192375f41f0a94be1f8da703214b9
15.7 kB Preview Download
md5:bfc29897b372cfc168dd866f5cf2a2d2
15.7 kB Preview Download
md5:b68048b14518a9ed8ab4530848d754b3
15.6 kB Preview Download
md5:baa57c1f9650fbd041786c49dc95028e
15.8 kB Preview Download
md5:d0ef4ab6786739d043757d10e793308f
15.8 kB Preview Download
md5:3ee5f52e729e406b84111e86989e1875
1.5 MB Preview Download
md5:34e671a9b0cb86e70b1bde407fa33ed4
35.7 kB Preview Download
md5:5617016619268d3f9e18d4d4320a6651
8.5 kB Download
md5:bc6d2309444e45ac7317d89cb9fd41e5
17.3 kB Download
md5:02a7905068159786362047648063516b
876 Bytes Preview Download
md5:cb7b71479d5adb5f6b4614a3dfcd6441
15.6 kB Preview Download
md5:bb9b16bf5d944849a507b0f47672dec1
189.2 kB Preview Download
md5:7f48e07cea256e7ec22f7c9ab9fa068b
15.7 kB Preview Download
md5:58d0ed472e7a9ed844544cf88d90d74e
15.5 kB Preview Download
md5:3fcf8269f9da3d0586ca1429d4c5dd22
85.7 kB Preview Download
md5:37e084d5541db7b6c6f0e7f613857075
79.8 kB Preview Download