This repository begins with a familiar story and ends with a stricter scientific question.
| Question | Short answer |
|---|---|
| Is the unmeasured cat automatically in $ | +\rangle=( |
| Can measuring the atom steer the cat into $ | +\rangle$? |
| Does |
No. The equality also accepts the empty branch |
| What makes the claim trustworthy? | A closed-form derivation, randomized implementation tests, and deterministic physical counterexamples—used together. |
New to quantum computing? Start with the interactive zero-prerequisite OER, then use the longer concept guide (English + 中文速览).
The original notebook remains the PennyLane Challenge solution. The OER and this README ask the next question: does passing the challenge's amplitude-equality test guarantee a physically realizable conditional state?
Not as a local state of the cat. After the atom and cat become maximally entangled, their joint state can be
The joint atom–cat system is in a coherent entangled superposition. But if we ignore the atom and examine only the cat, we trace the atom out:
The diagonal entries give 50/50 probabilities; the off-diagonal entries—the cat's local coherence—are zero. So the cat alone sits at the center of the Bloch sphere, not on its surface at
The GIF is a teaching interpolation between two state descriptions, not the literal continuous-time trajectory of one cat during measurement.
By quantum steering: choose a measurement basis for the atom, measure it, and keep a specified outcome. Conditioned on that outcome, the cat can land in
The logic has four steps:
- prepare the atom and cat in
$|00\rangle$ ; - entangle them with a two-qubit unitary
$U$ ; - rotate the atom's measurement basis with
$U3(\theta,\phi,\lambda)$ ; - measure the atom and post-select its
$|0\rangle$ outcome.
Post-selection is conditional: it describes the retained subensemble. It neither guarantees that the selected outcome occurs nor enables faster-than-light signalling.
The original circuit is shown first; the generalized circuit is shown second.
For a fixed input
After applying
The challenge validator asks for
If this branch is non-zero, equal amplitudes mean its normalized cat state is
Yes—no optimizer is required. Define
Then the equality condition becomes
For the general case
-
$\lambda$ aligns the two complex phases. -
$\theta$ balances the two magnitudes. -
$\phi$ only changes the discarded atom-$|1\rangle$ branch, so it does not enter the equality constraint.
| Case | Condition | One valid equality solution |
|---|---|---|
| General | $ | \alpha |
| Degenerate |
$ | \alpha |
| Degenerate |
$ | \beta |
| Both zero | $ | \alpha |
Why does the closed form work?
For non-zero
$$ \cos\frac{\theta}{2}=\frac{|\beta|}{\sqrt{|\alpha|^2+|\beta|^2}}, \qquad \sin\frac{\theta}{2}=\frac{|\alpha|}{\sqrt{|\alpha|^2+|\beta|^2}}. $$
Both sides therefore have the same phase and the same magnitude
$$ \frac{|\alpha||\beta|}{\sqrt{|\alpha|^2+|\beta|^2}}. $$
The degenerate rows force the remaining sine or cosine factor to zero. This proves the amplitude-equality formula for every input column
Not necessarily. Equality is an algebraic condition; preparation is a physical claim.
First ask whether the selected branch can occur:
Only when
Then ask whether that state is the target:
So a complete success claim requires:
-
amplitude equality:
$A_{00}\approx A_{01}$ ; -
reachability:
$p_0>0$ ; -
conditional correctness:
$F\approx1$ .
If
| Case | Equality validator | Physical conclusion | ||
|---|---|---|---|---|
| Bell preparation: |
PASS; |
Reachable and correct | ||
| CNOT on $ | 00\rangle$ | PASS; |
N/A |
This is the central loophole:
For a Schmidt-rank-2 state
Because a correct formula can still be implemented incorrectly.
The figure uses 50 Haar-random
The third panel is a 3D scatter in
The randomized tests check that:
- the code extracts the correct first column of
$U$ ; - phase alignment and magnitude balancing are implemented correctly;
- the returned angles make
$A_{00}$ and$A_{01}$ equal to floating-point precision; - the implementation works across many typical complex-valued inputs.
The maximum observed amplitude-equality error is
But randomized agreement is not a proof of the formula, and it does not establish physical validity for every boundary case.
Because exact zero-probability branches form a measure-zero boundary. Haar-random sampling almost surely produces a Schmidt-rank-2 state and almost surely misses that boundary, no matter how visually convincing a 100/100 pass rate looks.
A deliberately chosen case such as CNOT acting on
For the returned degenerate equality solution, the retained atom-$|0\rangle$ branch has
The original equality assertion passes, yet the claimed conditional state is physically undefined. Identity, SWAP, and suitable phase-gate inputs reveal the same class of boundary failure.
A deterministic counterexample is therefore not competing with the random test. It asks a different question that random sampling is structurally unlikely to ask.
The fastest route is the Colab notebook. For a local run:
git clone https://github.com/sunshineluyao/schrodingers-cat.git
cd schrodingers-cat
pip install -r requirements.txt
# Run the NumPy-only solver and 100-unitary stress test
python scripts/quantum_sandbox.py
# Regenerate all static figures and GIFs
python scripts/generate_figures.py
# Explore the original challenge notebook
jupyter notebook "Revisiting_Schrodinger's_Cat.ipynb"Show the copy-paste PennyLane solution
import pennylane as qp
import pennylane.numpy as np
dev = qp.device("default.qubit", wires=["atom", "cat"])
@qp.qnode(dev)
def evolve_atom_cat(unitary, params):
qp.QubitUnitary(unitary, wires=["atom", "cat"])
qp.U3(params[0], params[1], params[2], wires="atom")
return qp.state()
def u3_parameters(unitary):
"""Closed-form U3 angles for the challenge equality condition."""
a, b, c, d = unitary @ np.array([1, 0, 0, 0], dtype=complex)
alpha = a - b
beta = c - d
abs_alpha = np.abs(alpha)
abs_beta = np.abs(beta)
phi = 0.0
if np.isclose(abs_alpha, 0) and np.isclose(abs_beta, 0):
theta, lam = 0.0, 0.0
elif np.isclose(abs_alpha, 0):
theta, lam = 0.0, 0.0
elif np.isclose(abs_beta, 0):
theta, lam = np.pi, 0.0
else:
lam = np.angle(alpha) - np.angle(beta)
theta = 2 * np.arctan(abs_alpha / abs_beta)
return np.array([theta, phi, lam])
H = np.array([[1, 1], [1, -1]]) / np.sqrt(2)
CNOT = np.array(
[[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 0, 1],
[0, 0, 1, 0]],
dtype=complex,
)
U_bell = CNOT @ np.kron(H, np.eye(2))
params = u3_parameters(U_bell)
state = evolve_atom_cat(U_bell, params)
assert np.isclose(state[0], state[1], atol=5e-2)
print("PASS: equal-amplitude challenge condition")This assertion reproduces the original challenge condition. For a physical preparation claim, also compute
├── Revisiting_Schrodinger's_Cat.ipynb # original challenge notebook
├── assets/
│ ├── hero/ # banners
│ ├── figures/ # static SVG and PNG figures
│ └── anim/ # GitHub-safe GIF animations
├── scripts/
│ ├── quantum_sandbox.py # NumPy solver + 100-unitary stress test
│ └── generate_figures.py # reproducible figure/GIF generator
├── docs/
│ └── quantum-computing-101.md # concept guide (EN + 中文速览)
├── oer/
│ ├── index.html # interactive physical-validity lesson
│ ├── README.md # Hugging Face Space configuration
│ └── assets/ # self-contained deployment assets
├── certificates/ # PennyLane and WISER records
├── Citation.cff # GitHub citation metadata
└── requirements.txt
This project was completed as part of the PennyLane “Revisiting Schrödinger's Cat” challenge and the WISER 2026 summer program.
All certificate files (PDF / PNG / SVG) are collected in certificates/.
- PennyLane: Revisiting Schrödinger's Cat challenge
- PennyLane U3 gate documentation
- Nielsen & Chuang, Quantum Computation and Quantum Information (Cambridge, 2010), ch. 2 & 4
- Schrödinger, E. (1935), “Die gegenwärtige Situation in der Quantenmechanik,” Naturwissenschaften 23, 807–812
- Wiseman & Milburn, Quantum Measurement and Control (Cambridge, 2009) — quantum steering and post-selection
- Mezzadri, F. (2007), “How to generate random matrices from the classical compact groups,” Notices of the AMS 54(5), 592–604
This repository ships a Citation.cff file, which powers GitHub's Cite this repository button. If you use this work, please cite:
@misc{zhang2026schrodingerscat,
author = {Zhang, Luyao (Sunshine)},
title = {Revisiting Schr\"{o}dinger's Cat: A Complete Guide
(PennyLane Quantum Challenge)},
year = {2026},
url = {https://github.com/sunshineluyao/schrodingers-cat},
note = {Closed-form U3 equality solution, randomized verification,
deterministic physical-validity tests, and an interactive OER}
}They answer three different scientific questions.
| Evidence layer | Question it answers | What it establishes | What it cannot establish alone |
|---|---|---|---|
| Mathematical derivation | Is the equal-amplitude formula correct for the stated algebraic problem? | The closed form satisfies |
Whether the code implements the formula correctly; whether the selected branch has non-zero probability. |
| Randomized numerical simulation | Did we implement the formula correctly on diverse, typical inputs? | 100/100 Haar-random tests reach machine-precision amplitude equality. | A universal proof; reliable coverage of measure-zero boundaries; physical meaning of a PASS. |
| Deterministic counterexample | Does the validator's PASS always mean a realizable quantum state? |
No: |
The general closed-form solution or broad implementation reliability. |
The complete verification record is therefore:
| Test | Equality result | Reachability result | Correct interpretation |
|---|---|---|---|
| Bell preparation | Reachable; |
||
| One sampled random unitary | PASS |
|
Reachable for that sampled full-rank state |
| 100 Haar-random unitaries | 100/100 PASS | Exact zero is almost surely not sampled | Implementation stress test, not a boundary proof |
| Identity, SWAP, CNOT, or phase gate on $ | 00\rangle$ | Can PASS with |
Final lesson: the mathematical derivation proves the equal-amplitude formula; randomized simulation checks its implementation; deterministic counterexamples test its physical meaning. All three are indispensable.
This is the broader trustworthy-computing principle behind the project: a syntactically satisfied assertion is not yet an operationally reachable outcome, and an operational outcome is not yet the intended physical state.







