Example #1
0
File: qu.py Project: punkdit/bruhat
def test():

    n = 9
    G = Group.symmetric(n)
    t = Young(G, (4, 3, 1, 1))
    assert t.rows == [[0, 1, 2, 3], [4, 5, 6], [7], [8]]
    assert t.cols == [[0, 4, 7, 8], [1, 5], [2, 6], [3]]

    G = t.get_rowperms()
    assert len(G) == factorial(4) * factorial(3)
Example #2
0
def test():

    ring = element.Q

    n = argv.get("n", 3)
    G = Group.symmetric(n)

    tp = Cat(G, ring)
    burnside(tp)

    return

    rep = Rep.perm_rep(G, cat)
    rep.check()

    r2 = rep @ rep
    r2.check()

    r2.dump()
Example #3
0
def test():

    ring = element.Q

    n = argv.get("n", 3)
    d = argv.get("d", 2)

    G = Group.symmetric(n)

    algebra = GroupAlgebra(G, ring)
    v = algebra.zero
    for g in G:
        v = v + g
    assert 2 * v == v + v
    assert v - v == algebra.zero

    for g in algebra.basis:
        assert g * v == v
        assert v * g == v

    center = algebra.get_center()
    for v in center:
        for g in algebra.basis:
            assert g * v == v * g

    # ---------------------------------------

    # build standard representation of symmetric group

    act = G.left_action(list(range(n)))
    #print(act)

    tp = Cat(G, ring)
    rep = Rep.mk_rep(act, tp)
    #rep.dump()

    module = algebra.extend(rep)
    #print(module.action(v))

    # ---------------------------------------

    # build representation of symmetric group on tensor product

    space = Space(d, ring)
    rep = tensor_rep(G, space)
    #rep.check()

    module = algebra.extend(rep)
    #print(module.action(v))

    # ---------------------------------------

    # Build the young symmetrizers
    projs = []
    part = argv.get("part")
    parts = [part] if part else partitions(n)
    for part in parts:

        items = G.items
        A = algebra.zero
        for g in G:
            labels = [g[item] for item in items]
            tableau = Young(G, part, labels)
            P = algebra.get_symmetrizer(tableau)
            A = A + P

        #tableau = Young(G, part)
        #A = algebra.get_symmetrizer(tableau)

        print("partition:", part)
        #print("H:")
        #print(module.action(H))
        #print("V:")
        #print(module.action(V))

        print([g * A == A * g for g in algebra.basis])

        specht = []
        for v in algebra.basis:
            u = v * A
            specht.append(u.to_array())
        hom = Space(len(G), ring).endo_hom()
        specht = Map.from_array(specht, hom)
        specht = specht.image()
        #print(specht)
        dim = specht.shape[1]
        print("S(n)-algebra dim:", dim)

        if len(part) > d:
            continue

        print("A:", A)
        P = module.action(A)
        #P = P.transpose()
        P = P.image()
        print(P.longstr())

        print(P.shape)
        return
        print("multiplicity:", P.shape[1])

        src = P.src
        for v in src.get_basis():
            u = P * v
            #print(u.longstr())
            items = []
            for g in algebra.basis:
                g = module.action(g)
                w = g * u
                #print(w.longstr())
                items.append(w)
            A = find_span(items)
            print("dimension:", A.shape[1])
Example #4
0
#!/usr/bin/env python3
"""
Verifying that the normalizer of a subgroup is
the automorphism group of the corresponding G-set.
"""

from bruhat.action import Group, Perm
from bruhat.argv import argv

G = Group.symmetric(4)

print(len(G))

Hs = G.subgroups()

print(len(Hs))


def setpromote(items):
    if isinstance(items, Perm):
        items = {items}
    else:
        items = set(items)
    for item in items:
        assert isinstance(item, Perm)
    return items


def setmul(*itemss):
    items = itemss[0]
    items = setpromote(items)
Example #5
0
def super_young(U, V, part):
    ring = U.ring

    n = sum(part)

    lookup = {}
    summands = []
    for idxs in cross([(0, 1)] * n):
        spaces = [[U, V][idx] for idx in idxs]
        space = reduce(matmul, spaces)
        lookup[idxs] = len(summands)
        summands.append(space)
        #print(idxs, end=" ")
        #print(space.n)

    src = reduce(add, summands)

    G = Group.symmetric(n)
    hom = {}

    colim = src.identity()
    for action in G:
        perm = tuple(action[i] for i in range(n))
        #print(perm)
        sumswap = [None] * len(summands)
        fs = []
        for i, idxs in enumerate(cross([(0, 1)] * n)):
            jdxs = tuple(idxs[i] for i in perm)
            #print(idxs, "-->", jdxs)
            sumswap[lookup[jdxs]] = i
            space = src.items[i]
            f = space.get_swap(perm)
            fs.append(f)
        #print(sumswap)
        f = reduce(dsum, fs)
        #print(f.src.name, "-->", f.tgt.name)
        g = f.tgt.get_swap(sumswap)
        #print(g.src.name, "-->", g.tgt.name)
        assert f.tgt == g.src
        assert g.tgt == src
        hom[action] = (g, f)
        #print()

    young = Young(G, part)
    #print("Young:")
    #print(young)

    rowperms = young.get_rowperms()
    colperms = young.get_colperms()
    #print("rowperms", len(rowperms))
    #print("colperms", len(colperms))

    horiz = None
    for action in rowperms:
        (g, f) = hom[action]
        gf = g * f
        horiz = gf if horiz is None else (horiz + gf)
    assert horiz is not None

    vert = None
    for action in colperms:
        sign = action.sign() * ring.one
        g, f = hom[action]
        g = sign * g
        gf = g * f
        vert = gf if vert is None else (vert + gf)
    assert vert is not None
    P = horiz * vert

    P = P.row_reduce()
    #print(P.rank())
    #print(P)

    #for a in src.items:
    #    print(a)

    even = src.identity()
    odd = src.identity()
    i = 0
    j = 0
    for space in src.items:
        j += space.n
        while i < j:
            if space.grade % 2 == 0:
                odd[i, i] = ring.zero
            else:
                even[i, i] = ring.zero
            i += 1

    return (P * even).rank(), (P * odd).rank()
Example #6
0
def main():

    ring = element.Q
    zero = ring.zero
    one = ring.one

    n = argv.get("n", 3)
    if argv.cyclic:
        G = Group.cyclic(n)
    else:
        G = Group.symmetric(n)

    comm = G.is_abelian()

    print(G)

    d = len(G)
    K = Space(ring, 1, name="K")
    V = Space(ring, d, name="V")
    VV = V @ V

    scalar = K.identity()
    I = V.identity()
    swap = VV.get_swap()

    lunit = Lin(V, K @ V, elim.identity(ring, d))
    runit = Lin(V, V @ K, elim.identity(ring, d))

    cap = Lin(K, V @ V)  # tgt, src
    cup = Lin(V @ V, K)  # tgt, src
    for i in range(d):
        cup[i + d * i, 0] = one
        cap[0, i + d * i] = one

    # green spiders
    g_ = Lin(K, V)  # uniform discard
    _g = Lin(V, K)  # uniform create
    g_gg = Lin(VV, V)  # copy
    gg_g = Lin(V, VV)  # pointwise mul

    for i in range(d):
        g_[0, i] = one
        _g[i, 0] = one
        g_gg[i + d * i, i] = one
        gg_g[i, i + d * i] = one

    eq = lambda lhs, rhs: lhs.weak_eq(rhs)

    assert eq(g_gg >> (g_ @ I), I)  # counit
    assert eq(g_gg >> (I @ g_), I)  # counit
    assert eq(g_gg >> (g_gg @ I), g_gg >> (I @ g_gg))  # coassoc

    assert eq(gg_g * (_g @ I), I)  # unit
    assert eq(gg_g * (I @ _g), I)  # unit
    assert eq(gg_g * (gg_g @ I), gg_g * (I @ gg_g))  # assoc

    assert eq((g_gg @ I) >> (I @ gg_g), (I @ g_gg) >> (gg_g @ I))  # frobenius
    assert eq((g_gg @ I) >> (I @ gg_g), gg_g >> g_gg)  # extended frobenius

    assert eq(_g >> g_, d * scalar)

    assert eq(gg_g >> g_, cap)
    assert eq(_g >> g_gg, cup)

    # red spiders
    r_ = Lin(K, V)  # discard unit
    _r = Lin(V, K)  # create unit
    r_rr = Lin(VV, V)  # comul
    rr_r = Lin(V, VV)  # mul

    # hopf involution
    inv = Lin(V, V)

    lookup = dict((v, k) for (k, v) in enumerate(G))
    for i in range(d):
        g = G[i]
        if g.is_identity():
            r_[0, i] = one
            _r[i, 0] = one
        inv[lookup[~g], i] = one

        for j in range(d):
            h = G[j]
            gh = g * h
            k = lookup[gh]
            rr_r[k, i + j * d] = one
            r_rr[i + j * d, k] = one

    assert eq(r_rr >> (r_ @ I), I)  # unit
    assert eq(r_rr >> (I @ r_), I)  # unit
    assert eq(r_rr >> (r_rr @ I), r_rr >> (I @ r_rr))  # assoc

    assert eq(rr_r * (_r @ I), I)  # unit
    assert eq(rr_r * (I @ _r), I)  # unit
    assert eq(rr_r * (rr_r @ I), rr_r * (I @ rr_r))  # assoc

    assert eq((r_rr @ I) >> (I @ rr_r), (I @ r_rr) >> (rr_r @ I))  # frobenius
    assert eq((r_rr @ I) >> (I @ rr_r), rr_r >> r_rr)  # extended frobenius

    assert eq((_r >> r_), scalar)

    assert not eq(rr_r >> r_, cap)
    assert not eq(_r >> r_rr, cup)

    # K[G] is a bialgebra
    assert eq(rr_r >> g_, g_ @ g_)
    assert eq(_r >> g_gg, _r @ _r)
    assert eq(_r >> g_, scalar)
    if not argv.skip:
        assert eq(rr_r >> g_gg, (g_gg @ g_gg) >> (I @ swap @ I) >>
                  (rr_r @ rr_r))
    print("K[G] is comm  ", eq(swap >> rr_r, rr_r))
    print("K[G] is cocomm", eq(g_gg >> swap, g_gg))

    # K[G] is hopf
    rhs = g_ >> _r
    assert eq(g_gg >> (I @ inv) >> rr_r, rhs)
    assert eq(g_gg >> (inv @ I) >> rr_r, rhs)

    # k^G is a bialgebra
    assert eq(gg_g >> r_, r_ @ r_)
    assert eq(_g >> r_rr, _g @ _g)
    assert eq(_g >> r_, scalar)
    if not argv.skip:
        assert eq(gg_g >> r_rr, (r_rr @ r_rr) >> (I @ swap @ I) >>
                  (gg_g @ gg_g))

    # k^G is hopf
    rhs = r_ >> _g
    assert eq(r_rr >> (I @ inv) >> gg_g, rhs)
    assert eq(r_rr >> (inv @ I) >> gg_g, rhs)
    print("k^G is comm   ", eq(swap >> gg_g, gg_g))
    print("k^G is cocomm ", eq(r_rr >> swap, r_rr))

    #print(rr_r)
    #print(r_rr)

    # unimodular
    r_cup = _r >> r_rr
    g_cap = gg_g >> g_
    assert eq(r_cup >> (I @ g_), _g)
    assert eq(r_cup >> (g_ @ I), _g)
    assert eq((I @ _r) >> g_cap, r_)
    assert eq((_r @ I) >> g_cap, r_)
    assert eq(inv, (I @ r_cup) >> (swap @ I) >> (I @ g_cap))
    assert eq(inv, (r_cup @ I) >> (I @ swap) >> (g_cap @ I))

    assert eq(r_rr >> rr_r, d * I)
    assert eq(g_gg >> gg_g, I)  # special

    # complementary frobenius structures ?
    # Heunen & Vicary eq (6.4)
    lhs = (_r @ I) >> (r_rr @ g_gg) >> (I @ gg_g @ I) >> (I @ g_ @ I) >> (
        I @ lunit) >> rr_r
    rhs = g_ >> _r
    assert eq(lhs, rhs)

    lhs = (I @ _r) >> (r_rr @ g_gg) >> (I @ gg_g @ I) >> (I @ g_ @ I) >> (
        I @ lunit) >> rr_r
    #assert eq(lhs, rhs) # FAIL

    lhs = (_g @ I) >> (g_gg @ r_rr) >> (I @ rr_r @ I) >> (I @ r_ @ I) >> (
        I @ lunit) >> gg_g
    rhs = r_ >> _g
    assert eq(lhs, rhs)

    lhs = (I @ _g) >> (g_gg @ r_rr) >> (I @ rr_r @ I) >> (I @ r_ @ I) >> (
        I @ lunit) >> gg_g
    #assert eq(lhs, rhs) # FAIL

    # Heunen & Vicary eq (6.5)
    lhs = (_r @ I) >> (r_rr @ I) >> (I @ gg_g) >> (I @ g_)
    rhs = (I @ _r) >> (I @ r_rr) >> (gg_g @ I) >> (g_ @ I)
    assert eq(lhs, rhs)

    lhs = (_g @ I) >> (g_gg @ I) >> (I @ rr_r) >> (I @ r_)
    rhs = (I @ _g) >> (I @ g_gg) >> (rr_r @ I) >> (r_ @ I)
    assert eq(lhs, rhs)

    assert eq(r_rr, r_rr >> swap) == G.is_abelian()
    assert eq(rr_r, swap >> rr_r) == G.is_abelian()

    assert eq(_r >> r_rr, _r >> r_rr >> swap)
    assert eq(rr_r >> r_, swap >> rr_r >> r_)