# Does the flip of M_n (x) M_n lie in the algebra generated by planar maps built from m, m^op and their adjoints? import numpy as np, itertools, sys def run(n, out, useop=True): d=n*n E=lambda i,j: np.eye(d)[i*n+j] # m: V(x)V -> V as d x d^2 matrix m=np.zeros((d,d*d)); mop=np.zeros((d,d*d)) for i,j,k,l in itertools.product(range(n),repeat=4): if j==k: m[:, (i*n+j)*d+(k*n+l)] += E(i,l) if l==i: mop[:, (i*n+j)*d+(k*n+l)] += E(k,j) I=np.eye(d) gens=[] ops=(m,mop) if useop else (m,) for x in ops: for y in ops: gens.append(np.kron(x,I) @ np.kron(I,y.T)) # V2 -> V3 -> V2 gens.append(np.kron(I,x) @ np.kron(y.T,I)) gens.append(y.T @ x) # V2 -> V -> V2 # algebra generated: span closure under products basis=[] def addvec(M, basis): v=M.flatten() if not basis: basis.append(v/np.linalg.norm(v)); return True B=np.array(basis); r=v-B.T@(B@v) if np.linalg.norm(r)>1e-8*max(1,np.linalg.norm(v)): basis.append(r/np.linalg.norm(r)); return True return False mats=[np.eye(d*d)]+gens for M in mats: addvec(M,basis) frontier=list(mats) for it in range(6): new=[] for A in frontier: for g in gens: P=A@g if addvec(P,basis): new.append(P) print(f"n={n} round {it+1}: algebra dimension {len(basis)}", flush=True); out.write(f"n={n} round {it+1}: dimension {len(basis)}\n") if not new: break frontier=new S=np.zeros((d*d,d*d)) for a,b in itertools.product(range(d),repeat=2): S[b*d+a,a*d+b]=1 B=np.array(basis); v=S.flatten(); r=v-B.T@(B@v) res=f"n={n}, with m^op={useop}: flip in algebra generated: {np.linalg.norm(r)<1e-6}" print(res); out.write(res+"\n") # control: with m only (Temperley-Lieb), flip should NOT be there with open("caniggia-output.txt","w") as out: run(2,out) run(3,out) run(3,out,useop=False)