quantum-shadow-maps_v2/scripts/README.md
2026-07-26 14:09:49 +02:00

165 lines
7.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Reproducibility Scripts
This directory contains small numerical scripts used to reproduce values quoted in the paper. Scripts should be executable from the repository root unless noted otherwise.
## Requirements
- Python 3
- NumPy
Install the only current dependency with:
```bash
python3 -m pip install numpy
```
## Current Scripts
### `tiles_upb.py`
Computes the two-qutrit Tiles unextendible-product-basis benchmark used in `paper/symmetric_shadow_maps_formal.tex`. The script uses Gell-Mann generators scaled so that `Tr(sigma_i sigma_j) = 3 delta_ij`, matching the paper's generator normalization.
Run from the repository root:
```bash
python3 scripts/tiles_upb.py
```
The script constructs the five Tiles UPB product vectors, forms the normalized projector onto their four-dimensional orthogonal complement, and prints:
- the UPB Gram matrix;
- the density-matrix trace, Hermiticity check, and spectrum;
- the partial-transpose spectrum and minimum eigenvalue;
- the shadow-map value `||M_A(rho)||_*`, normalized by `sqrt((3-1)(3-1)) = 2`;
- the CCNR/realignment trace norm for comparison.
The values used in `paper/symmetric_shadow_maps_formal.tex` are:
| quantity | value |
| --- | ---: |
| minimum eigenvalue of partial transpose | `-1.5922869149236308e-16` |
| unnormalized correlation nuclear norm | `2.1068432645403345` |
| normalized shadow-map value | `1.0534216322701673` |
| CCNR/realignment trace norm | `1.087412464837521` |
The tiny negative partial-transpose eigenvalue is numerical roundoff; the state is the standard PPT-entangled Tiles UPB state. The paper compares the normalized shadow-map value to the separability bound `<= 1`.
### `grraph_state_cuts.py`
Computes the cut-resolved bigraduated shadow-map values for the four-qubit ring graph state with edges `(1,2)`, `(2,3)`, `(3,4)`, `(4,1)`. Internally the script uses zero-based qubit labels.
Run from the repository root:
```bash
python3 scripts/grraph_state_cuts.py
```
The script constructs the graph state, computes its Pauli correlation tensor, forms the normalized `2|2` source-target unfoldings, and prints:
- the full normalized nuclear norm `||M_S||_*` for each cut;
- the normalized full-sector block, obtained by keeping only nonidentity Pauli labels on both source qubits and both target qubits;
- the eigenvalues of the two-qubit source marginal and its distance from the maximally mixed state.
The values used in `paper/symmetric_shadow_maps_formal.tex` are:
| cut | full normalized norm | normalized full-sector block | source marginal |
| --- | ---: | ---: | --- |
| adjacent `{1,2}|{3,4}` | `5` | `5/3` | maximally mixed |
| diagonal `{1,3}|{2,4}` | `7/3` | `1` | eigenvalues `1/2, 1/2, 0, 0` |
| adjacent `{1,4}|{2,3}` | `5` | `5/3` | maximally mixed |
The script also prints raw, unnormalized nuclear norms. The paper compares only the normalized values to the separability bound `<= 1`.
## Adding New Scripts
When adding another script, add a short entry above with:
- the purpose of the script;
- the command needed to run it from the repository root;
- required dependencies beyond NumPy, if any;
- the paper values, table, or figure it reproduces;
- notes about normalization conventions if the output includes both raw and normalized quantities.
---
# Shadow-Map GME-Analyse: Skriptpaket
Alle Skripte aus der Diskussion zu "Symmetric Shadow Maps and Multipartite Correlation
Criteria", konsolidiert und bereinigt (keine überholten/fehlerhaften Zwischenversionen).
Qubit-Reihenfolge durchgehend (A,B,C,D) = (0,1,2,3).
## Grundmodule (werden von allem anderen importiert)
- **core.py** -- Parametrisierung reiner biseparabler 4-Qubit-Zustände
(`state_1_3`, `state_2_2`, `random_pure_state`).
- **core2.py** -- schnelle, vektorisierte Berechnung des vollen Pauli-Korrelationstensors
und der Einzelpartei-Shadow-Map (`full_tensor`, `phi_sym`).
- **cluster.py** -- die volle 15×15 bigraduierte Cluster-Shadow-Map `M_S` für
Zwei-Qubit-Quellcluster (`cluster_map`), plus Tensor-Extraktion für gemischte Zustände.
- **subblock.py** -- der "fully-active" 9×9-Unterblock von `M_S`.
- **party_blocks.py** -- rohe Einzelpartei-zu-Einzelpartei 3×3-Korrelationsblöcke.
## Kapitel 1: Universelle Sättigungs-Decke (bewiesen)
- **universal_ceiling.py** -- geschlossene Formel für das globale Maximum von
`||M_S||_*` über *alle* Zustände (Cauchy-Schwarz + Spur-Identität), reproduziert
`sqrt(6)`, `6/sqrt(7)`, `2.19089...` (n=3,4,5) und `5.0` (2-Qubit-Cluster, n=4) exakt.
## Kapitel 2: Warum Φ_sym und einzelne M_S keine GME-Zeugen sind
- **optimize_phi_sym.py** -- zeigt, dass die biseparable Suprema von Φ_sym (2|2- und
1|3-Schnitt) und das globale Supremum über *alle* Zustände identisch sind.
- **optimize_cluster_witness.py** -- zeigt dasselbe für einzelne `||M_AB||_*`, plus
erste (noch zu enge) Suche nach `min(M_AB,M_AC,M_AD)` über 1|3-biseparable Zustände.
- **pairwise_correlation_demo.py** -- Exkurs: warum paarweise Korrelationsblöcke
ebenfalls kein sauberes Kriterium liefern (Graphzustände haben selbst verschwindende
Paar-Blöcke).
## Kapitel 3: Der funktionierende GME-Zeuge `min(M_AB,M_AC,M_AD)`
- **mixture_search.py** -- Kernstück: exakte geschlossene Form für die
Bell-Paar-Mischungsfamilie (`p=1/2` optimal, Wert exakt 3), plus allgemeine
Mischungssuchen (2/3/4/6 Komponenten), die alle bei 3.0 landen.
- **sum_bound_proof.py** -- der rigorose Beweis der Schranke `<= 11/3` (Summe statt
Minimum ist konvex; LP bestätigt, dass Gleichgewichtung optimal für diese Technik ist).
## Kapitel 4: SDP-Verschärfung über PPT-Mixtures
Benötigt zusätzlich `pip install cvxpy` (Solver SCS ist enthalten).
- **sdp_ppt_mixture.py** -- PPT-Mixture-SDP + alternierendes (Frank-Wolfe-artiges)
Suchschema über duale Zeugen. **Wichtig:** `order='C'` in beiden `cp.reshape`-Aufrufen
ist notwendig (Standard-Fortran-Order von cvxpy passt sonst nicht zur row-major
Konstruktion von `PT_MATRIX`/`COEFF`).
- **compute_seed_witnesses.py** -- erzeugt `O_seed.npz` (optimale duale Zeugen für den
bekannten 3.0-Punkt). Vor den beiden folgenden Skripten einmal ausführen.
- **diagnostic_seeded_run.py** -- Sanity-Check: ein einzelner SDP-Schritt mit den
exakten Zeugen des bekannten Punktes muss `t >= 3.0` liefern (sonst Implementierungsfehler).
- **seeded_exploration.py** -- Stabilitäts-/Störungstest um den bekannten Punkt herum,
über die *volle* PPT-Mixture-Menge (echte Obermenge der biseparablen Zustände).
## Empfohlene Ausführungsreihenfolge
```bash
python3 universal_ceiling.py
python3 optimize_phi_sym.py # dauert ~1-2 Minuten
python3 optimize_cluster_witness.py # dauert ~1-2 Minuten
python3 pairwise_correlation_demo.py
python3 mixture_search.py # die Mischungs-Optimierungen sind langsam (Powell
# skaliert schlecht mit der Parameterzahl) --
# einzelne Restarts können 1-2 Minuten dauern
python3 sum_bound_proof.py
# für Kapitel 4 (SDP):
pip install cvxpy
python3 compute_seed_witnesses.py
python3 diagnostic_seeded_run.py
python3 seeded_exploration.py
```
## Status der zentralen Vermutung
- **Bewiesen:** `min(M_AB,M_AC,M_AD) <= 11/3` für jeden biseparablen Zustand.
- **Numerisch sehr robust (mehrere unabhängige Methoden, inkl. SDP über die größere
PPT-Mixture-Menge), aber nicht formal bewiesen:** die wahre Schranke ist exakt `3.0`.