feat: add new scripts for combined S_m and SO(3) symmetry checks and general-r correlation tensor validation
This commit is contained in:
parent
bc6f58b2c4
commit
4b7008b1df
4 changed files with 346 additions and 20 deletions
128
scripts/symmetric_states/7_combined_sm_so3_collapse.py
Normal file
128
scripts/symmetric_states/7_combined_sm_so3_collapse.py
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
import numpy as np
|
||||
from itertools import permutations, product
|
||||
from math import comb
|
||||
|
||||
def dicke3(k):
|
||||
psi = np.zeros(8, dtype=complex); n=0
|
||||
for bits in range(8):
|
||||
if bin(bits).count("1")==k: psi[bits]=1.0; n+=1
|
||||
return psi/np.sqrt(n)
|
||||
D3 = {k: dicke3(k) for k in range(4)}
|
||||
Q = np.zeros(64, dtype=complex)
|
||||
for k in range(4):
|
||||
Q += ((-1)**k) * np.kron(D3[k], D3[3-k])
|
||||
Q /= np.linalg.norm(Q)
|
||||
|
||||
# --- correlation tensor (Cartesian, all six legs, A,B,C,D,E,F) ---
|
||||
X=np.array([[0,1],[1,0]],dtype=complex); Y=np.array([[0,-1j],[1j,0]],dtype=complex); Z=np.array([[1,0],[0,-1]],dtype=complex)
|
||||
paulis=[X,Y,Z]
|
||||
Qt = Q.reshape((2,)*6)
|
||||
def apply_leg(psi,axis,P):
|
||||
p2=np.moveaxis(psi,axis,0); out=np.tensordot(P,p2,axes=([1],[0])); return np.moveaxis(out,0,axis)
|
||||
def corr_tensor(bra,ket):
|
||||
c=np.zeros((3,3,3,3,3,3),dtype=complex)
|
||||
for iA in range(3):
|
||||
for iB in range(3):
|
||||
for iC in range(3):
|
||||
for iD in range(3):
|
||||
for iE in range(3):
|
||||
for iF in range(3):
|
||||
k=ket
|
||||
for ax,ii in zip(range(6),(iA,iB,iC,iD,iE,iF)):
|
||||
k=apply_leg(k,ax,paulis[ii])
|
||||
c[iA,iB,iC,iD,iE,iF]=np.vdot(bra,k)
|
||||
return c
|
||||
T = corr_tensor(Qt,Qt).real
|
||||
M = T.reshape(27,27) # cut ABC|DEF
|
||||
print("nuclear norm of raw M (cut ABC|DEF):", np.linalg.svd(M,compute_uv=False).sum())
|
||||
|
||||
# --- exact Casimir (from before) for k=3 legs ---
|
||||
def J_component(a):
|
||||
eps = np.zeros((3,3,3))
|
||||
eps[0,1,2]=eps[1,2,0]=eps[2,0,1]=1
|
||||
eps[0,2,1]=eps[2,1,0]=eps[1,0,2]=-1
|
||||
Mm = np.zeros((3,3), dtype=complex)
|
||||
for b in range(3):
|
||||
for c in range(3):
|
||||
Mm[b,c] = -1j*eps[a,b,c]
|
||||
return Mm
|
||||
Jx,Jy,Jz = J_component(0),J_component(1),J_component(2)
|
||||
def total_J2(k):
|
||||
dim=3**k
|
||||
comps=[Jx,Jy,Jz]
|
||||
Jtot=[np.zeros((dim,dim),dtype=complex) for _ in range(3)]
|
||||
for leg in range(k):
|
||||
for a in range(3):
|
||||
mats=[np.eye(3,dtype=complex)]*k
|
||||
mats[leg]=comps[a]
|
||||
Mm=mats[0]
|
||||
for mm in mats[1:]: Mm=np.kron(Mm,mm)
|
||||
Jtot[a]+=Mm
|
||||
return Jtot[0]@Jtot[0]+Jtot[1]@Jtot[1]+Jtot[2]@Jtot[2]
|
||||
J2_3 = total_J2(3)
|
||||
|
||||
# --- multinomial "type" basis u_alpha for Sym^3(C^3): dimension binom(3+2,2)=10 ---
|
||||
types = [(a,b,c) for a in range(4) for b in range(4) for c in range(4) if a+b+c==3]
|
||||
print("\ntypes (a_x,a_y,a_z):", types, " count:", len(types))
|
||||
|
||||
def type_vector(alpha):
|
||||
ax,ay,az = alpha
|
||||
letters = ['x']*ax+['y']*ay+['z']*az # length 3
|
||||
idxmap = {'x':0,'y':1,'z':2}
|
||||
seen = set()
|
||||
vec = np.zeros(27, dtype=complex)
|
||||
count = 0
|
||||
for perm in set(permutations(letters)):
|
||||
idx = tuple(idxmap[l] for l in perm)
|
||||
flat = idx[0]*9+idx[1]*3+idx[2]
|
||||
vec[flat] = 1.0
|
||||
count += 1
|
||||
vec /= np.linalg.norm(vec)
|
||||
return vec
|
||||
|
||||
U = np.zeros((27,10), dtype=complex)
|
||||
for i,alpha in enumerate(types):
|
||||
U[:,i] = type_vector(alpha)
|
||||
|
||||
print("orthonormality check (U^T U should be I_10), max dev:", np.abs(U.conj().T@U - np.eye(10)).max())
|
||||
|
||||
# --- restrict Casimir to the 10-dim symmetric subspace ---
|
||||
J2_sym = U.conj().T @ J2_3 @ U
|
||||
evals_sym = np.linalg.eigvalsh(J2_sym)
|
||||
print("\nEigenvalues of J^2 restricted to Sym^3(C^3) (10-dim):")
|
||||
print(np.round(np.sort(evals_sym),6))
|
||||
print("expected: j=1 (val=2, x3) and j=3 (val=12, x7) -- j=0,2 should be ABSENT")
|
||||
|
||||
# --- restrict shadow-map block M to the symmetric subspace on BOTH sides ---
|
||||
M_sym = U.conj().T @ M @ U # 10x10 (reduced, S_3-symmetric on both ABC and DEF)
|
||||
print("\nnuclear norm of M restricted to Sym^3 x Sym^3 (10x10):", np.linalg.svd(M_sym,compute_uv=False).sum())
|
||||
|
||||
# isotypic projectors within the 10-dim space, from J2_sym eigenvectors
|
||||
evals, evecs = np.linalg.eigh(J2_sym)
|
||||
for jtarget, label in [(1,'j=1 (val=2)'), (3,'j=3 (val=12)')]:
|
||||
target = jtarget*(jtarget+1)
|
||||
mask = np.abs(evals-target)<1e-6
|
||||
print(f"{label}: multiplicity found = {mask.sum()} (expect {2*jtarget+1})")
|
||||
|
||||
for j0 in (0,2):
|
||||
target=j0*(j0+1)
|
||||
mask=np.abs(evals-target)<1e-6
|
||||
print(f"j={j0}: multiplicity found = {mask.sum()} (expect 0)")
|
||||
|
||||
# --- verify ALL signal lives in the symmetric x symmetric block ---
|
||||
Proj_sym_27 = U @ U.conj().T # 27x27 projector onto Sym^3 within full space
|
||||
M_outside = M - Proj_sym_27 @ M @ Proj_sym_27
|
||||
print("\nnuclear norm of M OUTSIDE the Sym^3 x Sym^3 block:",
|
||||
np.linalg.svd(M_outside, compute_uv=False).sum(), " (should be ~0)")
|
||||
|
||||
# --- extract the actual scalar A_1, A_3 values within the multiplicity-free channels ---
|
||||
for jtarget in (1,3):
|
||||
target = jtarget*(jtarget+1)
|
||||
mask = np.abs(evals-target)<1e-6
|
||||
P = evecs[:,mask] @ evecs[:,mask].conj().T # 10x10 projector
|
||||
block = P @ M_sym @ P
|
||||
nn = np.linalg.svd(block, compute_uv=False).sum()
|
||||
A_j = nn/(2*jtarget+1)
|
||||
print(f"j={jtarget}: ||A_j||_* (now a genuine SCALAR, multiplicity 1) = {A_j:.6f}")
|
||||
|
||||
print(f"\ncheck: 3*A_1 + 7*A_3 = {3*2.5+7*(15-3*2.5)/7 if False else ''}")
|
||||
132
scripts/symmetric_states/8_general_r_check.py
Normal file
132
scripts/symmetric_states/8_general_r_check.py
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
"""
|
||||
General-r check of Proposition coherence-templates: for r G-fixed states
|
||||
phi_1,...,phi_r and ANY density matrix rho = sum_{a,b} c_{ab} |phi_a><phi_b|
|
||||
(c a Hermitian PSD matrix, not necessarily rank-1/pure), the full
|
||||
correlation tensor is T(rho) = sum_{a,b} c_{ab} T_{ab}, with T_{ab} fixed
|
||||
(independent of c), REGARDLESS of which cut is subsequently taken.
|
||||
|
||||
Real-tensor count: T_{ba} = conj(T_{ab}) (since sigma is Hermitian), so the
|
||||
independent REAL data is {T_{aa}}_{a=1}^r (each already real) together with
|
||||
{Re(T_{ab}), Im(T_{ab})}_{a<b} -- total r + 2*binom(r,2) = r^2 real tensors,
|
||||
matching the real dimension of the space of r x r Hermitian matrices.
|
||||
(Corrects an earlier mis-stated count of r(r+1)/2 in the TODO comment.)
|
||||
|
||||
Tested here for r=3, using three different perfect matchings of six qubits
|
||||
into singlets as the three G-fixed basis states, and a genuinely MIXED
|
||||
(not pure/rank-1) random density matrix c -- a strictly more general test
|
||||
than the r=2 pure-superposition case checked earlier.
|
||||
"""
|
||||
import numpy as np
|
||||
|
||||
def s(a,b):
|
||||
if (a,b)==(0,1): return 1/np.sqrt(2)
|
||||
if (a,b)==(1,0): return -1/np.sqrt(2)
|
||||
return 0.0
|
||||
def build_pairing(pairs):
|
||||
psi = np.zeros((2,)*6, dtype=complex)
|
||||
for idx in np.ndindex(2,2,2,2,2,2):
|
||||
val=1.0
|
||||
for (p_,q_) in pairs:
|
||||
val *= s(idx[p_], idx[q_])
|
||||
if val==0: break
|
||||
psi[idx]=val
|
||||
return psi.reshape(64)
|
||||
|
||||
# three different perfect matchings of {A,B,C,D,E,F} = {0,1,2,3,4,5}
|
||||
phi1 = build_pairing([(0,3),(1,4),(2,5)]) # (A,D)(B,E)(C,F)
|
||||
phi2 = build_pairing([(0,4),(1,5),(2,3)]) # (A,E)(B,F)(C,D)
|
||||
phi3 = build_pairing([(0,5),(1,3),(2,4)]) # (A,F)(B,D)(C,E)
|
||||
Phi = np.stack([phi1,phi2,phi3], axis=1) # 64x3
|
||||
|
||||
G = Phi.conj().T @ Phi # Gram matrix
|
||||
print("Gram matrix (should be Hermitian, diag=1, off-diag |.|<1):")
|
||||
print(np.round(G,4))
|
||||
print("condition number:", np.linalg.cond(G))
|
||||
|
||||
# --- Pauli machinery ---
|
||||
X=np.array([[0,1],[1,0]],dtype=complex); Y=np.array([[0,-1j],[1j,0]],dtype=complex); Z=np.array([[1,0],[0,-1]],dtype=complex)
|
||||
paulis=[X,Y,Z]
|
||||
def apply_leg(psi,axis,P):
|
||||
p2=np.moveaxis(psi,axis,0); out=np.tensordot(P,p2,axes=([1],[0])); return np.moveaxis(out,0,axis)
|
||||
def corr_tensor(bra,ket):
|
||||
bra6, ket6 = bra.reshape((2,)*6), ket.reshape((2,)*6)
|
||||
c=np.zeros((3,3,3,3,3,3),dtype=complex)
|
||||
for iA in range(3):
|
||||
for iB in range(3):
|
||||
for iC in range(3):
|
||||
for iD in range(3):
|
||||
for iE in range(3):
|
||||
for iF in range(3):
|
||||
k=ket6
|
||||
for ax,ii in zip(range(6),(iA,iB,iC,iD,iE,iF)):
|
||||
k=apply_leg(k,ax,paulis[ii])
|
||||
c[iA,iB,iC,iD,iE,iF]=np.vdot(bra6,k)
|
||||
return c
|
||||
|
||||
print("\ncomputing all T_ab (a,b=1,2,3), 9 tensors total...")
|
||||
phis = [phi1,phi2,phi3]
|
||||
T = {}
|
||||
for a in range(3):
|
||||
for b in range(3):
|
||||
T[(a,b)] = corr_tensor(phis[a],phis[b])
|
||||
print(f" T[{a+1},{b+1}] done, max imag part={np.abs(T[(a,b)].imag).max():.2e}" if a==b else
|
||||
f" T[{a+1},{b+1}] done")
|
||||
|
||||
# check T_ba = conj(T_ab)
|
||||
for a in range(3):
|
||||
for b in range(3):
|
||||
err = np.abs(T[(a,b)] - np.conj(T[(b,a)])).max()
|
||||
assert err < 1e-10, (a,b,err)
|
||||
print("T_ba = conj(T_ab) verified for all pairs.")
|
||||
|
||||
# --- random genuinely MIXED c (PSD, not rank 1) ---
|
||||
rng = np.random.default_rng(42)
|
||||
W = rng.normal(size=(3,3)) + 1j*rng.normal(size=(3,3))
|
||||
c_raw = W @ W.conj().T # Hermitian PSD, generically full rank
|
||||
print("\nrandom c_raw (Hermitian PSD, rank =", np.linalg.matrix_rank(c_raw), "):")
|
||||
print(np.round(c_raw,3))
|
||||
|
||||
rho_raw = Phi @ c_raw @ Phi.conj().T # 64x64
|
||||
tr = np.trace(rho_raw).real
|
||||
rho = rho_raw/tr
|
||||
c = c_raw/tr
|
||||
print(f"\ntrace(rho_raw)={tr:.6f}; normalized rho has trace {np.trace(rho).real:.10f}")
|
||||
evals_rho = np.linalg.eigvalsh(rho)
|
||||
print("eigenvalues of rho (should be >=0, sum=1):", np.round(evals_rho[np.abs(evals_rho)>1e-9],6))
|
||||
|
||||
# --- brute-force TRUE correlation tensor of rho ---
|
||||
def corr_tensor_rho(rho):
|
||||
rho6 = rho.reshape((2,)*12) # not directly useful; do it via trace instead
|
||||
c=np.zeros((3,3,3,3,3,3),dtype=complex)
|
||||
for iA in range(3):
|
||||
for iB in range(3):
|
||||
for iC in range(3):
|
||||
for iD in range(3):
|
||||
for iE in range(3):
|
||||
for iF in range(3):
|
||||
O = paulis[iA]
|
||||
for ii in (iB,iC,iD,iE,iF):
|
||||
O = np.kron(O, paulis[ii])
|
||||
c[iA,iB,iC,iD,iE,iF] = np.trace(rho @ O)
|
||||
return c
|
||||
T_true = corr_tensor_rho(rho).real
|
||||
|
||||
# --- predicted via T(rho) = sum_ab c_ab T_ab ---
|
||||
T_pred = np.zeros((3,3,3,3,3,3), dtype=complex)
|
||||
for a in range(3):
|
||||
for b in range(3):
|
||||
T_pred += c[a,b] * T[(a,b)]
|
||||
T_pred = T_pred.real
|
||||
|
||||
err = np.abs(T_true - T_pred).max()
|
||||
print(f"\nmax|T_true - T_pred| (full 6-index tensor, r=3, genuinely mixed rho): {err:.2e}")
|
||||
|
||||
# --- verify at BOTH cuts via simple reshape, no new contraction ---
|
||||
M1_true, M1_pred = T_true.reshape(27,27), T_pred.reshape(27,27)
|
||||
M2_true, M2_pred = T_true.reshape(9,81), T_pred.reshape(9,81)
|
||||
print(f"cut ABC|DEF: max matrix error = {np.abs(M1_true-M1_pred).max():.2e}, "
|
||||
f"||M||_* true={np.linalg.svd(M1_true,compute_uv=False).sum():.4f} "
|
||||
f"pred={np.linalg.svd(M1_pred,compute_uv=False).sum():.4f}")
|
||||
print(f"cut AB|CDEF: max matrix error = {np.abs(M2_true-M2_pred).max():.2e}, "
|
||||
f"||M||_* true={np.linalg.svd(M2_true,compute_uv=False).sum():.4f} "
|
||||
f"pred={np.linalg.svd(M2_pred,compute_uv=False).sum():.4f}")
|
||||
|
|
@ -87,3 +87,32 @@ allgemeine (nicht nur p,j<=3) geschlossene Form von Xi als zitierfaehiges
|
|||
Standard-6j-Symbol wurde nicht identifiziert (zwei Versuche dazu blieben
|
||||
erfolglos, siehe search_6j.py-Fragmente); ebenso ist Gl. (2) nur verifiziert,
|
||||
nicht fuer allgemeines n_leg induktiv hergeleitet.
|
||||
|
||||
## 7. `7_combined_sm_so3_collapse.py`
|
||||
Kombiniert S_m-Permutationssymmetrie mit voller kollektiver SO(3)-Symmetrie
|
||||
an einem konkreten 6-Qubit-Beispiel: |Q> = kanonische Invariante zweier
|
||||
gekoppelter Spin-3/2-Dicke-Multipletts auf ABC und DEF (Gl.
|
||||
eq:dicke-network-state im .tex). Verifiziert:
|
||||
- |Q> ist exakt kollektiv-rotationsinvariant (|<Q|U^6|Q>|=1 exakt).
|
||||
- Innerhalb des 10-dim S_3-symmetrischen Unterraums (Typ-Basis u_alpha,
|
||||
Sym^3(C^3)) zeigt der Casimir NUR j=1 (x3) und j=3 (x7) -- j=0,2
|
||||
komplett abwesend, multiplizitätsfrei wie klassisch vorhergesagt.
|
||||
- Die gesamte Kernnorm (15.0) lebt exakt im doppelt-symmetrischen
|
||||
Sektor (Norm ausserhalb: 7e-15).
|
||||
- Konkrete Skalarwerte: A_1=1/3, A_3=2, mit 3*A_1+7*A_3=15 exakt.
|
||||
Ist jetzt Proposition harmonic-decomposition + Example dicke-network im
|
||||
.tex (Abschnitt sec:sm-so3-combination).
|
||||
|
||||
## 8. `8_general_r_check.py`
|
||||
Schliesst die letzte offene TODO im Abschnitt: verallgemeinert die
|
||||
Cut-unabhaengige Template-Aussage (Proposition coherence-templates) von
|
||||
r=2 auf r=3, mit einem ECHT GEMISCHTEN (volle Rang-3, nicht reine
|
||||
Ueberlagerung) Zustand. Korrigiert nebenbei einen Zaehlfehler im
|
||||
urspruenglichen TODO-Kommentar: die Anzahl unabhaengiger reeller Tensoren
|
||||
ist r^2 (= reelle Dimension hermitescher r x r Matrizen), nicht r(r+1)/2.
|
||||
Drei verschiedene Perfect-Matchings von 6 Qubits als Basis-Zustaende,
|
||||
Gram-Matrix-Konditionszahl 2 (linear unabhaengig), Haar-zufaellige
|
||||
hermitesche PSD-Koeffizientenmatrix voller Rang. Ergebnis: Fehler 1.1e-16
|
||||
zwischen Brute-Force- und Template-basierter Korrelationstensor-Berechnung,
|
||||
an BEIDEN Schnitten gleichzeitig, ohne erneute Simulation.
|
||||
Ist jetzt Corollary real-tensor-count + Example general-r-three im .tex.
|
||||
Loading…
Add table
Add a link
Reference in a new issue