import sys; sys.path.insert(0, "/private/tmp/claude-501/-Users-miltonlin-Projects-Trees/75c2c3d9-ef06-4644-b59b-d12583740b0c/scratchpad/solve/A6")
from e6_setup import A, n
# weights in fundamental-weight coordinates c_i=<lam,alpha_i^vee>; s_j(c) = c - c_j * (row j of Cartan: <alpha_j, alpha_i^vee>) -> c_i - c_j*A[j][i]
def to_dominant(c):
    c=list(c); word=[]
    while True:
        js=[j for j in range(n) if c[j]<0]
        if not js: return tuple(c),word
        j=js[0]; word.append(j+1); cj=c[j]; c=[c[i]-cj*A[j][i] for i in range(n)]
for name,c in [('lambda1*=rho-9w1-3w6',(-8,1,1,1,1,-2)),('lambda2*=rho-9w1',(-8,1,1,1,1,1))]:
    d,w=to_dominant(c)
    print(name,'-> dominant',d,' via simple reflections (applied left to right, Bourbaki labels):',w, ' length',len(w))
