from sage.all import * import itertools load('aplK.py') load("minimalModel_parallel.py") S = simplicial_complexes.K3Surface() S.set_immutable() cochainComplex = S.chain_complex(base_ring=QQ).dual() A = AlgebraAplK(S) smodel = load("Sullivan_model_K3_deg3.sobj") smorphism = load("model_morphism_K3_deg3.sobj") #cohomology_correspondence = load("cohomology_correspondence_K3_deg3.sobj") #smodel_basis_3 = smodel.basis(3) smodel_basis_2 = smodel.basis(2) #H = S.cohomology_ring(QQ) """ for g in smodel_basis_3: a = smorphism[3][str(g)] dg = g.differential() print("AplK Differential validation: generator "+str(g), flush=True) success = phi_polinomial(dg,smorphism,A) == a.differential() if success: print(success, flush=True) else: raise Exception("the differential and the model morphism do not commute") #################### cf = A.cochain_to_vector(a.integral(),3) cg = A.cochain_to_vector(a.differential().integral(),4) print("Cochain Complex Differential validation of element associated to generator "+str(g), flush=True) success = cochainComplex.differential(3)*cf == cg if success: print(success, flush=True) else: raise Exception("the aplk and cochain complex differentials do not commute") """ from sage.homology.algebraic_topological_model import algebraic_topological_model phi, M = algebraic_topological_model(S, QQ) # https://doc.sagemath.org/pdf/en/reference/homology/homology.pdf """ H = S.cohomology_ring(base_ring=QQ) g20 = H.basis()[(2,0)] g21 = H.basis()[(2,1)] g20.cup_product(g20) 2*h^{4,0} sage: g21.cup_product(g21) 2*h^{4,0} for i in range(22): for j in range(i,22): g1 = H.basis()[(2,i)] g2 = H.basis()[(2,j)] hsuccess = g1.cup_product(g2) == g2.cup_product(g1) if not hsuccess: print("producto diferente: (", str(i)+","+str(j)+")", flush=True) """ """ sage: S = simplicial_complexes.K3Surface() sage: S Minimal triangulation of the K3 surface sage: C = S.chain_complex().dual() sage: H = S.cohomology_ring(base_ring=QQ) sage: H.contraction? sage: phi = H.contraction().dual() sage: p = phi.pi() sage: iota = phi.iota() sage: M = iota.domain() sage: p2 = p.to_matrix(2) sage: p2 22 x 560 dense matrix over Rational Field (use the '.str()' method to see the entries) sage: g20 = H.basis()[(2,0)] sage: c20 = g20.to_cycle() sage: v20 = c20.to_vector() sage: m20 = p2*v20 sage: m20 (58, 14, 19, 31, -18, -6, -60, 61, 40, 2, 58, -26, -11, -14, 15, -110, 133, 20, -28, 68, -14, 15) sage: g21 = H.basis()[(2,1)] sage: c21 = g21.to_cycle() sage: v21 = c21.to_vector() sage: m21 = p2*v21 sage: m = matrix(QQ,[m20,m21]) sage: m.rank() 2 """ """ # coordinates of the cohomology generator h^(2,0) # equivalent to h^(2,0).to_cycle().to_vector() sage: vec = H.contraction().iota().in_degree(2).column(0) sage: chains = S.n_chains(2, H.base_ring(), cochains=H._cohomology) sage: chains.from_vector(vec) sage: chains.from_vector(vec) == g20.to_cycle() True """ """ sage: V = H.contraction().iota().in_degree(2).column_space() sage: V.coordinate_vector(g20.to_cycle().to_vector()) (-1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0) ################################################################################## sage: p = H.contraction().pi() sage: m = p.to_matrix(2) sage: m 22 x 560 dense matrix over Rational Field (use the '.str()' method to see the entries) sage: v20 = g20.to_cycle().to_vector() sage: m*v20 (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) sage: v21 = c21.to_vector() sage: m*v21 (0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) """ C2 = S.n_chains(2,QQ,cochains=True) basis2 = C2.basis() C4 = S.n_chains(4,QQ,cochains=True) basis4 = C4.basis() for i in range(len(smodel_basis_2)): for j in range(i, len(smodel_basis_2)): g1 = smodel_basis_2[i] g2 = smodel_basis_2[j] a1 = smorphism[2][str(g1)] a2 = smorphism[2][str(g2)] cA1 = a1.integral() dA1 = C2.zero() for k in basis2.keys(): dA1 += basis2[k]*cA1[k.tuple()] cA2 = a2.integral() dA2 = C2.zero() for k in basis2.keys(): dA2 += basis2[k]*cA2[k.tuple()] dA12 = dA1.cup_product(dA2) a4 = a1*a2 dA4 = C4.zero() cA4 = a4.integral() for k in basis4.keys(): dA4 += basis4[k]*cA4[k.tuple()] success = dA12 == dA4 if success: print("cup product commutes for elements " + str(g1) + " and " + str(g2), flush=True) print(success, flush=True) else: print("dA12", flush=True) print(dA12) print("dA4", flush=True) print(dA4) raise Exception("the aplk and cup products do not commute")