# GL4/Sp4: all lattices M subset t^{-2}O^4 with x unimodular on M, by type inv(O^4,M).
# Value (T_lambda * phi_0)(x) = #{M : inv(O^4,M) = -w0 lambda}  (Lemma A, lattice form).
import sys, time
exec(open('/private/tmp/claude-501/-Users-miltonlin-Projects-Trees/f0f18b89-aa0d-4ce6-93d2-78c269eb7d7d/scratchpad/salvage/S1/engine.py').read())
for p in [int(v) for v in sys.argv[1:]] or [2, 3]:
    for name, a in [('varpi J  (label (1,1,1,1))', (1, 1)), ("J''=t^2 J12+J34 (label (2,2,0,0))", (2, 0))]:
        t0 = time.time()
        cnt = count_types(a, p, lo=[-2]*4, hi=[3]*4, total_d=-sum(a), shift=2, prec=14)
        print('q=%d' % p, name, 'time %.1fs' % (time.time()-t0))
        for ty, c in sorted(cnt.items()):
            lam = tuple(-v for v in reversed(ty))
            print('   inv(O^4,M)=', ty, ' lambda=-w0(inv)=', lam, ' count', c)
