Indexed text attachment
verify-topology.py
Source for Algebraic and Differential Topology in Higher Categories
View paper · Download original file
Lines 1181–1280 of 1961. Source text is displayed literally.
1181 lhs = mat_mul(PK.bd(d + 1), P)1182 if d > 0:1183 Pm = [[0] * K.n(d - 1) for _ in range(PK.n(d))]1184 for j, x in enumerate(K.S[d - 1]):1185 for i in range(d):1186 Pm[PK.idx[d][x[:i + 1] + tuple(v + N for v in x[i:])]][j] = (-1) ** i1187 lhs = [[a + b for a, b in zip(r, q)] for r, q in zip(lhs, mat_mul(Pm, K.bd(d)))]1188 okpr = okpr and mat_eq(lhs, mat_sub(i1, i0))1189check('P1 the cylindric construction: the prism operator P satisfies dP + Pd = top - bottom', okpr, 'icosahedron, torus, projective plane, Klein bottle')1190 1191PR, _ = prism(RP2)1192PM, _ = prism(MB)1193check('P2 the cylinder on a complex has the homology of the complex, torsion included', homology(PR)[:3] == homology(RP2) and homology(PR)[3] == (0, []) and bettis(PM) == [1, 1, 0, 0],1194 'projective plane times interval: %s' % homology(PR))1195 1196 1197def choice_map(K, num):1198 inv_ = {i: x for x, i in num.items()}1199 return {i: random.choice(inv_[i]) for i in inv_}1200 1201 1202okcont = True1203found = 01204for K in (T7, RP2, MB, ICO):1205 SK, num = sd(K)1206 for _ in range(3):1207 f, g = choice_map(K, num), choice_map(K, num)1208 contig = all(tuple(sorted(set(f[a] for a in x) | set(g[a] for a in x))) in K.idx.get(len(set(f[a] for a in x) | set(g[a] for a in x)) - 1, {}) for d in SK.S for x in SK.S[d])1209 found += contig1210 for d in range(1, K.dim + 1):1211 Bd = K.bd(d + 1) if d < K.dim else []1212 Bbasis = independent_extend([], [[Fr(v) for v in c] for c in zip(*Bd)]) if Bd and Bd[0] else []1213 F, G = chain_map(SK, K, f, d), chain_map(SK, K, g, d)1214 for z in nullspace(SK.bd(d), SK.n(d)):1215 diff = [sum((F[i][k] - G[i][k]) * z[k] for k in range(SK.n(d))) for i in range(K.n(d))]1216 okcont = okcont and not independent_extend(Bbasis, [diff])1217check('P3 contiguous simplicial maps induce the same map on homology: any two vertex-choice maps from the subdivision to the complex', okcont and found == 12,1218 '%d pairs, all contiguous, on the torus, the projective plane, the Moebius band and the icosahedron' % found)1219 1220disc, _ = cone(circle(8))1221check('P4 homotopy equivalent polyhedra have the same homology: Moebius band and circle (1,1); disc and point',1222 bettis(MB) == [1, 1, 0] and bettis(circle(5)) == [1, 1] and bettis(disc) == [1, 0, 0], 'the band has the Euler characteristic 0 of its core circle')1223 1224sec('6. Traces and fixed points')1225 1226 1227def automorphisms_affine7():1228 out = []1229 tri = set(T7.S[2])1230 for a in range(1, 7):1231 for b in range(7):1232 vm = {x: (a * x + b) % 7 for x in range(7)}1233 if all(tuple(sorted(vm[v] for v in t)) in tri for t in tri):1234 out.append(((a, b), vm))1235 return out1236 1237 1238AUT = automorphisms_affine7()1239okht = all(lefschetz_chain(T7, vm) == lefschetz_hom(T7, vm) for _, vm in AUT)1240Ls = sorted(set(lefschetz_chain(T7, vm) for _, vm in AUT))1241check('L1 Hopf trace formula: the alternating trace on chains equals the alternating trace on homology', okht,1242 '%d affine automorphisms of the 7-vertex torus; Lefschetz numbers occurring: %s' % (len(AUT), Ls))1243 1244 1245def has_fixed_simplex(K, vm):1246 return any(tuple(sorted(vm[v] for v in x)) == x for d in K.S for x in K.S[d])1247 1248 1249okfp = all(has_fixed_simplex(T7, vm) for _, vm in AUT if lefschetz_chain(T7, vm) != 0)1250free = [ab for ab, vm in AUT if not has_fixed_simplex(T7, vm)]1251check('L2 Lefschetz: a simplicial map with non-zero Lefschetz number fixes a simplex setwise, hence a point; the translations have L = 0 and fix nothing',1252 okfp and all(lefschetz_chain(T7, vm) == 0 for ab, vm in AUT if ab in free) and len(free) >= 6, '%d automorphisms without fixed simplex: %s' % (len(free), free[:8]))1253 1254check('L3 the Lefschetz number of the identity is the Euler characteristic',1255 all(lefschetz_chain(K, {x[0]: x[0] for x in K.S[0]}) == K.chi() == lefschetz_hom(K, {x[0]: x[0] for x in K.S[0]}) for _, K in NAMED), 'six model complexes')1256 1257 1258def det2(M):1259 return M[0][0] * M[1][1] - M[0][1] * M[1][0]1260 1261 1262def torus_fixed(A):1263 """number of points x of R^2/Z^2 with Ax = x, by enumeration"""1264 B = [[A[0][0] - 1, A[0][1]], [A[1][0], A[1][1] - 1]]1265 D = abs(det2(B))1266 if D == 0:1267 return None1268 cnt = 01269 for i in range(D):1270 for j in range(D):1271 if (B[0][0] * i + B[0][1] * j) % D == 0 and (B[1][0] * i + B[1][1] * j) % D == 0:1272 cnt += 11273 return cnt1274 1275 1276oktf = True1277for _ in range(40):1278 A = [[random.randint(-3, 3) for _ in range(2)] for _ in range(2)]1279 L = 1 - (A[0][0] + A[1][1]) + det2(A)1280 n = torus_fixed(A)