File: HapTutorial.tex

package info (click to toggle)
gap-hap 1.70%2Bds-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 56,612 kB
  • sloc: xml: 16,139; sh: 216; javascript: 155; makefile: 126; ansic: 47; perl: 36
file content (10953 lines) | stat: -rw-r--r-- 569,901 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
% generated by GAPDoc2LaTeX from XML source (Frank Luebeck)
\documentclass[a4paper,11pt]{report}

\usepackage[top=37mm,bottom=37mm,left=27mm,right=27mm]{geometry}
\sloppy
\pagestyle{myheadings}
\usepackage{amssymb}
\usepackage[latin1]{inputenc}
\usepackage{makeidx}
\makeindex
\usepackage{color}
\definecolor{FireBrick}{rgb}{0.5812,0.0074,0.0083}
\definecolor{RoyalBlue}{rgb}{0.0236,0.0894,0.6179}
\definecolor{RoyalGreen}{rgb}{0.0236,0.6179,0.0894}
\definecolor{RoyalRed}{rgb}{0.6179,0.0236,0.0894}
\definecolor{LightBlue}{rgb}{0.8544,0.9511,1.0000}
\definecolor{Black}{rgb}{0.0,0.0,0.0}

\definecolor{linkColor}{rgb}{0.0,0.0,0.554}
\definecolor{citeColor}{rgb}{0.0,0.0,0.554}
\definecolor{fileColor}{rgb}{0.0,0.0,0.554}
\definecolor{urlColor}{rgb}{0.0,0.0,0.554}
\definecolor{promptColor}{rgb}{0.0,0.0,0.589}
\definecolor{brkpromptColor}{rgb}{0.589,0.0,0.0}
\definecolor{gapinputColor}{rgb}{0.589,0.0,0.0}
\definecolor{gapoutputColor}{rgb}{0.0,0.0,0.0}

%%  for a long time these were red and blue by default,
%%  now black, but keep variables to overwrite
\definecolor{FuncColor}{rgb}{0.0,0.0,0.0}
%% strange name because of pdflatex bug:
\definecolor{Chapter }{rgb}{0.0,0.0,0.0}
\definecolor{DarkOlive}{rgb}{0.1047,0.2412,0.0064}


\usepackage{fancyvrb}

\usepackage{mathptmx,helvet}
\usepackage[T1]{fontenc}
\usepackage{textcomp}


\usepackage[
            pdftex=true,
            bookmarks=true,        
            a4paper=true,
            pdftitle={Written with GAPDoc},
            pdfcreator={LaTeX with hyperref package / GAPDoc},
            colorlinks=true,
            backref=page,
            breaklinks=true,
            linkcolor=linkColor,
            citecolor=citeColor,
            filecolor=fileColor,
            urlcolor=urlColor,
            pdfpagemode={UseNone}, 
           ]{hyperref}

\newcommand{\maintitlesize}{\fontsize{50}{55}\selectfont}

% write page numbers to a .pnr log file for online help
\newwrite\pagenrlog
\immediate\openout\pagenrlog =\jobname.pnr
\immediate\write\pagenrlog{PAGENRS := [}
\newcommand{\logpage}[1]{\protect\write\pagenrlog{#1, \thepage,}}
%% were never documented, give conflicts with some additional packages

\newcommand{\GAP}{\textsf{GAP}}

%% nicer description environments, allows long labels
\usepackage{enumitem}
\setdescription{style=nextline}

%% depth of toc
\setcounter{tocdepth}{1}





%% command for ColorPrompt style examples
\newcommand{\gapprompt}[1]{\color{promptColor}{\bfseries #1}}
\newcommand{\gapbrkprompt}[1]{\color{brkpromptColor}{\bfseries #1}}
\newcommand{\gapinput}[1]{\color{gapinputColor}{#1}}


\begin{document}

\logpage{[ 0, 0, 0 ]}
\begin{titlepage}
\mbox{}\vfill

\begin{center}{\maintitlesize \textbf{A HAP tutorial\mbox{}}}\\
\vfill

\hypersetup{pdftitle=A HAP tutorial}
\markright{\scriptsize \mbox{}\hfill A HAP tutorial \hfill\mbox{}}
{\Huge \textbf{(See also an \href{../www/SideLinks/About/aboutContents.html} {older tutorial} or \href{comp.pdf} {mini\texttt{\symbol{45}}course notes} or related \href{https://global.oup.com/academic/product/an-invitation-to-computational-homotopy-9780198832980} {book}) \href{../www/index.html} {The \textsc{HAP} home page is here}\mbox{}}}\\
\vfill

\mbox{}\\[2cm]
{\Large \textbf{Graham Ellis\mbox{}}}\\
\hypersetup{pdfauthor=Graham Ellis}
\end{center}\vfill

\mbox{}\\
\end{titlepage}

\newpage\setcounter{page}{2}
\newpage

\def\contentsname{Contents\logpage{[ 0, 0, 1 ]}}

\tableofcontents
\newpage

 
\chapter{\textcolor{Chapter }{Simplicial complexes \& CW complexes}}\logpage{[ 1, 0, 0 ]}
\hyperdef{L}{X7E5EA9587D4BCFB4}{}
{
 
\section{\textcolor{Chapter }{The Klein bottle as a simplicial complex}}\logpage{[ 1, 1, 0 ]}
\hyperdef{L}{X85691C6980034524}{}
{
 

  

 The following example constructs the Klein bottle as a simplicial complex $K$ on $9$ vertices, and then constructs the cellular chain complex $C_\ast=C_\ast(K)$ from which the integral homology groups $H_1(K,\mathbb Z)=\mathbb Z_2\oplus \mathbb Z$, $H_2(K,\mathbb Z)=0$ are computed. The chain complex $D_\ast=C_\ast \otimes_{\mathbb Z} \mathbb Z_2$ is also constructed and used to compute the mod\texttt{\symbol{45}}$2$ homology vector spaces $H_1(K,\mathbb Z_2)=\mathbb Z_2\oplus \mathbb Z_2$, $H_2(K,\mathbb Z)=\mathbb Z_2$. Finally, a presentation $\pi_1(K) = \langle x,y : yxy^{-1}x\rangle$ is computed for the fundamental group of $K$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@2simplices:=|
  !gapprompt@>| !gapinput@[[1,2,5], [2,5,8], [2,3,8], [3,8,9], [1,3,9], [1,4,9],|
  !gapprompt@>| !gapinput@ [4,5,8], [4,6,8], [6,8,9], [6,7,9], [4,7,9], [4,5,7],|
  !gapprompt@>| !gapinput@ [1,4,6], [1,2,6], [2,6,7], [2,3,7], [3,5,7], [1,3,5]];;|
  !gapprompt@gap>| !gapinput@K:=SimplicialComplex(2simplices);|
  Simplicial complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@C:=ChainComplex(K);|
  Chain complex of length 2 in characteristic 0 .
  
  !gapprompt@gap>| !gapinput@Homology(C,1);|
  [ 2, 0 ]
  !gapprompt@gap>| !gapinput@Homology(C,2);|
  [  ]
  
  !gapprompt@gap>| !gapinput@D:=TensorWithIntegersModP(C,2);|
  Chain complex of length 2 in characteristic 2 .
  
  !gapprompt@gap>| !gapinput@Homology(D,1);|
  2
  !gapprompt@gap>| !gapinput@Homology(D,2);|
  1
  
  !gapprompt@gap>| !gapinput@G:=FundamentalGroup(K);|
  <fp group of size infinity on the generators [ f1, f2 ]>
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(G);|
  [ f2*f1*f2^-1*f1 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Other simplicial surfaces}}\logpage{[ 1, 2, 0 ]}
\hyperdef{L}{X7B8F88487B1B766C}{}
{
 The following example constructs the real projective plane $P$, the Klein bottle $K$ and the torus $T$ as simplicial complexes, using the surface genus $g$ as input in the oriented case and $-g$ as input in the unoriented cases. It then confirms that the connected sums $M=K\#P$ and $N=T\#P$ have the same integral homology. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=ClosedSurface(-1);|
  Simplicial complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@K:=ClosedSurface(-2);|
  Simplicial complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@T:=ClosedSurface(1);|
  Simplicial complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@M:=ConnectedSum(K,P);|
  Simplicial complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@N:=ConnectedSum(T,P);|
  Simplicial complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@Homology(M,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(N,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(M,1);|
  [ 2, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(N,1);|
  [ 2, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(M,2);|
  [  ]
  !gapprompt@gap>| !gapinput@Homology(N,2);|
  [  ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{The Quillen complex}}\logpage{[ 1, 3, 0 ]}
\hyperdef{L}{X80A72C347D99A58E}{}
{
 

 Given a group $G $ one can consider the partially ordered set ${\cal A}_p(G)$ of all non\texttt{\symbol{45}}trivial elementary abelian $p$\texttt{\symbol{45}}subgroups of $G$, the partial order being set inclusion. The order complex $\Delta{\cal A}_p(G)$ is a simplicial complex which is called the \emph{Quillen complex }. 

 The following example constructs the Quillen complex $\Delta{\cal A}_2(S_7)$ for the symmetric group of degree $7$ and $p=2$. This simplicial complex involves $11291$ simplices, of which $4410$ are $2$\texttt{\symbol{45}}simplices.. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=QuillenComplex(SymmetricGroup(7),2);A
  Simplicial complex of dimension 2.
  
  @gapprompt|gap>A @gapinput|Size(K);A
  11291
  
  @gapprompt|gap>A @gapinput|K!.nrSimplices(2);A
  4410
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{The Quillen complex as a reduced CW\texttt{\symbol{45}}complex}}\logpage{[ 1, 4, 0 ]}
\hyperdef{L}{X7C4A2B8B79950232}{}
{
 Any simplicial complex $K$ can be regarded as a regular CW complex. Different datatypes are used in \textsc{HAP} for these two notions. The following continuation of the above Quillen complex
example constructs a regular CW complex $Y$ isomorphic to (i.e. with the same face lattice as) $K=\Delta{\cal A}_2(S_7)$. An advantage to working in the category of CW complexes is that it may be
possible to find a CW complex $X$ homotopy equivalent to $Y$ but with fewer cells than $Y$. The cellular chain complex $C_\ast(X)$ of such a CW complex $X$ is computed by the following commands. From the number of free generators of $C_\ast(X)$, which correspond to the cells of $X$, we see that there is a single $0$\texttt{\symbol{45}}cell and $160$ $2$\texttt{\symbol{45}}cells. Thus the Quillen complex
\$\$\texttt{\symbol{92}}Delta\texttt{\symbol{123}}\texttt{\symbol{92}}cal
A\texttt{\symbol{125}}{\textunderscore}2(S{\textunderscore}7)
\texttt{\symbol{92}}simeq
\texttt{\symbol{92}}bigvee{\textunderscore}\texttt{\symbol{123}}1\texttt{\symbol{92}}le
i\texttt{\symbol{92}}le 160\texttt{\symbol{125}} S\texttt{\symbol{94}}2\$\$
has the homotopy type of a wedge of $160$ $2$\texttt{\symbol{45}}spheres. This homotopy equivalence is given in \cite[(15.1)]{ksontini} where it was obtained by purely theoretical methods. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|Y:=RegularCWComplex(K);A
  Regular CW-complex of dimension 2
  
  @gapprompt|gap>A @gapinput|C:=ChainComplex(Y);A
  Chain complex of length 2 in characteristic 0 . 
  
  @gapprompt|gap>A @gapinput|C!.dimension(0);A
  1
  @gapprompt|gap>A @gapinput|C!.dimension(1);A
  0
  @gapprompt|gap>A @gapinput|C!.dimension(2);A
  160
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Simple homotopy equivalences}}\logpage{[ 1, 5, 0 ]}
\hyperdef{L}{X782AAB84799E3C44}{}
{
 

For any regular CW complex $Y$ one can look for a sequence of simple homotopy collapses $Y\searrow Y_1 \searrow Y_2 \searrow \ldots \searrow Y_N=X$ with $X$ a smaller, and typically non\texttt{\symbol{45}}regular, CW complex. Such a
sequence of collapses can be recorded using what is now known as a \emph{discrete vector field} on $Y$. The sequence can, for example, be used to produce a chain homotopy
equivalence $f\colon C_\ast Y \rightarrow C_\ast X$ and its chain homotopy inverse $g\colon C_\ast X \rightarrow C_\ast Y$. The function \texttt{ChainComplex(Y)} returns the cellular chain complex $C_\ast(X)$, wheras the function \texttt{ChainComplexOfRegularCWComplex(Y)} returns the chain complex $C_\ast(Y)$. 

 For the above Quillen complex $Y=\Delta{\cal A}_2(S_7)$ the following commands produce the chain homotopy equivalence $f\colon C_\ast Y \rightarrow C_\ast X$ and $g\colon C_\ast X \rightarrow C_\ast Y$. The number of generators of $C_\ast Y$ equals the number of cells of $Y$ in each degree, and this number is listed for each degree. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=QuillenComplex(SymmetricGroup(7),2);;A
  @gapprompt|gap>A @gapinput|Y:=RegularCWComplex(K);;A
  @gapprompt|gap>A @gapinput|CY:=ChainComplexOfRegularCWComplex(Y);A
  Chain complex of length 2 in characteristic 0 . 
  
  @gapprompt|gap>A @gapinput|CX:=ChainComplex(Y);A
  Chain complex of length 2 in characteristic 0 . 
  
  @gapprompt|gap>A @gapinput|equiv:=ChainComplexEquivalenceOfRegularCWComplex(Y);;A
  @gapprompt|gap>A @gapinput|f:=equiv[1];A
  Chain Map between complexes of length 2 . 
  
  @gapprompt|gap>A @gapinput|g:=equiv[2];A
  Chain Map between complexes of length 2 .
  
  
  @gapprompt|gap>A @gapinput|CY!.dimension(0);A
  1316
  @gapprompt|gap>A @gapinput|CY!.dimension(1);A
  5565
  @gapprompt|gap>A @gapinput|CY!.dimension(2);A
  4410
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cellular simplifications preserving homeomorphism type}}\logpage{[ 1, 6, 0 ]}
\hyperdef{L}{X80474C7885AC1578}{}
{
  

For some purposes one might need to simplify the cell structure on a regular
CW\texttt{\symbol{45}}complex $Y$ so as to obtained a homeomorphic CW\texttt{\symbol{45}}complex $W$ with fewer cells. 

The following commands load a $4$\texttt{\symbol{45}}dimensional simplicial complex $Y$ representing the K3 complex surface. Its simplicial structure is taken from \cite{spreerkhuenel} and involves $1704$ cells of various dimensions. The commands then convert the cell structure into
that of a homeomorphic regular CW\texttt{\symbol{45}}complex $W$ involving $774$ cells. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=RegularCWComplex(SimplicialK3Surface());|
  Regular CW-complex of dimension 4
  
  !gapprompt@gap>| !gapinput@Size(Y);|
  1704
  !gapprompt@gap>| !gapinput@W:=SimplifiedComplex(Y);|
  Regular CW-complex of dimension 4
  
  !gapprompt@gap>| !gapinput@Size(W);|
  774
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Constructing a CW\texttt{\symbol{45}}structure on a knot complement}}\logpage{[ 1, 7, 0 ]}
\hyperdef{L}{X7A15484C7E680AC9}{}
{
 The following commands construct the complement $M=S^3\setminus K$ of the trefoil knot $K$. This complement is returned as a $3$\texttt{\symbol{45}}manifold $M$ with regular CW\texttt{\symbol{45}}structure involving four $3$\texttt{\symbol{45}}cells. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|arc:=ArcPresentation(PureCubicalKnot(3,1));B
  [ [ 2, 5 ], [ 1, 3 ], [ 2, 4 ], [ 3, 5 ], [ 1, 4 ] ]
  @gapprompt|gap>B @gapinput|S:=SphericalKnotComplement(arc);B
  Regular CW-complex of dimension 3
  
  @gapprompt|gap>B @gapinput|S!.nrCells(3);B
  4
  
\end{Verbatim}
 The following additional commands then show that $M$ is homotopy equivalent to a reduced CW\texttt{\symbol{45}}complex $Y$ of dimension $2$ involving one $0$\texttt{\symbol{45}}cell, two $1$\texttt{\symbol{45}}cells and one $2$\texttt{\symbol{45}}cell. The fundamental group of $Y$ is computed and used to calculate the Alexander polynomial of the trefoil
knot. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=ContractedComplex(S);|
  Regular CW-complex of dimension 2
  
  !gapprompt@gap>| !gapinput@CriticalCells(Y);|
  [ [ 2, 1 ], [ 1, 9 ], [ 1, 11 ], [ 0, 22 ] ]
  !gapprompt@gap>| !gapinput@G:=FundamentalGroup(Y);;|
  !gapprompt@gap>| !gapinput@AlexanderPolynomial(G);|
  x_1^2-x_1+1
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Constructing a regular CW\texttt{\symbol{45}}complex by attaching cells}}\logpage{[ 1, 8, 0 ]}
\hyperdef{L}{X829793717FB6DDCE}{}
{
 

  

The following example creates the projective plane $Y$ as a regular CW\texttt{\symbol{45}}complex, and tests that it has the correct
integral homology $H_0(Y,\mathbb Z)=\mathbb Z$, $H_1(Y,\mathbb Z)=\mathbb Z_2$, $H_2(Y,\mathbb Z)=0$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@attch:=RegularCWComplex_AttachCellDestructive;; #Function for attaching cells|
  
  !gapprompt@gap>| !gapinput@Y:=RegularCWDiscreteSpace(3); #Discrete CW-complex consisting of points {1,2,3}|
  Regular CW-complex of dimension 0
  
  !gapprompt@gap>| !gapinput@e1:=attch(Y,1,[1,2]);; #Attach 1-cell|
  !gapprompt@gap>| !gapinput@e2:=attch(Y,1,[1,2]);; #Attach 1-cell|
  !gapprompt@gap>| !gapinput@e3:=attch(Y,1,[1,3]);; #Attach 1-cell|
  !gapprompt@gap>| !gapinput@e4:=attch(Y,1,[1,3]);; #Attach 1-cell|
  !gapprompt@gap>| !gapinput@e5:=attch(Y,1,[2,3]);; #Attach 1-cell|
  !gapprompt@gap>| !gapinput@e6:=attch(Y,1,[2,3]);; #Attach 1-cell|
  !gapprompt@gap>| !gapinput@f1:=attch(Y,2,[e1,e3,e5]);; #Attach 2-cell|
  !gapprompt@gap>| !gapinput@f2:=attch(Y,2,[e2,e4,e5]);; #Attach 2-cell|
  !gapprompt@gap>| !gapinput@f3:=attch(Y,2,[e2,e3,e6]);; #Attach 2-cell|
  !gapprompt@gap>| !gapinput@f4:=attch(Y,2,[e1,e4,e6]);; #Attach 2-cell|
  !gapprompt@gap>| !gapinput@Homology(Y,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(Y,1);|
  [ 2 ]
  !gapprompt@gap>| !gapinput@Homology(Y,2);|
  [  ]`
  
\end{Verbatim}
 

The following example creates a 2\texttt{\symbol{45}}complex $K$ corresponding to the group presentation 

$G=\langle x,y,z\ :\ xyx^{-1}y^{-1}=1, yzy^{-1}z^{-1}=1,
zxz^{-1}x^{-1}=1\rangle$. 

The complex is shown to have the correct fundamental group and homology (since
it is the 2\texttt{\symbol{45}}skeleton of the 3\texttt{\symbol{45}}torus $S^1\times S^1\times S^1$). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@S1:=RegularCWSphere(1);;|
  !gapprompt@gap>| !gapinput@W:=WedgeSum(S1,S1,S1);;|
  !gapprompt@gap>| !gapinput@F:=FundamentalGroupWithPathReps(W);; x:=F.1;;y:=F.2;;z:=F.3;;|
  !gapprompt@gap>| !gapinput@K:=RegularCWComplexWithAttachedRelatorCells(W,F,Comm(x,y),Comm(y,z),Comm(x,z));|
  Regular CW-complex of dimension 2
  
  !gapprompt@gap>| !gapinput@G:=FundamentalGroup(K);|
  <fp group on the generators [ f1, f2, f3 ]>
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(G);|
  [ f2^-1*f1*f2*f1^-1, f1^-1*f3*f1*f3^-1, f2^-1*f3*f2*f3^-1 ]
  !gapprompt@gap>| !gapinput@Homology(K,1);|
  [ 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(K,2);|
  [ 0, 0, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Constructing a regular CW\texttt{\symbol{45}}complex from its face lattice}}\logpage{[ 1, 9, 0 ]}
\hyperdef{L}{X7B7354E68025FC92}{}
{
 

  

The following example creats a $2$\texttt{\symbol{45}}dimensional annulus $A$ as a regular CW\texttt{\symbol{45}}complex, and testing that it has the
correct integral homology $H_0(A,\mathbb Z)=\mathbb Z$, $H_1(A,\mathbb Z)=\mathbb Z$, $H_2(A,\mathbb Z)=0$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@FL:=[];; #The face lattice|
  !gapprompt@gap>| !gapinput@FL[1]:=[[1,0],[1,0],[1,0],[1,0]];;|
  !gapprompt@gap>| !gapinput@FL[2]:=[[2,1,2],[2,3,4],[2,1,4],[2,2,3],[2,1,4],[2,2,3]];;|
  !gapprompt@gap>| !gapinput@FL[3]:=[[4,1,2,3,4],[4,1,2,5,6]];;|
  !gapprompt@gap>| !gapinput@FL[4]:=[];;|
  !gapprompt@gap>| !gapinput@A:=RegularCWComplex(FL);|
  Regular CW-complex of dimension 2
  
  !gapprompt@gap>| !gapinput@Homology(A,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(A,1);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(A,2);|
  [  ]
  
  
\end{Verbatim}
 

Next we construct the direct product $Y=A\times A\times A\times A\times A$ of five copies of the annulus. This is a $10$\texttt{\symbol{45}}dimensional CW complex involving $248832$ cells. It will be homotopy equivalent $Y\simeq X$ to a CW complex $X$ involving fewer cells. The CW complex $X$ may be non\texttt{\symbol{45}}regular. We compute the cochain complex $D_\ast = {\rm Hom}_{\mathbb Z}(C_\ast(X),\mathbb Z)$ from which the cohomology groups \\
$H^0(Y,\mathbb Z)=\mathbb Z$, \\
$H^1(Y,\mathbb Z)=\mathbb Z^5$, \\
$H^2(Y,\mathbb Z)=\mathbb Z^{10}$, \\
$H^3(Y,\mathbb Z)=\mathbb Z^{10}$, \\
$H^4(Y,\mathbb Z)=\mathbb Z^5$, \\
$H^5(Y,\mathbb Z)=\mathbb Z$, \\
$H^6(Y,\mathbb Z)=0$\\
 are obtained. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=DirectProduct(A,A,A,A,A);|
  Regular CW-complex of dimension 10
  
  !gapprompt@gap>| !gapinput@Size(Y);|
  248832
  !gapprompt@gap>| !gapinput@C:=ChainComplex(Y);|
  Chain complex of length 10 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@D:=HomToIntegers(C);|
  Cochain complex of length 10 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Cohomology(D,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,1);|
  [ 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,2);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,3);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,4);|
  [ 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,5);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,6);|
  [  ]
  
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cup products}}\logpage{[ 1, 10, 0 ]}
\hyperdef{L}{X823FA6A9828FF473}{}
{
 

\textsc{Strategy 1: Use geometric group theory in low dimensions.} 

Continuing with the previous example, we consider the first and fifth
generators $g_1^1, g_5^1\in H^1(Y,\mathbb Z) =\mathbb Z^5$ and establish that their cup product $ g_1^1 \cup g_5^1 = - g_7^2 \in H^2(Y,\mathbb Z) =\mathbb Z^{10}$ is equal to minus the seventh generator of $H^2(Y,\mathbb Z)$. We also verify that $g_5^1\cup g_1^1 = - g_1^1 \cup g_5^1$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@cup11:=CupProduct(FundamentalGroup(Y));|
  function( a, b ) ... end
  
  !gapprompt@gap>| !gapinput@cup11([1,0,0,0,0],[0,0,0,0,1]);|
  [ 0, 0, 0, 0, 0, 0, -1, 0, 0, 0 ]
  
  !gapprompt@gap>| !gapinput@cup11([0,0,0,0,1],[1,0,0,0,0]);|
  [ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
  
  
\end{Verbatim}
 

This computation of low\texttt{\symbol{45}}dimensional cup products is
achieved using group\texttt{\symbol{45}}theoretic methods to approximate the
diagonal map $\Delta \colon Y \rightarrow Y\times Y$ in dimensions $\le 2$. In order to construct cup products in higher degrees \textsc{HAP} invokes three further strategies. 

\textsc{Strategy 2: implement the Alexander\texttt{\symbol{45}}Whitney map for
simplicial complexes.} 

For simplicial complexes the cup product is implemented using the standard
formula for the Alexander\texttt{\symbol{45}}Whitney chain map, together with
homotopy equivalences to improve efficiency. 

As a first example, the following commands construct simplicial complexes $K=(\mathbb S^1 \times \mathbb S^1) \# (\mathbb S^1 \times \mathbb S^1)$ and $L=(\mathbb S^1 \times \mathbb S^1) \vee \mathbb S^1 \vee \mathbb S^1$ and establish that they have the same cohomology groups. It is then shown that
the cup products $\cup_K\colon H^2(K,\mathbb Z)\times H^2(K,\mathbb Z) \rightarrow H^4(K,\mathbb
Z)$ and $\cup_L\colon H^2(L,\mathbb Z)\times H^2(L,\mathbb Z) \rightarrow H^4(L,\mathbb
Z)$ are antisymmetric bilinear forms of different ranks; hence $K$ and $L$ have different homotopy types. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=ClosedSurface(2);|
  Simplicial complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@L:=WedgeSum(WedgeSum(ClosedSurface(1),Sphere(1)),Sphere(1));|
  Simplicial complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@Cohomology(K,0);Cohomology(L,0);|
  [ 0 ]
  [ 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(K,1);Cohomology(L,1);|
  [ 0, 0, 0, 0 ]
  [ 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(K,2);Cohomology(L,2);|
  [ 0 ]
  [ 0 ]
  !gapprompt@gap>| !gapinput@gens:=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];;|
  !gapprompt@gap>| !gapinput@cupK:=CupProduct(K);;|
  !gapprompt@gap>| !gapinput@cupL:=CupProduct(L);;|
  !gapprompt@gap>| !gapinput@A:=NullMat(4,4);;B:=NullMat(4,4);;|
  !gapprompt@gap>| !gapinput@for i in [1..4] do|
  !gapprompt@>| !gapinput@for j in [1..4] do|
  !gapprompt@>| !gapinput@A[i][j]:=cupK(1,1,gens[i],gens[j])[1];|
  !gapprompt@>| !gapinput@B[i][j]:=cupL(1,1,gens[i],gens[j])[1];|
  !gapprompt@>| !gapinput@od;od;|
  !gapprompt@gap>| !gapinput@Display(A);|
  [ [   0,   0,   0,   1 ],
    [   0,   0,   1,   0 ],
    [   0,  -1,   0,   0 ],
    [  -1,   0,   0,   0 ] ]
  !gapprompt@gap>| !gapinput@Display(B);|
  [ [   0,   1,   0,   0 ],
    [  -1,   0,   0,   0 ],
    [   0,   0,   0,   0 ],
    [   0,   0,   0,   0 ] ]
  !gapprompt@gap>| !gapinput@Rank(A);|
  4
  !gapprompt@gap>| !gapinput@Rank(B);|
  2
  
\end{Verbatim}
 

 As a second example of the computation of cups products, the following
commands construct the connected sums $V=M\# M$ and $W=M\# \overline M$ where $M$ is the $K3$ complex surface which is stored as a pure simplicial complex of dimension 4
and where $\overline M$ denotes the opposite orientation on $M$. The simplicial structure on the $K3$ surface is taken from \cite{spreerkhuenel}. The commands then show that $H^2(V,\mathbb Z)=H^2(W,\mathbb Z)=\mathbb Z^{44}$ and $H^4(V,\mathbb Z)=H^4(W,\mathbb Z)=\mathbb Z$. The final commands compute the matrix $AV=(x\cup y)$ as $x,y$ range over a generating set for $H^2(V,\mathbb Z)$ and the corresponding matrix $AW$ for $W$. These two matrices are seen to have a different number of positive
eigenvalues from which we can conclude that $V$ is not homotopy equivalent to $W$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=SimplicialK3Surface();;|
  !gapprompt@gap>| !gapinput@V:=ConnectedSum(M,M,+1);|
  Simplicial complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@W:=ConnectedSum(M,M,-1);|
  Simplicial complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@Cohomology(V,2);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(W,2);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(V,4);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(W,4);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@cupV:=CupProduct(V);;|
  !gapprompt@gap>| !gapinput@cupW:=CupProduct(W);;|
  !gapprompt@gap>| !gapinput@AV:=NullMat(44,44);;      |
  !gapprompt@gap>| !gapinput@AW:=NullMat(44,44);;|
  !gapprompt@gap>| !gapinput@gens:=IdentityMat(44);;|
  !gapprompt@gap>| !gapinput@for i in [1..44] do|
  !gapprompt@>| !gapinput@for j in [1..44] do|
  !gapprompt@>| !gapinput@AV[i][j]:=cupV(2,2,gens[i],gens[j])[1];                               |
  !gapprompt@>| !gapinput@AW[i][j]:=cupW(2,2,gens[i],gens[j])[1];|
  !gapprompt@>| !gapinput@od;od;                                 |
  !gapprompt@gap>| !gapinput@SignatureOfSymmetricMatrix(AV);|
  rec( determinant := 1, negative_eigenvalues := 22, positive_eigenvalues := 22,
    zero_eigenvalues := 0 )
  !gapprompt@gap>| !gapinput@SignatureOfSymmetricMatrix(AW);|
  rec( determinant := 1, negative_eigenvalues := 6, positive_eigenvalues := 38, 
    zero_eigenvalues := 0 )
  
\end{Verbatim}
 A cubical cubical version of the Alexander\texttt{\symbol{45}}Whitney formula,
due to J.\texttt{\symbol{45}}P. Serre, could be used for computing the
cohomology ring of a regular CW\texttt{\symbol{45}}complex whose cells all
have a cubical combinatorial face lattice. This has not been implemented in
HAP. However, the following more general approach has been implemented. 

\textsc{Strategy 3: Implement a cellular approximation to the diagonal map on an
arbitrary finite regular CW\texttt{\symbol{45}}complex.} 

The following example calculates the cup product $H^2(W,\mathbb Z)\times H^2(W,\mathbb Z) \rightarrow H^4(W,\mathbb Z)$ for the $4$\texttt{\symbol{45}}dimensional orientable manifold $W=M\times M$ where $M$ is the closed surface of genus $2$. The manifold $W$ is stored as a regular CW\texttt{\symbol{45}}complex. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=RegularCWComplex(ClosedSurface(2));;|
  !gapprompt@gap>| !gapinput@W:=DirectProduct(M,M);|
  Regular CW-complex of dimension 4
  
  !gapprompt@gap>| !gapinput@Size(W);|
  5776
  !gapprompt@gap>| !gapinput@W:=SimplifiedComplex(W);;|
  !gapprompt@gap>| !gapinput@Size(W);                                |
  1024
  
  !gapprompt@gap>| !gapinput@Homology(W,2);           |
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(W,4);|
  [ 0 ]
  
  !gapprompt@gap>| !gapinput@cup:=CupProduct(W);;|
  !gapprompt@gap>| !gapinput@SecondCohomologtGens:=IdentityMat(18);;   |
  !gapprompt@gap>| !gapinput@A:=NullMat(18,18);;|
  !gapprompt@gap>| !gapinput@for i in [1..18] do|
  !gapprompt@>| !gapinput@for j in [1..18] do|
  !gapprompt@>| !gapinput@A[i][j]:=cup(2,2,SecondCohomologtGens[i],SecondCohomologtGens[j])[1];|
  !gapprompt@>| !gapinput@od;od;|
  !gapprompt@gap>| !gapinput@Display(A);|
  [ [    0,   -1,    0,    0,    0,    0,    3,   -2,    0,    0,    0,    1,   -1,    0,    0,    1,    0,    0 ],
    [   -1,  -10,    1,    2,   -2,    1,    6,   -1,    0,   -3,    4,   -1,   -1,   -1,    4,   -2,   -2,    0 ],
    [    0,    1,   -2,    1,    0,   -1,    0,    0,    1,    0,   -1,    1,    0,    0,    1,   -1,    0,    0 ],
    [    0,    2,    1,   -2,    1,    0,    0,   -1,    0,    1,    0,    0,    0,    0,   -1,    2,    0,    0 ],
    [    0,   -2,    0,    1,    0,    0,    1,   -1,    0,    0,   -1,    0,    0,    0,    0,   -1,    0,    0 ],
    [    0,    1,   -1,    0,    0,    0,    0,    1,   -1,    1,    0,    0,    0,    0,    1,   -1,    0,    0 ],
    [    3,    6,    0,    0,    1,    0,   -4,    0,   -1,    2,    4,   -5,    2,   -1,    1,    0,    3,    0 ],
    [   -2,   -1,    0,   -1,   -1,    1,    0,    4,   -2,    0,    0,    3,   -1,    1,   -1,    0,   -2,    0 ],
    [    0,    0,    1,    0,    0,   -1,   -1,   -2,    4,   -3,  -10,    1,    0,    0,   -3,    3,    0,    0 ],
    [    0,   -3,    0,    1,    0,    1,    2,    0,   -3,    2,    3,    0,    0,    0,    1,   -3,    0,    0 ],
    [    0,    4,   -1,    0,   -1,    0,    4,    0,  -10,    3,   18,    1,    0,    0,    0,    4,    0,    1 ],
    [    1,   -1,    1,    0,    0,    0,   -5,    3,    1,    0,    1,    0,    0,    0,   -2,   -1,   -1,    0 ],
    [   -1,   -1,    0,    0,    0,    0,    2,   -1,    0,    0,    0,    0,    0,    0,    1,    0,    0,    0 ],
    [    0,   -1,    0,    0,    0,    0,   -1,    1,    0,    0,    0,    0,    0,    0,    0,   -1,   -1,    0 ],
    [    0,    4,    1,   -1,    0,    1,    1,   -1,   -3,    1,    0,   -2,    1,    0,    0,    2,    2,    0 ],
    [    1,   -2,   -1,    2,   -1,   -1,    0,    0,    3,   -3,    4,   -1,    0,   -1,    2,    0,    0,    0 ],
    [    0,   -2,    0,    0,    0,    0,    3,   -2,    0,    0,    0,   -1,    0,   -1,    2,    0,    0,    0 ],
    [    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    1,    0,    0,    0,    0,    0,    0,    0 ] ]
  
  !gapprompt@gap>| !gapinput@SignatureOfSymmetricMatrix(A);|
  rec( determinant := -1, negative_eigenvalues := 9, positive_eigenvalues := 9,
    zero_eigenvalues := 0 )
  
  
\end{Verbatim}
 The matrix $A$ representing the cup product $H^2(W,\mathbb Z)\times H^2(W,\mathbb Z) \rightarrow H^4(W,\mathbb Z)$ is shown to have $9$ positive eigenvalues, $9$ negative eigenvalues, and no zero eigenvalue. 

\textsc{Strategy 4: Guess and verify a cellular approximation to the diagonal map.} 

Many naturally occuring cell structures are neither simplicial nor cubical.
For a general regular CW\texttt{\symbol{45}}complex we can attempt to
construct a cellular inclusion $\overline Y \hookrightarrow Y\times Y$ with $\{(y,y)\ :\ y\in Y\}\subset \overline Y$ and with projection $p\colon \overline Y \twoheadrightarrow Y$ that induces isomorphisms on integral homology. The function \texttt{DiagonalApproximation(Y)} constructs a candidate inclusion, but the projection $p\colon \overline Y \twoheadrightarrow Y$ needs to be tested for homology equivalence. If the candidate inclusion passes
this test then the function \texttt{CupProductOfRegularCWComplex{\textunderscore}alt(Y)}, involving the candidate space, can be used for cup products. (I think the
test is passed for all regular CW\texttt{\symbol{45}}complexes that are
subcomplexes of some Euclidean space with all cells convex polytopes
\texttt{\symbol{45}}\texttt{\symbol{45}} but a proof needs to be written
down!) 

The following example calculates $g_1^2 \cup g_2^2 \ne 0$ where $Y=T\times T$ is the direct product of two copies of a simplicial torus $T$, and where $g_k^n$ denotes the $k$\texttt{\symbol{45}}th generator in some basis of $H^n(Y,\mathbb Z)$. The direct product $Y$ is a CW\texttt{\symbol{45}}complex which is not a simplicial complex. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|K:=RegularCWComplex(ClosedSurface(1));;B
  @gapprompt|gap>B @gapinput|Y:=DirectProduct(K,K);;B
  @gapprompt|gap>B @gapinput|cup:=CupProductOfRegularCWComplex_alt(Y);;B
  @gapprompt|gap>B @gapinput|cup(2,2,[1,0,0,0,0,0],[0,1,0,0,0,0]);B
  [ 5 ]
  
  @gapprompt|gap>B @gapinput|D:=DiagonalApproximation(Y);;B
  @gapprompt|gap>B @gapinput|p:=D!.projection;B
  Map of regular CW-complexes
  
  @gapprompt|gap>B @gapinput|P:=ChainMap(p);B
  Chain Map between complexes of length 4 . 
  
  @gapprompt|gap>B @gapinput|IsIsomorphismOfAbelianFpGroups(Homology(P,0));B
  true
  @gapprompt|gap>B @gapinput|IsIsomorphismOfAbelianFpGroups(Homology(P,2));B
  true
  @gapprompt|gap>B @gapinput|IsIsomorphismOfAbelianFpGroups(Homology(P,3));B
  true
  @gapprompt|gap>B @gapinput|IsIsomorphismOfAbelianFpGroups(Homology(P,4));B
  true
  
\end{Verbatim}
 }

 Of course, either of Strategies 2 or 3 could also be used for this example. To
use the Alexander\texttt{\symbol{45}}Whitney formula of Strategy 2 we would
need to give the direct product $Y=T\times T$ a simplicial structure. This could be obtained using the function \texttt{DirectProduct(T,T)}. The details are as follows. (The result is consistent with the preceding
computation since the choice of a basis for cohomology groups is far from
unique.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=ClosedSurface(1);;                |
  !gapprompt@gap>| !gapinput@KK:=DirectProduct(K,K);|
  Simplicial complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@cup:=CupProduct(KK);;                |
  !gapprompt@gap>| !gapinput@cup(2,2,[1,0,0,0,0,0],[0,1,0,0,0,0]);|
  [ 0 ]
  
\end{Verbatim}
 
\section{\textcolor{Chapter }{Intersection forms of $4$\texttt{\symbol{45}}manifolds}}\logpage{[ 1, 11, 0 ]}
\hyperdef{L}{X7F9B01CF7EE1D2FC}{}
{
 The cup product gives rise to the intersection form of a connected, closed,
orientable $4$\texttt{\symbol{45}}manifold $Y$ is a symmetric bilinear form 

$qY\colon H^2(Y,\mathbb Z)/Torsion \times H^2(Y,\mathbb Z)/Torsion
\longrightarrow \mathbb Z$ 

which we represent as a symmetric matrix. 

The following example constructs the direct product $L=S^2\times S^2$ of two $2$\texttt{\symbol{45}}spheres, the connected sum $M=\mathbb CP^2 \# \overline{\mathbb CP^2}$ of the complex projective plane $\mathbb CP^2$ and its oppositely oriented version $\overline{\mathbb CP^2}$, and the connected sum $N=\mathbb CP^2 \# \mathbb CP^2$. The manifolds $L$, $M$ and $N$ are each shown to have a CW\texttt{\symbol{45}}structure involving one $0$\texttt{\symbol{45}}cell, two $1$\texttt{\symbol{45}}cells and one $2$\texttt{\symbol{45}}cell. They are thus simply connected and have identical
cohomology. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@S:=Sphere(2);;|
  !gapprompt@gap>| !gapinput@S:=RegularCWComplex(S);;|
  !gapprompt@gap>| !gapinput@L:=DirectProduct(S,S);|
  Regular CW-complex of dimension 4
  
  !gapprompt@gap>| !gapinput@M:=ConnectedSum(ComplexProjectiveSpace(2),ComplexProjectiveSpace(2),-1);|
  Simplicial complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@N:=ConnectedSum(ComplexProjectiveSpace(2),ComplexProjectiveSpace(2),+1);|
  Simplicial complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@CriticalCells(L);|
  [ [ 4, 1 ], [ 2, 13 ], [ 2, 56 ], [ 0, 16 ] ]
  !gapprompt@gap>| !gapinput@CriticalCells(RegularCWComplex(M));|
  [ [ 4, 1 ], [ 2, 109 ], [ 2, 119 ], [ 0, 8 ] ]
  !gapprompt@gap>| !gapinput@CriticalCells(RegularCWComplex(N));|
  [ [ 4, 1 ], [ 2, 119 ], [ 2, 149 ], [ 0, 12 ] ]
  
\end{Verbatim}
 John Milnor showed (as a corollary to a theorem of J. H. C. Whitehead) that
the homotopy type of a simply connected 4\texttt{\symbol{45}}manifold is
determined by its quadratic form. More precisely, a form is said to be of \emph{type I (properly primitive)} if some diagonal entry of its matrix is odd. If every diagonal entry is even,
then the form is of \emph{type II (improperly primitive)}. The \emph{index} of a form is defined as the number of positive diagonal entries minus the
number of negative ones, after the matrix has been diagonalized over the real
numbers. 

\textsc{Theorem.} (Milnor \cite{milnor}) The oriented homotopy type of a simply connected, closed, orientable
4\texttt{\symbol{45}}manifold is determined by its second Betti number and the
index and type of its intersetion form; except possibly in the case of a
manifold with definite quadratic form of rank r {\textgreater} 9. 

 The following commands compute matrices representing the intersection forms $qL$, $qM$, $qN$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@qL:=IntersectionForm(L);;|
  !gapprompt@gap>| !gapinput@qM:=IntersectionForm(M);;|
  !gapprompt@gap>| !gapinput@qN:=IntersectionForm(N);;|
  !gapprompt@gap>| !gapinput@Display(qL);|
  [ [  -2,   1 ],
    [   1,   0 ] ]
  !gapprompt@gap>| !gapinput@Display(qM);|
  [ [  1,  0 ],
    [  0,  1 ] ]
  !gapprompt@gap>| !gapinput@Display(qN);|
  [ [   1,   0 ],
    [   0,  -1 ] ]
  
\end{Verbatim}
 Since $qL$ is of type II, whereas $qM$ and $qN$ are of type I we see that the oriented homotopy type of $L$ is distinct to that of $M$ and that of $N$. Since $qM$ has index $2$ and $qN$ has index $0$ we see that that $M$ and $N$ also have distinct oriented homotopy types. }

 
\section{\textcolor{Chapter }{Cohomology Rings}}\logpage{[ 1, 12, 0 ]}
\hyperdef{L}{X80B6849C835B7F19}{}
{
 The cup product gives the cohomology $H^\ast(X,R)$ of a space $X$ with coefficients in a ring $R$ the structure of a graded commutitive ring. The function \texttt{CohomologyRing(Y,p)} returns the cohomology as an algebra for $Y$ a simplicial complex and $R=\mathbb Z_p$ the field of $p$ elements. For more general regular CW\texttt{\symbol{45}}complexes or $R=\mathbb Z$ the cohomology ring structure can be determined using the function \texttt{CupProduct(Y)}. 

The folowing commands compute the mod $2$ cohomology ring $H^\ast(W,\mathbb Z_2)$ of the above wedge sum $W=M\vee N$ of a $2$\texttt{\symbol{45}}dimensional orientable simplicial surface of genus 2 and
the $K3$ complex simplicial surface (of real dimension 4). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=ClosedSurface(2);;|
  !gapprompt@gap>| !gapinput@N:=SimplicialK3Surface();;|
  !gapprompt@gap>| !gapinput@W:=WedgeSum(M,N);;|
  !gapprompt@gap>| !gapinput@A:=CohomologyRing(W,2);|
  <algebra of dimension 29 over GF(2)>
  !gapprompt@gap>| !gapinput@x:=Basis(A)[25];|
  v.25
  !gapprompt@gap>| !gapinput@y:=Basis(A)[27];|
  v.27
  !gapprompt@gap>| !gapinput@x*y;|
  v.29
  
\end{Verbatim}
 

The functions \texttt{CupProduct} and \texttt{IntersectionForm} can be used to determine integral cohomology rings. For example, the integral
cohomology ring of an arbitrary closed surface was calculated in \cite[Theorem 3.5]{goncalves}. For any given surface $M$ this result can be recalculated using the intersection form. For instance, for
an orientable surface of genus $g$ it is well\texttt{\symbol{45}}known that $H^1(M,\mathbb Z)=\mathbb Z^{2g}$, $H^2(M,\mathbb Z)=\mathbb Z$. The ring structure multiplication is thus given by the matrix of the
intersection form. For say $g=3$ the ring multiplication is given, with respect to some cohomology basis, in
the following. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=ClosedSurface(3);;|
  !gapprompt@gap>| !gapinput@Display(IntersectionForm(M));|
  [ [   0,   0,   1,  -1,  -1,   0 ],
    [   0,   0,   0,   1,   1,   0 ],
    [  -1,   0,   0,   1,   1,  -1 ],
    [   1,  -1,  -1,   0,   0,   1 ],
    [   1,  -1,  -1,   0,   0,   0 ],
    [   0,   0,   1,  -1,   0,   0 ] ]
  
\end{Verbatim}
 By changing the basis $B$ for $H^1(M,\mathbb Z)$ we obtain the following simpler matrix representing multiplication in $H^\ast(M,\mathbb Z)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@B:=[ [ 0, 1, -1, -1, 1, 0 ],|
  !gapprompt@>| !gapinput@        [ 1, 0, 1, 1, 0, 0 ],|
  !gapprompt@>| !gapinput@        [ 0, 0, 1, 0, 0, 0 ],|
  !gapprompt@>| !gapinput@        [ 0, 0, 0, 1, -1, 0 ],|
  !gapprompt@>| !gapinput@        [ 0, 0, 1, 1, 0, 0 ],|
  !gapprompt@>| !gapinput@        [ 0, 0, 1, 1, 0, 1 ] ];;|
  !gapprompt@gap>| !gapinput@Display(IntersectionForm(M,B));|
  [ [   0,   1,   0,   0,   0,   0 ],
    [  -1,   0,   0,   0,   0,   0 ],
    [   0,   0,   0,   0,   1,   0 ],
    [   0,   0,   0,   0,   0,   1 ],
    [   0,   0,  -1,   0,   0,   0 ],
    [   0,   0,   0,  -1,   0,   0 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Bockstein homomorphism}}\logpage{[ 1, 13, 0 ]}
\hyperdef{L}{X83035DEC7C9659C6}{}
{
 The following example evaluates the Bockstein homomorphism $\beta_2\colon H^\ast(X,\mathbb Z_2) \rightarrow H^{\ast +1}(X,\mathbb Z_2)$ on an additive basis for $X=\Sigma^{100}(\mathbb RP^2 \times \mathbb RP^2)$ the $100$\texttt{\symbol{45}}fold suspension of the direct product of two projective
planes. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=SimplifiedComplex(RegularCWComplex(ClosedSurface(-1)));|
  Regular CW-complex of dimension 2
  !gapprompt@gap>| !gapinput@PP:=DirectProduct(P,P);;|
  !gapprompt@gap>| !gapinput@SPP:=Suspension(PP,100); |
  Regular CW-complex of dimension 104
  !gapprompt@gap>| !gapinput@A:=CohomologyRing(SPP,2); |
  <algebra of dimension 9 over GF(2)>
  !gapprompt@gap>| !gapinput@List(Basis(A),x->Bockstein(A,x));|
  [ 0*v.1, v.4, v.6, 0*v.1, v.7+v.8, 0*v.1, v.9, v.9, 0*v.1 ]
  
  
\end{Verbatim}
 If only the Bockstein homomorphism is required, and not the cohomology ring
structure, then the Bockstein could also be computedirectly from a chain
complex. The following computes the Bockstein $\beta_2\colon H^2(Y,\mathbb Z_2) \rightarrow H^{3}(Y,\mathbb Z_2)$ for the direct product $Y=K \times K \times K \times K$ of four copies of the Klein bottle represented as a regular
CW\texttt{\symbol{45}}complex with $331776$ cells. The order of the kernel and image of $\beta_2$ are computed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=ClosedSurface(-2);;                |
  !gapprompt@gap>| !gapinput@K:=SimplifiedComplex(RegularCWComplex(K));;|
  !gapprompt@gap>| !gapinput@KKKK:=DirectProduct(K,K,K,K); |
  Regular CW-complex of dimension 8
  !gapprompt@gap>| !gapinput@Size(KKKK);|
  331776
  !gapprompt@gap>| !gapinput@C:=ChainComplex(KKKK);;|
  !gapprompt@gap>| !gapinput@bk:=Bockstein(C,2,2);;|
  !gapprompt@gap>| !gapinput@Order(Kernel(bk));|
  1024
  !gapprompt@gap>| !gapinput@Order(Image(bk)); |
  262144
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Diagonal maps on associahedra and other polytopes}}\logpage{[ 1, 14, 0 ]}
\hyperdef{L}{X87135D067B6CDEEC}{}
{
 By a \emph{diagonal approximation} on a regular CW\texttt{\symbol{45}}complex $X$ we mean any cellular map $\Delta\colon X\rightarrow X\times X$ that is homotopic to the diagonal map $X\rightarrow X\times X, x\mapsto (x,x)$ and equal to the diagonal map when restricted to the $0$\texttt{\symbol{45}}skeleton. Theoretical formulae for diagonal maps on a
polytope $X$ can have interesting combinatorial aspects. To illustrate this let us
consider, for $n=3$, the $n$\texttt{\symbol{45}}dimensional polytope ${\cal K}^{n+2}$ known as the associahedron. The following commands display the $1$\texttt{\symbol{45}}skeleton of ${\cal K}^{5}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@n:=3;;Y:=RegularCWAssociahedron(n+2);;|
  !gapprompt@gap>| !gapinput@Display(GraphOfRegularCWComplex(Y));|
  
  				
\end{Verbatim}
 

  

 The induced chain map $C_\ast({\cal K}^{n+2}) \rightarrow C_\ast({\cal K}^{n+2}\times {\cal K}^{n+2})$ sends the unique free generator $e^n_1$ of $C_n({\cal K}^{n+2})$ to a sum $\Delta(e^n_1)$ of a number of distinct free generators of $C_n({\cal K}^{n+2}\times {\cal K}^{n+2})$. Let $|\Delta(e^n_1)|$ denote the number of free generators. For $n=3$ the following commands show that $|\Delta(e^3_1)|=22$ with each free generator occurring with coefficient $\pm 1$. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|n:=3;;Y:=RegularCWAssociahedron(n+2);;    B
  @gapprompt|gap>B @gapinput|D:=DiagonalChainMap(Y);;Filtered(D!.mapping([1],n),x->x<>0);B
  [ 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1 ]
  
                                  
\end{Verbatim}
 Repeating this example for $0\le n\le 6$ yields the sequence $|\Delta(e^n_1)|: 1, 2, 6, 22, 91, 408, 1938, \cdots\ $. The \href{https://oeis.org/A000139} {On\texttt{\symbol{45}}line Encyclopedia of Integer Sequences} explains that this is the beginning of the sequence given by the number of
canopy intervals in the Tamari lattices. 

Repeating the same experiment for the permutahedron, using the command \texttt{RegularCWPermutahedron(n)}, yields the sequence $|\Delta(e^n_1)|: 1, 2, 8, 50, 432, 4802,\cdots$. The \href{https://oeis.org/A007334} {On\texttt{\symbol{45}}line Encyclopedia of Integer Sequences} explains that this is the beginning of the sequence given by the number of
spanning trees in the graph $K_{n}/e$, which results from contracting an edge $e$ in the complete graph $K_{n}$ on $n$ vertices. 

Repeating the experiment for the cube, using the command \texttt{RegularCWCube(n)}, yields the sequence $|\Delta(e^n_1)|: 1, 2, 4, 8, 16, 32,\cdots$. 

Repeating the experiment for the simplex, using the command \texttt{RegularCWSimplex(n)}, yields the sequence $|\Delta(e^n_1)|: 1, 2, 3, 4, 5, 6,\cdots$. }

 
\section{\textcolor{Chapter }{CW maps and induced homomorphisms}}\logpage{[ 1, 15, 0 ]}
\hyperdef{L}{X8771FF2885105154}{}
{
 

A \emph{strictly cellular} map $f\colon X\rightarrow Y$ of regular CW\texttt{\symbol{45}}complexes is a cellular map for which the
image of any cell is a cell (of possibly lower dimension). Inclusions of
CW\texttt{\symbol{45}}subcomplexes, and projections from a direct product to a
factor, are examples of such maps. Strictly cellular maps can be represented
in \textsc{HAP}, and their induced homomorphisms on (co)homology and on fundamental groups
can be computed. 

 The following example begins by visualizing the trefoil knot $\kappa \in \mathbb R^3$. It then constructs a regular CW structure on the complement $Y= D^3\setminus {\rm Nbhd}(\kappa) $ of a small tubular open neighbourhood of the knot lying inside a large closed
ball $D^3$. The boundary of this tubular neighbourhood is a $2$\texttt{\symbol{45}}dimensional CW\texttt{\symbol{45}}complex $B$ homeomorphic to a torus $\mathbb S^1\times \mathbb S^1$ with fundamental group $\pi_1(B)=<a,b\, :\, aba^{-1}b^{-1}=1>$. The inclusion map $f\colon B\hookrightarrow Y$ is constructed. Then a presentation $\pi_1(Y)= <x,y\, |\, xy^{-1}x^{-1}yx^{-1}y^{-1}>$ and the induced homomorphism
\$\$\texttt{\symbol{92}}pi{\textunderscore}1(B)\texttt{\symbol{92}}rightarrow
\texttt{\symbol{92}}pi{\textunderscore}1(Y), a\texttt{\symbol{92}}mapsto
y\texttt{\symbol{94}}\texttt{\symbol{123}}\texttt{\symbol{45}}1\texttt{\symbol{125}}xy\texttt{\symbol{94}}2xy\texttt{\symbol{94}}\texttt{\symbol{123}}\texttt{\symbol{45}}1\texttt{\symbol{125}},
b\texttt{\symbol{92}}mapsto y \$\$ are computed. This induced homomorphism is
an example of a \emph{peripheral system} and is known to contain sufficient information to characterize the knot up to
ambient isotopy. 

 Finally, it is verified that the induced homology homomorphism $H_2(B,\mathbb Z) \rightarrow H_2(Y,\mathbb Z)$ is an isomomorphism. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=PureCubicalKnot(3,1);;|
  !gapprompt@gap>| !gapinput@ViewPureCubicalKnot(K);;|
  
\end{Verbatim}
  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=PureCubicalKnot(3,1);;|
  !gapprompt@gap>| !gapinput@f:=KnotComplementWithBoundary(ArcPresentation(K));|
  Map of regular CW-complexes
  
  !gapprompt@gap>| !gapinput@G:=FundamentalGroup(Target(f));|
  <fp group of size infinity on the generators [ f1, f2 ]>
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(G);|
  [ f1*f2^-1*f1^-1*f2*f1^-1*f2^-1 ]
  
  !gapprompt@gap>| !gapinput@F:=FundamentalGroup(f);|
  [ f1, f2 ] -> [ f2^-1*f1*f2^2*f1*f2^-1, f1 ]
  
  
  !gapprompt@gap>| !gapinput@phi:=ChainMap(f);|
  Chain Map between complexes of length 2 . 
  
  !gapprompt@gap>| !gapinput@H:=Homology(phi,2);|
  [ g1 ] -> [ g1 ]
  
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Constructing a simplicial complex from a regular CW\texttt{\symbol{45}}complex}}\logpage{[ 1, 16, 0 ]}
\hyperdef{L}{X853D6B247D0E18DB}{}
{
 The following example constructs a $3$\texttt{\symbol{45}}dimensional pure regular CW\texttt{\symbol{45}}complex $K$ whose $3$\texttt{\symbol{45}}cells are permutahedra. It then constructs the simplicial
complex $B$ by taking barycentric subdivision. It then constructes a smaller, homotopy
equivalent, simplicial complex $N$ by taking the nerve of the cover of $K$ by the closures of its $3$\texttt{\symbol{45}}cells. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=RegularCWComplex(PureComplexComplement(PurePermutahedralKnot(3,1)));|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@Size(K);|
  77923
  !gapprompt@gap>| !gapinput@B:=BarycentricSubdivision(K);|
  Simplicial complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@Size(B);|
  1622517
  !gapprompt@gap>| !gapinput@N:=Nerve(K);|
  Simplicial complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@Size(N);|
  48745
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Some limitations to representing spaces as regular CW complexes}}\logpage{[ 1, 17, 0 ]}
\hyperdef{L}{X7900FD197F175551}{}
{
 By a \emph{classifying space} for a group $G$ we mean a path\texttt{\symbol{45}}connected space $BG$ with fundamental group $\pi_1(BG)\cong G$ isomorphic to $G$ and with higher homotopy groups $\pi_n(BG)=0$ trivial for all $n\ge 2$. The homology of the group $G$ can be defined to be the homology of $BG$: $H_n(G,\mathbb Z) = H_n(BG,\mathbb Z)$. 

In principle $BG$ can always be constructed as a regular CW\texttt{\symbol{45}}complex. For
instance, the following extremely slow commands construct the $5$\texttt{\symbol{45}}skeleton $Y^5$ of a regular CW\texttt{\symbol{45}}classifying space $Y=BG$ for the dihedral group of order $16$ and use it to calculate $H_1(G,\mathbb Z)=\mathbb Z_2\oplus \mathbb Z_2$, $H_2(G,\mathbb Z)=\mathbb Z_2$, $H_3(G,\mathbb Z)=\mathbb Z_{2}\oplus \mathbb Z_2 \oplus \mathbb Z_8$, $H_4(G,\mathbb Z)=\mathbb Z_{2} \oplus \mathbb Z_2$. The final command shows that the constructed space $Y^5$ in this example is a $5$\texttt{\symbol{45}}dimensional regular CW\texttt{\symbol{45}}complex with a
total of $15289$ cells. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=ClassifyingSpaceFiniteGroup(DihedralGroup(16),5);|
  Regular CW-complex of dimension 5
  !gapprompt@gap>| !gapinput@Homology(Y,1);|
  [ 2, 2 ]
  !gapprompt@gap>| !gapinput@Homology(Y,2);|
  [ 2 ]
  !gapprompt@gap>| !gapinput@Homology(Y,3);|
  [ 2, 2, 8 ]
  !gapprompt@gap>| !gapinput@Homology(Y,4);|
  [ 2, 2 ]
  !gapprompt@gap>| !gapinput@Size(Y);|
  15289
  
  
\end{Verbatim}
 The $n$\texttt{\symbol{45}}skeleton of a regular CW\texttt{\symbol{45}}classifying
space of a finite group necessarily involves a large number of cells. For the
group $G=C_2$ of order two a classifying space can be take to be real projective space $BG=\mathbb RP^\infty$ with $n$\texttt{\symbol{45}}skeleton $BG^n=\mathbb RP^n$. To realize $BG^n=\mathbb RP^n$ as a simplicial complex it is known that one needs at least 6 vertices for $n=2$, at least 11 vertices for $n=3$ and at least 16 vertices for $n=4$. One can do a bit better by allowing $BG$ to be a regular CW\texttt{\symbol{45}}complex. For instance, the following
creates $\mathbb RP^4$ as a regular CW\texttt{\symbol{45}}complex with 5 vertices. This construction
of $\mathbb RP^4$ involves a total of 121 cells. A minimal triangulation of $\mathbb RP^4$ would require 991 simplices. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|Y:=ClassifyingSpaceFiniteGroup(CyclicGroup(2),4);A
  Regular CW-complex of dimension 4
  @gapprompt|gap>A @gapinput|Y!.nrCells(0);                                   A
  5
  @gapprompt|gap>A @gapinput|Y!.nrCells(1);A
  20
  @gapprompt|gap>A @gapinput|Y!.nrCells(2);A
  40
  @gapprompt|gap>A @gapinput|Y!.nrCells(3);                                   A
  40
  @gapprompt|gap>A @gapinput|Y!.nrCells(4);A
  16
  
\end{Verbatim}
 The space $\mathbb RP^n$ can be given the structure of a regular CW\texttt{\symbol{45}}complex with $n+1$ vertices. Kuehnel has described a triangulation of $\mathbb RP^n$ with $2^{n+1}-1$ vertices. 

The above examples suggest that it is inefficient/impractical to attempt to
compute the $n$\texttt{\symbol{45}}th homology of a group $G$ by first constructing a regular CW\texttt{\symbol{45}}complex corresponding
for the $n+1$ of a classifying space $BG$, even for quite small groups $G$, since such spaces seem to require a large number of cells in each dimension.
On the other hand, by dropping the requirement that $BG$ must be regular we can obtain much smaller CW\texttt{\symbol{45}}complexes.
The following example constructs $\mathbb RP^9$ as a regular CW\texttt{\symbol{45}}complex and then shows that it can be given
a non\texttt{\symbol{45}}regular CW\texttt{\symbol{45}}structure with just one
cell in each dimension. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=ClassifyingSpaceFiniteGroup(CyclicGroup(2),9);|
  Regular CW-complex of dimension 9
  !gapprompt@gap>| !gapinput@Size(Y);|
  29524
  !gapprompt@gap>| !gapinput@CriticalCells(Y);|
  [ [ 9, 1 ], [ 8, 124 ], [ 7, 1215 ], [ 6, 1246 ], [ 5, 487 ], [ 4, 254 ], 
    [ 3, 117 ], [ 2, 54 ], [ 1, 9 ], [ 0, 10 ] ]
  
\end{Verbatim}
 It is of course well\texttt{\symbol{45}}known that $\mathbb RP^\infty$ admits a theoretically described CW\texttt{\symbol{45}}structure with just one
cell in each dimension. The question is: how best to represent this on a
computer? }

 
\section{\textcolor{Chapter }{Equivariant CW complexes}}\logpage{[ 1, 18, 0 ]}
\hyperdef{L}{X85A579217DCB6CC8}{}
{
 As just explained, the representations of spaces as simplicial complexes and
regular CW complexes have their limitations. One limitation is that the number
of cells needed to describe a space can be unnecessarily large. A minimal
simplicial complex structure for the torus has $7$ vertices, $21$ edges and $14$ triangles. A minimal regular CW\texttt{\symbol{45}}complex structure for the
torus has $4$ vertices, $8$ edges and $4$ cells of dimension $2$. By using simplicial sets (which are like simplicial complexes except that
they allow the freedom to attach simplicial cells by gluing their boundary
non\texttt{\symbol{45}}homeomorphically) one obtains a minimal triangulation
of the torus involving $1$ vertex, $3$ edges and $2$ cells of dimension $2$. By using non\texttt{\symbol{45}}regular CW\texttt{\symbol{45}}complexes one
obtains a minimal cell structure involving $1$ vertex, $2$ edges and $1$ cell of dimension $2$. Minimal cell structures (in the four different categories) for the torus are
illustrated as follows. 

  

  

A second limitation to our representations of simplicial and regular
CW\texttt{\symbol{45}}complexes is that they apply only to structures with
finitely many cells. They do no apply, for instance, to the simplicial complex
structure on the real line $\mathbb R$ in which each each integer $n$ is a vertex and each interval $[n,n+1]$ is an edge. 

 Simplicial sets provide one approach to the efficient combinatorial
representation of certain spaces. So too do cubical sets (the analogues of
simplicial sets in which each cell has the combinatorics of an $n$\texttt{\symbol{45}}cube rather than an $n$\texttt{\symbol{45}}simplex). Neither of these two approaches has been
implemented in \textsc{HAP}. 

 Simplicial sets endowed with the action of a (possibly infinite) group $G$ provide for an efficient representation of (possibly infinite) cell structures
on a wider class of spaces. Such a structure can be made precise and is known
as a \emph{simplicial group}. Some functionality for simplicial groups is implemented in \textsc{HAP} and described in Chapter \ref{chapSimplicialGroups}. 

A regular CW\texttt{\symbol{45}}complex endowed with the action of a (possibly
infinite) group $G$ is an alternative approach to the efficient combinatorial representation of
(possibly infinite) cell structures on spaces. Much of \textsc{HAP} is focused on this approach. As a first example of the idea, the following
commands construct the infinite regular CW\texttt{\symbol{45}}complex $Y=\widetilde T$ arising as the universal cover of the torus $T=\mathbb S^1\times \mathbb S^1$ where $T$ is given the above minimal non\texttt{\symbol{45}}regular CW structure
involving $1$ vertex, $2$ edges, and $1$ cell of dimension $2$. The homology $H_n(T,\mathbb Z)$ is computed and the fundamental group of the torus $T$ is recovered. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FreeGroup(2);;x:=F.1;;y:=F.2;;|
  !gapprompt@gap>| !gapinput@G:=F/[ x*y*x^-1*y^-1 ];;|
  !gapprompt@gap>| !gapinput@Y:=EquivariantTwoComplex(G);|
  Equivariant CW-complex of dimension 2
  
  !gapprompt@gap>| !gapinput@C:=ChainComplexOfQuotient(Y);|
  Chain complex of length 2 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Homology(C,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(C,1);|
  [ 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(C,2);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@FundamentalGroupOfQuotient(Y);|
  <fp group of size infinity on the generators [ f1, f2 ]>
  
\end{Verbatim}
 

As a second example, the following comands load group number $9$ in the library of $3$\texttt{\symbol{45}}dimensional crystallographic groups. They verify that $G$ acts freely on $\mathbb R^3$ (i.e. $G$ is a \emph{Bieberbach group}) and then construct a $G$\texttt{\symbol{45}}equivariant CW\texttt{\symbol{45}}complex $Y=\mathbb R^3$ corresponding to the tessellation of $\mathbb R^3$ by a fundamental domain for $G$. Finally, the cohomology $H_n(M,\mathbb Z)$ of the $3$\texttt{\symbol{45}}dimensional closed manifold $M=\mathbb R^3/G$ is computed. The manifold $M$ is seen to be non\texttt{\symbol{45}}orientable (since it's
top\texttt{\symbol{45}}dimensional homology is trivial) and has a
non\texttt{\symbol{45}}regular CW structure with $1$ vertex, $3$ edges, $3$ cells of dimension $2$, and $1$ cell of dimension $3$. (This example uses Polymake software.) 
\begin{Verbatim}[commandchars=@|D,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>D @gapinput|G:=SpaceGroup(3,9);;D
  @gapprompt|gap>D @gapinput|IsAlmostBieberbachGroup(Image(IsomorphismPcpGroup(G)));D
  true
  @gapprompt|gap>D @gapinput|Y:=EquivariantEuclideanSpace(G,[0,0,0]);D
  Equivariant CW-complex of dimension 3
  
  @gapprompt|gap>D @gapinput|Y!.dimension(0);D
  1
  @gapprompt|gap>D @gapinput|Y!.dimension(1);D
  3
  @gapprompt|gap>D @gapinput|Y!.dimension(2);D
  3
  @gapprompt|gap>D @gapinput|Y!.dimension(3);D
  1
  @gapprompt|gap>D @gapinput|C:=ChainComplexOfQuotient(Y);D
  Chain complex of length 3 in characteristic 0 . 
  
  @gapprompt|gap>D @gapinput|Homology(C,0);D
  [ 0 ]
  @gapprompt|gap>D @gapinput|Homology(C,1);D
  [ 0, 0 ]
  @gapprompt|gap>D @gapinput|Homology(C,2);D
  [ 2, 0 ]
  @gapprompt|gap>D @gapinput|Homology(C,3);D
  [  ]
  
\end{Verbatim}
 The fundamental domain for the action of $G$ in the above example is constructed to be the
Dirichlet\texttt{\symbol{45}}Voronoi region in $\mathbb R^3$ whose points are closer to the origin $v=(0,0,0)$ than to any other point $v^g$ in the orbit of the origin under the action of $G$. This fundamental domain can be visualized as follows. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FundamentalDomainStandardSpaceGroup([0,0,0],G);|
  <polymake object>
  !gapprompt@gap>| !gapinput@Polymake(F,"VISUAL");|
  
\end{Verbatim}
 

 

 Other fundamental domains for the same group action can be obtained by
choosing some other starting vector $v$. For example: 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FundamentalDomainStandardSpaceGroup([1/2,1/3,1/5],G);;|
  !gapprompt@gap>| !gapinput@Polymake(F,"VISUAL");|
  
  !gapprompt@gap>| !gapinput@F:=FundamentalDomainStandardSpaceGroup([1/7,1/2,1/2],G);|
  !gapprompt@gap>| !gapinput@Polymake(F,"VISUAL");|
  
\end{Verbatim}
 

  }

 
\section{\textcolor{Chapter }{Orbifolds and classifying spaces}}\label{secOrbifolds}
\logpage{[ 1, 19, 0 ]}
\hyperdef{L}{X86881717878ADCD6}{}
{
 If a discrete group $G$ acts on Euclidean space or hyperbolic space with finite stabilizer groups then
we say that the quotient space obtained by killing the action of $G$ an an \emph{orbifold}. If the stabilizer groups are all trivial then the quotient is of course a
manifold. 

An orbifold is represented as a $G$\texttt{\symbol{45}}equivariant regular CW\texttt{\symbol{45}}complex together
with the stabilizer group for a representative of each orbit of cells and its
subgroup consisting of those group elements that preserve the cell
orientation. \textsc{HAP} stores orbifolds using the data type of \emph{non\texttt{\symbol{45}}free resolution} and uses them mainly as a first step in constructing free $\mathbb ZG$\texttt{\symbol{45}}resolutions of $\mathbb Z$. 

 The following commands use an $8$\texttt{\symbol{45}}dimensional equivariant deformation retract of a $GL_3(\mathbb Z[{\bf i}])$\texttt{\symbol{45}}orbifold structure on hyperbolic space to compute $H_5(GL_3({\mathbb Z}[{\bf i}],\mathbb Z) = \mathbb Z_2^5\oplus \mathbb Z_4^2$. (The deformation retract is stored in a library and was supplied by Mathieu
Dutour Sikiric.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Orbifold:=ContractibleGcomplex("PGL(3,Z[i])");|
  Non-free resolution in characteristic 0 for matrix group . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(Orbifold,6);|
  Resolution of length 5 in characteristic 0 for matrix group . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R),5);|
  [ 2, 2, 2, 2, 2, 4, 4 ]
  
\end{Verbatim}
 The next example computes an orbifold structure on $\mathbb R^4$, and then the first $12$ degrees of a free resolution/classifying space, for the second $4$\texttt{\symbol{45}}dimensional crystallographic group $G$ in the library of crystallographic groups. The resolution is shown to be
periodic of period $2$ in degrees $\ge 5$. The cohomology is seen to have $11$ ring generators in degree $2$ and no further ring generators. The cohomology groups are:
\$\$H\texttt{\symbol{94}}n(G,\texttt{\symbol{92}}mathbb Z)
=\texttt{\symbol{92}}left(
\texttt{\symbol{92}}begin\texttt{\symbol{123}}array\texttt{\symbol{125}}\texttt{\symbol{123}}ll\texttt{\symbol{125}}
0, \& \texttt{\symbol{123}}\texttt{\symbol{92}}rm
odd\texttt{\symbol{126}}\texttt{\symbol{125}} n\texttt{\symbol{92}}ge
1\texttt{\symbol{92}}\texttt{\symbol{92}} \texttt{\symbol{92}}mathbb
Z{\textunderscore}2\texttt{\symbol{94}}5 \texttt{\symbol{92}}oplus
\texttt{\symbol{92}}mathbb Z\texttt{\symbol{94}}6, \&
n=2\texttt{\symbol{92}}\texttt{\symbol{92}} \texttt{\symbol{92}}mathbb
Z{\textunderscore}2\texttt{\symbol{94}}\texttt{\symbol{123}}15\texttt{\symbol{125}}\texttt{\symbol{92}}oplus
\texttt{\symbol{92}}mathbb Z, \& n=4\texttt{\symbol{92}}\texttt{\symbol{92}}
\texttt{\symbol{92}}mathbb
Z{\textunderscore}2\texttt{\symbol{94}}\texttt{\symbol{123}}16\texttt{\symbol{125}},
\& \texttt{\symbol{123}}\texttt{\symbol{92}}rm
even\texttt{\symbol{126}}\texttt{\symbol{125}} n \texttt{\symbol{92}}ge 6
.\texttt{\symbol{92}}\texttt{\symbol{92}}
\texttt{\symbol{92}}end\texttt{\symbol{123}}array\texttt{\symbol{125}}\texttt{\symbol{92}}right.\$\$ 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|G:=SpaceGroup(4,2);;A
  @gapprompt|gap>A @gapinput|R:=ResolutionCubicalCrystGroup(G,12);A
  Resolution of length 12 in characteristic 0 for <matrix group with 
  5 generators> . 
  
  @gapprompt|gap>A @gapinput|R!.dimension(5);A
  16
  @gapprompt|gap>A @gapinput|R!.dimension(7);A
  16
  @gapprompt|gap>A @gapinput|List([1..16],k->R!.boundary(5,k)=R!.boundary(7,k));A
  [ true, true, true, true, true, true, true, true, true, true, true, true, 
    true, true, true, true ]
  
  @gapprompt|gap>A @gapinput|C:=HomToIntegers(R);A
  Cochain complex of length 12 in characteristic 0 . 
  
  @gapprompt|gap>A @gapinput|Cohomology(C,0);A
  [ 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,1);A
  [  ]
  @gapprompt|gap>A @gapinput|Cohomology(C,2);A
  [ 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,3);A
  [  ]
  @gapprompt|gap>A @gapinput|Cohomology(C,4);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,5);A
  [  ]
  @gapprompt|gap>A @gapinput|Cohomology(C,6);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,7);A
  [  ]
  
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,1);A
  [  ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,2);A
  [ [ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], 
    [ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ], 
    [ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ], 
    [ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ], 
    [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ], 
    [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ] ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,3);A
  [  ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,4);A
  [  ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,5);A
  [  ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,6);A
  [  ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,7);A
  [  ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,8);A
  [  ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,9);A
  [  ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,10);A
  [  ]
  
  
\end{Verbatim}
 

 A group $G$ with a finite index torsion free nilpotent subgroup admits a resolution which
is periodic in sufficiently high degrees if and only if all of its finite
index subgroups admit periodic resolutions. The following commands identify
the $99$ $3$\texttt{\symbol{45}}dimensional space groups (respectively, the $1191$ $4$\texttt{\symbol{45}}dimensional space groups) that admit a resolution which is
periodic in degrees $> 3$ (respectively, in degrees $> 4$). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L3:=Filtered([1..219],k->IsPeriodicSpaceGroup(SpaceGroup(3,k)));|
  [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 15, 17, 18, 19, 21, 24, 26, 27, 28, 
    29, 30, 31, 32, 33, 34, 36, 37, 39, 40, 41, 43, 45, 46, 52, 54, 55, 56, 58, 
    61, 62, 74, 75, 76, 77, 78, 79, 80, 81, 84, 85, 87, 89, 92, 98, 101, 102, 
    107, 111, 119, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 
    152, 153, 154, 155, 157, 159, 161, 162, 163, 164, 165, 166, 168, 171, 172, 
    174, 175, 176, 178, 180, 186, 189, 192, 196, 198, 209 ] 
  
  !gapprompt@gap>| !gapinput@L4:=Filtered([1..4783],k->IsPeriodicSpaceGroup(SpaceGroup(4,k)));|
  [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 25,
    26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, 46, 47, 48,
    49, 50, 51, 52, 53, 54, 55, 56, 58, 59, 60, 61, 62, 63, 65, 66, 68, 69, 70,
    71, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89, 90, 91,
    93, 94, 95, 96, 97, 98, 99, 101, 102, 103, 104, 105, 107, 108, 109, 110,
    111, 113, 115, 116, 118, 119, 120, 121, 122, 124, 126, 127, 128, 130, 131,
    134, 141, 144, 145, 149, 151, 153, 154, 155, 156, 157, 158, 159, 160, 162,
    163, 165, 167, 168, 169, 170, 171, 172, 173, 174, 176, 178, 179, 180, 187,
    188, 197, 198, 202, 204, 205, 206, 211, 212, 219, 220, 222, 226, 233, 237,
    238, 239, 240, 241, 242, 243, 244, 245, 247, 248, 249, 250, 251, 253, 254,
    255, 256, 257, 259, 260, 261, 263, 264, 265, 266, 267, 269, 270, 271, 273,
    275, 277, 278, 279, 281, 283, 285, 290, 292, 296, 297, 298, 299, 300, 301,
    303, 304, 305, 314, 316, 317, 319, 327, 328, 329, 333, 335, 342, 355, 357,
    358, 359, 361, 362, 363, 365, 366, 367, 368, 369, 370, 372, 374, 376, 378,
    381, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397,
    398, 399, 400, 401, 402, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413,
    414, 415, 416, 417, 418, 419, 421, 422, 423, 424, 425, 426, 427, 428, 429,
    430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 442, 443, 444, 445,
    446, 447, 448, 450, 451, 458, 459, 462, 464, 465, 466, 467, 469, 470, 473,
    477, 478, 479, 482, 483, 484, 485, 486, 493, 495, 497, 501, 502, 503, 504,
    505, 507, 508, 512, 514, 515, 516, 517, 522, 524, 525, 526, 527, 533, 537,
    539, 540, 541, 542, 543, 544, 546, 548, 553, 555, 558, 562, 564, 565, 566,
    567, 568, 571, 572, 573, 574, 576, 577, 580, 581, 582, 589, 590, 591, 593,
    596, 598, 599, 612, 613, 622, 623, 624, 626, 632, 641, 647, 649, 651, 652,
    654, 656, 657, 658, 659, 661, 662, 663, 665, 666, 667, 668, 669, 670, 671,
    672, 674, 676, 677, 678, 679, 680, 682, 683, 684, 686, 688, 689, 690, 691,
    692, 694, 696, 697, 698, 699, 700, 702, 708, 710, 712, 714, 716, 720, 722,
    728, 734, 738, 739, 741, 742, 744, 745, 752, 754, 756, 757, 758, 762, 763,
    769, 770, 778, 779, 784, 788, 790, 800, 801, 843, 845, 854, 855, 856, 857,
    865, 874, 900, 904, 909, 911, 913, 915, 916, 917, 919, 920, 921, 922, 923,
    924, 925, 926, 927, 929, 931, 932, 933, 934, 936, 938, 940, 941, 943, 945,
    946, 953, 955, 956, 958, 963, 966, 972, 973, 978, 979, 981, 982, 983, 985,
    987, 988, 989, 991, 992, 993, 995, 996, 998, 999, 1000, 1003, 1011, 1022,
    1024, 1025, 1026, 1162, 1167, 1236, 1237, 1238, 1239, 1240, 1241, 1242,
    1243, 1244, 1246, 1248, 1250, 1255, 1264, 1267, 1270, 1273, 1279, 1280,
    1281, 1283, 1284, 1289, 1291, 1293, 1294, 1324, 1325, 1326, 1327, 1328,
    1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340,
    1341, 1343, 1345, 1347, 1348, 1349, 1350, 1351, 1352, 1354, 1356, 1357,
    1358, 1359, 1361, 1363, 1365, 1367, 1372, 1373, 1374, 1375, 1376, 1377,
    1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389,
    1390, 1393, 1395, 1397, 1399, 1400, 1401, 1404, 1405, 1408, 1410, 1419,
    1420, 1421, 1422, 1424, 1425, 1426, 1428, 1429, 1438, 1440, 1441, 1442,
    1443, 1444, 1445, 1449, 1450, 1451, 1456, 1457, 1460, 1461, 1462, 1464,
    1465, 1470, 1472, 1473, 1477, 1480, 1481, 1487, 1488, 1489, 1493, 1494,
    1495, 1501, 1503, 1506, 1509, 1512, 1515, 1518, 1521, 1524, 1527, 1530,
    1532, 1533, 1534, 1537, 1538, 1541, 1542, 1544, 1547, 1550, 1552, 1553,
    1554, 1558, 1565, 1566, 1568, 1573, 1644, 1648, 1673, 1674, 1700, 1702,
    1705, 1713, 1714, 1735, 1738, 1740, 1741, 1742, 1743, 1744, 1745, 1746,
    1747, 1748, 1749, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1759,
    1761, 1762, 1763, 1765, 1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774,
    1775, 1778, 1779, 1782, 1783, 1785, 1787, 1788, 1789, 1791, 1793, 1795,
    1797, 1798, 1799, 1800, 1801, 1803, 1806, 1807, 1809, 1810, 1811, 1813,
    1815, 1821, 1822, 1823, 1828, 1829, 1833, 1837, 1839, 1842, 1845, 1848,
    1850, 1851, 1852, 1854, 1856, 1857, 1858, 1859, 1860, 1861, 1863, 1866,
    1870, 1873, 1874, 1877, 1880, 1883, 1885, 1886, 1887, 1889, 1892, 1895,
    1915, 1918, 1920, 1923, 1925, 1927, 1928, 1930, 1952, 1953, 1954, 1955,
    2045, 2047, 2049, 2051, 2053, 2054, 2055, 2056, 2057, 2059, 2067, 2068,
    2072, 2075, 2076, 2079, 2084, 2087, 2088, 2092, 2133, 2135, 2136, 2137,
    2139, 2140, 2170, 2171, 2196, 2224, 2234, 2236, 2238, 2254, 2355, 2356,
    2386, 2387, 2442, 2445, 2448, 2451, 2478, 2484, 2487, 2490, 2493, 2496,
    2499, 2502, 2508, 2511, 2514, 2517, 2520, 2523, 2550, 2553, 2559, 2621,
    2624, 2648, 2650, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054,
    3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066,
    3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078,
    3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3089, 3090, 3091,
    3094, 3095, 3096, 3099, 3100, 3101, 3104, 3105, 3106, 3109, 3110, 3111,
    3112, 3113, 3114, 3115, 3117, 3119, 3120, 3121, 3122, 3123, 3124, 3125,
    3127, 3128, 3129, 3130, 3131, 3132, 3133, 3135, 3137, 3139, 3141, 3142,
    3143, 3144, 3145, 3149, 3151, 3152, 3153, 3154, 3155, 3157, 3159, 3160,
    3161, 3162, 3163, 3169, 3170, 3171, 3172, 3173, 3174, 3175, 3177, 3179,
    3180, 3181, 3182, 3183, 3184, 3185, 3187, 3188, 3189, 3190, 3191, 3192,
    3193, 3195, 3197, 3199, 3200, 3201, 3204, 3206, 3207, 3208, 3209, 3210,
    3212, 3214, 3215, 3216, 3217, 3218, 3226, 3234, 3235, 3236, 3244, 3252,
    3253, 3254, 3260, 3268, 3269, 3270, 3278, 3280, 3281, 3282, 3283, 3284,
    3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, 3295, 3296, 3298, 3299,
    3302, 3303, 3306, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316,
    3317, 3318, 3319, 3320, 3322, 3324, 3326, 3327, 3329, 3330, 3338, 3345,
    3346, 3347, 3348, 3350, 3351, 3352, 3354, 3355, 3356, 3359, 3360, 3361,
    3362, 3374, 3375, 3383, 3385, 3398, 3399, 3417, 3418, 3419, 3420, 3422,
    3424, 3426, 3428, 3446, 3447, 3455, 3457, 3469, 3471, 3521, 3523, 3524,
    3525, 3530, 3531, 3534, 3539, 3542, 3545, 3548, 3550, 3551, 3554, 3557,
    3579, 3580, 3830, 3831, 3832, 3833, 3835, 3837, 3839, 3849, 3851, 3877,
    3938, 3939, 3949, 3951, 3952, 3958, 3960, 3962, 3963, 3964, 3966, 3968,
    3972, 3973, 3975, 4006, 4029, 4030, 4033, 4034, 4037, 4038, 4046, 4048,
    4050, 4062, 4064, 4067, 4078, 4081, 4089, 4090, 4114, 4138, 4139, 4140,
    4141, 4146, 4147, 4148, 4149, 4154, 4155, 4169, 4171, 4175, 4180, 4183,
    4188, 4190, 4204, 4205, 4223, 4224, 4225, 4254, 4286, 4289, 4391, 4397,
    4496, 4499, 4500, 4501, 4502, 4504, 4508, 4510, 4521, 4525, 4544, 4559,
    4560, 4561, 4562, 4579, 4580, 4581, 4583, 4587, 4597, 4598, 4599, 4600,
    4651, 4759, 4760, 4761, 4762, 4766 ]
  
  
\end{Verbatim}
 }

 }

 
\chapter{\textcolor{Chapter }{Cubical complexes \& permutahedral complexes}}\logpage{[ 2, 0, 0 ]}
\hyperdef{L}{X7F8376F37AF80AAC}{}
{
 
\section{\textcolor{Chapter }{Cubical complexes}}\logpage{[ 2, 1, 0 ]}
\hyperdef{L}{X7D67D5F3820637AD}{}
{
 A \emph{finite simplicial complex} can be defined to be a CW\texttt{\symbol{45}}subcomplex of the canonical
regular CW\texttt{\symbol{45}}structure on a simplex $\Delta^n$ of some dimension $n$. Analogously, a \emph{finite cubical complex} is a CW\texttt{\symbol{45}}subcomplex of the regular
CW\texttt{\symbol{45}}structure on a cube $[0,1]^n$ of some dimension $n$. Equivalently, but more conveniently, we can replace the unit interval $[0,1]$ by an interval $[0,k]$ with CW\texttt{\symbol{45}}structure involving $2k+1$ cells, namely one $0$\texttt{\symbol{45}}cell for each integer $0\le j\le k$ and one $1$\texttt{\symbol{45}}cell for each open interval $(j,j+1)$ for $0\le j\le k-1$. A \emph{finite cuical complex} $M$ is a CW\texttt{\symbol{45}}subcompex $M\subset [0,k_1]\times [0,k_2]\times \cdots [0,k_n]$ of a direct product of intervals, the direct product having the usual direct
product CW\texttt{\symbol{45}}structure. The equivalence of these two
definitions follows from the Gray code embedding of a mesh into a hypercube.
We say that the cubical complex has \emph{ambient dimension} $n$. A cubical complex $M$ of ambient dimension $n$ is said to be \emph{pure} if each cell lies in the boundary of an $n$\texttt{\symbol{45}}cell. In other words, $M$ is pure if it is a union of unit $n$\texttt{\symbol{45}}cubes in $\mathbb R^n$, each unit cube having vertices with integer coordinates. 

\textsc{HAP} has a datatype for finite cubical complexes, and a slightly different datatype
for pure cubical complexes. 

 The following example constructs the granny knot (the sum of a trefoil knot
with its reflection) as a $3$\texttt{\symbol{45}}dimensional pure cubical complex, and then displays it. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=PureCubicalKnot(3,1);|
  prime knot 1 with 3 crossings
  
  !gapprompt@gap>| !gapinput@L:=ReflectedCubicalKnot(K);|
  Reflected( prime knot 1 with 3 crossings )
  
  !gapprompt@gap>| !gapinput@M:=KnotSum(K,L);|
  prime knot 1 with 3 crossings + Reflected( prime knot 1 with 3 crossings )
  
  !gapprompt@gap>| !gapinput@Display(M);|
  
\end{Verbatim}
  

 Next we construct the complement $Y=D^3\setminus \mathring{M}$ of the interior of the pure cubical complex $M$. Here $D^3$ is a rectangular region with $M \subset \mathring{D^3}$. This pure cubical complex $Y$ is a union of $5891$ unit $3$\texttt{\symbol{45}}cubes. We contract $Y$ to get a homotopy equivalent pure cubical complex $YY$ consisting of the union of just $775$ unit $3$\texttt{\symbol{45}}cubes. Then we convert $YY$ to a regular CW\texttt{\symbol{45}}complex $W$ involving $11939$ cells. We contract $W$ to obtain a homotopy equivalent regular CW\texttt{\symbol{45}}complex $WW$ involving $5993$ cells. Finally we compute the fundamental group of the complement of the
granny knot, and use the presentation of this group to establish that the
Alexander polynomial $P(x)$ of the granny is 

$P(x) = x^4-2x^3+3x^2-2x+1 \ .$ 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=PureComplexComplement(M);|
  Pure cubical complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@Size(Y);|
  5891
  
  !gapprompt@gap>| !gapinput@YY:=ZigZagContractedComplex(Y);|
  Pure cubical complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@Size(YY);|
  775
  
  !gapprompt@gap>| !gapinput@W:=RegularCWComplex(YY);|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@Size(W);|
  11939
  
  !gapprompt@gap>| !gapinput@WW:=ContractedComplex(W);|
  Regular CW-complex of dimension 2
  
  !gapprompt@gap>| !gapinput@Size(WW);|
  5993
  
  !gapprompt@gap>| !gapinput@G:=FundamentalGroup(WW);|
  <fp group of size infinity on the generators [ f1, f2, f3 ]>
  
  !gapprompt@gap>| !gapinput@AlexanderPolynomial(G);|
  x_1^4-2*x_1^3+3*x_1^2-2*x_1+1
  
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Permutahedral complexes}}\logpage{[ 2, 2, 0 ]}
\hyperdef{L}{X85D8195379F2A8CA}{}
{
 

A finite pure cubical complex is a union of finitely many cubes in a
tessellation of $\mathbb R^n$ by unit cubes. One can also tessellate $\mathbb R^n$ by permutahedra, and we define a finite $n$\texttt{\symbol{45}}dimensional pure \emph{permutahedral complex} to be a union of finitely many permutahdra from such a tessellation. There are
two features of pure permutahedral complexes that are particularly useful in
some situations: 
\begin{itemize}
\item  Pure permutahedral complexes are topological manifolds with boundary. 
\item  The method used for finding a smaller pure cubical complex $M'$ homotopy equivalent to a given pure cubical complex $M$ retains the homeomorphism type, and not just the homotopy type, of the space $M$.
\end{itemize}
 

\textsc{Example 1} 

To illustrate these features the following example begins by reading in a
protein backbone from the online \href{https://www.rcsb.org/} {Protein Database}, and storing it as a pure cubical complex $K$. The ends of the protein have been joined, and the homology $H_i(K,\mathbb Z)=\mathbb Z$, $i=0,1$ is seen to be that of a circle. We can thus regard the protein as a knot $K\subset \mathbb R^3$. The protein is visualized as a pure permutahedral complex. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("data1V2X.pdb");;|
  !gapprompt@gap>| !gapinput@K:=ReadPDBfileAsPurePermutahedralComplex("file");|
  Pure permutahedral complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@Homology(K,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(K,1);|
  [ 0 ]
  
  Display(K);
  
\end{Verbatim}
  

An alternative method for seeing that the pure permutahedral complex $K$ has the homotopy type of a circle is to note that it is covered by open
permutahedra (small open neighbourhoods of the closed $3$\texttt{\symbol{45}}dimensional permutahedral titles) and to form the nerve $N=Nerve({\mathcal U})$ of this open covering $\mathcal U$. The nerve $N$ has the same homotopy type as $K$. The following commands establish that $N$ is a $1$\texttt{\symbol{45}}dimensional simplicial complex and display $N$ as a circular graph. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@N:=Nerve(K);|
  Simplicial complex of dimension 1.
  
  !gapprompt@gap>| !gapinput@Display(GraphOfSimplicialComplex(N));|
  
\end{Verbatim}
  

 The boundary of the pure permutahedral complex $K$ is a $2$\texttt{\symbol{45}}dimensional CW\texttt{\symbol{45}}complex $B$ homeomorphic to a torus. We next use the advantageous features of pure
permutahedral complexes to compute the homomorphism 

$\phi\colon \pi_1(B) \rightarrow \pi_1(\mathbb R^3\setminus \mathring{K}), a
\mapsto yx^{-3}y^2x^{-2}yxy^{-1}, b\mapsto yx^{-1}y^{-1}x^2y^{-1}$ 

where\\
 $\pi_1(B)=< a,b\, :\, aba^{-1}b^{-1}=1>$,\\
 $\pi_1(\mathbb R^3\setminus \mathring{K}) \cong < x,y\, :\,
y^2x^{-2}yxy^{-1}=1, yx^{-2}y^{-1}x(xy^{-1})^2=1>$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=PureComplexComplement(K);|
  Pure permutahedral complex of dimension 3.
  !gapprompt@gap>| !gapinput@Size(Y);|
  418922
  
  !gapprompt@gap>| !gapinput@YY:=ZigZagContractedComplex(Y);|
  Pure permutahedral complex of dimension 3.
  !gapprompt@gap>| !gapinput@Size(YY);|
  3438
  
  !gapprompt@gap>| !gapinput@W:=RegularCWComplex(YY);|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@f:=BoundaryMap(W);|
  Map of regular CW-complexes
  
  !gapprompt@gap>| !gapinput@CriticalCells(Source(f));|
  [ [ 2, 1 ], [ 2, 261 ], [ 1, 1043 ], [ 1, 1626 ], [ 0, 2892 ], [ 0, 24715 ] ]
  
  !gapprompt@gap>| !gapinput@F:=FundamentalGroup(f,2892);|
  [ f1, f2 ] -> [ f2*f1^-3*f2^2*f1^-2*f2*f1*f2^-1, f2*f1^-1*f2^-1*f1^2*f2^-1 ]
  
  !gapprompt@gap>| !gapinput@G:=Target(F);|
  <fp group on the generators [ f1, f2 ]>
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(G);|
  [ f2^2*f1^-2*f2*f1*f2^-1, f2*f1^-2*f2^-1*f1*(f1*f2^-1)^2 ]
  
  
\end{Verbatim}
 

\textsc{Example 2} 

The next example of commands begins by readng two synthetic knots from a CSV
file (containing the coordinates of the two sequences of vertices) and
producing a pure permutahedral complex model of the two knots. The linking
number of two knots is given by the low\texttt{\symbol{45}}dimension cup
product of the complement of the knots. This linking number is computed to be $6$. 

  
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|file1:=HapFile("data175_1.csv");;B
  @gapprompt|gap>B @gapinput|file2:=HapFile("data175_2.csv");;B
  @gapprompt|gap>B @gapinput|K:=ReadCSVfileAsPureCubicalKnot( [file1, file2]);;B
  @gapprompt|gap>B @gapinput|K:=PurePermutahedralComplex(K!.binaryArray);;B
  @gapprompt|gap>B @gapinput|K:=ThickenedPureComplex(K);;B
  @gapprompt|gap>B @gapinput|K:=ContractedComplex(K);;B
  @gapprompt|gap>B @gapinput|#K is a permutahedral complex model of the two input knotsB
  @gapprompt|gap>B @gapinput|Display(K);B
  
  
  @gapprompt|gap>B @gapinput|Y:=PureComplexComplement(K);;B
  @gapprompt|gap>B @gapinput|W:=ZigZagContractedComplex(Y,2);;B
  @gapprompt|gap>B @gapinput|W:=RegularCWComplex(W);;B
  @gapprompt|gap>B @gapinput|W:=ContractedComplex(W);;B
  @gapprompt|gap>B @gapinput|G:=FundamentalGroup(W);;B
  @gapprompt|gap>B @gapinput|cup:=CupProduct(G);;B
  @gapprompt|gap>B @gapinput|cup([1,0],[0,1]);B
  [ -6, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Constructing pure cubical and permutahedral complexes}}\logpage{[ 2, 3, 0 ]}
\hyperdef{L}{X78D3037283B506E0}{}
{
 

 An $n$\texttt{\symbol{45}}dimensional pure cubical or permutahedral complex can be
created from an $n$\texttt{\symbol{45}}dimensional array of 0s and 1s. The following example
creates and displays two $3$\texttt{\symbol{45}}dimensional complexes. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=[[[0,0,0],[0,0,0],[0,0,0]],|
  !gapprompt@>| !gapinput@       [[1,1,1],[1,0,1],[1,1,1]],|
  !gapprompt@>| !gapinput@       [[0,0,0],[0,0,0],[0,0,0]]];;|
  !gapprompt@gap>| !gapinput@M:=PureCubicalComplex(A);|
  Pure cubical complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@P:=PurePermutahedralComplex(A);|
  Pure permutahedral complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@Display(M);|
  !gapprompt@gap>| !gapinput@Display(P);|
  
\end{Verbatim}
  }

 
\section{\textcolor{Chapter }{Computations in dynamical systems}}\logpage{[ 2, 4, 0 ]}
\hyperdef{L}{X8462CF66850CC3A8}{}
{
 

Pure cubical complexes can be useful for rigourous interval arithmetic
calculations in numerical analysis. They can also be useful for trying to
estimate approximations of certain numerical quantities. To illustrate the
latter we consider the \emph{Henon map} 

$f\colon \mathbb R^2 \rightarrow \mathbb R^2, \left( \begin{array}{cc} x\\ y
\end{array}\right) \mapsto \left( \begin{array}{cc} y+1-ax^2\\ bx \\
\end{array}\right) .$\\
 

Starting with $(x_0,y_0)=(0,0)$ and iterating $(x_{n+1},y_{n+1}) = f(x_n,y_n)$ with the parameter values $a=1.4$, $b=0.3$ one obtains a sequence of points which is known to be dense in the so called \emph{strange attractor} ${\cal A}$ of the Henon map. The first $10$ million points in this sequence are plotted in the following example, with
arithmetic performed to 100 decimal places of accuracy. The sequence is stored
as a $2$\texttt{\symbol{45}}dimensional pure cubical complex where each $2$\texttt{\symbol{45}}cell is square of side equal to $\epsilon =1/500$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=HenonOrbit([0,0],14/10,3/10,10^7,500,100);|
  Pure cubical complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@Size(M);|
  10287
  
  !gapprompt@gap>| !gapinput@Display(M);|
  
\end{Verbatim}
  

Repeating the computation but with squares of side $\epsilon =1/1000$ 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=HenonOrbit([0,0],14/10,3/10,10^7,1000,100);|
  
  !gapprompt@gap>| !gapinput@Size(M);|
  24949
  
\end{Verbatim}
 

 we obtain the heuristic estimate 

$\delta \simeq \frac{ \log{ 24949}- \log{ 10287}} {\log{2}} = 1.277 $ 

 for the box\texttt{\symbol{45}}counting dimension of the attractor $\cal A$. }

 }

 
\chapter{\textcolor{Chapter }{Covering spaces}}\logpage{[ 3, 0, 0 ]}
\hyperdef{L}{X87472058788D76C0}{}
{
 

Let $Y$ denote a finite regular CW\texttt{\symbol{45}}complex. Let $\widetilde Y$ denote its universal covering space. The covering space inherits a regular
CW\texttt{\symbol{45}}structure which can be computed and stored using the
datatype of a $\pi_1Y$\texttt{\symbol{45}}equivariant CW\texttt{\symbol{45}}complex. The cellular
chain complex $C_\ast\widetilde Y$ of $\widetilde Y$ can be computed and stored as an equivariant chain complex. Given an
admissible discrete vector field on $ Y,$ we can endow $Y$ with a smaller non\texttt{\symbol{45}}regular CW\texttt{\symbol{45}}structre
whose cells correspond to the critical cells in the vector field. This smaller
CW\texttt{\symbol{45}}structure leads to a more efficient chain complex $C_\ast \widetilde Y$ involving one free generator for each critical cell in the vector field. 
\section{\textcolor{Chapter }{Cellular chains on the universal cover}}\logpage{[ 3, 1, 0 ]}
\hyperdef{L}{X85FB4CA987BC92CC}{}
{
 

The following commands construct a $6$\texttt{\symbol{45}}dimensional regular CW\texttt{\symbol{45}}complex $Y\simeq S^1 \times S^1\times S^1$ homotopy equivalent to a product of three circles. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=[[1,1,1],[1,0,1],[1,1,1]];;|
  !gapprompt@gap>| !gapinput@S:=PureCubicalComplex(A);;|
  !gapprompt@gap>| !gapinput@T:=DirectProduct(S,S,S);;|
  !gapprompt@gap>| !gapinput@Y:=RegularCWComplex(T);;|
  Regular CW-complex of dimension 6
  
  !gapprompt@gap>| !gapinput@Size(Y);|
  110592
  
\end{Verbatim}
 

The CW\texttt{\symbol{45}}somplex $Y$ has $110592$ cells. The next commands construct a free $\pi_1Y$\texttt{\symbol{45}}equivariant chain complex $C_\ast\widetilde Y$ homotopy equivalent to the chain complex of the universal cover of $Y$. The chain complex $C_\ast\widetilde Y$ has just $8$ free generators. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|Y:=ContractedComplex(Y);;A
  @gapprompt|gap>A @gapinput|CU:=ChainComplexOfUniversalCover(Y);;A
  @gapprompt|gap>A @gapinput|List([0..Dimension(Y)],n->CU!.dimension(n));A
  [ 1, 3, 3, 1 ]
  
\end{Verbatim}
 

The next commands construct a subgroup $H < \pi_1Y$ of index $50$ and the chain complex $C_\ast\widetilde Y\otimes_{\mathbb ZH}\mathbb Z$ which is homotopy equivalent to the cellular chain complex $C_\ast\widetilde Y_H$ of the $50$\texttt{\symbol{45}}fold cover $\widetilde Y_H$ of $Y$ corresponding to $H$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|L:=LowIndexSubgroupsFpGroup(CU!.group,50);;A
  @gapprompt|gap>A @gapinput|H:=L[Length(L)-1];;A
  @gapprompt|gap>A @gapinput|Index(CU!.group,H);A
  50
  @gapprompt|gap>A @gapinput|D:=TensorWithIntegersOverSubgroup(CU,H);A
  Chain complex of length 3 in characteristic 0 .
  
  @gapprompt|gap>A @gapinput|List([0..3],D!.dimension);A
  [ 50, 150, 150, 50 ]
  
\end{Verbatim}
 

General theory implies that the $50$\texttt{\symbol{45}}fold covering space $\widetilde Y_H$ should again be homotopy equivalent to a product of three circles. In keeping
with this, the following commands verify that $\widetilde Y_H$ has the same integral homology as $S^1\times S^1\times S^1$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Homology(D,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(D,1);|
  [ 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(D,2);|
  [ 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(D,3);|
  [ 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Spun knots and the Satoh tube map}}\logpage{[ 3, 2, 0 ]}
\hyperdef{L}{X7E5CC04E7E3CCDAD}{}
{
 

We'll contruct two spaces $Y,W$ with isomorphic fundamental groups and isomorphic intergal homology, and use
the integral homology of finite covering spaces to establsh that the two
spaces have distinct homotopy types. 

By \emph{spinning} a link $K \subset \mathbb R^3$ about a plane $ P\subset \mathbb R^3$ with $P\cap K=\emptyset$, we obtain a collection $Sp(K)\subset \mathbb R^4$ of knotted tori. The following commands produce the two tori obtained by
spinning the Hopf link $K$ and show that the space $Y=\mathbb R^4\setminus Sp(K) = Sp(\mathbb R^3\setminus K)$ is connected with fundamental group $\pi_1Y = \mathbb Z\times \mathbb Z$ and homology groups $H_0(Y)=\mathbb Z$, $H_1(Y)=\mathbb Z^2$, $H_2(Y)=\mathbb Z^4$, $H_3(Y,\mathbb Z)=\mathbb Z^2$. The space $Y$ is only constructed up to homotopy, and for this reason is $3$\texttt{\symbol{45}}dimensional. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Hopf:=PureCubicalLink("Hopf");|
  Pure cubical link.
  
  !gapprompt@gap>| !gapinput@Y:=SpunAboutInitialHyperplane(PureComplexComplement(Hopf));|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@Homology(Y,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(Y,1);|
  [ 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(Y,2);|
  [ 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(Y,3);|
  [ 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(Y,4);|
  [  ]
  !gapprompt@gap>| !gapinput@GY:=FundamentalGroup(Y);;|
  !gapprompt@gap>| !gapinput@GeneratorsOfGroup(GY);|
  [ f2, f3 ]
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(GY);|
  [ f3^-1*f2^-1*f3*f2 ]
  
\end{Verbatim}
 

An alternative embedding of two tori $L\subset \mathbb R^4 $ can be obtained by applying the 'tube map' of Shin Satoh to a welded Hopf link \cite{MR1758871}. The following commands construct the complement $W=\mathbb R^4\setminus L$ of this alternative embedding and show that $W $ has the same fundamental group and integral homology as $Y$ above. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=HopfSatohSurface();|
  Pure cubical complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@W:=ContractedComplex(RegularCWComplex(PureComplexComplement(L)));|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@Homology(W,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(W,1);|
  [ 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(W,2);|
  [ 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(W,3);|
  [ 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(W,4);|
  [  ]
  
  !gapprompt@gap>| !gapinput@GW:=FundamentalGroup(W);;|
  !gapprompt@gap>| !gapinput@GeneratorsOfGroup(GW);|
  [ f1, f2 ]
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(GW);|
  [ f1^-1*f2^-1*f1*f2 ]
  
\end{Verbatim}
 

Despite having the same fundamental group and integral homology groups, the
above two spaces $Y$ and $W$ were shown by Kauffman and Martins \cite{MR2441256} to be not homotopy equivalent. Their technique involves the fundamental
crossed module derived from the first three dimensions of the universal cover
of a space, and counts the representations of this fundamental crossed module
into a given finite crossed module. This homotopy inequivalence is recovered
by the following commands which involves the $5$\texttt{\symbol{45}}fold covers of the spaces. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|CY:=ChainComplexOfUniversalCover(Y);A
  Equivariant chain complex of dimension 3
  @gapprompt|gap>A @gapinput|LY:=LowIndexSubgroups(CY!.group,5);;A
  @gapprompt|gap>A @gapinput|invY:=List(LY,g->Homology(TensorWithIntegersOverSubgroup(CY,g),2));;A
  
  @gapprompt|gap>A @gapinput|CW:=ChainComplexOfUniversalCover(W);A
  Equivariant chain complex of dimension 3
  @gapprompt|gap>A @gapinput|LW:=LowIndexSubgroups(CW!.group,5);;A
  @gapprompt|gap>A @gapinput|invW:=List(LW,g->Homology(TensorWithIntegersOverSubgroup(CW,g),2));;A
  
  @gapprompt|gap>A @gapinput|SSortedList(invY)=SSortedList(invW);A
  false
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cohomology with local coefficients}}\logpage{[ 3, 3, 0 ]}
\hyperdef{L}{X7C304A1C7EF0BA60}{}
{
 

The $\pi_1Y$\texttt{\symbol{45}}equivariant cellular chain complex $C_\ast\widetilde Y$ of the universal cover $\widetilde Y$ of a regular CW\texttt{\symbol{45}}complex $Y$ can be used to compute the homology $H_n(Y,A)$ and cohomology $H^n(Y,A)$ of $Y$ with local coefficients in a $\mathbb Z\pi_1Y$\texttt{\symbol{45}}module $A$. To illustrate this we consister the space $Y$ arising as the complement of the trefoil knot, with fundamental group $\pi_1Y = \langle x,y : xyx=yxy \rangle$. We take $A= \mathbb Z$ to be the integers with non\texttt{\symbol{45}}trivial $\pi_1Y$\texttt{\symbol{45}}action given by $x.1=-1, y.1=-1$. We then compute 

$\begin{array}{lcl} H_0(Y,A) &= &\mathbb Z_2\, ,\\ H_1(Y,A) &= &\mathbb Z_3\,
,\\ H_2(Y,A) &= &\mathbb Z\, .\end{array}$ 
\begin{Verbatim}[commandchars=@|E,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>E @gapinput|K:=PureCubicalKnot(3,1);;E
  @gapprompt|gap>E @gapinput|Y:=PureComplexComplement(K);;E
  @gapprompt|gap>E @gapinput|Y:=ContractedComplex(Y);;E
  @gapprompt|gap>E @gapinput|Y:=RegularCWComplex(Y);;E
  @gapprompt|gap>E @gapinput|Y:=SimplifiedComplex(Y);;E
  @gapprompt|gap>E @gapinput|C:=ChainComplexOfUniversalCover(Y);;E
  @gapprompt|gap>E @gapinput|G:=C!.group;;E
  @gapprompt|gap>E @gapinput|GeneratorsOfGroup(G);E
  [ f1, f2 ]
  @gapprompt|gap>E @gapinput|RelatorsOfFpGroup(G);E
  [ f2^-1*f1^-1*f2^-1*f1*f2*f1, f1^-1*f2^-1*f1^-1*f2*f1*f2 ]
  @gapprompt|gap>E @gapinput|hom:=GroupHomomorphismByImages(G,Group([[-1]]),[G.1,G.2],[[[-1]],[[-1]]]);;E
  @gapprompt|gap>E @gapinput|A:=function(x); return Determinant(Image(hom,x)); end;;E
  @gapprompt|gap>E @gapinput|D:=TensorWithTwistedIntegers(C,A); #Here the function A represents E
  @gapprompt|gap>E @gapinput|#the integers with twisted action of G.E
  Chain complex of length 3 in characteristic 0 .
  @gapprompt|gap>E @gapinput|Homology(D,0);E
  [ 2 ]
  @gapprompt|gap>E @gapinput|Homology(D,1);E
  [ 3 ]
  @gapprompt|gap>E @gapinput|Homology(D,2);E
  [ 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Distinguishing between two non\texttt{\symbol{45}}homeomorphic homotopy
equivalent spaces}}\logpage{[ 3, 4, 0 ]}
\hyperdef{L}{X7A4F34B780FA2CD5}{}
{
 

The granny knot is the sum of the trefoil knot and its mirror image. The reef
knot is the sum of two identical copies of the trefoil knot. The following
commands show that the degree $1$ homology homomorphisms 

$H_1(p^{-1}(B),\mathbb Z) \rightarrow H_1(\widetilde X_H,\mathbb Z)$ 

 distinguish between the homeomorphism types of the complements $X\subset \mathbb R^3$ of the granny knot and the reef knot, where $B\subset X$ is the knot boundary, and where $p\colon \widetilde X_H \rightarrow X$ is the covering map corresponding to the finite index subgroup $H < \pi_1X$. More precisely, $p^{-1}(B)$ is in general a union of path components 

$p^{-1}(B) = B_1 \cup B_2 \cup \cdots \cup B_t$ . 

 The function \texttt{FirstHomologyCoveringCokernels(f,c)} inputs an integer $c$ and the inclusion $f\colon B\hookrightarrow X$ of a knot boundary $B$ into the knot complement $X$. The function returns the ordered list of the lists of abelian invariants of
cokernels 

${\rm coker}(\ H_1(p^{-1}(B_i),\mathbb Z) \rightarrow H_1(\widetilde
X_H,\mathbb Z)\ )$ 

arising from subgroups $H < \pi_1X$ of index $c$. To distinguish between the granny and reef knots we use index $c=6$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=PureCubicalKnot(3,1);;|
  !gapprompt@gap>| !gapinput@L:=ReflectedCubicalKnot(K);;|
  !gapprompt@gap>| !gapinput@granny:=KnotSum(K,L);;|
  !gapprompt@gap>| !gapinput@reef:=KnotSum(K,K);;|
  !gapprompt@gap>| !gapinput@fg:=KnotComplementWithBoundary(ArcPresentation(granny));;|
  !gapprompt@gap>| !gapinput@fr:=KnotComplementWithBoundary(ArcPresentation(reef));;|
  !gapprompt@gap>| !gapinput@a:=FirstHomologyCoveringCokernels(fg,6);;|
  !gapprompt@gap>| !gapinput@b:=FirstHomologyCoveringCokernels(fr,6);;|
  !gapprompt@gap>| !gapinput@a=b;|
  false
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{ Second homotopy groups of spaces with finite fundamental group}}\logpage{[ 3, 5, 0 ]}
\hyperdef{L}{X869FD75B84AAC7AD}{}
{
 

If $p:\widetilde Y \rightarrow Y$ is the universal covering map, then the fundamental group of $\widetilde Y$ is trivial and the Hurewicz homomorphism $\pi_2\widetilde Y\rightarrow H_2(\widetilde Y,\mathbb Z)$ from the second homotopy group of $\widetilde Y$ to the second integral homology of $\widetilde Y$ is an isomorphism. Furthermore, the map $p$ induces an isomorphism $\pi_2\widetilde Y \rightarrow \pi_2Y$. Thus $H_2(\widetilde Y,\mathbb Z)$ is isomorphic to the second homotopy group $\pi_2Y$. 

 If the fundamental group of $Y$ happens to be finite, then in principle we can calculate $H_2(\widetilde Y,\mathbb Z) \cong \pi_2Y$. We illustrate this computation for $Y$ equal to the real projective plane. The above computation shows that $Y$ has second homotopy group $\pi_2Y \cong \mathbb Z$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=[ [1,2,3], [1,3,4], [1,2,6], [1,5,6], [1,4,5], A
  @gapprompt|>A @gapinput|        [2,3,5], [2,4,5], [2,4,6], [3,4,6], [3,5,6]];;A
  
  @gapprompt|gap>A @gapinput|K:=MaximalSimplicesToSimplicialComplex(K);A
  Simplicial complex of dimension 2.
  
  @gapprompt|gap>A @gapinput|Y:=RegularCWComplex(K);  A
  Regular CW-complex of dimension 2
  @gapprompt|gap>A @gapinput|# Y is a regular CW-complex corresponding to the projective plane.A
  
  @gapprompt|gap>A @gapinput|U:=UniversalCover(Y);A
  Equivariant CW-complex of dimension 2
  
  @gapprompt|gap>A @gapinput|G:=U!.group;; A
  @gapprompt|gap>A @gapinput|# G is the fundamental group of Y, which by the next command A
  @gapprompt|gap>A @gapinput|# is finite of order 2.A
  @gapprompt|gap>A @gapinput|Order(G);A
  2
  
  @gapprompt|gap>A @gapinput|U:=EquivariantCWComplexToRegularCWComplex(U,Group(One(G))); A
  Regular CW-complex of dimension 2
  @gapprompt|gap>A @gapinput|#U is the universal cover of YA
  
  @gapprompt|gap>A @gapinput|Homology(U,0);A
  [ 0 ]
  @gapprompt|gap>A @gapinput|Homology(U,1);A
  [  ]
  @gapprompt|gap>A @gapinput|Homology(U,2);A
  [ 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Third homotopy groups of simply connected spaces}}\logpage{[ 3, 6, 0 ]}
\hyperdef{L}{X87F8F6C3812A7E73}{}
{
  
\subsection{\textcolor{Chapter }{First example: Whitehead's certain exact sequence}}\logpage{[ 3, 6, 1 ]}
\hyperdef{L}{X7B506CF27DE54DBE}{}
{
 

For any path connected space $Y$ with universal cover $\widetilde Y$ there is an exact sequence 

 $\rightarrow \pi_4\widetilde Y \rightarrow H_4(\widetilde Y,\mathbb Z)
\rightarrow H_4( K(\pi_2\widetilde Y,2), \mathbb Z ) \rightarrow
\pi_3\widetilde Y \rightarrow H_3(\widetilde Y,\mathbb Z) \rightarrow 0 $ 

 due to J.H.C.Whitehead. Here $K(\pi_2(\widetilde Y),2)$ is an Eilenberg\texttt{\symbol{45}}MacLane space with second homotopy group
equal to $\pi_2\widetilde Y$. 

Continuing with the above example where $Y$ is the real projective plane, we see that $H_4(\widetilde Y,\mathbb Z) = H_3(\widetilde Y,\mathbb Z) = 0$ since $\widetilde Y$ is a $2$\texttt{\symbol{45}}dimensional CW\texttt{\symbol{45}}space. The exact
sequence implies $\pi_3\widetilde Y \cong H_4(K(\pi_2\widetilde Y,2), \mathbb Z )$. Furthermore, $\pi_3\widetilde Y = \pi_3 Y$. The following commands establish that $\pi_3Y \cong \mathbb Z\, $. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=AbelianPcpGroup([0]);|
  Pcp-group with orders [ 0 ]
  
  !gapprompt@gap>| !gapinput@K:=EilenbergMacLaneSimplicialGroup(A,2,5);;|
  !gapprompt@gap>| !gapinput@C:=ChainComplexOfSimplicialGroup(K);|
  Chain complex of length 5 in characteristic 0 .
  
  !gapprompt@gap>| !gapinput@Homology(C,4);|
  [ 0 ]
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Second example: the Hopf invariant}}\logpage{[ 3, 6, 2 ]}
\hyperdef{L}{X828F0FAB86AA60E9}{}
{
 

 The following commands construct a $4$\texttt{\symbol{45}}dimensional simplicial complex $Y$ with $9$ vertices and $36$ $4$\texttt{\symbol{45}}dimensional simplices, and establish that 

 $\pi_1Y=0 , \pi_2Y=\mathbb Z , H_3(Y,\mathbb Z)=0, H_4(Y,\mathbb Z)=\mathbb Z $. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@smp:=[ [ 1, 2, 4, 5, 6 ], [ 1, 2, 4, 5, 9 ], [ 1, 2, 5, 6, 8 ], |
  !gapprompt@>| !gapinput@        [ 1, 2, 6, 4, 7 ], [ 2, 3, 4, 5, 8 ], [ 2, 3, 5, 6, 4 ], |
  !gapprompt@>| !gapinput@        [ 2, 3, 5, 6, 7 ], [ 2, 3, 6, 4, 9 ], [ 3, 1, 4, 5, 7 ],|
  !gapprompt@>| !gapinput@        [ 3, 1, 5, 6, 9 ], [ 3, 1, 6, 4, 5 ], [ 3, 1, 6, 4, 8 ], |
  !gapprompt@>| !gapinput@        [ 4, 5, 7, 8, 3 ], [ 4, 5, 7, 8, 9 ], [ 4, 5, 8, 9, 2 ], |
  !gapprompt@>| !gapinput@        [ 4, 5, 9, 7, 1 ], [ 5, 6, 7, 8, 2 ], [ 5, 6, 8, 9, 1 ],|
  !gapprompt@>| !gapinput@        [ 5, 6, 8, 9, 7 ], [ 5, 6, 9, 7, 3 ], [ 6, 4, 7, 8, 1 ], |
  !gapprompt@>| !gapinput@        [ 6, 4, 8, 9, 3 ], [ 6, 4, 9, 7, 2 ], [ 6, 4, 9, 7, 8 ], |
  !gapprompt@>| !gapinput@        [ 7, 8, 1, 2, 3 ], [ 7, 8, 1, 2, 6 ], [ 7, 8, 2, 3, 5 ],|
  !gapprompt@>| !gapinput@        [ 7, 8, 3, 1, 4 ], [ 8, 9, 1, 2, 5 ], [ 8, 9, 2, 3, 1 ], |
  !gapprompt@>| !gapinput@        [ 8, 9, 2, 3, 4 ], [ 8, 9, 3, 1, 6 ], [ 9, 7, 1, 2, 4 ], |
  !gapprompt@>| !gapinput@        [ 9, 7, 2, 3, 6 ], [ 9, 7, 3, 1, 2 ], [ 9, 7, 3, 1, 5 ] ];;|
  
  !gapprompt@gap>| !gapinput@K:=MaximalSimplicesToSimplicialComplex(smp);|
  Simplicial complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@Y:=RegularCWComplex(Y);|
  Regular CW-complex of dimension 4
  
  !gapprompt@gap>| !gapinput@Order(FundamentalGroup(Y));|
  1
  !gapprompt@gap>| !gapinput@Homology(Y,2);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(Y,3);|
  [  ]
  !gapprompt@gap>| !gapinput@Homology(Y,4);|
  [ 0 ]
  
\end{Verbatim}
 

 Previous commands have established $ H_4(K(\mathbb Z,2), \mathbb Z)=\mathbb Z$. So Whitehead's sequence reduces to an exact sequence 

$\mathbb Z \rightarrow \mathbb Z \rightarrow \pi_3Y \rightarrow 0$ 

in which the first map is $ H_4(Y,\mathbb Z)=\mathbb Z \rightarrow H_4(K(\pi_2Y,2), \mathbb Z )=\mathbb Z $. Hence $\pi_3Y$ is cyclic. 

 HAP is currently unable to compute the order of $\pi_3Y$ directly from Whitehead's sequence. Instead, we can use the \emph{Hopf invariant}. For any map $\phi\colon S^3 \rightarrow S^2$ we consider the space $C(\phi) = S^2 \cup_\phi e^4$ obtained by attaching a $4$\texttt{\symbol{45}}cell $e^4$ to $S^2$ via the attaching map $\phi$. The cohomology groups $H^2(C(\phi),\mathbb Z)=\mathbb Z$, $H^4(C(\phi),\mathbb Z)=\mathbb Z$ are generated by elements $\alpha, \beta$ say, and the cup product has the form 

$- \cup -\colon H^2(C(\phi),\mathbb Z)\times H^2(C(\phi),\mathbb Z) \rightarrow
H^4(C(\phi),\mathbb Z), (\alpha,\alpha) \mapsto h_\phi \beta$ 

for some integer $h_\phi$. The integer $h_\phi$ is the \textsc{Hopf invariant}. The function $h\colon \pi_3(S^3)\rightarrow \mathbb Z$ is a homomorphism and there is an isomorphism 

$\pi_3(S^2\cup e^4) \cong \mathbb Z/\langle h_\phi\rangle$. 

The following commands begin by simplifying the cell structure on the above
CW\texttt{\symbol{45}}complex $Y\cong K$ to obtain a homeomorphic CW\texttt{\symbol{45}}complex $W$ with fewer cells. They then create a space $S$ by removing one $4$\texttt{\symbol{45}}cell from $W$. The space $S$ is seen to be homotopy equivalent to a CW\texttt{\symbol{45}}complex $e^2\cup e^0$ with a single $0$\texttt{\symbol{45}}cell and single $2$\texttt{\symbol{45}}cell. Hence $S\simeq S^2$ is homotopy equivalent to the $2$\texttt{\symbol{45}}sphere. Consequently $Y \simeq C(\phi ) = S^2\cup_\phi e^4 $ for some map $\phi\colon S^3 \rightarrow S^2$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@W:=SimplifiedComplex(Y);|
  Regular CW-complex of dimension 4
  
  !gapprompt@gap>| !gapinput@S:=RegularCWComplexWithRemovedCell(W,4,6);|
  Regular CW-complex of dimension 4
  
  !gapprompt@gap>| !gapinput@CriticalCells(S);|
  [ [ 2, 6 ], [ 0, 5 ] ]
  
\end{Verbatim}
 

 The next commands show that the map $\phi$ in the construction $Y \simeq C(\phi) $ has Hopf invariant \texttt{\symbol{45}}1. Hence $h\colon \pi_3(S^3)\rightarrow \mathbb Z$ is an isomorphism. Therefore $\pi_3Y=0$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@IntersectionForm(K);|
  [ [ -1 ] ]
  
\end{Verbatim}
 

 [The simplicial complex $K$ in this second example is due to W. Kuehnel and T. F. Banchoff and is
homeomorphic to the complex projective plane. ] }

 }

 
\section{\textcolor{Chapter }{Computing the second homotopy group of a space with infinite fundamental group}}\logpage{[ 3, 7, 0 ]}
\hyperdef{L}{X7EAF7E677FB9D53F}{}
{
  The following commands compute the second integral homology 

 $H_2(\pi_1W,\mathbb Z) = \mathbb Z$ 

of the fundamental group $\pi_1W$ of the complement $W$ of the Hopf\texttt{\symbol{45}}Satoh surface. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=HopfSatohSurface();|
  Pure cubical complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@W:=ContractedComplex(RegularCWComplex(PureComplexComplement(L)));|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@GW:=FundamentalGroup(W);;|
  !gapprompt@gap>| !gapinput@IsAspherical(GW);|
  Presentation is aspherical.
  true
  !gapprompt@gap>| !gapinput@R:=ResolutionAsphericalPresentation(GW);;|
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R),2);|
  [ 0 ]
  
\end{Verbatim}
 

From Hopf's exact sequence 

 $ \pi_2W \stackrel{h}{\longrightarrow} H_2(W,\mathbb Z) \twoheadrightarrow
H_2(\pi_1W,\mathbb Z) \rightarrow 0$ 

 and the computation $H_2(W,\mathbb Z)=\mathbb Z^4$ we see that the image of the Hurewicz homomorphism is ${\sf im}(h)= \mathbb Z^3$ . The image of $h$ is referred to as the subgroup of \emph{spherical homology classes} and often denoted by $\Sigma^2W$. 

The following command computes the presentation of $\pi_1W$ corresponding to the $2$\texttt{\symbol{45}}skeleton $W^2$ and establishes that $W^2 = S^2\vee S^2 \vee S^2 \vee (S^1\times S^1)$ is a wedge of three spheres and a torus. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FundamentalGroupOfRegularCWComplex(W,"no simplification");|
  < fp group on the generators [ f1, f2 ]>
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(F);|
  [ < identity ...>, f1^-1*f2^-1*f1*f2, < identity ...>, <identity ...> ]
  
\end{Verbatim}
 

The next command shows that the $3$\texttt{\symbol{45}}dimensional space $W$ has two $3$\texttt{\symbol{45}}cells each of which is attached to the
base\texttt{\symbol{45}}point of $W$ with trivial boundary (up to homotopy in $W^2$). Hence $W = S^3\vee S^3\vee S^2 \vee S^2 \vee S^2 \vee (S^1\times S^1)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@CriticalCells(W);|
  [ [ 3, 1 ], [ 3, 3148 ], [ 2, 6746 ], [ 2, 20510 ], [ 2, 33060 ], 
    [ 2, 50919 ], [ 1, 29368 ], [ 1, 50822 ], [ 0, 21131 ] ]
  !gapprompt@gap>| !gapinput@CriticalBoundaryCells(W,3,1);|
  [  ]
  !gapprompt@gap>| !gapinput@CriticalBoundaryCells(W,3,3148);|
  [ -50919, 50919 ]
  
\end{Verbatim}
 

 Therefore $\pi_1W$ is the free abelian group on two generators, and $\pi_2W$ is the free $\mathbb Z\pi_1W$\texttt{\symbol{45}}module on three free generators. }

 }

 
\chapter{\textcolor{Chapter }{Three Manifolds}}\logpage{[ 4, 0, 0 ]}
\hyperdef{L}{X7BFA4D1587D8DF49}{}
{
 
\section{\textcolor{Chapter }{Dehn Surgery}}\logpage{[ 4, 1, 0 ]}
\hyperdef{L}{X82D1348C79238C2D}{}
{
 The following example constructs, as a regular CW\texttt{\symbol{45}}complex,
a closed orientable 3\texttt{\symbol{45}}manifold $W$ obtained from the 3\texttt{\symbol{45}}sphere by drilling out a tubular
neighbourhood of a trefoil knot and then gluing a solid torus to the boundary
of the cavity via a homeomorphism corresponding to a Dehn surgery coefficient $p/q=17/16$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ap:=ArcPresentation(PureCubicalKnot(3,1));;|
  !gapprompt@gap>| !gapinput@p:=17;;q:=16;;|
  !gapprompt@gap>| !gapinput@W:=ThreeManifoldViaDehnSurgery(ap,p,q);|
  Regular CW-complex of dimension 3
  
\end{Verbatim}
 The next commands show that this $3$\texttt{\symbol{45}}manifold $W$ has integral homology 

 $ H_0(W,\mathbb Z)=\mathbb Z$, $ H_1(W,\mathbb Z)=\mathbb Z_{16}$, $ H_2(W,\mathbb Z)=0$, $ H_3(W,\mathbb Z)=\mathbb Z$ 

 and that the fundamental group $\pi_1(W)$ is non\texttt{\symbol{45}}abelian. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Homology(W,0);Homology(W,1);Homology(W,2);Homology(W,3);|
  [ 0 ]
  [ 16 ]
  [  ]
  [ 0 ]
  
  !gapprompt@gap>| !gapinput@F:=FundamentalGroup(W);;|
  !gapprompt@gap>| !gapinput@L:=LowIndexSubgroupsFpGroup(F,10);;|
  !gapprompt@gap>| !gapinput@List(L,AbelianInvariants);|
  [ [ 16 ], [ 3, 8 ], [ 3, 4 ], [ 2, 3 ], [ 16, 43 ], [ 8, 43, 43 ] ]
  
\end{Verbatim}
 

 The following famous result of Lickorish and (independently) Wallace shows
that Dehn surgery on knots leads to an interesting range of spaces. 

\textsc{Theorem:} \emph{ Every closed, orientable, connected $3$\texttt{\symbol{45}}manifold can be obtained by surgery on a link in $S^3$. (Moreover, one can always perform the surgery with surgery coefficients $\pm 1$ and with each individual component of the link unknotted.) } }

 
\section{\textcolor{Chapter }{Connected Sums}}\logpage{[ 4, 2, 0 ]}
\hyperdef{L}{X848EDEE882B36F6C}{}
{
 The following example constructs the connected sum $W=A\#B$ of two $3$\texttt{\symbol{45}}manifolds, where $A$ is obtained from a $5/1$ Dehn surgery on the complement of the first prime knot on 11 crossings and $B$ is obtained by a $5/1$ Dehn surgery on the complement of the second prime knot on 11 crossings. The
homology groups 

$H_1(W,\mathbb Z) = \mathbb Z_2\oplus \mathbb Z_{594}$, $H_2(W,\mathbb Z) = 0$, $H_3(W,\mathbb Z) = \mathbb Z$ 

 are computed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ap1:=ArcPresentation(PureCubicalKnot(11,1));;|
  !gapprompt@gap>| !gapinput@A:=ThreeManifoldViaDehnSurgery(ap1,5,1);;|
  !gapprompt@gap>| !gapinput@ap2:=ArcPresentation(PureCubicalKnot(11,2));;|
  !gapprompt@gap>| !gapinput@B:=ThreeManifoldViaDehnSurgery(ap2,5,1);;|
  !gapprompt@gap>| !gapinput@W:=ConnectedSum(A,B); #W:=ConnectedSum(A,B,-1) would yield A#-B where -B has the opposite orientation|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@Homology(W,1);|
  [ 2, 594 ]
  !gapprompt@gap>| !gapinput@Homology(W,2);|
  [  ]
  !gapprompt@gap>| !gapinput@Homology(W,3);|
  [ 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Dijkgraaf\texttt{\symbol{45}}Witten Invariant}}\logpage{[ 4, 3, 0 ]}
\hyperdef{L}{X78AE684C7DBD7C70}{}
{
 Given a closed connected orientable $3$\texttt{\symbol{45}}manifold $W$, a finite group $G$ and a 3\texttt{\symbol{45}}cocycle $\alpha\in H^3(BG,U(1))$ Dijkgraaf and Witten define the complex number 

\$\$
Z\texttt{\symbol{94}}\texttt{\symbol{123}}G,\texttt{\symbol{92}}alpha\texttt{\symbol{125}}(W)
=
\texttt{\symbol{92}}frac\texttt{\symbol{123}}1\texttt{\symbol{125}}\texttt{\symbol{123}}|G|\texttt{\symbol{125}}\texttt{\symbol{92}}sum{\textunderscore}\texttt{\symbol{123}}\texttt{\symbol{92}}gamma\texttt{\symbol{92}}in
\texttt{\symbol{123}}\texttt{\symbol{92}}rm
Hom\texttt{\symbol{125}}(\texttt{\symbol{92}}pi{\textunderscore}1W,
G)\texttt{\symbol{125}} \texttt{\symbol{92}}langle
\texttt{\symbol{92}}gamma\texttt{\symbol{94}}\texttt{\symbol{92}}ast[\texttt{\symbol{92}}alpha],
[M]\texttt{\symbol{92}}rangle \texttt{\symbol{92}}
\texttt{\symbol{92}}in\texttt{\symbol{92}} \texttt{\symbol{92}}mathbb
C\texttt{\symbol{92}} \$\$ where $\gamma$ ranges over all group homomorphisms $\gamma\colon \pi_1W \rightarrow G$. This complex number is an invariant of the homotopy type of $W$ and is useful for distinguishing between certain homotopically distinct $3$\texttt{\symbol{45}}manifolds. 

A homology version of the Dijkgraaf\texttt{\symbol{45}}Witten invariant can be
defined as the set of homology homomorphisms \$\$D{\textunderscore}G(W)
=\texttt{\symbol{92}}\texttt{\symbol{123}}
\texttt{\symbol{92}}gamma{\textunderscore}\texttt{\symbol{92}}ast\texttt{\symbol{92}}colon
H{\textunderscore}3(W,\texttt{\symbol{92}}mathbb Z)
\texttt{\symbol{92}}longrightarrow
H{\textunderscore}3(BG,\texttt{\symbol{92}}mathbb Z)
\texttt{\symbol{92}}\texttt{\symbol{125}}{\textunderscore}\texttt{\symbol{123}}\texttt{\symbol{92}}gamma\texttt{\symbol{92}}in
\texttt{\symbol{123}}\texttt{\symbol{92}}rm
Hom\texttt{\symbol{125}}(\texttt{\symbol{92}}pi{\textunderscore}1W,
G)\texttt{\symbol{125}}.\$\$ Since $H_3(W,\mathbb Z)\cong \mathbb Z$ we represent $D_G(W)$ by the set $D_G(W)=\{ \gamma_\ast(1) \}_{\gamma\in {\rm Hom}(\pi_1W, G)}$ where $1$ denotes one of the two possible generators of $H_3(W,\mathbb Z)$. 

 For any coprime integers $p,q\ge 1$ the \emph{lens space} $L(p,q)$ is obtained from the 3\texttt{\symbol{45}}sphere by drilling out a tubular
neighbourhood of the trivial knot and then gluing a solid torus to the
boundary of the cavity via a homeomorphism corresponding to a Dehn surgery
coefficient $p/q$. Lens spaces have cyclic fundamental group $\pi_1(L(p,q))=C_p$ and homology $H_1(L(p,q),\mathbb Z)\cong \mathbb Z_p$, $H_2(L(p,q),\mathbb Z)\cong 0$, $H_3(L(p,q),\mathbb Z)\cong \mathbb Z$. It was proved by J.H.C. Whitehead that two lens spaces $L(p,q)$ and $L(p',q')$ are homotopy equivalent if and only if $p=p'$ and $qq'\equiv \pm n^2 \bmod p$ for some integer $n$. 

 The following session constructs the two lens spaces $L(5,1)$ and $L(5,2)$. The homology version of the Dijkgraaf\texttt{\symbol{45}}Witten invariant is
used with $G=C_5$ to demonstrate that the two lens spaces are not homotopy equivalent. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ap:=[[2,1],[2,1]];; #Arc presentation for the trivial knot|
  
  !gapprompt@gap>| !gapinput@L51:=ThreeManifoldViaDehnSurgery(ap,5,1);;|
  !gapprompt@gap>| !gapinput@D:=DijkgraafWittenInvariant(L51,CyclicGroup(5));|
  [ g1^4, g1^4, g1, g1, id ]
  
  !gapprompt@gap>| !gapinput@L52:=ThreeManifoldViaDehnSurgery(ap,5,2);;|
  !gapprompt@gap>| !gapinput@D:=DijkgraafWittenInvariant(L52,CyclicGroup(5));|
  [ g1^3, g1^3, g1^2, g1^2, id ]
  
\end{Verbatim}
 A theorem of Fermat and Euler states that if a prime $p$ is congruent to 3 modulo 4, then for any $q$ exactly one of $\pm q$ is a quadratic residue mod p. For all other primes $p$ either both or neither of $\pm q$ is a quadratic residue mod $p$. Thus for fixed $p \equiv 3 \bmod 4$ the lens spaces $L(p,q)$ form a single homotopy class. There are precisely two homotopy classes of lens
spaces for other $p$. 

 The following commands confirm that $L(13,1) \not\simeq L(13,2)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L13_1:=ThreeManifoldViaDehnSurgery([[1,2],[1,2]],13,1);;|
  !gapprompt@gap>| !gapinput@DijkgraafWittenInvariant(L13_1,CyclicGroup(13));|
  [ g1^12, g1^12, g1^10, g1^10, g1^9, g1^9, g1^4, g1^4, g1^3, g1^3, g1, g1, id ]
  !gapprompt@gap>| !gapinput@L13_2:=ThreeManifoldViaDehnSurgery([[1,2],[1,2]],13,2);;|
  !gapprompt@gap>| !gapinput@DijkgraafWittenInvariant(L13_2,CyclicGroup(13));|
  [ g1^11, g1^11, g1^8, g1^8, g1^7, g1^7, g1^6, g1^6, g1^5, g1^5, g1^2, g1^2, 
    id ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cohomology rings}}\logpage{[ 4, 4, 0 ]}
\hyperdef{L}{X80B6849C835B7F19}{}
{
 The following commands construct the multiplication table (with respect to
some basis) for the cohomology rings $H^\ast(L(13,1),\mathbb Z_{13})$ and $H^\ast(L(13,2),\mathbb Z_{13})$. These rings are isomorphic and so fail to distinguish between the homotopy
types of the lens spaces $L(13,1)$ and $L(13,2)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L13_1:=ThreeManifoldViaDehnSurgery([[1,2],[1,2]],13,1);;|
  !gapprompt@gap>| !gapinput@L13_2:=ThreeManifoldViaDehnSurgery([[1,2],[1,2]],13,2);;|
  !gapprompt@gap>| !gapinput@L13_1:=BarycentricSubdivision(L13_1);;|
  !gapprompt@gap>| !gapinput@L13_2:=BarycentricSubdivision(L13_2);;|
  !gapprompt@gap>| !gapinput@A13_1:=CohomologyRing(L13_1,13);;|
  !gapprompt@gap>| !gapinput@A13_2:=CohomologyRing(L13_2,13);;|
  !gapprompt@gap>| !gapinput@M13_1:=List([1..4],i->[]);;|
  !gapprompt@gap>| !gapinput@B13_1:=CanonicalBasis(A13_1);;|
  !gapprompt@gap>| !gapinput@M13_2:=List([1..4],i->[]);;|
  !gapprompt@gap>| !gapinput@B13_2:=CanonicalBasis(A13_2);;|
  !gapprompt@gap>| !gapinput@for i in [1..4] do|
  !gapprompt@>| !gapinput@for j in [1..4] do|
  !gapprompt@>| !gapinput@M13_1[i][j]:=B13_1[i]*B13_1[j];|
  !gapprompt@>| !gapinput@od;od;|
  !gapprompt@gap>| !gapinput@for i in [1..4] do|
  !gapprompt@>| !gapinput@for j in [1..4] do|
  !gapprompt@>| !gapinput@M13_2[i][j]:=B13_2[i]*B13_2[j];|
  !gapprompt@>| !gapinput@od;od;|
  !gapprompt@gap>| !gapinput@Display(M13_1);|
  [ [            v.1,            v.2,            v.3,            v.4 ],
    [            v.2,          0*v.1,  (Z(13)^6)*v.4,          0*v.1 ],
    [            v.3,  (Z(13)^6)*v.4,          0*v.1,          0*v.1 ],
    [            v.4,          0*v.1,          0*v.1,          0*v.1 ] ]
  !gapprompt@gap>| !gapinput@Display(M13_2);|
  [ [          v.1,          v.2,          v.3,          v.4 ],
    [          v.2,        0*v.1,  (Z(13))*v.4,        0*v.1 ],
    [          v.3,  (Z(13))*v.4,        0*v.1,        0*v.1 ],
    [          v.4,        0*v.1,        0*v.1,        0*v.1 ] ]
  
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Linking Form}}\logpage{[ 4, 5, 0 ]}
\hyperdef{L}{X7F56BB4C801AB894}{}
{
 Given a closed connected \textsc{oriented} $3$\texttt{\symbol{45}}manifold $W$ let $\tau H_1(W,\mathbb Z)$ denote the torsion subgroup of the first integral homology. The \emph{linking form} is a bilinear mapping 

$Lk_W\colon \tau H_1(W,\mathbb Z) \times \tau H_1(W,\mathbb Z) \longrightarrow
\mathbb Q/\mathbb Z$. 

To construct this form note that we have a Poincare duality isomorphism 

$\rho\colon H^2(W,\mathbb Z) \stackrel{\cong}{\longrightarrow} H_1(W,\mathbb
Z), z \mapsto z\cap [W]$ 

involving the cap product with the fundamental class $[W]\in H^3(W,\mathbb Z)$. That is, $[M]$ is the generator of $H^3(W,\mathbb Z)\cong \mathbb Z$ determining the orientation. The short exact sequence $\mathbb Z \rightarrowtail \mathbb Q \twoheadrightarrow \mathbb Q/\mathbb Z$ gives rise to a cohomology exact sequence 

$ \rightarrow H^1(W,\mathbb Q) \rightarrow H^1(W,\mathbb Q/\mathbb Z)
\stackrel{\beta}{\longrightarrow} H^2(W,\mathbb Z) \rightarrow H^2(W,\mathbb
Q) \rightarrow $ 

 from which we obtain the isomorphism $\beta \colon \tau H^1(W,\mathbb Q/\mathbb Z) \stackrel{\cong}{\longrightarrow}
\tau H^2(W,\mathbb Z)$. The linking form $Lk_W$ can be defined as the composite 

 $Lk_W\colon \tau H_1(W,\mathbb Z) \times \tau H_1(W,\mathbb Z)
\stackrel{1\times \rho^{-1}}{\longrightarrow} \tau H_1(W,\mathbb Z) \times
\tau H^2(W,\mathbb Z) \stackrel{1\times \beta^{-1}}{\longrightarrow} \tau
H_1(W,\mathbb Z) \times \tau H^1(W,\mathbb Q/\mathbb Z)
\stackrel{ev}{\longrightarrow } \mathbb Q/\mathbb Z $ 

where $ev(x,\alpha)$ evaluates a $1$\texttt{\symbol{45}}cocycle $\alpha$ on a $1$\texttt{\symbol{45}}cycle $x$. 

 The linking form can be used to define the set 

 $I^O(W) = \{Lk_W(g,g) \ \colon \ g\in \tau H_1(W,\mathbb Z)\}$ 

which is an oriented\texttt{\symbol{45}}homotopy invariant of $W$. Letting $W^+$ and $W^-$ denote the two possible orientations on the manifold, the set 

 $I(W) =\{I^O(W^+), I^O(W^-)\}$ 

is a homotopy invariant of $W$ which in this manual we refer to as the \emph{linking form homotopy invariant}. 

 The following commands compute the linking form homotopy invariant for the
lens spaces $L(13,q)$ with $1\le q\le 12$. This invariant distinguishes between the two homotopy types that arise. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@LensSpaces:=[];;|
  !gapprompt@gap>| !gapinput@for q in [1..12] do|
  !gapprompt@>| !gapinput@Add(LensSpaces,ThreeManifoldViaDehnSurgery([[1,2],[1,2]],13,q));|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@Display(List(LensSpaces,LinkingFormHomotopyInvariant));;|
  [ [ [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ], 
        [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ] ], 
  
    [ [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ], [ 0, 2/13, 
            2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ] ], 
  
    [ [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ], 
        [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ] ], 
  
    [ [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ], 
        [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ] ], 
  
    [ [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ], 
        [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ] ], 
  
    [ [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ], 
        [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ] ], 
  
    [ [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ], 
        [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ] ], 
  
    [ [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ], 
        [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ] ], 
  
    [ [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ], 
        [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ] ], 
  
    [ [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ], 
        [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ] ], 
  
    [ [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ], 
        [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ] ], 
  
    [ [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ], 
        [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ] ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Determining the homeomorphism type of a lens space}}\logpage{[ 4, 6, 0 ]}
\hyperdef{L}{X850C76697A6A1654}{}
{
 In 1935 K. Reidemeister \cite{reidemeister} classified lens spaces up to orientation preserving
PL\texttt{\symbol{45}}homeomorphism. This was generalized by E. Moise \cite{moise} in 1952 to a classification up to homeomorphism
\texttt{\symbol{45}}\texttt{\symbol{45}} his method requred the proof of the
Hauptvermutung for $3$\texttt{\symbol{45}}dimensional manifolds. In 1960, following a suggestion of
R. Fox, a proof was given by E.J. Brody \cite{brody} that avoided the need for the Hauptvermutung. Reidemeister's method, using
what is know termed \emph{Reidermeister torsion}, and Brody's method, using tubular neighbourhoods of $1$\texttt{\symbol{45}}cycles, both require identifying a suitable "preferred"
generator of $H_1(L(p,q),\mathbb Z)$. In 2003 J. Przytycki and A. Yasukhara \cite{przytycki} provided an alternative method for classifying lens spaces, which uses the
linking form and again requires the identification of a "preferred" generator
of $H_1(L(p,q),\mathbb Z)$. 

 Przytycki and Yasukhara proved the following. 

 \textsc{Theorem.} \emph{Let $\rho\colon S^ 3 \rightarrow L(p, q)$ be the $p$\texttt{\symbol{45}}fold cyclic cover and $K$ a knot in $L(p, q)$ that represents a generator of $H_1 (L(p, q), \mathbb Z)$. If $\rho ^{-1} (K)$ is the trivial knot, then $Lk_{ L(p,q)} ([K], [K]) = q/p$ or $= \overline q/p \in \mathbb Q/\mathbb Z$ where $q\overline q \equiv 1 \bmod p$. } 

The ingredients of this theorem can be applied in HAP, but at present only to
small examples of lens spaces. The obstruction to handling large examples is
that the current default method for computing the linking form involves
barycentric subdivision to produce a simplicial complex from a regular
CW\texttt{\symbol{45}}complex, and then a homotopy equivalence from this
typically large simplicial complex to a smaller non\texttt{\symbol{45}}regular
CW\texttt{\symbol{45}}complex. However, for homeomorphism invariants that are
not homotopy invariants there is a need to avoid homotopy equivalences. In the
current version of HAP this means that in order to obtain delicate
homeomorphism invariants we have to perform homology computations on typically
large simplicial complexes. In a future version of HAP we hope to avoid the
obstruction by implementing cup products, cap products and linking forms
entirely within the category of regular CW\texttt{\symbol{45}}complexes. 

The following commands construct a small lens space $L=L(p,q)$ with unknown values of $p,q$. Subsequent commands will determine the homeomorphism type of $L$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@p:=Random([2,3,5,7,11,13,17]);;|
  !gapprompt@gap>| !gapinput@q:=Random([1..p-1]);;|
  !gapprompt@gap>| !gapinput@L:=ThreeManifoldViaDehnSurgery([[1,2],[1,2]],p,q);|
  Regular CW-complex of dimension 3
  
\end{Verbatim}
 We can readily determine the value of $p=11$ by calculating the order of $\pi_1(L)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FundamentalGroupWithPathReps(L);;|
  !gapprompt@gap>| !gapinput@StructureDescription(F);|
  "C11"
  
\end{Verbatim}
 

 The next commands take the default edge path $\gamma\colon S^1\rightarrow L$ representing a generator of the cyclic group $\pi_1(L)$ and lift it to an edge path $\tilde\gamma\colon S^1\rightarrow \tilde L$. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|U:=UniversalCover(L);;B
  @gapprompt|gap>B @gapinput|G:=U!.group;;B
  @gapprompt|gap>B @gapinput|p:=EquivariantCWComplexToRegularCWMap(U,Group(One(G)));;B
  @gapprompt|gap>B @gapinput|U:=Source(p);;B
  @gapprompt|gap>B @gapinput|gamma:=[];;B
  @gapprompt|gap>B @gapinput|gamma[2]:=F!.loops[1];;B
  @gapprompt|gap>B @gapinput|gamma[2]:=List(gamma[2],AbsInt);;B
  @gapprompt|gap>B @gapinput|gamma[1]:=List(gamma[2],k->L!.boundaries[2][k]);;B
  @gapprompt|gap>B @gapinput|gamma[1]:=SSortedList(Flat(gamma[1]));;B
  @gapprompt|gap>B @gapinput|B
  @gapprompt|gap>B @gapinput|gammatilde:=[[],[],[],[]];;B
  @gapprompt|gap>B @gapinput|for k in [1..U!.nrCells(0)] doB
  @gapprompt|>B @gapinput|if p!.mapping(0,k) in gamma[1] then Add(gammatilde[1],k); fi;B
  @gapprompt|>B @gapinput|od;B
  @gapprompt|gap>B @gapinput|for k in [1..U!.nrCells(1)] doB
  @gapprompt|>B @gapinput|if p!.mapping(1,k) in gamma[2] then Add(gammatilde[2],k); fi;B
  @gapprompt|>B @gapinput|od;B
  @gapprompt|gap>B @gapinput|gammatilde:=CWSubcomplexToRegularCWMap([U,gammatilde]);B
  Map of regular CW-complexes
  
\end{Verbatim}
 

The next commands check that the path $\tilde\gamma$ is unknotted in $\tilde L\cong S^3$ by checking that $\pi_1(\tilde L\setminus {\rm image}(\tilde\gamma))$ is infinite cyclic. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@C:=RegularCWComplexComplement(gammatilde);|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@G:=FundamentalGroup(C);|
  <fp group of size infinity on the generators [ f2 ]>
  
\end{Verbatim}
 

Since $\tilde\gamma$ is unkotted the cycle $\gamma$ represents the preferred generator $[\gamma]\in H_1(L,\mathbb Z)$. The next commands compute $Lk_L([\gamma],[\gamma])= 7/11 $. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@LinkingFormHomeomorphismInvariant(L);|
  [ 7/11 ]
  
\end{Verbatim}
 

 The classification of Moise/Brody states that $L(p,q)\cong L(p,q')$ if and only if $qq'\equiv \pm 1 \bmod p$. Hence the lens space $L$ has the homeomorphism type 

 $L\cong L(11,7) \cong L(11,8) \cong L(11,4) \cong L(11,3)$. }

 
\section{\textcolor{Chapter }{Surgeries on distinct knots can yield homeomorphic manifolds}}\logpage{[ 4, 7, 0 ]}
\hyperdef{L}{X7EC6B008878CC77E}{}
{
 The lens space $L(5,1)$ is a quotient of the $3$\texttt{\symbol{45}}sphere $S^3$ by a certain action of the cyclic group $C_5$. It can be realized by a $p/q=5/1$ Dehn filling of the complement of the trivial knot. It can also be realized by
Dehn fillings of other knots. To see this, the following commands compute the
manifold $W$ obtained from a $p/q=1/5$ Dehn filling of the complement of the trefoil and show that $W$ at least has the same integral homology and same fundamental group as $L(5,1)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ap:=ArcPresentation(PureCubicalKnot(3,1));;|
  !gapprompt@gap>| !gapinput@W:=ThreeManifoldViaDehnSurgery(ap,1,5);;|
  !gapprompt@gap>| !gapinput@Homology(W,1);|
  [ 5 ]
  !gapprompt@gap>| !gapinput@Homology(W,2);|
  [  ]
  !gapprompt@gap>| !gapinput@Homology(W,3);|
  [ 0 ]
  
  !gapprompt@gap>| !gapinput@F:=FundamentalGroup(W);;|
  !gapprompt@gap>| !gapinput@StructureDescription(F);|
  "C5"
  
  
\end{Verbatim}
 

The next commands construct the universal cover $\widetilde W$ and show that it has the same homology as $S^3$ and trivivial fundamental group $\pi_1(\widetilde W)=0$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|U:=UniversalCover(W);;A
  @gapprompt|gap>A @gapinput|G:=U!.group;;A
  @gapprompt|gap>A @gapinput|Wtilde:=EquivariantCWComplexToRegularCWComplex(U,Group(One(G)));A
  Regular CW-complex of dimension 3
  
  @gapprompt|gap>A @gapinput|Homology(Wtilde,1);A
  [  ]
  @gapprompt|gap>A @gapinput|Homology(Wtilde,2);A
  [  ]
  @gapprompt|gap>A @gapinput|Homology(Wtilde,3);A
  [ 0 ]
  
  @gapprompt|gap>A @gapinput|F:=FundamentalGroup(Wtilde);A
  <fp group on the generators [  ]>
  
\end{Verbatim}
 By construction the space $\widetilde W$ is a manifold. Had we not known how the regular CW\texttt{\symbol{45}}complex $\widetilde W$ had been constructed then we could prove that it is a closed $3$\texttt{\symbol{45}}manifold by creating its barycentric subdivision $K=sd\widetilde W$, which is homeomorphic to $\widetilde W$, and verifying that the link of each vertex in the simplicial complex $sd\widetilde W$ is a $2$\texttt{\symbol{45}}sphere. The following command carries out this proof. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@IsClosedManifold(Wtilde);|
  
  true
  
\end{Verbatim}
 The Poincare conjecture (now proven) implies that $\widetilde W$ is homeomorphic to $S^3$. Hence $W=S^3/C_5$ is a quotient of the $3$\texttt{\symbol{45}}sphere by an action of $C_5$ and is hence a lens space $L(5,q)$ for some $q$. 

 The next commands determine that $W$ is homeomorphic to $L(5,4)\cong L(5,1)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Lk:=LinkingFormHomeomorphismInvariant(W);|
  [ 0, 4/5 ]
  
\end{Verbatim}
 

 Moser \cite{lmoser} gives a precise decription of the lens spaces arising from surgery on the
trefoil knot and more generally from surgery on torus knots. Greene \cite{greene} determines the lens spaces that arise by integer Dehn surgery along a knot in
the three\texttt{\symbol{45}}sphere }

 
\section{\textcolor{Chapter }{Finite fundamental groups of $3$\texttt{\symbol{45}}manifolds}}\logpage{[ 4, 8, 0 ]}
\hyperdef{L}{X7B425A3280A2AF07}{}
{
 Lens spaces are examples of $3$\texttt{\symbol{45}}manifolds with finite fundamental groups. The complete
list of finite groups $G$ arising as fundamental groups of closed connected $3$\texttt{\symbol{45}}manifolds is recalled in \ref{Secfinitefundman} where one method for computing their cohomology rings is presented. Their
cohomology could also be computed from explicit $3$\texttt{\symbol{45}}manifolds $W$ with $\pi_1W=G$. For instance, the following commands realize a closed connected $3$\texttt{\symbol{45}}manifold $W$ with $\pi_1W = C_{11}\times SL_2(\mathbb Z_5)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ap:=ArcPresentation(PureCubicalKnot(3,1));;|
  !gapprompt@gap>| !gapinput@W:=ThreeManifoldViaDehnSurgery(ap,1,11);;|
  !gapprompt@gap>| !gapinput@F:=FundamentalGroup(W);;|
  !gapprompt@gap>| !gapinput@Order(F);|
  1320
  !gapprompt@gap>| !gapinput@AbelianInvariants(F);|
  [ 11 ]
  !gapprompt@gap>| !gapinput@StructureDescription(F);|
  "C11 x SL(2,5)"
  
\end{Verbatim}
 Hence the group $G=C_{11}\times SL_2(\mathbb Z_5)$ of order $1320$ acts freely on the $3$\texttt{\symbol{45}}sphere $\widetilde W$. It thus has periodic cohomology with 
\[ H_n(G,\mathbb Z) = \left\{ \begin{array}{ll} \mathbb Z_{11} & n\equiv 1 \bmod
4 \\ 0 & n\equiv 2 \bmod 4 \\ \mathbb Z_{1320} & n \equiv 3\bmod 4\\ \mathbb 0
& n\equiv 0 \bmod 4 \\ \end{array}\right. \]
 for $n > 0$. }

 
\section{\textcolor{Chapter }{Poincare's cube manifolds}}\logpage{[ 4, 9, 0 ]}
\hyperdef{L}{X78912D227D753167}{}
{
 In his seminal paper on "Analysis situs", published in 1895, Poincare
constructed a series of closed 3\texttt{\symbol{45}}manifolds which played an
important role in the development of his theory. A good account of these
manifolds is given in the online \href{http://www.map.mpim-bonn.mpg.de/Poincar%C3%A9%27s_cube_manifolds} {Manifold Atlas Project (MAP)}. Most of his examples are constructed by identifications on the faces of a
(solid) cube. The function \texttt{PoincareCubeCWComplex()} can be used to construct any 3\texttt{\symbol{45}}dimensional
CW\texttt{\symbol{45}}complex arising from a cube by identifying the six faces
pairwise; the vertices and faces of the cube are numbered as follows 

  

 and barycentric subdivision is used to ensure that the quotient is represented
as a regular CW\texttt{\symbol{45}}complex. 

Examples 3 and 4 from Poincare's paper, described in the following figures
taken from \href{http://www.map.mpim-bonn.mpg.de/Poincar%C3%A9%27s_cube_manifolds} {MAP}, 

  

are constructed in the following example. Both are checked to be orientable
manifolds, and are shown to have different homology. (Note that the second
example in Poincare's paper is not a manifold
\texttt{\symbol{45}}\texttt{\symbol{45}} the links of some of its vertices are
not homeomorphic to a 2\texttt{\symbol{45}}sphere.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=1;;C:=2;;D:=3;;B:=4;;|
  !gapprompt@gap>| !gapinput@Ap:=5;;Cp:=6;;Dp:=7;;Bp:=8;;|
  
  !gapprompt@gap>| !gapinput@L:=[[A,B,D,C],[Bp,Dp,Cp,Ap]];;|
  !gapprompt@gap>| !gapinput@M:=[[A,B,Bp,Ap],[Cp,C,D,Dp]];;|
  !gapprompt@gap>| !gapinput@N:=[[A,C,Cp,Ap],[D,Dp,Bp,B]];;|
  !gapprompt@gap>| !gapinput@Ex3:=PoincareCubeCWComplex(L,M,N);|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@IsClosedManifold(Ex3);|
  
  true
  
  !gapprompt@gap>| !gapinput@L:=[[A,B,D,C],[Bp,Dp,Cp,Ap]];;|
  !gapprompt@gap>| !gapinput@M:=[[A,B,Bp,Ap],[C,D,Dp,Cp]];;|
  !gapprompt@gap>| !gapinput@N:=[[A,C,Cp,Ap],[B,D,Dp,Bp]];;|
  !gapprompt@gap>| !gapinput@Ex4:=PoincareCubeCWComplex(L,M,N);|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@IsClosedManifold(Ex4);|
  true
  
  !gapprompt@gap>| !gapinput@List([0..3],k->Homology(Ex3,k));|
  [ [ 0 ], [ 2, 2 ], [  ], [ 0 ] ]
  !gapprompt@gap>| !gapinput@List([0..3],k->Homology(Ex4,k));|
  [ [ 0 ], [ 2, 0 ], [ 0 ], [ 0 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{There are at least 25 distinct cube manifolds}}\logpage{[ 4, 10, 0 ]}
\hyperdef{L}{X8761051F84C6CEC2}{}
{
 The function \texttt{PoincareCubeCWComplex(A,G)} can also be applied to two inputs where $A$ is a pairing of the six faces such as $A=[[1,2],[3,4],[5,6]]$ and $G$ is a list of three elements of the dihedral group of order $8$ such as $G=[(2,4),(2,4),(2,4)*(1,3)]$. The dihedral elements specify how each pair of faces are glued together.
With these inputs it is easy to iterate over all possible values of $A$ and $G$ in order to construct all possible closed 3\texttt{\symbol{45}}manifolds
arising from the pairwise identification of faces of a cube. We call such a
manifold a \emph{\textsc{cube manifold}}. Distinct values of $A$ and $G$ can of course yield homeomorphic spaces. To ensure that each possible cube
manifold is constructed, at least once, up to homeomorphism it suffices to
consider 

$A=[ [1,2], [3,4], [5,6] ]$, $A=[ [1,2], [3,5], [4,6] ]$, $A=[ [1,4], [2,6], [3,5] ]$ 

 and all $G$ in $D_8\times D_8\times D_8$. 

The following commands iterate through these $3\times8^3 = 1536$ pairs $(A,G)$ and show that in precisely 163 cases (just over 10\% of cases) the quotient
CW\texttt{\symbol{45}}complex is a closed 3\texttt{\symbol{45}}manifold. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A1:= [ [1,2], [3,4], [5,6] ];;|
  !gapprompt@gap>| !gapinput@A2:=[ [1,2], [3,5], [4,6] ];;|
  !gapprompt@gap>| !gapinput@A3:=[ [1,4], [2,6], [3,5] ];;|
  !gapprompt@gap>| !gapinput@D8:=DihedralGroup(IsPermGroup,8);;|
  
  !gapprompt@gap>| !gapinput@Manifolds:=[];;|
  !gapprompt@gap>| !gapinput@for A in [A1,A2,A3] do|
  !gapprompt@>| !gapinput@for x in D8 do|
  !gapprompt@>| !gapinput@for y in D8 do|
  !gapprompt@>| !gapinput@for z in D8 do|
  !gapprompt@>| !gapinput@G:=[x,y,z];|
  !gapprompt@>| !gapinput@F:=PoincareCubeCWComplex(A,G);|
  !gapprompt@>| !gapinput@b:=IsClosedManifold(F);|
  !gapprompt@>| !gapinput@if b=true then Add(Manifolds,F); fi;|
  !gapprompt@>| !gapinput@od;od;od;od;|
  
  !gapprompt@gap>| !gapinput@Size(Manifolds);|
  163
  
\end{Verbatim}
 The following additional commands use integral homology and low index
subgroups of fundamental groups to establish that the 163 cube manifolds
represent at least 25 distinct homotopy equivalence classes of manifolds. One
homotopy class is represented by up to 40 of the manifolds, and at least four
of the homotopy classes are each represented by a single manifold.. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@invariant1:=function(m);|
  !gapprompt@>| !gapinput@return List([1..3],k->Homology(m,k));|
  !gapprompt@>| !gapinput@end;;|
  
  !gapprompt@gap>| !gapinput@C:=Classify(Manifolds,invariant1);;|
  
  !gapprompt@gap>| !gapinput@invariant2:=function(m)|
  !gapprompt@>| !gapinput@local L;|
  !gapprompt@>| !gapinput@L:=FundamentalGroup(m);|
  !gapprompt@>| !gapinput@if GeneratorsOfGroup(L)= [] then return [];fi;|
  !gapprompt@>| !gapinput@L:=LowIndexSubgroupsFpGroup(L,5);|
  !gapprompt@>| !gapinput@L:=List(L,AbelianInvariants);|
  !gapprompt@>| !gapinput@L:=SortedList(L);|
  !gapprompt@>| !gapinput@return L;|
  !gapprompt@>| !gapinput@end;;|
  
  !gapprompt@gap>| !gapinput@D:=RefineClassification(C,invariant2);;|
  !gapprompt@gap>| !gapinput@List(D,Size);|
  [ 40, 2, 10, 15, 8, 6, 2, 6, 2, 5, 7, 1, 4, 11, 7, 7, 10, 4, 4, 2, 1, 3, 1, 
    1, 4 ]
  
\end{Verbatim}
 The next commands construct a list of 18 orientable cube manifolds and a list
of 7 non\texttt{\symbol{45}}orientable cube manifolds. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Manifolds:=List(D,x->x[1]);;|
  !gapprompt@gap>| !gapinput@OrientableManifolds:=Filtered(Manifolds,m->Homology(m,3)=[0]);;|
  !gapprompt@gap>| !gapinput@NonOrientableManifolds:=Filtered(Manifolds,m->Homology(m,3)=[]);;|
  !gapprompt@gap>| !gapinput@Length(OrientableManifolds);|
  18
  !gapprompt@gap>| !gapinput@Length(NonOrientableManifolds);|
  7
  
\end{Verbatim}
 The next commands show that the 7 non\texttt{\symbol{45}}orientable cube
manifolds all have infinite fundamental groups. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@List(NonOrientableManifolds,m->IsFinite(FundamentalGroup(m)));|
  [ false, false, false, false, false, false, false ]
  
\end{Verbatim}
 The final commands show that (at least) 9 of the orientable manifolds have
finite fundamental groups and list the isomorphism types of these finite
groups. Note that it is now known that any closed
3\texttt{\symbol{45}}manifold with finite fundamental group is spherical (i.e.
is a quotient of the 3\texttt{\symbol{45}}sphere). Spherical manifolds with
cyclic fundamental group are, by definition, lens spaces. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@List(OrientableManifolds{[4,8,10,11,12,13,15,16,18]},m->|
            IsFinite(FundamentalGroup(m)));
  [ true, true, true, true, true, true, true, true, true ]
  
  !gapprompt@gap>| !gapinput@List(OrientableManifolds{[4,8,10,11,12,13,15,16,18]},m->|
            StructureDescription(FundamentalGroup(m)));
  [ "Q8", "C2", "C4", "C3 : C4", "C12", "C8", "C14", "C6", "1" ]
  
  
\end{Verbatim}
 
\subsection{\textcolor{Chapter }{Face pairings for 25 distinct cube manifolds}}\logpage{[ 4, 10, 1 ]}
\hyperdef{L}{X7D50795883E534A3}{}
{
 The following are the face pairings of 25 non\texttt{\symbol{45}}homeomorphic
cube manifolds, with vertices of the cube numbered as describe above. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|for i in [1..25] do                                              A
  @gapprompt|>A @gapinput|p:=Manifolds[i]!.cubeFacePairings;A
  @gapprompt|>A @gapinput|Print("Manifold ",i," has face pairings:\n");A
  @gapprompt|>A @gapinput|Print(p[1],"\n",p[2],"\n",p[3],"\n");A
  @gapprompt|>A @gapinput|Print("Fundamental group is:  ");A
  @gapprompt|>A @gapinput|if i in [ 1, 9, 12, 14, 15, 16, 17, 18, 19, 20, 22, 23, 25 ] thenA
  @gapprompt|>A @gapinput|Print(StructureDescription(FundamentalGroup(Manifolds[i])),"\n");A
  @gapprompt|>A @gapinput|else Print("infinite non-cyclic\n"); fi;A
  @gapprompt|>A @gapinput|if Homology(Manifolds[i],3)=[0] then Print("Orientable, ");A
  @gapprompt|>A @gapinput|else Print("Non orientable, "); fi;A
  @gapprompt|>A @gapinput|Print(ManifoldType(Manifolds[i]),"\n");A
  @gapprompt|>A @gapinput|for x in Manifolds[i]!.edgeDegrees doA
  @gapprompt|>A @gapinput|Print(x[2]," edges of \"degree\" ",x[1],",  ");A
  @gapprompt|>A @gapinput|od;A
  @gapprompt|>A @gapinput|Print("\n\n");A
  @gapprompt|>A @gapinput|od;A
  
  Manifold 1 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 7, 8, 4 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 8, 7, 6 ] ]
  [ [ 1, 4, 8, 5 ], [ 3, 2, 6, 7 ] ]
  Fundamental group is:  Z x C2
  Non orientable, other
  4 edges of "degree" 2,  4 edges of "degree" 4,  
  
  Manifold 2 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 7, 8, 4, 3 ] ]
  [ [ 1, 2, 3, 4 ], [ 1, 5, 8, 4 ] ]
  [ [ 5, 8, 7, 6 ], [ 7, 6, 2, 3 ] ]
  Fundamental group is:  infinite non-cyclic
  Non orientable, other
  2 edges of "degree" 1,  2 edges of "degree" 3,  2 edges of "degree" 8,  
  
  Manifold 3 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 7, 8, 4 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ] ]
  [ [ 1, 4, 8, 5 ], [ 2, 3, 7, 6 ] ]
  Fundamental group is:  infinite non-cyclic
  Non orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 4 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 7, 8, 4 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ] ]
  [ [ 1, 4, 8, 5 ], [ 6, 7, 3, 2 ] ]
  Fundamental group is:  infinite non-cyclic
  Non orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 5 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 7, 8, 4 ] ]
  [ [ 1, 2, 3, 4 ], [ 6, 5, 8, 7 ] ]
  [ [ 1, 4, 8, 5 ], [ 2, 6, 7, 3 ] ]
  Fundamental group is:  infinite non-cyclic
  Non orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 6 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 4, 8, 7 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ] ]
  [ [ 1, 4, 8, 5 ], [ 2, 3, 7, 6 ] ]
  Fundamental group is:  infinite non-cyclic
  Orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 7 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 7, 3, 4, 8 ] ]
  [ [ 1, 2, 3, 4 ], [ 1, 5, 8, 4 ] ]
  [ [ 5, 8, 7, 6 ], [ 7, 6, 2, 3 ] ]
  Fundamental group is:  infinite non-cyclic
  Orientable, other
  2 edges of "degree" 1,  2 edges of "degree" 3,  2 edges of "degree" 8,  
  
  Manifold 8 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 4, 8, 7 ] ]
  [ [ 1, 2, 3, 4 ], [ 7, 8, 5, 6 ] ]
  [ [ 1, 4, 8, 5 ], [ 7, 6, 2, 3 ] ]
  Fundamental group is:  infinite non-cyclic
  Orientable, other
  4 edges of "degree" 2,  2 edges of "degree" 8,  
  
  Manifold 9 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 4, 8, 7 ] ]
  [ [ 1, 2, 3, 4 ], [ 8, 5, 6, 7 ] ]
  [ [ 1, 4, 8, 5 ], [ 6, 2, 3, 7 ] ]
  Fundamental group is:  Q8
  Orientable, spherical
  8 edges of "degree" 3,  
  
  Manifold 10 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 4, 8, 7, 3 ] ]
  [ [ 1, 2, 3, 4 ], [ 7, 8, 5, 6 ] ]
  [ [ 1, 4, 8, 5 ], [ 7, 6, 2, 3 ] ]
  Fundamental group is:  infinite non-cyclic
  Orientable, other
  4 edges of "degree" 2,  4 edges of "degree" 4,  
  
  Manifold 11 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 4, 3, 7, 8 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ] ]
  [ [ 1, 4, 8, 5 ], [ 2, 3, 7, 6 ] ]
  Fundamental group is:  infinite non-cyclic
  Non orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 12 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 4, 8, 7, 3 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ] ]
  [ [ 1, 4, 8, 5 ], [ 2, 3, 7, 6 ] ]
  Fundamental group is:  Z x Z x Z
  Orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 13 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 4, 8, 7, 3 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ] ]
  [ [ 1, 4, 8, 5 ], [ 7, 6, 2, 3 ] ]
  Fundamental group is:  infinite non-cyclic
  Orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 14 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 7, 3, 4, 8 ] ]
  [ [ 1, 2, 3, 4 ], [ 7, 8, 5, 6 ] ]
  [ [ 1, 4, 8, 5 ], [ 7, 6, 2, 3 ] ]
  Fundamental group is:  C2
  Orientable, spherical
  12 edges of "degree" 2,  
  
  Manifold 15 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 7, 8, 4 ] ]
  [ [ 1, 2, 3, 4 ], [ 1, 5, 8, 4 ] ]
  [ [ 5, 8, 7, 6 ], [ 2, 3, 7, 6 ] ]
  Fundamental group is:  Z
  Non orientable, other
  4 edges of "degree" 1,  2 edges of "degree" 2,  2 edges of "degree" 8,  
  
  Manifold 16 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 4, 8, 7 ] ]
  [ [ 1, 2, 3, 4 ], [ 1, 5, 8, 4 ] ]
  [ [ 5, 8, 7, 6 ], [ 2, 3, 7, 6 ] ]
  Fundamental group is:  Z
  Orientable, other
  4 edges of "degree" 1,  2 edges of "degree" 2,  2 edges of "degree" 8,  
  
  Manifold 17 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 4, 8, 7 ] ]
  [ [ 1, 2, 3, 4 ], [ 1, 5, 8, 4 ] ]
  [ [ 5, 8, 7, 6 ], [ 3, 7, 6, 2 ] ]
  Fundamental group is:  C4
  Orientable, spherical
  2 edges of "degree" 1,  2 edges of "degree" 3,  2 edges of "degree" 8,  
  
  Manifold 18 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 4, 8, 7 ] ]
  [ [ 1, 2, 3, 4 ], [ 8, 4, 1, 5 ] ]
  [ [ 5, 8, 7, 6 ], [ 6, 2, 3, 7 ] ]
  Fundamental group is:  C3 : C4
  Orientable, spherical
  2 edges of "degree" 2,  4 edges of "degree" 5,  
  
  Manifold 19 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 4, 8, 7 ] ]
  [ [ 1, 2, 3, 4 ], [ 8, 4, 1, 5 ] ]
  [ [ 5, 8, 7, 6 ], [ 3, 7, 6, 2 ] ]
  Fundamental group is:  C12
  Orientable, spherical
  2 edges of "degree" 2,  2 edges of "degree" 3,  2 edges of "degree" 7,  
  
  Manifold 20 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 4, 8, 7 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 8, 4, 1 ] ]
  [ [ 5, 8, 7, 6 ], [ 3, 7, 6, 2 ] ]
  Fundamental group is:  C8
  Orientable, spherical
  8 edges of "degree" 3,  
  
  Manifold 21 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 7, 3, 4, 8 ] ]
  [ [ 1, 2, 3, 4 ], [ 8, 4, 1, 5 ] ]
  [ [ 5, 8, 7, 6 ], [ 7, 6, 2, 3 ] ]
  Fundamental group is:  infinite non-cyclic
  Orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 22 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 5, 6, 7, 8 ] ]
  [ [ 3, 7, 8, 4 ], [ 7, 6, 2, 3 ] ]
  [ [ 1, 2, 3, 4 ], [ 8, 4, 1, 5 ] ]
  Fundamental group is:  C14
  Orientable, spherical
  2 edges of "degree" 2,  4 edges of "degree" 5,  
  
  Manifold 23 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 5, 6, 7, 8 ] ]
  [ [ 3, 7, 8, 4 ], [ 7, 6, 2, 3 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 8, 4, 1 ] ]
  Fundamental group is:  C6
  Orientable, spherical
  6 edges of "degree" 2,  2 edges of "degree" 6,  
  
  Manifold 24 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 7, 8, 5, 6 ] ]
  [ [ 3, 7, 8, 4 ], [ 2, 3, 7, 6 ] ]
  [ [ 1, 2, 3, 4 ], [ 4, 1, 5, 8 ] ]
  Fundamental group is:  infinite non-cyclic
  Orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 25 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 6, 7, 8, 5 ] ]
  [ [ 3, 7, 8, 4 ], [ 3, 7, 6, 2 ] ]
  [ [ 1, 2, 3, 4 ], [ 1, 5, 8, 4 ] ]
  Fundamental group is:  1
  Orientable, spherical
  4 edges of "degree" 1,  4 edges of "degree" 5,
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Platonic cube manifolds}}\logpage{[ 4, 10, 2 ]}
\hyperdef{L}{X837811BB8181666E}{}
{
 A \emph{platonic solid} is a convex, regular polyhedron in $3$\texttt{\symbol{45}}dimensional euclidean $\mathbb E^3$ or spherical $\mathbb S^3$ or hyperbolic space $\mathbb H^3$. Being \emph{regular} means that all edges are congruent, all faces are congruent, all angles
between adjacent edges in a face are congruent, all dihedral angles between
adjacent faces are congruent. A platonic cube in euclidean space has six
congruent square faces with diherdral angle $\pi/2$. A platonic cube in spherical space has dihedral angles $2\pi/3$. A platonic cube in hyperbolic space has dihedral angles $2\pi/5$. This can alternatively be expressed by saying that in a tessellation of $\mathbb E^3$ by platonic cubes each edge is adjacent to 4 square faces. In a tessellation
of $\mathbb S^3$ by platonic cubes each edge is adjacent to 3 square faces. In a tessellation
of $\mathbb H^3$ by platonic cubes each edge is adjacent to 5 five square faces. 

 Any cube manifold $M$ induces a cubical CW\texttt{\symbol{45}}decomposition of its universal cover $\widetilde M$. We say that $M$ is a \emph{platonic cube manifold} if every edge in $\widetilde M$ is adjacent to 4 faces in the euclidean case $\widetilde M=\mathbb E^3$, is adjacent to 3 faces in the spherical case $\widetilde M=\mathbb S^3$, is adjacent to 5 faces in the hyperbolic case $\widetilde M=\mathbb H^3$. 

 In the above list of 25 cube manifolds we see that the euclidean manifolds 3,
4, 5, 6, 11 are platonic and that the spherical manifolds 9, 20 are platonic. }

 }

 
\section{\textcolor{Chapter }{There are at most 41 distinct cube manifolds}}\logpage{[ 4, 11, 0 ]}
\hyperdef{L}{X8084A36082B26D86}{}
{
 Using the \href{https://simpcomp-team.github.io/simpcomp/README.html} {Simpcomp} package for GAP we can show that many of the 163 cube manifolds constructed
above are homeomorphic. We do this by showing that barycentric subdivisions of
many of the manifolds are combinatorially the same. 

The following commands establish homeomorphisms (simplicial complex
isomorphisms) between manifolds in each equivalence class D[i] above for $1 \le i\le 25$, and then discard all but one manifold in each homeomorphism class. We are
left with 59 cube manifolds, some of which may be homeomorphic, representing
at least 25 distinct homeomorphism classes. The 59 manifolds are stored in the
list DD of length 25 each of whose terms is a list of cube manifolds. 
\begin{Verbatim}[commandchars=@|F,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>F @gapinput|LoadPackage("Simpcomp");;F
  
  @gapprompt|gap>F @gapinput|inv3:=function(m)F
  @gapprompt|>F @gapinput|local K;F
  @gapprompt|>F @gapinput|K:=BarycentricSubdivision(m);F
  @gapprompt|>F @gapinput|K:=MaximalSimplicesOfSimplicialComplex(K);F
  @gapprompt|>F @gapinput|K:=SC(K);F
  @gapprompt|>F @gapinput|if not SCIsStronglyConnected(K) then Print("WARNING!\n"); fi;F
  @gapprompt|>F @gapinput|return SCExportIsoSig( K );F
  @gapprompt|>F @gapinput|end;F
  function( m ) ... end
  
  @gapprompt|gap>F @gapinput|DD:=[];;F
  @gapprompt|gap>F @gapinput|for x in D doF
  @gapprompt|>F @gapinput|y:=Classify(x,inv3);F
  @gapprompt|>F @gapinput|Add(DD,List(y,z->z[1]));F
  @gapprompt|>F @gapinput|od;F
  
  @gapprompt|gap>F @gapinput|List(DD,Size);F
  [ 9, 1, 3, 3, 3, 1, 1, 1, 1, 1, 2, 1, 2, 7, 4, 4, 3, 1, 1, 1, 1, 3, 1, 1, 3 ]
  
\end{Verbatim}
 The function \texttt{PoincareCubeCWCompex()} applies cell simplifications in its construction of the quotient of a
CW\texttt{\symbol{45}}complex. A variant \texttt{PoincareCubeCWCompexNS()} performs no cell simplifications and thus returns a bigger cell complex which
we can attempt to use to establish further homeomorphisms. This is done in the
following session and succeeds in showing that there are at most 51 distinct
homeomorphism types of cube manifolds. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|DD:=List(DD,x->List(x,y->PoincareCubeCWComplexNS(B
  @gapprompt|>B @gapinput|y!.cubeFacePairings[1],y!.cubeFacePairings[2],y!.cubeFacePairings[3])));;B
  
  @gapprompt|gap>B @gapinput|D:=[];;B
  @gapprompt|gap>B @gapinput|for x in DD doB
  @gapprompt|>B @gapinput|y:=Classify(x,inv3);B
  @gapprompt|>B @gapinput|Add(D,List(y,z->z[1]));B
  >od;;
  
  @gapprompt|gap>B @gapinput|List(D,Size);B
  [ 8, 1, 3, 3, 2, 1, 1, 1, 1, 1, 2, 1, 2, 4, 4, 4, 3, 1, 1, 1, 1, 1, 1, 1, 2 ]
  
\end{Verbatim}
 Making further modifications to the cell structures of the manifolds that
leave their homeomorphism types unchanged can help to identify further
simplicial isomorphisms between barycentric subdivisions. For instance, the
following commands succeed in establishing that there are at most 45 distinct
homeomorphism types of cube manifolds. 
\begin{Verbatim}[commandchars=@|E,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>E @gapinput|DD:=[];;E
  @gapprompt|gap>E @gapinput|for x in D doE
  @gapprompt|>E @gapinput|if Length(x)>1 thenE
  @gapprompt|>E @gapinput|Add(DD, List(x,y->BarycentricallySimplifiedComplex(y)));E
  @gapprompt|>E @gapinput|else Add(DD,x);E
  @gapprompt|>E @gapinput|fi;E
  @gapprompt|>E @gapinput|od;E
  @gapprompt|gap>E @gapinput|D:=[];;E
  
  @gapprompt|gap>E @gapinput|for x in DD doE
  @gapprompt|>E @gapinput|y:=Classify(x,inv3);E
  @gapprompt|>E @gapinput|Add(D,List(y,z->z[1]));E
  @gapprompt|>E @gapinput|od;E
  
  @gapprompt|gap>E @gapinput|List(D,Size);E
  [ 7, 1, 3, 3, 2, 1, 1, 1, 1, 1, 2, 1, 2, 2, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 2 ]
  
  @gapprompt|gap>E @gapinput|DD:=List(D,x->List(x,y->PoincareCubeCWComplexNS(E
  @gapprompt|>E @gapinput|y!.cubeFacePairings[1],y!.cubeFacePairings[2],y!.cubeFacePairings[3])));;E
  
  @gapprompt|gap>E @gapinput|D1:=[];;E
  @gapprompt|gap>E @gapinput|for x in DD doE
  @gapprompt|>E @gapinput|if Length(x)>1 thenE
  @gapprompt|>E @gapinput|Add(D1, List(x,y->BarycentricallySimplifiedComplex(RegularCWComplex(BarycentricSubdivision(y)))));E
  @gapprompt|>E @gapinput|else Add(D1,x);E
  @gapprompt|>E @gapinput|fi;E
  @gapprompt|>E @gapinput|od;E
  
  @gapprompt|gap>E @gapinput|DD:=[];;E
  @gapprompt|gap>E @gapinput|for x in D1 doE
  @gapprompt|>E @gapinput|y:=Classify(x,inv3);E
  @gapprompt|>E @gapinput|Add(DD,List(y,z->z[1]));E
  @gapprompt|>E @gapinput|od;;E
  
  @gapprompt|gap>E @gapinput|Print(List(DD,Size),"\n");E
  [ 6, 1, 3, 3, 2, 1, 1, 1, 1, 1, 2, 1, 2, 2, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 2 ]
  
\end{Verbatim}
 

The two manifolds in DD[14] have fundamental group $C_2$ and are thus lens spaces. There is only one homeomorphism class of such lens
spaces and so these two manifolds are homeomorphic. The three manifolds in
DD[17] are lens spaces with fundamental group $C_4$. Again, there is only one homeomorphism class of such lens spaces and so
these three manifolds are homeomorphic. The two manifolds in DD[25] have
trivial fundamental group and are hence both homeomorphic to the
3\texttt{\symbol{45}}sphere. These observations mean that there are at most 41
closed manifolds arising from a cube by identifying the cube's faces pairwise. 

 These observations can be incorporated into our list DD of equivalence classes
of manifolds as follows. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@DD[14]:=DD[14]{[1]};;|
  !gapprompt@gap>| !gapinput@DD[17]:=DD[17]{[1]};;|
  !gapprompt@gap>| !gapinput@DD[25]:=DD[25]{[1]};;|
  !gapprompt@gap>| !gapinput@List(DD,Size);|
  [ 6, 1, 3, 3, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{There are precisely 18 orientable cube manifolds, of which 9 are spherical and
5 are euclidean}}\logpage{[ 4, 12, 0 ]}
\hyperdef{L}{X7B63C22C80E53758}{}
{
 The following commands show that there are at least 18 and at most 21
orientable cube manifolds. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@DDorient:=Filtered(DD,x->Homology(x[1],3)=[0]);;|
  !gapprompt@gap>| !gapinput@List(DDorient,Size);|
  [ 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
  
\end{Verbatim}
 The next commands show that the fundamental groups of the two manifolds in
DDorient[7] are isomorphic to $\mathbb Z \times \mathbb Z : \mathbb Z$, and that the fundamental groups of the three manifolds in DDorient[9] are
isomorphic to $\mathbb Z$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@g1:=FundamentalGroup(DDorient[7][1]);;|
  !gapprompt@gap>| !gapinput@g2:=FundamentalGroup(DDorient[7][2]);;|
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(g1);|
  [ f1^-1*f2*f1*f2^-1, f3^-1*f1*f3*f1, f3^-1*f2^-1*f3*f2^-1 ]
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(g2);|
  [ f1*f2*f1^-1*f2^-1, f1^-1*f3*f1^-1*f3^-1, f3*f2*f3^-1*f2 ]
  
  !gapprompt@gap>| !gapinput@h1:=FundamentalGroup(DDorient[9][1]);;|
  !gapprompt@gap>| !gapinput@h2:=FundamentalGroup(DDorient[9][2]);;|
  !gapprompt@gap>| !gapinput@h3:=FundamentalGroup(DDorient[9][3]);;|
  !gapprompt@gap>| !gapinput@StructureDescription(h1);|
  "Z"
  !gapprompt@gap>| !gapinput@StructureDescription(h2);|
  "Z"
  !gapprompt@gap>| !gapinput@StructureDescription(h3);|
  "Z"
  
\end{Verbatim}
 Since neither $\mathbb Z\times \mathbb Z : \mathbb Z$ nor $\mathbb Z$ is a free product of two non\texttt{\symbol{45}}trivial groups we conclude
that the manifolds in DDorient[7] and DDorient[9] are prime. Since oriented
prime 3\texttt{\symbol{45}}manifolds are determined up to homeomorphism by
their fundamental groups we can conclude that there are precisely 18
orientable closed manifolds arising from a cube by identifying the cube's
faces pairwise. 

 A compact 3\texttt{\symbol{45}}manifold $M$ is \emph{spherical} if it is of the form $M=S^3/\Gamma$ where $\Gamma$ is a finite group acting freely as rotations on $S^3$. The fundamental group of $M$ is then the finite group $\Gamma$. Perelmen showed that a compact 3\texttt{\symbol{45}}manifold is spherical if
and only if its fundamental group is finite. 

 A compact 3\texttt{\symbol{45}}manifold is \emph{euclidean} if it is of the form $M=\mathbb R^3/\Gamma$ where $\Gamma$ is a group of affine transformations acting freely on $\mathbb R^3$. The fundamental group is then $\Gamma$ and is called a \emph{Bieberbach group} of dimension 3. It can be shown that a group $\Gamma$ is isomorphic to a Bieberbach group of dimension $n$ if and only if there is a short exact sequence $\mathbb Z^n \rightarrowtail \Gamma \twoheadrightarrow P$ with $P$ a finite group. 

The following command establishes that there are precisely 9 orientable
spherical manifolds and 5 closed orientable euclidean manifolds arising from
pairwise identifications of the faces of the cube. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@List(OrientableManifolds,ManifoldType);|
  [ "euclidean", "other", "other", "spherical", "other", "euclidean", 
    "euclidean", "spherical", "other", "spherical", "spherical", "spherical", 
    "spherical", "euclidean", "spherical", "spherical", "euclidean", "spherical" ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cube manifolds with boundary}}\logpage{[ 4, 13, 0 ]}
\hyperdef{L}{X796BF3817BD7F57D}{}
{
 If a space $Y$ obtained from identifying faces of the cube fails to be a manifold then it
fails because one or more vertices of $Y$ fail to have a spherical link. By using barycentric subdivision if necessary,
we can ensure that the stars of any two non\texttt{\symbol{45}}manifold
vertices of $Y$ have trivial intersection. Removing the stars of the
non\texttt{\symbol{45}}manifold vertices from $Y$ yields a 3\texttt{\symbol{45}}manifold with boundary $\hat Y$. 

The following commands show that there are 367 combinatorially different
regular CW\texttt{\symbol{45}}complexes $Y$ that arise by identifying faces of a cube in pairs and which fail to be
manifolds. The commands also show that these spaces give rise to at least 180
non\texttt{\symbol{45}}homeomorphic manifolds $\hat Y$ with boundary. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A1:= [ [1,2], [3,4], [5,6] ];;|
  !gapprompt@gap>| !gapinput@A2:=[ [1,2], [3,5], [4,6] ];;|
  !gapprompt@gap>| !gapinput@A3:=[ [1,4], [2,6], [3,5] ];;|
  !gapprompt@gap>| !gapinput@D8:=DihedralGroup(IsPermGroup,8);;|
  
  !gapprompt@gap>| !gapinput@NonManifolds:=[];;|
  !gapprompt@gap>| !gapinput@for A in [A1,A2,A3] do|
  !gapprompt@>| !gapinput@for x in D8 do|
  !gapprompt@>| !gapinput@for y in D8 do|
  !gapprompt@>| !gapinput@for z in D8 do|
  !gapprompt@>| !gapinput@G:=[x,y,z];|
  !gapprompt@>| !gapinput@F:=PoincareCubeCWComplex(A,G);|
  !gapprompt@>| !gapinput@b:=IsClosedManifold(F);|
  !gapprompt@>| !gapinput@if b=false then Add(NonManifolds,F); fi;|
  !gapprompt@>| !gapinput@od;od;od;od;|
  
  !gapprompt@gap>| !gapinput@D:=Classify(NonManifolds,inv3); #See above for inv3|
  !gapprompt@gap>| !gapinput@D:=List(D,x->x[1]);;|
  !gapprompt@gap>| !gapinput@Size(D);|
  367
  
  !gapprompt@gap>| !gapinput@M:=List(D,ThreeManifoldWithBoundary);;|
  !gapprompt@gap>| !gapinput@C:=Classify(M,invariant1);; #See above for invariant1       |
  !gapprompt@gap>| !gapinput@List(C,Size);|
  [ 33, 13, 3, 18, 21, 7, 6, 13, 51, 2, 1, 15, 11, 11, 1, 35, 2, 2, 6, 15, 
    17, 2, 3, 2, 14, 17, 3, 1, 25, 8, 4, 1, 4 ]
  
  !gapprompt@gap>| !gapinput@inv5:=function(m)                       |
  !gapprompt@>| !gapinput@local B;|
  !gapprompt@>| !gapinput@B:=BoundaryOfPureRegularCWComplex(m);;|
  !gapprompt@>| !gapinput@return invariant1(B);|
  !gapprompt@>| !gapinput@end;;|
  
  !gapprompt@gap>| !gapinput@CC:=RefineClassification(C,inv5);;|
  !gapprompt@gap>| !gapinput@List(CC,Size);|
  [ 25, 5, 3, 5, 4, 4, 2, 1, 11, 3, 4, 7, 3, 6, 4, 1, 5, 1, 1, 5, 1, 13, 4, 
    6, 40, 1, 2, 1, 11, 4, 5, 3, 1, 2, 7, 4, 1, 14, 11, 10, 2, 2, 6, 9, 3, 3, 
    2, 15, 2, 3, 2, 14, 17, 2, 1, 1, 4, 7, 14, 8, 3, 1, 1, 4 ]
  
  !gapprompt@gap>| !gapinput@CC:=RefineClassification(CC,invariant2);;|
  !gapprompt@gap>| !gapinput@List(CC,Size);                              |
  [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 3, 1, 1, 2, 1, 2, 1, 4, 2, 3, 2, 3, 
    4, 3, 2, 1, 1, 3, 2, 4, 3, 1, 1, 5, 1, 1, 3, 1, 1, 1, 13, 3, 1, 4, 2, 1, 
    2, 2, 3, 3, 3, 4, 4, 2, 4, 4, 4, 4, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 2, 3, 4, 3, 1, 2, 3, 2, 3, 4, 3, 3, 2, 2, 1, 1, 2, 1, 1, 2, 
    1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 10, 5, 2, 3, 2, 14, 17, 1, 1, 1, 
    1, 4, 5, 2, 9, 1, 4, 7, 1, 3, 1, 1, 4 ]
  !gapprompt@gap>| !gapinput@Length(CC);|
  180
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Octahedral manifolds}}\logpage{[ 4, 14, 0 ]}
\hyperdef{L}{X7EC4359B7DF208B0}{}
{
 The above construction of 3\texttt{\symbol{45}}manifolds as quotients of a
cube can be extended to other polytopes. A polytope of particular interest,
and one that appears several times in the classic book on
Three\texttt{\symbol{45}}Manifolds by William Thurston \cite{thurston}, is the octahedron. The function \texttt{PoincareOctahahedronCWComplex()} can be used to construct any 3\texttt{\symbol{45}}dimensional
CW\texttt{\symbol{45}}complex arising from an octahedron by identifying the
eight faces pairwise; the vertices and faces of the octahedron are numbered as
follows. 

  

The following commands construct a spherical 3\texttt{\symbol{45}}manifold Y
with fundamental group equal to the binary tetrahedral group $G$. The commands then use the universal cover of this manifold to construct the
first four terms of a free periodic $\mathbb ZG$\texttt{\symbol{45}}resolution of $\mathbb Z$ of period $4$. The resolution has one free generator in dimensions $4n$ and $4n+3$ for $n\ge 0$. It has two free generators in dimensions $4n+1$ and $4n+2$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|L:=[ [ 1, 4, 5 ], [ 2, 6, 3 ] ];;A
  @gapprompt|gap>A @gapinput|M:=[ [ 3, 4, 5 ], [ 6, 1, 2 ] ];;A
  @gapprompt|gap>A @gapinput|N:=[ [ 2, 3, 5 ], [ 6, 4, 1 ] ];;A
  @gapprompt|gap>A @gapinput|P:=[ [ 1, 2, 5 ], [ 6, 3, 4 ] ];;A
  @gapprompt|gap>A @gapinput|Y:=PoincareOctahedronCWComplex(L,M,N,P);;A
  @gapprompt|gap>A @gapinput|IsClosedManifold(Y);A
  true
  
  @gapprompt|gap>A @gapinput|G:=FundamentalGroup(Y);;A
  @gapprompt|gap>A @gapinput|StructureDescription(G);A
  "SL(2,3)"
  
  @gapprompt|gap>A @gapinput|R:=ChainComplexOfUniversalCover(Y);A
  Equivariant chain complex of dimension 3
  
  @gapprompt|gap>A @gapinput|List([0..3],R!.dimension);A
  [ 1, 2, 2, 1 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Dodecahedral manifolds}}\logpage{[ 4, 15, 0 ]}
\hyperdef{L}{X85FFF9B97B7AD818}{}
{
 Another polytope of interest, and one that can be used to construct the
Poincare homology sphere, is the dodecahedron. The function \texttt{PoincareDodecahedronCWComplex()} can be used to construct any 3\texttt{\symbol{45}}dimensional
CW\texttt{\symbol{45}}complex arising from a dodecahedron by identifying the $12$ pentagonal faces pairwise; the vertices of the prism are numbered as follows. 

  

The following commands construct the Poincare homology $3$\texttt{\symbol{45}}sphere (with fundamental group equal to the binary
icosahedral group of order 120). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=PoincareDodecahedronCWComplex(|
  !gapprompt@>| !gapinput@[[1,2,3,4,5],[6,7,8,9,10]],|
  !gapprompt@>| !gapinput@[[1,11,16,12,2],[19,9,8,18,14]],|
  !gapprompt@>| !gapinput@[[2,12,17,13,3],[20,10,9,19,15]],|
  !gapprompt@>| !gapinput@[[3,13,18,14,4],[16,6,10,20,11]],|
  !gapprompt@>| !gapinput@[[4,14,19,15,5],[17,7,6,16,12]],|
  !gapprompt@>| !gapinput@[[5,15,20,11,1],[18,8,7,17,13]]);|
  Regular CW-complex of dimension 3
  !gapprompt@gap>| !gapinput@IsClosedManifold(Y);|
  true
  !gapprompt@gap>| !gapinput@List([0..3],n->Homology(Y,n));|
  [ [ 0 ], [  ], [  ], [ 0 ] ]
  !gapprompt@gap>| !gapinput@StructureDescription(FundamentalGroup(Y));|
  "SL(2,5)"
  
\end{Verbatim}
 The following commands construct Seifert\texttt{\symbol{45}}Weber space, a
rational homology sphere. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@W:=PoincareDodecahedronCWComplex(|
  !gapprompt@>| !gapinput@[[1,2,3,4,5],[7,8,9,10,6]],|
  !gapprompt@>| !gapinput@[[1,11,16,12,2],[9,8,18,14,19]],|
  !gapprompt@>| !gapinput@[[2,12,17,13,3],[10,9,19,15,20]],|
  !gapprompt@>| !gapinput@[[3,13,18,14,4],[6,10,20,11,16]],|
  !gapprompt@>| !gapinput@[[4,14,19,15,5],[7,6,16,12,17]],|
  !gapprompt@>| !gapinput@[[5,15,20,11,1],[8,7,17,13,18]]);|
  Regular CW-complex of dimension 3
  !gapprompt@gap>| !gapinput@IsClosedManifold(W);|
  true
  !gapprompt@gap>| !gapinput@List([0..3],n->Homology(W,n));|
  [ [ 0 ], [ 5, 5, 5 ], [  ], [ 0 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Prism manifolds}}\logpage{[ 4, 16, 0 ]}
\hyperdef{L}{X78B75E2E79FBCC54}{}
{
 Another polytope of interest is the prism constructed as the direct product $D_n\times [0,1]$ of an n\texttt{\symbol{45}}gonal disk $D_n$ with the unit interval. The function \texttt{PoincarePrismCWComplex()} can be used to construct any 3\texttt{\symbol{45}}dimensional
CW\texttt{\symbol{45}}complex arising from a prism with even $n\ge 4$ by identifying the $n+2$ faces pairwise; the vertices of the prism are numbered as follows. 

  

The case $n=4$ is that of a cube. The following commands construct a manifold $Y$ arising from a hexagonal prism ($n=6$) with fundamental group $\pi_1Y=C_5\times Q_{32}$ equal to the direct product of the cyclic group of order $5$ and the quaternion group of order $32$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=[[1,2,3,4,5,6],[11,12,7,8,9,10]];;                 |
  !gapprompt@gap>| !gapinput@M:=[[1,7,8,2],[4,5,11,10]];;             |
  !gapprompt@gap>| !gapinput@N:=[[2,8,9,3],[6,1,7,12]];;             |
  !gapprompt@gap>| !gapinput@P:=[[3,9,10,4],[6,12,11,5]];;             |
  !gapprompt@gap>| !gapinput@Y:=PoincarePrismCWComplex(L,M,N,P);;|
  !gapprompt@gap>| !gapinput@IsClosedManifold(Y);|
  true
  !gapprompt@gap>| !gapinput@G:=FundamentalGroup(Y);;|
  !gapprompt@gap>| !gapinput@StructureDescription(G);|
  "C5 x Q32"
  
\end{Verbatim}
 

An exhaustive search through all manifolds constructed from a hexagonal prism
by identify faces pairwise shows that the finite groups arising as fundamental
groups are precisely: $ Q_8$, $Q_{16}$, $C_4$, $ C_3 : C_4$, $ C_5 : C_4$, $ C_8$, $C_{16}$, $C_{12}$, $C_{20}$, $C_2$, $ C_6$, $ C_3 \times Q_8$, $ C_3 \times Q_{16}$, $C_5 \times Q_{32} $. Each of these finite groups $G=\pi_1Y$ is either cyclic (in which case the corresponding manifold is a lens space) or
else has the propert that $G/Z(G)$ is dihedral (in which case the corresponding manifold is called a \emph{prism manifold}). The majority of the manifolds arising from a hexagonal prism have infinite
fundamental group. 

 Infinite families of spherical $3$\texttt{\symbol{45}}maniolds can be constructed from the infinite family of
prisms. For instance, a prism manifold which we denote by $P_r$ can be obtained from a prism $D_{2r}\times [0,1]$ by identifying the left and right side under a twist of $\pi/r$, and identifying opposite square faces under a twist of $\pi/2$. Its fundamental group $\pi_1P_r$ is the binary dihedral group of order $4r$. The following commands construct $P_r$ for $r=3$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=[[1,2,3,4,5,6],[8,9,10,11,12,7]];;|
  !gapprompt@gap>| !gapinput@M:=[[1,7,8,2],[11,10,4,5]];;|
  !gapprompt@gap>| !gapinput@N:=[[2,8,9,3],[12,11,5,6]];;|
  !gapprompt@gap>| !gapinput@P:=[[3,9,10,4],[7,12,6,1]];;|
  !gapprompt@gap>| !gapinput@Y:=PoincarePrismCWComplex(L,M,N,P);;|
  !gapprompt@gap>| !gapinput@IsClosedManifold(Y);|
  true
  !gapprompt@gap>| !gapinput@StructureDescription(FundamentalGroup(Y));|
  "C3 : C4"
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Bipyramid manifolds}}\logpage{[ 4, 17, 0 ]}
\hyperdef{L}{X7F31DFDA846E8E75}{}
{
 Yet another polytope of interest is the bipyramid constructed as the
suspension of an n\texttt{\symbol{45}}gonal disk $D_n$. The function \texttt{PoincareBipyramidCWComplex()} can be used to construct any 3\texttt{\symbol{45}}dimensional
CW\texttt{\symbol{45}}complex arising from a bipyramid with $n\ge 3$ by identifying the $2n$ faces pairwise; the vertices of the prism are numbered as follows. 

  

 For $n=4$ the bipyramid is the octahedron. }

 }

 
\chapter{\textcolor{Chapter }{Topological data analysis}}\logpage{[ 5, 0, 0 ]}
\hyperdef{L}{X7B7E077887694A9F}{}
{
 
\section{\textcolor{Chapter }{Persistent homology }}\logpage{[ 5, 1, 0 ]}
\hyperdef{L}{X80A70B20873378E0}{}
{
 

Pairwise distances between $74$ points from some metric space have been recorded and stored in a $74\times 74$ matrix $D$. The following commands load the matrix, construct a filtration of length $100$ on the first two dimensions of the assotiated clique complex (also known as
the \emph{Vietoris\texttt{\symbol{45}}Rips Complex}), and display the resulting degree $0$ persistent homology as a barcode. A single bar with label $n$ denotes $n$ bars with common starting point and common end point. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("data253a.txt");;|
  !gapprompt@gap>| !gapinput@Read(file);|
  
  !gapprompt@gap>| !gapinput@G:=SymmetricMatrixToFilteredGraph(D,100);|
  Filtered graph on 74 vertices.
  
  !gapprompt@gap>| !gapinput@K:=FilteredRegularCWComplex(CliqueComplex(G,2));|
  Filtered regular CW-complex of dimension 2
  
  !gapprompt@gap>| !gapinput@P:=PersistentBettiNumbers(K,0);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P);|
  
\end{Verbatim}
  

The first 54 terms in the filtration each have 74 path components
\texttt{\symbol{45}}\texttt{\symbol{45}} one for each point in the sample.
During the next 9 filtration terms the number of path components reduces,
meaning that sample points begin to coalesce due to the formation of edges in
the simplicial complexes. Then, two path components persist over an interval
of 18 filtration terms, before they eventually coalesce. 

 The next commands display the resulting degree $1$ persistent homology as a barcode. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=PersistentBettiNumbers(K,1);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P);|
  
\end{Verbatim}
  

 Interpreting short bars as noise, we see for instance that the $65$th term in the filtration could be regarded as noiseless and belonging to a
"stable interval" in the filtration with regards to first and second homology
functors. The following command displays (up to homotopy) the $1$ skeleton of the simplicial complex arizing as the $65$\texttt{\symbol{45}}th term in the filtration on the clique complex. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=FiltrationTerm(K,65);|
  Regular CW-complex of dimension 1
  
  !gapprompt@gap>| !gapinput@Display(HomotopyGraph(Y));|
  
\end{Verbatim}
  

These computations suggest that the dataset contains two persistent path
components (or clusters), and that each path component is in some sense
periodic. The final command displays one possible representation of the data
as points on two circles. 
\subsection{\textcolor{Chapter }{Background to the data}}\logpage{[ 5, 1, 1 ]}
\hyperdef{L}{X7D512DA37F789B4C}{}
{
 

Each point in the dataset was an image consisting of $732\times 761$ pixels. This point was regarded as a vector in $\mathbb R^{557052}=\mathbb R^{732\times 761}$ and the matrix $D$ was constructed using the Euclidean metric. The images were the following: 

  }

 }

 
\section{\textcolor{Chapter }{Mapper clustering}}\logpage{[ 5, 2, 0 ]}
\hyperdef{L}{X849556107A23FF7B}{}
{
 

The following example reads in a set $S$ of vectors of rational numbers. It uses the Euclidean distance $d(u,v)$ between vectors. It fixes some vector $u_0\in S $ and uses the associated function $f\colon D\rightarrow [0,b] \subset \mathbb R, v\mapsto d(u_0,v)$. In addition, it uses an open cover of the interval $[0,b]$ consisting of $100$ uniformly distributed overlapping open subintervals of radius $r=29$. It also uses a simple clustering algorithm implemented in the function \texttt{cluster}. 

 These ingredients are input into the Mapper clustering procedure to produce a
simplicial complex $M$ which is intended to be a representation of the data. The complex $M$ is $1$\texttt{\symbol{45}}dimensional and the final command uses GraphViz software
to visualize the graph. The nodes of this simplicial complex are "buckets"
containing data points. A data point may reside in several buckets. The number
of points in the bucket determines the size of the node. Two nodes are
connected by an edge when they contain common data points. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("data134.txt");;|
  !gapprompt@gap>| !gapinput@Read(file);|
  !gapprompt@gap>| !gapinput@dx:=EuclideanApproximatedMetric;;|
  !gapprompt@gap>| !gapinput@dz:=EuclideanApproximatedMetric;;|
  !gapprompt@gap>| !gapinput@L:=List(S,x->Maximum(List(S,y->dx(x,y))));;|
  !gapprompt@gap>| !gapinput@n:=Position(L,Minimum(L));;|
  !gapprompt@gap>| !gapinput@f:=function(x); return [dx(S[n],x)]; end;;|
  !gapprompt@gap>| !gapinput@P:=30*[0..100];; P:=List(P, i->[i]);;|
  !gapprompt@gap>| !gapinput@r:=29;;|
  !gapprompt@gap>| !gapinput@epsilon:=75;;|
  !gapprompt@gap>| !gapinput@ cluster:=function(S)|
  !gapprompt@>| !gapinput@  local Y, P, C;|
  !gapprompt@>| !gapinput@  if Length(S)=0 then return S; fi;|
  !gapprompt@>| !gapinput@  Y:=VectorsToOneSkeleton(S,epsilon,dx);|
  !gapprompt@>| !gapinput@  P:=PiZero(Y);|
  !gapprompt@>| !gapinput@  C:=Classify([1..Length(S)],P[2]);|
  !gapprompt@>| !gapinput@  return List(C,x->S{x});|
  !gapprompt@>| !gapinput@ end;;|
  !gapprompt@gap>| !gapinput@M:=Mapper(S,dx,f,dz,P,r,cluster);|
  Simplicial complex of dimension 1.
  
  !gapprompt@gap>| !gapinput@Display(GraphOfSimplicialComplex(M));|
  
\end{Verbatim}
  
\subsection{\textcolor{Chapter }{Background to the data}}\label{pointcloud}
\logpage{[ 5, 2, 1 ]}
\hyperdef{L}{X7D512DA37F789B4C}{}
{
 

 The datacloud $S$ consists of the $400$ points in the plane shown in the following picture. 

  }

 }

 
\section{\textcolor{Chapter }{Some tools for handling pure complexes}}\logpage{[ 5, 3, 0 ]}
\hyperdef{L}{X7BBDE0567DB8C5DA}{}
{
 A CW\texttt{\symbol{45}}complex $X$ is said to be \emph{pure} if all of its top\texttt{\symbol{45}}dimensional cells have a common
dimension. There are instances where such a space $X$ provides a convenient ambient space whose subspaces can be used to model
experimental data. For instance, the plane $X=\mathbb R^2$ admits a pure regular CW\texttt{\symbol{45}}structure whose $2$\texttt{\symbol{45}}cells are open unit squares with integer coordinate
vertices. An alternative, and sometimes preferrable, pure regular
CW\texttt{\symbol{45}}structure on $\mathbb R^2$ is one where the $2$\texttt{\symbol{45}}cells are all reguar hexagons with sides of unit length.
Any digital image can be thresholded to produce a
black\texttt{\symbol{45}}white image and this black\texttt{\symbol{45}}white
image can naturally be regared as a finite pure cellular subcomplex of either
of the two proposed CW\texttt{\symbol{45}}structures on $\mathbb R^2$. Analogously, thresholding can be used to represent $3$\texttt{\symbol{45}}dimensional greyscale images as finite pure cellular
subspaces of cubical or permutahedral CW\texttt{\symbol{45}}structures on $\mathbb R^3$, and to represent RGB colour photographs as analogous subcomplexes of $\mathbb R^5$. 

 In this section we list a few functions for performing basic operations on $n$\texttt{\symbol{45}}dimensional pure cubical and pure permutahedral finite
subcomplexes $M$ of $X=R^n$. We refer to $M$ simply as a \emph{pure complex}. In subsequent sections we demonstrate how these few functions on pure
complexes allow for in\texttt{\symbol{45}}depth analysis of experimental data. 

(\textsc{Aside.} The basic operations could equally well be implemented for other
CW\texttt{\symbol{45}}decompositions of $X=\mathbb R^n$ such as the regular CW\texttt{\symbol{45}}decompositions arising as the
tessellations by a fundamental domain of a Bieberbach group (=torsion free
crytallographic group). Moreover, the basic operations could also be
implemented for other manifolds such as an $n$\texttt{\symbol{45}}torus $X=S^1\times S^1 \times \cdots \times S^1$ or $n$\texttt{\symbol{45}}sphere $X=S^n$ or for $X$ the universal cover of some interesting hyperbolic $3$\texttt{\symbol{45}}manifold. An example use of the ambient manifold $X=S^1\times S^1\times S^1$ could be for the construction of a cellular subspace recording the time of
day, day of week and week of the year of crimes committed in a population.) 

\textsc{Basic operations returning pure complexes.} ( Function descriptions available \href{../doc/chap1_mj.html#X7FD50DF6782F00A0} {here}.) 
\begin{itemize}
\item \texttt{PureCubicalComplex(binary array)}
\item \texttt{PurePermutahedralComplex(binary array)}
\item  \texttt{ReadImageAsPureCubicalComplex(file,threshold)}
\item  \texttt{ReadImageSquenceAsPureCubicalComplex(file,threshold)}
\item \texttt{PureComplexBoundary(M)}
\item  \texttt{PureComplexComplement(M)} 
\item  \texttt{PureComplexRandomCell(M)}
\item  \texttt{PureComplexThickened(M)}
\item \texttt{ContractedComplex(M, optional subcomplex of M)}
\item \texttt{ExpandedComplex(M, optional supercomplex of M)}
\item  \texttt{PureComplexUnion(M,N)}
\item  \texttt{PureComplexIntersection(M,N)}
\item  \texttt{PureComplexDifference(M,N)}
\item  \texttt{FiltrationTerm(F,n)}
\end{itemize}
 

\textsc{Basic operations returning filtered pure complexes.} 
\begin{itemize}
\item  \texttt{PureComplexThickeningFiltration(M,length)}
\item  \texttt{ReadImageAsFilteredPureCubicalComplex(file,length)}
\end{itemize}
 }

 
\section{\textcolor{Chapter }{Digital image analysis and persistent homology}}\logpage{[ 5, 4, 0 ]}
\hyperdef{L}{X79616D12822FDB9A}{}
{
 

The following example reads in a digital image as a filtered pure cubical
complexex. The filtration is obtained by thresholding at a sequence of
uniformly spaced values on the greyscale range. The persistent homology of
this filtered complex is calculated in degrees $0$ and $1$ and displayed as two barcodes. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("image1.3.2.png");;|
  !gapprompt@gap>| !gapinput@F:=ReadImageAsFilteredPureCubicalComplex(file,40);|
  Filtered pure cubical complex of dimension 2.
  !gapprompt@gap>| !gapinput@P:=PersistentBettiNumbers(F,0);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P);|
  
\end{Verbatim}
  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=PersistentBettiNumbers(F,1);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P);|
  
\end{Verbatim}
  

The $20$ persistent bars in the degree $0$ barcode suggest that the image has $20$ objects. The degree $1$ barcode suggests that there are $14$ (or possibly $17$) holes in these $20$ objects. 
\subsection{\textcolor{Chapter }{Naive example of image segmentation by automatic thresholding}}\logpage{[ 5, 4, 1 ]}
\hyperdef{L}{X8066F9B17B78418E}{}
{
 Assuming that short bars and isolated points in the barcodes represent noise
while long bars represent essential features, a "noiseless" representation of
the image should correspond to a term in the filtration corresponding to a
column in the barcode incident with all the long bars but incident with no
short bars or isolated points. There is no noiseless term in the above
filtration of length 40. However (in conjunction with the next subsection) the
following commands confirm that the 64th term in the filtration of length 500
is such a term and display this term as a binary image. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=ReadImageAsFilteredPureCubicalComplex(file,500);;|
  !gapprompt@gap>| !gapinput@Y:=FiltrationTerm(F,64);            |
  Pure cubical complex of dimension 2.
  !gapprompt@gap>| !gapinput@BettiNumber(Y,0);|
  20
  !gapprompt@gap>| !gapinput@BettiNumber(Y,1);|
  14
  !gapprompt@gap>| !gapinput@Display(Y);|
  
\end{Verbatim}
  }

 
\subsection{\textcolor{Chapter }{Refining the filtration}}\logpage{[ 5, 4, 2 ]}
\hyperdef{L}{X7E6436E0856761F2}{}
{
 The first filtration for the image has 40 terms. One may wish to investigate a
filtration with more terms, say 500 terms, with a view to analysing, say,
those 1\texttt{\symbol{45}}cycles that are born by term 25 of the filtration
and that die between terms 50 and 60. The following commands produce the
relevant barcode showing that there is precisely one such
1\texttt{\symbol{45}}cycle. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=ReadImageAsFilteredPureCubicalComplex(file,500);;|
  !gapprompt@gap>| !gapinput@L:=[20,60,61,62,63,64,65,66,67,68,69,70];;          |
  !gapprompt@gap>| !gapinput@T:=FiltrationTerms(F,L);;|
  !gapprompt@gap>| !gapinput@P0:=PersistentBettiNumbers(T,0);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P0);|
  !gapprompt@gap>| !gapinput@P1:=PersistentBettiNumbers(T,1);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P1);|
  
\end{Verbatim}
 

$\beta_0$:

  

 $\beta_1$:

  }

 
\subsection{\textcolor{Chapter }{Background to the data}}\logpage{[ 5, 4, 3 ]}
\hyperdef{L}{X7D512DA37F789B4C}{}
{
 

The following image was used in the example. 

  }

 }

 
\section{\textcolor{Chapter }{A second example of digital image segmentation}}\logpage{[ 5, 5, 0 ]}
\hyperdef{L}{X7A8224DA7B00E0D9}{}
{
 In order to automatically count the number of coins in this picture 

  

 we can load the image as a filtered pure cubical complex $F$ of filtration length 40 say, and observe the degree zero persistent Betti
numbers to establish that the 28\texttt{\symbol{45}}th term or so of $F$ seems to be 'noise free' in degree zero. We can then set $M$ equal to the 28\texttt{\symbol{45}}th term of $F$ and thicken $M$ a couple of times say to remove any tiny holes it may have. We can then
construct the complement $C$ of $M$. Then we can construct a 'neighbourhood thickening' filtration $T$ of $C$ with say $50$ consecutive thickenings. The degree one persistent barcode for $T$ has $24$ long bars, suggesting that the original picture consists of $24$ coins. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=ReadImageAsFilteredPureCubicalComplex("my_coins.png",40);;|
  !gapprompt@gap>| !gapinput@M:=FiltrationTerm(F,24);;  #Chosen after viewing degree 0 barcode for F|
  !gapprompt@gap>| !gapinput@M:=PureComplexThickened(M);;|
  !gapprompt@gap>| !gapinput@M:=PureComplexThickened(M);;|
  !gapprompt@gap>| !gapinput@C:=PureComplexComplement(M);;|
  !gapprompt@gap>| !gapinput@T:=ThickeningFiltration(C,50);;|
  !gapprompt@gap>| !gapinput@P:=PersistentBettiNumbers(T,1);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P);|
  
\end{Verbatim}
 

  

 The pure cubical complex \texttt{W:=PureComplexComplement(FiltrationTerm(T,25))} has the correct number of path components, namely $25$, but its path components are very much subsets of the regions in the image
corresponding to coins. The complex $W$ can be thickened repeatedly, subject to no two path components being allowed
to merge, in order to obtain a more realistic image segmentation with path
components corresponding more closely to coins. This is done in the follow
commands which use a makeshift function \texttt{Basins(L)} available \href{tutex/basins.g} {here}. The commands essentially implement a standard watershed segmentation
algorithm but do so by using the language of filtered pure cubical complexes. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@W:=PureComplexComplement(FiltrationTerm(T,25));;|
  !gapprompt@gap>| !gapinput@L:=[];;|
  !gapprompt@gap>| !gapinput@for i in [1..PathComponentOfPureComplex(W,0)] do|
  !gapprompt@gap>| !gapinput@P:=PathComponentOfPureComplex(W,i);;|
  !gapprompt@gap>| !gapinput@Q:=ThickeningFiltration(P,50,M);;|
  !gapprompt@gap>| !gapinput@Add(L,Q);;|
  !gapprompt@gap>| !gapinput@od;;|
  
  !gapprompt@gap>| !gapinput@B:=Basins(L);|
  !gapprompt@gap>| !gapinput@Display(B);|
  
\end{Verbatim}
 

  }

 
\section{\textcolor{Chapter }{A third example of digital image segmentation}}\logpage{[ 5, 6, 0 ]}
\hyperdef{L}{X8290E7D287F69B98}{}
{
 The following image is number 3096 in the \href{https://www2.eecs.berkeley.edu/Research/Projects/CS/vision/bsds/} {BSDS500 database of images} \cite{MartinFTM01}. 

  

A common first step in segmenting such an image is to appropriately threshold
the corresponding gradient image. 

   

 The following commands use the thresholded gradient image to produce an
outline of the aeroplane. The outline is a pure cubical complex with one path
component and with first Betti number equal to 1. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=Filename(DirectoriesPackageLibrary("HAP"),"../tutorial/images/3096b.jpg");;|
  !gapprompt@gap>| !gapinput@F:=ReadImageAsFilteredPureCubicalComplex(file,30);;|
  !gapprompt@gap>| !gapinput@F:=ComplementOfFilteredPureCubicalComplex(F);;|
  !gapprompt@gap>| !gapinput@M:=FiltrationTerm(F,27);;  #Thickening chosen based on degree 0 barcode|
  !gapprompt@gap>| !gapinput@Display(M);;|
  !gapprompt@gap>| !gapinput@P:=List([1..BettiNumber(M,0)],n->PathComponentOfPureComplex(M,n));;|
  !gapprompt@gap>| !gapinput@P:=Filtered(P,m->Size(m)>10);;|
  !gapprompt@gap>| !gapinput@M:=P[1];;|
  !gapprompt@gap>| !gapinput@for m in P do|
  !gapprompt@>| !gapinput@M:=PureComplexUnion(M,m);;|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@T:=ThickeningFiltration(M,50);;|
  !gapprompt@gap>| !gapinput@BettiNumber(FiltrationTerm(T,11),0);|
  1
  !gapprompt@gap>| !gapinput@BettiNumber(FiltrationTerm(T,11),1);|
  1
  !gapprompt@gap>| !gapinput@BettiNumber(FiltrationTerm(T,12),1);|
  0
  !gapprompt@gap>| !gapinput@#Confirmation that 11-th filtration term has one hole and the 12-th term is contractible.|
  !gapprompt@gap>| !gapinput@C:=FiltrationTerm(T,11);;|
  !gapprompt@gap>| !gapinput@for n in Reversed([1..10]) do|
  !gapprompt@>| !gapinput@C:=ContractedComplex(C,FiltrationTerm(T,n));|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@C:=PureComplexBoundary(PureComplexThickened(C));;|
  !gapprompt@gap>| !gapinput@H:=HomotopyEquivalentMinimalPureCubicalSubcomplex(FiltrationTerm(T,12),C);;|
  !gapprompt@gap>| !gapinput@B:=ContractedComplex(PureComplexBoundary(H));;|
  !gapprompt@gap>| !gapinput@Display(B);|
  
\end{Verbatim}
  }

 
\section{\textcolor{Chapter }{Naive example of digital image contour extraction}}\logpage{[ 5, 7, 0 ]}
\hyperdef{L}{X7957F329835373E9}{}
{
 The following greyscale image is available from the \href{http://www.ipol.im/pub/art/2014/74/FrechetAndConnectedCompDemo.tgz} {online appendix} to the paper \cite{coeurjolly}. 

  

The following commands produce a picture of contours from this image based on
greyscale values. They also produce a picture of just the closed contours (the
non\texttt{\symbol{45}}closed contours having been homotopy collapsed to
points). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=Filename(DirectoriesPackageLibrary("HAP"),"../tutorial/images/circularGradient.png");;|
  !gapprompt@gap>| !gapinput@L:=[];;                                                          |
  !gapprompt@gap>| !gapinput@for n in [1..15] do|
  !gapprompt@>| !gapinput@M:=ReadImageAsPureCubicalComplex(file,n*30000);|
  !gapprompt@>| !gapinput@M:=PureComplexBoundary(M);;|
  !gapprompt@>| !gapinput@Add(L,M);|
  !gapprompt@>| !gapinput@od;;|
  !gapprompt@gap>| !gapinput@C:=L[1];;|
  !gapprompt@gap>| !gapinput@for n in [2..Length(L)] do C:=PureComplexUnion(C,L[n]); od;|
  !gapprompt@gap>| !gapinput@Display(C);|
  !gapprompt@gap>| !gapinput@Display(ContractedComplex(C));|
  
\end{Verbatim}
 Contours from the above greyscale image: 

  

 Closed contours from the above greyscale image: 

  

 Very similar results are obtained when applied to the file \texttt{circularGradientNoise.png}, containing noise, available from the \href{http://www.ipol.im/pub/art/2014/74/FrechetAndConnectedCompDemo.tgz} {online appendix} to the paper \cite{coeurjolly}. 

The number of distinct "light sources" in the image can be read from the
countours. Alternatively, this number can be read directly from the barcode
produced by the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=ReadImageAsFilteredPureCubicalComplex(file,20);;|
  !gapprompt@gap>| !gapinput@P:=PersistentBettiNumbersAlt(F,1);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P);|
  
\end{Verbatim}
 

  

 The seventeen bars in the barcode correspond to seventeen light sources. The
length of a bar is a measure of the "persistence" of the corresponding light
source. A long bar may initially represent a cluster of several lights whose
members may eventually be distinguished from each other as new bars (or
persistent homology classes) are created. 

Here the command \texttt{PersistentBettiNumbersAlt} has been used. This command is explained in the following section. 

The follwowing commands use a watershed method to partition the digital image
into regions, one region per light source. A makeshift function \texttt{Basins(L)}, available \href{tutex/basins.g} {here}, is called. (The efficiency of the example could be easily improved. For
simplicity it uses generic commands which, in principle, can be applied to
cubical or permutarhedral complexes of higher dimensions.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=Filename(DirectoriesPackageLibrary("HAP"),"../tutorial/images/circularGradient.png");;|
  !gapprompt@gap>| !gapinput@F:=ReadImageAsFilteredPureCubicalComplex(file,20);;|
  !gapprompt@gap>| !gapinput@FF:=ComplementOfFilteredPureCubicalComplex(F);|
  
  !gapprompt@gap>| !gapinput@W:=(FiltrationTerm(FF,3));|
  !gapprompt@gap>| !gapinput@for n in [4..23] do|
  !gapprompt@>| !gapinput@L:=[];;|
  !gapprompt@>| !gapinput@for i in [1..PathComponentOfPureComplex(W,0)] do|
  !gapprompt@>| !gapinput@ P:=PathComponentOfPureComplex(W,i);;|
  !gapprompt@>| !gapinput@ Q:=ThickeningFiltration(P,150,FiltrationTerm(FF,n));;|
  !gapprompt@>| !gapinput@ Add(L,Q);;|
  !gapprompt@>| !gapinput@od;;|
  !gapprompt@>| !gapinput@W:=Basins(L);|
  !gapprompt@>| !gapinput@od;|
  
  !gapprompt@gap>| !gapinput@C:=PureComplexComplement(W);;|
  !gapprompt@gap>| !gapinput@T:=PureComplexThickened(C);; C:=ContractedComplex(T,C);;  |
  !gapprompt@gap>| !gapinput@Display(C);|
  
\end{Verbatim}
 

  }

 
\section{\textcolor{Chapter }{Alternative approaches to computing persistent homology}}\label{secAltPersist}
\logpage{[ 5, 8, 0 ]}
\hyperdef{L}{X7D2CC9CB85DF1BAF}{}
{
 From any sequence $X_0 \subset X_1 \subset X_2 \subset \cdots \subset X_T$ of cellular spaces (such as pure cubical complexes, or cubical complexes, or
simplicial complexes, or regular CW complexes) we can construct a filtered
chain complex $C_\ast X_0 \subset C_\ast X_1 \subset C_\ast X_2 \subset \cdots C_\ast X_T$. The induced homology homomorphisms $H_n(C_\ast X_0,\mathbb F) \rightarrow H_n(C_\ast X_1,\mathbb F) \rightarrow
H_n(C_\ast X_2,\mathbb F) \rightarrow \cdots \rightarrow H_n(C_\ast
X_T,\mathbb F)$ with coefficients in a field $\mathbb F$ can be computed by applying an appropriate sequence of elementary row
operations to the boundary matrices in the chain complex $C_\ast X_T\otimes \mathbb F$; the boundary matrices are sparse and are best represented as such; the row
operations need to be applied in a fashion that respects the filtration. This
method is used in the above examples of persistent homology. The method is not
practical when the number of cells in $X_T$ is large. 

An alternative approach is to construct an admissible discrete vector field on
each term $X_k$ in the filtration. For each vector field there is a
non\texttt{\symbol{45}}regular CW\texttt{\symbol{45}}complex $Y_k$ whose cells correspond to the critical cells in $X_k$ and for which there is a homotopy equivalence $X_k\simeq Y_k$. For each $k$ the composite homomorphism $H_n(C_\ast Y_k, \mathbb F) \stackrel{\cong}{\rightarrow} H_n(C_\ast X_k,
\mathbb F) \rightarrow H_n(C_\ast X_{k+1}, \mathbb F)
\stackrel{\cong}{\rightarrow} H_n(C_\ast Y_{k+1}, \mathbb F)$ can be computed and the persistent homology can be derived from these homology
homomorphisms. This method is implemented in the function \texttt{PersistentBettiNUmbersAlt(X,n,p)} where $p$ is the characteristic of the field, $n$ is the homology degree, and $X$ can be a filtered pure cubical complex, or a filtered simplicial complex, or a
filtered regular CW complex, or indeed a filtered chain complex (represented
in sparse form). This function incorporates the functions \texttt{ContractedFilteredPureCubicalComplex(X)} and \texttt{ContractedFilteredRegularComplex(X)} which respectively input a filtered pure cubical complex and filtered regular
CW\texttt{\symbol{45}}complex and return a filtered complex of the same data
type in which each term of the output filtration is a deformation retract of
the corresponding term in the input filtration. 

In this approach the vector fields on the various spaces $X_k$ are completely independent and so the method lends itself to a degree of easy
parallelism. This is not incorporated into the current implementation. 

 As an illustration we consider a synthetic data set $S$ consisting of $3527$ points sampled, with errors, from an `unknown' manifold $M$ in $\mathbb R^3$. From such a data set one can associate a $3$\texttt{\symbol{45}}dimensional cubical complex $X_0$ consisting of one unit cube centred on each (suitably scaled) data point. A
visualization of $X_0$ is shown below. 

  

 Given a pure cubical complex $X_s$ we construct $X_{s+1} =X_s \cup \{\overline e^3_\lambda\}_{\lambda\in \Lambda}$ by adding to $X_s$ each closed unit cube $\overline e^3_\lambda$ in $\mathbb R^3$ that intersects non\texttt{\symbol{45}}trivially with $X_s$. We construct the filtered cubical complex $X_\ast =\{X_i\}_{0\le i\le 19}$ and compute the persistence matrices $\beta_d^{\ast\ast}$ for $d=0,1,2$ and for $\mathbb Z_2$ coefficients. The filtered complex $X_\ast$ is quite large. In particular, the final space $X_{19}$ in the filtration involves $1\,092727$ vertices, $3\,246354$ edges, $3\,214836$ faces of dimension $2$ and $1\,061208$ faces of dimension $3$. The usual matrix reduction approach to computing persistent Betti numbers
would involve an appropriate row reduction of sparse matrices one of which has
over 3 million rows and 3 million columns. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("data247.txt");;|
  !gapprompt@gap>| !gapinput@Read(file);;|
  !gapprompt@gap>| !gapinput@F:=ThickeningFiltration(T,20);;|
  !gapprompt@gap>| !gapinput@P:=PersistentBettiNumbersAlt(F,[0,1,2]);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P);|
  
\end{Verbatim}
  

The barcodes suggest that the data points might have been sampled from a
manifold with the homotopy type of a torus. 
\subsection{\textcolor{Chapter }{Non\texttt{\symbol{45}}trivial cup product}}\logpage{[ 5, 8, 1 ]}
\hyperdef{L}{X86FD0A867EC9E64F}{}
{
 Of course, a wedge $S^2\vee S^1\vee S^1$ has the same homology as the torus $S^1\times S^1$. By establishing that a 'noise free' model for our data points, say the
10\texttt{\symbol{45}}th term $X_{10}$ in the filtration, has a non\texttt{\symbol{45}}trivial cup product $\cup\colon H^1(X_{10},\mathbb Z) \times H^1(X_{10},\mathbb Z) \rightarrow
H^2(X_{10},\mathbb Z)$ we can eliminate $S^2\vee S^1\vee S^1$ as a candidate from which the data was sampled. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@X10:=RegularCWComplex(FiltrationTerm(F,10));;|
  !gapprompt@gap>| !gapinput@cup:=LowDimensionalCupProduct(X10);;|
  !gapprompt@gap>| !gapinput@cup([1,0],[0,1]);|
  [ 1 ]
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Explicit homology generators}}\logpage{[ 5, 8, 2 ]}
\hyperdef{L}{X783EF0F17B629C46}{}
{
 It could be desirable to obtain explicit representatives of the persistent
homology generators that "persist" through a significant sequence of
filtration terms. There are two such generators in degree $1$ and one such generator in degree $2$. The explicit representatives in degree $n$ could consist of an inclusion of pure cubical complexes $Y_n \subset X_{10}$ for which the incuced homology homomorphism $H_n(Y_n,\mathbb Z) \rightarrow H_n(X_{10},\mathbb Z)$ is an isomorphism, and for which $Y_n$ is minimal in the sense that its homotopy type changes if any one or more of
its top dimensional cells are removed. Ideally the space $Y_n$ should be "close to the original dataset" $X_0$. The following commands first construct an explicit degree $2$ homology generator representative $Y_2\subset X_{10}$ where $Y_2$ is homotopy equivalent to $X_{10}$. They then construct an explicit degree $1$ homology generators representative $Y_1\subset X_{10}$ where $Y_1$ is homotopy equivalent to a wedge of two circles. The final command displays
the homology generators representative $Y_1$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y2:=FiltrationTerm(F,10);;                   |
  !gapprompt@gap>| !gapinput@for t in Reversed([1..9]) do|
  !gapprompt@>| !gapinput@Y2:=ContractedComplex(Y2,FiltrationTerm(F,t));|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@Y2:=ContractedComplex(Y2);;|
  
  !gapprompt@gap>| !gapinput@Size(FiltrationTerm(F,10));|
  918881
  !gapprompt@gap>| !gapinput@Size(Y2);                  |
  61618
  
  !gapprompt@gap>| !gapinput@Y1:=PureComplexDifference(Y2,PureComplexRandomCell(Y2));;|
  !gapprompt@gap>| !gapinput@Y1:=ContractedComplex(Y1);;|
  !gapprompt@gap>| !gapinput@Size(Y1);|
  474
  !gapprompt@gap>| !gapinput@Display(Y1);|
  
\end{Verbatim}
 

  

 }

 }

 
\section{\textcolor{Chapter }{Knotted proteins}}\logpage{[ 5, 9, 0 ]}
\hyperdef{L}{X80D0D8EB7BCD05E9}{}
{
 The \href{https://www.rcsb.org/} {Protein Data Bank} contains a wealth of data which can be investigated with respect to
knottedness. Information on a particular protein can be downloaded as a .pdb
file. Each protein consists of one or more chains of amino acids and the file
gives 3\texttt{\symbol{45}}dimensional Euclidean coordinates of the atoms in
amino acids. Each amino acid has a unique "alpha carbon" atom (labelled as
"CA" in the pdb file). A simple 3\texttt{\symbol{45}}dimensional curve, the \emph{protein backbone}, can be constructed through the sequence of alpha carbon atoms. Typically the
ends of the protein backbone lie near the "surface" of the protein and can be
joined by a path outside of the protein to obtain a simple closed curve in
Euclidean 3\texttt{\symbol{45}}space. 

The following command reads in the pdb file for the T.thermophilus 1V2X
protein, which consists of a single chain of amino acids, and uses Asymptote
software to produce an interactive visualization of its backbone. A path
joining the end vertices of the backbone is displayed in blue. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("data1V2X.pdb");;|
  !gapprompt@gap>| !gapinput@DisplayPDBfile(file);|
  
\end{Verbatim}
 

   

The next command reads in the pdb file for the T.thermophilus 1V2X protein and
represents it as a $3$\texttt{\symbol{45}}dimensional pure cubical complex $K$. A resolution of $r=5$ is chosen and this results in a representation as a subcomplex $K$ of an ambient rectangular box of volume equal to $184\times 186\times 294$ unit cubes. The complex $K$ should have the homotopy type of a circle and the protein backbone is a
1\texttt{\symbol{45}}dimenional curve that should lie in $K$. The final command displays $K$. 
\begin{Verbatim}[commandchars=@|E,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>E @gapinput|r:=5;;E
  @gapprompt|gap>E @gapinput|K:=ReadPDBfileAsPureCubicalComplex(file,r);;      E
  @gapprompt|gap>E @gapinput|K:=ContractedComplex(K);;E
  @gapprompt|gap>E @gapinput|K!.properties;E
  [ [ "dimension", 3 ], [ "arraySize", [ 184, 186, 294 ] ] ]
  
  @gapprompt|gap>E @gapinput|Display(K);E
  
\end{Verbatim}
 

   

Next we create a filtered pure cubical complex by repeatedly thickening $K$. We perform $15$ thickenings, each thickening being a term in the filtration. The $\beta_1$ barcode for the filtration is displayed. This barcode is a descriptor for the
geometry of the protein. For current purposes it suffices to note that the
first few terms of the filtration have first homology equal to that of a
circle. This indicates that the Euclidean coordinates in the pdb file robustly
determine some knot. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=ThickeningFiltration(K,15);;|
  !gapprompt@gap>| !gapinput@F:=FilteredPureCubicalComplexToCubicalComplex(F);;|
  !gapprompt@gap>| !gapinput@F:=FilteredCubicalComplexToFilteredRegularCWComplex(F);;|
  !gapprompt@gap>| !gapinput@P:=PersistentBettiNumbersAlt(F,1);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P);|
  
\end{Verbatim}
 

  

 The next commands compute a presentation for the fundamental group $\pi_1(\mathbb R^3\setminus K)$ and the Alexander polynomial for the knot. This is the same Alexander
polynomial as for the trefoil knot. Also, Tietze transformations can be used
to see that the fundamental group is the same as for the trefoil knot. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@C:=PureComplexComplement(K);;|
  !gapprompt@gap>| !gapinput@C:=ContractedComplex(C);;|
  !gapprompt@gap>| !gapinput@G:=FundamentalGroup(C);;|
  !gapprompt@gap>| !gapinput@GeneratorsOfGroup(G);|
  [ f1, f2 ]
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(G);|
  [ f2*f1^-1*f2^-1*f1^-1*f2*f1 ]
  
  !gapprompt@gap>| !gapinput@AlexanderPolynomial(G);|
  x_1^2-x_1+1
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Random simplicial complexes}}\logpage{[ 5, 10, 0 ]}
\hyperdef{L}{X87AF06677F05C624}{}
{
 

For a positive integer $n$ and probability $p$ we denote by $Y(n,p)$ the \emph{Linial\texttt{\symbol{45}}Meshulam random simplicial
2\texttt{\symbol{45}}complex}. Its $1$\texttt{\symbol{45}}skeleton is the complete graph on $n$ vertices; each possible $2$\texttt{\symbol{45}}simplex is included independently with probability $p$. 

The following commands first compute the number $h_i$ of non\texttt{\symbol{45}}trivial cyclic summands in $H_i(Y(100,p), \mathbb Z)$ for a range of probabilities $p$ and $i=1,2$ and then produce a plot of $h_i$ versus $p$. The plot for $h_1$ is red and the plot for $h_2$ is blue. A plot for the Euler characteristic $1-h_1+h_2$ is shown in green. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=[];;M:=[];;|
  !gapprompt@gap>| !gapinput@for p in [1..100] do|
  !gapprompt@>| !gapinput@K:=RegularCWComplex(RandomSimplicialTwoComplex(100,p/1000));;|
  !gapprompt@>| !gapinput@h1:=Length(Homology(K,1));;|
  !gapprompt@>| !gapinput@h2:=Length(Homology(K,2));;|
  !gapprompt@>| !gapinput@Add(L, [1.0*(p/1000),h1,"red"]);|
  !gapprompt@>| !gapinput@Add(L, [1.0*(p/1000),h2,"blue"]);|
  !gapprompt@>| !gapinput@Add(M, [1.0*(p/1000),1-h1+h2,"green"]);|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@ScatterPlot(L);|
  !gapprompt@gap>| !gapinput@ScatterPlot(M);|
  
\end{Verbatim}
 

   

From this plot it seems that there is a \emph{phase change threshold} at around $p=0.025$. An inspection of the first homology groups $H_1(Y(100,p), \mathbb Z)$ shows that in most cases there is no torsion. However, around the threshold
some of the complexes do have torsion in their first homology. 

Similar commands for $Y(75,p)$ suggest a phase transition at around $p=0.035$ in this case. The following commands compute $H_1(Y(75,p), \mathbb Z)$ for $900$ random $2$\texttt{\symbol{45}}complexes with $p$ in a small interval around $ 0.035$ and, in each case where there is torsion, the torsion coefficients are stored
in a list. The final command prints these lists
\texttt{\symbol{45}}\texttt{\symbol{45}} all but one of which are of length $1$. For example, there is one $2$\texttt{\symbol{45}}dimensional simplicial complex on $75$ vertices whose first homology contains the summand $\mathbb Z_{107879661870516800665161182578823128}$. The largest prime factor is $80555235907994145009690263$ occuring in the summand $\mathbb Z_{259837760616287294231081766978855}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@torsion:=function(n,p)|
  !gapprompt@>| !gapinput@local H, Y;|
  !gapprompt@>| !gapinput@Y:=RegularCWComplex(RandomSimplicialTwoComplex(n,p));|
  !gapprompt@>| !gapinput@H:=Homology(Y,1);|
  !gapprompt@>| !gapinput@H:=Filtered(H,x->not x=0);|
  !gapprompt@>| !gapinput@return H;|
  !gapprompt@>| !gapinput@end;|
  function( n, p ) ... end
  
  
  !gapprompt@gap>| !gapinput@L:=[];;for n in [73000..73900] do|
  !gapprompt@>| !gapinput@t:=torsion(75,n/2000000);  |
  !gapprompt@>| !gapinput@if not t=[] then Add(L,t); fi;|
  !gapprompt@>| !gapinput@od;|
  
  !gapprompt@gap>| !gapinput@Display(L);|
  [ [                                     2 ],
    [                                    26 ],
    [     259837760616287294231081766978855 ],
    [                                     2 ],
    [                                     3 ],
    [                                     2 ],
    [          2761642698060127444812143568 ],
    [       2626355281010974663776273381976 ],
    [                                     2 ],
    [                                     3 ],
    [         33112382751264894819430785350 ],
    [                                    16 ],
    [                                     4 ],
    [                                     3 ],
    [                                     2 ],
    [                                     3 ],
    [                                     2 ],
    [      85234949999183888967763100590977 ],
    [                                     2 ],
    [      24644196130785821107897718662022 ],
    [                                     2,                                     2 ],
    [                                     2 ],
    [           416641662889025645492982468 ],
    [         41582773001875039168786970816 ],
    [                                     2 ],
    [            75889883165411088431747730 ],
    [         33523474091636554792305315165 ],
    [  107879661870516800665161182578823128 ],
    [          5588265814409119568341729980 ],
    [                                     2 ],
    [          5001457249224115878015053458 ],
    [                                    10 ],
    [                                    12 ],
    [                                     2 ],
    [                                     2 ],
    [                                     3 ],
    [          7757870243425246987971789322 ],
    [       8164648856993269673396613497412 ],
    [                                     2 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Computing homology of a clique complex (Vietoris\texttt{\symbol{45}}Rips
complex) }}\logpage{[ 5, 11, 0 ]}
\hyperdef{L}{X875EE92F7DBA1E27}{}
{
 Topological data analysis provides one motivation for wanting to compute the
homology of a clique complex. Consider for instance the cloud of data points
shown in Example \ref{pointcloud}. This data is a set $S$ of 400 points in the plane. Let $\Gamma$ be the graph with vertex set $S$ and with two vertices joined by an edge if they lie within a Euclidean
distance of 40 of each other. The clique complex $K=K(\Gamma)$ could be studied to see what it reveals about the data. The following commands
construct $K$ and show that it is a 23\texttt{\symbol{45}}dimensional simplicial complex
consisting of a total of 36191976 simplices. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("data134.txt");;                              |
  !gapprompt@gap>| !gapinput@Read(file);|
  !gapprompt@gap>| !gapinput@A:=VectorsToSymmetricMatrix(S,EuclideanApproximatedMetric);;|
  !gapprompt@gap>| !gapinput@threshold:=40;; |
  !gapprompt@gap>| !gapinput@grph:=SymmetricMatrixToGraph(A,threshold);;|
  !gapprompt@gap>| !gapinput@dimension_cap:=100;; |
  !gapprompt@gap>| !gapinput@K:=CliqueComplex(grph,dimension_cap);|
  Simplicial complex of dimension 23.
  
  !gapprompt@gap>| !gapinput@Size(K);|
  36191976
  
\end{Verbatim}
 

 The computation of the homology of this clique complex $K$ is a challenge because of its size. If we are only interested in $K$ up to homotopy then we could try to modify the graph $\Gamma$ in such a way that the homotopy type of the clique complex is unchanged but
the size of the clique complex is reduced. This is done in the following
commands, producing a smaller $19$\texttt{\symbol{45}}dimensional simplicial complex $K$ with 4180652 simplices. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ContractGraph(grph);;|
  
  !gapprompt@gap>| !gapinput@dimension_cap:=100;; |
  !gapprompt@gap>| !gapinput@K:=CliqueComplex(grph,dimension_cap);|
  Simplicial complex of dimension 19.
  
  !gapprompt@gap>| !gapinput@Size(K);|
  4180652
  
\end{Verbatim}
 

To compute the homology of $K$ in degrees $0$ to $5$ say, we could represent $K$ as a regular CW\texttt{\symbol{45}}complex $Y$ and then compute the homology of $Y$ as follows. The homology $H_n(K)=\mathbb Z$ for $n=0,1$ and $H_n(K)= 0$ for $n=2,3,4,5$ is consistent with the data having been sampled from a space with the homotopy
type of a circle. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=RegularCWComplex(K);|
  Regular CW-complex of dimension 19
  
  !gapprompt@gap>| !gapinput@Homology(Y,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(Y,1);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(Y,2);|
  [  ]
  !gapprompt@gap>| !gapinput@Homology(Y,3);|
  [  ]
  !gapprompt@gap>| !gapinput@Homology(Y,4);|
  [  ]
  !gapprompt@gap>| !gapinput@Homology(Y,5)|
  [  ]
  
\end{Verbatim}
 }

 }

 
\chapter{\textcolor{Chapter }{Group theoretic computations}}\logpage{[ 6, 0, 0 ]}
\hyperdef{L}{X7C07F4BD8466991A}{}
{
 
\section{\textcolor{Chapter }{Third homotopy group of a supsension of an
Eilenberg\texttt{\symbol{45}}MacLane space }}\logpage{[ 6, 1, 0 ]}
\hyperdef{L}{X86D7FBBD7E5287C9}{}
{
 

The following example uses the nonabelian tensor square of groups to compute
the third homotopy group 

$\pi_3(S(K(G,1))) = \mathbb Z^{30}$ 

of the suspension of the Eigenberg\texttt{\symbol{45}}MacLane space $K(G,1)$ for $G$ the free nilpotent group of class $2$ on four generators. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FreeGroup(4);;G:=NilpotentQuotient(F,2);;|
  !gapprompt@gap>| !gapinput@ThirdHomotopyGroupOfSuspensionB(G);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Representations of knot quandles}}\logpage{[ 6, 2, 0 ]}
\hyperdef{L}{X803FDFFE78A08446}{}
{
 

 The following example constructs the finitely presented quandles associated to
the granny knot and square knot, and then computes the number of quandle
homomorphisms from these two finitely prresented quandles to the $17$\texttt{\symbol{45}}th quandle in \textsc{HAP}'s library of connected quandles of order $24$. The number of homomorphisms differs between the two cases. The computation
therefore establishes that the complement in $\mathbb R^3$ of the granny knot is not homeomorphic to the complement of the square knot. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=ConnectedQuandle(24,17,"import");;|
  !gapprompt@gap>| !gapinput@K:=PureCubicalKnot(3,1);;|
  !gapprompt@gap>| !gapinput@L:=ReflectedCubicalKnot(K);;|
  !gapprompt@gap>| !gapinput@square:=KnotSum(K,L);;|
  !gapprompt@gap>| !gapinput@granny:=KnotSum(K,K);;|
  !gapprompt@gap>| !gapinput@gcsquare:=GaussCodeOfPureCubicalKnot(square);;|
  !gapprompt@gap>| !gapinput@gcgranny:=GaussCodeOfPureCubicalKnot(granny);;|
  !gapprompt@gap>| !gapinput@Qsquare:=PresentationKnotQuandle(gcsquare);;|
  !gapprompt@gap>| !gapinput@Qgranny:=PresentationKnotQuandle(gcgranny);;|
  !gapprompt@gap>| !gapinput@NumberOfHomomorphisms(Qsquare,Q);|
  408
  !gapprompt@gap>| !gapinput@NumberOfHomomorphisms(Qgranny,Q);|
  24
  
\end{Verbatim}
 

 The following commands compute a knot quandle directly from a pdf file
containing the following hand\texttt{\symbol{45}}drawn image of the knot. 

  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ gc:=ReadLinkImageAsGaussCode("myknot.pdf");|
  [ [ [ -2, 4, -1, 3, -3, 2, -4, 1 ] ], [ -1, -1, 1, -1 ] ]
  !gapprompt@gap>| !gapinput@Q:=PresentationKnotQuandle(gc);|
  Quandle presentation of 4 generators and 4 relators.
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Identifying knots}}\logpage{[ 6, 3, 0 ]}
\hyperdef{L}{X7E4EFB987DA22017}{}
{
 Low index subgrops of the knot group can be used to identify knots with few
crossings. For instance, the following commands read in the following image of
a knot and identify it as a sum of two trefoils. The commands determine the
prime components only up to reflection, and so they don't distinguish between
the granny and square knots. 

  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gc:=ReadLinkImageAsGaussCode("myknot2.png");|
  [ [ [ -4, 7, -5, 4, -7, 5, -3, 6, -2, 3, 8, -8, -6, 2, 1, -1 ] ], 
    [ 1, -1, -1, -1, -1, -1, -1, 1 ] ]
  !gapprompt@gap>| !gapinput@IdentifyKnot(gc);;|
  PrimeKnot(3,1) + PrimeKnot(3,1)    modulo reflections of components. 
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Aspherical $2$\texttt{\symbol{45}}complexes}}\logpage{[ 6, 4, 0 ]}
\hyperdef{L}{X8664E986873195E6}{}
{
 

The following example uses Polymake's linear programming routines to establish
that the $2$\texttt{\symbol{45}}complex associated to the group presentation $<x,y,z : xyx=yxy,\, yzy=zyz,\, xzx=zxz>$ is aspherical (that is, has contractible universal cover). The presentation is
Tietze equivalent to the presentation used in the computer code, and the
associated $2$\texttt{\symbol{45}}complexes are thus homotopy equivalent. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FreeGroup(6);;|
  !gapprompt@gap>| !gapinput@x:=F.1;;y:=F.2;;z:=F.3;;a:=F.4;;b:=F.5;;c:=F.6;;|
  !gapprompt@gap>| !gapinput@rels:=[a^-1*x*y, b^-1*y*z, c^-1*z*x, a*x*(y*a)^-1,|
  !gapprompt@>| !gapinput@   b*y*(z*b)^-1, c*z*(x*c)^-1];;|
  !gapprompt@gap>| !gapinput@Print(IsAspherical(F,rels),"\n");|
  Presentation is aspherical.
  
  true
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Group presentations and homotopical syzygies}}\logpage{[ 6, 5, 0 ]}
\hyperdef{L}{X84C0CB8B7C21E179}{}
{
 Free resolutons for a group $G$ are constructed in \textsc{HAP} as the cellular chain complex $R_\ast=C_\ast(\tilde X)$ of the universal cover of some CW\texttt{\symbol{45}}complex $X=K(G,1)$. The $2$\texttt{\symbol{45}}skeleton of $X$ gives rise to a free presentation for the group $G$. This presentation depends on a choice of maximal tree in the $1$\texttt{\symbol{45}}skeleton of $X$ in cases where $X$ has more than one $0$\texttt{\symbol{45}}cell. The attaching maps of $3$\texttt{\symbol{45}}cells in $X$ can be regarded as \emph{homotopical syzygies} or van Kampen diagrams over the group presentation whose boundaries spell the
trivial word. 

The following example constructs four terms of a resolution for the free
abelian group $G$ on $n=3$ generators, and then extracts the group presentation from the resolution as
well as the unique homotopical syzygy. The syzygy is visualized in terms of
its graph of edges, directed edges being coloured according to the
corresponding group generator. (In this example the
CW\texttt{\symbol{45}}complex $\tilde X$ is regular, but in cases where it is not the visualization may be a quotient
of the $1$\texttt{\symbol{45}}skeleton of the syzygy.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@n:=3;;c:=1;;|
  !gapprompt@gap>| !gapinput@G:=Image(NqEpimorphismNilpotentQuotient(FreeGroup(n),c));;|
  !gapprompt@gap>| !gapinput@R:=ResolutionNilpotentGroup(G,4);;|
  !gapprompt@gap>| !gapinput@P:=PresentationOfResolution(R);;|
  !gapprompt@gap>| !gapinput@P.freeGroup;|
  <free group on the generators [ x, y, z ]>
  !gapprompt@gap>| !gapinput@P.relators;|
  [ y^-1*x^-1*y*x, z^-1*x^-1*z*x, z^-1*y^-1*z*y ]
  !gapprompt@gap>| !gapinput@IdentityAmongRelatorsDisplay(R,1);|
  
\end{Verbatim}
 

  

 This homotopical syzygy represents a relationship between the three relators $[x,y]$, $[x,z]$ and $[y,z]$ where $[x,y]=xyx^{-1}y^{-1}$. The syzygy can be thought of as a geometric relationship between commutators
corresponding to the well\texttt{\symbol{45}}known
Hall\texttt{\symbol{45}}Witt identity: 

$ [\ [x,y],\ {^yz}\ ]\ \ [\ [y,z],\ {^zx}\ ]\ \ [\ [z,x],\ {^xy}\ ]\ \ =\ \ 1\ \
.$ 

The homotopical syzygy is special since in this example the edge directions
and labels can be understood as specifying three homeomorphisms between pairs
of faces. Viewing the syzygy as the boundary of the $3$\texttt{\symbol{45}}ball, by using the homeomorphisms to identify the faces in
each face pair we obtain a quotient CW\texttt{\symbol{45}}complex $M$ involving one vertex, three edges, three $2$\texttt{\symbol{45}}cells and one $3$\texttt{\symbol{45}}cell. The cell structure on the quotient exists because,
under the restrictions of homomorphisms to the edges, any cycle of edges
retricts to the identity map on any given edge. The following result tells us
that $M$ is in fact a closed oriented compact $3$\texttt{\symbol{45}}manifold. 

\textsc{Theorem.} [Seifert u. Threlfall, Topologie, p.208] \emph{Let $S^2$ denote the boundary of the $3$\texttt{\symbol{45}}ball $B^3$ and suppose that the sphere $S^2$ is given a regular CW\texttt{\symbol{45}}structure in which the faces are
partitioned into a collection of face pairs. Suppose that for each face pair
there is an orientation reversing homeomorphism between the two faces that
sends edges to edges and vertices to vertices. Suppose that by using these
homeomorphisms to identity face pairs we obtain a (not necessarily regular)
CW\texttt{\symbol{45}}structure on the quotient $M$. Then $M$ is a closed compact orientable manifold if and only if its Euler
characteristic is $\chi(M)=0$.} 

The next commands construct a presentation and associated unique homotopical
syzygy for the free nilpotent group of class $c=2$ on $n=2$ generators. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@n:=2;;c:=2;;|
  !gapprompt@gap>| !gapinput@G:=Image(NqEpimorphismNilpotentQuotient(FreeGroup(n),c));;|
  !gapprompt@gap>| !gapinput@R:=ResolutionNilpotentGroup(G,4);;|
  !gapprompt@gap>| !gapinput@P:=PresentationOfResolution(R);;|
  !gapprompt@gap>| !gapinput@P.freeGroup;|
  <free group on the generators [ x, y, z ]>
  !gapprompt@gap>| !gapinput@P.relators;|
  [ z*x*y*x^-1*y^-1, z*x*z^-1*x^-1, z*y*z^-1*y^-1 ]
  !gapprompt@gap>| !gapinput@IdentityAmongRelatorsDisplay(R,1);|
  
\end{Verbatim}
 

  

The syzygy represents the following relationship between commutators (in a
free group). 

$ [\ [x^{-1},y][x,y]\ ,\ [y,x][y^{-1},x]y^{-1}\ ]\ [\ [y,x][y^{-1},x]\ , \
x^{-1} \ ] \ \ =\ \ 1$ 

 Again, using the theorem of Seifert and Threlfall we see that the free
nilpotent group of class two on two generators arises as the fundamental group
of a closed compact orientable $3$\texttt{\symbol{45}}manifold $M$. }

 
\section{\textcolor{Chapter }{Bogomolov multiplier}}\logpage{[ 6, 6, 0 ]}
\hyperdef{L}{X7F719758856A443D}{}
{
 

The Bogomolov multiplier of a group is an isoclinism invariant. Using this
property, the following example shows that there are precisely three groups of
order $243$ with non\texttt{\symbol{45}}trivial Bogomolov multiplier. The groups in
question are numbered 28, 29 and 30 in \textsc{GAP}'s library of small groups of order $243$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=AllSmallGroups(3^5);;|
  !gapprompt@gap>| !gapinput@C:=IsoclinismClasses(L);;|
  !gapprompt@gap>| !gapinput@for c in C do|
  !gapprompt@>| !gapinput@if Length(BogomolovMultiplier(c[1]))>0 then|
  !gapprompt@>| !gapinput@Print(List(c,g->IdGroup(g)),"\n\n\n"); fi;|
  !gapprompt@>| !gapinput@od;|
  [ [ 243, 28 ], [ 243, 29 ], [ 243, 30 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Second group cohomology and group extensions}}\label{secExtensions}
\logpage{[ 6, 7, 0 ]}
\hyperdef{L}{X8333413B838D787D}{}
{
 Any group extension $N\rightarrowtail E \twoheadrightarrow G$ gives rise to: 
\begin{itemize}
\item  an outer action $\alpha\colon G\rightarrow Out(N)$ of $G$ on $N$.
\item an action $G\rightarrow Aut(Z(N))$ of $G$ on the centre of $N$, uniquely induced by the outer action $\alpha$ and the canonical action of $Out(N)$ on $Z(N)$.
\item a "$2$\texttt{\symbol{45}}cocycle" $f\colon G\times G\rightarrow N$. 
\end{itemize}
 

Any outer homomorphism $\alpha\colon G\rightarrow Out(N)$ gives rise to a cohomology class $k$ in $H^3(G,Z(N))$. It was shown by Eilenberg and Mac$\,$Lane that the class $k$ is trivial if and only if the outer action $\alpha$ arises from some group extension $N\rightarrowtail E\twoheadrightarrow G$. If $k$ is trivial then there is a (non\texttt{\symbol{45}}canonical) bijection
between the second cohomology group $H^2(G,Z(N))$ and Yoneda equivalence classes of extensions of $G$ by $N$ that are compatible with $\alpha$. 

\textsc{First Example.} 

 Consider the group $H=SmallGroup(64,134)$. Consider the normal subgroup $N=NormalSubgroups(G)[15]$ and quotient group $G=H/N$. We have $N=C_2\times D_4$, $A=Z(N)=C_2\times C_2$ and $G=C_2\times C_2$. 

 Suppose we wish to classify all extensions $C_2\times D_4 \rightarrowtail E \twoheadrightarrow C_2\times C_2$ that induce the given outer action of $G$ on $N$. The following commands show that, up to Yoneda equivalence, there are two
such extensions. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@H:=SmallGroup(64,134);;|
  !gapprompt@gap>| !gapinput@N:=NormalSubgroups(H)[15];;|
  !gapprompt@gap>| !gapinput@A:=Centre(GOuterGroup(H,N));;|
  !gapprompt@gap>| !gapinput@G:=ActingGroup(A);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(G,3);;|
  !gapprompt@gap>| !gapinput@C:=HomToGModule(R,A);;|
  !gapprompt@gap>| !gapinput@Cohomology(C,2);|
  [ 2 ]
  
\end{Verbatim}
 

The following additional commands return a standard $2$\texttt{\symbol{45}}cocycle $f:G\times G\rightarrow A =C_2\times C_2$ corresponding to the non\texttt{\symbol{45}}trivial element in $H^2(G,A)$. The value $f(g,h)$ of the $2$\texttt{\symbol{45}}cocycle is calculated for all $16$ pairs $g,h \in G$. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|CH:=CohomologyModule(C,2);;B
  @gapprompt|gap>B @gapinput|Elts:=Elements(ActedGroup(CH));B
  [ <identity> of ..., f1 ]
  
  @gapprompt|gap>B @gapinput|x:=Elts[2];;B
  @gapprompt|gap>B @gapinput|c:=CH!.representativeCocycle(x);B
  Standard 2-cocycle 
  
  @gapprompt|gap>B @gapinput|f:=Mapping(c);;B
  @gapprompt|gap>B @gapinput|for g in G do for h in G doB
  @gapprompt|>B @gapinput|Print(f(g,h),"\n");B
  @gapprompt|>B @gapinput|od;B
  @gapprompt|>B @gapinput|od;B
  <identity> of ...
  <identity> of ...
  <identity> of ...
  <identity> of ...
  <identity> of ...
  f6
  <identity> of ...
  f6
  <identity> of ...
  <identity> of ...
  <identity> of ...
  <identity> of ...
  <identity> of ...
  f6
  <identity> of ...
  f6
  
\end{Verbatim}
 

The following commands will then construct and identify all extensions of $N$ by $G$ corresponding to the given outer action of $G$ on $N$. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|H := SmallGroup(64,134);;B
  @gapprompt|gap>B @gapinput|N := NormalSubgroups(H)[15];;B
  @gapprompt|gap>B @gapinput|ON := GOuterGroup(H,N);;B
  @gapprompt|gap>B @gapinput|A := Centre(ON);;B
  @gapprompt|gap>B @gapinput|G:=ActingGroup(A);;B
  @gapprompt|gap>B @gapinput|R:=ResolutionFiniteGroup(G,3);;B
  @gapprompt|gap>B @gapinput|C:=HomToGModule(R,A);;B
  @gapprompt|gap>B @gapinput|CH:=CohomologyModule(C,2);;B
  @gapprompt|gap>B @gapinput|Elts:=Elements(ActedGroup(CH));;B
  
  @gapprompt|gap>B @gapinput|lst := List(Elts{[1..Length(Elts)]},x->CH!.representativeCocycle(x));;B
  @gapprompt|gap>B @gapinput|ccgrps := List(lst, x->CcGroup(ON, x));;B
  @gapprompt|gap>B @gapinput|#So ccgrps is a list of groups, each being an extension of G by N, correspondingB
  @gapprompt|gap>B @gapinput|#to the two elements in H^2(G,A).B
  
  @gapprompt|gap>B @gapinput|#The following command produces the GAP identification number for each group.B
  @gapprompt|gap>B @gapinput|L:=List(ccgrps,IdGroup);B
  [ [ 64, 134 ], [ 64, 135 ] ]
  
\end{Verbatim}
 

\textsc{Second Example} 

The following example illustrates how to construct a cohomology class $k$ in $H^2(G, A)$ from a cocycle $f:G \times G \rightarrow A$, where $G=SL_2(\mathbb Z_4)$ and $A=\mathbb Z_8$ with trivial action. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|#We'll construct G=SL(2,Z_4) as a permutation group.B
  @gapprompt|gap>B @gapinput|G:=SL(2,ZmodnZ(4));;B
  @gapprompt|gap>B @gapinput|G:=Image(IsomorphismPermGroup(G));;B
  
  @gapprompt|gap>B @gapinput|#We'll construct Z_8=Z/8Z as a G-outer groupB
  @gapprompt|gap>B @gapinput|z_8:=Group((1,2,3,4,5,6,7,8));;B
  @gapprompt|gap>B @gapinput|Z_8:=TrivialGModuleAsGOuterGroup(G,z_8);;B
  
  @gapprompt|gap>B @gapinput|#We'll compute the group h=H^2(G,Z_8)B
  @gapprompt|gap>B @gapinput|R:=ResolutionFiniteGroup(G,3);;  #R is a free resolutionB
  @gapprompt|gap>B @gapinput|C:=HomToGModule(R,Z_8);; # C is a chain complexB
  @gapprompt|gap>B @gapinput|H:=CohomologyModule(C,2);; #H is the second cohomology H^2(G,Z_8)B
  @gapprompt|gap>B @gapinput|h:=ActedGroup(H);; #h is the underlying group of HB
  
  @gapprompt|gap>B @gapinput|#We'll compute  cocycles c2, c5 for the second and fifth cohomology classsB
  @gapprompt|gap>B @gapinput|c2:=H!.representativeCocycle(Elements(h)[2]);B
  Standard 2-cocycle 
  
  @gapprompt|gap>B @gapinput|c5:=H!.representativeCocycle(Elements(h)[5]);B
  Standard 2-cocycle 
  
  @gapprompt|gap>B @gapinput|#Now we'll construct the cohomology classes C2, C5 in the group h corresponding to the cocycles c2, c5.B
  @gapprompt|gap>B @gapinput|C2:=CohomologyClass(H,c2);;B
  @gapprompt|gap>B @gapinput|C5:=CohomologyClass(H,c5);;B
   
  @gapprompt|gap>B @gapinput|#Finally, we'll show that C2, C5 are distinct cohomology classes, both of order 4.B
  @gapprompt|gap>B @gapinput|C2=C5;B
  false
  @gapprompt|gap>B @gapinput|Order(C2);B
  4
  @gapprompt|gap>B @gapinput|Order(C5);B
  4
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cocyclic groups: a convenient way of representing certain groups}}\label{secCocyclic}
\logpage{[ 6, 8, 0 ]}
\hyperdef{L}{X7F04FA5E81FFA848}{}
{
 \textsc{GAP} offers a number of data types for representing groups, including those of
fp\texttt{\symbol{45}}groups (\emph{finitely presented groups}), pc\texttt{\symbol{45}}groups (\emph{power\texttt{\symbol{45}}conjugate presentated groups} for finite polycyclic groups), pcp\texttt{\symbol{45}}groups (\emph{polycyclically presented groups} for finite and infinite polycyclic groups), permutation groups (for finite
groups), and matrix groups over a field or ring. Each data type has its
advantages and limitations. 

 Based on the definitions and examples in Section \ref{secExtensions} the additional data type of a cc\texttt{\symbol{45}}group (\emph{cocyclic group}) is provided in \textsc{HAP}. This can be used for a group $E$ arising as a group extension $N\rightarrowtail E \twoheadrightarrow G$ and is a component object involving: 
\begin{itemize}
\item \texttt{E!.Base} consisting of some representation of a group $G$.
\item \texttt{E!.Fibre} consisting of some representation of a group $N$.
\item \texttt{E!.OuterGroup} consisting of an outer action $\alpha\colon G\rightarrow Out(N)$ of $G$ on $N$.
\item \texttt{E!.Cocycle} consisting of a "$2$\texttt{\symbol{45}}cocycle" $f\colon G\times G\rightarrow N$.
\end{itemize}
 

The first example in Section \ref{secExtensions} illustrates the construction of cc\texttt{\symbol{45}}groups for which both
the base $G$ and fibre $N$ are finite pc\texttt{\symbol{45}}groups. That example extends to any scenario
in which the base $G$ is a group for which: 
\begin{enumerate}
\item we can construct the first 3 degrees of a free $\mathbb ZG$\texttt{\symbol{45}}resolution $C_\ast X$.
\item we can construct the first 2 terms of a contracting homotopy $h_i\colon C_nX\rightarrow C_{n+1}X $ for $i=0,1$. 
\item $N$ is a group in which we can multiply elements effectively and for which we can
determine the centre $Z(N)$ and outer automorphism group $Out(N)$. 
\end{enumerate}
 

 As an illustration where the base group is a non\texttt{\symbol{45}}solvable
finite group and the fibre is the infinite cyclic group, with base group
acting trivially on the fibre, the following commands list up to Yoneda
equivalence all central extensions $\mathbb Z \rightarrowtail E \twoheadrightarrow G$ for $G=A_5:C_{16}$. The base group is a non\texttt{\symbol{45}}solvable
semi\texttt{\symbol{45}}direct product of order $960$ and thus none of the $16$ extensions are polycyclic. The commands classify the extensions according to
their integral homology in degrees $ \le 2$, showing that there are precisely 5 such equivalence classes of extensions.
Thus, there are at least 5 distinct isomorphism types among the $16$ extensions. A presentation is constructed for the group corresponding to the
sixteenth extension. The final command lists the orders of the 16 cohomology
group elements corresponding to the 16 extensions. The 16th element has order
1, meaning that the sixteenth extension is the direct product $C_\infty\ \times\ A_5:C_{16}$. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|G:=SmallGroup(960,637);;B
  @gapprompt|gap>B @gapinput|StructureDescription(G);B
  "A5 : C16"
  
  @gapprompt|gap>B @gapinput|N:=AbelianPcpGroup([0]);;B
  @gapprompt|gap>B @gapinput|N:=TrivialGModuleAsGOuterGroup(G,N);;B
  @gapprompt|gap>B @gapinput|R:=ResolutionFiniteGroup(G,3);;B
  @gapprompt|gap>B @gapinput|C:=HomToGModule(R,N);;B
  @gapprompt|gap>B @gapinput|CH:=CohomologyModule(C,2);;B
  @gapprompt|gap>B @gapinput|Elts:=Elements(ActedGroup(CH));;B
  @gapprompt|gap>B @gapinput|lst := List(Elts{[1..Length(Elts)]},x->CH!.representativeCocycle(x));;B
  @gapprompt|gap>B @gapinput|ccgrps := List(lst, x->CcGroup(N, x));;B
  
  @gapprompt|gap>B @gapinput|inv:=function(gg)B
  @gapprompt|>B @gapinput|local T;B
  @gapprompt|>B @gapinput|T:=ResolutionInfiniteCcGroup(gg,3);B
  @gapprompt|>B @gapinput|return List([1..2],i->Homology(TensorWithIntegers(T),i));B
  @gapprompt|>B @gapinput|end;;B
  
  @gapprompt|gap>B @gapinput|EquivClasses:=Classify(ccgrps,inv);B
   [ <Cc-group of Size infinity>, <Cc-group of Size infinity>, 
        <Cc-group of Size infinity>, <Cc-group of Size infinity>, 
        <Cc-group of Size infinity>, <Cc-group of Size infinity>, 
        <Cc-group of Size infinity>, <Cc-group of Size infinity> ], 
    [ <Cc-group of Size infinity>, <Cc-group of Size infinity>, 
        <Cc-group of Size infinity>, <Cc-group of Size infinity> ], 
    [ <Cc-group of Size infinity>, <Cc-group of Size infinity> ], 
    [ <Cc-group of Size infinity> ], [ <Cc-group of Size infinity> ] ]
  @gapprompt|gap>B @gapinput|List(EquivClasses,Size);B
  [ 8, 4, 2, 1, 1 ]
  
  @gapprompt|gap>B @gapinput|F16:=Image(IsomorphismFpGroup(ccgrps[16]));B
  <fp group on the generators [ x, y, z, w, v ]>
  @gapprompt|gap>B @gapinput|RelatorsOfFpGroup(F16);B
  [ (x^2*y*z*w*z*y)^3*x^2*(y*x*w*y^2*z*x*y*z*y)^3*y*x*w*y^2*z*x*y^2*z*w*y^2*z*y,
    x*y^-2*w^-1*z^-1*y^-1*x^-1*y, x*z^-1*y^-1*z^-1*w^-1*z^-1*y^-1*x^-1*z, 
    x*y^-2*z^-1*w^-1*z^-1*y^-1*x^-1*w, z^-2, w^-2, y^-3, w*y^-1*w^-1*y^-1, 
    w*z*w^-1*z^-1*w^-1*z, z*y^2*(z^-1*y^-1)^2, v^-1*x^-1*v*x, v*y*v^-1*y^-1, 
    v*z*v^-1*z^-1, v*w*v^-1*w^-1 ]
  
  @gapprompt|gap>B @gapinput|List(Elts,Order);B
  [ 16, 16, 16, 16, 16, 16, 16, 16, 8, 8, 8, 8, 4, 4, 2, 1 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Effective group presentations}}\logpage{[ 6, 9, 0 ]}
\hyperdef{L}{X863080FE8270468D}{}
{
 For any free $\mathbb ZG$\texttt{\symbol{45}}resolution $R_\ast=C_\ast X$ arising as the cellular chain complex of a contractible
CW\texttt{\symbol{45}}complex, the terms in degrees $\le 2$ correspond to a free presentation for the group $G$. The following example accesses this presentation for the group $PGL_3(\mathbb Z[\sqrt{-1}])$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=ContractibleGcomplex("PGL(3,Z[i])");;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(K,2);;|
  !gapprompt@gap>| !gapinput@P:=PresentationOfResolution(R);;|
  !gapprompt@gap>| !gapinput@G:=P.freeGroup/P.relators;|
  <fp group on the generators [ v, w, x, y, z ]>
  !gapprompt@gap>| !gapinput@P.relators;|
  [ v^2, w^-1*v*w*v^-1, w^-1*v^-1*w^-1, (x^-1*w)^3, (y^-1*w)^3, (z^-1*w)^4, 
    y^-1*v^-1*z*y^-1*x, y^-1*v*x*v^-1*x*v, v^-1*z*v^-1*x*y, v^-1*x*v*y*v*x*v*y, 
    x^3, x*z*y, y^-1*v^-1*y^2*v*y^-1, (v*y)^4, z^-1*y*v*z^-1, (v*y*z)^2, 
    v^-1*(z*v)^2*z ]
  
\end{Verbatim}
 

 The homomorphism $h_0\colon R_0 \rightarrow R_1$ of a contracting homotopy provides a unique expression for each element of $G$ as a word in the free generators. To illustrate this, we consider the Sylow $2$\texttt{\symbol{45}}subgroup $H=Syl_2(M_{24})$ of the Mathieu group $M_{24}$. We obtain a resolution $R_\ast$ for $H$ by recursively applying perturbation techniques to a composition series for $H$. Such a resolution will yield a "kind of" power\texttt{\symbol{45}}conjugate
presentation for $H$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@H:=SylowSubgroup(MathieuGroup(24),2);|
  <permutation group of size 1024 with 10 generators>
  !gapprompt@gap>| !gapinput@Order(H);|
  1024
  !gapprompt@gap>| !gapinput@C:=CompositionSeries(H);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionSubnormalSeries(C,2);;|
  !gapprompt@gap>| !gapinput@P:=PresentationOfResolution(R);;|
  !gapprompt@gap>| !gapinput@P.freeGroup/P.relators;|
  <fp group on the generators [ q, r, s, t, u, v, w, x, y, z ]>
  !gapprompt@gap>| !gapinput@P.relators;|
  [ q^-2*z*y*x*w*v, q*r^-1*q^-1*y*u*r, s*q*s^-1*q^-1, t*q*t^-1*q^-1, 
    q*u^-1*q^-1*y*v*u, y*q*v^-1*q^-1, q*w^-1*q^-1*z*x, w*q*x^-1*q^-1, 
    q*y^-1*q^-1*z*v, z*q*z^-1*q^-1, r^-2, t*r*s^-1*r^-1, s*r*t^-1*r^-1, 
    u*r*u^-1*r^-1, v*r*v^-1*r^-1, r*w^-1*r^-1*y*w*u, r*x^-1*r^-1*y*x*u, 
    y*r*y^-1*r^-1, z*r*z^-1*r^-1, s^-2, t*s*t^-1*s^-1, x*s*u^-1*s^-1, 
    s*v^-1*s^-1*z*y*w*u, s*w^-1*s^-1*y*v*u, u*s*x^-1*s^-1, s*y^-1*s^-1*y*x*u, 
    z*s*z^-1*s^-1, t^-2, t*u^-1*t^-1*y*x*u, t*v^-1*t^-1*z*w, t*w^-1*t^-1*z*v, 
    y*t*x^-1*t^-1, x*t*y^-1*t^-1, z*t*z^-1*t^-1, u^-2, v*u*v^-1*u^-1, 
    u*w^-1*u^-1*z*w, x*u*x^-1*u^-1, y*u*y^-1*u^-1, z*u*z^-1*u^-1, v^-2, 
    w*v*w^-1*v^-1, v*x^-1*v^-1*z*x, y*v*y^-1*v^-1, z*v*z^-1*v^-1, w^-2, 
    x*w*x^-1*w^-1, w*y^-1*w^-1*z*y, z*w*z^-1*w^-1, x^-2, y*x*y^-1*x^-1, 
    z*x*z^-1*x^-1, y^-2, z*y*z^-1*y^-1, z^-2 ]
  
\end{Verbatim}
 

 The following additional commands use the contracting homotopy homomorphism $h_0\colon R_0\rightarrow R_1$ to express some random elements of $H$ as words in the free generators. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@g:=Random(H);|
  (1,6)(2,3)(4,9)(5,16)(7,10)(8,21)(11,18)(12,17)(13,19)(14,20)(15,22)(23,24)
  !gapprompt@gap>| !gapinput@P.wordInFreeGenerators(g);|
  q^-1*t^-1*x^-1*y^-1
  !gapprompt@gap>| !gapinput@|
  !gapprompt@gap>| !gapinput@g:=Random(H);|
  (1,6)(2,23,10,18)(3,22,19,24)(4,11,15,9)(7,8,21,13)(12,14)
  !gapprompt@gap>| !gapinput@P.wordInFreeGenerators(g);|
  q^-1*u^-1*w^-1*x^-1*z^-1
  !gapprompt@gap>| !gapinput@|
  !gapprompt@gap>| !gapinput@g:=Random(H);|
  (1,14,5,17)(2,7,9,19)(3,11,4,22)(6,12,16,20)(8,18,24,15)(10,23,13,21)
  !gapprompt@gap>| !gapinput@P.wordInFreeGenerators(g);|
  q^-1*r^-1*t^-1*v^-1*x^-1*z^-1
  !gapprompt@gap>| !gapinput@|
  !gapprompt@gap>| !gapinput@g:=Random(H);|
  (1,14,5,17)(2,21)(3,9)(4,24)(6,12,16,20)(7,11,15,13)(8,23)(10,18,22,19)
  !gapprompt@gap>| !gapinput@P.wordInFreeGenerators(g);|
  q^-1*r^-1*t^-1*v^-1*w^-1*z^-1
  
\end{Verbatim}
 

 Because the resolution $R_\ast$ was obtained from a composition series, the unique word associated to an
element $g\in H$ always has the form $q^{\epsilon_1} r^{\epsilon_2} s^{\epsilon_3} t^{\epsilon_4} u^{\epsilon_5}
v^{\epsilon_6} w^{\epsilon_7} x^{\epsilon_8} y^{\epsilon_9} z^{\epsilon_{10}}$ determined by the exponent vector $(\epsilon_1,\cdots,\epsilon_{10}) \in (\mathbb Z_2)^{10}$. }

 
\section{\textcolor{Chapter }{Second group cohomology and cocyclic Hadamard matrices}}\label{secHadamard}
\logpage{[ 6, 10, 0 ]}
\hyperdef{L}{X7C60E2B578074532}{}
{
 An \emph{Hadamard matrix} is a square $n\times n$ matrix $H$ whose entries are either $+1$ or $-1$ and whose rows are mutually orthogonal, that is $H H^t = nI_n$ where $H^t$ denotes the transpose and $I_n$ denotes the $n\times n$ identity matrix. 

Given a group $G=\{g_1,g_2,\ldots,g_n\}$ of order $n$ and the abelian group $A=\{1,-1\}$ of square roots of unity, any $2$\texttt{\symbol{45}}cocycle $f\colon G\times G\rightarrow A$ corresponds to an $n\times n$ matrix $F=(f(g_i,g_j))_{1\le i,j\le n}$ whose entries are $\pm 1$. If $F$ is Hadamard it is called a \emph{cocyclic Hadamard matrix} corresponding to $G$. 

The following commands compute all $192$ of the cocyclic Hadamard matrices for the abelian group $G=\mathbb Z_4\oplus \mathbb Z_4$ of order $n=16$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=AbelianGroup([4,4]);;|
  !gapprompt@gap>| !gapinput@F:=CocyclicHadamardMatrices(G);;|
  !gapprompt@gap>| !gapinput@Length(F);|
  192
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Third group cohomology and homotopy $2$\texttt{\symbol{45}}types}}\label{secCat1}
\logpage{[ 6, 11, 0 ]}
\hyperdef{L}{X78040D8580D35D53}{}
{
  \textsc{Homotopy 2\texttt{\symbol{45}}types} 

 The third cohomology $H^3(G,A)$ of a group $G$ with coefficients in a $G$\texttt{\symbol{45}}module $A$, together with the corresponding $3$\texttt{\symbol{45}}cocycles, can be used to classify homotopy $2$\texttt{\symbol{45}}types. A \emph{homotopy 2\texttt{\symbol{45}}type} is a CW\texttt{\symbol{45}}complex whose homotopy groups are trivial in
dimensions $n=0$ and $n>2$. There is an equivalence between the two categories 
\begin{enumerate}
\item  (Homotopy category of connected CW\texttt{\symbol{45}}complexes $X$ with trivial homotopy groups $\pi_n(X)$ for $n>2$) 
\item  (Localization of the category of simplicial groups with Moore complex of
length $1$, where localization is with respect to homomorphisms inducing isomorphisms on
homotopy groups) 
\end{enumerate}
 which reduces the homotopy theory of $2$\texttt{\symbol{45}}types to a 'computable' algebraic theory. Furthermore, a
simplicial group with Moore complex of length $1$ can be represented by a group $H$ endowed with two endomorphisms $s\colon H\rightarrow H$ and $t\colon H\rightarrow H$ satisfying the axioms 
\begin{itemize}
\item $ss=s$, $ts=s$,
\item $tt=t$, $st=t$,
\item  $[\ker s, \ker t] = 1$.
\end{itemize}
 Ths triple $(H,s,t)$ was termed a \emph{cat$^1$\texttt{\symbol{45}}group} by J.\texttt{\symbol{45}}L. Loday since it can be regarded as a group $H$ endowed with one compatible category structure. 

The \emph{homotopy groups} of a cat$^1$\texttt{\symbol{45}}group $H$ are defined as: $\pi_1(H) = {\rm image}(s)/t(\ker(s))$; $\pi_2(H)=\ker(s) \cap \ker(t)$; $\pi_n(H)=0$ for $n> 2$ or $n=0$. Note that $\pi_2(H)$ is a $\pi_1(H)$\texttt{\symbol{45}}module where the action is induced by conjugation in $H$. 

A homotopy $2$\texttt{\symbol{45}}type $X$ can be represented by a cat$^1$\texttt{\symbol{45}}group $H$ or by the homotopy groups $\pi_1X=\pi_1H$, $\pi_2X=\pi_2H$ and a cohomology class $k\in H^3(\pi_1X,\pi_2X)$. This class $k$ is the \emph{Postnikov invariant}. 

\textsc{Relation to Group Theory} 

A number of standard group\texttt{\symbol{45}}theoretic constructions can be
viewed naturally as a cat$^1$\texttt{\symbol{45}}group. 
\begin{enumerate}
\item  A $\mathbb ZG$\texttt{\symbol{45}}module $A$ can be viewed as a cat$^1$\texttt{\symbol{45}}group $(H,s,t)$ where $H$ is the semi\texttt{\symbol{45}}direct product $A\rtimes G$ and $s(a,g)=(1,g)$, $t(a,g)=(1,g)$. Here $\pi_1(H)=G$ and $\pi_2(H)=A$.
\item  A group $G$ with normal subgroup $N$ can be viewed as a cat$^1$\texttt{\symbol{45}}group $(H,s,t)$ where $H$ is the semi\texttt{\symbol{45}}direct product $N\rtimes G$ and $s(n,g)=(1,g)$, $t(n,g)=(1,ng)$. Here $\pi_1(H)=G/N$ and $\pi_2(H)=0$.
\item  The homomorphism $\iota \colon G\rightarrow Aut(G)$ which sends elements of a group $G$ to the corresponding inner automorphism can be viewed as a cat$^1$\texttt{\symbol{45}}group $(H,s,t)$ where $H$ is the semi\texttt{\symbol{45}}direct product $G\rtimes Aut(G)$ and $s(g,a)=(1,a)$, $t(g,a)=(1,\iota (g)a)$. Here $\pi_1(H)=Out(G)$ is the outer automorphism group of $G$ and $\pi_2(H)=Z(G)$ is the centre of $G$.
\end{enumerate}
 These three constructions are implemented in \textsc{HAP}. 

\textsc{Example} 

The following commands begin by constructing the cat$^1$\texttt{\symbol{45}}group $H$ of Construction 3 for the group $G=SmallGroup(64,134)$. They then construct the fundamental group of $H$ and the second homotopy group of as a $\pi_1$\texttt{\symbol{45}}module. These homotopy groups have orders $8$ and $2$ respectively. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SmallGroup(64,134);;|
  !gapprompt@gap>| !gapinput@H:=AutomorphismGroupAsCatOneGroup(G);;|
  !gapprompt@gap>| !gapinput@pi_1:=HomotopyGroup(H,1);;|
  !gapprompt@gap>| !gapinput@pi_2:=HomotopyModule(H,2);;|
  !gapprompt@gap>| !gapinput@Order(pi_1);|
  8
  !gapprompt@gap>| !gapinput@Order(ActedGroup(pi_2));|
  2
  
\end{Verbatim}
 

 The following additional commands show that there are $1024$ Yoneda equivalence classes of cat$^1$\texttt{\symbol{45}}groups with fundamental group $\pi_1$ and $\pi_1$\texttt{\symbol{45}} module equal to $\pi_2$ in our example. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(pi_1,4);;|
  !gapprompt@gap>| !gapinput@C:=HomToGModule(R,pi_2);;|
  !gapprompt@gap>| !gapinput@CH:=CohomologyModule(C,3);;|
  !gapprompt@gap>| !gapinput@AbelianInvariants(ActedGroup(CH));|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 A $3$\texttt{\symbol{45}}cocycle $f \colon \pi_1 \times \pi_1 \times \pi_1 \rightarrow \pi_2$ corresponding to a random cohomology class $k\in H^3(\pi_1,\pi_2)$ can be produced using the following command. }

 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|x:=Random(Elements(ActedGroup(CH)));;B
  @gapprompt|gap>B @gapinput|f:=CH!.representativeCocycle(x);B
  Standard 3-cocycle 
  
\end{Verbatim}
 The $3$\texttt{\symbol{45}}cocycle corresponding to the Postnikov invariant of $H$ itself can be easily constructed directly from its definition in terms of a
set\texttt{\symbol{45}}theoretic 'section' of the crossed module corresponding
to $H$. }

 
\chapter{\textcolor{Chapter }{Cohomology of groups (and Lie Algebras)}}\logpage{[ 7, 0, 0 ]}
\hyperdef{L}{X787E37187B7308C9}{}
{
 
\section{\textcolor{Chapter }{Finite groups }}\logpage{[ 7, 1, 0 ]}
\hyperdef{L}{X807B265978F90E01}{}
{
 
\subsection{\textcolor{Chapter }{Naive homology computation for a very small group}}\logpage{[ 7, 1, 1 ]}
\hyperdef{L}{X80A721AC7A8D30A3}{}
{
 

It is possible to compute the low degree (co)homology of a finite group or
monoid of small order directly from the bar resolution. The following commands
take this approach to computing the fifth integral homology 

$H_5(Q_4,\mathbb Z) = \mathbb Z_2\oplus\mathbb Z_2$ 

of the quaternion group $G=Q_4$ of order $8$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|Q:=QuaternionGroup(8);;A
  @gapprompt|gap>A @gapinput|B:=BarComplexOfMonoid(Q,6);;                 A
  @gapprompt|gap>A @gapinput|C:=ContractedComplex(B);;A
  @gapprompt|gap>A @gapinput|Homology(C,5);A
  [ 2, 2 ]
  
  
  @gapprompt|gap>A @gapinput|List([0..6],B!.dimension);A
  [ 1, 7, 49, 343, 2401, 16807, 117649 ]
  @gapprompt|gap>A @gapinput|List([0..6],C!.dimension);A
  [ 1, 2, 2, 1, 2, 4, 102945 ]
  
\end{Verbatim}
 

However, this approach is of limited applicability since the bar resolution
involves $|G|^k$ free generators in degree $k$. A range of techniques, tailored to specific classes of groups, can be used
to compute the (co)homology of larger finite groups. 

 This naive approach does have the merit of being applicable to arbitrary small
monoids. The following calculates the homology in degrees $\le 7$ of a monoid of order 8, the monoid being specified by its multiplication
table. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|T:=[ [  1,  1,  1,  4,  4,  4,  4,  1 ],A
  @gapprompt|>A @gapinput|        [  1,  1,  1,  4,  4,  4,  4,  2 ],A
  @gapprompt|>A @gapinput|        [  1,  1,  1,  4,  4,  4,  4,  3 ],A
  @gapprompt|>A @gapinput|        [  4,  4,  4,  1,  1,  1,  1,  4 ],A
  @gapprompt|>A @gapinput|        [  4,  4,  4,  1,  1,  1,  1,  5 ],A
  @gapprompt|>A @gapinput|        [  4,  4,  4,  1,  1,  1,  1,  6 ],A
  @gapprompt|>A @gapinput|        [  4,  4,  4,  1,  1,  1,  1,  7 ],A
  @gapprompt|>A @gapinput|        [  1,  2,  3,  4,  5,  6,  7,  8 ] ];;A
  @gapprompt|gap>A @gapinput|M:=MonoidByMultiplicationTable(T);A
  <monoid of size 8, with 8 generators>
  @gapprompt|gap>A @gapinput|B:=BarComplexOfMonoid(M,8);;A
  @gapprompt|gap>A @gapinput|C:=ContractedComplex(B);;A
  @gapprompt|gap>A @gapinput|List([0..7],i->Homology(C,i));A
  [ [ 0 ], [ 2 ], [  ], [ 2 ], [  ], [ 2 ], [  ], [ 2 ] ]
  
  
  @gapprompt|gap>A @gapinput|List([0..8],B!.dimension);A
  [ 1, 7, 49, 343, 2401, 16807, 117649, 823543, 5764801 ]
  @gapprompt|gap>A @gapinput|List([0..8],C!.dimension);A
  [ 1, 1, 1, 1, 1, 1, 1, 1, 5044201 ]
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{A more efficient homology computation}}\logpage{[ 7, 1, 2 ]}
\hyperdef{L}{X838CEA3F850DFC82}{}
{
 

 The following example computes the seventh integral homology 

$H_7(M_{23},\mathbb Z) = \mathbb Z_{16}\oplus\mathbb Z_{15}$ 

and fourth integral cohomomogy 

$H^4(M_{24},\mathbb Z) = \mathbb Z_{12}$ 

of the Mathieu groups $M_{23}$ and $M_{24}$. (Warning: the computation of $H_7(M_{23},\mathbb Z)$ takes a couple of hours to run.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@GroupHomology(MathieuGroup(23),7);|
  [ 16, 3, 5 ]
  
  !gapprompt@gap>| !gapinput@GroupCohomology(MathieuGroup(24),4);|
  [ 4, 3 ]
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Computation of an induced homology homomorphism}}\logpage{[ 7, 1, 3 ]}
\hyperdef{L}{X842E93467AD09EC1}{}
{
 

The following example computes the cokernel 

${\rm coker}( H_3(A_7,\mathbb Z) \rightarrow H_3(S_{10},\mathbb Z)) \cong
\mathbb Z_2\oplus \mathbb Z_2$ 

of the degree\texttt{\symbol{45}}3 integral homomogy homomorphism induced by
the canonical inclusion $A_7 \rightarrow S_{10}$ of the alternating group on $7$ letters into the symmetric group on $10$ letters. The analogous cokernel with $\mathbb Z_2$ homology coefficients is also computed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SymmetricGroup(10);;|
  !gapprompt@gap>| !gapinput@H:=AlternatingGroup(7);;|
  !gapprompt@gap>| !gapinput@f:=GroupHomomorphismByFunction(H,G,x->x);;|
  !gapprompt@gap>| !gapinput@F:=GroupHomology(f,3);|
  MappingByFunction( Pcp-group with orders [ 4, 3 ], Pcp-group with orders 
  [ 2, 2, 4, 3 ], function( x ) ... end )
  !gapprompt@gap>| !gapinput@AbelianInvariants(Range(F)/Image(F));|
  [ 2, 2 ]
  
  !gapprompt@gap>| !gapinput@Fmod2:=GroupHomology(f,3,2);;|
  !gapprompt@gap>| !gapinput@AbelianInvariants(Range(Fmod2)/Image(Fmod2));|
  [ 2, 2 ]
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Some other finite group homology computations}}\logpage{[ 7, 1, 4 ]}
\hyperdef{L}{X8754D2937E6FD7CE}{}
{
 

The following example computes the third integral homology of the Weyl group $W=Weyl(E_8)$, a group of order $696729600$. 

$H_3(Weyl(E_8),\mathbb Z) = \mathbb Z_2 \oplus \mathbb Z_2 \oplus \mathbb
Z_{12}$ 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=SimpleLieAlgebra("E",8,Rationals);;|
  !gapprompt@gap>| !gapinput@W:=WeylGroup(RootSystem(L));;|
  !gapprompt@gap>| !gapinput@Order(W);|
  696729600
  !gapprompt@gap>| !gapinput@GroupHomology(W,3);|
  [ 2, 2, 4, 3 ]
  
\end{Verbatim}
 

The preceding calculation could be achieved more quickly by noting that $W=Weyl(E_8)$ is a Coxeter group, and by using the associated Coxeter polytope. The
following example uses this approach to compute the fourth integral homology
of $W$. It begins by displaying the Coxeter diagram of $W$, and then computes 

$H_4(Weyl(E_8),\mathbb Z) = \mathbb Z_2 \oplus \mathbb Z_2 \oplus Z_2 \oplus
\mathbb Z_2$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=[[1,[2,3]],[2,[3,3]],[3,[4,3],[5,3]],[5,[6,3]],[6,[7,3]],[7,[8,3]]];;|
  !gapprompt@gap>| !gapinput@CoxeterDiagramDisplay(D);|
  
\end{Verbatim}
  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@polytope:=CoxeterComplex_alt(D,5);;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(polytope,5);|
  Resolution of length 5 in characteristic 0 for <matrix group with 
  8 generators> . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@C:=TensorWithIntegers(R);|
  Chain complex of length 5 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Homology(C,4);|
  [ 2, 2, 2, 2 ]
  
\end{Verbatim}
 

The following example computes the sixth mod\texttt{\symbol{45}}$2$ homology of the Sylow $2$\texttt{\symbol{45}}subgroup $Syl_2(M_{24})$ of the Mathieu group $M_{24}$. 

$H_6(Syl_2(M_{24}),\mathbb Z_2) = \mathbb Z_2^{143}$ 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@GroupHomology(SylowSubgroup(MathieuGroup(24),2),6,2);|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 

The following example computes the sixth mod\texttt{\symbol{45}}$2$ homology of the Unitary group $U_3(4)$ of order 312000. 

$H_6(U_3(4),\mathbb Z_2) = \mathbb Z_2^{4}$ 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=GU(3,4);;|
  !gapprompt@gap>| !gapinput@Order(G);|
  312000
  !gapprompt@gap>| !gapinput@GroupHomology(G,6,2);|
  [ 2, 2, 2, 2 ]
  
\end{Verbatim}
 

The following example constructs the Poincare series 

$p(x)=\frac{1}{-x^3+3*x^2-3*x+1}$ 

for the cohomology $H^\ast(Syl_2(M_{12},\mathbb F_2)$. The coefficient of $x^n$ in the expansion of $p(x)$ is equal to the dimension of the vector space $H^n(Syl_2(M_{12},\mathbb F_2)$. The computation involves \textsc{Singular}'s Groebner basis algorithms and the
Lyndon\texttt{\symbol{45}}Hochschild\texttt{\symbol{45}}Serre spectral
sequence. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SylowSubgroup(MathieuGroup(12),2);;|
  !gapprompt@gap>| !gapinput@P:=PoincareSeriesLHS(G);|
  (1)/(-x_1^3+3*x_1^2-3*x_1+1)
  
\end{Verbatim}
 The additional following command uses the Poincare series 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@RankHomologyPGroup(G,P,1000);|
  251000
  
\end{Verbatim}
 to determine that $H_{1000}(Syl_2(M_{12},\mathbb Z)$ is a direct sum of 251000 non\texttt{\symbol{45}}trivial cyclic $2$\texttt{\symbol{45}}groups. 

The following example constructs the series 

$p(x)=\frac{x^4-x^3+x^2-x+1}{x^6-x^5+x^4-2*x^3+x^2-x+1}$ 

whose coefficient of $x^n$ is equal to the dimension of the vector space $H^n(M_{11},\mathbb F_2)$ for all $n$ in the range $0\le n\le 14$. The coefficient is not guaranteed correct for $n\ge 15$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@PoincareSeriesPrimePart(MathieuGroup(11),2,14);|
  (x_1^4-x_1^3+x_1^2-x_1+1)/(x_1^6-x_1^5+x_1^4-2*x_1^3+x_1^2-x_1+1)
  
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Nilpotent groups}}\logpage{[ 7, 2, 0 ]}
\hyperdef{L}{X8463EF6A821FFB69}{}
{
 The following example computes 

$H_4(N,\mathbb Z) = \mathbb (Z_3)^4 \oplus \mathbb Z^{84}$ 

for the free nilpotent group $N$ of class $2$ on four generators. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FreeGroup(4);; N:=NilpotentQuotient(F,2);;|
  !gapprompt@gap>| !gapinput@GroupHomology(N,4);|
  [ 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Crystallographic and Almost Crystallographic groups}}\logpage{[ 7, 3, 0 ]}
\hyperdef{L}{X82E8FAC67BC16C01}{}
{
 

The following example computes 

$H_5(G,\mathbb Z) = \mathbb Z_2 \oplus \mathbb Z_2$ 

for the $3$\texttt{\symbol{45}}dimensional crystallographic space group $G$ with Hermann\texttt{\symbol{45}}Mauguin symbol "P62" 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@GroupHomology(SpaceGroupBBNWZ("P62"),5);|
  [ 2, 2 ]
  
\end{Verbatim}
 

The following example computes 

$H^5(G,\mathbb Z)= \mathbb Z$ 

 for an almost crystallographic group. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=AlmostCrystallographicPcpGroup( 4, 50, [ 1, -4, 1, 2 ] );;|
  !gapprompt@gap>| !gapinput@GroupCohomology(G,4);|
  [ 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Arithmetic groups}}\logpage{[ 7, 4, 0 ]}
\hyperdef{L}{X7AFFB32587D047FE}{}
{
 

The following example computes 

$H_6(SL_2({\cal O},\mathbb Z) = \mathbb Z_2 \oplus \mathbb Z_{12}$ 

for ${\cal O}$ the ring of integers of the number field $\mathbb Q(\sqrt{-2})$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@C:=ContractibleGcomplex("SL(2,O-2)");;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(C,7);;|
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R),6);|
  [ 2, 12 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Artin groups}}\logpage{[ 7, 5, 0 ]}
\hyperdef{L}{X800CB6257DC8FB3A}{}
{
 

The following example computes 

$H_n(G,\mathbb Z) =\left\{ \begin{array}{ll} \mathbb Z &n=0,1,7,8\\ \mathbb
Z_2, &n=2,3\\ \mathbb Z_2\oplus \mathbb Z_6, &n=4,6\\ \mathbb Z_3 \oplus
\mathbb Z_6,& n=5\\ 0, &n>8 \end{array}\right. $ 

for $G$ the Artin group of type $E_8$. (Similar commands can be used to compute a resolution and homology of
arbitrary Artin monoids and, in thoses cases such as the spherical cases where
the $K(\pi,1)$\texttt{\symbol{45}}conjecture is known to hold, the homology is equal to that
of the corresponding Artin group.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=[[1,[2,3]],[2,[3,3]],[3,[4,3],[5,3]],[5,[6,3]],[6,[7,3]],[7,[8,3]]];;|
  !gapprompt@gap>| !gapinput@CoxeterDiagramDisplay(D);;|
  
\end{Verbatim}
  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionArtinGroup(D,9);;|
  !gapprompt@gap>| !gapinput@C:=TensorWithIntegers(R);;|
  !gapprompt@gap>| !gapinput@List([0..8],n->Homology(C,n));|
  [ [ 0 ], [ 0 ], [ 2 ], [ 2 ], [ 2, 6 ], [ 3, 6 ], [ 2, 6 ], [ 0 ], [ 0 ] ]
  
\end{Verbatim}
 The Artin group $G$ projects onto the Coxeter group $W$ of type $E_8$. The group $W$ has a natural representation as a group of $8\times 8$ integer matrices. This projection gives rise to a representation $\rho\colon G\rightarrow GL_8(\mathbb Z)$. The following command computes the cohomology group $H^6(G,\rho) = (\mathbb Z_2)^6$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|G:=R!.group;;A
  @gapprompt|gap>A @gapinput|gensG:=GeneratorsOfGroup(G);;A
  @gapprompt|gap>A @gapinput|W:=CoxeterDiagramMatCoxeterGroup(D);;A
  @gapprompt|gap>A @gapinput|gensW:=GeneratorsOfGroup(W);;A
  @gapprompt|gap>A @gapinput|rho:=GroupHomomorphismByImages(G,W,gensG,gensW);;A
  @gapprompt|gap>A @gapinput|C:=HomToIntegralModule(R,rho);;A
  @gapprompt|gap>A @gapinput|Cohomology(C,6);A
  [ 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Graphs of groups}}\logpage{[ 7, 6, 0 ]}
\hyperdef{L}{X7BAFCA3680E478AE}{}
{
 

The following example computes 

$H_5(G,\mathbb Z) = \mathbb Z_2\oplus Z_2\oplus Z_2 \oplus Z_2 \oplus Z_2$ 

for $G$ the graph of groups corresponding to the amalgamated product $G=S_5*_{S_3}S_4$ of the symmetric groups $S_5$ and $S_4$ over the canonical subgroup $S_3$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@S5:=SymmetricGroup(5);SetName(S5,"S5");|
  !gapprompt@gap>| !gapinput@S4:=SymmetricGroup(4);SetName(S4,"S4");|
  !gapprompt@gap>| !gapinput@A:=SymmetricGroup(3);SetName(A,"S3");|
  !gapprompt@gap>| !gapinput@AS5:=GroupHomomorphismByFunction(A,S5,x->x);|
  !gapprompt@gap>| !gapinput@AS4:=GroupHomomorphismByFunction(A,S4,x->x);|
  !gapprompt@gap>| !gapinput@D:=[S5,S4,[AS5,AS4]];|
  !gapprompt@gap>| !gapinput@GraphOfGroupsDisplay(D);|
  
\end{Verbatim}
  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionGraphOfGroups(D,6);;|
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R),5);|
  [ 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Lie algebra homology and free nilpotent groups}}\logpage{[ 7, 7, 0 ]}
\hyperdef{L}{X7CE849E58706796C}{}
{
 One method of producting a Lie algebra $L$ from a group $G$ is by forming the direct sum $L(G) = G/\gamma_2G \oplus \gamma_2G/\gamma_3G \oplus \gamma_3G/\gamma_4G
\oplus \cdots$ of the quotients of the lower central series $\gamma_1G=G$, $\gamma_{n+1}G=[\gamma_nG,G]$. Commutation in $G$ induces a Lie bracket $L(G)\times L(G) \rightarrow L(G)$. 

 The homology $H_n(L)$ of a Lie algebra (with trivial coefficients) can be calculated as the homology
of the Chevalley\texttt{\symbol{45}}Eilenberg chain complex $C_\ast(L)$. This chain complex is implemented in \textsc{HAP} in the cases where the underlying additive group of $L$ is either finitely generated torsion free or finitely generated of prime
exponent $p$. In these two cases the ground ring for the Lie algebra/
Chevalley\texttt{\symbol{45}}Eilenberg complex is taken to be $\mathbb Z$ and $\mathbb Z_p$ respectively. 

 For example, consider the quotient $G=F/\gamma_8F$ of the free group $F=F(x,y)$ on two generators by eighth term of its lower central series. So $G$ is the \emph{free nilpotent group of class 7 on two generators}. The following commands compute $H_4(L(G)) = \mathbb Z_2^{77} \oplus \mathbb Z_6^8 \oplus \mathbb Z_{12}^{51}
\oplus \mathbb Z_{132}^{11} \oplus \mathbb Z^{2024}$ and show that the fourth homology in this case contains 2\texttt{\symbol{45}},
3\texttt{\symbol{45}} and 11\texttt{\symbol{45}}torsion. (The commands take an
hour or so to complete.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=Image(NqEpimorphismNilpotentQuotient(FreeGroup(2),7));;|
  !gapprompt@gap>| !gapinput@L:=LowerCentralSeriesLieAlgebra(G);;|
  !gapprompt@gap>| !gapinput@h:=LieAlgebraHomology(L,4);;|
  !gapprompt@gap>| !gapinput@Collected(h);|
  [ [ 0, 2024 ], [ 2, 77 ], [ 6, 8 ], [ 12, 51 ], [ 132, 11 ] ]
  
\end{Verbatim}
 

 For a free nilpotent group $G$ the additive homology $H_n(L(G))$ of the Lie algebra can be computed more quickly in \textsc{HAP} than the integral group homology $H_n(G,\mathbb Z)$. Clearly there are isomorphisms$H_1(G) \cong H_1(L(G)) \cong G_{ab}$ of abelian groups in homological degree $n=1$. Hopf's formula can be used to establish an isomorphism $H_2(G) \cong H_2(L(G))$ also in degree $n=2$. The following two theorems provide further isomorphisms that allow for the
homology of a free nilpotent group to be calculated more efficiently as the
homology of the associated Lie algebra. 

\textsc{Theorem 1.} \cite{kuzmin} \emph{Let $G$ be a finitely generated free nilpotent group of class 2. Then the integral
group homology $H_n(G,\mathbb Z)$ is isomorphic to the integral Lie algebra homology $H_n(L(G),\mathbb Z)$ in each degree $n\ge0$.} 

 \textsc{Theorem 2.} \cite{igusa} \emph{Let $G$ be a finitely generated free nilpotent group (of any class). Then the integral
group homology $H_n(G,\mathbb Z)$ is isomorphic to the integral Lie algebra homology $H_n(L(G),\mathbb Z)$ in degrees $n=0, 1, 2, 3$.} 

We should remark that experimentation on free nilpotent groups of class $\ge 4$ has not yielded a group for which the isomorphism $H_n(G,\mathbb Z) \cong H_n(L(G),\mathbb G)$ fails. For instance, the isomorphism holds in degree $n=4$ for the free nilpotent group of class 5 on two generators, and for the free
nilpotent group of class 2 on four generators: 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=Image(NqEpimorphismNilpotentQuotient(FreeGroup(2),5));;|
  !gapprompt@gap>| !gapinput@L:=LowerCentralSeriesLieAlgebra(G);;|
  !gapprompt@gap>| !gapinput@Collected( LieAlgebraHomology(L,4) );|
  [ [ 0, 85 ], [ 7, 1 ] ]
  !gapprompt@gap>| !gapinput@Collected( GroupHomology(G,4) );|
  [ [ 0, 85 ], [ 7, 1 ] ]
  
  !gapprompt@gap>| !gapinput@G:=Image(NqEpimorphismNilpotentQuotient(FreeGroup(4),2));;  |
  !gapprompt@gap>| !gapinput@L:=LowerCentralSeriesLieAlgebra(G);;|
  !gapprompt@gap>| !gapinput@Collected( LieAlgebraHomology(L,4) );|
  [ [ 0, 84 ], [ 3, 4 ] ]
  !gapprompt@gap>| !gapinput@Collected( GroupHomology(G,4) );|
  [ [ 0, 84 ], [ 3, 4 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cohomology with coefficients in a module}}\logpage{[ 7, 8, 0 ]}
\hyperdef{L}{X7C3DEDD57BB4D537}{}
{
 There are various ways to represent a $\mathbb ZG$\texttt{\symbol{45}}module $A$ with action $G\times A \rightarrow A, (g,a)\mapsto \alpha(g,a)$. 

One possibility is to use the data type of a \emph{$G$\texttt{\symbol{45}}Outer Group} which involves three components: an $ActedGroup$ $A$; an $Acting Group$ $G$; a $Mapping$ $(g,a)\mapsto \alpha(g,a)$. The following example uses this data type to compute the cohomology $H^4(G,A) =\mathbb Z_5 \oplus \mathbb Z_{10}$ of the symmetric group $G=S_6$ with coefficients in the integers $A=\mathbb Z$ where odd permutations act non\texttt{\symbol{45}}trivially on $A$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SymmetricGroup(6);;|
  
  !gapprompt@gap>| !gapinput@A:=AbelianPcpGroup([0]);;|
  !gapprompt@gap>| !gapinput@alpha:=function(g,a); return a^SignPerm(g); end;;|
  !gapprompt@gap>| !gapinput@A:=GModuleAsGOuterGroup(G,A,alpha);|
  ZG-module with abelian invariants [ 0 ] and G= SymmetricGroup( [ 1 .. 6 ] )
  
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(G,5);;|
  !gapprompt@gap>| !gapinput@C:=HomToGModule(R,A);|
  G-cocomplex of length 5 . 
  
  !gapprompt@gap>| !gapinput@Cohomology(C,4);|
  [ 2, 2, 5 ]
  
\end{Verbatim}
 

 If $A=\mathbb Z^n$ and $G$ acts as 

$G\times A \rightarrow A, (g, v) \mapsto \rho(g)\, v $ 

 where $\rho\colon G\rightarrow Gl_n(\mathbb Z)$ is a (not necessarily faithful) matrix representation of degree $n$ then we can avoid the use of $G$\texttt{\symbol{45}}outer groups and use just the homomorphism $\rho$ instead. The following example uses this data type to compute the cohomology 

$H^6(G,A) =\mathbb Z_2 $ 

and the homology 

$H_6(G,A) = 0 $ 

 of the alternating group $G=A_5$ with coefficients in $A=\mathbb Z^5$ where elements of $G$ act on $\mathbb Z^5$ via an irreducible representation. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=AlternatingGroup(5);;|
  !gapprompt@gap>| !gapinput@rho:=IrreducibleRepresentations(G)[5];|
  [ (1,2,3,4,5), (3,4,5) ] -> 
  [ 
    [ [ 0, 0, 1, 0, 0 ], [ -1, -1, 0, 0, 1 ], [ 0, 1, 1, 1, 0 ], 
        [ 1, 0, -1, 0, -1 ], [ -1, -1, 0, -1, 0 ] ], 
    [ [ -1, -1, 0, 0, 1 ], [ 1, 0, -1, 0, -1 ], [ 0, 0, 0, 0, 1 ], 
        [ 0, 0, 1, 0, 0 ], [ 0, 0, 0, 1, 0 ] ] ]
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(G,7);;|
  !gapprompt@gap>| !gapinput@C:=HomToIntegralModule(R,rho);;|
  !gapprompt@gap>| !gapinput@Cohomology(C,6);|
  [ 2 ]
  !gapprompt@gap>| !gapinput@D:=TensorWithIntegralModule(R,rho);|
  Chain complex of length 7 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Homology(D,6);|
  [  ]
  
\end{Verbatim}
 

If $V=K^d$ is a vetor space of dimension $d$ over the field $K=GF(p)$ with $p$ a prime and $G$ acts on $V$ via a homomorphism $\rho\colon G\rightarrow GL_d(K)$ then the homology $H^n(G,V)$ can again be computed without the use of G\texttt{\symbol{45}}outer groups. As
an example, the following commands compute 

$H^4(GL(3,2),V) =K^2$ 

where $K=GF(2)$ and $GL(3,2)$ acts with its natural action on $V=K^3$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=GL(3,2);;|
  !gapprompt@gap>| !gapinput@rho:=GroupHomomorphismByFunction(G,G,x->x);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(G,5);;|
  !gapprompt@gap>| !gapinput@C:=HomToModPModule(R,rho);;|
  !gapprompt@gap>| !gapinput@Cohomology(C,4);|
  2
  
\end{Verbatim}
 

 It can be computationally difficult to compute resolutions for large finite
groups. But the $p$\texttt{\symbol{45}}primary part of the homology can be computed using
resolutions of Sylow $p$\texttt{\symbol{45}}subgroups. This approach is used in the following example
that computes the $2$\texttt{\symbol{45}}primary part 

$H_{2}(G,\mathbb Z)_{(2)} = \mathbb Z_2 \oplus \mathbb Z_2\oplus \mathbb Z_2$ 

of the degree 2 integral homology of the Rubik's cube group $G$. This group has order $43252003274489856000$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gens:= [|
  !gapprompt@>| !gapinput@   ( 1, 3, 8, 6)( 2, 5, 7, 4)( 9,33,25,17)(10,34,26,18)(11,35,27,19),|
  !gapprompt@>| !gapinput@   ( 9,11,16,14)(10,13,15,12)( 1,17,41,40)( 4,20,44,37)( 6,22,46,35),|
  !gapprompt@>| !gapinput@   (17,19,24,22)(18,21,23,20)( 6,25,43,16)( 7,28,42,13)( 8,30,41,11),|
  !gapprompt@>| !gapinput@   (25,27,32,30)(26,29,31,28)( 3,38,43,19)( 5,36,45,21)( 8,33,48,24),|
  !gapprompt@>| !gapinput@   (33,35,40,38)(34,37,39,36)( 3, 9,46,32)( 2,12,47,29)( 1,14,48,27),|
  !gapprompt@>| !gapinput@   (41,43,48,46)(42,45,47,44)(14,22,30,38)(15,23,31,39)(16,24,32,40)|
  !gapprompt@>| !gapinput@ ];; G:=Group(gens);;P:=SylowSubgroup(G,2);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionNormalSeries(BigStepUCS(P,6),3);;|
  !gapprompt@gap>| !gapinput@PrimePartDerivedFunctorViaSubgroupChain(G,R,TensorWithIntegers,2);|
  [ 2, 2, 2 ]
  
\end{Verbatim}
 The same approach is used in the following example that computes the $2$\texttt{\symbol{45}}primary part 

$H_{11}(A_7,A)_{(2)} = \mathbb Z_2 \oplus \mathbb Z_2\oplus \mathbb Z_4$ 

of the degree 11 homology of the alternating group $A_7$ of degree $7$ with coefficients in the module $A=\mathbb Z^7$ on which $A_7$ acts by permuting basis vectors. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=AlternatingGroup(7);;|
  !gapprompt@gap>| !gapinput@rho:=PermToMatrixGroup(G);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(SylowSubgroup(G,2),12);;|
  !gapprompt@gap>| !gapinput@F:=function(X); return TensorWithIntegralModule(X,rho); end;;|
  !gapprompt@gap>| !gapinput@PrimePartDerivedFunctorViaSubgroupChain(G,R,F,11);|
  [ 2, 2, 4 ]
  
\end{Verbatim}
 Similar commands compute 

$H_{3}(A_{10},A)_{(2)} = \mathbb Z_4$ 

with coefficient module $A=\mathbb Z^{10}$ on which $A_{10}$ acts by permuting basis vectors. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=AlternatingGroup(10);;|
  !gapprompt@gap>| !gapinput@rho:=PermToMatrixGroup(G);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(SylowSubgroup(G,2),4);;|
  !gapprompt@gap>| !gapinput@F:=function(X); return TensorWithIntegralModule(X,rho); end;;|
  !gapprompt@gap>| !gapinput@PrimePartDerivedFunctorViaSubgroupChain(G,R,F,3);|
  [ 4 ]
  
\end{Verbatim}
 

The following commands compute 

$H_{100}(GL(3,2),V)= K^{34}$ 

where $V$ is the vector space of dimension $3$ over $K=GF(2)$ acting via some irreducible representation $\rho\colon GL(3,2) \rightarrow GL(V)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=GL(3,2);;|
  !gapprompt@gap>| !gapinput@rho:=IrreducibleRepresentations(G,GF(2))[3];|
  CompositionMapping( [ (5,7)(6,8), (2,3,5)(4,7,6) ] -> 
  [ <an immutable 3x3 matrix over GF2>, <an immutable 3x3 matrix over GF2> ],
   <action isomorphism> )
  !gapprompt@gap>| !gapinput@F:=function(X); return TensorWithModPModule(X,rho); end;;|
  !gapprompt@gap>| !gapinput@S:=ResolutionPrimePowerGroup(SylowSubgroup(G,2),101);;|
  !gapprompt@gap>| !gapinput@PrimePartDerivedFunctorViaSubgroupChain(G,S,F,100);|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cohomology as a functor of the first variable}}\logpage{[ 7, 9, 0 ]}
\hyperdef{L}{X7E573EA582CCEF2E}{}
{
 Suppose given a group homomorphism $f\colon G_1\rightarrow G_2$ and a $G_2$\texttt{\symbol{45}}module $A$. Then $A$ is naturally a $G_1$\texttt{\symbol{45}}module with action via $f$, and there is an induced cohomology homomorphism $H^n(f,A)\colon H^n(G_2,A) \rightarrow H^n(G_1,A)$. 

The following example computes this cohomology homomorphism in degree $n=6$ for the inclusion $f\colon A_5 \rightarrow S_5$ and $A=\mathbb Z^5$ with action that permutes the canonical basis. The final commands determine
that the kernel of the homomorphism $H^6(f,A)$ is the Klein group of order $4$ and that the cokernel is cyclic of order $6$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G1:=AlternatingGroup(5);;|
  !gapprompt@gap>| !gapinput@G2:=SymmetricGroup(5);;|
  !gapprompt@gap>| !gapinput@f:=GroupHomomorphismByFunction(G1,G2,x->x);;|
  !gapprompt@gap>| !gapinput@pi:=PermToMatrixGroup(G2,5);;|
  !gapprompt@gap>| !gapinput@R1:=ResolutionFiniteGroup(G1,7);;|
  !gapprompt@gap>| !gapinput@R2:=ResolutionFiniteGroup(G2,7);;|
  !gapprompt@gap>| !gapinput@F:=EquivariantChainMap(R1,R2,f);;|
  !gapprompt@gap>| !gapinput@C:=HomToIntegralModule(F,pi);;|
  !gapprompt@gap>| !gapinput@c:=Cohomology(C,6);|
  [ g1, g2, g3 ] -> [ id, id, g3 ]
  
  !gapprompt@gap>| !gapinput@AbelianInvariants(Kernel(c));|
  [ 2, 2 ]
  !gapprompt@gap>| !gapinput@AbelianInvariants(Range(c)/Image(c));|
  [ 2, 3 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cohomology as a functor of the second variable and the long exact coefficient
sequence}}\logpage{[ 7, 10, 0 ]}
\hyperdef{L}{X796731727A7EBE59}{}
{
 A short exact sequence of $\mathbb ZG$\texttt{\symbol{45}}modules $A \rightarrowtail B \twoheadrightarrow C$ induces a long exact sequence of cohomology groups 

$ \rightarrow H^n(G,A) \rightarrow H^n(G,B) \rightarrow H^n(G,C) \rightarrow
H^{n+1}(G,A) \rightarrow $ . 

 Consider the symmetric group $G=S_4$ and the sequence $ \mathbb Z_4 \rightarrowtail \mathbb Z_8 \twoheadrightarrow \mathbb Z_2$ of trivial $\mathbb ZG$\texttt{\symbol{45}}modules. The following commands compute the induced
cohomology homomorphism 

$f\colon H^3(S_4,\mathbb Z_4) \rightarrow H^3(S_4,\mathbb Z_8)$ 

and determine that the image of this induced homomorphism has order $8$ and that its kernel has order $2$. 
\begin{Verbatim}[commandchars=@|D,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>D @gapinput|G:=SymmetricGroup(4);;D
  @gapprompt|gap>D @gapinput|x:=(1,2,3,4,5,6,7,8);;D
  @gapprompt|gap>D @gapinput|a:=Group(x^2);;D
  @gapprompt|gap>D @gapinput|b:=Group(x);;D
  @gapprompt|gap>D @gapinput|ahomb:=GroupHomomorphismByFunction(a,b,y->y);;D
  @gapprompt|gap>D @gapinput|A:=TrivialGModuleAsGOuterGroup(G,a);;D
  @gapprompt|gap>D @gapinput|B:=TrivialGModuleAsGOuterGroup(G,b);;D
  @gapprompt|gap>D @gapinput|phi:=GOuterGroupHomomorphism();;D
  @gapprompt|gap>D @gapinput|phi!.Source:=A;;D
  @gapprompt|gap>D @gapinput|phi!.Target:=B;;D
  @gapprompt|gap>D @gapinput|phi!.Mapping:=ahomb;;D
   
  @gapprompt|gap>D @gapinput|Hphi:=CohomologyHomomorphism(phi,3);;D
  
  @gapprompt|gap>D @gapinput|Size(ImageOfGOuterGroupHomomorphism(Hphi));D
  8
  
  @gapprompt|gap>D @gapinput|Size(KernelOfGOuterGroupHomomorphism(Hphi));D
  2
  
\end{Verbatim}
 

 The following commands then compute the homomorphism 

$H^3(S_4,\mathbb Z_8) \rightarrow H^3(S_4,\mathbb Z_2)$ 

induced by $\mathbb Z_4 \rightarrowtail \mathbb Z_8 \twoheadrightarrow \mathbb Z_2$, and determine that the kernel of this homomorphsim has order $8$. 
\begin{Verbatim}[commandchars=@|D,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>D @gapinput|bhomc:=NaturalHomomorphismByNormalSubgroup(b,a);D
  @gapprompt|gap>D @gapinput|B:=TrivialGModuleAsGOuterGroup(G,b);D
  @gapprompt|gap>D @gapinput|C:=TrivialGModuleAsGOuterGroup(G,Image(bhomc));D
  @gapprompt|gap>D @gapinput|psi:=GOuterGroupHomomorphism();D
  @gapprompt|gap>D @gapinput|psi!.Source:=B;D
  @gapprompt|gap>D @gapinput|psi!.Target:=C;D
  @gapprompt|gap>D @gapinput|psi!.Mapping:=bhomc;D
  
  @gapprompt|gap>D @gapinput|Hpsi:=CohomologyHomomorphism(psi,3);D
  
  @gapprompt|gap>D @gapinput|Size(KernelOfGOuterGroupHomomorphism(Hpsi));D
  8
  
\end{Verbatim}
 

The following commands then compute the connecting homomorphism 

$H^2(S_4,\mathbb Z_2) \rightarrow H^3(S_4,\mathbb Z_4)$ 

and determine that the image of this homomorphism has order $2$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@delta:=ConnectingCohomologyHomomorphism(psi,2);;|
  !gapprompt@gap>| !gapinput@Size(ImageOfGOuterGroupHomomorphism(delta));|
  
\end{Verbatim}
 Note that the various orders are consistent with exactness of the sequence 

$H^2(S_4,\mathbb Z_2) \rightarrow H^3(S_4,\mathbb Z_4) \rightarrow
H^3(S_4,\mathbb Z_8) \rightarrow H^3(S_4,\mathbb Z_2) $ . }

 
\section{\textcolor{Chapter }{Transfer Homomorphism}}\logpage{[ 7, 11, 0 ]}
\hyperdef{L}{X80F6FD3E7C7E4E8D}{}
{
 Consider the action of the symmetric group $G=S_5$ on $A=\mathbb Z^5$ which permutes the canonical basis. The action restricts to the sylow $2$\texttt{\symbol{45}}subgroup $P=Syl_2(G)$. The following commands compute the cohomology transfer homomorphism $t^4\colon H^4(P,A) \rightarrow H^4(S_5,A)$ and determine its kernel and image. The integral homology transfer $t_4\colon H_4(S_5,\mathbb Z) \rightarrow H_5(P,\mathbb Z)$ is also computed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SymmetricGroup(5);;|
  !gapprompt@gap>| !gapinput@P:=SylowSubgroup(G,2);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(G,5);;|
  !gapprompt@gap>| !gapinput@A:=PermToMatrixGroup(G);;|
  !gapprompt@gap>| !gapinput@tr:=TransferCochainMap(R,P,A);|
  Cochain Map between complexes of length 5 . 
  
  !gapprompt@gap>| !gapinput@t4:=Cohomology(tr,4);|
  [ g1, g2, g3, g4 ] -> [ id, g1, g2, g4 ]
  !gapprompt@gap>| !gapinput@StructureDescription(Kernel(t4));|
  "C2 x C2"
  !gapprompt@gap>| !gapinput@StructureDescription(Image(t4));|
  "C4 x C2"
  
  !gapprompt@gap>| !gapinput@tr:=TransferChainMap(R,P);|
  Chain Map between complexes of length 5 . 
  
  !gapprompt@gap>| !gapinput@Homology(tr,4);|
  [ g1 ] -> [ g1 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cohomology rings of finite fundamental groups of
3\texttt{\symbol{45}}manifolds }}\label{Secfinitefundman}
\logpage{[ 7, 12, 0 ]}
\hyperdef{L}{X79B1406C803FF178}{}
{
 A \emph{spherical 3\texttt{\symbol{45}}manifold} is a 3\texttt{\symbol{45}}manifold arising as the quotient $S^3/\Gamma$ of the 3\texttt{\symbol{45}}sphere $S^3$ by a finite subgroup $\Gamma$ of $SO(4)$ acting freely as rotations. The geometrization conjecture, proved by Grigori
Perelman, implies that every closed connected 3\texttt{\symbol{45}}manifold
with a finite fundamental group is homeomorphic to a spherical
3\texttt{\symbol{45}}manifold. 

 A spherical 3\texttt{\symbol{45}}manifold $S^3/\Gamma$ has finite fundamental group isomorphic to $\Gamma$. This fundamental group is one of: 
\begin{itemize}
\item  $\Gamma=C_m=\langle x\ |\ x^m\rangle$ (\textsc{cyclic fundamental group})
\item  $\Gamma=C_m\times \langle x,y \ |\ xyx^{-1}=y^{-1}, x^{2^k}=y^n \rangle$ for integers $k, m\ge 1, n\ge 2$ and $m$ coprime to $2n$ (\textsc{prism manifold case})
\item  $\Gamma= C_m\times \langle x,y, z \ |\ (xy)^2=x^2=y^2, zxz^{-1}=y, zyz^{-1}=xy,
z^{3^k}=1\rangle $ for integers $k,m\ge 1$ and $m$ coprime to 6 (\textsc{tetrahedral case})
\item  $\Gamma=C_m\times\langle x,y\ |\ (xy)^2=x^3=y^4\rangle $ for $m\ge 1$ coprime to 6 (\textsc{octahedral case})
\item $\Gamma=C_m\times \langle x,y\ |\ (xy)^2=x^3=y^5\rangle $ for $m\ge 1$ coprime to 30 (\textsc{icosahedral case}).
\end{itemize}
 This list of cases is taken from the \href{https://en.wikipedia.org/wiki/Spherical_3-manifold} {Wikipedia pages}. The group $\Gamma$ has periodic cohomology since it acts on a sphere. The cyclic group has period
2 and in the other four cases it has period 4. (Recall that in general a
finite group $G$ has \emph{periodic cohomology of period $n$} if there is an element $u\in H^n(G,\mathbb Z)$ such that the cup product $-\ \cup u\colon H^k(G,\mathbb Z) \rightarrow H^{k+n}(G,\mathbb Z)$ is an isomorphism for all $k\ge 1$. It can be shown that $G$ has periodic cohomology of period $n$ if and only if $H^{n}(G,\mathbb Z)=\mathbb Z_{|G|}$.) 

The cohomology of the cyclic group is well\texttt{\symbol{45}}known, and the
cohomology of a direct product can be obtained from that of the factors using
the Kunneth formula. 

 In the icosahedral case with $m=1$ the following commands yield
\$\$H\texttt{\symbol{94}}\texttt{\symbol{92}}ast(\texttt{\symbol{92}}Gamma,\texttt{\symbol{92}}mathbb
Z)=Z[t]/(120t=0)\$\$ with generator $t$ of degree 4. The final command demonstrates that a periodic resolution is used
in the computation. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|F:=FreeGroup(2);;x:=F.1;;y:=F.2;;A
  @gapprompt|gap>A @gapinput|G:=F/[(x*y)^2*x^-3, x^3*y^-5];;A
  @gapprompt|gap>A @gapinput|Order(G);A
  120
  @gapprompt|gap>A @gapinput|R:=ResolutionSmallGroup(G,5);;A
  @gapprompt|gap>A @gapinput|n:=0;;Cohomology(HomToIntegers(R),n);A
  [ 0 ]
  @gapprompt|gap>A @gapinput|n:=1;;Cohomology(HomToIntegers(R),n);A
  [  ]
  @gapprompt|gap>A @gapinput|n:=2;;Cohomology(HomToIntegers(R),n);A
  [  ]
  @gapprompt|gap>A @gapinput|n:=3;;Cohomology(HomToIntegers(R),n);A
  [  ]
  @gapprompt|gap>A @gapinput|n:=4;;Cohomology(HomToIntegers(R),n);A
  [ 120 ]
  
  @gapprompt|gap>A @gapinput|List([0..5],k->R!.dimension(k));A
  [ 1, 2, 2, 1, 1, 2 ]
  
\end{Verbatim}
 In the octahedral case with $m=1$ we obtain
\$\$H\texttt{\symbol{94}}\texttt{\symbol{92}}ast(\texttt{\symbol{92}}Gamma,\texttt{\symbol{92}}mathbb
Z) = \texttt{\symbol{92}}mathbb Z[s,t]/(s\texttt{\symbol{94}}2=24t, 2s=0,
48t=0)\$\$ where $s$ has degree 2 and $t$ has degree 4, from the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FreeGroup(2);;x:=F.1;;y:=F.2;;|
  !gapprompt@gap>| !gapinput@G:=F/[(x*y)^2*x^-3, x^3*y^-4];;|
  !gapprompt@gap>| !gapinput@Order(G);|
  48
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(G,5);;|
  !gapprompt@gap>| !gapinput@n:=0;;Cohomology(HomToIntegers(R),n);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@n:=1;;Cohomology(HomToIntegers(R),n);|
  [  ]
  !gapprompt@gap>| !gapinput@n:=2;;Cohomology(HomToIntegers(R),n);|
  [ 2 ]
  !gapprompt@gap>| !gapinput@n:=3;;Cohomology(HomToIntegers(R),n);|
  [  ]
  !gapprompt@gap>| !gapinput@n:=4;;Cohomology(HomToIntegers(R),n);|
  [ 48 ]
  !gapprompt@gap>| !gapinput@IntegralCupProduct(R,[1],[1],2,2);|
  [ 24 ]
  
\end{Verbatim}
 In the tetrahedral case with $m=1$ we obtain
\$\$H\texttt{\symbol{94}}\texttt{\symbol{92}}ast(\texttt{\symbol{92}}Gamma,\texttt{\symbol{92}}mathbb
Z) = \texttt{\symbol{92}}mathbb Z[s,t]/(s\texttt{\symbol{94}}2=16t, 3s=0,
24t=0)\$\$ where $s$ has degree 2 and $t$ has degree 4, from the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FreeGroup(3);;x:=F.1;;y:=F.2;;z:=F.3;;|
  !gapprompt@gap>| !gapinput@G:=F/[(x*y)^2*x^-2, x^2*y^-2, z*x*z^-1*y^-1, z*y*z^-1*y^-1*x^-1,z^3];;|
  !gapprompt@gap>| !gapinput@Order(G);|
  24
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(G,5);;|
  !gapprompt@gap>| !gapinput@n:=1;;Cohomology(HomToIntegers(R),n);|
  [  ]
  !gapprompt@gap>| !gapinput@n:=2;;Cohomology(HomToIntegers(R),n);|
  [ 3 ]
  !gapprompt@gap>| !gapinput@n:=3;;Cohomology(HomToIntegers(R),n);|
  [  ]
  !gapprompt@gap>| !gapinput@n:=4;;Cohomology(HomToIntegers(R),n);|
  [ 24 ]
  !gapprompt@gap>| !gapinput@IntegralCupProduct(R,[1],[1],2,2);|
  [ 16 ]
  
\end{Verbatim}
 A theoretical calculation of the integral and mod\texttt{\symbol{45}}p
cohomology rings of all of these fundamental groups of spherical
3\texttt{\symbol{45}}manifolds is given in \cite{tomoda}. }

 
\section{\textcolor{Chapter }{Explicit cocycles }}\logpage{[ 7, 13, 0 ]}
\hyperdef{L}{X833A19F0791C3B06}{}
{
 Given a $\mathbb ZG$\texttt{\symbol{45}}resolution $R_\ast$ and a $\mathbb ZG$\texttt{\symbol{45}}module $A$, one defines an \emph{$n$\texttt{\symbol{45}}cocycle} to be a $\mathbb ZG$\texttt{\symbol{45}}homomorphism $f\colon R_n \rightarrow A$ for which the composite homomorphism $fd_{n+1}\colon R_{n+1}\rightarrow A$ is zero. If $R_\ast$ happens to be the standard bar resolution (i.e. the cellular chain complex of
the nerve of the group $G$ considered as a one object category) then the free $\mathbb ZG$\texttt{\symbol{45}}generators of $R_n$ are indexed by $n$\texttt{\symbol{45}}tuples $(g_1 | g_2 | \ldots | g_n)$ of elements $g_i$ in $G$. In this case we say that the $n$\texttt{\symbol{45}}cocycle is a \emph{standard n\texttt{\symbol{45}}cocycle} and we think of it as a set\texttt{\symbol{45}}theoretic function 

$f \colon G \times G \times \cdots \times G \longrightarrow A$ 

satisfying a certain algebraic cocycle condition. Bearing in mind that a
standard $n$\texttt{\symbol{45}}cocycle really just assigns an element $f(g_1, \ldots ,g_n) \in A$ to an $n$\texttt{\symbol{45}}simplex in the nerve of $G$ , the cocycle condition is a very natural one which states that \emph{$f$ must vanish on the boundary of a certain $(n+1)$\texttt{\symbol{45}}simplex}. For $n=2$ the condition is that a $2$\texttt{\symbol{45}}cocycle $f(g_1,g_2)$ must satisfy 

$g.f(h,k) + f(g,hk) = f(gh,k) + f(g,h)$ 

 for all $g,h,k \in G$. This equation is explained by the following picture. 

 

 The definition of a cocycle clearly depends on the choice of $\mathbb ZG$\texttt{\symbol{45}}resolution $R_\ast$. However, the cohomology group $H^n(G,A)$, which is a group of equivalence classes of $n$\texttt{\symbol{45}}cocycles, is independent of the choice of $R_\ast$. 

 There are some occasions when one needs explicit examples of standard
cocycles. For instance: 
\begin{itemize}
\item  Let $G$ be a finite group and $k$ a field of characteristic $0$. The group algebra $k(G)$, and the algebra $F(G)$ of functions $d_g\colon G\rightarrow k, h\rightarrow d_{g,h}$, are both Hopf algebras. The tensor product $F(G) \otimes k(G)$ also admits a Hopf algebra structure known as the quantum double $D(G)$. A twisted quantum double $D_f(G)$ was introduced by R. Dijkraaf, V. Pasquier \& P. Roche \cite{dpr}. The twisted double is a quasi\texttt{\symbol{45}}Hopf algebra depending on a $3$\texttt{\symbol{45}}cocycle $f\colon G\times G\times G\rightarrow k$. The multiplication is given by $(d_g \otimes x)(d_h \otimes y) = d_{gx,xh}\beta_g(x,y)(d_g \otimes xy)$ where $\beta_a $ is defined by $\beta_a(h,g) = f(a,h,g) f(h,h^{-1}ah,g)^{-1} f(h,g,(hg)^{-1}ahg)$ . Although the algebraic structure of $D_f(G)$ depends very much on the particular $3$\texttt{\symbol{45}}cocycle $f$, representation\texttt{\symbol{45}}theoretic properties of $D_f(G)$ depend only on the cohomology class of $f$. 
\item  An explicit $2$\texttt{\symbol{45}}cocycle $f\colon G\times G\rightarrow A$ is needed to construct the multiplication $(a,g)(a',g') = (a + g\cdot a' + f(g,g'), gg')$ in the extension a group $G$ by a $\mathbb ZG$\texttt{\symbol{45}}module $A$ determined by the cohomology class of $f$ in $H^2(G,A)$. See \ref{secExtensions}. 
\item  In work on coding theory and Hadamard matrices a number of papers have
investigated square matrices $(a_{ij})$ whose entries $a_{ij}=f(g_i,g_j)$ are the values of a $2$\texttt{\symbol{45}}cocycle $f\colon G\times G \rightarrow \mathbb Z_2$ where $G$ is a finite group acting trivially on $\mathbb Z_2$. See for instance \cite{horadam} and \ref{secHadamard}. 
\end{itemize}
 

 Given a $\mathbb ZG$\texttt{\symbol{45}}resolution $R_\ast$ (with contracting homotopy) and a $\mathbb ZG$\texttt{\symbol{45}}module $A$ one can use HAP commands to compute explicit standard $n$\texttt{\symbol{45}}cocycles $f\colon G^n \rightarrow A$. With the twisted quantum double in mind, we illustrate the computation for $n=3$, $G=S_3$, and $A=U(1)$ the group of complex numbers of modulus $1$ with trivial $G$\texttt{\symbol{45}}action. 

 We first compute a $\mathbb ZG$\texttt{\symbol{45}}resolution $R_\ast$. The Universal Coefficient Theorem gives an isomorphism $H_3(G,U(1)) = Hom_{\mathbb Z}(H_3(G,\mathbb Z), U(1))$, The multiplicative group $U(1)$ can thus be viewed as $\mathbb Z_m$ where $m$ is a multiple of the exponent of $H_3(G,\mathbb Z)$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|G:=SymmetricGroup(3);;A
  @gapprompt|gap>A @gapinput|R:=ResolutionFiniteGroup(G,4);;A
  @gapprompt|gap>A @gapinput|TR:=TensorWithIntegers(R);;A
  @gapprompt|gap>A @gapinput|Homology(TR,3);A
  [ 6 ]
  @gapprompt|gap>A @gapinput|R!.dimension(3);A
  4
  @gapprompt|gap>A @gapinput|R!.dimension(4);A
  5
  
\end{Verbatim}
 

 We thus replace the very infinite group U(1) by the finite cyclic group $\mathbb Z_6$. Since the resolution $R_\ast $ has $4$ generators in degree $3$, a homomorphism $f\colon R^3\rightarrow U(1)$ can be represented by a list $f=[f_1, f_2, f_3, f_4]$ with $f_i$ the image in $\mathbb Z_6$ of the $i$th generator. The cocycle condition on $f$ can be expressed as a matrix equation 

$Mf^t = 0 \bmod 6$. 

 where the matrix $M$ is obtained from the following command and $f^t$ denotes the transpose. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=CocycleCondition(R,3);;|
  
\end{Verbatim}
 A particular cocycle $f=[f_1, f_2, f_3, f_4]$ can be obtained by choosing a solution to the equation
Mf\texttt{\symbol{94}}t=0. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@SolutionsMod2:=NullspaceModQ(TransposedMat(M),2);|
  [ [ 0, 0, 0, 0 ], [ 0, 0, 1, 1 ], [ 1, 1, 0, 0 ], [ 1, 1, 1, 1 ] ]
  
  !gapprompt@gap>| !gapinput@SolutionsMod3:=NullspaceModQ(TransposedMat(M),3);|
  [ [ 0, 0, 0, 0 ], [ 0, 0, 0, 1 ], [ 0, 0, 0, 2 ], [ 0, 0, 1, 0 ],
    [ 0, 0, 1, 1 ], [ 0, 0, 1, 2 ], [ 0, 0, 2, 0 ], [ 0, 0, 2, 1 ],
    [ 0, 0, 2, 2 ] ]
  
\end{Verbatim}
 A non\texttt{\symbol{45}}standard $3$\texttt{\symbol{45}}cocycle $f$ can be converted to a standard one using the command \texttt{StandardCocycle(R,f,n,q)} . This command inputs $ R_\ast$, integers $n$ and $q$, and an $n$\texttt{\symbol{45}}cocycle $f$ for the resolution $R_\ast$. It returns a standard cocycle $G^n \rightarrow \mathbb Z_q$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@f:=3*SolutionsMod2[3] - SolutionsMod3[5];   #An example solution to Mf=0 mod 6.|
  [ 3, 3, -1, -1 ]
  
  !gapprompt@gap>| !gapinput@Standard_f:=StandardCocycle(R,f,3,6);;|
  
  !gapprompt@gap>| !gapinput@g:=Random(G); h:=Random(G); k:=Random(G);|
  (1,2)
  (1,3,2)
  (1,3)
  
  !gapprompt@gap>| !gapinput@Standard_f(g,h,k);|
  3
  
\end{Verbatim}
 A function $f\colon G\times G\times G \rightarrow A$ is a standard $3$\texttt{\symbol{45}}cocycle if and only if 

$g\cdot f(h,k,l) - f(gh,k,l) + f(g,hk,l) - f(g,h,kl) + f(g,h,k) = 0$ 

for all $g,h,k,l \in G$. In the above example the group $G=S_3$ acts trivially on $A=Z_6$. The following commands show that the standard $3$\texttt{\symbol{45}}cocycle produced in the example really does satisfy this $3$\texttt{\symbol{45}}cocycle condition. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@sf:=Standard_f;;|
  
  !gapprompt@gap>| !gapinput@Test:=function(g,h,k,l);|
  !gapprompt@>| !gapinput@return sf(h,k,l) - sf(g*h,k,l) + sf(g,h*k,l) - sf(g,h,k*l) + sf(g,h,k);|
  !gapprompt@>| !gapinput@end;|
  function( g, h, k, l ) ... end
  
  !gapprompt@gap>| !gapinput@for g in G do for h in G do for k in G do for l in G do|
  !gapprompt@>| !gapinput@Print(Test(g,h,k,l),",");|
  !gapprompt@>| !gapinput@od;od;od;od;|
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,6,6,0,0,6,
  0,0,0,0,0,6,6,6,0,6,0,12,12,6,12,6,0,12,6,0,6,6,0,0,0,0,0,0,0,12,12,6,6,6,0,
  6,6,0,6,6,0,0,-6,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,0,0,0,0,0,0,0,6,0,0,6,6,0,6,6,
  0,6,0,0,6,6,6,0,0,0,0,0,0,0,-6,0,0,-6,0,-6,0,0,0,0,0,0,0,0,6,6,0,6,0,0,6,0,0,
  0,0,0,6,6,6,0,0,0,6,6,6,0,0,0,0,-6,0,6,6,0,0,0,0,0,0,0,12,6,6,0,6,0,0,0,0,12,
  6,0,0,0,0,0,0,0,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,6,0,0,6,0,0,0,0,0,6,6,
  6,0,0,0,6,12,6,6,0,0,0,-6,0,0,6,0,0,0,0,0,0,0,12,12,6,6,6,0,0,0,0,6,6,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,6,0,6,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,0,
  6,6,0,6,6,0,12,12,6,12,12,0,0,0,0,0,0,0,6,6,0,0,0,0,6,6,6,12,12,0,-6,-6,0,0,
  0,0,6,6,0,0,6,0,0,6,0,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,
  0,6,0,0,6,0,0,0,0,0,0,0,0,0,0,0,6,6,0,6,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,6,6,0,6,6,0,6,0,0,6,6,6,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,0,0,0,0,0,0,0,6,6,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,-6,0,6,0,6,0,6,0,0,0,0,0,0,0,12,12,6,12,12,0,6,6,0,6,6,0,
  0,0,0,0,0,0,12,12,6,12,12,0,6,6,0,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,0,
  0,0,0,0,0,0,6,0,0,6,6,0,6,6,0,6,0,0,6,6,6,0,0,0,-6,0,0,0,-6,0,0,-6,0,-6,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,0,6,6,0,0,0,0,0,0,0,6,6,0,0,0,
  0,0,0,0,6,6,0,-6,0,0,-6,0,0,12,6,0,-6,-6,0,0,0,0,6,6,0,0,6,0,0,6,0,6,6,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,-6,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,0,6,12,0,6,0,0,6,0,0,0,6,0,0,0,0,0,0,
  0,6,12,0,0,0,0,0,0,0,6,6,0,-6,-6,0,0,0,0,0,0,0,0,6,0,0,6,0,6,6,0,0,0,0,0,0,0,
  6,0,0,0,6,0,0,6,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,
  0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,6,6,0,6,6,0,6,6,6,12,12,0,0,0,0,0,0,0,6,6,0,
  6,6,0,6,6,6,12,12,0,0,0,0,0,0,0,6,6,0,0,6,0,0,6,0,6,6,
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Quillen's complex and the $p$\texttt{\symbol{45}}part of homology }}\label{secWebb}
\logpage{[ 7, 14, 0 ]}
\hyperdef{L}{X7C5233E27D2D603E}{}
{
 Let $G$ be a finite group with order divisible by prime $p$. Let ${\mathcal A}={\mathcal A}_p(G)$ denote Quillen's simplicial complex arising as the order complex of the poset
of non\texttt{\symbol{45}}trivial elementary abelian $p$\texttt{\symbol{45}}subgroups of $G$. The group $G$ acts on $\mathcal A$. Denote the orbit of a $k$\texttt{\symbol{45}}simplex $e^k$ by $[e^k]$, and the stabilizer of $e^k$ by $Stab(e^k) \le G$. For a finite abelian group $H$ let $H_p$ denote the Sylow $p$\texttt{\symbol{45}}subgroup or the "$p$\texttt{\symbol{45}}part". In Theorem 3.3 of \cite{Webb} P.J. Webb proved the following. 

 \textsc{Theorem.}\cite{Webb} For any $G$\texttt{\symbol{45}}module $M$ there is a (non natural) isomomorphism

 $H_n(G,M)_p \oplus \bigoplus_{[e^k]\, :\, k~{\rm odd}~}H_n(Stab(e^k),M)_p \cong
\bigoplus_{[e^k]\, : \, k~{\rm even}~}H_n(Stab(e^k),M)_p$ 

 for $n\ge 1$. The isomorphism can also be expressed as 

 $H_n(G,M)_p \cong \bigoplus_{[e^k]\, : \, k~{\rm even}~}H_n(Stab(e^k),M)_p\ -\
\bigoplus_{[e^k] \, :\, k~{\rm odd}~}H_n(Stab(e^k),M)_p$ 

where terms can often be cancelled. 

Thus the additive structure of the $p$\texttt{\symbol{45}}part of the homology of $G$ is determined by that of the stabilizer groups. The result also holds with
homology replaced by cohomology. 

\textsc{Illustration 1} 

 As an illustration of the theorem, the following commands calculate 

 $H_n(SL_3(\mathbb Z_2),\mathbb Z) \cong H_n(S_4,\mathbb Z)_2 \oplus
H_n(S_4,\mathbb Z)_2 \ominus H_n(D_8,\mathbb Z)_2 \oplus H_n(S_3,\mathbb Z)_3
\oplus H_n(C_7 : C_3,\mathbb Z)_7 $ 

 where $n\ge 1$, $S_k$ denotes the symmetric group on $n$ letters, $D_8$ the dihedral group of order $8$ and $C_7 : C_3$ a nonabelian semi\texttt{\symbol{45}}direct product of cyclic groups.
Furthermore, for $n\ge 1$ 

$ H_n(C_7 : C_3,\mathbb Z)_7 =\left\{\begin{array}{ll}\mathbb Z_7,\ n \equiv 5
{\rm \ mod\ } 6\\ 0,\ {\rm otherwise} \end{array}\right.$ 

and 

$ H_n(S_3,\mathbb Z)_3 =\left\{\begin{array}{ll}\mathbb Z_3,\ n \equiv 3 {\rm \
mod\ } 4\\ 0,\ n{\rm ~otherwise .} \end{array}\right.$ 

 Formulas for $H_n(S_4,\mathbb Z)$ and $ H_n(D_8,\mathbb Z)$ can be found in the literature. Alternatively, they can be computed using \textsc{GAP} for a given value of $n$. For $n=27$ we find 

$ H_{27}(S_4,\mathbb Z)_2 \oplus H_{27}(S_4,\mathbb Z)_2 \ominus
H_{27}(D_8,\mathbb Z)_2 \cong \mathbb Z_2 \oplus \mathbb Z_2 \oplus \mathbb
Z_2 \oplus \mathbb Z_2 \oplus \mathbb Z_4$ 

 and 

$H_{27}(SL_3(\mathbb Z_2),\mathbb Z) \cong \mathbb Z_2 \oplus \mathbb Z_2
\oplus \mathbb Z_2 \oplus \mathbb Z_2 \oplus \mathbb Z_4 \oplus \mathbb Z_3 $ . 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SL(3,2);;Factors(Order(G));|
  [ 2, 2, 2, 3, 7 ]
  !gapprompt@gap>| !gapinput@D2:=HomologicalGroupDecomposition(G,2);;|
  !gapprompt@gap>| !gapinput@D3:=HomologicalGroupDecomposition(G,3);;|
  !gapprompt@gap>| !gapinput@D7:=HomologicalGroupDecomposition(G,7);;|
  !gapprompt@gap>| !gapinput@List(D2[1],StructureDescription);|
  [ "S4", "S4" ]
  !gapprompt@gap>| !gapinput@List(D2[2],StructureDescription);|
  [ "D8" ]
  !gapprompt@gap>| !gapinput@List(D3[1],StructureDescription);|
  [ "S3" ]
  !gapprompt@gap>| !gapinput@List(D3[2],StructureDescription);|
  [  ]
  !gapprompt@gap>| !gapinput@List(D7[1],StructureDescription);|
  [ "C7 : C3" ]
  !gapprompt@gap>| !gapinput@List(D7[2],StructureDescription);|
  [  ]
  
  !gapprompt@gap>| !gapinput@CohomologicalPeriod(D7[1][1]);|
  6
  !gapprompt@gap>| !gapinput@List([1..6],n->GroupHomology(D7[1][1],n));|
  [ [ 3 ], [  ], [ 3 ], [  ], [ 3, 7 ], [  ] ]
  
  !gapprompt@gap>| !gapinput@CohomologicalPeriod(D3[1][1]);|
  4
  !gapprompt@gap>| !gapinput@List([1..4],n->GroupHomology(D3[1][1],n));|
  [ [ 2 ], [  ], [ 6 ], [  ] ]
  
  !gapprompt@gap>| !gapinput@R_S4:=ResolutionFiniteGroup(Group([(1,2),(2,3),(3,4)]),28);;|
  !gapprompt@gap>| !gapinput@R_D8:=ResolutionFiniteGroup(Group([(1,2),(1,3)(2,4)]),28);;|
  
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R_S4),27);|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 12 ]
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R_D8),27);|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4 ]
  
\end{Verbatim}
 

\textsc{Illustration 2} 

 As a further illustration of the theorem, the following commands calculate 

 $H_n(M_{12},M)_3 \cong \bigoplus_{1\le i\le 3}\,H_n(Stab_i,M)_3 -
\bigoplus_{4\le i\le 5}H_n(Stab_i,M)_3$ 

 for the Mathieu simple group $M_{12}$ of order $95040$, where 

$Stab_1\cong Stab_3=(((C_3 \times C_3) : Q_8) : C_3) : C_2$ 

$Stab_2=A_4 \times S_3$ 

$Stab_4=C_3 \times S_3$ 

$Stab_5=((C_3 \times C_3) : C_3) : (C_2 \times C_2)$ . 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=MathieuGroup(12);;|
  !gapprompt@gap>| !gapinput@D:=HomologicalGroupDecomposition(G,3);;|
  !gapprompt@gap>| !gapinput@List(D[1],StructureDescription);|
  [ "(((C3 x C3) : Q8) : C3) : C2", "A4 x S3", "(((C3 x C3) : Q8) : C3) : C2" ]
  !gapprompt@gap>| !gapinput@List(D[2],StructureDescription);|
  [ "C3 x S3", "((C3 x C3) : C3) : (C2 x C2)" ]
  
\end{Verbatim}
 

\textsc{Illustration 3} 

 As a third illustration, the following commands show that $H_n(M_{23},M)_{p}$ is periodic for primes $p=5, 7, 11, 23$ of periods dividing $8, 6, 10, 22$ respectively. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=MathieuGroup(23);;|
  !gapprompt@gap>| !gapinput@Factors(Order(G));|
  [ 2, 2, 2, 2, 2, 2, 2, 3, 3, 5, 7, 11, 23 ]
  
  !gapprompt@gap>| !gapinput@sd:=StructureDescription;;|
  
  !gapprompt@gap>| !gapinput@D:=HomologicalGroupDecomposition(G,5);;|
  !gapprompt@gap>| !gapinput@List(D[1],sd);List(D[2],sd);|
  [ "C15 : C4" ]
  [  ]
  !gapprompt@gap>| !gapinput@IsPeriodic(D[1][1]);|
  true
  !gapprompt@gap>| !gapinput@CohomologicalPeriod(D[1][1]);|
  8
  
  !gapprompt@gap>| !gapinput@D:=HomologicalGroupDecomposition(G,7);;|
  !gapprompt@gap>| !gapinput@List(D[1],sd);List(D[2],sd);|
  [ "C2 x (C7 : C3)" ]
  [  ]
  !gapprompt@gap>| !gapinput@IsPeriodic(D[1][1]);|
  true
  !gapprompt@gap>| !gapinput@CohomologicalPeriod(D[1][1]);|
  6
  
  !gapprompt@gap>| !gapinput@D:=HomologicalGroupDecomposition(G,11);;|
  !gapprompt@gap>| !gapinput@List(D[1],sd);List(D[2],sd);|
  [ "C11 : C5" ]
  [  ]
  !gapprompt@gap>| !gapinput@IsPeriodic(D[1][1]);|
  true
  !gapprompt@gap>| !gapinput@CohomologicalPeriod(D[1][1]);|
  10
  
  !gapprompt@gap>| !gapinput@D:=HomologicalGroupDecomposition(G,23);;|
  !gapprompt@gap>| !gapinput@List(D[1],sd);List(D[2],sd);|
  [ "C23 : C11" ]
  [  ]
  !gapprompt@gap>| !gapinput@IsPeriodic(D[1][1]);|
  true
  !gapprompt@gap>| !gapinput@CohomologicalPeriod(D[1][1]);|
  22
  
\end{Verbatim}
 

The order $|M_{23}|=10200960$ is divisible by primes $p=2, 3, 5, 7, 11, 23$. For $p=3$ the following commands establish that the Poincare series 

$(x^{16} - 2x^{15}$ $ + 3x^{14} - 4x^{13}$ $ + 4x^{12} - 4x^{11}$ $ + 4x^{10} - 3x^9$ $ + 3x^8 - 3x^7 +$ $ 4x^6 - 4x^5 $ $+ 4x^4 -4x^3$ $ + 3x^2 -2x + 1) /$ $ (x^{18} - 2x^{17}$ $ + 3x^{16} - 4x^{15}$ $ + 4x^{14} - $ $4x^{13} + 4x^{12}$ $ - 4x^{11} + 4x^{10}$ $ - 4x^9 + 4x^8$ $ - 4x^7 + 4x^6 $ $ - 4x^5 + 4x^4$ $ - 4x^3 +$ $ 3x^2 - 2x + 1)$ 

describes the dimension of the vector space $H^n(M_{23},\mathbb Z_3)$ up to at least degree $n=40$. To prove that it describes the dimension in all degrees one would need to
verify "completion criteria". 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=MathieuGroup(23);;|
  !gapprompt@gap>| !gapinput@D:=HomologicalGroupDecomposition(G,3);;|
  !gapprompt@gap>| !gapinput@List(D[1],StructureDescription);|
  [ "(C3 x C3) : QD16", "A5 : S3" ]
  !gapprompt@gap>| !gapinput@List(D[2],StructureDescription);|
  [ "S3 x S3" ]
  
  !gapprompt@gap>| !gapinput@P1:=PoincareSeriesPrimePart(D[1][1],3,40);|
  (x_1^16-2*x_1^15+3*x_1^14-4*x_1^13+4*x_1^12-4*x_1^11+4*x_1^10-3*x_1^9+3*x_1^8-3*x_1^7+4*x_1^6-4*x_1^5+\
  4*x_1^4-4*x_1^3+3*x_1^2-2*x_1+1)/(x_1^18-2*x_1^17+3*x_1^16-4*x_1^15+4*x_1^14-4*x_1^13+4*x_1^12-4*x_1^1\
  1+4*x_1^10-4*x_1^9+4*x_1^8-4*x_1^7+4*x_1^6-4*x_1^5+4*x_1^4-4*x_1^3+3*x_1^2-2*x_1+1)
  
  !gapprompt@gap>| !gapinput@P2:=PoincareSeriesPrimePart(D[1][2],3,40);|
  (x_1^4-2*x_1^3+3*x_1^2-2*x_1+1)/(x_1^6-2*x_1^5+3*x_1^4-4*x_1^3+3*x_1^2-2*x_1+1)
  
  !gapprompt@gap>| !gapinput@P3:=PoincareSeriesPrimePart(D[2][1],3,40);|
  (x_1^4-2*x_1^3+3*x_1^2-2*x_1+1)/(x_1^6-2*x_1^5+3*x_1^4-4*x_1^3+3*x_1^2-2*x_1+1)
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Homology of a Lie algebra}}\logpage{[ 7, 15, 0 ]}
\hyperdef{L}{X865CC8E0794C0E61}{}
{
 Let $A$ be the Lie algebra constructed from the associative algebra $M^{4\times 4}(\mathbb Q)$ of all $4\times 4$ rational matrices. Let $V$ be its adjoint module (with underlying vector space of dimension $16$ and equal to that of $A$). The following commands compute $H_{4}(A,V) = \mathbb Q$. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|M:=FullMatrixAlgebra(Rationals,4);; B
  @gapprompt|gap>B @gapinput|A:=LieAlgebra(M);;B
  @gapprompt|gap>B @gapinput|V:=AdjointModule(A);;B
  @gapprompt|gap>B @gapinput|C:=ChevalleyEilenbergComplex(V,17);;B
  @gapprompt|gap>B @gapinput|List([0..17],C!.dimension);B
  [ 16, 256, 1920, 8960, 29120, 69888, 128128, 183040, 205920, 183040, 128128, 
    69888, 29120, 8960, 1920, 256, 16, 0 ]
  @gapprompt|gap>B @gapinput|Homology(C,4);B
  1
  
\end{Verbatim}
 

Note that the eighth term $C_{8}(V)$ in the Chevalley\texttt{\symbol{45}}Eilenberg complex $C_\ast(V)$ is a vector space of dimension $205920$ and so it will take longer to compute the homology in degree $8$. 

As a second example, let $B$ be the classical Lie ring of type $B_3$ over the ring of integers. The following commands compute $H_3(B,\mathbb Z)= \mathbb Z \oplus \mathbb Z_2^{105}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=SimpleLieAlgebra("B",7,Integers);       |
  <Lie algebra of dimension 105 over Integers>
  !gapprompt@gap>| !gapinput@C:=ChevalleyEilenbergComplex(A,4,"sparse");|
  Sparse chain complex of length 4 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@D:=ContractedComplex(C);|
  Sparse chain complex of length 4 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Collected(Homology(D,3));|
  [ [ 0, 1 ], [ 2, 105 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Covers of Lie algebras}}\logpage{[ 7, 16, 0 ]}
\hyperdef{L}{X86B4EE4783A244F7}{}
{
 A short exact sequence of Lie algebras 

$ M \rightarrowtail C \twoheadrightarrow L $ 

 (over a field $k$) is said to be a \emph{stem extension} of $L$ if $M$ lies both in the centre $Z(C)$ and in the derived subalgeba $C^2$. If, in addition, the rank of the vector space $M$ is equal to the rank of the second Chevalley\texttt{\symbol{45}}Eilenberg
homology $H_2(L,k)$ then the Lie algebra $C$ is said to be a \emph{cover} of $L$. 

Each finite dimensional Lie algebra $L$ admits a cover $C$, and this cover can be shown to be unique up to Lie isomorphism. 

The cover can be used to determine whether there exists a Lie algebra $E$ whose central quotient $E/Z(E)$ is isomorphic to $L$. The image in $L$ of the centre of $C$ is called the \emph{Lie Epicentre} of $L$, and this image is trivial if and only if such an $E$ exists. 

The cover can also be used to determine the stem extensions of $L$. It can be shown that each stem extension is a quotient of the cover by an
ideal in the Lie multiplier $H_2(L,k)$. 
\subsection{\textcolor{Chapter }{Computing a cover}}\logpage{[ 7, 16, 1 ]}
\hyperdef{L}{X7DFF32A67FF39C82}{}
{
 The following commands compute the cover $C$ of the solvable but non\texttt{\symbol{45}}nilpotent
13\texttt{\symbol{45}}dimensional Lie algebra $L$ (over $k=\mathbb Q$) that was introduced by M. Wuestner \cite{Wustner}. They also show that: the second homology of $C$ is trivial and compute the ranks of the homology groups in other dimensions;
the Lie algebra $L$ is not isomorphic to any central quotient $E/Z(E)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@SCTL:=EmptySCTable(13,0,"antisymmetric");;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 1, 6, [ 1, 7 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 1, 8, [ 1, 9 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 1, 10, [ 1, 11 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 1, 12, [ 1, 13 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 1, 7, [ -1, 6 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 1, 9, [ -1, 8 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 1, 11, [ -1, 10 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 1, 13, [ -1, 12 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 6, 7, [ 1, 2 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 8, 9, [ 1, 3 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 6, 9, [ -1, 5 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 7, 8, [ 1, 5 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 2, 8, [ 1, 12 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 2, 9, [ 1, 13 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 3, 6, [ 1, 10 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 3, 7, [ 1, 11 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 2, 3, [ 1, 4 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 5, 6, [ -1, 12 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 5, 7, [ -1, 13 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 5, 8, [ -1, 10 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 5, 9, [ -1, 11 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 6, 11, [ -1/2, 4 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 7, 10, [ 1/2, 4 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 8, 13, [ 1/2, 4 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 9, 12, [ -1/2, 4 ] );;|
  !gapprompt@gap>| !gapinput@L:=LieAlgebraByStructureConstants(Rationals,SCTL);;|
  
  !gapprompt@gap>| !gapinput@C:=Source(LieCoveringHomomorphism(L));|
  <Lie algebra of dimension 15 over Rationals>
  
  !gapprompt@gap>| !gapinput@Dimension(LieEpiCentre(L));|
  1
  
  !gapprompt@gap>| !gapinput@ch:=ChevalleyEilenbergComplex(C,17);;|
  !gapprompt@gap>| !gapinput@List([0..16],n->Homology(ch,n));     |
  [ 1, 1, 0, 9, 23, 27, 47, 88, 88, 47, 27, 23, 9, 0, 1, 1, 0 ]
  
\end{Verbatim}
 }

 }

 }

 
\chapter{\textcolor{Chapter }{Cohomology rings and Steenrod operations for groups}}\logpage{[ 8, 0, 0 ]}
\hyperdef{L}{X7ED29A58858AAAF2}{}
{
 
\section{\textcolor{Chapter }{Mod\texttt{\symbol{45}}$p$ cohomology rings of finite groups}}\logpage{[ 8, 1, 0 ]}
\hyperdef{L}{X877CAF8B7E64DE04}{}
{
 For a finite group $G$, prime $p$ and positive integer $deg$ the function \texttt{ModPCohomologyRing(G,p,deg)} computes a finite dimensional graded ring equal to the cohomology ring $H^{\le deg}(G,\mathbb Z_p) := H^\ast(G,\mathbb Z_p)/\{x=0\ :\ {\rm
degree}(x)>deg \}$ . 

The following example computes the first $14$ degrees of the cohomology ring $H^\ast(M_{11},\mathbb Z_2)$ where $M_{11}$ is the Mathieu group of order $7920$. The ring is seen to be generated by three elements $a_3, a_4, a_6$ in degrees $3,4,5$. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|G:=MathieuGroup(11);;          B
  @gapprompt|gap>B @gapinput|p:=2;;deg:=14;;B
  @gapprompt|gap>B @gapinput|A:=ModPCohomologyRing(G,p,deg);B
  <algebra over GF(2), with 20 generators>
  
  @gapprompt|gap>B @gapinput|gns:=ModPRingGenerators(A);B
  [ v.1, v.6, v.8+v.10, v.13 ]
  @gapprompt|gap>B @gapinput|List(gns,A!.degree);B
  [ 0, 3, 4, 5 ]
  
\end{Verbatim}
 

The following additional command produces a rational function $f(x)$ whose series expansion $f(x) = \sum_{i=0}^\infty f_ix^i$ has coefficients $f_i$ which are guaranteed to satisfy $f_i = \dim H^i(G,\mathbb Z_p)$ in the range $0\le i\le deg$. We refer to $f(x)$ as the \emph{Poincare series} for the group at the prime $p=2$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@f:=PoincareSeries(A);|
  (x_1^4-x_1^3+x_1^2-x_1+1)/(x_1^6-x_1^5+x_1^4-2*x_1^3+x_1^2-x_1+1)
  
  
  !gapprompt@gap>| !gapinput@Let's use f to list the first few cohomology dimensions|
  !gapprompt@gap>| !gapinput@ExpansionOfRationalFunction(f,deg); |
  [ 1, 0, 0, 1, 1, 1, 1, 1, 2, 2, 1, 2, 3, 2, 2 ]
  
\end{Verbatim}
 An alternative command for computing the Poincare series is the following. In
this alternative we choose to ensure correctness in degrees $\le 100$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@PoincareSeriesPrimePart(MathieuGroup(11),2,100);|
  The series is guaranteed correct for group cohomology in degrees < 101
  (x_1^4-x_1^3+x_1^2-x_1+1)/(x_1^6-x_1^5+x_1^4-2*x_1^3+x_1^2-x_1+1)
  
\end{Verbatim}
 If one needs to verify that the Poincare series is valid in all degrees then
more work is required. One readily implemented (but computationally
non\texttt{\symbol{45}}optimal) approach is to use Peter Symmonds result \cite{Symmonds} that: if a non\texttt{\symbol{45}}cyclic finite group $G$ has a faithful complex representation equal to a sum of irreducibles of
dimensions $n_i$ then the cohomology ring $H^\ast(G,\mathbb Z_p)$ is generated by elements of degree at most $\sum n_i^2$; a degree bound for the relations is $2 \sum n_i^2$. The following commands use this bound, in conjunction with Webb's result \ref{secWebb} on the Quillen complex, to obtained a Poincare series that is guaranteed
correct in all degree. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=MathieuGroup(11);;|
  !gapprompt@gap>| !gapinput@h:=HomologicalGroupDecomposition(G,2);;|
  
  !gapprompt@gap>| !gapinput@ModPCohomologyPresentationBounds(h[1][1]);|
  rec( generators_degree_bound := 4, relators_degree_bound := 8 )
  !gapprompt@gap>| !gapinput@A:=ModPCohomologyRing(h[1][1],2,9);;F:=PresentationOfGradedStructureConstantAlgebra(A);;f11:=HilbertPoincareSeries(F);|
  (x_1^2-x_1+1)/(x_1^4-2*x_1^3+2*x_1^2-2*x_1+1)
  
  !gapprompt@gap>| !gapinput@ModPCohomologyPresentationBounds(h[1][2]);|
  rec( generators_degree_bound := 9, relators_degree_bound := 18 )
  !gapprompt@gap>| !gapinput@A:=ModPCohomologyRing(h[1][2],2,19);;F:=PresentationOfGradedStructureConstantAlgebra(A);;f12:=HilbertPoincareSeries(F);|
  (x_1^2+1)/(x_1^4-x_1^3-x_1+1)
  
  !gapprompt@gap>| !gapinput@ModPCohomologyPresentationBounds(h[2][1]);|
  rec( generators_degree_bound := 4, relators_degree_bound := 8 )
  !gapprompt@gap>| !gapinput@A:=ModPCohomologyRing(h[2][1],2,9);;F:=PresentationOfGradedStructureConstantAlgebra(A);;f21:=HilbertPoincareSeries(F);|
  (1)/(x_1^2-2*x_1+1)
  
  !gapprompt@gap>| !gapinput@f11+f12-f21;|
  (x_1^4-x_1^3+x_1^2-x_1+1)/(x_1^6-x_1^5+x_1^4-2*x_1^3+x_1^2-x_1+1)
  
\end{Verbatim}
 
\subsection{\textcolor{Chapter }{Ring presentations (for the commutative $p=2$ case)}}\logpage{[ 8, 1, 1 ]}
\hyperdef{L}{X870E0299782638AF}{}
{
 The cohomology ring $H^\ast(G,\mathbb Z_p)$ is graded commutative which, in the case $p=2$, implies strictly commutative. The following additional commands can be
applied in the $p=2$ setting to determine a presentation for a graded commutative ring $F$ that is guaranteed to be isomorphic to the cohomology ring $H^\ast(G,\mathbb Z_p)$ in degrees $i\le deg$. If $deg$ is chosen "sufficiently large" then $F$ will be isomorphic to the cohomology ring. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=PresentationOfGradedStructureConstantAlgebra(A);|
  Graded algebra GF(2)[ x_1, x_2, x_3 ] / [ x_1^2*x_2+x_3^2 
   ] with indeterminate degrees [ 3, 4, 5 ]
  
\end{Verbatim}
 

 The additional command 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@p:=HilbertPoincareSeries(F);|
  (x_1^4-x_1^3+x_1^2-x_1+1)/(x_1^6-x_1^5+x_1^4-2*x_1^3+x_1^2-x_1+1)
  
\end{Verbatim}
 invokes a call to \textsc{Singular} in order to calculate the Poincare series of the graded algebra $F$. }

 }

 
\section{\textcolor{Chapter }{Poincare Series for Mod\texttt{\symbol{45}}$p$ cohomology}}\logpage{[ 8, 2, 0 ]}
\hyperdef{L}{X862538218748627F}{}
{
 For a finite $p$\texttt{\symbol{45}}group $G$ the command \texttt{PoincarePolynomial(G)} returns a rational function $f(x)=p(x)/q(x)$ whose series expansion $f(x) = \sum_{i=0}^\infty f_ix^i$ has coefficients $f_i$ that are guaranteed to satisfy $f_i = \dim H^i(G,\mathbb Z_p)$ in the range $0\le i < 1+ deg$ for some displayed value of $deg$. Furthermore, the coefficients $f_i$ are guaranteed to be integers for all $0\le i\le 1000$ and the order of the pole of $f(x)$ at $x=1$ is guaranteed to equal the $p$\texttt{\symbol{45}}rank of $G$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SmallGroup(3^4,10);;|
  !gapprompt@gap>| !gapinput@StructureDescription(G);|
  "C3 . ((C3 x C3) : C3) = (C3 x C3) . (C3 x C3)"
  !gapprompt@gap>| !gapinput@f:=PoincareSeries(G);|
  The series is guaranteed correct for group cohomology in degrees < 14
  (-x_1^3+x_1^2+1)/(x_1^6-2*x_1^5+2*x_1^4-2*x_1^3+2*x_1^2-2*x_1+1)
  
\end{Verbatim}
 

If a higher value of $deg$ is required then this can be entered as an optional second argument. For
instance, the following increases the value to $deg=100$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@f:=PoincareSeries(G,100);|
  The series is guaranteed correct for group cohomology in degrees < 101
  (-x_1^3+x_1^2+1)/(x_1^6-2*x_1^5+2*x_1^4-2*x_1^3+2*x_1^2-2*x_1+1)
  
\end{Verbatim}
 

 As mentioned above, one approach to verifying that the Poincare series is
valid in all degrees is to use Peter Symmonds result \cite{Symmonds} that: if a non\texttt{\symbol{45}}cyclic finite group $G$ has a faithful complex representation equal to a sum of irreducibles of
dimensions $n_i$ then the cohomology ring $H^\ast(G,\mathbb Z_p)$ is generated by elements of degree at most $\sum n_i^2$; a degree bound for the relations is $2 \sum n_i^2$. Thus, if we use at least $\sum n_i^2$ degrees of a resolution to construct a presentation for the cohomology ring
then the presented ring maps surjectively onto the actual cohomology ring.
Furthermore, if this surjection is a bijection in the first $2 \sum n_i^2$ degrees then it is necessarily an isomorphism in all degrees. 

 The following commands use this approach to obtain a guaranteed presentation
and Poincare series for the Sylow $2$\texttt{\symbol{45}}subgroup of the Mathieu group $M_{12}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SylowSubgroup(MathieuGroup(12),2);;|
  !gapprompt@gap>| !gapinput@ModPCohomologyPresentationBounds(G);|
  rec( generators_degree_bound := 16, relators_degree_bound := 32 )
  !gapprompt@gap>| !gapinput@A:=ModPCohomologyRing(G,16);;|
  !gapprompt@gap>| !gapinput@F:=PresentationOfGradedStructureConstantAlgebra(A);|
  Graded algebra GF(2)[ x_1, x_2, x_3, x_4, x_5, x_6, x_7 ] / 
  [ x_1*x_3, x_1*x_2, x_1*x_4, x_2*x_3^2+x_3^3+x_3*x_4+x_3*x_5, 
    x_2*x_6+x_3*x_6+x_4*x_5, x_2*x_3*x_4+x_3^2*x_4+x_3*x_6, 
    x_2^2*x_4+x_3^2*x_4+x_3*x_6+x_4^2, x_3^2*x_6+x_3*x_4^2+x_3*x_4*x_5, 
    x_2*x_4*x_5+x_4*x_6, x_3^2*x_4*x_5+x_3*x_4*x_6+x_3*x_5*x_6, 
    x_1^3*x_6+x_1^2*x_7+x_1*x_5*x_6+x_3*x_5*x_6+x_4*x_5^2+x_6^2, 
    x_3*x_4^2*x_5+x_3*x_6^2 ] with indeterminate degrees [ 1, 1, 1, 2, 2, 3, 4 ]
  !gapprompt@gap>| !gapinput@f:=HilbertPoincareSeries(F);|
  (1)/(-x_1^3+3*x_1^2-3*x_1+1)
  
  !gapprompt@gap>| !gapinput@ff:=PoincareSeries(G,32);|
  The series is guaranteed correct for group cohomology in degrees < 33
  (1)/(-x_1^3+3*x_1^2-3*x_1+1)
  
\end{Verbatim}
 

 An alternative approach to obtaining a guaranteed presentation is to implement
Len even's spectral sequence proof of the finite generation of cohomology
rings of finite groups. The following example determines a guaranteed
presentation in this way for the cohomology ring $H^\ast(Syl_2(M_{12}),\mathbb Z_2)$. The Lyndon\texttt{\symbol{45}}Hochschild\texttt{\symbol{45}}Serre spectral
sequence, and Groebner basis routines from \textsc{Singular} (for commutative rings), are used to determine how much of a resolution is
needed to compute the guaranteed correct presentation. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SylowSubgroup(MathieuGroup(12),2);;|
  !gapprompt@gap>| !gapinput@F:=Mod2CohomologyRingPresentation(G);|
  Alpha version of completion test code will be used. This needs further work.
  Graded algebra GF(2)[ x_1, x_2, x_3, x_4, x_5, x_6, x_7 ] / 
  [ x_2*x_3, x_1*x_2, x_2*x_4, x_1^3+x_1^2*x_3+x_1*x_5, 
    x_1*x_3*x_4+x_1*x_3*x_5+x_3^2*x_4+x_1*x_6+x_3*x_6+x_4*x_5, 
    x_1^2*x_4+x_1^2*x_5+x_1*x_3*x_5+x_3^2*x_4+x_1*x_6+x_4^2, 
    x_1^2*x_3^2+x_1^2*x_5+x_1*x_3*x_5+x_1*x_6+x_3*x_6+x_4^2+x_4*x_5, 
    x_1^2*x_6+x_1*x_3*x_6+x_1*x_4*x_5+x_3^2*x_6+x_3*x_4^2+x_3*x_4*x_5, 
    x_1*x_3^2*x_5+x_3^3*x_4+x_1*x_3*x_6+x_1*x_4^2+x_3^2*x_6+x_3*x_4^2+x_4*x_6,
    x_1^2*x_3*x_5+x_1*x_3*x_6+x_1*x_4^2+x_1*x_5^2, 
    x_3^3*x_6+x_3^2*x_4^2+x_3^2*x_4*x_5+x_3*x_4*x_6+x_3*x_5*x_6+x_4^3+x_4*x_5^2, 
    x_1*x_3^2*x_6+x_1*x_4*x_6+x_2^2*x_7+x_2*x_5*x_6+x_3*x_4*x_6+x_3*x_5*x_6+x_6^2, 
    x_1^2*x_5^2+x_1*x_3*x_5^2+x_3^2*x_4^2+x_3^2*x_4*x_5+x_2^2*x_7+x_2*x_5*x_6+x_3*x_5*x_6+x_6^2 ] 
  with indeterminate degrees [ 1, 1, 1, 2, 2, 3, 4 ]
  
  !gapprompt@gap>| !gapinput@f:=HilbertPoincareSeries(F);|
  (1)/(-x_1^3+3*x_1^2-3*x_1+1)
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Functorial ring homomorphisms in Mod\texttt{\symbol{45}}$p$ cohomology}}\logpage{[ 8, 3, 0 ]}
\hyperdef{L}{X780DF87680C3F52B}{}
{
 The following example constructs the ring homomorphism 

$F\colon H^{\le deg}(G,\mathbb Z_p) \rightarrow H^{\le deg}(H,\mathbb Z_p)$ 

 induced by the group homomorphism $f\colon H\rightarrow G$ with $H=A_5$, $G=S_5$, $f$ the canonical inclusion of the alternating group into the symmetric group, $p=2$ and $deg=7$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SymmetricGroup(5);;H:=AlternatingGroup(5);;|
  !gapprompt@gap>| !gapinput@f:=GroupHomomorphismByFunction(H,G,x->x);;|
  !gapprompt@gap>| !gapinput@p:=2;; deg:=7;;|
  !gapprompt@gap>| !gapinput@F:=ModPCohomologyRing(f,p,deg);|
  [ v.1, v.2, v.4+v.6, v.5, v.7, v.8, v.9, v.12+v.15, v.13, v.14, v.16+v.17, 
    v.18, v.19, v.20, v.22+v.24+v.28, v.23, v.25, v.26, v.27 ] -> 
  [ v.1, 0*v.1, v.4+v.5+v.6, 0*v.1, v.7+v.8, 0*v.1, 0*v.1, v.14+v.15, 0*v.1, 
    0*v.1, v.16+v.17+v.19, 0*v.1, 0*v.1, 0*v.1, v.22+v.23+v.26+v.27+v.28, 
    v.25, 0*v.1, 0*v.1, 0*v.1 ]
  
\end{Verbatim}
 
\subsection{\textcolor{Chapter }{Testing homomorphism properties}}\logpage{[ 8, 3, 1 ]}
\hyperdef{L}{X834CED9D7A104695}{}
{
 

The following commands are consistent with $F$ being a ring homomorphism. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@x:=Random(Source(F));|
  v.4+v.6+v.8+v.9+v.12+v.13+v.14+v.15+v.18+v.20+v.22+v.24+v.25+v.28+v.32+v.35
  !gapprompt@gap>| !gapinput@y:=Random(Source(F));|
  v.1+v.2+v.7+v.9+v.13+v.23+v.26+v.27+v.32+v.33+v.34+v.35
  !gapprompt@gap>| !gapinput@Image(F,x)+Image(F,y)=Image(F,x+y);|
  true
  !gapprompt@gap>| !gapinput@Image(F,x)*Image(F,y)=Image(F,x*y);|
  true
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Testing functorial properties}}\logpage{[ 8, 3, 2 ]}
\hyperdef{L}{X7A0D505D844F0CD4}{}
{
 The following example takes two "random" automorphisms $f,g\colon K\rightarrow K$ of the group $K$ of order $24$ arising as the direct product $K=C_3\times Q_8$ and constructs the three ring isomorphisms $F,G,FG\colon H^{\le 5}(K,\mathbb Z_2) \rightarrow H^{\le 5}(K,\mathbb Z_2)$ induced by $f, g$ and the composite $f\circ g$. It tests that $FG$ is indeed the composite $G\circ F$. Note that when we create the ring $H^{\le 5}(K,\mathbb Z_2)$ twice in \textsc{GAP} we obtain two canonically isomorphic but distinct implimentations of the ring.
Thus the canocial isomorphism between these distinct implementations needs to
be incorporated into the test. Note also that \textsc{GAP} defines $g\ast f = f\circ g$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=SmallGroup(24,11);;|
  !gapprompt@gap>| !gapinput@aut:=AutomorphismGroup(K);;|
  !gapprompt@gap>| !gapinput@f:=Elements(aut)[5];;|
  !gapprompt@gap>| !gapinput@g:=Elements(aut)[8];;|
  !gapprompt@gap>| !gapinput@fg:=g*f;;|
  !gapprompt@gap>| !gapinput@F:=ModPCohomologyRing(f,2,5);|
  [ v.1, v.2, v.3, v.4, v.5, v.6, v.7 ] -> [ v.1, v.2+v.3, v.3, v.4+v.5, v.5, 
    v.6, v.7 ]
  !gapprompt@gap>| !gapinput@G:=ModPCohomologyRing(g,2,5);|
  [ v.1, v.2, v.3, v.4, v.5, v.6, v.7 ] -> [ v.1, v.2+v.3, v.2, v.5, v.4+v.5, 
    v.6, v.7 ]
  !gapprompt@gap>| !gapinput@FG:=ModPCohomologyRing(fg,2,5);|
  [ v.1, v.2, v.3, v.4, v.5, v.6, v.7 ] -> [ v.1, v.3, v.2, v.4, v.4+v.5, v.6, 
    v.7 ]
  
  !gapprompt@gap>| !gapinput@sF:=Source(F);;tF:=Target(F);;|
  !gapprompt@gap>| !gapinput@sG:=Source(G);; |
  !gapprompt@gap>| !gapinput@tGsF:=AlgebraHomomorphismByImages(tF,sG,Basis(tF),Basis(sG));;|
  !gapprompt@gap>| !gapinput@List(GeneratorsOfAlgebra(sF),x->Image(G,Image(tGsF,Image(F,x))));|
  [ v.1, v.3, v.2, v.4, v.4+v.5, v.6, v.7 ]
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Computing with larger groups}}\logpage{[ 8, 3, 3 ]}
\hyperdef{L}{X855764877FA44225}{}
{
 

Mod\texttt{\symbol{45}}$p$ cohomology rings of finite groups are constructed as the rings of stable
elements in the cohomology of a (non\texttt{\symbol{45}}functorially) chosen
Sylow $p$\texttt{\symbol{45}}subgroup and thus require the construction of a free
resolution only for the Sylow subgroup. However, to ensure the functoriality
of induced cohomology homomorphisms the above computations construct free
resolutions for the entire groups $G,H$. This is a more expensive computation than finding resolutions just for Sylow
subgroups. 

The default algorithm used by the function \texttt{ModPCohomologyRing()} for constructing resolutions of a finite group $G$ is \texttt{ResolutionFiniteGroup()} or \texttt{ResolutionPrimePowerGroup()} in the case when $G$ happens to be a group of prime\texttt{\symbol{45}}power order. If the user is
able to construct the first $deg$ terms of free resolutions $RG, RH$ for the groups $G, H$ then the pair \texttt{[RG,RH]} can be entered as the third input variable of \texttt{ModPCohomologyRing()}. 

For instance, the following example constructs the ring homomorphism 

$F\colon H^{\le 7}(A_6,\mathbb Z_2) \rightarrow H^{\le 7}(S_6,\mathbb Z_2)$ 

 induced by the the canonical inclusion of the alternating group $A_6$ into the symmetric group $S_6$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SymmetricGroup(6);;|
  !gapprompt@gap>| !gapinput@H:=AlternatingGroup(6);;|
  !gapprompt@gap>| !gapinput@f:=GroupHomomorphismByFunction(H,G,x->x);;|
  !gapprompt@gap>| !gapinput@RG:=ResolutionFiniteGroup(G,7);;   |
  !gapprompt@gap>| !gapinput@RH:=ResolutionFiniteSubgroup(RG,H);;|
  !gapprompt@gap>| !gapinput@F:=ModPCohomologyRing(f,2,[RG,RH]);       |
  [ v.1, v.2+v.3, v.6+v.8+v.10, v.7+v.9, v.11+v.12, v.13+v.15+v.16+v.18+v.19, 
    v.14+v.16+v.19, v.17, v.22, v.23+v.28+v.32+v.35, 
    v.24+v.26+v.27+v.29+v.32+v.33+v.35, v.25+v.26+v.27+v.29+v.32+v.33+v.35, 
    v.30+v.32+v.33+v.34+v.35, v.36+v.39+v.43+v.45+v.47+v.49+v.50+v.55, 
    v.38+v.45+v.47+v.49+v.50+v.55, v.40, 
    v.41+v.43+v.45+v.47+v.48+v.49+v.50+v.53+v.55, 
    v.42+v.43+v.45+v.46+v.47+v.49+v.53+v.54, v.44+v.45+v.46+v.47+v.49+v.53+v.54,
    v.51+v.52, v.58+v.60, v.59+v.68+v.73+v.77+v.81+v.83, 
    v.62+v.68+v.74+v.77+v.78+v.80+v.81+v.83+v.84, 
    v.63+v.69+v.73+v.74+v.78+v.80+v.84, v.64+v.68+v.73+v.77+v.81+v.83, v.65, 
    v.66+v.75+v.81, v.67+v.68+v.69+v.70+v.73+v.74+v.78+v.80+v.84, 
    v.71+v.72+v.73+v.76+v.77+v.78+v.80+v.82+v.83+v.84, v.79 ] -> 
  [ v.1, 0*v.1, v.4+v.5+v.6, 0*v.1, v.8, v.8, 0*v.1, v.7, 0*v.1, 
    v.12+v.13+v.14+v.15, v.12+v.13+v.14+v.15, v.12+v.13+v.14+v.15, 
    v.12+v.13+v.14+v.15, v.18+v.19, 0*v.1, 0*v.1, v.18+v.19, v.18+v.19, 
    v.18+v.19, v.16+v.17, 0*v.1, v.25, v.22+v.24+v.25+v.26+v.27+v.28, 
    v.22+v.24+v.25+v.26+v.27+v.28, 0*v.1, 0*v.1, v.25, v.22+v.24+v.26+v.27+v.28,
    v.22+v.24+v.26+v.27+v.28, v.23 ]
  
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Steenrod operations for finite $2$\texttt{\symbol{45}}groups}}\logpage{[ 8, 4, 0 ]}
\hyperdef{L}{X80114B0483EF9A67}{}
{
 The command \texttt{CohomologicalData(G,n)} prints complete information for the cohomology ring $H^\ast(G, Z_2 )$ and steenrod operations for a $2$\texttt{\symbol{45}}group $G$ provided that the integer $n$ is at least the maximal degree of a generator or relator in a minimal set of
generatoirs and relators for the ring. 

The following example produces complete information on the Steenrod algebra of
group number $8$ in \textsc{GAP}'s library of groups of order $32$. Groebner basis routines (for commutative rings) from \textsc{Singular} are called in the example. (This example take over 2 hours to run. Most other
groups of order 32 run significantly quicker.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@CohomologicalData(SmallGroup(32,8),12);|
  
  Integer argument is large enough to ensure completeness of cohomology ring presentation.
  
  Group number: 8
  Group description: C2 . ((C4 x C2) : C2) = (C2 x C2) . (C4 x C2)
  
  Cohomology generators
  Degree 1: a, b
  Degree 2: c, d
  Degree 3: e
  Degree 5: f, g
  Degree 6: h
  Degree 8: p
  
  Cohomology relations
  1: f^2
  2: c*h+e*f
  3: c*f
  4: b*h+c*g
  5: b*e+c*d
  6: a*h
  7: a*g
  8: a*f+b*f
  9: a*e+c^2
  10: a*c
  11: a*b
  12: a^2
  13: d*e*h+e^2*g+f*h
  14: d^2*h+d*e*f+d*e*g+f*g
  15: c^2*d+b*f
  16: b*c*g+e*f
  17: b*c*d+c*e
  18: b^2*g+d*f
  19: b^2*c+c^2
  20: b^3+a*d
  21: c*d^2*e+c*d*g+d^2*f+e*h
  22: c*d^3+d*e^2+d*h+e*f+e*g
  23: b^2*d^2+c*d^2+b*f+e^2
  24: b^3*d
  25: d^3*e^2+d^2*e*f+c^2*p+h^2
  26: d^4*e+b*c*p+e^2*g+g*h
  27: d^5+b*d^2*g+b^2*p+f*g+g^2
  
  Poincare series
  (x^5+x^2+1)/(x^8-2*x^7+2*x^6-2*x^5+2*x^4-2*x^3+2*x^2-2*x+1)
  
  Steenrod squares
  Sq^1(c)=0
  Sq^1(d)=b*b*b+d*b
  Sq^1(e)=c*b*b
  Sq^2(e)=e*d+f
  Sq^1(f)=c*d*b*b+d*d*b*b
  Sq^2(f)=g*b*b
  Sq^4(f)=p*a
  Sq^1(g)=d*d*d+g*b
  Sq^2(g)=0
  Sq^4(g)=c*d*d*d*b+g*d*b*b+g*d*d+p*a+p*b
  Sq^1(h)=c*d*d*b+e*d*d
  Sq^2(h)=d*d*d*b*b+c*d*d*d+g*c*b
  Sq^4(h)=d*d*d*d*b*b+g*e*d+p*c
  Sq^1(p)=c*d*d*d*b
  Sq^2(p)=d*d*d*d*b*b+c*d*d*d*d
  Sq^4(p)=d*d*d*d*d*b*b+d*d*d*d*d*d+g*d*d*d*b+g*g*d+p*d*d
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Steenrod operations on the classifying space of a finite $p$\texttt{\symbol{45}}group}}\logpage{[ 8, 5, 0 ]}
\hyperdef{L}{X7D5ACA56870A40E9}{}
{
 The following example constructs the first eight degrees of the
mod\texttt{\symbol{45}}$3$ cohomology ring $H^\ast(G,\mathbb Z_3)$ for the group $G$ number 4 in \textsc{GAP}'s library of groups of order $81$. It determines a minimal set of ring generators lying in degree $\le 8$ and it evaluates the Bockstein operator on these generators. Steenrod powers
for $p\ge 3$ are not implemented as no efficient method of implementation is known. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SmallGroup(81,4);;|
  !gapprompt@gap>| !gapinput@A:=ModPSteenrodAlgebra(G,8);;|
  !gapprompt@gap>| !gapinput@List(ModPRingGenerators(A),x->Bockstein(A,x));|
  [ 0*v.1, 0*v.1, v.5, 0*v.1, (Z(3))*v.7+v.8+(Z(3))*v.9 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Mod\texttt{\symbol{45}}$p$ cohomology rings of crystallographic groups}}\logpage{[ 8, 6, 0 ]}
\hyperdef{L}{X7D2D26C0784A0E14}{}
{
 Mod $p$ cohomology ring computations can be attempted for any group $G$ for which we can compute sufficiently many terms of a free $ZG$\texttt{\symbol{45}}resolution with contracting homotopy. The contracting
homotopy is not needed if only the dimensions of the cohomology in each degree
are sought. Crystallographic groups are one class of infinite groups where
such computations can be attempted. 
\subsection{\textcolor{Chapter }{Poincare series for crystallographic groups}}\logpage{[ 8, 6, 1 ]}
\hyperdef{L}{X81C107C07CF02F0E}{}
{
 Consider the space group $G=SpaceGroupOnRightIT(3,226,'1')$. The following computation computes the infinite series 

 $(-2x^4+2x^2+1)/(-x^5+2x^4-x^3+x^2-2x+1)$ 

in which the coefficient of the monomial $x^n$ is guaranteed to equal the dimension of the vector space $H^n(G,\mathbb Z_2)$ in degrees $n\le 14$. One would need to involve a theoretical argument to establish that this
equality in fact holds in every degree $n\ge 0$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SpaceGroupIT(3,226);|
  SpaceGroupOnRightIT(3,226,'1')
  !gapprompt@gap>| !gapinput@R:=ResolutionSpaceGroup(G,15);|
  Resolution of length 15 in characteristic 0 for <matrix group with 
  8 generators> . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@D:=List([0..14],n->Cohomology(HomToIntegersModP(R,2),n));|
  [ 1, 2, 5, 9, 11, 15, 20, 23, 28, 34, 38, 44, 51, 56, 63 ]
  
  !gapprompt@gap>| !gapinput@PoincareSeries(D,14);|
  (-2*x_1^4+2*x_1^2+1)/(-x_1^5+2*x_1^4-x_1^3+x_1^2-2*x_1+1)
  
  
\end{Verbatim}
 Consider the space group $SpaceGroupOnRightIT(3,103,'1')$. The following computation uses a different construction of a free resolution
to compute the infinite series 

 $ (x^3+2x^2+2x+1)/(-x+1) $ 

in which the coefficient of the monomial $x^n$ is guaranteed to equal the dimension of the vector space $H^n(G,\mathbb Z_2)$ in degrees $n\le 99$. The final commands show that $G$ acts on a (cubical) cellular decomposition of $\mathbb R^3$ with cell ctabilizers being either trivial or cyclic of order $2$ or $4$. From this extra calculation it follows that the cohomology is periodic in
degrees greater than $3$ and that the Poincare series is correct in every degree $n \ge 0$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|G:=SpaceGroupIT(3,103);A
  SpaceGroupOnRightIT(3,103,'1')
  @gapprompt|gap>A @gapinput|R:=ResolutionCubicalCrystGroup(G,100);A
  Resolution of length 100 in characteristic 0 for <matrix group with 6 generators> . 
  
  @gapprompt|gap>A @gapinput|D:=List([0..99],n->Cohomology(HomToIntegersModP(R,2),n));;A
  @gapprompt|gap>A @gapinput|PoincareSeries(D,99);A
  (x_1^3+2*x_1^2+2*x_1+1)/(-x_1+1)
  
  
  #Torsion subgroups are cyclic
  @gapprompt|gap>A @gapinput|B:=CrystGFullBasis(G);;A
  @gapprompt|gap>A @gapinput|C:=CrystGcomplex(GeneratorsOfGroup(G),B,1);;A
  @gapprompt|gap>A @gapinput|for n in [0..3] doA
  @gapprompt|>A @gapinput|for k in [1..C!.dimension(n)] doA
  @gapprompt|>A @gapinput|Print(StructureDescription(C!.stabilizer(n,k)),"  ");A
  @gapprompt|>A @gapinput|od;od;A
  C4  C2  C4  1  1  C4  C2  C4  1  1  1  1  
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Mod $2$ cohomology rings of $3$\texttt{\symbol{45}}dimensional crystallographic groups}}\logpage{[ 8, 6, 2 ]}
\hyperdef{L}{X7F5C242F7BC938A5}{}
{
 Computations in the \emph{integral} cohomology of a crystallographic group are illustrated in Section \ref{secOrbifolds}. The commands underlying that illustration could be further developed and
adapted to mod $p$ cohomology. Indeed, the authors of the paper \cite{liuye} have developed commands for accessing the mod $2$ cohomology of $3$\texttt{\symbol{45}}dimensional crystallographic groups with the aim of
establishing a connection between these rings and the lattice structure of
crystals with space group symmetry. Their code is available at the github
repository \cite{liuyegithub}. In particular, their code contains the command 
\begin{itemize}
\item  \texttt{SpaceGroupCohomologyRingGapInterface(ITC)}
\end{itemize}
 that inputs an integer in the range $1\le ITC\le 230$ corresponding to the numbering of a $3$\texttt{\symbol{45}}dimensional space group $G$ in the International Table for Crystallography. This command returns 
\begin{itemize}
\item  a presentation for the mod $2$ cohomology ring $H^\ast(G,\mathbb Z_2)$. The presentation is guaranteed to be correct for low degree cohomology. In
cases where the cohomology is periodic in degrees $ \ge 5$ (which can be tested using \texttt{IsPeriodicSpaceGroup(G)}) the presentation is guaranteed correct in all degrees. In
non\texttt{\symbol{45}}periodic cases some additional mathematical argument
needs to be provided to be mathematically sure that the presentation is
correct in all degrees. 
\item  the Lieb\texttt{\symbol{45}}Schultz\texttt{\symbol{45}}Mattis anomaly
(degree\texttt{\symbol{45}}3 cocycles) associated with the Irreducible Wyckoff
Position (see the paper \cite{liuye} for a definition). 
\end{itemize}
 The command \texttt{SpaceGroupCohomologyRingGapInterface(ITC)} is fast for most groups (a few seconds to a few minutes) but can be very slow
for certain space groups (e.g. ITC $= 228$ and ITC $= 142$). The following illustration assumes that two relevant files have been
downloaded from \cite{liuyegithub} and illustrates the command for ITC $ =30$ and ITC $=216$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Read("SpaceGroupCohomologyData.gi");        #These two files must be |
  !gapprompt@gap>| !gapinput@Read("SpaceGroupCohomologyFunctions.gi");   #downloaded from|
  !gapprompt@gap>| !gapinput@      #https://github.com/liuchx1993/Space-Group-Cohomology-and-LSM/|
   
  !gapprompt@gap>| !gapinput@IsPeriodicSpaceGroup(SpaceGroupIT(3,30));|
  true
  
  !gapprompt@gap>| !gapinput@SpaceGroupCohomologyRingGapInterface(30);|
  ===========================================
  Mod-2 Cohomology Ring of Group No. 30:
  Z2[Ac,Am,Ax,Bb]/<R2,R3,R4>
  R2:  Ac.Am  Am^2  Ax^2+Ac.Ax  
  R3:  Am.Bb  
  R4:  Bb^2  
  ===========================================
  LSM:
  2a Ac.Bb+Ax.Bb
  2b Ax.Bb
  true
  
  
  !gapprompt@gap>| !gapinput@IsPeriodicSpaceGroup(SpaceGroupIT(3,216));|
  false
  
  !gapprompt@gap>| !gapinput@SpaceGroupCohomologyRingGapInterface(216);|
  ===========================================
  Mod-2 Cohomology Ring of Group No. 216:
  Z2[Am,Ba,Bb,Bxyxzyz,Ca,Cb,Cc,Cxyz]/<R4,R5,R6>
  R4:  Am.Ca  Am.Cb  Ba.Bxyxzyz+Am.Cc  Bb^2+Am.Cc+Ba.Bb  Bb.Bxyxzyz+Am^2.Bb+Am.Cxyz  Bxyxzyz^2  
  R5:  Bxyxzyz.Ca  Ba.Cb+Bb.Ca  Bb.Cb+Bb.Ca  Bxyxzyz.Cb  Bxyxzyz.Cc  Ba.Cxyz+Am.Ba.Bb+Bb.Cc  Bb.Cxyz+Am^2.Cc+Am.Ba.Bb+Bb.Cc  Bxyxzyz.Cxyz+Am^3.Bb+Am^2.Cxyz 
  ===========================================
  LSM:
  4a Ca+Cc+Cxyz
  4b Cb+Cc+Cxyz
  4c Cb+Cxyz
  4d Cxyz
  true
  
\end{Verbatim}
 In the example the naming convention for ring generators follows the paper \cite{liuye}. }

 }

 }

 
\chapter{\textcolor{Chapter }{Bredon homology}}\logpage{[ 9, 0, 0 ]}
\hyperdef{L}{X786DB80A8693779E}{}
{
 
\section{\textcolor{Chapter }{Davis complex}}\logpage{[ 9, 1, 0 ]}
\hyperdef{L}{X7B0212F97F3D442A}{}
{
 

The following example computes the Bredon homology 

$\underline H_0(W,{\cal R}) = \mathbb Z^{21}$ 

 for the infinite Coxeter group $W$ associated to the Dynkin diagram shown in the computation, with coefficients
in the complex representation ring. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=[[1,[2,3]],[2,[3,3]],[3,[4,3]],[4,[5,6]]];;|
  !gapprompt@gap>| !gapinput@CoxeterDiagramDisplay(D);|
  
\end{Verbatim}
  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@C:=DavisComplex(D);;|
  !gapprompt@gap>| !gapinput@D:=TensorWithComplexRepresentationRing(C);;|
  !gapprompt@gap>| !gapinput@Homology(D,0);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Arithmetic groups}}\logpage{[ 9, 2, 0 ]}
\hyperdef{L}{X7AFFB32587D047FE}{}
{
 

The following example computes the Bredon homology 

$\underline H_0(SL_2({\cal O}_{-3}),{\cal R}) = \mathbb Z_2\oplus \mathbb Z^{9}$ 

$\underline H_1(SL_2({\cal O}_{-3}),{\cal R}) = \mathbb Z$ 

for ${\cal O}_{-3}$ the ring of integers of the number field $\mathbb Q(\sqrt{-3})$, and $\cal R$ the complex reflection ring. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ContractibleGcomplex("SL(2,O-3)");;|
  !gapprompt@gap>| !gapinput@IsRigid(R);|
  false
  !gapprompt@gap>| !gapinput@S:=BaryCentricSubdivision(R);;|
  !gapprompt@gap>| !gapinput@IsRigid(S);|
  true
  !gapprompt@gap>| !gapinput@C:=TensorWithComplexRepresentationRing(S);;|
  !gapprompt@gap>| !gapinput@Homology(C,0);|
  [ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(C,1);|
  [ 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Crystallographic groups}}\logpage{[ 9, 3, 0 ]}
\hyperdef{L}{X7DEBF2BB7D1FB144}{}
{
 

The following example computes the Bredon homology 

$\underline H_0(G,{\cal R}) = \mathbb Z^{17}$ 

 for $G$ the second crystallographic group of dimension $4$ in \textsc{GAP}'s library of crystallographic groups, and for $\cal R$ the Burnside ring. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SpaceGroup(4,2);;|
  !gapprompt@gap>| !gapinput@gens:=GeneratorsOfGroup(G);;|
  !gapprompt@gap>| !gapinput@B:=CrystGFullBasis(G);;|
  !gapprompt@gap>| !gapinput@R:=CrystGcomplex(gens,B,1);;|
  !gapprompt@gap>| !gapinput@IsRigid(R);|
  false
  !gapprompt@gap>| !gapinput@S:=CrystGcomplex(gens,B,0);;|
  !gapprompt@gap>| !gapinput@IsRigid(S);|
  true
  !gapprompt@gap>| !gapinput@D:=TensorWithBurnsideRing(S);;|
  !gapprompt@gap>| !gapinput@Homology(D,0);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 }

 }

 
\chapter{\textcolor{Chapter }{Chain Complexes}}\logpage{[ 10, 0, 0 ]}
\hyperdef{L}{X7A06103979B92808}{}
{
 HAP uses implementations of chain complexes of free $\mathbb K$\texttt{\symbol{45}}modules for each of the rings $\mathbb K = \mathbb Z$, $\mathbb K = \mathbb Q$, $\mathbb K = \mathbb F_p$ with $p$ a prime number, $\mathbb K = \mathbb ZG$, $\mathbb K = \mathbb F_pG$ with $G$ a group. The implemented chain complexes have the form 

$ C_n \stackrel{d_n}{\longrightarrow } C_{n-1}
\stackrel{d_{n-1}}{\longrightarrow } \cdots \stackrel{d_2}{\longrightarrow }
C_1 \stackrel{d_1}{\longrightarrow } C_0 \stackrel{d_0}{\longrightarrow } 0\ .$ 

Such a complex is said to have \emph{length} $n$ and the rank of the free $\mathbb K$\texttt{\symbol{45}}module $C_k$ is referred to as the \emph{dimenion} of the complex in degree $k$. 

 For the case $\mathbb K = \mathbb ZG$ (resp. $\mathbb K = \mathbb F_pG$) the main focus is on free chain complexes that are exact at each degree $k$, i.e. ${\rm im}(d_{k+1})={\rm ker}(d_k)$, for $0 < k < n$ and with $C_0/{\rm im}(d_1) \cong \mathbb Z$ (resp. $C_0/{\rm im}(d_1) \cong \mathbb F_p$). We refer to such a chain complex as a \emph{resolution of length } $n$ even though $d_n$ will typically not be injective. More correct terminology would refer to such
a chain complex as the first $n$ degrees of a free resolution. 

The following sections illustrate some constructions of chain complexes.
Constructions for resolutions are described in the next chapter \ref{resolutions}. 
\section{\textcolor{Chapter }{Chain complex of a simplicial complex and simplicial pair}}\logpage{[ 10, 1, 0 ]}
\hyperdef{L}{X782DE78884DD6992}{}
{
 

The following example constructs the Quillen simplicial complex $Q={\mathcal A}_p(G)$ for $p=2$ and $G=A_8$; this is the order complex of the poset of non\texttt{\symbol{45}}trivial
elementary $2$\texttt{\symbol{45}}subgroups of $G$. The chain complex $C_\ast = C_\ast(Q)$ is then computed and seen to have the same number of free generators as $Q$ has simplices. (To ensure indexing of subcomplexes is consistent with that of
the large complex it is best to work with vertices represented as integers.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuillenComplex(AlternatingGroup(8),2);|
  Simplicial complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@C:=ChainComplex(Q);|
  Chain complex of length 3 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Size(Q);|
  55015
  !gapprompt@gap>| !gapinput@Size(C);|
  55015
  
\end{Verbatim}
 Next the simplicial complex $Q$ is converted to one whose vertices are represented by integers and a
contactible subcomplex $L < Q$ is computed. The chain complex $D_\ast=C_\ast(Q,L)$ of the simplicial pair $(Q,L)$ is constructed and seen to have the correct size. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=IntegerSimplicialComplex(Q);|
  Simplicial complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@L:=ContractibleSubcomplex(Q);|
  Simplicial complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@D:=ChainComplexOfPair(Q,L);|
  Chain complex of length 3 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Size(D)=Size(Q)-Size(L);|
  true
  !gapprompt@gap>| !gapinput@Size(D);|
  670
  gap>
  
\end{Verbatim}
 The next commands produce a smalled chain complex $B_\ast$ chain homotopy equivalent to $D_\ast$ and compute the homology $H_k(Q,\mathbb Z) \cong H_k(B_\ast)$ for $k=1,2,3$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@B:=ContractedComplex(D);|
  Chain complex of length 3 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Size(B);|
  64
  !gapprompt@gap>| !gapinput@Homology(B,1);|
  [  ]
  !gapprompt@gap>| !gapinput@Homology(B,2);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(B,3);|
  [  ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Chain complex of a cubical complex and cubical pair}}\logpage{[ 10, 2, 0 ]}
\hyperdef{L}{X79E7A13E7DE9C412}{}
{
 The following example reads in the digital image 

  

as a $2$\texttt{\symbol{45}}dimensional pure cubical complex $M$ and constructs the chain complex $C_\ast=C_\ast(M)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=ReadImageAsPureCubicalComplex(file,400);|
  Pure cubical complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@C:=ChainComplex(K);|
  Chain complex of length 2 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Size(C); |
  173243
  
\end{Verbatim}
 Next an acyclic pure cubical subcomplex $L < M$ is computed and the chain complex $D_\ast=C_\ast(M,L)$ of the pair is constructed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=AcyclicSubcomplexOfPureCubicalComplex(K);|
  Pure cubical complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@D:=ChainComplexOfPair(K,L);|
  Chain complex of length 2 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Size(D);|
  618
  
\end{Verbatim}
 Finally the chain complex $D_\ast$ is simplified to a homotopy equivalent chain complex $B_\ast$ and the homology $H_1(M,\mathbb Z) \cong H_1(B_\ast)$ is computed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@B:=ContractedComplex(D);|
  Chain complex of length 2 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Size(B);|
  20
  !gapprompt@gap>| !gapinput@Homology(B,1);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Chain complex of a regular CW\texttt{\symbol{45}}complex}}\logpage{[ 10, 3, 0 ]}
\hyperdef{L}{X86C38E87817F2EAD}{}
{
 The next example constructs a $15$\texttt{\symbol{45}}dimensional regular CW\texttt{\symbol{45}}complex $Y$ that is homotopy equivalent to the $2$\texttt{\symbol{45}}dimensional torus. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Circle:=PureCubicalComplex([[1,1,1,1,1],[1,1,0,1,1],[1,1,1,1,1]]);|
  Pure cubical complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@Torus:=DirectProductOfPureCubicalComplexes(Circle,Circle);|
  Pure cubical complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@CTorus:=CechComplexOfPureCubicalComplex(Torus);|
  Simplicial complex of dimension 15.
  
  !gapprompt@gap>| !gapinput@Y:=RegularCWComplex(CTorus);|
  Regular CW-complex of dimension 15
  
\end{Verbatim}
 Next the cellular chain complex $C_\ast=C_\ast(Y)$ is constructed. Also, a minimally generated chain complex $D_\ast=C_\ast(Y')$ of a non\texttt{\symbol{45}}regular CW\texttt{\symbol{45}}complex $Y'\simeq Y$ is constructed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@C:=ChainComplexOfRegularCWComplex(Y);|
  Chain complex of length 15 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Size(C);|
  1172776
  
  !gapprompt@gap>| !gapinput@D:=ChainComplex(Y);|
  Chain complex of length 15 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Size(D);|
  4
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Chain Maps of simplicial and regular CW maps}}\logpage{[ 10, 4, 0 ]}
\hyperdef{L}{X7F9662EF83A1FA76}{}
{
 The next example realizes the complement of the first prime knot on $11$ crossings as a pure permutahedral complex. The complement is converted to a
regular CW\texttt{\symbol{45}}complex $Y$ and the boundary inclusion $f\colon \partial Y \hookrightarrow Y$ is constructed as a map of regular CW\texttt{\symbol{45}}complexes. Then the
induced chain map $F\colon C_\ast(\partial Y) \hookrightarrow C_\ast(Y)$ is constructed. Finally the homology homomorphism $H_1(F)\colon H_1(C_\ast(\partial Y)) \rightarrow H_1(C_\ast(Y))$ is computed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=PurePermutahedralKnot(11,1);;|
  !gapprompt@gap>| !gapinput@M:=PureComplexComplement(K);|
  Pure permutahedral complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@Y:=RegularCWComplex(M);|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@f:=BoundaryMap(Y);|
  Map of regular CW-complexes
  
  !gapprompt@gap>| !gapinput@F:=ChainMap(f);|
  Chain Map between complexes of length 2 . 
  
  !gapprompt@gap>| !gapinput@H:=Homology(F,1);|
  [ g1, g2 ] -> [ g1^-1, g1^-1 ]
  
  !gapprompt@gap>| !gapinput@Kernel(H);|
  Pcp-group with orders [ 0 ]
  
\end{Verbatim}
 The command \texttt{ChainMap(f)} can be used to construct the chain map $C_\ast(K) \rightarrow C_\ast(K')$ induced by a map $f\colon K\rightarrow K'$ of simplicial complexes. }

 
\section{\textcolor{Chapter }{Constructions for chain complexes}}\logpage{[ 10, 5, 0 ]}
\hyperdef{L}{X8127E17383F45359}{}
{
 It is straightforward to implement basic constructions on chain complexes. A
few constructions are illustrated in the following example. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|res:=ResolutionFiniteGroup(SymmetricGroup(5),5);;B
  @gapprompt|gap>B @gapinput|C:=TensorWithIntegers(res);B
  Chain complex of length 5 in characteristic 0 . 
  
  @gapprompt|gap>B @gapinput|D:=ContractedComplex(C);#A chain homotopic complexB
  Chain complex of length 5 in characteristic 0 . 
  @gapprompt|gap>B @gapinput|List([0..5],C!.dimension);B
  [ 1, 4, 10, 20, 35, 56 ]
  @gapprompt|gap>B @gapinput|List([0..5],D!.dimension);B
  [ 1, 1, 2, 4, 6, 38 ]
  
  @gapprompt|gap>B @gapinput|CxC:=TensorProduct(C,C);B
  Chain complex of length 10 in characteristic 0 . 
  
  @gapprompt|gap>B @gapinput|SC:=SuspendedChainComplex(C);B
  Chain complex of length 6 in characteristic 0 . 
  
  @gapprompt|gap>B @gapinput|RC:=ReducedSuspendedChainComplex(C);B
  Chain complex of length 6 in characteristic 0 .
  
  @gapprompt|gap>B @gapinput|PC:=PathObjectForChainComplex(C);B
  Chain complex of length 5 in characteristic 0 .
  
  @gapprompt|gap>B @gapinput|dualC:=HomToIntegers(C);B
  Cochain complex of length 5 in characteristic 0 .
  
  @gapprompt|gap>B @gapinput|Cxp:=TensorWithIntegersModP(C,5);B
  Chain complex of length 5 in characteristic 5 .
  
  @gapprompt|gap>B @gapinput|CxQ:=TensorWithRationals(C); #The quirky -1/2 denotes rationalsB
  Chain complex of length 5 in characteristic -1/2 .
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Filtered chain complexes}}\logpage{[ 10, 6, 0 ]}
\hyperdef{L}{X7AAAB26682CD8AC4}{}
{
 A sequence of inclusions of chain complexes $C_{0,\ast} \le C_{1,\ast} \le \cdots \le C_{T-1,\ast} \le C_{T,\ast}$ in which the preferred basis of $C_{k-1,\ell}$ is the beginning of the preferred basis of $C_{k,\ell}$ is referred to as a \emph{filtered chain complex}. Filtered chain complexes give rise to spectral sequences such as the \emph{equivariant spectral sequence} of a $G-CW$\texttt{\symbol{45}}complex with subgroup $H < G$. A particular case is the
Lyndon\texttt{\symbol{45}}Hochschild\texttt{\symbol{45}}Serre spectral
sequence for the homology of a group extension $N \rightarrowtail G \twoheadrightarrow Q$ with $E^2_{p,q}=H_p(Q,H_q(N, \mathbb Z))$. 

The following commands construct the filtered chain complex underlying the
Lyndon\texttt{\symbol{45}}Hochschild\texttt{\symbol{45}}Serre spectral
sequence for the dihedral group $G=D_{32}$ of order 64 and its centre $N=Z(G)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=DihedralGroup(64);;|
  !gapprompt@gap>| !gapinput@N:=Center(G);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionNormalSeries([G,N],3);;|
  !gapprompt@gap>| !gapinput@C:=FilteredTensorWithIntegersModP(R,2);|
  Chain complex of length 3 in characteristic 2 .
  
\end{Verbatim}
 The differentials $d^r_{p,q}$ in a given page $E^r$ of the spectral sequence arise from the induced homology homomorphisms $\iota^{s,t}_\ell\colon H_{\ell}(C_{s,\ast}) \rightarrow H_{\ell}(C_{t,\ast})$ for $s\le t$. Textbooks traditionally picture the differential in $E^r$ as an array of sloping arrows with non\texttt{\symbol{45}}zero groups $E^r_{p,q}\neq 0$ represented by dots. An alternative representation of this information is as a
barcode (of the sort used in Topological Data Analysis). The homomorphisms $\iota^{\ast,\ast}_2$ in the example, with coefficients converted to mod $2$, are pictured by the bar code 

  

 which was produced by the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@p:=2;;k:=2;;|
  !gapprompt@gap>| !gapinput@P:=PersistentHomologyOfFilteredChainComplex(C,k,p);;|
  !gapprompt@gap>| !gapinput@BarCodeDisplay(P);|
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Sparse chain complexes}}\logpage{[ 10, 7, 0 ]}
\hyperdef{L}{X856F202D823280F8}{}
{
 Boundary homomorphisms in all of the above examples of chain complexes are
represented by matrices. In cases where the matrices are large and have many
zero entries it is better to use sparse matrices. 

The following commands demonstrate the conversion of the matrix 

$A=\left(\begin{array}{ccc} 0 &2 &0\\ -3 &0 & 0\\ 0 & 0 &4 \end{array}\right)$ 

to sparse form, and vice\texttt{\symbol{45}}versa. 
\begin{Verbatim}[commandchars=@|D,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>D @gapinput|A:=[[0,2,0],[-3,0,0],[0,0,4]];;D
  @gapprompt|gap>D @gapinput|S:=SparseMat(A);D
  Sparse matrix with 3 rows and 3 columns in characteristic 0
  
  @gapprompt|gap>D @gapinput|NamesOfComponents(S);D
  [ "mat", "characteristic", "rows", "cols" ]
  @gapprompt|gap>D @gapinput|S!.mat;D
  [ [ [ 2, 2 ] ], [ [ 1, -3 ] ], [ [ 3, 4 ] ] ]
  
  @gapprompt|gap>D @gapinput|B:=SparseMattoMat(S);D
  [ [ 0, 2, 0 ], [ -3, 0, 0 ], [ 0, 0, 4 ] ]
  
\end{Verbatim}
 

To illustrate the use of sparse chain complexes we consider the data points
represented in the following digital image. 

 

 The following commands read in this image as a $2$\texttt{\symbol{45}}dimensional pure cubical complex and store the Euclidean
coordinates of the black pixels in a list. Then 200 points are selected at
random from this list and used to construct a $200\times 200$ symmetric matrix $S$ whose entries are the Euclidean distance between the sample data points. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|file:=HapFile("data500.png");;B
  @gapprompt|gap>B @gapinput|M:=ReadImageAsPureCubicalComplex(file,400);;B
  @gapprompt|gap>B @gapinput|A:=M!.binaryArray;;B
  @gapprompt|gap>B @gapinput|data:=[];;B
  @gapprompt|gap>B @gapinput|for i in [1..Length(A)] doB
  @gapprompt|>B @gapinput|for j in [1..Length(A[1])] doB
  @gapprompt|>B @gapinput|if A[i][j]=1 then Add(data,[i,j]); fi;B
  @gapprompt|>B @gapinput|od;B
  @gapprompt|>B @gapinput|od;B
  @gapprompt|gap>B @gapinput|sample:=List([1..200],i->Random(data));;B
  @gapprompt|gap>B @gapinput|S:=VectorsToSymmetricMatrix(sample,EuclideanApproximatedMetric);;B
  
\end{Verbatim}
 The symmetric distance matrix $S$ is next converted to a filtered chain complex arising from a filtered
simplicial complex (using the standard \emph{persistent homology} pipeline). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SymmetricMatrixToFilteredGraph(S,10,100);; |
  #Filtration length T=10, distances greater than 100 discarded.
  !gapprompt@gap>| !gapinput@N:=SimplicialNerveOfFilteredGraph(G,2);;|
  !gapprompt@gap>| !gapinput@C:=SparseFilteredChainComplexOfFilteredSimplicialComplex(N);;|
  Filtered sparse chain complex of length 2 in characteristic 0 .
  
\end{Verbatim}
 Next, the induced homology homomorphisms in degrees 1 and 2, with rational
coefficients, are computed and displayed a barcodes. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P0:=PersistentHomologyOfFilteredSparseChainComplex(C,0);;|
  !gapprompt@gap>| !gapinput@P1:=PersistentHomologyOfFilteredSparseChainComplex(C,1);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P0);|
  
\end{Verbatim}
 

 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P1);|
  
\end{Verbatim}
 

 

 The barcodes are consistent with the data points having been sampled from a
space with the homotopy type of an annulus. }

 }

 
\chapter{\textcolor{Chapter }{Resolutions}}\label{resolutions}
\logpage{[ 11, 0, 0 ]}
\hyperdef{L}{X7C0B125E7D5415B4}{}
{
 There is a range of functions in HAP that input a group $G$, integer $n$, and attempt to return the first $n$ terms of a free $\mathbb ZG$\texttt{\symbol{45}}resolution $R_\ast$ of the trivial module $\mathbb Z$. In some cases an explicit contracting homotopy is provided on the
resolution. The function \texttt{Size(R)} returns a list whose $k$th term is the sum of the lengths of the boundaries of the generators in
degree $k$. 
\section{\textcolor{Chapter }{Resolutions for small finite groups}}\logpage{[ 11, 1, 0 ]}
\hyperdef{L}{X83E8F9DA7CDC0DA7}{}
{
 The following uses discrete Morse theory to construct a resolution. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SymmetricGroup(6);; n:=6;;|
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(G,n);|
  Resolution of length 6 in characteristic 0 for Group([ (1,2), (1,2,3,4,5,6) 
   ]) .
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 10, 58, 186, 452, 906, 1436 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for very small finite groups}}\logpage{[ 11, 2, 0 ]}
\hyperdef{L}{X7EEA738385CC3AEA}{}
{
 The following uses linear algebra over $\mathbb Z$ to construct a resolution. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuaternionGroup(128);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionSmallGroup(Q,20);|
  Resolution of length 20 in characteristic 0 for <pc group of size 128 with 
  2 generators> . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 4, 42, 8, 128, 4, 42, 8, 128, 4, 42, 8, 128, 4, 42, 8, 128, 4, 42, 8, 128 ]
  
\end{Verbatim}
 The suspicion that this resolution $R_\ast$ is periodic of period $4$ can be confirmed by constructing the chain complex $C_\ast=R_\ast\otimes_{\mathbb Z}\mathbb ZG$ and verifying that boundary matrices repeat with period $4$. 

 A second example of a periodic resolution, for the Dihedral group $D_{2k+1}=\langle x, y\ |\ x^2= xy^kx^{-1}y^{-k-1} = 1\rangle$ of order $2k+2$ in the case $k=1$, is constructed and verified for periodicity in the next example. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FreeGroup(2);;D:=F/[F.1^2,F.1*F.2*F.1^-1*F.2^-2];;|
  !gapprompt@gap>| !gapinput@R:=ResolutionSmallGroup(D,15);;|
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 4, 7, 8, 6, 4, 8, 8, 6, 4, 8, 8, 6, 4, 8, 8 ]
  !gapprompt@gap>| !gapinput@C:=TensorWithIntegersOverSubgroup(R,Group(One(D)));;|
  !gapprompt@gap>| !gapinput@n:=4;;BoundaryMatrix(C,n)=BoundaryMatrix(C,n+4);|
  true
  !gapprompt@gap>| !gapinput@n:=5;;BoundaryMatrix(C,n)=BoundaryMatrix(C,n+4);|
  true
  !gapprompt@gap>| !gapinput@n:=6;;BoundaryMatrix(C,n)=BoundaryMatrix(C,n+4);|
  true
  !gapprompt@gap>| !gapinput@n:=7;;BoundaryMatrix(C,n)=BoundaryMatrix(C,n+4);|
  true
  !gapprompt@gap>| !gapinput@n:=8;;BoundaryMatrix(C,n)=BoundaryMatrix(C,n+4);|
  true
  
\end{Verbatim}
 This periodic resolution for $D_3$ can be found in a paper by R. Swan \cite{swan2}. The resolution was proved for arbitrary $D_{2k+1}$ by Irina Kholodna \cite{kholodna} (Corollary 5.5) and is the cellular chain complex of the universal cover of a
CW\texttt{\symbol{45}}complex $X$ with two cells in dimensions $1, 2 \bmod 4$ and one cell in dimensions $0,3 \bmod 4$. The $2$\texttt{\symbol{45}}skelecton is the $2$\texttt{\symbol{45}}complex for the given presentation of $D_{2k+1}$ and an attaching map for the $3$\texttt{\symbol{45}}cell is represented as follows. 

  

 A slightly different periodic resolution for $D_{2k+1}$ has been obtain more recently by FEA Johnson \cite{johnson}. Johnson's resolution has two free generators in each degree. Interestingly,
running the following code for many values of $k >1$ seems to produce a periodic resolution with two free generators in each degree
for most values of $k$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|k:=20;;rels:=[x^2,x*y^k*x^-1*y^(-1-k)];;D:=F/rels;;A
  @gapprompt|gap>A @gapinput|R:=ResolutionSmallGroup(D,7);;A
  @gapprompt|gap>A @gapinput|List([0..7],R!.dimension);A
  [ 1, 2, 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 

The performance of the function \texttt{ResolutionSmallGroup(G,n)} is very sensistive to the choice of presentation for the input group $G$. If $G$ is an fp\texttt{\symbol{45}}group then the defining presentation for $G$ is used. If $G$ is a permutaion group or finite matrix group then \textsc{GAP} functions are invoked to find a presentation for $G$. The following commands use a geometrically derived presentation for $SL(2,5)$ as input in order to obtain the first few terms of a periodic resolution for
this group of period $4$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|Y:=PoincareDodecahedronCWComplex( A
  @gapprompt|>A @gapinput|[[1,2,3,4,5],[6,7,8,9,10]],A
  @gapprompt|>A @gapinput|[[1,11,16,12,2],[19,9,8,18,14]],A
  @gapprompt|>A @gapinput|[[2,12,17,13,3],[20,10,9,19,15]],A
  @gapprompt|>A @gapinput|[[3,13,18,14,4],[16,6,10,20,11]],A
  @gapprompt|>A @gapinput|[[4,14,19,15,5],[17,7,6,16,12]],A
  @gapprompt|>A @gapinput|[[5,15,20,11,1],[18,8,7,17,13]]);;A
  @gapprompt|gap>A @gapinput|G:=FundamentalGroup(Y);A
  <fp group on the generators [ f1, f2 ]>
  @gapprompt|gap>A @gapinput|RelatorsOfFpGroup(G);A
  [ f2^-1*f1^-1*f2*f1^-1*f2^-1*f1, f2^-1*f1*f2^2*f1*f2^-1*f1^-1 ]
  @gapprompt|gap>A @gapinput|StructureDescription(G);A
  "SL(2,5)"
  @gapprompt|gap>A @gapinput|R:=ResolutionSmallGroup(G,3);;A
  @gapprompt|gap>A @gapinput|List([0..3],R!.dimension);    A
  [ 1, 2, 2, 1 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for finite groups acting on orbit polytopes}}\logpage{[ 11, 3, 0 ]}
\hyperdef{L}{X86C0983E81F706F5}{}
{
 The following uses Polymake convex hull computations and homological
perturbation theory to construct a resolution. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SignedPermutationGroup(5);;|
  !gapprompt@gap>| !gapinput@StructureDescription(G);|
  "C2 x ((C2 x C2 x C2 x C2) : S5)"
  
  !gapprompt@gap>| !gapinput@v:=[1,2,3,4,5];;  #The resolution depends on the choice of vector.|
  !gapprompt@gap>| !gapinput@P:=PolytopalComplex(G,[1,2,3,4,5]);|
  Non-free resolution in characteristic 0 for <matrix group of size 3840 with 
  9 generators> . 
  No contracting homotopy available.
  
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(P,6);|
  Resolution of length 5 in characteristic 0 for <matrix group of size 
  3840 with 9 generators> . 
  No contracting homotopy available.
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 10, 60, 214, 694, 6247, 273600 ]
  
\end{Verbatim}
 The convex polytope $P_G(v)={\rm Convex~Hull}\{g\cdot v\ |\ g\in G\}$ used in the resolution depends on the choice of vector $v\in \mathbb R^n$. Two such polytopes for the alternating group $G=A_4$ acting on $\mathbb R^4$ can be visualized as follows. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=AlternatingGroup(4);;|
  !gapprompt@gap>| !gapinput@OrbitPolytope(G,[1,2,3,4],["VISUAL"]);|
  !gapprompt@gap>| !gapinput@OrbitPolytope(G,[1,1,3,4],["VISUAL"]);|
  
  !gapprompt@gap>| !gapinput@P1:=PolytopalComplex(G,[1,2,3,4]);;|
  !gapprompt@gap>| !gapinput@P2:=PolytopalComplex(G,[1,1,3,4]);;|
  !gapprompt@gap>| !gapinput@R1:=FreeGResolution(P1,20);;|
  !gapprompt@gap>| !gapinput@R2:=FreeGResolution(P2,20);;|
  !gapprompt@gap>| !gapinput@Size(R1);|
  [ 6, 11, 32, 24, 36, 60, 65, 102, 116, 168, 172, 248, 323, 628, 650, 1093, 
    1107, 2456, 2344, 6115 ]
  !gapprompt@gap>| !gapinput@Size(R2);|
  [ 4, 11, 20, 24, 36, 60, 65, 102, 116, 168, 172, 248, 323, 628, 650, 1093, 
    1107, 2456, 2344, 6115 ]
  
\end{Verbatim}
 

   }

 
\section{\textcolor{Chapter }{Minimal resolutions for finite $p$\texttt{\symbol{45}}groups over $\mathbb F_p$}}\logpage{[ 11, 4, 0 ]}
\hyperdef{L}{X85374EA47E3D97CF}{}
{
 The following uses linear algebra to construct a minimal free $\mathbb F_pG$\texttt{\symbol{45}}resolution of the trivial module $\mathbb F$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=SylowSubgroup(MathieuGroup(12),2);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionPrimePowerGroup(P,20);|
  Resolution of length 20 in characteristic 2 for Group(
  [ (2,8,4,12)(3,11,7,9), (2,3)(4,7)(6,10)(9,11), (3,7)(6,10)(8,11)(9,12), 
    (1,10)(3,7)(5,6)(8,12), (2,4)(3,7)(8,12)(9,11), (1,5)(6,10)(8,12)(9,11) 
   ]) . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 6, 62, 282, 740, 1810, 3518, 6440, 10600, 17040, 24162, 34774, 49874, 
    62416, 81780, 106406, 145368, 172282, 208926, 262938, 320558 ]
  
\end{Verbatim}
 The resolution has the minimum number of generators possible in each degree
and can be used to guess a formula for the Poincare series 

$P(x) = \Sigma_{k\ge 0} \dim_{\mathbb F_p}H^k(G,\mathbb F_p)\,x^k$. 

The guess is certainly correct for the coefficients of $x^k$ for $k\le 20$ and can be used to guess the dimension of say $H^{2000}(G,\mathbb F_p)$. 

 Most likely $\dim_{\mathbb F_2}H^{2000}(G,\mathbb F_2) = 2001000$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=PoincareSeries(R,20);|
  (1)/(-x_1^3+3*x_1^2-3*x_1+1)
  
  !gapprompt@gap>| !gapinput@ExpansionOfRationalFunction(P,2000)[2000];|
  2001000
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for abelian groups}}\logpage{[ 11, 5, 0 ]}
\hyperdef{L}{X866C8D91871D1170}{}
{
 The following uses the formula for the tensor product of chain complexes to
construct a resolution. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=AbelianPcpGroup([2,4,8,0,0]);;|
  !gapprompt@gap>| !gapinput@StructureDescription(A);|
  "Z x Z x C8 x C4 x C2"
  
  !gapprompt@gap>| !gapinput@R:=ResolutionAbelianGroup(A,10);|
  Resolution of length 10 in characteristic 0 for Pcp-group with orders 
  [ 2, 4, 8, 0, 0 ] . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 14, 90, 296, 680, 1256, 2024, 2984, 4136, 5480, 7016 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for nilpotent groups}}\logpage{[ 11, 6, 0 ]}
\hyperdef{L}{X7B332CBE85120B38}{}
{
 The following uses the NQ package to express the free nilpotent group of class $3$ on three generators as a Pcp group $G$, and then uses homological perturbation on the lower central series to
construct a resolution. The resolution is used to exhibit $2$\texttt{\symbol{45}}torsion in $H_4(G,\mathbb Z)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FreeGroup(3);;|
  !gapprompt@gap>| !gapinput@G:=Image(NqEpimorphismNilpotentQuotient(F,3));;|
  !gapprompt@gap>| !gapinput@R:=ResolutionNilpotentGroup(G,5);|
  Resolution of length 5 in characteristic 0 for Pcp-group with orders 
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 28, 377, 2377, 9369, 25850 ]
  
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R),4);|
  [ 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 The following example uses a simplification procedure for resolutions to
construct a resolution $S_\ast$ for the free nilpotent group $G$ of class $2$ on $3$ generators that has the minimal possible number of free generators in each
degree. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=Image(NqEpimorphismNilpotentQuotient(FreeGroup(3),2));;|
  !gapprompt@gap>| !gapinput@R:=ResolutionNilpotentGroup(G,10);;|
  !gapprompt@gap>| !gapinput@S:=ContractedComplex(R);;|
  !gapprompt@gap>| !gapinput@C:=TensorWithIntegers(S);; |
  !gapprompt@gap>| !gapinput@List([1..10],i->IsZero(BoundaryMatrix(C,i)));|
  [ true, true, true, true, true, true, true, true, true, true ]
  
\end{Verbatim}
 The following example uses homological perturbation on the lower central
series to construct a resolution for the Sylow $2$\texttt{\symbol{45}}subgroup $P=Syl_2(M_{12})$ of the Mathieu simple group $M_{12}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=MathieuGroup(12);;|
  !gapprompt@gap>| !gapinput@P:=SylowSubgroup(G,2);;|
  !gapprompt@gap>| !gapinput@StructureDescription(P);|
  "((C4 x C4) : C2) : C2"
  
  !gapprompt@gap>| !gapinput@R:=ResolutionNilpotentGroup(P,9);|
  Resolution of length 9 in characteristic 
  0 for <permutation group with 279 generators> . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 12, 80, 310, 939, 2556, 6768, 19302, 61786, 237068 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for groups with subnormal series}}\logpage{[ 11, 7, 0 ]}
\hyperdef{L}{X7B03997084E00509}{}
{
 The following uses homological perturbation on a subnormal series to construct
a resolution for the Sylow $2$\texttt{\symbol{45}}subgroup $P=Syl_2(M_{12})$ of the Mathieu simple group $M_{12}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=SylowSubgroup(MathieuGroup(12),2);;|
  !gapprompt@gap>| !gapinput@sn:=ElementaryAbelianSeries(P);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionSubnormalSeries(sn,9);|
  Resolution of length 9 in characteristic 
  0 for <permutation group with 64 generators> . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 12, 78, 288, 812, 1950, 4256, 8837, 18230, 39120 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for groups with normal series}}\logpage{[ 11, 8, 0 ]}
\hyperdef{L}{X814FFCE080B3A826}{}
{
 The following uses homological perturbation on a normal series to construct a
resolution for the Sylow $2$\texttt{\symbol{45}}subgroup $P=Syl_2(M_{12})$ of the Mathieu simple group $M_{12}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=SylowSubgroup(MathieuGroup(12),2);;|
  !gapprompt@gap>| !gapinput@P1:=EfficientNormalSubgroups(P)[1];;|
  !gapprompt@gap>| !gapinput@P2:=Intersection(DerivedSubgroup(P),P1);;|
  !gapprompt@gap>| !gapinput@P3:=Group(One(P));;|
  !gapprompt@gap>| !gapinput@R:=ResolutionNormalSeries([P,P1,P2,P3],9);|
  Resolution of length 9 in characteristic 
  0 for <permutation group with 64 generators> . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 10, 60, 200, 532, 1238, 2804, 6338, 15528, 40649 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for polycyclic (almost) crystallographic groups }}\logpage{[ 11, 9, 0 ]}
\hyperdef{L}{X81227BF185C417AF}{}
{
 The following uses the Polycyclic package and homological perturbation to
construct a resolution for the crystallographic group \texttt{G:=SpaceGroup(3,165)}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SpaceGroup(3,165);;|
  !gapprompt@gap>| !gapinput@G:=Image(IsomorphismPcpGroup(G));;|
  !gapprompt@gap>| !gapinput@R:=ResolutionAlmostCrystalGroup(G,20);|
  Resolution of length 20 in characteristic 0 for Pcp-group with orders 
  [ 3, 2, 0, 0, 0 ] . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 10, 49, 117, 195, 273, 351, 429, 507, 585, 663, 741, 819, 897, 975, 1053, 
    1131, 1209, 1287, 1365, 1443 ]
  
\end{Verbatim}
 The following constructs a resolution for an almost crystallographic Pcp group $G$. The final commands establish that $G$ is not isomorphic to a crystallographic group. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=AlmostCrystallographicPcpGroup( 4, 50, [ 1, -4, 1, 2 ] );;|
  !gapprompt@gap>| !gapinput@R:=ResolutionAlmostCrystalGroup(G,20);|
  Resolution of length 20 in characteristic 0 for Pcp-group with orders 
  [ 4, 0, 0, 0, 0 ] . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 10, 53, 137, 207, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 
    223, 223, 223, 223, 223 ]
  
  
  !gapprompt@gap>| !gapinput@T:=Kernel(NaturalHomomorphismOnHolonomyGroup(G));;|
  !gapprompt@gap>| !gapinput@IsAbelian(T);|
  false
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for Bieberbach groups }}\logpage{[ 11, 10, 0 ]}
\hyperdef{L}{X814BCDD6837BB9C5}{}
{
 The following constructs a resolution for the Bieberbach group \texttt{G=SpaceGroup(3,165)} by using convex hull algorithms to construct a Dirichlet domain for its free
action on Euclidean space $\mathbb R^3$. By construction the resolution is trivial in degrees $\ge 3$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SpaceGroup(3,165);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionBieberbachGroup(G);|
  Resolution of length 4 in characteristic 
  0 for SpaceGroupOnRightBBNWZ( 3, 6, 1, 1, 4 ) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 10, 18, 8, 0 ]
  
\end{Verbatim}
 The fundamental domain constructed for the above resolution can be visualized
using the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FundamentalDomainBieberbachGroup(G);|
  <polymake object>
  !gapprompt@gap>| !gapinput@Display(F);|
  
\end{Verbatim}
 

  

 A different fundamental domain and resolution for $G$ can be obtained by changing the choice of vector $v\in \mathbb R^3$ in the definition of the Dirichlet domain 

$D(v) = \{x\in \mathbb R^3\ | \ ||x-v|| \le ||x-g.v||\ {\rm for~all~} g\in G\}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionBieberbachGroup(G,[1/2,1/2,1/2]);|
  Resolution of length 4 in characteristic 
  0 for SpaceGroupOnRightBBNWZ( 3, 6, 1, 1, 4 ) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 28, 42, 16, 0 ]
  
  !gapprompt@gap>| !gapinput@F:=FundamentalDomainBieberbachGroup(G);|
  <polymake object>
  !gapprompt@gap>| !gapinput@Display(F);|
  
\end{Verbatim}
 

  

 A higher dimensional example is handled in the next session. A list of the $62$ $7$\texttt{\symbol{45}}dimensional Hantze\texttt{\symbol{45}}Wendt Bieberbach
groups is loaded and a resolution is computed for the first group in the list. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("HW-7dim.txt");;|
  !gapprompt@gap>| !gapinput@Read(file);|
  !gapprompt@gap>| !gapinput@G:=HWO7Gr[1];|
  <matrix group with 7 generators>
  
  !gapprompt@gap>| !gapinput@R:=ResolutionBieberbachGroup(G);|
  Resolution of length 8 in characteristic 0 for <matrix group with 
  7 generators> . 
  No contracting homotopy available.
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 284, 1512, 3780, 4480, 2520, 840, 84, 0 ]
  
\end{Verbatim}
 

The homological perturbation techniques needed to extend this method to
crystallographic groups acting non\texttt{\symbol{45}}freely on $\mathbb R^n$ has not yet been implemenyed. This is on the TO\texttt{\symbol{45}}DO list. }

 
\section{\textcolor{Chapter }{Resolutions for arbitrary crystallographic groups}}\logpage{[ 11, 11, 0 ]}
\hyperdef{L}{X87ADCB7D7FC0B4D3}{}
{
 An implementation of the above method for Bieberbach groups is also available
for arbitrary crystallographic groups. The following example constructs a
resolution for the group \texttt{G:=SpaceGroupIT(3,227)}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SpaceGroupIT(3,227);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionSpaceGroup(G,11);|
  Resolution of length 11 in characteristic 0 for <matrix group with 
  8 generators> . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 38, 246, 456, 644, 980, 1427, 2141, 2957, 3993, 4911, 6179 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for crystallographic groups admitting cubical fundamental domain}}\logpage{[ 11, 12, 0 ]}
\hyperdef{L}{X7B9B3AF487338A9B}{}
{
 The following uses subdivision techniques to construct a resolution for the
Bieberbach group \texttt{G:=SpaceGroup(4,122)}. The resolution is endowed with a contracting homotopy. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SpaceGroup(4,122);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionCubicalCrystGroup(G,20);|
  Resolution of length 20 in characteristic 0 for <matrix group with 
  6 generators> . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 8, 24, 24, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 Subdivision and homological perturbation are used to construct the following
resolution (with contracting homotopy) for a crystallographic group with
non\texttt{\symbol{45}}free action. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SpaceGroup(4,1100);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionCubicalCrystGroup(G,20);|
  Resolution of length 20 in characteristic 0 for <matrix group with 
  8 generators> . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 40, 215, 522, 738, 962, 1198, 1466, 1734, 2034, 2334, 2666, 2998, 3362, 
    3726, 4122, 4518, 4946, 5374, 5834, 6294 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for Coxeter groups }}\logpage{[ 11, 13, 0 ]}
\hyperdef{L}{X78DD8D068349065A}{}
{
 The following session constructs the Coxeter diagram for the Coxeter group $B=B_7$ of order $645120$. A resolution for $G$ is then computed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=[[1,[2,3]],[2,[3,3]],[3,[4,3]],[4,[5,3]],[5,[6,3]],[6,[7,4]]];;|
  !gapprompt@gap>| !gapinput@CoxeterDiagramDisplay(D);;|
  
\end{Verbatim}
 

  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionCoxeterGroup(D,5);|
  Resolution of length 5 in characteristic 
  0 for <permutation group of size 645120 with 7 generators> . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 14, 112, 492, 1604, 5048 ]
  
\end{Verbatim}
 The routine extension of this method to infinite Coxeter groups is on the
TO\texttt{\symbol{45}}DO list. }

 
\section{\textcolor{Chapter }{Resolutions for Artin groups }}\logpage{[ 11, 14, 0 ]}
\hyperdef{L}{X7C69E7227F919CC9}{}
{
 The following session constructs a resolution for the infinite Artin group $G$ associated to the Coxeter group $B_7$. Exactness of the resolution depends on the solution to the $K(\pi,1)$ Conjecture for Artin groups of spherical type. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionArtinGroup(D,8);|
  Resolution of length 8 in characteristic 0 for <fp group on the generators 
  [ f1, f2, f3, f4, f5, f6, f7 ]> . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 14, 98, 310, 610, 918, 1326, 2186, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for $G=SL_2(\mathbb Z[1/m])$}}\logpage{[ 11, 15, 0 ]}
\hyperdef{L}{X8032647F8734F4EB}{}
{
 The following uses homological perturbation to construct a resolution for $G=SL_2(\mathbb Z[1/6])$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionSL2Z(6,10);|
  Resolution of length 10 in characteristic 0 for SL(2,Z[1/6]) . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 44, 679, 6910, 21304, 24362, 48506, 43846, 90928, 86039, 196210 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for selected groups $G=SL_2( {\mathcal O}(\mathbb Q(\sqrt{d}) )$}}\logpage{[ 11, 16, 0 ]}
\hyperdef{L}{X7BE4DE82801CD38E}{}
{
 The following uses finite "Voronoi complexes" and homological perturbation to
construct a resolution for $G=SL_2({\mathcal O}(\mathbb Q(\sqrt{-5}))$. The finite complexes were contributed independently by A. Rahm, M.
Dutour\texttt{\symbol{45}}Scikiric and S. Schoenenbeck and are stored in the
folder \texttt{\texttt{\symbol{126}}pkg/Hap1.v/lib/Perturbations/Gcomplexes}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionSL2QuadraticIntegers(-5,10);|
  Resolution of length 10 in characteristic 0 for matrix group . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 22, 114, 120, 200, 146, 156, 136, 254, 168, 170 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for selected groups $G=PSL_2( {\mathcal O}(\mathbb Q(\sqrt{d}) )$}}\logpage{[ 11, 17, 0 ]}
\hyperdef{L}{X7D9CCB2C7DAA2310}{}
{
 The following uses finite "Voronoi complexes" and homological perturbation to
construct a resolution for $G=PSL_2({\mathcal O}(\mathbb Q(\sqrt{-11}))$. The finite complexes were contributed independently by A. Rahm, M.
Dutour\texttt{\symbol{45}}Scikiric and S. Schoenenbeck and are stored in the
folder \texttt{\texttt{\symbol{126}}pkg/Hap1.v/lib/Perturbations/Gcomplexes}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionPSL2QuadraticIntegers(-11,10);|
  Resolution of length 10 in characteristic 0 for PSL(2,O-11) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 12, 59, 89, 107, 125, 230, 208, 270, 326, 515 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for a few higher\texttt{\symbol{45}}dimensional arithmetic groups }}\logpage{[ 11, 18, 0 ]}
\hyperdef{L}{X7F699587845E6DB1}{}
{
 The following uses finite "Voronoi complexes" and homological perturbation to
construct a resolution for $G=PSL_4(\mathbb Z)$. The finite complexes were contributed by M.
Dutour\texttt{\symbol{45}}Scikiric and are stored in the folder \texttt{\texttt{\symbol{126}}pkg/Hap1.v/lib/Perturbations/Gcomplexes}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ V:=ContractibleGcomplex("PSL(4,Z)_d");|
  Non-free resolution in characteristic 0 for matrix group . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(V,5);|
  Resolution of length 5 in characteristic 0 for matrix group . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 18, 210, 1444, 26813 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for finite\texttt{\symbol{45}}index subgroups }}\logpage{[ 11, 19, 0 ]}
\hyperdef{L}{X7812EB3F7AC45F87}{}
{
 The next commands first construct the congruence subgroup $\Gamma_0(I)$ of index $144$ in $SL_2({\cal O}\mathbb Q(\sqrt{-2}))$ for the ideal $I$ in ${\cal O}\mathbb Q(\sqrt{-2})$ generated by $4+5\sqrt{-2}$. The commands then compute a resolution for the congruence subgroup $G=\Gamma_0(I) \le SL_2({\cal O}\mathbb Q(\sqrt{-2}))$ 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuadraticNumberField(-2);;|
  !gapprompt@gap>| !gapinput@OQ:=RingOfIntegers(Q);;|
  !gapprompt@gap>| !gapinput@I:=QuadraticIdeal(OQ,4+5*Sqrt(-2));;|
  !gapprompt@gap>| !gapinput@G:=HAP_CongruenceSubgroupGamma0(I);|
  <[group of 2x2 matrices in characteristic 0>
  !gapprompt@gap>| !gapinput@|
  !gapprompt@gap>| !gapinput@IndexInSL2O(G);|
  144
  !gapprompt@gap>| !gapinput@R:=ResolutionSL2QuadraticIntegers(-2,4,true);;|
  !gapprompt@gap>| !gapinput@S:=ResolutionFiniteSubgroup(R,G);|
  Resolution of length 4 in characteristic 0 for <matrix group with 
  290 generators> . 
  
  !gapprompt@gap>| !gapinput@Size(S);|
  [ 1152, 8496, 30960, 59616 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Simplifying resolutions }}\logpage{[ 11, 20, 0 ]}
\hyperdef{L}{X84CAAA697FAC8E0D}{}
{
 The next commands construct a resolution $R_\ast$ for the symmetric group $S_5$ and convert it to a resolution $S_\ast$ for the finite index subgroup $A_4 < S_5$. An heuristic algorithm is applied to $S_\ast$ in the hope of obtaining a smaller resolution $T_\ast$ for the alternating group $A_4$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(SymmetricGroup(5),5);;|
  !gapprompt@gap>| !gapinput@S:=ResolutionFiniteSubgroup(R,AlternatingGroup(4));|
  Resolution of length 5 in characteristic 0 for Alt( [ 1 .. 4 ] ) . 
  
  !gapprompt@gap>| !gapinput@Size(S);|
  [ 80, 380, 1000, 2040, 3400 ]
  !gapprompt@gap>| !gapinput@T:=SimplifiedComplex(S);|
  Resolution of length 5 in characteristic 0 for Alt( [ 1 .. 4 ] ) . 
  
  !gapprompt@gap>| !gapinput@Size(T);|
  [ 4, 34, 22, 19, 196 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for graphs of groups and for groups with aspherical presentations }}\logpage{[ 11, 21, 0 ]}
\hyperdef{L}{X780C3F038148A1C7}{}
{
 The following example constructs a resolution for a finitely presented group
whose presentation is known to have the property that its associated $2$\texttt{\symbol{45}}complex is aspherical. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FreeGroup(3);;x:=F.1;;y:=F.2;;z:=F.3;;|
  !gapprompt@gap>| !gapinput@rels:=[x*y*x*(y*x*y)^-1, y*z*y*(z*y*z)^-1, z*x*z*(x*z*x)^-1];;|
  !gapprompt@gap>| !gapinput@G:=F/rels;;|
  !gapprompt@gap>| !gapinput@R:=ResolutionAsphericalPresentation(G,10);|
  Resolution of length 10 in characteristic 0 for <fp group on the generators 
  [ f1, f2, f3 ]> . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 6, 18, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 The following commands create a resolution for a graph of groups corresponding
to the amalgamated product $G=H\ast_AK$ where $H=S_5$ is the symmetric group of degree $5$, $K=S_4$ is the symmetric group of degree $4$ and the common subgroup is $A=S_3$. }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@S5:=SymmetricGroup(5);SetName(S5,"S5");;|
  Sym( [ 1 .. 5 ] )
  !gapprompt@gap>| !gapinput@S4:=SymmetricGroup(4);SetName(S4,"S4");;|
  Sym( [ 1 .. 4 ] )
  !gapprompt@gap>| !gapinput@A:=SymmetricGroup(3);SetName(A,"S3");;|
  Sym( [ 1 .. 3 ] )
  !gapprompt@gap>| !gapinput@AS5:=GroupHomomorphismByFunction(A,S5,x->x);;|
  !gapprompt@gap>| !gapinput@AS4:=GroupHomomorphismByFunction(A,S4,x->x);;|
  !gapprompt@gap>| !gapinput@D:=[S5,S4,[AS5,AS4]];;|
  !gapprompt@gap>| !gapinput@GraphOfGroupsDisplay(D);;|
  
\end{Verbatim}
 

  

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionGraphOfGroups(D,8);;|
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 16, 68, 162, 302, 480, 627, 869, 1290 ]
  
\end{Verbatim}
 
\section{\textcolor{Chapter }{Resolutions for $\mathbb FG$\texttt{\symbol{45}}modules }}\logpage{[ 11, 22, 0 ]}
\hyperdef{L}{X85AB973F8566690A}{}
{
 Let $\mathbb F=\mathbb F_p$ be the field of $p$ elements and let $M$ be some $\mathbb FG$\texttt{\symbol{45}}module for $G$ a finite $p$\texttt{\symbol{45}}group. We might wish to construct a free $\mathbb FG$\texttt{\symbol{45}}resolution for $M$. We can handle this by constructing a short exact sequence 

$ DM \rightarrowtail P \twoheadrightarrow M$ 

 in which $P$ is free (or projective). Then any resolution of $DM$ yields a resolution of $M$ and we can represent $DM$ as a submodule of $P$. We refer to $DM$ as the \emph{desuspension} of $M$. Consider for instance $G=Syl_2(GL(4,2))$ and $\mathbb F=\mathbb F_2$. The matrix group $G$ acts via matrix multiplication on $M=\mathbb F^4$. The following example constructs a free $\mathbb FG$\texttt{\symbol{45}}resolution for $M$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|G:=GL(4,2);;A
  @gapprompt|gap>A @gapinput|S:=SylowSubgroup(G,2);;A
  @gapprompt|gap>A @gapinput|M:=GModuleByMats(GeneratorsOfGroup(S),GF(2));;A
  @gapprompt|gap>A @gapinput|DM:=DesuspensionMtxModule(M);;A
  @gapprompt|gap>A @gapinput|R:=ResolutionFpGModule(DM,20);A
  Resolution of length 20 in characteristic 2 for <matrix group of 
  size 64 with 3 generators> .
  
  @gapprompt|gap>A @gapinput|List([0..20],R!.dimension);A
  [ 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 
  153, 171, 190, 210, 231, 253 ]
  
\end{Verbatim}
 }

 }

 
\chapter{\textcolor{Chapter }{Simplicial groups}}\label{chapSimplicialGroups}
\logpage{[ 12, 0, 0 ]}
\hyperdef{L}{X7D818E5F80F4CF63}{}
{
 
\section{\textcolor{Chapter }{Crossed modules}}\label{secCrossedModules}
\logpage{[ 12, 1, 0 ]}
\hyperdef{L}{X808C6B357F8BADC1}{}
{
 A \emph{crossed module} consists of a homomorphism of groups $\partial\colon M\rightarrow G$ together with an action $(g,m)\mapsto\, {^gm}$ of $G$ on $M$ satisfying 
\begin{enumerate}
\item  $\partial(^gm) = gmg^{-1}$
\item  $^{\partial m}m' = mm'm^{-1}$
\end{enumerate}
 for $g\in G$, $m,m'\in M$. 

 A crossed module $\partial\colon M\rightarrow G$ is equivalent to a cat$^1$\texttt{\symbol{45}}group $(H,s,t)$ (see \ref{secCat1}) where $H=M \rtimes G$, $s(m,g) = (1,g)$, $t(m,g)=(1,(\partial m)g)$. A cat$^1$\texttt{\symbol{45}}group is, in turn, equivalent to a simplicial group with
Moore complex has length $1$. The simplicial group is constructed by considering the cat$^1$\texttt{\symbol{45}}group as a category and taking its nerve. Alternatively,
the simplicial group can be constructed by viewing the crossed module as a
crossed complex and using a nonabelian version of the
Dold\texttt{\symbol{45}}Kan theorem. 

The following example concerns the crossed module 

$\partial\colon G\rightarrow Aut(G), g\mapsto (x\mapsto gxg^{-1})$ 

associated to the dihedral group $G$ of order $16$. This crossed module represents, up to homotopy type, a connected space $X$ with $\pi_iX=0$ for $i\ge 3$, $\pi_2X=Z(G)$, $\pi_1X = Aut(G)/Inn(G)$. The space $X$ can be represented, up to homotopy, by a simplicial group. That simplicial
group is used in the example to compute 

$H_1(X,\mathbb Z)= \mathbb Z_2 \oplus \mathbb Z_2$, 

$H_2(X,\mathbb Z)= \mathbb Z_2 $, 

$H_3(X,\mathbb Z)= \mathbb Z_2 \oplus \mathbb Z_2 \oplus \mathbb Z_2$, 

$H_4(X,\mathbb Z)= \mathbb Z_2 \oplus \mathbb Z_2 \oplus \mathbb Z_2$, 

$H_5(X,\mathbb Z)= \mathbb Z_2 \oplus \mathbb Z_2 \oplus \mathbb Z_2 \oplus
\mathbb Z_2\oplus \mathbb Z_2\oplus \mathbb Z_2$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@C:=AutomorphismGroupAsCatOneGroup(DihedralGroup(16));|
  Cat-1-group with underlying group Group( 
  [ f1, f2, f3, f4, f5, f6, f7, f8, f9 ] ) . 
  
  !gapprompt@gap>| !gapinput@Size(C);|
  512
  !gapprompt@gap>| !gapinput@Q:=QuasiIsomorph(C);|
  Cat-1-group with underlying group Group( [ f9, f8, f1, f2*f3, f5 ] ) . 
  
  !gapprompt@gap>| !gapinput@Size(Q);|
  32
  
  !gapprompt@gap>| !gapinput@N:=NerveOfCatOneGroup(Q,6);|
  Simplicial group of length 6
  
  !gapprompt@gap>| !gapinput@K:=ChainComplexOfSimplicialGroup(N);|
  Chain complex of length 6 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Homology(K,1);|
  [ 2, 2 ]
  !gapprompt@gap>| !gapinput@Homology(K,2);|
  [ 2 ]
  !gapprompt@gap>| !gapinput@Homology(K,3);|
  [ 2, 2, 2 ]
  !gapprompt@gap>| !gapinput@Homology(K,4);|
  [ 2, 2, 2 ]
  !gapprompt@gap>| !gapinput@Homology(K,5);|
  [ 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Eilenberg\texttt{\symbol{45}}MacLane spaces as simplicial groups (not
recommended)}}\label{eilennot}
\logpage{[ 12, 2, 0 ]}
\hyperdef{L}{X795E339978B42775}{}
{
 

The following example concerns the Eilenberg\texttt{\symbol{45}}MacLane space $X=K(\mathbb Z_3,3)$ which is a path\texttt{\symbol{45}}connected space with $\pi_3X=\mathbb Z_3$, $\pi_iX=0$ for $3\ne i\ge 1$. This space is represented by a simplicial group, and perturbation techniques
are used to compute 

$H_7(X,\mathbb Z)=\mathbb Z_3 \oplus \mathbb Z_3$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=AbelianGroup([3]);;AbelianInvariants(A);   |
  [ 3 ]
  !gapprompt@gap>| !gapinput@ K:=EilenbergMacLaneSimplicialGroup(A,3,8);|
  Simplicial group of length 8
  
  !gapprompt@gap>| !gapinput@C:=ChainComplex(K);|
  Chain complex of length 8 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Homology(C,7);                                          |
  [ 3, 3 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Eilenberg\texttt{\symbol{45}}MacLane spaces as simplicial free abelian groups
(recommended)}}\label{eilen}
\logpage{[ 12, 3, 0 ]}
\hyperdef{L}{X7D91E64D7DD7F10F}{}
{
 

For integer $n>1$ and abelian group $A$ the Eilenberg\texttt{\symbol{45}}MacLane space $K(A,n)$ is better represented as a simplicial free abelian group. (The reason is that
the functorial bar resolution of a group can be replaced in computations by
the smaller functorial Chevalley\texttt{\symbol{45}}Eilenberg complex of the
group when the group is free abelian, obviating the need for perturbation
techniques. When $A$ has torision we can replace it with an inclusion of free abelian groups $A_1 \hookrightarrow A_0$ with $A\cong A_0/A_1$ and again invoke the Chevalley\texttt{\symbol{45}}Eilenberg complex. The
current implementation unfortunately handles only free abelian $A$ but the easy extension to non\texttt{\symbol{45}}free $A$ is planned for a future release.) 

The following commands compute the integral homology $H_n(K(\mathbb Z,3),\mathbb Z)$ for $ 0\le n \le 16$. (Note that one typically needs fewer than $n$ terms of the Eilenberg\texttt{\symbol{45}}MacLance space to compute its $n$\texttt{\symbol{45}}th homology \texttt{\symbol{45}}\texttt{\symbol{45}} an
error is printed if too few terms of the space are available for a given
computation.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=AbelianPcpGroup([0]);; #infinite cyclic group                    |
  !gapprompt@gap>| !gapinput@K:=EilenbergMacLaneSimplicialFreeAbelianGroup(A,3,14);|
  Simplicial free abelian group of length 14
  
  !gapprompt@gap>| !gapinput@for n in [0..16] do|
  !gapprompt@>| !gapinput@Print("Degree ",n," integral homology of K is ",Homology(K,n),"\n");|
  !gapprompt@>| !gapinput@od;|
  Degree 0 integral homology of K is [ 0 ]
  Degree 1 integral homology of K is [  ]
  Degree 2 integral homology of K is [  ]
  Degree 3 integral homology of K is [ 0 ]
  Degree 4 integral homology of K is [  ]
  Degree 5 integral homology of K is [ 2 ]
  Degree 6 integral homology of K is [  ]
  Degree 7 integral homology of K is [ 3 ]
  Degree 8 integral homology of K is [ 2 ]
  Degree 9 integral homology of K is [ 2 ]
  Degree 10 integral homology of K is [ 3 ]
  Degree 11 integral homology of K is [ 5, 2 ]
  Degree 12 integral homology of K is [ 2 ]
  Degree 13 integral homology of K is [  ]
  Degree 14 integral homology of K is [ 10, 2 ]
  Degree 15 integral homology of K is [ 7, 6 ]
  Degree 16 integral homology of K is [  ]
  
\end{Verbatim}
 For an $n$\texttt{\symbol{45}}connected pointed space $X$ the Freudenthal Suspension Theorem states that the map $X \rightarrow \Omega(\Sigma X)$ induces a map $\pi_k(X) \rightarrow \pi_k(\Omega(\Sigma X))$ which is an isomorphism for $k\le 2n$ and epimorphism for $k=2n+1$. Thus the Eilenberg\texttt{\symbol{45}}MacLane space $K(A,n+1)$ can be constructed from the suspension $\Sigma K(A,n)$ by attaching cells in dimensions $\ge 2n+1$. In particular, there is an isomorphism $ H_{k-1}(K(A,n),\mathbb Z) \rightarrow H_k(K(A,n+1),\mathbb Z)$ for $k\le 2n$ and epimorphism for $k=2n+1$. 

 For instance, $ H_{k-1}(K(\mathbb Z,3),\mathbb Z) \cong H_k(K(\mathbb Z,4),\mathbb Z) $ for $k\le 6$ and $ H_6(K(\mathbb Z,3),\mathbb Z) \twoheadrightarrow H_7(K(\mathbb Z,4),\mathbb Z) $. This assertion is seen in the following session. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=AbelianPcpGroup([0]);; #infinite cyclic group                    |
  !gapprompt@gap>| !gapinput@K:=EilenbergMacLaneSimplicialFreeAbelianGroup(A,4,11);|
  Simplicial free abelian group of length 11
  
  !gapprompt@gap>| !gapinput@for n in [0..13] do|
  !gapprompt@>| !gapinput@Print("Degree ",n," integral homology of K is ",Homology(K,n),"\n");|
  !gapprompt@>| !gapinput@od;|
  Degree 0 integral homology of K is [ 0 ]
  Degree 1 integral homology of K is [  ]
  Degree 2 integral homology of K is [  ]
  Degree 3 integral homology of K is [  ]
  Degree 4 integral homology of K is [ 0 ]
  Degree 5 integral homology of K is [  ]
  Degree 6 integral homology of K is [ 2 ]
  Degree 7 integral homology of K is [  ]
  Degree 8 integral homology of K is [ 3, 0 ]
  Degree 9 integral homology of K is [  ]
  Degree 10 integral homology of K is [ 2, 2 ]
  Degree 11 integral homology of K is [  ]
  Degree 12 integral homology of K is [ 5, 12, 0 ]
  Degree 13 integral homology of K is [ 2 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Elementary theoretical information on $H^\ast(K(\pi,n),\mathbb Z)$}}\logpage{[ 12, 4, 0 ]}
\hyperdef{L}{X84ABCA497C577132}{}
{
  

The cup product is not implemented for the cohomology ring $H^\ast(K(\pi,n),\mathbb Z)$. Standard theoretical spectral sequence arguments have to be applied to
obtain basic information relating to the ring structure. To illustrate this
the following commands compute $H^n(K(\mathbb Z,2),\mathbb Z)$ for the first few values of $n$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=EilenbergMacLaneSimplicialFreeAbelianGroup(A,2,10);;|
  !gapprompt@gap>| !gapinput@List([0..10],k->Cohomology(K,k));|
  [ [ 0 ], [  ], [ 0 ], [  ], [ 0 ], [  ], [ 0 ], [  ], [ 0 ], [  ], [ 0 ] ]
  
\end{Verbatim}
 There is a fibration sequence $K(\pi,n) \hookrightarrow \ast \twoheadrightarrow K(\pi,n+1)$ in which $\ast$ denotes a contractible space. For $n=1, \pi=\mathbb Z$ the terms of the $E_2$ page of the Serre integral cohomology spectral sequence for this fibration are 
\begin{itemize}
\item  $E_2^{pq}= H^p( K(\mathbb Z,2), H^q(K(\mathbb Z,1),\mathbb Z) )$ .
\end{itemize}
 Since $K(\mathbb Z,1)$ can be taken to be the circle $S^1$ we know that it has non\texttt{\symbol{45}}trivial cohomology in degrees $0$ and $1$ only. The first few terms of the $E_2$ page are given in the following table. \begin{center}
\begin{tabular}{l|lllllllllll} $1$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ \\
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ \\
 $q/p$ &
 $0$ &
 $1$ &
 $2$ &
 $3$ &
 $4$ &
 $5$ &
 $6$ &
 $7$ &
 $8$ &
 $9$ &
 $10$ \\
\end{tabular}\\[2mm]
\textbf{Table: }$E^2$ cohomology page for $K(\mathbb Z,1) \hookrightarrow \ast \twoheadrightarrow K(\mathbb Z,2)$\end{center}

 Let $x$ denote the generator of $H^1(K(\mathbb Z,1),\mathbb Z)$ and $y$ denote the generator of $H^2(K(\mathbb Z,2),\mathbb Z)$. Since $\ast$ has zero cohomology in degrees $\ge 1$ we see that the differential must restrict to an isomorphism $d_2\colon E_2^{0,1} \rightarrow E_2^{2,0}$ with $d_2(x)=y$. Then we see that the differential must restrict to an isomorphism $d_2\colon E_2^{2,1} \rightarrow E_2^{4,0}$ defined on the generator $xy$ of $E_2^{2,1}$ by 
\[d_2(xy) = d_2(x)y + (-1)^{{\rm deg}(x)}xd_2(y) =y^2\ . \]
 Hence $E_2^{4,0} \cong H^4(K(\mathbb Z,2),\mathbb Z)$ is generated by $y^2$. The argument extends to show that $H^6(K(\mathbb Z,2),\mathbb Z)$ is generated by $y^3$, $H^8(K(\mathbb Z,2),\mathbb Z)$ is generated by $y^4$, and so on. 

In fact, to obtain a complete description of the ring $H^\ast(K(\mathbb Z,2),\mathbb Z)$ in this fashion there is no benefit to using computer methods at all. We only
need to know the cohomology ring $H^\ast(K(\mathbb Z,1),\mathbb Z) =H^\ast(S^1,\mathbb Z)$ and the single cohomology group $H^2(K(\mathbb Z,2),\mathbb Z)$. 

A similar approach can be attempted for $H^\ast(K(\mathbb Z,3),\mathbb Z)$ using the fibration sequence $K(\mathbb Z,2) \hookrightarrow \ast \twoheadrightarrow K(\mathbb Z,3)$ and, as explained in Chapter 5 of \cite{hatcher}, yields the computation of the group $H^i(K(\mathbb Z,3),\mathbb Z)$ for $4\le i\le 13$. The method does not directly yield $H^3(K(\mathbb Z,3),\mathbb Z)$ and breaks down in degree $14$ yielding only that $H^{14}(K(\mathbb Z,3),\mathbb Z) = 0 {\rm ~or~} \mathbb Z_3$. The following commands provide $H^3(K(\mathbb Z,3),\mathbb Z)= \mathbb Z$ and $H^{14}(K(\mathbb Z,3),\mathbb Z) =0$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=AbelianPcpGroup([0]);;|
  !gapprompt@gap>| !gapinput@K:=EilenbergMacLaneSimplicialFreeAbelianGroup(A,3,15);;|
  !gapprompt@gap>| !gapinput@Cohomology(K,3);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(K,14);|
  [  ]
  
\end{Verbatim}
 However, the implementation of these commands is currently a bit naive, and
computationally inefficient, since they do not currently employ any
homological perturbation techniques. }

 
\section{\textcolor{Chapter }{The first three non\texttt{\symbol{45}}trivial homotopy groups of spheres}}\label{firstthree}
\logpage{[ 12, 5, 0 ]}
\hyperdef{L}{X7F828D8D8463CC20}{}
{
 

The Hurewicz Theorem immediately gives 
\[\pi_n(S^n)\cong \mathbb Z ~~~ (n\ge 1)\]
 and 
\[\pi_k(S^n)=0 ~~~ (k\le n-1).\]
 

As a CW\texttt{\symbol{45}}complex the Eilenberg\texttt{\symbol{45}}MacLane
space $K=K(\mathbb Z,n)$ can be obtained from an $n$\texttt{\symbol{45}}sphere $S^n=e^0\cup e^n$ by attaching cells in dimensions $\ge n+2$ so as to kill the higher homotopy groups of $S^n$. From the inclusion $\iota\colon S^n\hookrightarrow K(\mathbb Z,n)$ we can form the mapping cone $X=C(\iota)$. The long exact homotopy sequence 

$ \cdots \rightarrow \pi_{k+1}K \rightarrow \pi_{k+1}(K,S^n) \rightarrow \pi_{k}
S^n \rightarrow \pi_kK \rightarrow \pi_k(K,S^n) \rightarrow \cdots$ 

 implies that $\pi_k(K,S^n)=0$ for $0 \le k\le n+1$ and $\pi_{n+2}(K,S^n)\cong \pi_{n+1}(S^n)$. The relative Hurewicz Theorem gives an isomorphism $\pi_{n+2}(K,S^n) \cong H_{n+2}(K,S^n,\mathbb Z)$. The long exact homology sequence 

$ \cdots H_{n+2}(S^n,\mathbb Z) \rightarrow H_{n+2}(K,\mathbb Z) \rightarrow
H_{n+2}(K,S^n, \mathbb Z) \rightarrow H_{n+1}(S^n,\mathbb Z) \rightarrow
\cdots$ 

 arising from the cofibration $S^n \hookrightarrow K \twoheadrightarrow X$ implies that $\pi_{n+1}(S^n)\cong \pi_{n+2}(K,S^n) \cong H_{n+2}(K,S^n,\mathbb Z) \cong
H_{n+2}(K,\mathbb Z)$. From the \textsc{GAP} computations in \ref{eilen} and the Freudenthal Suspension Theorem we find: 
\[ \pi_3S^2 \cong \mathbb Z, ~~~~~~ \pi_{n+1}(S^n)\cong \mathbb Z_2~~~(n\ge 3).\]
 

The Hopf fibration $S^3\rightarrow S^2$ has fibre $S^1 = K(\mathbb Z,1)$. It can be constructed by viewing $S^3$ as all pairs $(z_1,z_2)\in \mathbb C^2$ with $|z_1|^2+|z_2|^2=1$ and viewing $S^2$ as $\mathbb C\cup \infty$; the map sends $(z_1,z_2)\mapsto z_1/z_2$. The homotopy exact sequence of the Hopf fibration yields $\pi_k(S^3) \cong \pi_k(S^2)$ for $k\ge 3$, and in particular 
\[\pi_4(S^2) \cong \pi_4(S^3) \cong \mathbb Z_2\ .\]
 It will require further techniques (such as the Postnikov tower argument in
Section \ref{postnikov2} below) to establish that $\pi_5(S^3) \cong \mathbb Z_2$. Once we have this isomorphism for $\pi_5(S^3)$, the generalized Hopf fibration $S^3 \hookrightarrow S^7 \twoheadrightarrow S^4$ comes into play. This fibration is contructed as for the classical fibration,
but using pairs $(z_1,z_2)$ of quaternions rather than pairs of complex numbers. The Hurewicz Theorem
gives $\pi_3(S^7)=0$; the fibre $S^3$ is thus homotopic to a point in $S^7$ and the inclusion of the fibre induces the zero homomorphism $\pi_k(S^3) \stackrel{0}{\longrightarrow} \pi_k(S^7) ~~(k\ge 1)$. The exact homotopy sequence of the generalized Hopf fibration then gives $\pi_k(S^4)\cong \pi_k(S^7)\oplus \pi_{k-1}(S^3)$. On taking $k=6$ we obtain $\pi_6(S^4)\cong \pi_5(S^3) \cong \mathbb Z_2$. Freudenthal suspension then gives 
\[\pi_{n+2}(S^n)\cong \mathbb Z_2,~~~(n\ge 2).\]
 }

 
\section{\textcolor{Chapter }{The first two non\texttt{\symbol{45}}trivial homotopy groups of the suspension
and double suspension of a $K(G,1)$}}\label{firsttwo}
\logpage{[ 12, 6, 0 ]}
\hyperdef{L}{X81E2F80384ADF8C2}{}
{
 

For any group $G$ we consider the homotopy groups $\pi_n(\Sigma K(G,1))$ of the suspension $\Sigma K(G,1)$ of the Eilenberg\texttt{\symbol{45}}MacLance space $K(G,1)$. On taking $G=\mathbb Z$, and observing that $S^2 = \Sigma K(\mathbb Z,1)$, we specialize to the homotopy groups of the $2$\texttt{\symbol{45}}sphere $S^2$. 

By construction, 
\[\pi_1(\Sigma K(G,1))=0\ .\]
 The Hurewicz Theorem gives 
\[\pi_2(\Sigma K(G,1)) \cong G_{ab}\]
 via the isomorphisms $\pi_2(\Sigma K(G,1)) \cong H_2(\Sigma K(G,1),\mathbb Z) \cong
H_1(K(G,1),\mathbb Z) \cong G_{ab}$. R. Brown and J.\texttt{\symbol{45}}L. Loday \cite{brownloday} obtained the formulae 
\[\pi_3(\Sigma K(G,1)) \cong \ker (G\otimes G \rightarrow G, x\otimes y\mapsto
[x,y]) \ ,\]
 
\[\pi_4(\Sigma^2 K(G,1)) \cong \ker (G\, {\widetilde \otimes}\, G \rightarrow G,
x\, {\widetilde \otimes}\, y\mapsto [x,y]) \]
 involving the nonabelian tensor square and nonabelian symmetric square of the
group $G$. The following commands use the nonabelian tensor and symmetric product to
compute the third and fourth homotopy groups for $G =Syl_2(M_{12})$ the Sylow $2$\texttt{\symbol{45}}subgroup of the Mathieu group $M_{12}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SylowSubgroup(MathieuGroup(12),2);;|
  !gapprompt@gap>| !gapinput@ThirdHomotopyGroupOfSuspensionB(G);   |
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  gap>
  !gapprompt@gap>| !gapinput@FourthHomotopyGroupOfDoubleSuspensionB(G);|
  [ 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Postnikov towers and $\pi_5(S^3)$ }}\label{postnikov2}
\logpage{[ 12, 7, 0 ]}
\hyperdef{L}{X83EAC40A8324571F}{}
{
 A Postnikov system for the sphere $S^3$ consists of a sequence of fibrations $\cdots X_3\stackrel{p_3}{\rightarrow} X_2\stackrel{p_2}{\rightarrow}
X_1\stackrel{p_1}{\rightarrow} \ast$ and a sequence of maps $\phi_n\colon S^3 \rightarrow X_n$ such that 
\begin{itemize}
\item  $p_n \circ \phi_n =\phi_{n-1}$ 
\item The map $\phi_n\colon S^3 \rightarrow X_n$ induces an isomorphism $\pi_k(S^3)\rightarrow \pi_k(X_n)$ for all $k\le n$ 
\item $\pi_k(X_n)=0$ for $k > n$
\item and consequently each fibration $p_n$ has fibre an Eilenberg\texttt{\symbol{45}}MacLane space $K(\pi_n(S^3),n)$.
\end{itemize}
 The space $X_n$ is obtained from $S^3$ by adding cells in dimensions $\ge n+2$ and thus 
\begin{itemize}
\item $H_k(X_n,\mathbb Z)=H_k(S^3,\mathbb Z)$ for $k\le n+1$. 
\end{itemize}
 So in particular $X_1=X_2=\ast, X_3=K(\mathbb Z,3)$ and we have a fibration sequence $K(\pi_4(S^3),4) \hookrightarrow X_4 \twoheadrightarrow K(\mathbb Z,3)$. The terms in the $E_2$ page of the Serre integral cohomology spectral sequence of this fibration are 
\begin{itemize}
\item $E_2^{p,q}=H^p(\,K(\mathbb Z,3),\,H_q(K(\mathbb Z_2,4),\mathbb Z)\,)$.
\end{itemize}
 The first few terms in the $E_2$ page can be computed using the commands of Sections \ref{eilennot} and \ref{eilen} and recorded as follows. \begin{center}
\begin{tabular}{l|llllllllll} $8$ &
 $\mathbb Z_2$ &
 $0$&
 $0$&
 &
 &
 &
 &
 &
 &
 \\
 $7$ &
 $\mathbb Z_2$ &
 $0$&
 $0$&
 &
 &
 &
 &
 &
 &
 \\
 $6$ &
 $0$ &
 $0$&
 $0$&
 &
 &
 &
 &
 &
 &
 \\
 $5$ &
 $\pi_4(S^3)$ &
 $0$ &
 $0$ &
 $\pi_4(S^3)$ &
 $0$ &
 $0$&
 $0$ &
 $$&
 &
 \\
 $4$ &
 $0$ &
 $0$ &
$0$ &
 $0$ &
 $0$ &
 $0$ &
 &
 \\
 $3$ &
 $0$ &
 $0$ &
$0$ &
 $0$ &
 $0$ &
 $0$ &
 &
 \\
 $2$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 &
 \\
 $1$ &
$0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 &
 \\
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $0$ &
 $\mathbb Z_2$ &
 $0$ &
 $\mathbb Z_3$ &
 $\mathbb Z_2$ \\
 $q/p$ &
 $0$ &
 $1$ &
 $2$ &
 $3$ &
 $4$ &
 $5$ &
 $6$ &
 $7$ &
 $8$ &
 $9$ \\
\end{tabular}\\[2mm]
\textbf{Table: }$E_2$ cohomology page for $K(\pi_4(S^3),4) \hookrightarrow X_4 \twoheadrightarrow X_3$\end{center}

 Since we know that $H^5(X_4,\mathbb Z) =0$, the differentials in the spectral sequence must restrict to an isomorphism $E_2^{0,5}=\pi_4(S^3) \stackrel{\cong}{\longrightarrow} E_2^{6,0}=\mathbb Z_2$. This provides an alternative derivation of $\pi_4(S^3) \cong \mathbb Z_2$. We can also immediately deduce that $H^6(X_4,\mathbb Z)=0$. Let $x$ be the generator of $E_2^{0,5}$ and $y$ the generator of $E_2^{3,0}$. Then the generator $xy$ of $E_2^{3,5}$ gets mapped to a non\texttt{\symbol{45}}zero element $d_7(xy)=d_7(x)y -xd_7(y)$. Hence the term $E_2^{0,7}=\mathbb Z_2$ must get mapped to zero in $E_2^{3,5}$. It follows that $H^7(X_4,\mathbb Z)=\mathbb Z_2$. 

The integral cohomology of Eilenberg\texttt{\symbol{45}}MacLane spaces yields
the following information on the $E_2$ page $E_2^{p,q}=H_p(\,X_4,\,H^q(K(\pi_5S^3,5),\mathbb Z)\,)$ for the fibration $K(\pi_5(S^3),5) \hookrightarrow X_5 \twoheadrightarrow X_4$. \begin{center}
\begin{tabular}{l|llllllll} $6$ &
 $\pi_5(S^3)$ &
 $0$ &
 $0$ &
 $\pi_5(S^3)$ &
 $0$ &
 $0$ &
 &
 \\
 $5$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 \\
 $4$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 \\
 $3$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 \\
 $2$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 \\
 $1$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 \\
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $0$ &
 $0$ &
 $H^7(X_4,\mathbb Z)$ \\
 $q/p$ &
 $0$ &
 $1$ &
 $2$ &
 $3$ &
 $4$ &
 $5$ &
 $6$ &
 $7$ \\
\end{tabular}\\[2mm]
\textbf{Table: }$E_2$ cohomology page for $K(\pi_5(S^3),5) \hookrightarrow X_5 \twoheadrightarrow X_4$\end{center}

 Since we know that $H^6(X_5,\mathbb Z)=0$, the differentials in the spectral sequence must restrict to an isomorphism $E_2^{0,6}=\pi_5(S^3) \stackrel{\cong}{\longrightarrow}
E_2^{7,0}=H^7(X_4,\mathbb Z)$. We can conclude the desired result: 
\[\pi_5(S^3) = \mathbb Z_2\ .\]
 

 $~~~$



 Note that the fibration $X_4 \twoheadrightarrow K(\mathbb Z,3)$ is determined by a cohomology class $\kappa \in H^5(K(\mathbb Z,3), \mathbb Z_2) = \mathbb Z_2$. If $\kappa=0$ then we'd have $X_4 =K(\mathbb Z_2,4)\times K(\mathbb Z,3)$ and, as the following commands show, we'd then have $H_4(X_4,\mathbb Z)=\mathbb Z_2$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=EilenbergMacLaneSimplicialGroup(AbelianPcpGroup([0]),3,7);;|
  !gapprompt@gap>| !gapinput@L:=EilenbergMacLaneSimplicialGroup(CyclicGroup(2),4,7);;|
  !gapprompt@gap>| !gapinput@CK:=ChainComplex(K);;|
  !gapprompt@gap>| !gapinput@CL:=ChainComplex(L);;|
  !gapprompt@gap>| !gapinput@T:=TensorProduct(CK,CL);;|
  !gapprompt@gap>| !gapinput@Homology(T,4);|
  [ 2 ]
  
\end{Verbatim}
 Since we know that $H_4(X_4,\mathbb Z)=0$ we can conclude that the Postnikov invariant $\kappa$ is the non\texttt{\symbol{45}}zero class in $H^5(K(\mathbb Z,3), \mathbb Z_2) = \mathbb Z_2$. }

 
\section{\textcolor{Chapter }{Towards $\pi_4(\Sigma K(G,1))$ }}\label{postnikov}
\logpage{[ 12, 8, 0 ]}
\hyperdef{L}{X8227000D83B9A17F}{}
{
 Consider the suspension $X=\Sigma K(G,1)$ of a classifying space of a group $G$ once again. This space has a Postnikov system in which $X_1 = \ast$, $X_2= K(G_{ab},2)$. We have a fibration sequence $K(\pi_3 X, 3) \hookrightarrow X_3 \twoheadrightarrow K(G_{ab},2)$. The corresponding integral cohomology Serre spectral sequence has $E_2$ page with terms 
\begin{itemize}
\item  $E_2^{p,q}=H^p(\,K(G_{ab},2), H^q(K(\pi_3 X,3)),\mathbb Z)\, )$. 
\end{itemize}
 

As an example, for the Alternating group $G=A_4$ of order $12$ the following commands of Section \ref{firsttwo} compute $G_{ab} = \mathbb Z_3$ and $\pi_3 X = \mathbb Z_6$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@AbelianInvariants(G);|
  [ 3 ]
  !gapprompt@gap>| !gapinput@ThirdHomotopyGroupOfSuspensionB(G);|
  [ 2, 3 ]
  
\end{Verbatim}
 The first terms of the $E_2$ page can be calculated using the commands of Sections \ref{eilennot} and \ref{eilen}. \begin{center}
\begin{tabular}{l|llllllll} $7$ &
 $\mathbb Z_2 $ &
 $0$ &
 $$ &
 $$ &
 $$ &
 $$ &
 &
 \\
 $6$ &
 $\mathbb Z_2$ &
 $0$ &
 $0$ &
 $0$ &
 $$ &
 $$ &
 &
 \\
 $5$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $$ &
 $$ &
 $$ &
 \\
 $4$ &
 $\mathbb Z_6$ &
 $0$ &
 $0$ &
 $\mathbb Z_3$ &
 $$ &
 $$ &
 $$ &
 \\
 $3$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $$ &
 \\
 $2$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 \\
 $1$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 \\
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $0$ &
 $\mathbb Z_3$ &
 $0$ &
 $\mathbb Z_3$ &
 $0$ &
 $\mathbb Z_9$ \\
 $q/p$ &
 $0$ &
 $1$ &
 $2$ &
 $3$ &
 $4$ &
 $5$ &
 $6$ &
 $7$ \\
\end{tabular}\\[2mm]
\textbf{Table: }$E^2$ cohomology page for $K(\pi_3 X,3) \hookrightarrow X_3 \twoheadrightarrow X_2$\end{center}

 We know that $H^1(X_3,\mathbb Z)=0$, $H^2(X_3,\mathbb Z)=H^1(G,\mathbb Z) =0$, $H^3(X_3,\mathbb Z)=H^2(G,\mathbb Z) =\mathbb Z_3$, and that $H^4(X_3,\mathbb Z)$ is a subgroup of $H^3(G,\mathbb Z) = \mathbb Z_2$. It follows that the differential induces a surjection $E_2^{0,4}=\mathbb Z_6 \twoheadrightarrow E_2^{5,0}=\mathbb Z_3$. Consequently $H^4(X_3,\mathbb Z)=\mathbb Z_2$ and $H^5(X_3,\mathbb Z)=0$ and $H^6(X_3,\mathbb Z)=\mathbb Z_2$. 

The $E_2$ page for the fibration $K(\pi_4 X,4) \hookrightarrow X_4 \twoheadrightarrow X_3$ contains the following terms. \begin{center}
\begin{tabular}{l|lllllll} $5$ &
 $\pi_4 X$ &
 $0$ &
 $0$ &
 $$ &
 $$ &
 $$ &
 $$ \\
 $4$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $$ &
 $$ &
 $$ \\
 $3$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $$ \\
 $2$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 \\
 $1$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ \\
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $0$ &
 $\mathbb Z_3$ &
 $\mathbb Z_2$ &
 $0$ &
 $\mathbb Z_2$ \\
 $q/p$ &
 $0$ &
 $1$ &
 $2$ &
 $3$ &
 $4$ &
 $5$ &
 $6$ \\
\end{tabular}\\[2mm]
\textbf{Table: }$E^2$ cohomology page for $K(\pi_4 X,4) \hookrightarrow X_4 \twoheadrightarrow X_3$\end{center}

 We know that $H^5(X_4,\mathbb Z)$ is a subgroup of $H^4(G,\mathbb Z)=\mathbb Z_6$, and hence that there is a homomorphisms $\pi_4X \rightarrow \mathbb Z_2$ whose kernel is a subgroup of $\mathbb Z_6$. If follows that $|\pi_4 X|\le 12$. }

 
\section{\textcolor{Chapter }{Enumerating homotopy 2\texttt{\symbol{45}}types}}\logpage{[ 12, 9, 0 ]}
\hyperdef{L}{X7F5E6C067B2AE17A}{}
{
  A \emph{2\texttt{\symbol{45}}type} is a CW\texttt{\symbol{45}}complex $X$ whose homotopy groups are trivial in dimensions $n=0 $ and $n>2$. As explained in \ref{secCat1} the homotopy type of such a space can be captured algebraically by a cat$^1$\texttt{\symbol{45}}group $G$. Let $X$, $Y$ be $2$\texttt{\symbol{45}}tytpes represented by cat$^1$\texttt{\symbol{45}}groups $G$, $H$. If $X$ and $Y$ are homotopy equivalent then there exists a sequence of morphisms of cat$^1$\texttt{\symbol{45}}groups 
\[G \rightarrow K_1 \rightarrow K_2 \leftarrow K_3 \rightarrow \cdots
\rightarrow K_n \leftarrow H\]
 in which each morphism induces isomorphisms of homotopy groups. When such a
sequence exists we say that $G$ is \emph{quasi\texttt{\symbol{45}}isomorphic} to $H$. We have the following result. 

\textsc{Theorem.} The $2$\texttt{\symbol{45}}types $X$ and $Y$ are homotopy equivalent if and only if the associated cat$^1$\texttt{\symbol{45}}groups $G$ and $H$ are quasi\texttt{\symbol{45}}isomorphic. 

The following commands produce a list $L$ of all of the $62$ non\texttt{\symbol{45}}isomorphic cat$^1$\texttt{\symbol{45}}groups whose underlying group has order $16$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=[];;|
  !gapprompt@gap>| !gapinput@for G in AllSmallGroups(16) do|
  !gapprompt@>| !gapinput@Append(L,CatOneGroupsByGroup(G));|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@Length(L);|
  62
  
\end{Verbatim}
 The next commands use the first and second homotopy groups to prove that the
list $L$ contains at least $37$ distinct quasi\texttt{\symbol{45}}isomorphism types. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Invariants:=function(G)|
  !gapprompt@>| !gapinput@local inv;|
  !gapprompt@>| !gapinput@inv:=[];|
  !gapprompt@>| !gapinput@inv[1]:=IdGroup(HomotopyGroup(G,1));|
  !gapprompt@>| !gapinput@inv[2]:=IdGroup(HomotopyGroup(G,2));|
  !gapprompt@>| !gapinput@return inv;|
  !gapprompt@>| !gapinput@end;;|
  
  !gapprompt@gap>| !gapinput@C:=Classify(L,Invariants);;|
  !gapprompt@gap>| !gapinput@Length(C);|
  
\end{Verbatim}
 The following additional commands use second and third integral homology in
conjunction with the first two homotopy groups to prove that the list $L$ contains \textsc{at least} $49$ distinct quasi\texttt{\symbol{45}}isomorphism types. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Invariants2:=function(G)|
  !gapprompt@>| !gapinput@local inv;|
  !gapprompt@>| !gapinput@inv:=[];|
  !gapprompt@>| !gapinput@inv[1]:=Homology(G,2);|
  !gapprompt@>| !gapinput@inv[2]:=Homology(G,3);|
  !gapprompt@>| !gapinput@return inv;|
  !gapprompt@>| !gapinput@end;;|
  !gapprompt@gap>| !gapinput@C:=RefineClassification(C,Invariants2);;|
  
  !gapprompt@gap>| !gapinput@Length(C);|
  49
  
\end{Verbatim}
 The following commands show that the above list $L$ contains \textsc{at most} $51$ distinct quasi\texttt{\symbol{45}}isomorphism types. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=List(L,QuasiIsomorph);;|
  !gapprompt@gap>| !gapinput@M:=[];;|
  
  !gapprompt@gap>| !gapinput@for q in Q do|
  !gapprompt@>| !gapinput@bool:=true;;|
  !gapprompt@>| !gapinput@for m in M do|
  !gapprompt@>| !gapinput@if not IsomorphismCatOneGroups(m,q)=fail then bool:=false; break; fi;|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@>| !gapinput@if bool then Add(M,q); fi;|
  !gapprompt@>| !gapinput@od;|
  
  !gapprompt@gap>| !gapinput@Length(M);|
  51
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Identifying cat$^1$\texttt{\symbol{45}}groups of low order}}\logpage{[ 12, 10, 0 ]}
\hyperdef{L}{X7D99B7AA780D8209}{}
{
  Let us define the \emph{order} of a cat$^1$\texttt{\symbol{45}}group to be the order of its underlying group. The
function \texttt{IdQuasiCatOneGroup(C)} inputs a cat$^1$\texttt{\symbol{45}}group $C$ of "low order" and returns an integer pair $[n,k]$ that uniquely idenifies the quasi\texttt{\symbol{45}}isomorphism type of $C$. The integer $n$ is the order of a smallest cat$^1$\texttt{\symbol{45}}group quasi\texttt{\symbol{45}}isomorphic to $C$. The integer $k$ identifies a particular cat$^1$\texttt{\symbol{45}}group of order $n$. 

The following commands use this function to show that there are precisely $49$ distinct quasi\texttt{\symbol{45}}isomorphism types of cat$^1$\texttt{\symbol{45}}groups of order $16$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=[];;|
  !gapprompt@gap>| !gapinput@for G in AllSmallGroups(16) do|
  !gapprompt@>| !gapinput@Append(L,CatOneGroupsByGroup(G));|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@M:=List(L,IdQuasiCatOneGroup);|
  [ [ 16, 1 ], [ 16, 2 ], [ 16, 3 ], [ 16, 4 ], [ 16, 5 ], [ 4, 4 ], [ 1, 1 ], 
    [ 16, 6 ], [ 16, 7 ], [ 16, 8 ], [ 16, 9 ], [ 16, 10 ], [ 16, 11 ], 
    [ 16, 9 ], [ 16, 12 ], [ 16, 13 ], [ 16, 14 ], [ 16, 15 ], [ 4, 1 ], 
    [ 4, 2 ], [ 16, 16 ], [ 16, 17 ], [ 16, 18 ], [ 16, 19 ], [ 16, 20 ], 
    [ 16, 21 ], [ 16, 22 ], [ 16, 23 ], [ 16, 24 ], [ 16, 25 ], [ 16, 26 ], 
    [ 16, 27 ], [ 16, 28 ], [ 4, 3 ], [ 4, 1 ], [ 4, 4 ], [ 4, 4 ], [ 4, 2 ], 
    [ 4, 5 ], [ 16, 29 ], [ 16, 30 ], [ 16, 31 ], [ 16, 32 ], [ 16, 33 ], 
    [ 16, 34 ], [ 4, 3 ], [ 4, 4 ], [ 4, 4 ], [ 16, 35 ], [ 16, 36 ], [ 4, 3 ], 
    [ 16, 37 ], [ 16, 38 ], [ 16, 39 ], [ 16, 40 ], [ 16, 41 ], [ 16, 42 ], 
    [ 16, 43 ], [ 4, 3 ], [ 4, 4 ], [ 1, 1 ], [ 4, 5 ] ]
  !gapprompt@gap>| !gapinput@Length(SSortedList(M));|
  49
  
\end{Verbatim}
 The next example first identifies the order and the identity number of the cat$^1$\texttt{\symbol{45}}group $C$ corresponding to the crossed module (see \ref{secCrossedModules}) 
\[\iota\colon G \longrightarrow Aut(G), g \mapsto (x\mapsto gxg^{-1})\]
 for the dihedral group $G$ of order $10$. It then realizes a smallest possible cat$^1$\texttt{\symbol{45}}group $D$ of this quasi\texttt{\symbol{45}}isomorphism type. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@C:=AutomorphismGroupAsCatOneGroup(DihedralGroup(10));|
  Cat-1-group with underlying group Group( [ f1, f2, f3, f4, f5 ] ) . 
  
  !gapprompt@gap>| !gapinput@Order(C);|
  200
  !gapprompt@gap>| !gapinput@IdCatOneGroup(C);|
  [ 200, 42, 4 ]
  !gapprompt@gap>| !gapinput@|
  !gapprompt@gap>| !gapinput@IdQuasiCatOneGroup(C);|
  [ 2, 1 ]
  !gapprompt@gap>| !gapinput@D:=SmallCatOneGroup(2,1);|
  Cat-1-group with underlying group Group( [ f1 ] ) . 
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Identifying crossed modules of low order}}\logpage{[ 12, 11, 0 ]}
\hyperdef{L}{X7F386CF078CB9A20}{}
{
  

The following commands construct the crossed module $\partial \colon G\otimes G \rightarrow G$ involving the nonabelian tensor square of the dihedral group \$G\$ of order $10$, identify it as being number $71$ in the list of crossed modules of order $100$, create a quasi\texttt{\symbol{45}}isomorphic crossed module of order $4$, and finally construct the corresponding cat$^1$\texttt{\symbol{45}}group of order $100$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=DihedralGroup(10);;|
  !gapprompt@gap>| !gapinput@T:=NonabelianTensorSquareAsCrossedModule(G);|
  Crossed module with group homomorphism GroupHomomorphismByImages( Group( 
  [ f3*f1*f3^-1*f1^-1, f3*f2*f3^-1*f2^-1 ] ), Group( [ f1, f2 ] ), 
  [ f3*f1*f3^-1*f1^-1, f3*f2*f3^-1*f2^-1 ], [ <identity> of ..., f2^3 ] )
  
  !gapprompt@gap>| !gapinput@IdCrossedModule(T);|
  [ 100, 71 ]
  !gapprompt@gap>| !gapinput@Q:=QuasiIsomorph(T);|
  Crossed module with group homomorphism Pcgs([ f2 ]) -> [ <identity> of ... ]
  
  !gapprompt@gap>| !gapinput@Order(Q);|
  4
  !gapprompt@gap>| !gapinput@C:=CatOneGroupByCrossedModule(T);|
  Cat-1-group with underlying group Group( [ F1, F2, F1 ] ) . 
  
\end{Verbatim}
 }

 }

 
\chapter{\textcolor{Chapter }{Congruence Subgroups, Cuspidal Cohomology and Hecke Operators}}\logpage{[ 13, 0, 0 ]}
\hyperdef{L}{X86D5DB887ACB1661}{}
{
 In this chapter we explain how HAP can be used to make computions about
modular forms associated to congruence subgroups $\Gamma$ of $SL_2(\mathbb Z)$. Also, in Subsection 10.8 onwards, we demonstrate cohomology computations for
the \emph{Picard group} $SL_2(\mathbb Z[i])$, some \emph{Bianchi groups} $PSL_2({\cal O}_{-d}) $ where ${\cal O}_{d}$ is the ring of integers of $\mathbb Q(\sqrt{-d})$ for square free positive integer $d$, and some other groups of the form $SL_m({\cal O})$, $GL_m({\cal O})$, $PSL_m({\cal O})$, $PGL_m({\cal O})$, for $m=2,3,4$ and certain ${\cal O}=\mathbb Z, {\cal O}_{-d}$. 
\section{\textcolor{Chapter }{Eichler\texttt{\symbol{45}}Shimura isomorphism}}\label{sec:EichlerShimura}
\logpage{[ 13, 1, 0 ]}
\hyperdef{L}{X79A1974B7B4987DE}{}
{
 

We begin by recalling the Eichler\texttt{\symbol{45}}Shimura isomorphism \cite{eichler}\cite{shimura} 
\[ S_k(\Gamma) \oplus \overline{S_k(\Gamma)} \oplus E_k(\Gamma) \cong_{\sf Hecke}
H^1(\Gamma,P_{\mathbb C}(k-2))\]
 

 which relates the cohomology of groups to the theory of modular forms
associated to a finite index subgroup $\Gamma$ of $SL_2(\mathbb Z)$. In subsequent sections we explain how to compute with the
right\texttt{\symbol{45}}hand side of the isomorphism. But first, for
completeness, let us define the terms on the left\texttt{\symbol{45}}hand
side. 

 Let $N$ be a positive integer. A subgroup $\Gamma$ of $SL_2(\mathbb Z)$ is said to be a \emph{congruence subgroup} of level $N $ if it contains the kernel of the canonical homomorphism $\pi_N\colon SL_2(\mathbb Z) \rightarrow SL_2(\mathbb Z/N\mathbb Z)$. So any congruence subgroup is of finite index in $SL_2(\mathbb Z)$, but the converse is not true. 

One congruence subgroup of particular interest is the group $\Gamma_1(N)=\ker(\pi_N)$, known as the \emph{principal congruence subgroup} of level $N$. Another congruence subgroup of particular interest is the group $\Gamma_0(N)$ of those matrices that project to upper triangular matrices in $SL_2(\mathbb Z/N\mathbb Z)$. 

A \emph{modular form} of weight $k$ for a congruence subgroup $\Gamma$ is a complex valued function on the upper\texttt{\symbol{45}}half plane, $f\colon {\frak{h}}=\{z\in \mathbb C : Re(z)>0\} \rightarrow \mathbb C$, satisfying: 
\begin{itemize}
\item  $\displaystyle f(\frac{az+b}{cz+d}) = (cz+d)^k f(z)$ for $\left(\begin{array}{ll}a&b\\ c &d \end{array}\right) \in \Gamma$, 
\item  $f$ is `holomorphic' on the \emph{extended upper\texttt{\symbol{45}}half plane} $\frak{h}^\ast = \frak{h} \cup \mathbb Q \cup \{\infty\}$ obtained from the upper\texttt{\symbol{45}}half plane by `adjoining a point at
each cusp'. 
\end{itemize}
 The collection of all weight $k$ modular forms for $\Gamma$ form a vector space $M_k(\Gamma)$ over $\mathbb C$. 

A modular form $f$ is said to be a \emph{cusp form} if $f(\infty)=0$. The collection of all weight $k$ cusp forms for $\Gamma$ form a vector subspace $S_k(\Gamma)$. There is a decomposition 
\[M_k(\Gamma) \cong S_k(\Gamma) \oplus E_k(\Gamma)\]
 

 involving a summand $E_k(\Gamma)$ known as the \emph{Eisenstein space}. See \cite{stein} for further introductory details on modular forms. 

The Eichler\texttt{\symbol{45}}Shimura isomorphism is more than an isomorphism
of vector spaces. It is an isomorphism of Hecke modules: both sides admit
notions of \emph{Hecke operators}, and the isomorphism preserves these operators. The bar on the
left\texttt{\symbol{45}}hand side of the isomorphism denotes complex
conjugation, or \emph{anti\texttt{\symbol{45}}holomorphic} forms. See \cite{wieser} for a full account of the isomorphism. 



 On the right\texttt{\symbol{45}}hand side of the isomorphism, the $\mathbb Z\Gamma$\texttt{\symbol{45}}module $P_{\mathbb C}(k-2)\subset \mathbb C[x,y]$ denotes the space of homogeneous degree $k-2$ polynomials with action of $\Gamma$ given by 
\[\left(\begin{array}{ll}a&b\\ c &d \end{array}\right)\cdot p(x,y) =
p(dx-by,-cx+ay)\ .\]
 In particular $P_{\mathbb C}(0)=\mathbb C$ is the trivial module. Below we shall compute with the integral analogue $P_{\mathbb Z}(k-2) \subset \mathbb Z[x,y]$. 



 In the following sections we explain how to use the
right\texttt{\symbol{45}}hand side of the Eichler\texttt{\symbol{45}}Shimura
isomorphism to compute eigenvalues of the Hecke operators restricted to the
subspace $S_k(\Gamma)$ of cusp forms. }

 
\section{\textcolor{Chapter }{Generators for $SL_2(\mathbb Z)$ and the cubic tree}}\logpage{[ 13, 2, 0 ]}
\hyperdef{L}{X7BFA2C91868255D9}{}
{
 

 The matrices $S=\left(\begin{array}{rr}0&-1\\ 1 &0 \end{array}\right)$ and $T=\left(\begin{array}{rr}1&1\\ 0 &1 \end{array}\right)$ generate $SL_2(\mathbb Z)$ and it is not difficult to devise an algorithm for expressing an arbitrary
integer matrix $A$ of determinant $1$ as a word in $S$, $T$ and their inverses. The following illustrates such an algorithm. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=[[4,9],[7,16]];;|
  !gapprompt@gap>| !gapinput@word:=AsWordInSL2Z(A);|
  [ [ [ 1, 0 ], [ 0, 1 ] ], [ [ 0, 1 ], [ -1, 0 ] ], [ [ 1, -1 ], [ 0, 1 ] ], 
    [ [ 0, 1 ], [ -1, 0 ] ], [ [ 1, 1 ], [ 0, 1 ] ], [ [ 0, 1 ], [ -1, 0 ] ], 
    [ [ 1, -1 ], [ 0, 1 ] ], [ [ 1, -1 ], [ 0, 1 ] ], [ [ 1, -1 ], [ 0, 1 ] ], 
    [ [ 0, 1 ], [ -1, 0 ] ], [ [ 1, 1 ], [ 0, 1 ] ], [ [ 1, 1 ], [ 0, 1 ] ] ]
  !gapprompt@gap>| !gapinput@Product(word);|
  [ [ 4, 9 ], [ 7, 16 ] ]
  
\end{Verbatim}
 It is convenient to introduce the matrix $U=ST = \left(\begin{array}{rr}0&-1\\ 1 &1 \end{array}\right)$. The matrices $S$ and $U$ also generate $SL_2(\mathbb Z)$. In fact we have a free presentation $SL_2(\mathbb Z)= \langle S,U\, |\, S^4=U^6=1, S^2=U^3 \rangle $. 



 The \emph{cubic tree} $\cal T$ is a tree (\emph{i.e.} a $1$\texttt{\symbol{45}}dimensional contractible regular
CW\texttt{\symbol{45}}complex) with countably infinitely many edges in which
each vertex has degree $3$. We can realize the cubic tree $\cal T$ by taking the left cosets of ${\cal U}=\langle U\rangle$ in $SL_2(\mathbb Z)$ as vertices, and joining cosets $x\,{\cal U} $ and $y\,{\cal U}$ by an edge if, and only if, $x^{-1}y \in {\cal U}\, S\,{\cal U}$. Thus the vertex $\cal U $ is joined to $S\,{\cal U} $, $US\,{\cal U}$ and $U^2S\,{\cal U}$. The vertices of this tree are in
one\texttt{\symbol{45}}to\texttt{\symbol{45}}one correspondence with all
reduced words in $S$, $U$ and $U^2$ that, apart from the identity, end in $S$. 

 From our realization of the cubic tree $\cal T$ we see that $SL_2(\mathbb Z)$ acts on $\cal T$ in such a way that each vertex is stabilized by a cyclic subgroup conjugate to ${\cal U}=\langle U\rangle$ and each edge is stabilized by a cyclic subgroup conjugate to ${\cal S} =\langle S \rangle$. 

 In order to store this action of $SL_2(\mathbb Z)$ on the cubic tree $\cal T$ we just need to record the following finite amount of information. 

  }

 
\section{\textcolor{Chapter }{One\texttt{\symbol{45}}dimensional fundamental domains and generators for
congruence subgroups}}\logpage{[ 13, 3, 0 ]}
\hyperdef{L}{X7D1A56967A073A8B}{}
{
 The modular group ${\cal M}=PSL_2(\mathbb Z)$ is isomorphic, as an abstract group, to the free product $\mathbb Z_2\ast \mathbb Z_3$. By the Kurosh subgroup theorem, any finite index subgroup $M \subset {\cal M}$ is isomorphic to the free product of finitely many copies of $\mathbb Z_2$s, $\mathbb Z_3$s and $\mathbb Z$s. A subset $\underline x \subset M$ is an \emph{independent} set of subgroup generators if $M$ is the free product of the cyclic subgroups $<x >$ as $x$ runs over $\underline x$. Let us say that a set of elements in $SL_2(\mathbb Z)$ is \emph{projectively independent} if it maps injectively onto an independent set of subgroup generators $\underline x\subset {\cal M}$. The generating set $\{S,U\}$ for $SL_2(\mathbb Z)$ given in the preceding section is projectively independent. 

 We are interested in constructing a set of generators for a given congruence
subgroup $\Gamma$. If a small generating set for $\Gamma$ is required then we should aim to construct one which is close to being
projectively independent. 

 It is useful to invoke the following general result which follows from a
perturbation result about free $\mathbb ZG$\texttt{\symbol{45}}resolutons in \cite[Theorem 2]{ellisharrisskoldberg} and an old observation of John Milnor that a free $\mathbb ZG$\texttt{\symbol{45}}resolution can be realized as the cellular chain complex
of a CW\texttt{\symbol{45}}complex if it can be so realized in low dimensions. 

\textsc{Theorem.} Let $X$ be a contractible CW\texttt{\symbol{45}}complex on which a group $G$ acts by permuting cells. The cellular chain complex $C_\ast X$ is a $\mathbb ZG$\texttt{\symbol{45}}resolution of $\mathbb Z$ which typically is not free. Let $[e^n]$ denote the orbit of the n\texttt{\symbol{45}}cell $e^n$ under the action. Let $G^{e^n} \le G$ denote the stabilizer subgroup of $e^n$, in which group elements are not required to stabilize $e^n$ point\texttt{\symbol{45}}wise. Let $Y_{e^n}$ denote a contractible CW\texttt{\symbol{45}}complex on which $G^{e^n}$ acts cellularly and freely. Then there exists a contractible
CW\texttt{\symbol{45}}complex $W$ on which $G$ acts cellularly and freely, and in which the orbits of $n$\texttt{\symbol{45}}cells are labelled by $[e^p]\otimes [f^q]$ where $p+q=n$ and $[e^p]$ ranges over the $G$\texttt{\symbol{45}}orbits of $p$\texttt{\symbol{45}}cells in $X$, $[f^q]$ ranges over the $G^{e^p}$\texttt{\symbol{45}}orbits of $q$\texttt{\symbol{45}}cells in $Y_{e^p}$. 

 

Let $W$ be as in the theorem. Then the quotient CW\texttt{\symbol{45}}complex $B_G=W/G$ is a classifying space for $G$. Let $T$ denote a maximal tree in the $1$\texttt{\symbol{45}}skeleton $B^1_G$. Basic geometric group theory tells us that the $1$\texttt{\symbol{45}}cells in $B^1_G\setminus T$ correspond to a generating set for $G$. 

 Suppose we wish to compute a set of generators for a principal congruence
subgroup $\Gamma=\Gamma_1(N)$. In the above theorem take $X={\cal T}$ to be the cubic tree, and note that $\Gamma$ acts freely on $\cal T$ and thus that $W={\cal T}$. To determine the $1$\texttt{\symbol{45}}cells of $B_{\Gamma}\setminus T$ we need to determine a cellular subspace $D_\Gamma \subset \cal T$ whose images under the action of $\Gamma$ cover $\cal T$ and are pairwise either disjoint or identical. The subspace $D_\Gamma$ will not be a CW\texttt{\symbol{45}}complex as it won't be closed, but it can
be chosen to be connected, and hence contractible. We call $D_\Gamma$ a \emph{fundamental region} for $\Gamma$. We denote by $\mathring D_\Gamma$ the largest CW\texttt{\symbol{45}}subcomplex of $D_\Gamma$. The vertices of $\mathring D_\Gamma$ are the same as the vertices of $D_\Gamma$. Thus $\mathring D_\Gamma$ is a subtree of the cubic tree with $|\Gamma|/6$ vertices. For each vertex $v$ in the tree $\mathring D_\Gamma$ define $\eta(v)=3 -{\rm degree}(v)$. Then the number of generators for $ \Gamma $ will be $(1/2)\sum_{v\in \mathring D_\Gamma} \eta(v)$. 

 The following commands determine projectively independent generators for $\Gamma_1(6)$ and display $\mathring D_{\Gamma_1(6)}$. The subgroup $\Gamma_1(6)$ is free on $13$ generators. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=HAP_PrincipalCongruenceSubgroup(6);;|
  !gapprompt@gap>| !gapinput@HAP_SL2TreeDisplay(G);|
  
  
  !gapprompt@gap>| !gapinput@gens:=GeneratorsOfGroup(G);|
  [ [ [ -83, -18 ], [ 60, 13 ] ], [ [ -77, -18 ], [ 30, 7 ] ], 
    [ [ -65, -12 ], [ 168, 31 ] ], [ [ -53, -12 ], [ 84, 19 ] ], 
    [ [ -47, -18 ], [ 222, 85 ] ], [ [ -41, -12 ], [ 24, 7 ] ], 
    [ [ -35, -6 ], [ 6, 1 ] ], [ [ -11, -18 ], [ 30, 49 ] ], 
    [ [ -11, -6 ], [ 24, 13 ] ], [ [ -5, -18 ], [ 12, 43 ] ], 
    [ [ -5, -12 ], [ 18, 43 ] ], [ [ -5, -6 ], [ 6, 7 ] ], 
    [ [ 1, 0 ], [ -6, 1 ] ] ]
  
\end{Verbatim}
 

  

An alternative but very related approach to computing generators of congruence
subgroups of $SL_2(\mathbb Z)$ is described in \cite{kulkarni}. 

The congruence subgroup $\Gamma_0(N)$ does not act freely on the vertices of $\cal T$, and so one needs to incorporate a generator for the cyclic stabilizer group
according to the above theorem. Alternatively, we can replace the cubic tree
by a six\texttt{\symbol{45}}fold cover ${\cal T}'$ on whose vertex set $\Gamma_0(N)$ acts freely. This alternative approach will produce a redundant set of
generators. The following commands display $\mathring D_{\Gamma_0(39)}$ for a fundamental region in ${\cal T}'$. They also use the corresponding generating set for $\Gamma_0(39)$, involving $18$ generators, to compute the abelianization $\Gamma_0(39)^{ab}= \mathbb Z_2 \oplus \mathbb Z_3^2 \oplus \mathbb Z^9$. The abelianization shows that any generating set has at least $11$ generators. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=HAP_CongruenceSubgroupGamma0(39);;|
  !gapprompt@gap>| !gapinput@HAP_SL2TreeDisplay(G);|
  !gapprompt@gap>| !gapinput@Length(GeneratorsOfGroup(G));|
  18
  !gapprompt@gap>| !gapinput@AbelianInvariants(G);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3 ]
  
\end{Verbatim}
 

  

 Note that to compute $D_\Gamma$ one only needs to be able to test whether a given matrix lies in $\Gamma$ or not. Given an inclusion $\Gamma'\subset \Gamma$ of congruence subgroups, it is straightforward to use the trees $\mathring D_{\Gamma'}$ and $\mathring D_{\Gamma}$ to compute a system of coset representative for $\Gamma'\setminus \Gamma$. }

 
\section{\textcolor{Chapter }{Cohomology of congruence subgroups}}\logpage{[ 13, 4, 0 ]}
\hyperdef{L}{X818BFA9A826C0DB3}{}
{
 To compute the cohomology $H^n(\Gamma,A)$ of a congruence subgroup $\Gamma$ with coefficients in a $\mathbb Z\Gamma$\texttt{\symbol{45}}module $A$ we need to construct $n+1$ terms of a free $\mathbb Z\Gamma$\texttt{\symbol{45}}resolution of $\mathbb Z$. We can do this by first using perturbation techniques (as described in \cite{buiellis}) to combine the cubic tree with resolutions for the cyclic groups of order $4$ and $6$ in order to produce a free $\mathbb ZG$\texttt{\symbol{45}}resolution $R_\ast$ for $G=SL_2(\mathbb Z)$. This resolution is also a free $\mathbb Z\Gamma$\texttt{\symbol{45}}resolution with each term of rank 
\[{\rm rank}_{\mathbb Z\Gamma} R_k = |G:\Gamma|\times {\rm rank}_{\mathbb ZG}
R_k\ .\]
 

For congruence subgroups of lowish index in $G$ this resolution suffices to make computations. 

The following commands compute 
\[H^1(\Gamma_0(39),\mathbb Z) = \mathbb Z^9\ .\]
 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionSL2Z_alt(2);|
  Resolution of length 2 in characteristic 0 for SL(2,Integers) .
  
  !gapprompt@gap>| !gapinput@gamma:=HAP_CongruenceSubgroupGamma0(39);;|
  !gapprompt@gap>| !gapinput@S:=ResolutionFiniteSubgroup(R,gamma);|
  Resolution of length 2 in characteristic 0 for 
  CongruenceSubgroupGamma0( 39)  .
  
  !gapprompt@gap>| !gapinput@Cohomology(HomToIntegers(S),1);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 

This computation establishes that the space $M_2(\Gamma_0(39))$ of weight $2$ modular forms is of dimension $9$. 

The following commands show that ${\rm rank}_{\mathbb Z\Gamma_0(39)} R_1 = 112$ but that it is possible to apply `Tietze like' simplifications to $R_\ast$ to obtain a free $\mathbb Z\Gamma_0(39)$\texttt{\symbol{45}}resolution $T_\ast$ with ${\rm rank}_{\mathbb Z\Gamma_0(39)} T_1 = 11$. It is more efficient to work with $T_\ast$ when making cohomology computations with coefficients in a module $A$ of large rank. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|S!.dimension(1);A
  112
  @gapprompt|gap>A @gapinput|T:=TietzeReducedResolution(S);A
  Resolution of length 2 in characteristic 0 for CongruenceSubgroupGamma0(
  39)  . 
  
  @gapprompt|gap>A @gapinput|T!.dimension(1);A
  11
  
\end{Verbatim}
 

The following commands compute 
\[H^1(\Gamma_0(39),P_{\mathbb Z}(8)) = \mathbb Z_3 \oplus \mathbb Z_6 \oplus
\mathbb Z_{168} \oplus \mathbb Z^{84}\ ,\]
 
\[H^1(\Gamma_0(39),P_{\mathbb Z}(9)) = \mathbb Z_2 \oplus \mathbb Z_2 .\]
 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=HomogeneousPolynomials(gamma,8);;|
  !gapprompt@gap>| !gapinput@c:=Cohomology(HomToIntegralModule(T,P),1);|
  [ 3, 6, 168, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Length(c);|
  87
  
  !gapprompt@gap>| !gapinput@P:=HomogeneousPolynomials(gamma,9);;|
  !gapprompt@gap>| !gapinput@c:=Cohomology(HomToIntegralModule(T,P),1);|
  [ 2, 2 ]
  
\end{Verbatim}
 

This computation establishes that the space $M_{10}(\Gamma_0(39))$ of weight $10$ modular forms is of dimension $84$, and $M_{11}(\Gamma_0(39))$ is of dimension $0$. (There are never any modular forms of odd weight, and so $M_k(\Gamma)=0$ for all odd $k$ and any congruence subgroup $\Gamma$.) 
\subsection{\textcolor{Chapter }{Cohomology with rational coefficients}}\logpage{[ 13, 4, 1 ]}
\hyperdef{L}{X7F55F8EA82FE9122}{}
{
 To calculate cohomology $H^n(\Gamma,A)$ with coefficients in a $\mathbb Q\Gamma$\texttt{\symbol{45}}module $A$ it suffices to construct a resolution of $\mathbb Z$ by non\texttt{\symbol{45}}free $\mathbb Z\Gamma$\texttt{\symbol{45}}modules where $\Gamma$ acts with finite stabilizer groups on each module in the resolution. Computing
over $\mathbb Q$ is computationally less expensive than computing over $\mathbb Z$. The following commands first compute $H^1(\Gamma_0(39),\mathbb Q) = H_1(\Gamma_0(39),\mathbb Q)= \mathbb Q^9$. As a larger example, they then compute $H^1(\Gamma_0(2^{13}-1),\mathbb Q) =\mathbb Q^{1365}$ where $\Gamma_0(2^{13}-1)$ has index $8192$ in $SL_2(\mathbb Z)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=ContractibleGcomplex("SL(2,Z)");|
  Non-free resolution in characteristic 0 for SL(2,Integers) . 
  
  !gapprompt@gap>| !gapinput@gamma:=HAP_CongruenceSubgroupGamma0(39);;|
  !gapprompt@gap>| !gapinput@KK:=NonFreeResolutionFiniteSubgroup(K,gamma);|
  Non-free resolution in characteristic 0 for <matrix group with 
  18 generators> . 
  
  !gapprompt@gap>| !gapinput@C:=TensorWithRationals(KK);|
  !gapprompt@gap>| !gapinput@Homology(C,1);|
  9
  
  !gapprompt@gap>| !gapinput@G:=HAP_CongruenceSubgroupGamma0(2^13-1);;|
  !gapprompt@gap>| !gapinput@IndexInSL2Z(G);|
  8192
  !gapprompt@gap>| !gapinput@KK:=NonFreeResolutionFiniteSubgroup(K,G);;|
  !gapprompt@gap>| !gapinput@C:=TensorWithRationals(KK);;|
  !gapprompt@gap>| !gapinput@Homology(C,1);|
  1365
  
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Cuspidal cohomology}}\logpage{[ 13, 5, 0 ]}
\hyperdef{L}{X84D30F1580CD42D1}{}
{
 To define and compute cuspidal cohomology we consider the action of $SL_2(\mathbb Z)$ on the upper\texttt{\symbol{45}}half plane ${\frak h}$ given by 
\[\left(\begin{array}{ll}a&b\\ c &d \end{array}\right) z = \frac{az +b}{cz+d}\ .\]
 A standard 'fundamental domain' for this action is the region 
\[\begin{array}{ll} D=&\{z\in {\frak h}\ :\ |z| > 1, |{\rm Re}(z)| <
\frac{1}{2}\} \\ & \cup\ \{z\in {\frak h} \ :\ |z| \ge 1, {\rm
Re}(z)=-\frac{1}{2}\}\\ & \cup\ \{z \in {\frak h}\ :\ |z|=1, -\frac{1}{2} \le
{\rm Re}(z) \le 0\} \end{array} \]
 illustrated below. 

 

 The action factors through an action of $PSL_2(\mathbb Z) =SL_2(\mathbb Z)/\langle \left(\begin{array}{rr}-1&0\\ 0 &-1
\end{array}\right)\rangle$. The images of $D$ under the action of $PSL_2(\mathbb Z)$ cover the upper\texttt{\symbol{45}}half plane, and any two images have at most
a single point in common. The possible common points are the bottom
left\texttt{\symbol{45}}hand corner point which is stabilized by $\langle U\rangle$, and the bottom middle point which is stabilized by $\langle S\rangle$. 

 A congruence subgroup $\Gamma$ has a `fundamental domain' $D_\Gamma$ equal to a union of finitely many copies of $D$, one copy for each coset in $\Gamma\setminus SL_2(\mathbb Z)$. The quotient space $X=\Gamma\setminus {\frak h}$ is not compact, and can be compactified in several ways. We are interested in
the Borel\texttt{\symbol{45}}Serre compactification. This is a space $X^{BS}$ for which there is an inclusion $X\hookrightarrow X^{BS}$ and this inclusion is a homotopy equivalence. One defines the \emph{boundary} $\partial X^{BS} = X^{BS} - X$ and uses the inclusion $\partial X^{BS} \hookrightarrow X^{BS} \simeq X$ to define the cuspidal cohomology group, over the ground ring $\mathbb C$, as 
\[ H_{cusp}^n(\Gamma,P_{\mathbb C}(k-2)) = \ker (\ H^n(X,P_{\mathbb C}(k-2))
\rightarrow H^n(\partial X^{BS},P_{\mathbb C}(k-2)) \ ).\]
 Strictly speaking, this is the definition of \emph{interior cohomology} $H_!^n(\Gamma,P_{\mathbb C}(k-2))$ which in general contains the cuspidal cohomology as a subgroup. However, for
congruence subgroups of $SL_2(\mathbb Z)$ there is equality $H_!^n(\Gamma,P_{\mathbb C}(k-2)) = H_{cusp}^n(\Gamma,P_{\mathbb C}(k-2))$. 

 Working over $\mathbb C$ has the advantage of avoiding the technical issue that $\Gamma $ does not necessarily act freely on ${\frak h}$ since there are points with finite cyclic stabilizer groups in $SL_2(\mathbb Z)$. But it has the disadvantage of losing information about torsion in
cohomology. So HAP confronts the issue by working with a contractible
CW\texttt{\symbol{45}}complex $\tilde X^{BS}$ on which $\Gamma$ acts freely, and $\Gamma$\texttt{\symbol{45}}equivariant inclusion $\partial \tilde X^{BS} \hookrightarrow \tilde X^{BS}$. The definition of cuspidal cohomology that we use, which coincides with the
above definition when working over $\mathbb C$, is 
\[ H_{cusp}^n(\Gamma,A) = \ker (\ H^n({\rm Hom}_{\, \mathbb
Z\Gamma}(C_\ast(\tilde X^{BS}), A)\, ) \rightarrow H^n(\ {\rm Hom}_{\, \mathbb
Z\Gamma}(C_\ast(\tilde \partial X^{BS}), A)\, \ ).\]
 

The following data is recorded and, using perturbation theory, is combined
with free resolutions for $C_4$ and $C_6$ to constuct $\tilde X^{BS}$. 

 

 The following commands calculate 
\[H^1_{cusp}(\Gamma_0(39),\mathbb Z) = \mathbb Z^6\ .\]
 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gamma:=HAP_CongruenceSubgroupGamma0(39);;|
  !gapprompt@gap>| !gapinput@k:=2;; deg:=1;; c:=CuspidalCohomologyHomomorphism(gamma,deg,k);|
  [ g1, g2, g3, g4, g5, g6, g7, g8, g9 ] -> [ g1^-1*g3, g1^-1*g3, g1^-1*g3, 
    g1^-1*g3, g1^-1*g2, g1^-1*g3, g1^-1*g4, g1^-1*g4, g1^-1*g4 ]
  !gapprompt@gap>| !gapinput@AbelianInvariants(Kernel(c));|
  [ 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 From the Eichler\texttt{\symbol{45}}Shimura isomorphism and the already
calculated dimension of $M_2(\Gamma_0(39))\cong \mathbb C^9$, we deduce from this cuspidal cohomology that the space $S_2(\Gamma_0(39))$ of cuspidal weight $2$ forms is of dimension $3$, and the Eisenstein space $E_2(\Gamma_0(39))\cong \mathbb C^3$ is of dimension $3$. 

The following commands show that the space $S_4(\Gamma_0(39))$ of cuspidal weight $4$ forms is of dimension $12$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gamma:=HAP_CongruenceSubgroupGamma0(39);;|
  !gapprompt@gap>| !gapinput@k:=4;; deg:=1;; c:=CuspidalCohomologyHomomorphism(gamma,deg,k);;|
  !gapprompt@gap>| !gapinput@AbelianInvariants(Kernel(c));|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Hecke operators on forms of weight 2}}\logpage{[ 13, 6, 0 ]}
\hyperdef{L}{X80861D3F87C29C43}{}
{
 A congruence subgroup $\Gamma \le SL_2(\mathbb Z)$ and element $g\in SL_2(\mathbb Q)$ determine the subgroup $\Gamma' = \Gamma \cap g\Gamma g^{-1} $ and homomorphisms 
\[ \Gamma\ \hookleftarrow\ \Gamma'\ \ \stackrel{\gamma \mapsto g^{-1}\gamma
g}{\longrightarrow}\ \ g^{-1}\Gamma' g\ \hookrightarrow \Gamma\ . \]
 These homomorphisms give rise to homomorphisms of cohomology groups 
\[H^n(\Gamma,\mathbb Z)\ \ \stackrel{tr}{\leftarrow} \ \ H^n(\Gamma',\mathbb Z)
\ \ \stackrel{\alpha}{\leftarrow} \ \ H^n(g^{-1}\Gamma' g,\mathbb Z) \ \
\stackrel{\beta}{\leftarrow} H^n(\Gamma, \mathbb Z) \]
 with $\alpha$, $\beta$ functorial maps, and $tr$ the transfer map. We define the composite $T_g=tr \circ \alpha \circ \beta\colon H^n(\Gamma, \mathbb Z) \rightarrow
H^n(\Gamma, \mathbb Z)$ to be the \emph{ Hecke component } determined by $g$. 

For $\Gamma=\Gamma_0(N)$, prime integer $p$ coprime to $N$, and cohomology degree $n=1$ we define the \emph{Hecke operator} $T_p =T_g$ where $g=\left(\begin{array}{cc}1&0\\0&p\end{array}\right)$. Further details on this description of Hecke operators can be found in \cite[Appendix by P. Gunnells]{stein}. 

The following commands compute $T_2$ and $T_5$ and $\Gamma=\Gamma_0(39)$. The commands also compute the eigenvalues of these two Hecke operators. The
final command confirms that $T_2$ and $T_5$ commute. (It is a fact that $T_pT_q=T_qT_p$ for all $p,q$.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gamma:=HAP_CongruenceSubgroupGamma0(39);;|
  !gapprompt@gap>| !gapinput@p:=2;;k:=2;;T2:=HeckeOperator(gamma,p,k);;|
  !gapprompt@gap>| !gapinput@Display(T2);|
  [ [  -2,  -2,   2,   2,   1,   2,   0,   0,   0 ],
    [  -2,   0,   1,   2,  -2,   2,   2,   2,  -2 ],
    [  -2,  -1,   2,   2,  -1,   2,   1,   1,  -1 ],
    [  -2,  -1,   2,   2,   1,   1,   0,   0,   0 ],
    [  -1,   0,   0,   2,  -3,   2,   3,   3,  -3 ],
    [   0,   1,   1,   1,  -1,   0,   1,   1,  -1 ],
    [  -1,   1,   1,  -1,   0,   1,   2,  -1,   1 ],
    [  -1,  -1,   0,   2,  -3,   2,   1,   4,  -1 ],
    [   0,   1,   0,  -1,  -2,   1,   1,   1,   2 ] ]
  !gapprompt@gap>| !gapinput@Eigenvalues(Rationals,T2);|
  [ 3, 1 ]
  
  !gapprompt@gap>| !gapinput@p:=5;;k:=2;;h:=HeckeOperator(gamma,p,k);;|
  !gapprompt@gap>| !gapinput@Display(T5);|
  [ [  -1,  -1,   3,   4,   0,   0,   1,   1,  -1 ],
    [  -5,  -1,   5,   4,   0,   0,   3,   3,  -3 ],
    [  -2,   0,   4,   4,   1,   0,  -1,  -1,   1 ],
    [  -2,   0,   3,   2,  -3,   2,   4,   4,  -4 ],
    [  -4,  -2,   4,   4,   3,   0,   1,   1,  -1 ],
    [  -6,  -4,   5,   6,   1,   2,   2,   2,  -2 ],
    [   1,   5,   0,  -4,  -3,   2,   5,  -1,   1 ],
    [  -2,  -2,   2,   4,   0,   0,  -2,   4,   2 ],
    [   1,   3,   0,  -4,  -4,   2,   2,   2,   4 ] ]
  !gapprompt@gap>| !gapinput@Eigenvalues(Rationals,T5);|
  [ 6, 2 ]
  
  gap>T2*T5=T5*T2;
  true
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Hecke operators on forms of weight $ \ge 2$}}\logpage{[ 13, 7, 0 ]}
\hyperdef{L}{X831BB0897B988DA3}{}
{
 The above definition of Hecke operator $T_p$ for $\Gamma=\Gamma_0(N)$ extends to a Hecke operator $T_p\colon H^1(\Gamma,P_{\mathbb Q}(k-2) ) \rightarrow H^1(\Gamma,P_{\mathbb
Q}(k-2) )$ for $k\ge 2$. We work over the rationals since that is a setting of much interest. The
following commands compute the matrix of $T_2\colon H^1(\Gamma,P_{\mathbb Q}(k-2) ) \rightarrow H^1(\Gamma,P_{\mathbb
Q}(k-2) )$ for $\Gamma=SL_2(\mathbb Z)$ and $k=4$; 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@H:=HAP_CongruenceSubgroupGamma0(1);;|
  !gapprompt@gap>| !gapinput@h:=HeckeOperator(H,2,12);;Display(h);|
  [ [   2049,  -7560,      0 ],
    [      0,    -24,      0 ],
    [      0,      0,    -24 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Reconstructing modular forms from cohomology computations}}\logpage{[ 13, 8, 0 ]}
\hyperdef{L}{X84CC51EE8525E0D9}{}
{
 

Given a modular form $f\colon {\frak h} \rightarrow \mathbb C$ associated to a congruence subgroup $\Gamma$, and given a compact edge $e$ in the tessellation of ${\frak h}$ (\emph{i.e.} an edge in the cubic tree $\cal T$) arising from the above fundamental domain for $SL_2(\mathbb Z)$, we can evaluate 
\[\int_e f(z)\,dz \ .\]
 In this way we obtain a cochain $f_1\colon C_1({\cal T}) \rightarrow \mathbb C$ in $Hom_{\mathbb Z\Gamma}(C_1({\cal T}), \mathbb C)$ representing a cohomology class $c(f) \in H^1(\, Hom_{\mathbb Z\Gamma}(C_\ast({\cal T}), \mathbb C) \,) =
H^1(\Gamma,\mathbb C)$. The correspondence $f\mapsto c(f)$ underlies the Eichler\texttt{\symbol{45}}Shimura isomorphism. Hecke operators
can be used to recover modular forms from cohomology classes. 

 Let $\Gamma=\Gamma_0(N)$. The above defined Hecke operators restrict to operators on cuspidal
cohomology. On the left\texttt{\symbol{45}}hand side of the
Eichler\texttt{\symbol{45}}Shimura isomorphism Hecke operators restrict to
operators $T_s\colon S_2(\Gamma) \rightarrow S_2(\Gamma)$ for $s\ge 1$. 

Consider the function $q=q(z)=e^{2\pi i z}$ which is holomorphic on $\mathbb C$. For any modular form $f(z) \in M_k(\Gamma)$ there are numbers $a_s$ such that 
\[f(z) = \sum_{s=0}^\infty a_sq^s \]
 for all $z\in {\frak h}$. The form $f$ is a cusp form if $a_0=0$. 

 A non\texttt{\symbol{45}}zero cusp form $f\in S_2(\Gamma)$ is a cusp \emph{eigenform} if it is simultaneously an eigenvector for the Hecke operators $T_s$ for all $s =1,2,3,\cdots$ coprime to the level $N$. A cusp eigenform is said to be \emph{normalized} if its coefficient $a_1=1$. It turns out that if $f$ is normalized then the coefficient $a_s$ is an eigenvalue for $T_s$ (see for instance \cite{stein} for details). It can be shown \cite{atkinlehner} that $S_2(\Gamma_0(N))$ admits a "basis constructed from eigenforms". 

 This all implies that, in principle, we can construct an approximation to an
explicit basis for the space $S_2(\Gamma_0(N))$ of cusp forms by computing eigenvalues for Hecke operators. 

 Suppose that we would like a basis for $S_2(\Gamma_0(11))$. The following commands first show that $H^1_{cusp}(\Gamma_0(11),\mathbb Z)=\mathbb Z\oplus \mathbb Z$ from which we deduce that $S_2(\Gamma_0(11)) =\mathbb C$ is $1$\texttt{\symbol{45}}dimensional and thus admits a basis of eigenforms. Then
eigenvalues of Hecke operators are calculated to establish that the modular
form 
\[f = q -2q^2 -q^3 +2q^4 +q^5 +2q^6 -2q^7 + -2q^9 -2q^{10} + \cdots \]
 constitutes a basis for $S_2(\Gamma_0(11))$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gamma:=HAP_CongruenceSubgroupGamma0(11);;|
  !gapprompt@gap>| !gapinput@AbelianInvariants(Kernel(CuspidalCohomologyHomomorphism(gamma,1,2)));|
  [ 0, 0 ]
  
  !gapprompt@gap>| !gapinput@T1:=HeckeOperator(gamma,1,2);; Display(T1);|
  [ [  1,  0,  0 ],
    [  0,  1,  0 ],
    [  0,  0,  1 ] ]
  !gapprompt@gap>| !gapinput@T2:=HeckeOperator(gamma,2,2);; Display(T2);|
  [ [   3,  -4,   4 ],
    [   0,  -2,   0 ],
    [   0,   0,  -2 ] ]
  !gapprompt@gap>| !gapinput@T3:=HeckeOperator(gamma,3,2);; Display(T3);|
  [ [   4,  -4,   4 ],
    [   0,  -1,   0 ],
    [   0,   0,  -1 ] ]
  !gapprompt@gap>| !gapinput@T5:=HeckeOperator(gamma,5,2);; Display(T5);|
  [ [   6,  -4,   4 ],
    [   0,   1,   0 ],
    [   0,   0,   1 ] ]
  !gapprompt@gap>| !gapinput@T7:=HeckeOperator(gamma,7,2);; Display(T7);|
  [ [   8,  -8,   8 ],
    [   0,  -2,   0 ],
    [   0,   0,  -2 ] ]
  
\end{Verbatim}
 

 For a normalized eigenform $f=1 + \sum_{s=2}^\infty a_sq^s$ the coefficients $a_s$ with $s$ a composite integer can be expressed in terms of the coefficients $a_p$ for prime $p$. If $r,s$ are coprime then $T_{rs} =T_rT_s$. If $p$ is a prime that is not a divisor of the level $N$ of $\Gamma$ then $a_{p^m} =a_{p^{m-1}}a_p - p a_{p^{m-2}}.$ If the prime $ p$ divides $N$ then $a_{p^m} = (a_p)^m$. It thus suffices to compute the coefficients $a_p$ for prime integers $p$ only. 

 The following commands establish that $S_{12}(SL_2(\mathbb Z))$ has a basis consisting of one cusp eigenform 

$q - 24q^2 + 252q^3 - 1472q^4 + 4830q^5 - 6048q^6 - 16744q^7 + 84480q^8 -
113643q^9 $ 

$- 115920q^{10} + 534612q^{11} - 370944q^{12} - 577738q^{13} + 401856q^{14} +
1217160q^{15} + 987136q^{16}$ 

$ - 6905934q^{17} + 2727432q^{18} + 10661420q^{19} + ...$ 
\begin{Verbatim}[commandchars=@|D,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>D @gapinput|R:=ResolutionSL2Z_alt(2);;D
  @gapprompt|gap>D @gapinput|G:=R!.group;;D
  @gapprompt|gap>D @gapinput|P:=HomogeneousPolynomials(G,14);D
  MappingByFunction( SL(2,Integers), <matrix group with 
  2 generators>, function( x ) ... end )
  @gapprompt|gap>D @gapinput|Cohomology(HomToIntegralModule(R,P),1);D
  [ 2, 2, 156, 0, 0, 0 ]
  @gapprompt|gap>D @gapinput|#Thus the space S_12 of cusp forms is of dimension 1D
  
  
  @gapprompt|gap>D @gapinput|G:=HAP_CongruenceSubgroupGamma0(1);;D
  @gapprompt|gap>D @gapinput|for p in [2,3,5,7,11,13,17,19] doD
  @gapprompt|>D @gapinput|T:=HeckeOperator(G,p,12);;D
  @gapprompt|>D @gapinput|Print("eigenvalues= ",Eigenvalues(Rationals,T), " and eigenvectors = ", Eigenvectors(Rationals,T)," for p= ",p,"\n");D
  @gapprompt|>D @gapinput|od;D
  eigenvalues= [ 2049, -24 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 2
  eigenvalues= [ 177148, 252 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 3
  eigenvalues= [ 48828126, 4830 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 5
  eigenvalues= [ 1977326744, -16744 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 7
  eigenvalues= [ 285311670612, 534612 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 11
  eigenvalues= [ 1792160394038, -577738 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 13
  eigenvalues= [ 34271896307634, -6905934 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 17
  eigenvalues= [ 116490258898220, 10661420 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 19
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{The Picard group}}\logpage{[ 13, 9, 0 ]}
\hyperdef{L}{X8180E53C834301EF}{}
{
 Let us now consider the \emph{Picard group} $G=SL_2(\mathbb Z[ i])$ and its action on \emph{upper\texttt{\symbol{45}}half space} 
\[{\frak h}^3 =\{(z,t) \in \mathbb C\times \mathbb R\ |\ t > 0\} \ . \]
 To describe the action we introduce the symbol $j$ satisfying $j^2=-1$, $ij=-ji$ and write $z+tj$ instead of $(z,t)$. The action is given by 
\[\left(\begin{array}{ll}a&b\\ c &d \end{array}\right)\cdot (z+tj) \ = \
\left(a(z+tj)+b\right)\left(c(z+tj)+d\right)^{-1}\ .\]
 Alternatively, and more explicitly, the action is given by 
\[\left(\begin{array}{ll}a&b\\ c &d \end{array}\right)\cdot (z+tj) \ = \
\frac{(az+b)\overline{(cz+d) } + a\overline c t^2}{|cz +d|^2 + |c|^2t^2} \ +\
\frac{t}{|cz+d|^2+|c|^2t^2}\, j \ .\]
 

A standard 'fundamental domain' $D$ for this action is the following region (with some of the boundary points
removed). 
\[ \{z+tj\in {\frak h}^3\ |\ 0 \le |{\rm Re}(z)| \le \frac{1}{2}, 0\le {\rm
Im}(z) \le \frac{1}{2}, z\overline z +t^2 \ge 1\} \]
  

The four bottom vertices of $D$ are $a = -\frac{1}{2} +\frac{1}{2}i +\frac{\sqrt{2}}{2}j$, $b = -\frac{1}{2} +\frac{\sqrt{3}}{2}j$, $c = \frac{1}{2} +\frac{\sqrt{3}}{2}j$, $d = \frac{1}{2} +\frac{1}{2}i +\frac{\sqrt{2}}{2}j$. 

The upper\texttt{\symbol{45}}half space ${\frak h}^3$ can be retracted onto a $2$\texttt{\symbol{45}}dimensional subspace ${\cal T} \subset {\frak h}^3$. The space ${\cal T}$ is a contractible $2$\texttt{\symbol{45}}dimensional regular CW\texttt{\symbol{45}}complex, and the
action of the Picard group $G$ restricts to a cellular action of $G$ on ${\cal T}$. 

Using perturbation techniques, the $2$\texttt{\symbol{45}}complex ${\cal T}$ can be combined with free resolutions for the cell stabilizer groups to
contruct a regular CW\texttt{\symbol{45}}complex $X$ on which the Picard group $G$ acts freely. The following commands compute the first few terms of the free $\mathbb ZG$\texttt{\symbol{45}}resolution $R_\ast =C_\ast X$. Then $R_\ast$ is used to compute 
\[H^1(G,\mathbb Z) =0\ ,\]
 
\[H^2(G,\mathbb Z) =\mathbb Z_2\oplus \mathbb Z_2\ ,\]
 
\[H^3(G,\mathbb Z) =\mathbb Z_6\ ,\]
 
\[H^4(G,\mathbb Z) =\mathbb Z_4\oplus \mathbb Z_{24}\ ,\]
 and compute a free presentation for $G$ involving four generators and seven relators. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=ContractibleGcomplex("SL(2,O-1)");;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(K,5);;|
  !gapprompt@gap>| !gapinput@Cohomology(HomToIntegers(R),1);|
  [  ]
  !gapprompt@gap>| !gapinput@Cohomology(HomToIntegers(R),2);|
  [ 2, 2 ]
  !gapprompt@gap>| !gapinput@Cohomology(HomToIntegers(R),3);|
  [ 6 ]
  !gapprompt@gap>| !gapinput@Cohomology(HomToIntegers(R),4);|
  [ 4, 24 ]
  !gapprompt@gap>| !gapinput@P:=PresentationOfResolution(R);|
  rec( freeGroup := <free group on the generators [ f1, f2, f3, f4 ]>, 
    gens := [ 184, 185, 186, 187 ], 
    relators := [ f1^2*f2^-1*f1^-1*f2^-1, f1*f2*f1*f2^-2, 
        f3*f2^2*f1*(f2*f1^-1)^2*f3^-1*f1^2*f2^-2, 
        f1*(f2*f1^-1)^2*f3^-1*f1^2*f2^-1*f3^-1, 
        f4*f2*f1*(f2*f1^-1)^2*f4^-1*f1*f2^-1, f1*f4^-1*f1^-2*f4^-1, 
        f3*f2*f1*(f2*f1^-1)^2*f4^-1*f1*f2^-1*f3^-1*f4*f2 ] )
  
\end{Verbatim}
 We can also compute the cohomology of $G=SL_2(\mathbb Z[i])$ with coefficients in a module such as the module $P_{\mathbb Z[i]}(k)$ of degree $k$ homogeneous polynomials with coefficients in $\mathbb Z[i]$ and with the action described above. For instance, the following commands
compute 
\[H^1(G,P_{\mathbb Z[i]}(24)) = (\mathbb Z_2)^4 \oplus \mathbb Z_4 \oplus
\mathbb Z_8 \oplus \mathbb Z_{40} \oplus \mathbb Z_{80}\, ,\]
 
\[H^2(G,P_{\mathbb Z[i]}(24)) = (\mathbb Z_2)^{24} \oplus \mathbb
Z_{520030}\oplus \mathbb Z_{1040060} \oplus \mathbb Z^2\, ,\]
 
\[H^3(G,P_{\mathbb Z[i]}(24)) = (\mathbb Z_2)^{22} \oplus \mathbb Z_{4}\oplus
(\mathbb Z_{12})^2 \, .\]
 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|G:=R!.group;;A
  @gapprompt|gap>A @gapinput|M:=HomogeneousPolynomials(G,24);;A
  @gapprompt|gap>A @gapinput|C:=HomToIntegralModule(R,M);;A
  @gapprompt|gap>A @gapinput|Cohomology(C,1);A
  [ 2, 2, 2, 2, 4, 8, 40, 80 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,2);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    520030, 1040060, 0, 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,3);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 12, 12 
   ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Bianchi groups}}\logpage{[ 13, 10, 0 ]}
\hyperdef{L}{X858B1B5D8506FE81}{}
{
 The \emph{Bianchi groups} are the groups $G=PSL_2({\cal O}_{-d})$ where $d$ is a square free positive integer and ${\cal O}_{-d}$ is the ring of integers of the imaginary quadratic field $\mathbb Q(\sqrt{-d})$. More explicitly, 
\[{\cal O}_{-d} = \mathbb Z\left[\sqrt{-d}\right]~~~~~~~~ {\rm if~} d \equiv 1,2
{\rm ~mod~} 4\, ,\]
 
\[{\cal O}_{-d} = \mathbb Z\left[\frac{1+\sqrt{-d}}{2}\right]~~~~~ {\rm if~} d
\equiv 3 {\rm ~mod~} 4\, .\]
 These groups act on upper\texttt{\symbol{45}}half space ${\frak h}^3$ in the same way as the Picard group. Upper\texttt{\symbol{45}}half space can
be tessellated by a 'fundamental domain' for this action. Moreover, as with
the Picard group, this tessellation contains a $2$\texttt{\symbol{45}}dimensional cellular subspace ${\cal T}\subset {\frak h}^3$ where ${\cal T}$ is a contractible CW\texttt{\symbol{45}}complex on which $G$ acts cellularly. It should be mentioned that the fundamental domain and the
contractible $2$\texttt{\symbol{45}}complex ${\cal T}$ are not uniquely determined by $G$. Various algorithms exist for computing ${\cal T}$ and its cell stabilizers. One algorithm due to Swan \cite{swan} has been implemented by Alexander Rahm \cite{rahmthesis} and the output for various values of $d$ are stored in HAP. Another approach is to use Voronoi's theory of perfect
forms. This approach has been implemented by Sebastian Schoennenbeck \cite{schoennenbeck} and, again, its output for various values of $d$ are stored in HAP. The following commands combine data from Schoennenbeck's
algorithm with free resolutions for cell stabiliers to compute 
\[H^1(PSL_2({\cal O}_{-6}),P_{{\cal O}_{-6}}(24)) = (\mathbb Z_2)^4 \oplus
\mathbb Z_{12} \oplus \mathbb Z_{24} \oplus \mathbb Z_{9240} \oplus \mathbb
Z_{55440} \oplus \mathbb Z^4\,, \]
 
\[H^2(PSL_2({\cal O}_{-6}),P_{{\cal O}_{-6}}(24)) = \begin{array}{l} (\mathbb
Z_2)^{26} \oplus \mathbb (Z_{6})^8 \oplus \mathbb (Z_{12})^{9} \oplus \mathbb
Z_{24} \oplus (\mathbb Z_{120})^2 \oplus (\mathbb Z_{840})^3\\ \oplus \mathbb
Z_{2520} \oplus (\mathbb Z_{27720})^2 \oplus (\mathbb Z_{24227280})^2 \oplus
(\mathbb Z_{411863760})^2\\ \oplus \mathbb
Z_{2454438243748928651877425142836664498129840}\\ \oplus \mathbb
Z_{14726629462493571911264550857019986988779040}\\ \oplus \mathbb
Z^4\end{array}\ , \]
 
\[H^3(PSL_2({\cal O}_{-6}),P_{{\cal O}_{-6}}(24)) = (\mathbb Z_2)^{23} \oplus
\mathbb Z_{4} \oplus (\mathbb Z_{12})^2\ . \]
 Note that the action of $SL_2({\cal O}_{-d})$ on $P_{{\cal O}_{-d}}(k)$ induces an action of $PSL_2({\cal O}_{-d})$ provided $k$ is even. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|R:=ResolutionPSL2QuadraticIntegers(-6,4);A
  Resolution of length 4 in characteristic 0 for PSL(2,O-6) . 
  No contracting homotopy available. 
  
  @gapprompt|gap>A @gapinput|G:=R!.group;;A
  @gapprompt|gap>A @gapinput|M:=HomogeneousPolynomials(G,24);;A
  @gapprompt|gap>A @gapinput|C:=HomToIntegralModule(R,M);;A
  @gapprompt|gap>A @gapinput|Cohomology(C,1);A
  [ 2, 2, 2, 2, 12, 24, 9240, 55440, 0, 0, 0, 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,2);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 6, 6, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 12, 12, 12, 12, 12, 24, 120, 120, 
    840, 840, 840, 2520, 27720, 27720, 24227280, 24227280, 411863760, 411863760, 
    2454438243748928651877425142836664498129840, 
    14726629462493571911264550857019986988779040, 0, 0, 0, 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,3);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 12, 
    12 ]
  
\end{Verbatim}
 

We can also consider the coefficient module 
\[ P_{{\cal O}_{-d}}(k,\ell) = P_{{\cal O}_{-d}}(k) \otimes_{{\cal O}_{-d}}
\overline{P_{{\cal O}_{-d}}(\ell)} \]
 where the bar denotes a twist in the action obtained from complex conjugation.
For an action of the projective linear group we must insist that $k+\ell$ is even. The following commands compute 
\[H^2(PSL_2({\cal O}_{-11}),P_{{\cal O}_{-11}}(5,5)) = (\mathbb Z_2)^8 \oplus
\mathbb Z_{60} \oplus (\mathbb Z_{660})^3 \oplus \mathbb Z^6\,, \]
 a computation which was first made, along with many other cohomology
computationsfor Bianchi groups, by Mehmet Haluk Sengun \cite{sengun}. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|R:=ResolutionPSL2QuadraticIntegers(-11,3);;A
  @gapprompt|gap>A @gapinput|M:=HomogeneousPolynomials(R!.group,5,5);;A
  @gapprompt|gap>A @gapinput|C:=HomToIntegralModule(R,M);;A
  @gapprompt|gap>A @gapinput|Cohomology(C,2);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 60, 660, 660, 660, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 

The function \texttt{ResolutionPSL2QuadraticIntegers(\texttt{\symbol{45}}d,n)} relies on a limited data base produced by the algorithms implemented by
Schoennenbeck and Rahm. The function also covers some cases covered by
entering a sring "\texttt{\symbol{45}}d+I" as first variable. These cases
correspond to projective special groups of module automorphisms of lattices of
rank 2 over the integers of the imaginary quadratic number field $\mathbb Q(\sqrt{-d})$ with non\texttt{\symbol{45}}trivial Steinitz\texttt{\symbol{45}}class. In the
case of a larger class group there are cases labelled
"\texttt{\symbol{45}}d+I2",...,"\texttt{\symbol{45}}d+Ik" and the Ij together
with O\texttt{\symbol{45}}d form a system of representatives of elements of
the class group modulo squares and Galois action. For instance, the following
commands compute 
\[H_2(PSL({\cal O}_{-21+I2}),\mathbb Z) = \mathbb Z_2\oplus \mathbb Z^6\, .\]
 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionPSL2QuadraticIntegers("-21+I2",3);|
  Resolution of length 3 in characteristic 0 for PSL(2,O-21+I2)) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R),2);|
  [ 2, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{(Co)homology of Bianchi groups and $SL_2({\cal O}_{-d})$}}\logpage{[ 13, 11, 0 ]}
\hyperdef{L}{X851390E07C3B3BB1}{}
{
 The (co)homology of Bianchi groups has been studied in papers such as \cite{Schwermer} \cite{Vogtmann} \cite{Berkove00} \cite{Berkove06} \cite{Rahm11} \cite{Rahm13} \cite{Rahm13a} \cite{Rahm20}. Calculations in these papers can often be verified by computer. For
instance, the calculation 
\[H_q(PSL_2({\cal O}_{-15}),\mathbb Z) = \left\{\begin{array}{ll} \mathbb Z^2
\oplus \mathbb Z_6 & q=1,\\ \mathbb Z \oplus \mathbb Z_6 & q=2,\\ \mathbb Z_6
& q\ge 3\\ \end{array}\right. \]
 obtained in \cite{Rahm11} can be verified as follows, once we note that Bianchi groups have virtual
cohomological dimension 2 and, if all stabilizer groups are periodic with
period dividing m, then the homology has period dividing m in degree $\ge 3$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=ContractibleGcomplex("SL(2,O-15)");;A
  @gapprompt|gap>A @gapinput|PK:=QuotientOfContractibleGcomplex(K,Group(-One(K!.group)));;A
  @gapprompt|gap>A @gapinput|for n in [0..2] doA
  @gapprompt|>A @gapinput|for k in [1..K!.dimension(n)] doA
  @gapprompt|>A @gapinput|Print( CohomologicalPeriod(K!.stabilizer(n,k)),"  ");A
  @gapprompt|>A @gapinput|od;od;A
  2  2  2  2  2  2  2  2  2  2  2  2  2  2  
  @gapprompt|gap>A @gapinput|R:=FreeGResolution(PK,5);;A
  @gapprompt|gap>A @gapinput|for n in [0..4] doA
  @gapprompt|>A @gapinput|Print("H_",n," = ", Homology(TensorWithIntegers(R),n),"\n");A
  @gapprompt|>A @gapinput|od;A
  H_0 = [ 0 ]
  H_1 = [ 6, 0, 0 ]
  H_2 = [ 6, 0 ]
  H_3 = [ 6 ]
  H_4 = [ 6 ]
  
\end{Verbatim}
 All finite subgroups of $SL_2({\cal O}_{-d})$ are periodic. Thus the above example can be adapted from PSL to SL for any
square=free $d\ge 1$. For example, the calculation 
\[H^q(SL_2({\cal O}_{-2}),\mathbb Z) = \left\{\begin{array}{ll} \mathbb Z &
q=1,\\ \mathbb Z_6 & q=2 {\rm \ mod\ } 4,\\ \mathbb Z_2 \oplus \mathbb Z_{12}
& q= 3 {\rm \ mod\ } 4\\ \mathbb Z_2 \oplus \mathbb Z_{24} & q= 0 {\rm \ mod\
} 4 (q>0)\\ \mathbb Z_{12} & q= 1 {\rm \ mod\ } 4 (q > 1)\\ \end{array}\right. \]
 obtained in \cite{Schwermer} can be verified as follows. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=ContractibleGcomplex("SL(2,O-2)");;A
  @gapprompt|gap>A @gapinput|for n in [0..2] doA
  @gapprompt|>A @gapinput|for k in [1..K!.dimension(n)] doA
  @gapprompt|>A @gapinput|Print(CohomologicalPeriod(K!.stabilizer(n,k)),"  ");A
  @gapprompt|>A @gapinput|od;od;A
  2  4  2  4  2  2  2  2  2  2  2  2  
  @gapprompt|gap>A @gapinput|R:=FreeGResolution(K,11);;A
  @gapprompt|gap>A @gapinput|for n in [0..10] doA
  @gapprompt|>A @gapinput|Print("H^",n," = ", Cohomology(HomToIntegers(R),n),"\n");A
  @gapprompt|>A @gapinput|od;A
  H^0 = [ 0 ]
  H^1 = [ 0 ]
  H^2 = [ 6 ]
  H^3 = [ 2, 12 ]
  H^4 = [ 2, 24 ]
  H^5 = [ 12 ]
  H^6 = [ 6 ]
  H^7 = [ 2, 12 ]
  H^8 = [ 2, 24 ]
  H^9 = [ 12 ]
  H^10 = [ 6 ]
  
\end{Verbatim}
 A quotient of a periodic group by a central subgroup of order 2 need not be
periodic. For this reason the (co)homology of PSL can be a bit more tricky
than SL. For example, the calculation 
\[H^q(PSL_2({\cal O}_{-13}),\mathbb Z) = \left\{\begin{array}{ll} \mathbb Z^3
\oplus (\mathbb Z_2)^2 & q=1,\\ \mathbb Z^2 \oplus \mathbb Z_4 \oplus (\mathbb
Z_3)^2 \oplus \mathbb Z_2 & q=2,\\ (\mathbb Z_2)^q \oplus (\mathbb Z_{3})^2 &
q= 3 {\rm \ mod\ } 4\\ (\mathbb Z_2)^q & q= 0 {\rm \ mod\ } 4 (q>0)\\ (\mathbb
Z_2)^q & q= 1 {\rm \ mod\ } 4 (q>1)\\ (\mathbb Z_2)^q \oplus (\mathbb Z_{3})^2
& q= 2 {\rm \ mod\ } 4 (q > 2)\\ \end{array}\right. \]
 was obtained in \cite{Rahm11}. The following commands verify the calculation in the first 34 degrees, but
for a proof valid for all degrees one needs to analyse the computation to spot
that there is a certain "periodicity of period 2" in the computations for $q\ge 3$. This analysis is done in \cite{Rahm11}. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=ContractibleGcomplex("SL(2,O-13)");;A
  @gapprompt|gap>A @gapinput|PK:=QuotientOfContractibleGcomplex(K,Group(-One(K!.group)));;A
  @gapprompt|gap>A @gapinput|for n in [0..2] doA
  @gapprompt|>A @gapinput|for k in [1..PK!.dimension(n)] doA
  @gapprompt|>A @gapinput|S:=SmallGroup(IdGroup(PK!.stabilizer( n, k )));A
  @gapprompt|>A @gapinput|Print( [n,k]," is periodic ",IsPeriodic(S),"\n  ");A
  @gapprompt|>A @gapinput|od;od;A
  [ 0, 1 ] is periodic true
  [ 0, 2 ] is periodic true
  [ 0, 3 ] is periodic true
  [ 0, 4 ] is periodic true
  [ 0, 5 ] is periodic true
  [ 0, 6 ] is periodic true
  [ 0, 7 ] is periodic false
  [ 0, 8 ] is periodic false
  [ 1, 1 ] is periodic true
  [ 1, 2 ] is periodic true
  [ 1, 3 ] is periodic true
  [ 1, 4 ] is periodic true
  [ 1, 5 ] is periodic true
  [ 1, 6 ] is periodic true
  [ 1, 7 ] is periodic true
  [ 1, 8 ] is periodic true
  [ 1, 9 ] is periodic true
  [ 1, 10 ] is periodic true
  [ 1, 11 ] is periodic true
  [ 1, 12 ] is periodic true
  [ 1, 13 ] is periodic true
  [ 2, 1 ] is periodic true
  [ 2, 2 ] is periodic true
  [ 2, 3 ] is periodic true
  [ 2, 4 ] is periodic true
  [ 2, 5 ] is periodic true
  [ 2, 6 ] is periodic true
  [ 2, 7 ] is periodic true
  [ 2, 8 ] is periodic true
  [ 2, 9 ] is periodic true
  [ 2, 10 ] is periodic true
  [ 2, 11 ] is periodic true
  
  @gapprompt|gap>A @gapinput|R:=ResolutionPSL2QuadraticIntegers(-13,35);;A
  @gapprompt|gap>A @gapinput|for n in [0..34] doA
  @gapprompt|>A @gapinput|Print("H_",n," = ", Homology(TensorWithIntegers(R),n),"\n");A
  @gapprompt|>A @gapinput|od;A
  H_0 = [ 0 ]
  H_1 = [ 2, 2, 0, 0, 0 ]
  H_2 = [ 6, 12, 0, 0 ]
  H_3 = [ 2, 6, 6 ]
  H_4 = [ 2, 2, 2, 2 ]
  H_5 = [ 2, 2, 2, 2, 2 ]
  H_6 = [ 2, 2, 2, 2, 6, 6 ]
  H_7 = [ 2, 2, 2, 2, 2, 6, 6 ]
  H_8 = [ 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_9 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_10 = [ 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_11 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_12 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_13 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_14 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_15 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_16 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_17 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_18 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_19 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_20 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_21 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_22 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_23 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_24 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_25 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_26 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_27 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_28 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_29 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_30 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_31 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_32 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_33 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_34 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  
\end{Verbatim}
 The Lyndon\texttt{\symbol{45}}Hochschild\texttt{\symbol{45}}Serre spectral
sequence $H_p(G/N,H_q(N,A)) \Rightarrow H_{p+q}(G,A)$ for the groups $G=SL_2({\mathcal O}_{-d})$ and $N\cong C_2$ the central subgroup with $G/N\cong PSL_2({\mathcal O}_{-d})$, and the trivial module $A = \mathbb Z_{\ell}$, implies that for primes $\ell>2$ we have a natural isomorphism $H_n(PSL_2({\mathcal O}_{-d}),\mathbb Z_{\ell}) \cong H_n(SL_2({\mathcal
O}_{-d}),\mathbb Z_{\ell})$. It follows that we have an isomorphism of $\ell$\texttt{\symbol{45}}primary parts $H_n(PSL_2({\mathcal O}_{-d}),\mathbb Z)_{(\ell)} \cong H_n(SL_2({\mathcal
O}_{-d}),\mathbb Z)_{(\ell)}$. Since $ H_n(SL_2({\mathcal O}_{-d}),\mathbb Z)_{(\ell)}$ is periodic in degrees $ \ge 3$ we can recover the $3$\texttt{\symbol{45}}primary part of $H_n(PSL_2({\mathcal O}_{-13}),\mathbb Z)$ in all degrees $q\ge1$ from the following computation by ignoring all $2$\texttt{\symbol{45}}power factors in the output. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionSL2QuadraticIntegers(-13,13);;|
  !gapprompt@gap>| !gapinput@for n in [3..12] do|
  !gapprompt@>| !gapinput@Print("H_",n," at prime p=3 is: ", Filtered(Homology(TensorWithIntegers(R),n), m->IsInt(m/3)),"\n");|
  !gapprompt@>| !gapinput@od;|
  H_3 at prime p=3 is: [ 6, 24 ]
  H_4 at prime p=3 is: [  ]
  H_5 at prime p=3 is: [  ]
  H_6 at prime p=3 is: [ 6, 12 ]
  H_7 at prime p=3 is: [ 6, 24 ]
  H_8 at prime p=3 is: [  ]
  H_9 at prime p=3 is: [  ]
  H_10 at prime p=3 is: [ 6, 12 ]
  H_11 at prime p=3 is: [ 6, 24 ]
  H_12 at prime p=3 is: [  ]
  !gapprompt@gap>| !gapinput@#Ignore the 2-power factors in the output|
  
\end{Verbatim}
 The ring ${\mathcal O}_{-163}$ is an example of a principal ideal domain that is not a Euclidean domain. It
seems that no complete calculation of $H_n(PSL_2({\mathcal O}_{-163}),\mathbb Z)$ is yet available in the literature. The following comands compute this
homology in the first $31$ degrees. The computation suggests a general formula in higher degrees. All but
two of the stabilizer groups for the action of $PSL_2({\mathcal O}_{-163})$ are periodic. The non\texttt{\symbol{45}}periodic group $A_4$ occurs twice in degree $0$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionPSL2QuadraticIntegers(-163,32);;|
  !gapprompt@gap>| !gapinput@for n in [1..31] do|
  !gapprompt@>| !gapinput@Print("H_",n,"= ",Homology(TensorWithIntegers(R),n),"\n");|
  !gapprompt@>| !gapinput@od;|
  H_1= [ 0, 0, 0, 0, 0, 0, 0 ]
  H_2= [ 2, 12, 0, 0, 0, 0, 0, 0 ]
  H_3= [ 6 ]
  H_4= [  ]
  H_5= [ 2, 2, 2 ]
  H_6= [ 2, 6 ]
  H_7= [ 6 ]
  H_8= [ 2, 2, 2, 2 ]
  H_9= [ 2, 2, 2 ]
  H_10= [ 2, 6 ]
  H_11= [ 2, 2, 2, 2, 6 ]
  H_12= [ 2, 2, 2, 2 ]
  H_13= [ 2, 2, 2 ]
  H_14= [ 2, 2, 2, 2, 2, 6 ]
  H_15= [ 2, 2, 2, 2, 6 ]
  H_16= [ 2, 2, 2, 2 ]
  H_17= [ 2, 2, 2, 2, 2, 2, 2 ]
  H_18= [ 2, 2, 2, 2, 2, 6 ]
  H_19= [ 2, 2, 2, 2, 6 ]
  H_20= [ 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_21= [ 2, 2, 2, 2, 2, 2, 2 ]
  H_22= [ 2, 2, 2, 2, 2, 6 ]
  H_23= [ 2, 2, 2, 2, 2, 2, 2, 2, 6 ]
  H_24= [ 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_25= [ 2, 2, 2, 2, 2, 2, 2 ]
  H_26= [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 6 ]
  H_27= [ 2, 2, 2, 2, 2, 2, 2, 2, 6 ]
  H_28= [ 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_29= [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_30= [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 6 ]
  H_31= [ 2, 2, 2, 2, 2, 2, 2, 2, 6 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Some other infinite matrix groups}}\logpage{[ 13, 12, 0 ]}
\hyperdef{L}{X86A6858884B9C05B}{}
{
 Analogous to the functions for Bianchi groups, HAP has functions 
\begin{itemize}
\item \texttt{ResolutionSL2QuadraticIntegers(\texttt{\symbol{45}}d,n)} 
\item \texttt{ResolutionSL2ZInvertedInteger(m,n)}
\item \texttt{ResolutionGL2QuadraticIntegers(\texttt{\symbol{45}}d,n)}
\item \texttt{ResolutionPGL2QuadraticIntegers(\texttt{\symbol{45}}d,n)}
\item \texttt{ResolutionGL3QuadraticIntegers(\texttt{\symbol{45}}d,n)}
\item \texttt{ResolutionPGL3QuadraticIntegers(\texttt{\symbol{45}}d,n)}
\end{itemize}
 for computing free resolutions for certain values of $SL_2({\cal O}_{-d})$, $SL_2(\mathbb Z[\frac{1}{m}])$, $GL_2({\cal O}_{-d})$ and $PGL_2({\cal O}_{-d})$. Additionally, the function 
\begin{itemize}
\item \texttt{ResolutionArithmeticGroup("string",n)}
\end{itemize}
 can be used to compute resolutions for groups whose data (provided by
Sebastian Schoennenbeck, Alexander Rahm and Mathieu Dutour) is stored in the
directory \texttt{gap/pkg/Hap/lib/Perturbations/Gcomplexes} . 

For instance, the following commands compute 
\[H^1(SL_2({\cal O}_{-6}),P_{{\cal O}_{-6}}(24)) = (\mathbb Z_2)^4 \oplus
\mathbb Z_{12} \oplus \mathbb Z_{24} \oplus \mathbb Z_{9240} \oplus \mathbb
Z_{55440} \oplus \mathbb Z^4\,, \]
 
\[H^2(SL_2({\cal O}_{-6}),P_{{\cal O}_{-6}}(24)) = \begin{array}{l} (\mathbb
Z_2)^{26} \oplus \mathbb (Z_{6})^7 \oplus \mathbb (Z_{12})^{10} \oplus \mathbb
Z_{24} \oplus (\mathbb Z_{120})^2 \oplus (\mathbb Z_{840})^3\\ \oplus \mathbb
Z_{2520} \oplus (\mathbb Z_{27720})^2 \oplus (\mathbb Z_{24227280})^2 \oplus
(\mathbb Z_{411863760})^2\\ \oplus \mathbb
Z_{2454438243748928651877425142836664498129840}\\ \oplus \mathbb
Z_{14726629462493571911264550857019986988779040}\\ \oplus \mathbb
Z^4\end{array}\ , \]
 
\[H^3(SL_2({\cal O}_{-6}),P_{{\cal O}_{-6}}(24)) = (\mathbb Z_2)^{58} \oplus
(\mathbb Z_{4})^4 \oplus (\mathbb Z_{12})\ . \]
 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|R:=ResolutionSL2QuadraticIntegers(-6,4);A
  Resolution of length 4 in characteristic 0 for PSL(2,O-6) . 
  No contracting homotopy available. 
  
  @gapprompt|gap>A @gapinput|G:=R!.group;;A
  @gapprompt|gap>A @gapinput|M:=HomogeneousPolynomials(G,24);;A
  @gapprompt|gap>A @gapinput|C:=HomToIntegralModule(R,M);;A
  @gapprompt|gap>A @gapinput|Cohomology(C,1);A
  [ 2, 2, 2, 2, 12, 24, 9240, 55440, 0, 0, 0, 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,2);A
  @gapprompt|gap>A @gapinput|Cohomology(C,2);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 6, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 24, 120, 
    120, 840, 840, 840, 2520, 27720, 27720, 24227280, 24227280, 411863760, 
    411863760, 2454438243748928651877425142836664498129840, 
    14726629462493571911264550857019986988779040, 0, 0, 0, 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,3);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 12, 12 ]
  
\end{Verbatim}
 

The following commands construct free resolutions up to degree 5 for the
groups $SL_2(\mathbb Z[\frac{1}{2}])$, $GL_2({\cal O}_{-2})$, $GL_2({\cal O}_{2})$, $PGL_2({\cal O}_{2})$, $GL_3({\cal O}_{-2})$, $PGL_3({\cal O}_{-2})$. The final command constructs a free resolution up to degree 3 for $PSL_4(\mathbb Z)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R1:=ResolutionSL2ZInvertedInteger(2,5);|
  Resolution of length 5 in characteristic 0 for SL(2,Z[1/2]) . 
  
  !gapprompt@gap>| !gapinput@R2:=ResolutionGL2QuadraticIntegers(-2,5);|
  Resolution of length 5 in characteristic 0 for GL(2,O-2) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@R3:=ResolutionGL2QuadraticIntegers(2,5);|
  Resolution of length 5 in characteristic 0 for GL(2,O2) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@R4:=ResolutionPGL2QuadraticIntegers(2,5);|
  Resolution of length 5 in characteristic 0 for PGL(2,O2) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@R5:=ResolutionGL3QuadraticIntegers(-2,5);|
  Resolution of length 5 in characteristic 0 for GL(3,O-2) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@R6:=ResolutionPGL3QuadraticIntegers(-2,5);|
  Resolution of length 5 in characteristic 0 for PGL(3,O-2) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@R7:=ResolutionArithmeticGroup("PSL(4,Z)",3);|
  Resolution of length 3 in characteristic 0 for <matrix group with 655 generators> . 
  No contracting homotopy available. 
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Ideals and finite quotient groups}}\logpage{[ 13, 13, 0 ]}
\hyperdef{L}{X7EF5D97281EB66DA}{}
{
 The following commands first construct the number field $\mathbb Q(\sqrt{-7})$, its ring of integers ${\cal O}_{-7}={\cal O}(\mathbb Q(\sqrt{-7}))$, and the principal ideal $I=\langle 5 + 2\sqrt{-7}\rangle \triangleleft {\cal O}(\mathbb Q(\sqrt{-7}))$ of norm ${\cal N}(I)=53$. The ring $I$ is prime since its norm is a prime number. The primality of $I$ is also demonstrated by observing that the quotient ring $R={\cal O}_{-7}/I$ is an integral domain and hence isomorphic to the unique finite field of order $53 $, $R\cong \mathbb Z/53\mathbb Z$ . (In a ring of quadratic integers \emph{prime ideal} is the same as \emph{maximal ideal}). 

The finite group $G=SL_2({\cal O}_{-7}\,/\,I)$ is then constructed and confirmed to be isomorphic to $SL_2(\mathbb Z/53\mathbb Z)$. The group $G$ is shown to admit a periodic $\mathbb ZG$\texttt{\symbol{45}}resolution of $\mathbb Z$ of period dividing $52$. 

Finally the integral homology 
\[H_n(G,\mathbb Z) = \left\{\begin{array}{ll} 0 & n\ne 3,7, {\rm~for~} 0\le n
\le 8,\\ \mathbb Z_{2808} & n=3,7, \end{array}\right.\]
 is computed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuadraticNumberField(-7);|
  Q(Sqrt(-7))
  
  !gapprompt@gap>| !gapinput@OQ:=RingOfIntegers(Q);|
  O(Q(Sqrt(-7)))
  
  !gapprompt@gap>| !gapinput@I:=QuadraticIdeal(OQ,5+2*Sqrt(-7));|
  ideal of norm 53 in O(Q(Sqrt(-7)))
  
  !gapprompt@gap>| !gapinput@R:=OQ mod I;|
  ring mod ideal of norm 53
  
  !gapprompt@gap>| !gapinput@IsIntegralRing(R);|
  true
  
  !gapprompt@gap>| !gapinput@gens:=GeneratorsOfGroup( SL2QuadraticIntegers(-7) );;|
  !gapprompt@gap>| !gapinput@G:=Group(gens*One(R));;G:=Image(IsomorphismPermGroup(G));;|
  !gapprompt@gap>| !gapinput@StructureDescription(G);|
  "SL(2,53)"
  
  !gapprompt@gap>| !gapinput@IsPeriodic(G);|
  true
  !gapprompt@gap>| !gapinput@CohomologicalPeriod(G);|
  52
  
  !gapprompt@gap>| !gapinput@GroupHomology(G,1);|
  [  ]
  !gapprompt@gap>| !gapinput@GroupHomology(G,2);|
  [  ]
  !gapprompt@gap>| !gapinput@GroupHomology(G,3);|
  [ 8, 27, 13 ]
  !gapprompt@gap>| !gapinput@GroupHomology(G,4);|
  [  ]
  !gapprompt@gap>| !gapinput@GroupHomology(G,5);|
  [  ]
  !gapprompt@gap>| !gapinput@GroupHomology(G,6);|
  [  ]
  !gapprompt@gap>| !gapinput@GroupHomology(G,7);|
  [ 8, 27, 13 ]
  !gapprompt@gap>| !gapinput@GroupHomology(G,8);|
  [  ]
  
\end{Verbatim}
 

The following commands show that the rational prime $7$ is not prime in ${\cal O}_{-5}={\cal O}(\mathbb Q(\sqrt{-5}))$. Moreover, $7$ totally splits in ${\cal O}_{-5}$ since the final command shows that only the rational primes $2$ and $5$ ramify in ${\cal O}_{-5}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuadraticNumberField(-5);;|
  !gapprompt@gap>| !gapinput@OQ:=RingOfIntegers(Q);;|
  !gapprompt@gap>| !gapinput@I:=QuadraticIdeal(OQ,7);;|
  !gapprompt@gap>| !gapinput@IsPrime(I);|
  false
  
  !gapprompt@gap>| !gapinput@Factors(Discriminant(OQ));|
  [ -2, 2, 5 ]
  
\end{Verbatim}
 

 For $d < 0$ the rings ${\cal O}_d={\cal O}(\mathbb Q(\sqrt{d}))$ are unique factorization domains for precisely 
\[ d = -1, -2, -3, -7, -11, -19, -43, -67, -163.\]
 This result was conjectured by Gauss, and essentially proved by Kurt Heegner,
and then later proved by Harold Stark. 

The following commands construct the classic example of a prime ideal $I$ that is not principal. They then illustrate reduction modulo $I$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuadraticNumberField(-5);;|
  !gapprompt@gap>| !gapinput@OQ:=RingOfIntegers(Q);;|
  !gapprompt@gap>| !gapinput@I:=QuadraticIdeal(OQ,[2,1+Sqrt(-5)]);|
  ideal of norm 2 in O(Q(Sqrt(-5)))
  
  !gapprompt@gap>| !gapinput@6 mod I;|
  0
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Congruence subgroups for ideals}}\logpage{[ 13, 14, 0 ]}
\hyperdef{L}{X7D1F72287F14C5E1}{}
{
 

 Given a ring of integers ${\cal O}$ and ideal $I \triangleleft {\cal O}$ there is a canonical homomorphism $\pi_I\colon SL_2({\cal O}) \rightarrow SL_2({\cal O}/I)$. A subgroup $\Gamma \le SL_2({\cal O})$ is said to be a \emph{congruence subgroup} if it contains $\ker \pi_I$. Thus congruence subgroups are of finite index. Generalizing the definition
in \ref{sec:EichlerShimura} above, we define the \emph{principal congruence subgroup} $\Gamma_1(I)=\ker \pi_I$, and the congruence subgroup $\Gamma_0(I)$ consisting of preimages of the upper triangular matrices in $SL_2({\cal O}/I)$. 

 The following commands construct $\Gamma=\Gamma_0(I)$ for the ideal $I\triangleleft {\cal O}\mathbb Q(\sqrt{-5})$ generated by $12$ and $36\sqrt{-5}$. The group $\Gamma$ has index $385$ in $SL_2({\cal O}\mathbb Q(\sqrt{-5}))$. The final command displays a tree in a Cayley graph for $SL_2({\cal O}\mathbb Q(\sqrt{-5}))$ whose nodes represent a transversal for $\Gamma$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuadraticNumberField(-5);;|
  !gapprompt@gap>| !gapinput@OQ:=RingOfIntegers(Q);;|
  !gapprompt@gap>| !gapinput@I:=QuadraticIdeal(OQ,[36*Sqrt(-5), 12]);;|
  !gapprompt@gap>| !gapinput@G:=HAP_CongruenceSubgroupGamma0(I);|
  CongruenceSubgroupGamma0(ideal of norm 144 in O(Q(Sqrt(-5)))) 
  
  !gapprompt@gap>| !gapinput@IndexInSL2O(G);|
  385
   
  !gapprompt@gap>| !gapinput@HAP_SL2TreeDisplay(G);|
  
\end{Verbatim}
  

The next commands first construct the congruence subgroup $\Gamma_0(I)$ of index $144$ in $SL_2({\cal O}\mathbb Q(\sqrt{-2}))$ for the ideal $I$ in ${\cal O}\mathbb Q(\sqrt{-2})$ generated by $4+5\sqrt{-2}$. The commands then compute 
\[H_1(\Gamma_0(I),\mathbb Z) = \mathbb Z_3 \oplus \mathbb Z_6 \oplus \mathbb
Z_{30} \oplus \mathbb Z^8\, ,\]
 
\[H_2(\Gamma_0(I), \mathbb Z) = (\mathbb Z_2)^9 \oplus \mathbb Z^7\, ,\]
 
\[H_3(\Gamma_0(I), \mathbb Z) = (\mathbb Z_2)^9 \, .\]
 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuadraticNumberField(-2);;|
  !gapprompt@gap>| !gapinput@OQ:=RingOfIntegers(Q);;|
  !gapprompt@gap>| !gapinput@I:=QuadraticIdeal(OQ,4+5*Sqrt(-2));;|
  !gapprompt@gap>| !gapinput@G:=HAP_CongruenceSubgroupGamma0(I);|
  CongruenceSubgroupGamma0(ideal of norm 66 in O(Q(Sqrt(-2)))) 
  
  !gapprompt@gap>| !gapinput@IndexInSL2O(G);|
  144
  
  !gapprompt@gap>| !gapinput@R:=ResolutionSL2QuadraticIntegers(-2,4,true);;|
  !gapprompt@gap>| !gapinput@S:=ResolutionFiniteSubgroup(R,G);;|
  
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(S),1);|
  [ 3, 6, 30, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(S),2);|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(S),3);|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{First homology}}\logpage{[ 13, 15, 0 ]}
\hyperdef{L}{X85E912617AFE03F4}{}
{
 The isomorphism $H_1(G,\mathbb Z) \cong G_{ab}$ allows for the computation of first integral homology using computational
methods for finitely presented groups. Such methods underly the following
computation of 
\[H_1( \Gamma_0(I),\mathbb Z) \cong \mathbb Z_2 \oplus \cdots \oplus \mathbb
Z_{4078793513671}\]
 where $I$ is the prime ideal in the Gaussian integers generated by $41+56\sqrt{-1}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuadraticNumberField(-1);;|
  !gapprompt@gap>| !gapinput@OQ:=RingOfIntegers(Q);;|
  !gapprompt@gap>| !gapinput@I:=QuadraticIdeal(OQ,41+56*Sqrt(-1));|
  ideal of norm 4817 in O(GaussianRationals)
  !gapprompt@gap>| !gapinput@G:=HAP_CongruenceSubgroupGamma0(I);;|
  !gapprompt@gap>| !gapinput@AbelianInvariants(G);|
  [ 2, 2, 4, 5, 7, 16, 29, 43, 157, 179, 1877, 7741, 22037, 292306033, 
    4078793513671 ]
  
\end{Verbatim}
 

We write $G^{ab}_{tors}$ to denote the maximal finite summand of the first homology group of $G$ and refer to this as the \emph{torsion subgroup}. Nicholas Bergeron and Akshay Venkatesh \cite{bergeron} have conjectured relationships between the torsion in congruence subgroups $\Gamma$ and the volume of their quotient manifold ${\frak h}^3/\Gamma$. For instance, for the Gaussian integers they conjecture 
\[ \frac{\log |\Gamma_0(I)_{tors}^{ab}|}{{\rm Norm}(I)} \rightarrow
\frac{\lambda}{18\pi},\ \lambda =L(2,\chi_{\mathbb Q(\sqrt{-1})}) = 1
-\frac{1}{9} + \frac{1}{25} - \frac{1}{49} + \cdots\]
 as the norm of the prime ideal $I$ tends to $\infty$. The following approximates $\lambda/18\pi = 0.0161957$ and $\frac{\log |\Gamma_0(I)_{tors}^{ab}|}{{\rm Norm}(I)} = 0.0210325$ for the above example. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuadraticNumberField(-1);;|
  !gapprompt@gap>| !gapinput@Lfunction(Q,2)/(18*3.142);|
  0.0161957
  
  Loge10:=0.434294481903;; #Log_10(e)
  !gapprompt@gap>| !gapinput@1.0*Log(Product(AbelianInvariants(G)),10)/(Loge*Norm(I));|
  0.0210325
  
\end{Verbatim}
 

 The link with volume is given by the Humbert volume formula 
\[ {\rm Vol} ( {\frak h}^3 / PSL_2( {\cal O}_{d} ) ) = \frac{|D|^{3/2}}{24}
\zeta_{ \mathbb Q( \sqrt{d} ) }(2)/\zeta_{\mathbb Q}(2) \]
 valid for square\texttt{\symbol{45}}free $d<0$, where $D$ is the discriminant of $\mathbb Q(\sqrt{d})$. The volume of a finite index subgroup $\Gamma$ is obtained by multiplying the right\texttt{\symbol{45}}hand side by the index $|PSL_2({\cal O}_d)\,:\, \Gamma|$. 

 The following commands produce a graph of $ \frac{\log |\Gamma_0(I)_{tors}^{ab}|}{{\rm Norm}(I)}$ against ${\rm Norm}(I)$ for prime ideals $I$ of norm $49 \le {\rm Norm}(I) \le 4357$ (where one ideal for each norm is taken). 
\begin{Verbatim}[commandchars=@|D,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>D @gapinput|Q:=QuadraticNumberField(-1);;D
  @gapprompt|gap>D @gapinput|OQ:=RingOfIntegers(Q);;D
  @gapprompt|gap>D @gapinput|N:=QuadraticIntegersByNorm(OQ,20000);;D
  
  @gapprompt|gap>D @gapinput|#########################################D
  @gapprompt|gap>D @gapinput|fn:=function(x);D
  @gapprompt|gap>D @gapinput|if IsRat(x) then return x; fi;D
  @gapprompt|gap>D @gapinput|return x!.rational+x!.irrational*Sqrt(-1);D
  @gapprompt|gap>D @gapinput|end;D
  @gapprompt|gap>D @gapinput|#########################################D
  
  @gapprompt|gap>D @gapinput|NN:=List(N,fn);D
  @gapprompt|gap>D @gapinput|P:=Filtered(NN,x->IsPrime(QuadraticIdeal(OQ,x)));D
  @gapprompt|gap>D @gapinput|PP:=Classify(P,x->Norm(Q,x));D
  @gapprompt|gap>D @gapinput|PP:=List(PP,x->x[1]);;D
  @gapprompt|gap>D @gapinput|PP:=Filtered(PP,x->not x=0);D
  
  @gapprompt|gap>D @gapinput|Loge:=0.434294481903;; ###Log_10(e)D
  @gapprompt|gap>D @gapinput|#########################################D
  @gapprompt|gap>D @gapinput|ffn:=function(x)D
  @gapprompt|gap>D @gapinput|local I, G, A, S, F;D
  @gapprompt|gap>D @gapinput|I:=QuadraticIdeal(OQ,x);D
  @gapprompt|gap>D @gapinput|G:=HAP_CongruenceSubgroupGamma0(I);;D
  @gapprompt|gap>D @gapinput|A:=AbelianInvariants(G);D
  @gapprompt|gap>D @gapinput|A:=Filtered(A,x->not x=0);D
  @gapprompt|gap>D @gapinput|return [Norm(Q,x),1.0*Log(Product(Filtered(AbelianInvariants(G),i->not i=0)),10)/(Loge*Norm(I))];D
  @gapprompt|gap>D @gapinput|end;D
  @gapprompt|gap>D @gapinput|#########################################D
  
  @gapprompt|gap>D @gapinput|S:=List(PP{[9..267]},ffn);D
  @gapprompt|gap>D @gapinput|ScatterPlot(S);D
  
\end{Verbatim}
  }

 }

 
\chapter{\textcolor{Chapter }{Fundamental domains for Bianchi groups}}\logpage{[ 14, 0, 0 ]}
\hyperdef{L}{X805848868005D528}{}
{
 
\section{\textcolor{Chapter }{Bianchi groups}}\logpage{[ 14, 1, 0 ]}
\hyperdef{L}{X858B1B5D8506FE81}{}
{
 The \emph{Bianchi groups} are the groups $G_{-d}=PSL_2({\cal O}_{-d})$ where $d$ is a square free positive integer and ${\cal O}_{-d}$ is the ring of integers of the imaginary quadratic field $\mathbb Q(\sqrt{-d})$. These groups act on \emph{upper\texttt{\symbol{45}}half space} 
\[{\frak h}^3 =\{(z,t) \in \mathbb C\times \mathbb R\ |\ t > 0\} \]
 by the formula 
\[\left(\begin{array}{ll}a&b\\ c &d \end{array}\right)\cdot (z+tj) \ = \
\left(a(z+tj)+b\right)\left(c(z+tj)+d\right)^{-1}\ \]
 where we use the symbol $j$ satisfying $j^2=-1$, $ij=-ji$ and write $z+tj$ instead of $(z,t)$. Alternatively, the action is given by 
\[\left(\begin{array}{ll}a&b\\ c &d \end{array}\right)\cdot (z+tj) \ = \
\frac{(az+b)\overline{(cz+d) } + a\overline c t^2}{|cz +d|^2 + |c|^2t^2} \ +\
\frac{t}{|cz+d|^2+|c|^2t^2}\, j \ .\]
 

We take the boundary $\partial {\frak h}^3$ to be the Riemann sphere $\mathbb C \cup \infty$ and let $\overline{\frak h}^3$ denote the union of ${\frak h}^3$ and its boundary. The action of $G_{-d}$ extends to the boundary. The element $\infty$ and each element of the number field $\mathbb Q(\sqrt{-d})$ are thought of as lying in the boundary $\partial {\frak h}^3$ and are referred to as \emph{cusps}. Let $X$ denote the union of ${\frak h}^3$ with the set of cusps, $X={\frak h}^3 \cup \{\infty\} \cup \mathbb Q(\sqrt{-d})$. It follows from work of Bianchi and Humbert that the space $X$ admits the structure of a regular CW\texttt{\symbol{45}}complex (depending on $d$) for which the action of $G_{-d}$ on ${\frak h}^3$ extends to a cellular action on $X$ which permutes cells. Moreover, $G_{-d}$ acts transitively on the $3$\texttt{\symbol{45}}cells of $X$ and each $3$\texttt{\symbol{45}}cell has trivial stabilizer in $G_{-d}$. Details are provided in Richard Swan's paper \cite{swanB}. 

 We refer to the closure in $X$ of any one of these $3$\texttt{\symbol{45}}cells as a \emph{fundamental domain} for the action $G_{-d}$. Cohomology of $G_{-d}$ can be computed from a knowledge of the combinatorial structure of this
fundamental domain together with a knowledge of the stabilizer groups of the
cells of dimension $\le 2$. }

 
\section{\textcolor{Chapter }{Swan's description of a fundamental domain}}\logpage{[ 14, 2, 0 ]}
\hyperdef{L}{X872D22507F797001}{}
{
 A pair $(a,b)$ of elements in ${\cal O}_{-d}$ is said to be \emph{unimodular} if the ideal generated by $a,b$ is the whole ring ${\cal O}_{-d}$ and $a\ne 0$. A unimodular pair can be represented by a hemisphere in $\overline{\frak h}^3$ with base centred at the point $b/a \in \mathbb C$ and of radius $|1/a|$. The radius is $\le 1$. Think of the points in ${\frak h}^3$ as lying strictly above $\mathbb C$. Let $B$ denote the space obtained by removing all such hemispheres from ${\frak h}^3$. 

 When $d \equiv 3 {\rm \ mod\ } 4$ let $F$ be the subspace of $\overline{\frak h}^3$ consisting of the points $x+iy+jt$ with $-1/2 \le x \le 1/2$, $-1/4 \le y \le 1/4$, $t \ge 0$. Otherwise, let $F$ be the subspace of $\overline{\frak h}^3$ consisting of the points $x+iy+jt$ with $-1/2 \le x \le 1/2$, $-1/2 \le y \le 1/2$, $t \ge 0$. 

 It is explained in \cite{swanB} that $F\cap B$ is a $3$\texttt{\symbol{45}}cell in the above mentioned regular
CW\texttt{\symbol{45}}complex structure on $X$. }

 
\section{\textcolor{Chapter }{Computing a fundamental domain}}\logpage{[ 14, 3, 0 ]}
\hyperdef{L}{X7B9DE54F7ECB7E44}{}
{
 Explicit fundamental domains for certain values of $d$ were calculated by Bianchi in the 1890s and further calculations were made by
Swan in 1971 \cite{swanB}. In the 1970s, building on Swan's work, \href{https://www.sciencedirect.com/science/article/pii/S0723086913000042} {Robert Riley} developed a computer program for computing fundamental domains of certain
Kleinian groups (including Bianchi groups). In their 2010 PhD theses \href{https://theses.hal.science/tel-00526976/en/} {Alexander Rahm} and \href{https://wrap.warwick.ac.uk/id/eprint/35128/} {M.T. Aranes} independently developed Pari/GP and Sage software based on Swan's ideas. In
2011 \href{https://mathstats.uncg.edu/sites/yasaki/publications/bianchipolytope.pdf} {Dan Yasaki} used a different approach based on Voronoi's theory of perfect forms in his
Magma software for fundamental domains of Bianchi groups. \href{http://www.normalesup.org/~page/Recherche/Logiciels/logiciels-en.html} {Aurel Page} developed software for fundamental domains of Kleinian groups in his 2010
masters thesis. In 2018 \href{https://github.com/schoennenbeck/VMH-DivisionAlgebras} {Sebastian Schoennenbeck} used a more general approach based on perfect forms in his Magma software for
computing fundamental domains of Bianchi and other groups. Output from the
code of Alexander Rahm and Sebastian Schoennenbeck for certain Bianchi groups
has been stored iin \textsc{HAP} for use in constructing free resolutions. 

More recently a \textsc{GAP} implementation of Swan's algorithm has been included in \textsc{HAP}. The implementation uses exact computations in $\mathbb Q(\sqrt{-d})$ and in $\mathbb Q(\sqrt{d})$. A bespoke implementation of these two fields is part of the implementation
so as to avoid making apparently slower computations with cyclotomic numbers.
The account of Swan's algorithm in the thesis of Alexander Rahm was the main
reference during the implementation. }

 
\section{\textcolor{Chapter }{Examples}}\logpage{[ 14, 4, 0 ]}
\hyperdef{L}{X7A489A5D79DA9E5C}{}
{
 The fundamental domain $D=\overline{F \cap B}$ (where the overline denotes closure) has boundary $\partial D$ involving the four vertical quadrilateral $2$\texttt{\symbol{45}}cells contained in the four vertical quadrilateral $2$\texttt{\symbol{45}}cells of $\partial F$. We refer to these as the \emph{vertical $2$\texttt{\symbol{45}}cells} of $D$. When visualizing $D$ we ignore the $3$\texttt{\symbol{45}}cell and the four vertical $2$\texttt{\symbol{45}}cells entirely and visualize only the remaining $2$\texttt{\symbol{45}}cells. These $2$\texttt{\symbol{45}}cells can be viewed as a $2$\texttt{\symbol{45}}dimensional image by projecting them onto the complex
plane, or they can be viewed as an interactive $3$\texttt{\symbol{45}}dimensional image. 

A fundamental domain for $G_{-39}$ can be visualized using the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=BianchiPolyhedron(-39);|
  3-dimensional Bianchi polyhedron over OQ( Sqrt(-39) ) 
  involving hemispheres of minimum squared radius 1/39 
  and non-cuspidal vertices of minimum squared height 1/49 . 
  
  !gapprompt@gap>| !gapinput@Display3D(D);;|
  !gapprompt@gap>| !gapinput@Display2D(D);;|
  
\end{Verbatim}
   

 A \emph{cusp vertex} of $D$ is any vertex of $D$ lying in $\mathbb C \cup \infty$. In the above visualizations for $G_{-39}$ several cusp vertices in $\mathbb C$ are : in the 2\texttt{\symbol{45}}dimensional visualization they are
represented by red dots. Computer calculations show that these cusps lie in
precisely three orbits under the action of $G_{-d}$. Thus, together with the orbit of $\infty$ there are four distinct orbits of cusps. By the well\texttt{\symbol{45}}known
correspondence between cusp orbits and elements of the class group it follows
that the class group of $\mathbb Q(\sqrt{-39})$ is of order $4$. 

The following additional commands comvert the Bianchi polyhedron $D$ to a regular CW\texttt{\symbol{45}}complex and then display its $1$\texttt{\symbol{45}}skeleton. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=BianchiPolyhedron(-39);;|
  !gapprompt@gap>| !gapinput@Y:=RegularCWComplex(D);|
  Regular CW-complex of dimension 2
  
  !gapprompt@gap>| !gapinput@Display(GraphOfRegularCWComplex(Y));|
  
\end{Verbatim}
  

A fundamental domain for $G_{-22}$ can be visualized using the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=BianchiPolyhedron(-22);;|
  !gapprompt@gap>| !gapinput@Display3D(OQ,D);;|
  !gapprompt@gap>| !gapinput@Display2D(OQ,D);;|
  
\end{Verbatim}
   

Two cusps are visible in the visualizations for $G_{-22}$. They lie in a single orbit. Thus, together with the orbit of $\infty$, there are two orbits of cusps for this group. 

A fundamental domain for $G_{-163}$ can be visualized using the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=BianchiPolyhedron(-163);;|
  !gapprompt@gap>| !gapinput@Display3D(OQ,D);;|
  !gapprompt@gap>| !gapinput@Display2D(OQ,D);;|
  
\end{Verbatim}
   

There is just a single orbit of cusps in this example, the orbit containing $\infty$, since $\mathbb Q(\sqrt{-163})$ is a principal ideal domain and hence has trivial class group. 

A fundamental domain for $G_{-33}$ is visualized using the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=BianchiPolyhedron(-33);;|
  !gapprompt@gap>| !gapinput@Display3D(OQ,D);;|
  !gapprompt@gap>| !gapinput@Display2D(OQ,D);;|
  
\end{Verbatim}
   }

 
\section{\textcolor{Chapter }{Establishing correctness of a fundamental domain}}\logpage{[ 14, 5, 0 ]}
\hyperdef{L}{X86CD59CB7A04EE5A}{}
{
 The cusps of a fundamental domain can be calculated independently of the
domain computation. The remaining vertices of the domain will have positive
heights. To prove that the computation is correct we need to establish that no
non\texttt{\symbol{45}}cuspidal vertex lies below any hemishpere centered on
the complex plane at $b/a\in \mathbb C$ with $(a,b)$ a unimodular pair. As these hemispheres have increasingly smaller radius we
only need to check those finitely many hemispheres with radius smaller than
the height of the lowest non\texttt{\symbol{45}}cuspidal vertex. 

For a few values of $d$ the smallest radius $r$ of a hemisphere contributing to the fundamental domain boundary has been
stored. For cases where this smallest radius is not stored a very slow method
for finding $r$ is implemented and the user is advised to speed things up by guessiing a value $N=1/r^2$ and then test that this value of $N$ is indeed large enough. The following commands illustrate this for $d=-46$ with a guess of $N=600$. Once the test is done we can see that in fact a smaller guess of $N=441$ would have sufficed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=BianchiPolyhedron(-46);|
  Try 
    P:=BianchiPolyhedron(OQ,N);
  for some guessed positive integer value of N and then try
    SwanBianchiCriterion(P);
  to test if the value of N was large enough. If the test returns false then you\
  'll need to try a larger value of N.
  
  A successful value of N can be stored as a pair [d,N] in the list HAPRECORD wh\
  ich can be edited manually in the file hap/lib/Congruence/bianchi.gi .
  
  
  !gapprompt@gap>| !gapinput@P:=BianchiPolyhedron(-46,600);|
  3-dimensional Bianchi polyhedron over OQ( Sqrt(
  -46) ) involving hemispheres of minimum squared radius 1/
  441 and non-cuspidal vertices of minimum squared height 1/8280 . 
  
  !gapprompt@gap>| !gapinput@SwanBianchiCriterion(P);|
  true
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Computing a free resolution for $SL_2({\mathcal O}_{-d})$}}\logpage{[ 14, 6, 0 ]}
\hyperdef{L}{X78476F127B73BBD1}{}
{
 The above fundamental domains can be used to construct free resolutions for $SL_2({\mathcal O}_{-d})$ and $PSL_2({\mathcal O}_{-d})$. The following commands illustrate the computation of free resolutions for $SL_2({\mathcal O}_{-43})$ and $SL_2({\mathcal O}_{-10})$ and $SL_2({\mathcal O}_{-14})$ and their integral homology (which in each case is periodic of period dividing $4$ in degrees $\ge 3$). The computation of fundamental domains uses exact arithmetic in the two
field extensions $\mathbb Q(\sqrt{d})$ and $ \mathbb Q(\sqrt{-d})$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=BianchiGcomplex(-43);;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(K,11);;|
  !gapprompt@gap>| !gapinput@C:=TensorWithIntegers(R);;|
  !gapprompt@gap>| !gapinput@List([0..10],n->Homology(C,n));|
  [ [ 0 ], [ 0, 0 ], [ 2, 2, 12, 0 ], [ 2, 2, 24 ], [ 2, 2 ], [ 2 ], 
    [ 2, 2, 12 ], [ 2, 2, 24 ], [ 2, 2 ], [ 2 ], [ 2, 2, 12 ] ]
  
  !gapprompt@gap>| !gapinput@K:=BianchiGcomplex(-10);;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(K,11);;|
  !gapprompt@gap>| !gapinput@List([0..10],k->Homology(TensorWithIntegers(R),k));|
  [ [ 0 ], [ 2, 2, 0, 0, 0 ], [ 2, 2, 2, 12, 0, 0 ], [ 2, 2, 2, 24 ], 
    [ 2, 4, 12 ], [ 2, 2, 2, 6 ], [ 2, 2, 2, 12 ], [ 2, 2, 2, 24 ], 
    [ 2, 4, 12 ], [ 2, 2, 2, 6 ], [ 2, 2, 2, 12 ] ]
  
  !gapprompt@gap>| !gapinput@K:=BianchiGcomplex(-14);;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(K,11);;|
  !gapprompt@gap>| !gapinput@List([0..10],k->Homology(TensorWithIntegers(R),k));|
  [ [ 0 ], [ 6, 0, 0, 0, 0, 0 ], [ 2, 2, 2, 4, 12, 0, 0, 0, 0 ], 
    [ 2, 2, 2, 2, 24 ], [ 2, 2, 2, 4, 12 ], [ 2, 2, 2, 2, 24 ], 
    [ 2, 2, 2, 4, 12 ], [ 2, 2, 2, 2, 24 ], [ 2, 2, 2, 4, 12 ], 
    [ 2, 2, 2, 2, 24 ], [ 2, 2, 2, 4, 12 ] ]
  
\end{Verbatim}
 The following commands count the number of orbits of cusps (in addition to the
orbit of $\infty$). They determine that there is precisely one element in the ideal class group
of ${\mathcal O}_{-43}$ (i.e it is a principal ideal domain) and that there are precisely two elements
in the ideal class group of ${\mathcal O}_{-10}$ and precisely four elements in the ideal class group of ${\mathcal O}_{-14}$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=BianchiGcomplex(-43);;A
  @gapprompt|gap>A @gapinput|List([1..K!.dimension(0)],k->Order(K!.stabilizer(0,k)));A
  [ 24, 24, 6, 6, 4, 4, 12, 12 ]
  
  @gapprompt|gap>A @gapinput|K:=BianchiGcomplex(-10);;A
  @gapprompt|gap>A @gapinput|List([1..K!.dimension(0)],k->Order(K!.stabilizer(0,k)));A
  [ 6, 6, 4, 4, 6, infinity ]
  
  @gapprompt|gap>A @gapinput|K:=BianchiGcomplex(-14);;A
  @gapprompt|gap>A @gapinput|List([1..K!.dimension(0)],k->Order(K!.stabilizer(0,k)));A
  [ 6, 6, 2, 2, 2, infinity, infinity, 2, infinity, 6, 4 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Some sanity checks}}\logpage{[ 14, 7, 0 ]}
\hyperdef{L}{X784B2156823AEB15}{}
{
 There is ample scope for bugs in the implementation of the above method for
computing resolutions of Bianchi groups. The following sanity checks lend
confidence to the implementation. 
\subsection{\textcolor{Chapter }{Equivariant Euler characteristic}}\logpage{[ 14, 7, 1 ]}
\hyperdef{L}{X7E5A36D47F9D4A47}{}
{
 Let $X$ be any cell complex with an action of a group $G$ such that (i) $X$ has finitely many $G$\texttt{\symbol{45}}orbits of cells, and (ii) the stabilizer subgroup in $G$ for each cell is either finite or free abelian. One defines the \emph{equivariant Euler characteristic} \$\$\texttt{\symbol{92}}chi{\textunderscore}G(X) =
\texttt{\symbol{92}}sum{\textunderscore}e
(\texttt{\symbol{45}}1)\texttt{\symbol{94}}\texttt{\symbol{123}}dim\texttt{\symbol{126}}
e\texttt{\symbol{125}} / |Stab{\textunderscore}G(e)|\$\$ where $e$ ranges over a set of representatives of the orbits of those cells with finite
stabilizers. If $G$ has a finite index torsion free subgroup and if the complex $X$ is contractible then one can define the Euler characteristic of the group to
be $\chi(G) = \chi_G(X)$. It is known that $\chi (SL_n({\mathcal O})) = \chi(GL_n({\mathcal O})) =0$ for $\mathcal O$ the ring of integers of a number field \cite{Gangl}. 

One easy test to make in our computations is to check that the equivariant
Euler characteristic of the $2$\texttt{\symbol{45}}complex is indeed zero. The following commands perform
this test for the group $SL_2({\mathcal O}_{-23})$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=BianchiGcomplex(-23);;A
  
  @gapprompt|gap>A @gapinput|chi:=0;;A
  @gapprompt|gap>A @gapinput|for n in [0..2] doA
  @gapprompt|>A @gapinput|for k in [1..K!.dimension(n)] doA
  @gapprompt|>A @gapinput|g:=Order(K!.stabilizer(n,k));A
  @gapprompt|>A @gapinput|if g < infinity then chi:=chi + (-1)^n/g; fi;A
  @gapprompt|>A @gapinput|od;od;A
  @gapprompt|gap>A @gapinput|chi;A
  0
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Boundary squares to zero}}\logpage{[ 14, 7, 2 ]}
\hyperdef{L}{X852CDAFF84C5DF01}{}
{
 The signs in the boundary maps of the free resolution are delicate. Another
easy test is to check that the boundary in the resolution squares to zero. The
following commands perform this check for the group $SL_2({\mathcal O}_{-23})$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=BianchiGcomplex(-23);;A
  @gapprompt|gap>A @gapinput|R:=FreeGResolution(K,10);;A
  @gapprompt|gap>A @gapinput|n:=2;;List([1..R!.dimension(n)],k->ResolutionBoundaryOfWord(R,n-1,R!.boundary(n,k)));A
  [ [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], 
    [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], 
    [  ], [  ], [  ] ]
  @gapprompt|gap>A @gapinput|n:=3;;List([1..R!.dimension(n)],k->ResolutionBoundaryOfWord(R,n-1,R!.boundary(n,k)));A
  [ [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], 
    [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], 
    [  ], [  ], [  ] ]
  @gapprompt|gap>A @gapinput|n:=4;;List([1..R!.dimension(n)],k->ResolutionBoundaryOfWord(R,n-1,R!.boundary(n,k)));A
  [ [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], 
    [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], 
    [  ], [  ], [  ] ]
  @gapprompt|gap>A @gapinput|n:=5;;List([1..R!.dimension(n)],k->ResolutionBoundaryOfWord(R,n-1,R!.boundary(n,k)));A
  [ [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], 
    [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], 
    [  ], [  ], [  ] ]
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Compare different algorithms or implementations}}\logpage{[ 14, 7, 3 ]}
\hyperdef{L}{X7E64819A7C058EDD}{}
{
 Sebastian Schoennenbeck in his thesis work computed some contractible $2$\texttt{\symbol{45}}complexes on which Bianchi groups act with finite
stabilizers (even when the ideal class is greater than $1$) using a different approach to that of Swan. These computed complexes are
stored in \textsc{HAP} and provide an alternative way of computing cohomology for the stored groups.
Alexander Rahm in his thesis work implemented Swan's approach and has provided
some $2$\texttt{\symbol{45}}complexes that are also stored in \textsc{HAP} in cases where the ideal class is equal to $1$. 

The following commands test that Sebastian Schoennenbeck's $2$\texttt{\symbol{45}}complex for $SL_2({\mathcal O}_{-23})$ yields the same integral homology as the above \textsc{HAP} implementation. Both computations use \textsc{HAP}'s implementation of Wall's perturbation technique for computing the
resolution from the $2$\texttt{\symbol{45}}complex. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=ContractibleGcomplex("SL(2,O-23)");;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(K,10);;|
  !gapprompt@gap>| !gapinput@List([0..9],n->Homology(TensorWithIntegers(R),n));|
  [ [ 0 ], [ 12, 0, 0, 0 ], [ 2, 2, 12, 0, 0 ], [ 2, 2, 12 ], [ 2, 2, 12 ], 
    [ 2, 2, 12 ], [ 2, 2, 12 ], [ 2, 2, 12 ], [ 2, 2, 12 ], [ 2, 2, 12 ] ]
  
  !gapprompt@gap>| !gapinput@K:=BianchiGcomplex(-23);;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(K,10);;|
  !gapprompt@gap>| !gapinput@List([0..9],n->Homology(TensorWithIntegers(R),n));|
  [ [ 0 ], [ 12, 0, 0, 0 ], [ 2, 2, 12, 0, 0 ], [ 2, 2, 12 ], [ 2, 2, 12 ], 
    [ 2, 2, 12 ], [ 2, 2, 12 ], [ 2, 2, 12 ], [ 2, 2, 12 ], [ 2, 2, 12 ] ]
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Compare geometry to algebra}}\logpage{[ 14, 7, 4 ]}
\hyperdef{L}{X8223864085412705}{}
{
 The number of cusps (i.e. the number of orbits of vertices with infinite
stabilizer subgroup) must be precisely one less than the number of elements in
the ideal class group of ${\mathcal O}_{-d}$. The following commands check this for $SL_2({\mathcal O}_{-23})$ where ${\mathcal O}_{-23}$ is known to have class number 3. (This class number is easily computed from a
formula in Swan's paper.) 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=BianchiGcomplex(-23);;A
  @gapprompt|gap>A @gapinput|List([1..K!.dimension(0)],k->Order(K!.stabilizer(0,k)));A
  [ 6, 2, 2, 4, infinity, infinity ]
  
\end{Verbatim}
 A visualization of the fundamental domain tells us a certain amount about the
algebra. In the case of $SL_2({\mathcal O}_{-23})$ 

  

 a fundamental domain for the action on $\mathbb C$ by the translation subgroup generated by the matrices \$\$
\texttt{\symbol{92}}left(\texttt{\symbol{92}}begin\texttt{\symbol{123}}array\texttt{\symbol{125}}\texttt{\symbol{123}}ll\texttt{\symbol{125}}
1 \&1\texttt{\symbol{92}}\texttt{\symbol{92}} 0
\&1\texttt{\symbol{92}}end\texttt{\symbol{123}}array\texttt{\symbol{125}}\texttt{\symbol{92}}right),
\texttt{\symbol{92}}left(\texttt{\symbol{92}}begin\texttt{\symbol{123}}array\texttt{\symbol{125}}\texttt{\symbol{123}}ll\texttt{\symbol{125}}
1 \&\texttt{\symbol{92}}omega\texttt{\symbol{92}}\texttt{\symbol{92}} 0
\&1\texttt{\symbol{92}}end\texttt{\symbol{123}}array\texttt{\symbol{125}}\texttt{\symbol{92}}right)
\$\$ $\omega = (1+\sqrt{-23})/2$ is indicated by the white rectangle. From this we see that under the action of $SL_2({\mathcal O}_{-23})$ there are at most $11$ orbits of $2$\texttt{\symbol{45}}cells, the central decagon and ten quadrilaterals.
However, the matrix \$\$
\texttt{\symbol{92}}left(\texttt{\symbol{92}}begin\texttt{\symbol{123}}array\texttt{\symbol{125}}\texttt{\symbol{123}}rr\texttt{\symbol{125}}
0 \&\texttt{\symbol{45}}1\texttt{\symbol{92}}\texttt{\symbol{92}} 1
\&0\texttt{\symbol{92}}end\texttt{\symbol{123}}array\texttt{\symbol{125}}\texttt{\symbol{92}}right)
\$\$ maps $(z,0)$ to $(-1/z,0)$ and fixes $(0,1)$. This isometry identifies points on the boundary of the decagon pairwise.
These observations are consistent with the above listing of the six orbit
stabilizers and the following algebraic information on the boundaries of the $2$\texttt{\symbol{45}}cells in the Bianchi $2$\texttt{\symbol{45}}complex. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=BianchiGcomplex(-23);;A
  @gapprompt|gap>A @gapinput|List([1..K!.dimension(2)],k->Length(K!.boundary(2,k)));A
  [ 10, 4, 4, 4, 4, 4 ]
  
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Group presentations}}\logpage{[ 14, 8, 0 ]}
\hyperdef{L}{X78BC9D077956089A}{}
{
 Swan's reason for studying fundamental domains was to obtain explicit group
presentations for $SL_2({\mathcal O}_{-d})$ for various values of $d$. The following commands obtain a presentation for $SL_2({\mathcal O}_{-23})$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=BianchiGcomplex(-23);;A
  @gapprompt|gap>A @gapinput|R:=FreeGResolution(K,2);;A
  @gapprompt|gap>A @gapinput|P:=PresentationOfResolution(R);A
  @gapprompt|gap>A @gapinput|G:=SimplifiedFpGroup(P!.freeGroup/P!.relators);A
  <fp group on the generators [ k, r, s, w, x ]>
  @gapprompt|gap>A @gapinput|RelatorsOfFpGroup(G);A
  [ w^-1*k*w*k^-1, s^-1*r*s*r^-1, k^6, x^-1*k^-3*x*k^-3, s^-1*k^-3*s*k^-3, 
    r^-1*w*x^-1*s*r*w^-1*x*s^-1, r^-1*k^-3*r*k^-3, 
    x*k^-2*r^-1*x*r^-1*s^-1*k^-1*s^-1, x^-1*k^3*s*r*x^-1*s*r ]
  
  @gapprompt|gap>A @gapinput|#Next we identify the generators as matricesA
  @gapprompt|gap>A @gapinput|GeneratorsOfGroup(P!.freeGroup);A
  [ k, m, n, p, q, r, s, t, u, v, w, x, y, z ]
  @gapprompt|gap>A @gapinput|P!.gens;A
  [ 19, 6, 6, 20, 6, 21, 22, 6, 52, 53, 2, 50, 1, 4 ]
  
  @gapprompt|gap>A @gapinput|k:=R!.elts[19];A
  [ [ 1, 1 ], 
    [ -1, 0 ] ]
  @gapprompt|gap>A @gapinput|r:=R!.elts[21];A
  [ [ 3, 3 + -1 Sqrt(-23) ], 
    [ -3/2 + -1/2 Sqrt(-23), -5 ] ]
  @gapprompt|gap>A @gapinput|s:=R!.elts[22];A
  [ [ 2 + 1 Sqrt(-23), 13/2 + 1/2 Sqrt(-23) ], 
    [ 5/2 + -1/2 Sqrt(-23), -1 Sqrt(-23) ] ]
  @gapprompt|gap>A @gapinput|w:=R!.elts[2];A
  [ [ 3/2 + 1/2 Sqrt(-23), -3/2 + 1/2 Sqrt(-23) ], 
    [ 3/2 + -1/2 Sqrt(-23), 3 ] ]
  @gapprompt|gap>A @gapinput|x:=R!.elts[50];A
  [ [ 11/2 + 1/2 Sqrt(-23), 15/2 + -1/2 Sqrt(-23) ], 
    [ -1 Sqrt(-23), -4 + -1 Sqrt(-23) ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Finite index subgroups}}\logpage{[ 14, 9, 0 ]}
\hyperdef{L}{X786CFAA17C0A6E7A}{}
{
 The following commands compute the integral homology of a congruence subgroup $G$ of index 24 in $SL_2({\mathcal O}_{-23})$. They also compute a presentation for $G$ with 13 generators and 24 relators. 
\begin{Verbatim}[commandchars=@|D,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>D @gapinput|OQ:=RingOfIntegers(QuadraticNumberField(-23));;D
  @gapprompt|gap>D @gapinput|I:=QuadraticIdeal(OQ,[Sqrt(-23)]);D
  ideal of norm 23 in O(Q(Sqrt(-23)))
  @gapprompt|gap>D @gapinput|G:=HAP_CongruenceSubgroupGamma0(I);D
  <group of 2x2 matrices in characteristic 0>
  @gapprompt|gap>D @gapinput|IndexInSL2O(G);D
  24
  
  @gapprompt|gap>D @gapinput|K:=BianchiGcomplex(-23);;D
  @gapprompt|gap>D @gapinput|R:=FreeGResolution(K,11);;D
  @gapprompt|gap>D @gapinput|R:=QuadraticToCyclotomicCoefficients(R);;D
  @gapprompt|gap>D @gapinput|S:=ResolutionFiniteSubgroup(R,G);;D
  @gapprompt|gap>D @gapinput|List([0..10],n->Homology(TensorWithIntegers(S),n));D
  [ [ 0 ], [ 2, 0, 0, 0, 0, 0, 0, 0, 0 ], 
    [ 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0 ], [ 2, 2, 2, 2, 2, 2, 2, 2 ],
    [ 2, 2, 2, 2, 2, 2, 2, 2 ], [ 2, 2, 2, 2, 2, 2, 2, 2 ], 
    [ 2, 2, 2, 2, 2, 2, 2, 2 ], [ 2, 2, 2, 2, 2, 2, 2, 2 ], 
    [ 2, 2, 2, 2, 2, 2, 2, 2 ], [ 2, 2, 2, 2, 2, 2, 2, 2 ], 
    [ 2, 2, 2, 2, 2, 2, 2, 2 ] ]
  
  @gapprompt|gap>D @gapinput|P:=PresentationOfResolution(S);;D
  @gapprompt|gap>D @gapinput|H:=SimplifiedFpGroup(P!.freeGroup/P!.relators);D
  <fp group on the generators [ f8, f10, f15, f70, f86, f125, f132, f138, f182, 
    f187, f191, f273, f279 ]>
  @gapprompt|gap>D @gapinput|Length(RelatorsOfFpGroup(H));D
  24
  
\end{Verbatim}
 }

 }

 
\chapter{\textcolor{Chapter }{Parallel computation}}\logpage{[ 15, 0, 0 ]}
\hyperdef{L}{X7F571E8F7BBC7514}{}
{
 
\section{\textcolor{Chapter }{An embarassingly parallel computation}}\logpage{[ 15, 1, 0 ]}
\hyperdef{L}{X7EAE286B837D27BA}{}
{
 

The following example creates fifteen child processes and uses them
simultaneously to compute the second integral homology of each of the $2328$ groups of order $128$. The final command shows that 

$H_2(G,\mathbb Z)=\mathbb Z_2^{21}$ 

for the $2328$\texttt{\symbol{45}}th group $G$ in \textsc{GAP}'s library of small groups. The penulimate command shows that the parallel
computation achieves a speedup of 10.4 . 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Processes:=List([1..15],i->ChildProcess());;|
  !gapprompt@gap>| !gapinput@fn:=function(i);return GroupHomology(SmallGroup(128,i),2);end;;|
  !gapprompt@gap>| !gapinput@for p in Processes do|
  !gapprompt@>| !gapinput@ChildPut(fn,"fn",p);|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@Exec("date +%s");L:=ParallelList([1..2328],"fn",Processes);;Exec("date +%s");|
  1716105545
  1716105554
  !gapprompt@gap>| !gapinput@Exec("date +%s");L1:=List([1..2328],fn);;Exec("date +%s");|
  1716105586
  1716105680
  
  !gapprompt@gap>| !gapinput@speedup:=1.0*(680-586)/(554-545);|
  10.4444
  
  !gapprompt@gap>| !gapinput@L[2328];|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 

The function \texttt{ParallelList()} is built from \textsc{HAP}'s six core functions for parallel computation. }

 
\section{\textcolor{Chapter }{A non\texttt{\symbol{45}}embarassingly parallel computation}}\logpage{[ 15, 2, 0 ]}
\hyperdef{L}{X80F359DD7C54D405}{}
{
 

The following commands use core functions to compute the product $A=M\times N$ of two random matrices by distributing the work over two processors. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=RandomMat(10000,10000);;|
  !gapprompt@gap>| !gapinput@N:=RandomMat(10000,10000);;|
  !gapprompt@gap>| !gapinput@|
  !gapprompt@gap>| !gapinput@s:=ChildProcess();;|
  !gapprompt@gap>| !gapinput@|
  !gapprompt@gap>| !gapinput@Exec("date +%s");|
  1716109418
  !gapprompt@gap>| !gapinput@Mtop:=M{[1..5000]};;|
  !gapprompt@gap>| !gapinput@Mbottom:=M{[5001..10000]};;|
  !gapprompt@gap>| !gapinput@ChildPut(Mtop,"Mtop",s);|
  !gapprompt@gap>| !gapinput@ChildPut(N,"N",s);|
  !gapprompt@gap>| !gapinput@NextAvailableChild([s]);;|
  !gapprompt@gap>| !gapinput@ChildCommand("Atop:=Mtop*N;;",s);;|
  !gapprompt@gap>| !gapinput@Abottom:=Mbottom*N;;|
  !gapprompt@gap>| !gapinput@A:=ChildGet("Atop",s);;|
  !gapprompt@gap>| !gapinput@Append(A,Abottom);;|
  !gapprompt@gap>| !gapinput@Exec("date +%s");|
  1716110143
  
  !gapprompt@gap>| !gapinput@AA:=M*N;;Exec("date +%s");|
  1716111389
  
  !gapprompt@gap>| !gapinput@speedup:=1.0*(111389-110143)/(110143-109418);|
  1.71862
  
\end{Verbatim}
 

The next commands compute the product $A=M\times N$ of two random matrices by distributing the work over fifteen processors. The
parallelization is very naive (the entire matrices $M$ and $N$ are communicated to all processes) and the computation achieves a speedup of
7.6. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=RandomMat(15000,15000);;|
  !gapprompt@gap>| !gapinput@N:=RandomMat(15000,15000);;|
  !gapprompt@gap>| !gapinput@S:=List([1..15],i->ChildCreate());;|
  
  !gapprompt@gap>| !gapinput@Exec("date +%s");|
  1716156583
  !gapprompt@gap>| !gapinput@ChildPutObj(M,"M",S);|
  !gapprompt@gap>| !gapinput@ChildPutObj(N,"N",S);|
  !gapprompt@gap>| !gapinput@for i in [1..15] do|
  !gapprompt@>| !gapinput@cmd:=Concatenation("A:=M{[1..1000]+(",String(i),"-1)*1000}*N;");|
  !gapprompt@>| !gapinput@ChildCommand(cmd,S[i]);|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@A:=[];;|
  !gapprompt@gap>| !gapinput@for i in [1..15] do|
  !gapprompt@>| !gapinput@ C:=ChildGet("A",S[i]);|
  !gapprompt@>| !gapinput@ Append(A,C);|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@Exec("date +%s");|
  1716157489
  
  !gapprompt@gap>| !gapinput@AA:=M*N;;Exec("date +%s");|
  1716164405
  
  !gapprompt@gap>| !gapinput@speedup:=1.0*(64405-57489)/(57489-56583);|
  7.63355
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Parallel persistent homology}}\logpage{[ 15, 3, 0 ]}
\hyperdef{L}{X8496786F7FCEC24A}{}
{
 Section \ref{secAltPersist} illustrates an alternative method of computing the persitent Betti numbers of
a filtered pure cubical complex. The method lends itself to parallelisation.
However, the following parallel computation of persistent Betti numbers
achieves only a speedup of $1.5$ due to a significant time spent transferring data structures between
processes. On the other hand, the persistent Betti function could be used to
distribute computations over several computers. This might be useful for
larger computations that require significant memory resources. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("data247.txt");;|
  !gapprompt@gap>| !gapinput@Read(file);;|
  !gapprompt@gap>| !gapinput@F:=ThickeningFiltration(T,25);;|
  !gapprompt@gap>| !gapinput@S:=List([1..15],i->ChildCreate());;|
  !gapprompt@gap>| !gapinput@N:=[0,1,2];;|
  !gapprompt@gap>| !gapinput@Exec("date +%s");P:=ParallelPersistentBettiNumbers(F,N,S);;Exec("date +%s");|
  1717160785
  1717161285
  
  !gapprompt@gap>| !gapinput@Exec("date +%s");Q:=PersistentBettiNumbersAlt(F,N);;Exec("date +%s");|
  1717161528
  1717162276
  !gapprompt@gap>| !gapinput@speedup:=1.0*(1717162276-1717161528)/(1717161285-1717160785);|
  1.496
  
\end{Verbatim}
 }

 }

 
\chapter{\textcolor{Chapter }{Regular CW\texttt{\symbol{45}}structure on knots (written by Kelvin Killeen)}}\logpage{[ 16, 0, 0 ]}
\hyperdef{L}{X7C57D4AB8232983E}{}
{
 
\section{\textcolor{Chapter }{Knot complements in the 3\texttt{\symbol{45}}ball}}\logpage{[ 16, 1, 0 ]}
\hyperdef{L}{X86F56A85848347FF}{}
{
 While methods for endowing knot complements with
CW\texttt{\symbol{45}}structure already exist in HAP (see section 2.1), they
often result in a large number of cells which can make computing with them
taxing. The following example shows how one can obtain a comparatively small
3\texttt{\symbol{45}}dimensional regular CW\texttt{\symbol{45}}complex
corresponding to the complement of a thickened trefoil knot from an arc
presentation. Recall that an arc presentation is encoded in HAP as a list of
integer pairs corresponding to the position of the endpoints of each
horizontal arc in a grid. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@k_:=PureCubicalKnot(3,1);                  |
  prime knot 1 with 3 crossings
  
  !gapprompt@gap>| !gapinput@arc:=ArcPresentation(k_);                  |
  [ [ 2, 5 ], [ 1, 3 ], [ 2, 4 ], [ 3, 5 ], [ 1, 4 ] ]
  !gapprompt@gap>| !gapinput@k_:=RegularCWComplex(PureComplexComplement(k_));|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@Size(k_);|
  13291
  !gapprompt@gap>| !gapinput@k:=KnotComplement(arc);                                         |
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@Size(k);|
  395
  
\end{Verbatim}
 An optional argument of \texttt{"rand"} in the \texttt{KnotComplement} function randomises the order in which $2$\texttt{\symbol{45}}cells are added to the complex. This allows for alternate
presentations of the knot group. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@arc:=ArcPresentation(PureCubicalKnot(3,1));|
  [ [ 2, 5 ], [ 1, 3 ], [ 2, 4 ], [ 3, 5 ], [ 1, 4 ] ]
  !gapprompt@gap>| !gapinput@k:=KnotComplement(arc,"rand");|
  Random 2-cell selection is enabled.
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@g:=FundamentalGroup(k); RelatorsOfFpGroup(g); |
  #I  there are 2 generators and 1 relator of total length 6
  <fp group of size infinity on the generators [ f1, f2 ]>
  [ f2^-1*f1*f2^-1*f1^-1*f2*f1^-1 ]
  !gapprompt@gap>| !gapinput@k:=KnotComplement(arc,"rand");               |
  Random 2-cell selection is enabled.
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@g:=FundamentalGroup(k); RelatorsOfFpGroup(g);|
  #I  there are 2 generators and 1 relator of total length 7
  <fp group of size infinity on the generators [ f1, f2 ]>
  [ f1*f2^-2*f1*f2*f1^-1*f2 ]
  
\end{Verbatim}
 It is often useful to obtain an inclusion of regular
CW\texttt{\symbol{45}}complexes $\iota : \partial (N(K)) \hookrightarrow B^3 \backslash N(K)$ from the boundary of a tubular neighbourhood of some knot $N(K)$ into its complement in the $3$\texttt{\symbol{45}}ball $B^3 \backslash N(K)$. The below example does this for the first prime knot on 11 crossings. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@arc:=ArcPresentation(PureCubicalKnot(11,1));|
  [ [ 2, 9 ], [ 1, 3 ], [ 2, 6 ], [ 4, 7 ], [ 3, 5 ], [ 6, 10 ], [ 4, 8 ], 
    [ 9, 11 ], [ 7, 10 ], [ 1, 8 ], [ 5, 11 ] ]
  !gapprompt@gap>| !gapinput@k:=KnotComplementWithBoundary(arc);|
  Map of regular CW-complexes
  
  !gapprompt@gap>| !gapinput@Size(Source(i));|
  616
  !gapprompt@gap>| !gapinput@Size(Target(i));|
  1043
  
\end{Verbatim}
 Note that we can add $n$\texttt{\symbol{45}}cells to regular CW\texttt{\symbol{45}}complexes by
specifying the $(n-1)$\texttt{\symbol{45}}cells in their boundaries and $(n+1)$\texttt{\symbol{45}}cells in their coboundaries. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|k:=KnotComplement([[1,2],[1,2]])!.boundaries;;B
  @gapprompt|gap>B @gapinput|Homology(RegularCWComplex(k),0);B
  [ 0 ]
  @gapprompt|gap>B @gapinput|AddCell(k,0,[0],[]);                          B
  @gapprompt|gap>B @gapinput|Homology(RegularCWComplex(k),0);B
  [ 0, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Tubular neighbourhoods}}\logpage{[ 16, 2, 0 ]}
\hyperdef{L}{X83EA2A38801E7A4C}{}
{
 Let $Y$ denote a CW\texttt{\symbol{45}}subcomplex of a regular
CW\texttt{\symbol{45}}complex $X$ and let $N(Y)$ denote an open tubular neighbourhood of $Y$. Given an inclusion of regular CW\texttt{\symbol{45}}complexes $f : Y \hookrightarrow X$, this algorithm describes a procedure for obtaining the associated inclusion $f' : \partial C \hookrightarrow C$ where $C=X \backslash N(Y)$ and $\partial C$ denotes the boundary of $C$. The following is also assumed: 

Let $e^n$ denote a cell of $X \backslash Y$ of dimension $n$ with $\bar{e}^n$ denoting its closure. For each $n$\texttt{\symbol{45}}cell, all of the connected components of the subcomplex $\bar{e}^n \cap Y$ are contractible. 

Some additional terminology and notation is needed to describe this algorithm.
The output regular CW\texttt{\symbol{45}}complex $X \backslash N(Y)$ consists of the cell complex $X \backslash Y$ as well as some additional cells to maintain regularity. A cell of $ X \backslash N(Y)$ is referred to as \emph{internal} if it lies in $X \backslash Y$, it is \emph{external} otherwise. Let $\bar{e}^n$ denote the closure in $X$ of an internal cell $e^n$. Note that $\bar{e}^n$ is a CW\texttt{\symbol{45}}subcomplex of $X$ and so is the intersection $\bar{e}^n \cap Y$ which can be expressed as the union 

$\bar{e}^n \cap Y = A_1 \cup A_2 \cup \cdots \cup A_k$ 

 of its path components $A_i$ all of which are CW\texttt{\symbol{45}}subcomplexes of $Y$. For each $n$\texttt{\symbol{45}}cell of $X \backslash Y$ there is one internal $n$\texttt{\symbol{45}}cell $e^n$ of $X \backslash N(Y)$. For $n \geq 1$ there is also one external $(n-1)$\texttt{\symbol{45}}cell $f^{e^n}_{A_i}$ for each path component $A_i$ of $\bar{e}^n \cap Y$. Lastly, we need a method for determining the homological boundary of the
internal and external cells: 

$\bullet$ The boundary of an internal $n$\texttt{\symbol{45}}cell $e^n$ consists of all those internal $(n-1)$\texttt{\symbol{45}}cells of $\bar{e}^n$ together with all external $(n-1)$\texttt{\symbol{45}}cells $f^{e^n}_{A_i}$ where $A_i$ is a path component of $\bar{e}^n \cap Y$. 

$\bullet$ The boundary of an external $(n-1)$\texttt{\symbol{45}}cell $f^{e^n}_{A_i}$ consists of all those external $(n-2)$\texttt{\symbol{45}}cells $f^{e^{n-1}}_{B_j}$ where $e^{n-1}$ is an $(n-1)$\texttt{\symbol{45}}cell of $\bar{e}^n$ and $B_j \subseteq A_i$ is a path component of $A_i$. 

The following three steps comprise the algorithm. 

$(1)$ For each internal $n$\texttt{\symbol{45}}cell $e^n \subset X \backslash Y$, compute the CW\texttt{\symbol{45}}complex $\bar{e}^n \cap Y$ as a union of path components $A_1 \cup A_2 \cup \cdots \cup A_k$. This information can be used to determine the number of cells of $X \backslash N(Y)$ in each dimension. 

$(2)$ Create a list $B=[ \; [ \; \; ], [ \; \; ], \ldots, [ \; \; ] \; ]$ of length $\textrm{dim}X +1$. 

$(3)$ For $0 \leq n \leq \textrm{dim}X$ set $B[n+1]=[ b_1, b_2, \ldots, b_{\alpha_n} ]$ where $\alpha_n$ is the number of $n$\texttt{\symbol{45}}cells in $X \backslash N(Y)$ and $b_i$ is a list of integers describing the $(n-1)$\texttt{\symbol{45}}cells of the $i ^ \textrm{th}$ $n$\texttt{\symbol{45}}cell of $X \backslash N(Y)$. The internal cells will always be listed before the external cells in each
sublist. Return B as a regular CW\texttt{\symbol{45}}complex. 

 The following example computes the tubular neighbourhood of a $1$\texttt{\symbol{45}}dimensional subcomplex of a $3$\texttt{\symbol{45}}dimensional complex corresponding to the Hopf link
embedded in the closed $3$\texttt{\symbol{45}}ball. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@arc:=[[2,4],[1,3],[2,4],[1,3]];;            |
  !gapprompt@gap>| !gapinput@f:=ArcPresentationToKnottedOneComplex(arc);|
  Map of regular CW-complexes
  
  !gapprompt@gap>| !gapinput@comp:=RegularCWComplexComplement(f);|
  Testing contractibility...
  151 out of 151 cells tested.
  The input is compatible with this algorithm.
  Regular CW-complex of dimension 3
  
  
\end{Verbatim}
 Note that the output of this algorithm is just a regular
CW\texttt{\symbol{45}}complex, not an inclusion map. The function \texttt{BoundaryMap} can be employed to obtain the boundary of a pure complex. This results in
three path components for this example: two corresponding to the boundary of
the knotted tori and the other corresponding to the boundary of the $3$\texttt{\symbol{45}}ball in which the link was embedded. These path components
can be obtained as individual CW\texttt{\symbol{45}}subcomplexes if desired. A
CW\texttt{\symbol{45}}subcomplex is represented in HAP as a list $[X,s]$ where $X$ is a regular CW\texttt{\symbol{45}}complex and $s$ is a list of length $n$ whose $i^\textrm{th}$ entry lists the indexing of each $(i-1)$\texttt{\symbol{45}}cell of the $n$\texttt{\symbol{45}}dimensional subcomplex of $X$. CW\texttt{\symbol{45}}subcomplexes and CW maps can be converted between each
other interchangeably. This next example obtains the inclusion detailed in the
above algorithm, finds the path components of the source of said inclusion,
shows that they are in fact disjoint, and then obtains the first four integral
homology groups of each component. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@f_:=BoundaryMap(comp);|
  Map of regular CW-complexes
  
  !gapprompt@gap>| !gapinput@f_:=RegularCWMapToCWSubcomplex(f_);;|
  !gapprompt@gap>| !gapinput@paths:=PathComponentsCWSubcomplex(f_);|
  [ [ Regular CW-complex of dimension 3
          , 
        [ [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 18, 19, 20 ], 
            [ 1, 2, 3, 4, 5, 6, 13, 14, 15, 16, 17, 18, 33, 34, 35, 46, 47, 48 
               ], [ 11, 12, 13, 14, 15, 16, 35, 36 ] ] ], 
    [ Regular CW-complex of dimension 3
          , [ [ 21, 24, 25, 27, 30, 31, 32, 37, 38, 39, 40, 43, 45, 46, 48 ], 
            [ 49, 51, 53, 56, 57, 59, 61, 63, 65, 67, 69, 71, 73, 74, 76, 79, 
                82, 83, 86, 87, 90, 91 ], [ 37, 39, 41, 44, 45, 47, 49 ] ] ], 
    [ Regular CW-complex of dimension 3
          , [ [ 22, 23, 26, 28, 29, 33, 34, 35, 36, 41, 42, 44, 47, 49, 50 ], 
            [ 50, 52, 54, 55, 58, 60, 62, 64, 66, 68, 70, 72, 75, 77, 78, 80, 
                81, 84, 85, 88, 89, 92 ], [ 38, 40, 42, 43, 46, 48, 50 ] ] ] ]
  !gapprompt@gap>| !gapinput@paths:=List(paths,CWSubcomplexToRegularCWMap);|
  [ Map of regular CW-complexes
      , Map of regular CW-complexes
      , Map of regular CW-complexes
       ]
  !gapprompt@gap>| !gapinput@List([1..3],x->List(Difference([1..3],[x]),y->IntersectionCWSubcomplex(paths[x],paths[y])));|
  [ [ [ Regular CW-complex of dimension 3
              , [ [  ], [  ], [  ] ] ], [ Regular CW-complex of dimension 3
              , [ [  ], [  ], [  ] ] ] ], [ [ Regular CW-complex of dimension 3
              , [ [  ], [  ], [  ] ] ], [ Regular CW-complex of dimension 3
              , [ [  ], [  ], [  ] ] ] ], [ [ Regular CW-complex of dimension 3
              , [ [  ], [  ], [  ] ] ], [ Regular CW-complex of dimension 3
              , [ [  ], [  ], [  ] ] ] ] ]
  
  !gapprompt@gap>| !gapinput@List(paths,x->List([0..3],y->Homology(Source(x),y)));|
  [ [ [ 0 ], [  ], [ 0 ], [  ] ], [ [ 0 ], [ 0, 0 ], [ 0 ], [  ] ], 
    [ [ 0 ], [ 0, 0 ], [ 0 ], [  ] ] ]
  
\end{Verbatim}
 As previously mentioned, for the tubular neighbourhood algorithm to work, we
require that no external cells yield non\texttt{\symbol{45}}contractible
path\texttt{\symbol{45}}components in their intersection with the subcomplex.
If this is ever the case then we can subdivide the offending cell to prevent
this from happening. We have implemented two subdivision algorithms in HAP,
one for barycentrically subdividing a given cell, and the other for
subdividing an $n$\texttt{\symbol{45}}cell into as many $n$\texttt{\symbol{45}}cells as there are $(n-1)$\texttt{\symbol{45}}cells in its boundary. Barycentric subdivision is
integrated into the \texttt{RegularCWComplexComplement} function and will be performed automatically as required. The following
example shows this automatic subdivision running via the complement of a
tubular neighbourhood of the unknot, then obtains an inclusion map from the
closure of an arbitrary $3$\texttt{\symbol{45}}cell of this complex and then compares the difference in
size of the two different subdivisions of a 2\texttt{\symbol{45}}cell in the
boundary of this $3$\texttt{\symbol{45}}cell. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@arc:=[[1,2],[1,2]];;|
  !gapprompt@gap>| !gapinput@unknot:=ArcPresentationToKnottedOneComplex(arc);|
  Map of regular CW-complexes
  
  !gapprompt@gap>| !gapinput@f:=RegularCWComplexComplement(unknot);|
  Testing contractibility...
  79 out of 79 cells tested.
  Subdividing 3 cell(s):
  100% complete. 
  Testing contractibility...
  145 out of 145 cells tested.
  The input is compatible with this algorithm.
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@f:=Objectify(HapRegularCWMap,rec(source:=f,target:=f,mapping:={i,j}->j));    |
  Map of regular CW-complexes
  
  !gapprompt@gap>| !gapinput@closure:=ClosureCWCell(Target(f),3,1);|
  [ Regular CW-complex of dimension 3
      , 
    [ [ 1, 2, 3, 4, 7, 8, 9, 10, 11, 13, 14, 20, 21, 22, 23, 25 ], 
        [ 1, 2, 3, 7, 8, 9, 10, 11, 15, 16, 17, 20, 21, 22, 23, 24, 25, 27, 28, 55, 58, 59, 
            60, 63 ], [ 1, 4, 7, 8, 9, 13, 14, 15, 18, 52 ], [ 1 ] ] ]
  !gapprompt@gap>| !gapinput@Size(Target(f));                                          |
  195
  !gapprompt@gap>| !gapinput@Size(Target(BarycentricallySubdivideCell(f,2,1)));        |
  231
  !gapprompt@gap>| !gapinput@Size(Target(SubdivideCell(f,2,1)));        |
  207
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Knotted surface complements in the 4\texttt{\symbol{45}}ball}}\logpage{[ 16, 3, 0 ]}
\hyperdef{L}{X78C28038837300BD}{}
{
 A construction of Satoh's, the tube map, associates a ribbon
torus\texttt{\symbol{45}}knot to virtual knot diagrams. A virtual knot diagram
differs from a knot diagram in that it allows for a third type of crossing, a
virtual crossing. The image of such a crossing via the tube map is two tori
which pass through each other. An arc diagram is a triple of lists \texttt{[arc,cross,cols]} that encode virtual knot diagrams. \texttt{arc} is an arc presentation. \texttt{cross} is a list of length the number of crossings in the knot associated to the arc
presentation whose entries are $-1,0$ or $1$ corresponding to an undercrossing (horizontal arc underneath vertical arc), a
virtual crossing (depicted by intersecting horizontal and vertical arcs) and
an overcrossing (horizontal arc above vertical arc) respectively. \texttt{cols} is a list of length the number of $0$ entries in \texttt{cross} and its entries are $1,2,3$ or $4$. It describes the types of 'colourings' we assign to the virtual crossings.
We interpret each integer as the change in 4\texttt{\symbol{45}}dimensional
height information as represented by a colour scale from blue (lower down in
4\texttt{\symbol{45}}space), to green (0 level), to red (higher up in
4\texttt{\symbol{45}}space). Without loss of generality, we impose that at
each virtual crossing, the vertical arc passes through the horizontal arc.
Thus, $1$ corresponds to the vertical bar entering the horizontal bar as blue and
leaving as blue, $2$ corresponds to entering as blue and leaving as red, $3$ corresponds to entering as red and leaving as blue and $4$ corresponds to entering and leaving as red. A coloured arc diagram can be
visualised using the \texttt{ViewColouredArcDiagram} function. 
\begin{Verbatim}[commandchars=!|B,fontsize=\small,frame=single,label=Example]
  !gapprompt|gap>B !gapinput|arc:=ArcPresentation(PureCubicalKnot(6,1));B
  [ [ 5, 8 ], [ 4, 6 ], [ 3, 5 ], [ 2, 4 ], [ 1, 3 ], [ 2, 7 ], [ 6, 8 ], [ 1, 7 ] ]
  !gapprompt|gap>B !gapinput|cross:=[0,0,1,-1,-1,0];;B
  !gapprompt|gap>B !gapinput|cols:=[1,4,3];;B
  !gapprompt|gap>B !gapinput|ViewArc2Presentation([arc,cross,cols]);  B
  convert-im6.q16: pixels are not authentic `/tmp/HAPtmpImage.txt' @ error/cache.c/QueueAuthenticPixelCacheNexus/4381.
  
  
\end{Verbatim}
 

  

 Towards obtaining a regular CW\texttt{\symbol{45}}decomposition of ribbon
torus\texttt{\symbol{45}}knots, we first begin by embedding a
self\texttt{\symbol{45}}intersecting knotted torus in the
3\texttt{\symbol{45}}ball. The function \texttt{ArcDiagramToTubularSurface} inputs a coloured arc diagram and outputs an inclusion from the boundary of
some (potentially self\texttt{\symbol{45}}intersecting) torus in the $3$\texttt{\symbol{45}}ball. By inputting just an arc presentation, one can
obtain an inclusion identical to the \texttt{KnotComplementWithBoundary} function. By additionally inputting a list of $-1$s and $1$s, one can obtain an inclusion similar to \texttt{KnotComplementWithBoundary} but where there is extra freedom in determining whether or not a given
crossing is an under/overcrossing. If one inputs both of the above but
includes $0$ entries in the \texttt{cross} list and includes the list of colours, the output is then an inclusion from an
embedded self\texttt{\symbol{45}}intersecting torus into the
3\texttt{\symbol{45}}ball where each $2$\texttt{\symbol{45}}cell (the top\texttt{\symbol{45}}dimensional cells of the
self\texttt{\symbol{45}}intersecting surface) is assigned a colour. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|tub:=ArcDiagramToTubularSurface(arc);        B
  Map of regular CW-complexes
  
  @gapprompt|gap>B @gapinput|tub:=ArcDiagramToTubularSurface([arc,cross]);B
  Map of regular CW-complexes
  
  @gapprompt|gap>B @gapinput|tub:=ArcDiagramToTubularSurface([arc,cross,cols]);B
  Map of regular CW-complexes
  
  @gapprompt|gap>B @gapinput|List([1..Length(Source(tub)!.boundaries[3])],x->tub!.colour(2,tub!.mapping(2,x)));B
  [ [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], 
    [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], 
    [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], 
    [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], 
    [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ -1 ], [ -1 ], 
    [ 0 ], [ 0 ], [ -1 ], [ -1 ], [ -1 ], [ -1 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 1 ], [ 1 ], 
    [ 0 ], [ 0 ], [ 1 ], [ 1 ], [ 1 ], [ 1 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 1 ], [ 1 ], [ 0 ], 
    [ 0 ], [ -1 ], [ -1 ], [ 1 ], [ -1 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ -1 ], [ -1 ], [ 0 ], 
    [ 1 ], [ 1 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 1 ], [ -1 ], [ 0 ] ]
  
\end{Verbatim}
 From this self\texttt{\symbol{45}}intersecting surface with colour, we can
lift it to a surface without self\texttt{\symbol{45}}intersections in $\mathbb{R}^4$. We do this by constructing a regular CW\texttt{\symbol{45}}complex of the
direct product $B^3 \times [a,b]$ where $B^3$ denotes the $3$\texttt{\symbol{45}}ball, $a$ is $1$ less than the smallest integer assigned to a cell by the colouring, and $b$ is $1$ greater than the largest integer assigned to a cell by the colouring. The
subcomplex of the direct product corresponding to the surface without
intersection can be obtained using the colouring with additional care taken to
not lift any 1\texttt{\symbol{45}}cells arising as
double\texttt{\symbol{45}}point singularities. The following example
constructs the complement of a ribbon torus\texttt{\symbol{45}}link embedded
in $\mathbb{R}^4$ obtained from the Hopf link with one virtual crossing and then calculates some
invariants of the resulting space. We compare the size of this complex, as
well as how long it takes to obtain the same invariants, with a cubical
complex of the same space. As barycentric subdivision can massively increase
the size of the cell complex, the below method sequentially obtains the
tubular neighbourhood of the entire subcomplex by obtaining the tubular
neighbourhood of each individual $2$\texttt{\symbol{45}}cell. This has yet to be optimised so it currently takes
some time to complete. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|arc:=[[2,4],[1,3],[2,4],[1,3]];;                B
  @gapprompt|gap>B @gapinput|tub:=ArcDiagramToTubularSurface([arc,[0,-1],[2]]);B
  Map of regular CW-complexes
  
  @gapprompt|gap>B @gapinput|tub:=LiftColouredSurface(tub);B
  Map of regular CW-complexes
  
  @gapprompt|gap>B @gapinput|Dimension(Source(tub));B
  2
  @gapprompt|gap>B @gapinput|Dimension(Source(tub));B
  4
  @gapprompt|gap>B @gapinput|map:=RegularCWMapToCWSubcomplex(tub);;B
  @gapprompt|gap>B @gapinput|sub:=SortedList(map[2][3]);;B
  @gapprompt|gap>B @gapinput|sub:=List(sub,x->x-(Position(sub,x)-1));;B
  @gapprompt|gap>B @gapinput|clsr:=ClosureCWCell(map[1],2,sub[1])[2];;B
  @gapprompt|gap>B @gapinput|seq:=CWSubcomplexToRegularCWMap([map[1],clsr]);;B
  @gapprompt|gap>B @gapinput|tub:=RegularCWComplexComplement(seq);B
  Testing contractibility...
  3501 out of 3501 cells tested.
  The input is compatible with this algorithm.
  @gapprompt|gap>B @gapinput|for i in [2..Length(sub)] doB
  @gapprompt|>B @gapinput|    clsr:=ClosureCWCell(tub,2,sub[i])[2];;B
  @gapprompt|>B @gapinput|    seq:=CWSubcomplexToRegularCWMap([tub,clsr]);;B
  @gapprompt|>B @gapinput|    tub:=RegularCWComplexComplement(seq);B
  @gapprompt|>B @gapinput|od;B
  Testing contractibility...
  3612 out of 3612 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  3693 out of 3693 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  3871 out of 3871 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  3925 out of 3925 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  4084 out of 4084 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  4216 out of 4216 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  4348 out of 4348 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  4529 out of 4529 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  4688 out of 4688 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  4723 out of 4723 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  4918 out of 4918 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  5107 out of 5107 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  5269 out of 5269 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  5401 out of 5401 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  5548 out of 5548 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  5702 out of 5702 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  5846 out of 5846 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6027 out of 6027 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6089 out of 6089 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6124 out of 6124 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6159 out of 6159 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6349 out of 6349 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6467 out of 6467 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6639 out of 6639 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6757 out of 6757 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6962 out of 6962 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7052 out of 7052 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7242 out of 7242 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7360 out of 7360 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7470 out of 7470 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7561 out of 7561 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7624 out of 7624 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7764 out of 7764 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7904 out of 7904 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7979 out of 7979 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8024 out of 8024 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8086 out of 8086 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8148 out of 8148 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8202 out of 8202 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8396 out of 8396 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8534 out of 8534 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8625 out of 8625 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8736 out of 8736 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8817 out of 8817 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8983 out of 8983 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  9073 out of 9073 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  9218 out of 9218 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  9323 out of 9323 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  9442 out of 9442 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  9487 out of 9487 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  9538 out of 9538 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  9583 out of 9583 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  9634 out of 9634 cells tested.
  The input is compatible with this algorithm.
  @gapprompt|gap>B @gapinput|Size(tub);      B
  9685
  @gapprompt|gap>B @gapinput|total_time_1:=0;;B
  @gapprompt|gap>B @gapinput|List([0..4],x->Homology(tub,x)); total_time_1:=total_time_1+time;;B
  [ [ 0 ], [ 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0 ], [  ] ]
  @gapprompt|gap>B @gapinput|c:=ChainComplexOfUniversalCover(tub);; total_time_1:=total_time_1+time;;B
  @gapprompt|gap>B @gapinput|l:=Filtered(LowIndexSubgroups(c!.group,5),g->Index(c!.group,g)=5);; total_time_1:=total_time_1+time;;B
  @gapprompt|gap>B @gapinput|inv:=Set(l,g->Homology(TensorWithIntegersOverSubgroup(c,g),2)); total_time_1:=total_time_1+time;;B
  [ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] 
   ]
  @gapprompt|gap>B @gapinput|total_time_1;B
  3407
  @gapprompt|gap>B @gapinput|hopf:=PureComplexComplement(HopfSatohSurface());;B
  @gapprompt|gap>B @gapinput|hopf:=RegularCWComplex(hopf);;B
  @gapprompt|gap>B @gapinput|Size(hopf);B
  4508573
  @gapprompt|gap>B @gapinput|total_time_2:=0;;B
  @gapprompt|gap>B @gapinput|c_:=ChainComplexOfUniversalCover(hopf);; total_time_2:=total_time_2+time;;B
  @gapprompt|gap>B @gapinput|l_:=Filtered(LowIndexSubgroups(c_!.group,5),g->Index(c_!.group,g)=5);; total_time_2:=total_time_2+time;;B
  @gapprompt|gap>B @gapinput|inv_:=Set(l_,g->Homology(TensorWithIntegersOverSubgroup(c_,g),2));; total_time_2:=total_time_2+time;;B
  @gapprompt|gap>B @gapinput|total_time_2;B
  1116000
  @gapprompt|gap>B @gapinput|inv_=inv;B
  true
  
\end{Verbatim}
 }

 }

 \def\bibname{References\logpage{[ "Bib", 0, 0 ]}
\hyperdef{L}{X7A6F98FD85F02BFE}{}
}

\bibliographystyle{alpha}
\bibliography{mybib.xml}

\addcontentsline{toc}{chapter}{References}

\def\indexname{Index\logpage{[ "Ind", 0, 0 ]}
\hyperdef{L}{X83A0356F839C696F}{}
}

\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{Index}


\printindex

\newpage
\immediate\write\pagenrlog{["End"], \arabic{page}];}
\immediate\closeout\pagenrlog
\end{document}