Decoherence Lab โ Kraus Channels, T1/T2 Bookkeeping, Pointer States & Finite-Environment Recoherence โ by Darion Kellar
Educational decoherence lab in ONE pure-Python file, computed two honest ways. As channels: amplitude damping and pure dephasing as explicit Kraus operators on a hand-built 2x2 density matrix โ completeness sum K^dagger K = I verified to 0.00e+00 / 1.11e-16 before use โ with the square-root law computed from the matrices (at the labelled T1 = 50 us, damping takes the excited population by x0.367879 but the coherence only by x0.606531) and dephasing shown killing coherence by exactly e^-1 at T_phi = 80 us while leaving every population untouched. The textbook bookkeeping 1/T2 = 1/(2*T1) + 1/T_phi predicts T2 = 44.444444 us, and a least-squares fit of the composed channel's own decay curve recovers 44.444444 us (relative error 0.0). A five-state pointer survival table shows the Z basis states as exact fixed points while superpositions pay the full e^-1. As a mechanism: one qubit coupled to a finite environment of three labelled spins (g = 1.0, 1.7, 2.9), evolved as an exact 16-amplitude statevector โ the reduced coherence equals the environment branch overlap to <1e-12, collapses to 1.141e-06 at t = 9.24, and partially recoheres to 0.917439 at t = 25.90, while an exponential fitted to the initial collapse predicts 4.33e-19 there (max residual 0.917439, against 4.44e-16 for the true Kraus channel). A from-scratch kNN regime classifier labels (T1, T_phi, t) points coherent / dephasing-dominated / relaxation-dominated / pointer-stable from the lab's own policy.
Pure Python standard library. Zero dependencies. Zero network. Honest scope: every lifetime is a LABELLED teaching number โ no qubit sat in a fridge, no device was measured, and nothing here is a specification, a benchmark, or a record. The recoherence is a finite-size artefact of a 3-spin universe, printed at full size and fenced: a macroscopic bath does not come back, and selling the toy comeback as a way to beat decoherence is a permanent HOLD gate (14 total).
โ ๐งฐ Tech Stack Badges & Full Architecture Tech Stack
๐ Python 3.12, pure standard library (cmath, math, hashlib, json, sys) โ zero dependencies, zero network, deterministic (double-run byte-identical)
๐ Channel core: 2ร2 complex density matrices and Kraus operators built by hand โ amplitude damping K0 = diag(1, โ(1โฮณ)), K1 = โ(ฮณ)ยท|0โฉโจ1|, phase-flip dephasing โ completeness ฮฃ Kโ K = I asserted to machine precision before any channel output is trusted
๐ Lifetime bookkeeping: the composed channel's coherence curve is fitted by least squares in log space, and the fitted T2 is graded against 1/T2 = 1/(2ยทT1) + 1/T_phi โ agreement is a check, not an assumption
๐ฌ Mechanism core: an exact 16-amplitude statevector for qubit + 3 environment spins under controlled-phase couplings, a partial trace done by index sums, and the branch-overlap product โ (1 + e^{โiยทg_kยทt})/2 asserted equal to the traced ฯ_01 at every sampled time
๐ง TinyML kNN regime classifier (from scratch, stdlib): coherent / dephasing-dominated / relaxation-dominated / pointer-stable from (T1, T_phi, elapsed time), labels from the lab's own regime policy
๐ช Council seats: Gemini Argon 4 DECIDER (names-only, tighten-only) + Muse advisor (never overrides HOLD) + Google Flow plan-only (rendered = False, live = 0)
๐ซ Not applicable โ honestly. No blockchain, no Web3, no tokens: the "infrastructure" in this lab is a density matrix, two Kraus channels, and a 3-spin toy universe inside one offline file. No fake badges here.
โ โ๏ธ Platform Support & Hardware Architecture
๐ฅ๏ธ Pure Python โ runs anywhere Python 3.12+ runs (Linux, macOS, Windows), plus the python:3.12-slim Docker image
๐ No hardware is controlled, ever: real qubits, cryostats, and control electronics are permanent HOLD gates (see the gate table below)
๐ซ No low-level code โ honestly. No C, no C++, no GPU, no compiled extensions: this is one interpreted Python file on purpose, so every matrix entry can be read, checked, and diffed. Performance here means honest algorithms โ closed-form channel parameters, an exact partial trace, and a 4,001-point scan of the environment curve โ all deterministic and byte-identical between runs.
๐ซ None โ honestly. No cloud provider is used or needed: the lab runs fully offline on your own machine or in a local Docker container. Docker Hub appears only as the registry the publish workflow pushes the image to.
Kraus channels, completeness first โ amplitude damping and phase-flip dephasing as explicit 2x2 operator pairs; sum K^dagger K = I verified (errors 0.00e+00 and 1.11e-16), and trace, hermiticity, and positivity of every output state asserted in CHECKS.
The square-root law, computed โ damping at t = T1: population x0.367879 (= e^-1), coherence x0.606531 (= e^-1/2). The ground state is an exact fixed point; gamma = 1 lands exactly on |0>.
Dephasing, the silent killer โ coherence x0.367879 at t = T_phi with populations bit-for-bit unchanged, verified on a 0.7/0.3 mixture out to t = 400 us.
T2 fitted, not quoted โ predicted 44.444444 us from 1/(2*T1) + 1/T_phi at labelled T1 = 50, T_phi = 80; the composed channel's log-fit returns 44.444444 us, relative error 0.0; coherence at T2 is 0.183940 = 0.5/e.
Pointer survival table โ at t = T_phi: |0> and |1> untouched, |+> and |+i> coherence 0.500000 -> 0.183940, mixture coherence 0.200000 -> 0.073576 with populations pinned.
The mechanism โ qubit + 3 environment spins, exact 16-amplitude statevector, partial trace by index sums; reduced rho_01 equals 0.5 * prod (1 + e^(-i g_k t))/2 to <1e-12, populations pinned at 0.5/0.5 (pure dephasing with a visible cause).
Collapse + recoherence, sized โ factor falls to 1.141e-06 at t = 9.24 (purity at its 0.5 floor) and returns to 0.917439 at t = 25.90 โ printed with its finite-size fence, and recoherence-as-recovery is a HOLD gate.
Where the exponential ends โ Kraus channel vs its own exponential: max deviation 4.44e-16. Environment: initial-collapse fit (T = 0.612532) predicts 4.33e-19 at the recoherence peak vs the actual 0.917439; max residual 0.917439, RMS 0.344814.
TinyML kNN classifier โ coherent / dephasing-dominated / relaxation-dominated / pointer-stable from (T1, T_phi, t); labels generated by the lab's own regime policy, audited on every scenario and all 150 grid points.
Advisory seats โ Gemini Argon 4 DECIDER (names-only, tighten-only, sha256 trace), Muse advisor (can never override HOLD), Google Flow plan-only (rendered = False, live = 0).