Skip to content

feat(layer-101): Quantum Coherence Lab — in-browser phase/interference sandbox#23

Closed
slavazeph-coder wants to merge 1 commit into
mainfrom
claude/quantum-coherence-lab-YdXiy
Closed

feat(layer-101): Quantum Coherence Lab — in-browser phase/interference sandbox#23
slavazeph-coder wants to merge 1 commit into
mainfrom
claude/quantum-coherence-lab-YdXiy

Conversation

@slavazeph-coder

Copy link
Copy Markdown
Owner

Summary

Adds Layer 101 — Quantum Coherence Lab: a single-qubit simulator and panel that runs entirely in the browser, teaching the physical mechanism behind "alignment" — superposition, phase, interference, observation, noise, and decoherence.

  • src/utils/quantumCoherence.js — complex helpers (complex, addComplex, mulComplex, abs2, normalizeState), gates (applyH, applyX, applyZ, applyRZ), measurement (measureDistribution, sampleShots), three experiments (runPhaseExperiment, runObservationExperiment, runDecoherenceExperiment), coherenceScore, and mapQuantumToBrainState.
  • src/components/QuantumCoherencePanel.jsx — θ slider (0 → π), shots picker (256 / 1024 / 4096), noise slider, X·X depth slider, observe-midway toggle, Scientific / Metaphor mode toggle, P(0) / P(1) bars, coherence score 0–100, plain-English explanation, and a H → RZ(θ) → H → M circuit row.
  • Brain mapping: PFC↑ coherence · AMY↑ noise · THL↑ routing · HPC↑ survival · BG↑ dominance · CBL↑ correction · CTX↑ complexity.
  • Wiring: panel registered in App.jsx, listed in layerCatalog.js as L101 with a new experimental group.
  • Tests: 18 unit tests via Node's built-in node:test runner. npm run test:quantum.
  • Docs: README section in brainsnn-r3f-app/README.md that explicitly disclaims literal multiverse, consciousness collapse, Planck foam, and spiritual portal claims — those are framing metaphors only.

No backend, no IBM/OriginQ keys, no secrets. The function surface is intentionally compatible with a future hardware-backed run.

Test plan

  • npm install succeeds
  • npm run build succeeds (Vite, ~8s)
  • npm run test:quantum — 18/18 passing
  • Open the app, scroll to the Quantum Coherence Lab panel:
    • θ=0 → P(0) bar at ~100%
    • θ=π → P(1) bar at ~100%
    • θ=π/2 → bars roughly 50/50
    • Slide noise up → both bars approach 50/50, coherence score drops
    • Toggle "observe midway" → bars become ~50/50, score < 40
    • Increase X·X depth → score decays even at noise=0
    • Mode: Scientific ↔ Metaphor flips the explanation
    • "Apply to brain" nudges the 7 regions and toasts

https://claude.ai/code/session_01VYArf8MTS6QdhmswtqNPox


Generated by Claude Code

…e sandbox

Adds a single-qubit simulator running |0⟩ → H → RZ(θ) → H → M entirely in
JavaScript, plus a panel that teaches superposition, phase, interference,
observation, noise, and decoherence.

- src/utils/quantumCoherence.js: complex/H/X/Z/RZ helpers, three
  experiments (phase / observation / decoherence), simple dephasing +
  bit-flip noise model, coherenceScore, and mapQuantumToBrainState
  (PFC↑ coherence · AMY↑ noise · THL↑ routing · HPC↑ survival ·
  BG↑ dominance · CBL↑ correction · CTX↑ complexity).
- src/components/QuantumCoherencePanel.jsx: theta / shots / noise /
  depth / observe-midway controls, scientific ↔ metaphor mode toggle,
  P(0)/P(1) bars, coherence score 0–100, plain-English explanation,
  and a circuit-row visualization.
- App.jsx: wired with onApplyToBrain that nudges the 7 region levels.
- layerCatalog: registered as L101 with new "experimental" group.
- Tests: 18 cases via node:test (theta=0/π, observation, decoherence,
  noise/depth scaling, brain mapping). Run with `npm run test:quantum`.
- Docs: README section explicitly disclaims literal multiverse /
  consciousness / Planck / spiritual claims; framed as a teaching
  sandbox; future backend can swap in IBM Quantum or OriginQ.

No secrets added. npm install + npm run build pass.

https://claude.ai/code/session_01VYArf8MTS6QdhmswtqNPox

Copy link
Copy Markdown
Owner Author

Closing as a duplicate of #22, which now ships both the offline Qiskit suite (quantum_alignment/) and the same browser-native Layer 101 (brainsnn-r3f-app/...quantumCoherence...). Same code, broader scope — keeping both open would just create merge conflicts on layerCatalog.js / App.jsx.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants