Model card: restore full README from GitHub, add commercial license option
Browse files
README.md
CHANGED
|
@@ -17,3 +17,112 @@ tags:
|
|
| 17 |
|
| 18 |
> Mirrored from [https://github.com/SNAPKITTYWEST/cpsc-qft](https://github.com/SNAPKITTYWEST/cpsc-qft) at commit `8ebd1d5`. Part of the **SnapKitty October 2026 main drop**.
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
> Mirrored from [https://github.com/SNAPKITTYWEST/cpsc-qft](https://github.com/SNAPKITTYWEST/cpsc-qft) at commit `8ebd1d5`. Part of the **SnapKitty October 2026 main drop**.
|
| 19 |
|
| 20 |
+
<!--
|
| 21 |
+
Copyright (c) 2026 Ahmad Ali Parr and others.
|
| 22 |
+
SPDX-License-Identifier: LicenseRef-CPSC-ESCL-1.0 OR AGPL-3.0-only
|
| 23 |
+
This file is dual-licensed under the CPSC Eclipse Strict Copyleft License v1.0
|
| 24 |
+
or the GNU AGPL v3 only. Both are strict copyleft.
|
| 25 |
+
-->
|
| 26 |
+
|
| 27 |
+
# CPSC — Conservation-Preserving Scattering Compiler
|
| 28 |
+
|
| 29 |
+
Proof-carrying lattice scattering for 1+1D scalar field theory. Conservation laws are compilation constraints, not post-selection filters.
|
| 30 |
+
|
| 31 |
+
**Status:** prototype. The analyzer, translation-orbit check, Trotter product, certificate digest, and Boolean Lean skeleton run. Operator commutation on the qubit space is still open. The paper is [paper/PAPER.md](paper/PAPER.md).
|
| 32 |
+
|
| 33 |
+
Repository: [AHMADALIPARR/cpsc-qft](https://github.com/AHMADALIPARR/cpsc-qft)
|
| 34 |
+
|
| 35 |
+
## Claim, precisely
|
| 36 |
+
|
| 37 |
+
Current NISQ scattering experiments often evolve a Trotter circuit and discard shots whose measured quantum numbers disagree with the input. CPSC inverts that. The compiler is only allowed to emit unitaries on the joint symmetry manifold
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
\mathcal{M}_{\mathrm{sym}} = \{ U \in U(2^N) \mid [U, \Pi_\chi] = 0 \;\forall\, \chi \in \{P, Q\} \}
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
and must attach a certificate that every emitted gate stays on that manifold. Energy is not an independent constraint: a time-independent Hamiltonian already satisfies $[H, H] = 0$, so $e^{-iHt}$ conserves energy exactly. The non-trivial compilation constraints are the symmetries of $H$ (here lattice momentum and a $\mathbb{Z}_2$ charge).
|
| 44 |
+
|
| 45 |
+
## What is actually conserved in this model
|
| 46 |
+
|
| 47 |
+
The working model is a periodic qubit lattice standing in for the Ising limit of 1+1D $\phi^4$, not continuum $\phi^4$.
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
H = -J \sum_{i=0}^{N-1} Z_i Z_{i+1} + \lambda \sum_{i=0}^{N-1} X_i
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
The quartic written as $(g/4!)\sum_i X_i^4$ is identically proportional to the identity, because $X^2 = I$. It is recorded in `src/cpsc/hamiltonian.py` and then dropped. A faithful lattice $\phi^4$ needs a truncated real field per site (or a higher spin), which is listed as an open problem.
|
| 54 |
+
|
| 55 |
+
| Quantity | Operator | Status in this repo |
|
| 56 |
+
| --- | --- | --- |
|
| 57 |
+
| Charge $Q$ | $\sum_i Z_i$ (equivalently $\mathbb{Z}_2$ parity $\prod_i Z_i$) | Enforced. $H$ is block-diagonal in $Q$. Single-qubit $X$ is rejected. |
|
| 58 |
+
| Momentum $P$ | Generator of the cyclic shift $T$ | Specified. Translation averaging is implemented classically for diagonal checks; block synthesis is not. |
|
| 59 |
+
| Energy $E$ | $H$ itself | Automatic for exact $e^{-iHt}$. Not a separate compilation filter. |
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
<p align="center">
|
| 64 |
+
<a href="docs/mercury-circuit-demo.mp4">
|
| 65 |
+
<img src="docs/mercury-circuit-demo.gif" alt="Programming a GHZ circuit in Mercury, then the compile-time rejection and the admitted Ising ring" width="720">
|
| 66 |
+
</a>
|
| 67 |
+
<br>
|
| 68 |
+
<a href="docs/mercury-circuit-demo.mp4">Mercury circuit demo (MP4)</a>
|
| 69 |
+
· GHZ ladder written, rejected, replaced by an admitted ZZ ring
|
| 70 |
+
</p>
|
| 71 |
+
|
| 72 |
+
## Site
|
| 73 |
+
|
| 74 |
+
GitHub Pages serves `docs/`. The console is [qsim.html](https://ahmadaliparr.github.io/cpsc-qft/qsim.html). Rebuild it from the frontend with `frontend/web/build.sh`, which copies the bundle into `docs/`.
|
| 75 |
+
|
| 76 |
+
## Layout
|
| 77 |
+
|
| 78 |
+
```
|
| 79 |
+
docs/SPECIFICATION.md mathematical construction and PCSS workflow
|
| 80 |
+
docs/CHANNEL_PRUNING.md channel rules and what they do not mean
|
| 81 |
+
docs/OPEN_PROBLEMS.md discharged skeleton vs open operator proof
|
| 82 |
+
lean/CPSC/ Boolean certificate, plus an emitted digest
|
| 83 |
+
qsharp/ Ising and spin-flip Trotter operations
|
| 84 |
+
src/cpsc/ analyzer, compiler, certificate binder
|
| 85 |
+
tests/ adversarial rejection, orbit check, digest binding
|
| 86 |
+
paper/PAPER.md working paper
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
## Run the analyzer
|
| 90 |
+
|
| 91 |
+
```bash
|
| 92 |
+
python -m venv .venv && source .venv/bin/activate
|
| 93 |
+
pip install -e ".[dev]"
|
| 94 |
+
pytest -q
|
| 95 |
+
python -m cpsc.demo
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
Python 3.11+. No quantum hardware required. The demo is a statevector check on $N \le 8$.
|
| 99 |
+
|
| 100 |
+
## Certificate story
|
| 101 |
+
|
| 102 |
+
`lean/CPSC/Certificate.lean` defines the statements that a later proof must discharge:
|
| 103 |
+
|
| 104 |
+
1. Every gate in the compiled circuit commutes with $Q$ and with the translation generator.
|
| 105 |
+
2. In the absence of decoherence, amplitude outside the input sector is identically zero.
|
| 106 |
+
3. If $[H, \Pi_\chi] = 0$, the exact evolution lies in $\mathcal{M}_{\mathrm{sym}}$ (completeness). Projection is then a no-op on the ideal operator and a rejection rule on illegal gates.
|
| 107 |
+
|
| 108 |
+
These are `sorry`s. A modified circuit does not yet break a machine-checked proof, because the proof does not exist. The Python adversarial test is the executable stand-in: inserting an $X$ fails compilation.
|
| 109 |
+
|
| 110 |
+
## Relation to existing methods
|
| 111 |
+
|
| 112 |
+
This is not a new symmetry. Block-diagonalization by a conserved charge is textbook. Symmetry-protected codes and subspace-preserving compilations (Qiskit Pauli evolution in a symmetry sector, PennyLane symmetry projection, verified quantum circuits in SQIR/Coq) already exist. The architectural bet is narrower: treat the allowed scattering channel of a lattice QFT as the synthesis domain, and ship the channel membership proof with the circuit. See `docs/OPEN_PROBLEMS.md` before citing novelty.
|
| 113 |
+
|
| 114 |
+
## License
|
| 115 |
+
|
| 116 |
+
Dual strict copyleft. You may use this repository under either:
|
| 117 |
+
|
| 118 |
+
- the CPSC Eclipse Strict Copyleft License, Version 1.0 (`LicenseRef-CPSC-ESCL-1.0`), or
|
| 119 |
+
- the GNU Affero General Public License, Version 3 only (`AGPL-3.0-only`).
|
| 120 |
+
|
| 121 |
+
Both options are strict copyleft, including network use. This is not the Eclipse Public License, and it is not Apache-2.0. There is no classpath exception and no permissive relicensing. Headers on each source file are part of the notice. See [LICENSE](LICENSE), [NOTICE](NOTICE), and [LICENSES/](LICENSES/).
|
| 122 |
+
|
| 123 |
+
### 💼 Commercial License
|
| 124 |
+
|
| 125 |
+
This repository is published under **CPSC-ESCL-1.0 or AGPL-3.0**. Building a commercial product or service? A **proprietary commercial license** from Snapkitty Collective LLC lets you ship this code on terms other than CPSC-ESCL-1.0 or AGPL-3.0.
|
| 126 |
+
|
| 127 |
+
**[→ Get a commercial license](mailto:A.parr@belespritdaccord.uk?subject=Commercial%20license:%20cpsc-qft)** · A.parr@belespritdaccord.uk
|
| 128 |
+
|