# Independent check of the gluing claim: x_i = q^{rho_L} y_i, y1=(q^-5,q), y2=(q^-5,q^4) in (u,v)=(y(e1),y(e6)).
import sys; sys.path.insert(0, '/private/tmp/claude-501/-Users-miltonlin-Projects-Trees/75c2c3d9-ef06-4644-b59b-d12583740b0c/scratchpad/anim/work/G5/scripts')
from e6model import *
from e6_theta import theta, phi, rhoL, e1, e6, black
def weight_of_point(lu, lv):
    # log_q x(alpha_j^vee) = <rho_L, alpha_j^vee> + (log y)(phi(alpha_j^vee)); phi(alpha_1)=e1, phi(alpha_6)=e6
    c = [dot(rhoL, al[j]) for j in range(1, 7)]
    c[0] += lu; c[5] += lv
    v = (F(0),) * 8
    for j in range(6): v = add(v, sc(c[j], om[j + 1]))
    return v
L1 = weight_of_point(-5, 1); L2 = weight_of_point(-5, 4)
print('lambda1* fund coords', fund(L1), ' = rho-9w1-3w6 ?', L1 == sub(sub(rho, sc(9, om[1])), sc(3, om[6])))
print('lambda2* fund coords', fund(L2), ' = rho-9w1 ?', L2 == sub(rho, sc(9, om[1])))
print('norms', dot(L1, L1), dot(L2, L2))
# W-orbit of L1 by BFS with simple reflections (vectors in R^8)
def orbit(v):
    seen = {v}; fr = [v]
    while fr:
        nf = []
        for x in fr:
            for j in range(1, 7):
                y = refl(al[j], x)
                if y not in seen: seen.add(y); nf.append(y)
        fr = nf
    return seen
O1 = orbit(L1)
print('|W.lambda1*| =', len(O1), ' lambda2* in W.lambda1* :', L2 in O1)
dom = [v for v in O1 if all(dot(v, al[j]) >= 0 for j in range(1, 7))]
print('dominant element(s) of the orbit, fund coords:', [fund(v) for v in dom])
# W_X-orbits of y1, y2 in log coordinates, from the actual action of rho_L-fixing elements of W normalizing the minus-eigenspace
# find the subgroup W' = {w in W : w preserves Lambda_S (x) Q and Phi_L^+}: generate W as matrices acting on R^8 vectors (6-dim span)
