Research Atlas

Главная / Пять размерностей одного геометрического фактора / Альтернативный расчёт коядра

Программа · Python

Альтернативный расчёт коядра

Пять размерностей одного геометрического фактора

Программа · Pythoncheck_fixed_exterior_cokernel_independent.py
from collections import defaultdict
from itertools import combinations
from math import comb
from pathlib import Path
from runpy import run_path

LAB = Path(__file__).resolve().parent.parent
S = run_path(str(LAB/'rh2253_rank_six_D42_fixed_exterior_module'/'compute_exterior_cokernel.py'))
key = S['key']
plus = S['plus']
diff = S['diff']
subtract = S['subtract']
divides = S['divides']
C = tuple(combinations(range(8),2))
N = 28


def normal_form(poly,basis):
    residual={}
    indexed = [[(max(v,key=key),v) for v in basis if max(v,key=key)[1]==pos]
               for pos in range(N)]
    while poly:
        term=max(poly,key=key)
        exponent,pos=term
        coefficient=poly[term]
        for (lead,_),vector in indexed[pos]:
            if divides(lead,exponent):
                subtract(poly,coefficient,diff(exponent,lead),vector)
                break
        else:
            residual[term]=poly.pop(term)
    return residual


def initial_numerator(initial):
    ans=defaultdict(int)
    for comp in initial.values():
        minimal=[]
        for m in sorted({x for x,_ in comp},key=sum):
            if any(divides(a,m) for a in minimal): continue
            minimal.append(m)
        for n in range(1,len(minimal)+1):
            for group in combinations(minimal,n):
                m=tuple(max(row[j] for row in group) for j in range(7))
                ans[sum(m)]+=(-1)**n
    ans[0]+=N
    return {m:k for m,k in ans.items() if k}


cases=((6,(7,[]),219265080),(5,(7,[]),219270570),
       (6,(2,[]),219272430),(6,(2,[(4,1)]),219269935),
       (5,(3,[]),219363657))
for kind,relation,expected in cases:
    original=list(S['generators'](kind,relation))
    basis,init,_=S['groebner'](copy.copy() for copy in original)
    # The source builds these vectors from exact remainders, so they
    # already belong to the original module. Independently check the
    # reverse inclusion and every Buchberger critical pair in the final
    # basis, including those added during the mutable pair enumeration.
    assert all(not normal_form(poly.copy(),basis) for poly in original)
    checks=0
    for comp in init.values():
        for (a,i),(b,j) in combinations(comp,2):
            lcm=tuple(max(x,y) for x,y in zip(a,b))
            v={}
            subtract(v,-1,diff(lcm,a),basis[i])
            subtract(v,1,diff(lcm,b),basis[j])
            assert not normal_form(v,basis)
            checks+=1
    h=initial_numerator(init)
    assert h==S['hilbert_numerator'](init)
    total=0
    for d,mult in ((41,21),(40,-7),(39,1)):
        total+=mult*sum(coef*comb(d+6-pow,6) for pow,coef in h.items() if pow<=d)
    assert total==expected
    print(kind,relation,'verified final S-pairs:',checks,'quotient:',total)

Исходные технические записи отражают состояние работы на дату их составления. Уточнения и итоговый вывод приведены в статье.

Контрольная сумма оригинала · SHA-2561fb13fe4976f98b372516d1685d70331c1148ff6d78a49fc5e144e78d8dee9e5