Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

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

# -*- coding: utf-8 -*- 

r""" 

Methods of constructing simplicial sets 

 

This implements various constructions on simplicial sets: 

subsimplicial sets, pullbacks, products, pushouts, quotients, wedges, 

disjoint unions, smash products, cones, and suspensions. The best way 

to access these is with methods attached to simplicial sets 

themselves, as in the following. 

 

EXAMPLES:: 

 

sage: K = simplicial_sets.Simplex(1) 

sage: square = K.product(K) 

 

sage: K = simplicial_sets.Simplex(1) 

sage: endpoints = K.n_skeleton(0) 

sage: circle = K.quotient(endpoints) 

 

The mapping cone of a morphism of simplicial sets is constructed as a 

pushout:: 

 

sage: eta = simplicial_sets.HopfMap() 

sage: CP2 = eta.mapping_cone() 

sage: type(CP2) 

<class 'sage.homology.simplicial_set_constructions.PushoutOfSimplicialSets_finite_with_category'> 

 

See the main documentation for simplicial sets, as well as for the 

classes for pushouts, pullbacks, etc., for more details. 

 

Many of the classes defined here inherit from 

:class:`sage.structure.unique_representation.UniqueRepresentation`. This 

means that they produce identical output if given the same input, so 

for example, if ``K`` is a simplicial set, calling ``K.suspension()`` 

twice returns the same result both times:: 

 

sage: CP2.suspension() is CP2.suspension() 

True 

 

So on one hand, a command like ``simplicial_sets.Sphere(2)`` 

constructs a distinct copy of a 2-sphere each time it is called; on 

the other, once you have constructed a 2-sphere, then constructing its 

cone, its suspension, its product with another simplicial set, etc., 

will give you the same result each time:: 

 

sage: simplicial_sets.Sphere(2) == simplicial_sets.Sphere(2) 

False 

sage: S2 = simplicial_sets.Sphere(2) 

sage: S2.product(S2) == S2.product(S2) 

True 

sage: S2.disjoint_union(CP2, S2) == S2.disjoint_union(CP2, S2) 

True 

 

AUTHORS: 

 

- John H. Palmieri (2016-07) 

""" 

#***************************************************************************** 

# Copyright (C) 2016 John H. Palmieri <palmieri at math.washington.edu> 

# 

# Distributed under the terms of the GNU General Public License (GPL) 

# http://www.gnu.org/licenses/ 

# 

# This code is distributed in the hope that it will be useful, 

# but WITHOUT ANY WARRANTY; without even the implied warranty 

# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

# 

# See the GNU General Public License for more details; the full text 

# is available at: 

# 

# http://www.gnu.org/licenses/ 

# 

#***************************************************************************** 

 

import itertools 

 

from sage.graphs.graph import Graph 

from sage.misc.latex import latex 

from sage.sets.set import Set 

from sage.structure.parent import Parent 

from sage.structure.unique_representation import UniqueRepresentation 

 

from .simplicial_set import AbstractSimplex, \ 

SimplicialSet_arbitrary, SimplicialSet_finite, \ 

standardize_degeneracies, face_degeneracies 

from .simplicial_set_examples import Empty, Point 

 

from sage.misc.lazy_import import lazy_import 

lazy_import('sage.categories.simplicial_sets', 'SimplicialSets') 

 

######################################################################## 

# classes which inherit from SimplicialSet_arbitrary 

 

# Note: many of the classes below for infinite simplicial sets have an 

# attribute '_n_skeleton'. This is used to cache the highest 

# dimensional skeleton calculated so far for this simplicial set, 

# along with its dimension, so for example, the starting value is 

# often (-1, Empty()): the (-1)-skeleton is the empty simplicial 

# set. It gets used and updated in the n_skeleton method. 

 

class SubSimplicialSet(SimplicialSet_finite, UniqueRepresentation): 

@staticmethod 

def __classcall__(self, data, ambient=None): 

""" 

Convert ``data`` from a dict to a tuple. 

 

TESTS:: 

 

sage: from sage.homology.simplicial_set_constructions import SubSimplicialSet 

sage: K = simplicial_sets.Simplex(2) 

sage: e = K.n_cells(1)[0] 

sage: A = SubSimplicialSet({e: K.faces(e)}, ambient=K) 

sage: B = SubSimplicialSet({e: list(K.faces(e))}, ambient=K) 

sage: A == B 

True 

""" 

L = [] 

for x in data: 

if data[x] is None: 

L.append((x, None)) 

else: 

L.append((x, tuple(data[x]))) 

return super(SubSimplicialSet, self).__classcall__(self, tuple(L), ambient) 

 

def __init__(self, data, ambient=None): 

r""" 

Return a finite simplicial set as a subsimplicial set of another 

simplicial set. 

 

This keeps track of the ambient simplicial set and the 

inclusion map from the subcomplex into it. 

 

INPUT: 

 

- ``data`` -- the data defining the subset: a dictionary where 

the keys are simplices from the ambient simplicial set and 

the values are their faces. 

 

- ``ambient`` -- the ambient simplicial set. If omitted, use 

the same simplicial set as the subset and the ambient 

complex. 

 

EXAMPLES:: 

 

sage: S3 = simplicial_sets.Sphere(3) 

sage: K = simplicial_sets.KleinBottle() 

sage: X = S3.disjoint_union(K) 

sage: Y = X.structure_map(0).image() # the S3 summand 

sage: Y.inclusion_map() 

Simplicial set morphism: 

From: Simplicial set with 2 non-degenerate simplices 

To: Disjoint union: (S^3 u Klein bottle) 

Defn: [v_0, sigma_3] --> [v_0, sigma_3] 

sage: Y.ambient_space() 

Disjoint union: (S^3 u Klein bottle) 

 

TESTS:: 

 

sage: T = simplicial_sets.Torus() 

sage: latex(T.n_skeleton(2)) 

S^{1} \times S^{1} 

 

sage: T.n_skeleton(1).n_skeleton(1) == T.n_skeleton(1) 

True 

 

sage: T.n_skeleton(1) is T.n_skeleton(1) 

True 

""" 

data = dict(data) 

if ambient is None: 

ambient = self 

if (ambient.is_pointed() 

and hasattr(ambient, '_basepoint') 

and ambient.base_point() in data): 

SimplicialSet_finite.__init__(self, data, base_point=ambient.base_point()) 

else: 

SimplicialSet_finite.__init__(self, data) 

if self == ambient: 

if hasattr(ambient, '__custom_name'): 

self.rename(str(ambient)) 

self._latex_name = latex(ambient) 

# When constructing the inclusion map, we do not need to check 

# the validity of the morphism, and more importantly, we 

# cannot check it in the infinite case: the appropriate data 

# may not have yet been constructed. So use "check=False". 

self._inclusion = self.Hom(ambient)({x:x for x in data}, check=False) 

 

def inclusion_map(self): 

r""" 

Return the inclusion map from this subsimplicial set into its 

ambient space. 

 

EXAMPLES:: 

 

sage: RP6 = simplicial_sets.RealProjectiveSpace(6) 

sage: K = RP6.n_skeleton(2) 

sage: K.inclusion_map() 

Simplicial set morphism: 

From: Simplicial set with 3 non-degenerate simplices 

To: RP^6 

Defn: [1, f, f * f] --> [1, f, f * f] 

 

`RP^6` itself is constructed as a subsimplicial set of 

`RP^\infty`:: 

 

sage: latex(RP6.inclusion_map()) 

RP^{6} \to RP^{\infty} 

""" 

return self._inclusion 

 

def ambient_space(self): 

""" 

Return the simplicial set of which this is a subsimplicial set. 

 

EXAMPLES:: 

 

sage: T = simplicial_sets.Torus() 

sage: eight = T.wedge_as_subset() 

sage: eight 

Simplicial set with 3 non-degenerate simplices 

sage: eight.fundamental_group() 

Finitely presented group < e0, e1 | > 

sage: eight.ambient_space() 

Torus 

""" 

return self._inclusion.codomain() 

 

 

class PullbackOfSimplicialSets(SimplicialSet_arbitrary, UniqueRepresentation): 

@staticmethod 

def __classcall_private__(self, maps=None): 

""" 

TESTS:: 

 

sage: from sage.homology.simplicial_set_constructions import PullbackOfSimplicialSets 

sage: S2 = simplicial_sets.Sphere(2) 

sage: one = S2.Hom(S2).identity() 

sage: PullbackOfSimplicialSets([one, one]) == PullbackOfSimplicialSets((one, one)) 

True 

""" 

if maps: 

return super(PullbackOfSimplicialSets, self).__classcall__(self, tuple(maps)) 

return super(PullbackOfSimplicialSets, self).__classcall__(self) 

 

def __init__(self, maps=None): 

r""" 

Return the pullback obtained from the morphisms ``maps``. 

 

INPUT: 

 

- ``maps`` -- a list or tuple of morphisms of simplicial sets 

 

If only a single map `f: X \to Y` is given, then return 

`X`. If no maps are given, return the one-point simplicial 

set. Otherwise, given a simplicial set `Y` and maps `f_i: X_i 

\to Y` for `0 \leq i \leq m`, construct the pullback `P`: see 

:wikipedia:`Pullback_(category_theory)`. This is constructed 

as pullbacks of sets for each set of `n`-simplices, so `P_n` 

is the subset of the product `\prod (X_i)_n` consisting of 

those elements `(x_i)` for which `f_i(x_i) = f_j(x_j)` for all 

`i`, `j`. 

 

This is pointed if the maps `f_i` are. 

 

EXAMPLES: 

 

The pullback of a quotient map by a subsimplicial set and the 

base point map gives a simplicial set isomorphic to the 

original subcomplex:: 

 

sage: RP5 = simplicial_sets.RealProjectiveSpace(5) 

sage: K = RP5.quotient(RP5.n_skeleton(2)) 

sage: X = K.pullback(K.quotient_map(), K.base_point_map()) 

sage: X.homology() == RP5.n_skeleton(2).homology() 

True 

 

Pullbacks of identity maps:: 

 

sage: S2 = simplicial_sets.Sphere(2) 

sage: one = S2.Hom(S2).identity() 

sage: P = S2.pullback(one, one) 

sage: P.homology() 

{0: 0, 1: 0, 2: Z} 

 

The pullback is constructed in terms of the product -- of 

course, the product is a special case of the pullback -- and 

the simplices are named appropriately:: 

 

sage: P.nondegenerate_simplices() 

[(v_0, v_0), (sigma_2, sigma_2)] 

""" 

# Import this here to prevent circular imports. 

from sage.homology.simplicial_set_morphism import SimplicialSetMorphism 

if maps and any(not isinstance(f, SimplicialSetMorphism) for f in maps): 

raise ValueError('the maps must be morphisms of simplicial sets') 

 

Cat = SimplicialSets() 

if maps: 

if all(f.domain().is_finite() for f in maps): 

Cat = Cat.Finite() 

if all(f.is_pointed() for f in maps): 

Cat = Cat.Pointed() 

Parent.__init__(self, category=Cat) 

self._maps = maps 

self._n_skeleton = (-1, Empty()) 

 

def n_skeleton(self, n): 

""" 

Return the `n`-skeleton of this simplicial set. 

 

That is, the simplicial set generated by all nondegenerate 

simplices of dimension at most `n`. 

 

INPUT: 

 

- ``n`` -- the dimension 

 

The `n`-skeleton of the pullback is computed as the pullback 

of the `n`-skeleta of the component simplicial sets. 

 

EXAMPLES:: 

 

sage: B = simplicial_sets.ClassifyingSpace(groups.misc.MultiplicativeAbelian([2])) 

sage: one = Hom(B,B).identity() 

sage: c = Hom(B,B).constant_map() 

sage: P = B.pullback(one, c) 

sage: P.n_skeleton(2) 

Pullback of maps: 

Simplicial set endomorphism of Simplicial set with 3 non-degenerate simplices 

Defn: Identity map 

Simplicial set endomorphism of Simplicial set with 3 non-degenerate simplices 

Defn: Constant map at 1 

sage: P.n_skeleton(3).homology() 

{0: 0, 1: C2, 2: 0, 3: Z} 

""" 

if self.is_finite(): 

maps = self._maps 

if maps: 

codomain = SimplicialSet_finite.n_skeleton(maps[0].codomain(), n) 

domains = [SimplicialSet_finite.n_skeleton(f.domain(), n) for f in maps] 

new_maps = [f.n_skeleton(n, d, codomain) for (f, d) in zip(maps, domains)] 

return PullbackOfSimplicialSets_finite(new_maps) 

return PullbackOfSimplicialSets_finite(maps) 

start, skel = self._n_skeleton 

if start == n: 

return skel 

elif start > n: 

return skel.n_skeleton(n) 

ans = PullbackOfSimplicialSets_finite([f.n_skeleton(n) for f in self._maps]) 

self._n_skeleton = (n, ans) 

return ans 

 

def defining_map(self, i): 

r""" 

Return the `i`-th map defining the pullback. 

 

INPUT: 

 

- ``i`` -- integer 

 

If this pullback was constructed as ``Y.pullback(f_0, f_1, ...)``, 

this returns `f_i`. 

 

EXAMPLES:: 

 

sage: RP5 = simplicial_sets.RealProjectiveSpace(5) 

sage: K = RP5.quotient(RP5.n_skeleton(2)) 

sage: Y = K.pullback(K.quotient_map(), K.base_point_map()) 

sage: Y.defining_map(1) 

Simplicial set morphism: 

From: Point 

To: Quotient: (RP^5/Simplicial set with 3 non-degenerate simplices) 

Defn: Constant map at * 

sage: Y.defining_map(0).domain() 

RP^5 

""" 

return self._maps[i] 

 

def _repr_(self): 

""" 

Print representation 

 

EXAMPLES:: 

 

sage: S3 = simplicial_sets.Sphere(3) 

sage: c = Hom(S3,S3).constant_map() 

sage: one = Hom(S3, S3).identity() 

sage: S3.pullback(c, one) 

Pullback of maps: 

Simplicial set endomorphism of S^3 

Defn: Constant map at v_0 

Simplicial set endomorphism of S^3 

Defn: Identity map 

""" 

if not self._maps: 

return 'Point' 

s = 'Pullback of maps:' 

for f in self._maps: 

t = '\n' + str(f) 

s += t.replace('\n', '\n ') 

return s 

 

 

class PullbackOfSimplicialSets_finite(PullbackOfSimplicialSets, SimplicialSet_finite): 

""" 

The pullback of finite simplicial sets obtained from ``maps``. 

 

When the simplicial sets involved are all finite, there are more 

methods available to the resulting pullback, as compared to case 

when some of the components are infinite: the structure maps from 

the pullback and the pullback's universal property: see 

:meth:`structure_map` and :meth:`universal_property`. 

""" 

@staticmethod 

def __classcall_private__(self, maps=None): 

""" 

TESTS:: 

 

sage: from sage.homology.simplicial_set_constructions import PullbackOfSimplicialSets_finite 

sage: S2 = simplicial_sets.Sphere(2) 

sage: one = S2.Hom(S2).identity() 

sage: PullbackOfSimplicialSets_finite([one, one]) == PullbackOfSimplicialSets_finite((one, one)) 

True 

""" 

if maps: 

return super(PullbackOfSimplicialSets_finite, self).__classcall__(self, tuple(maps)) 

return super(PullbackOfSimplicialSets_finite, self).__classcall__(self) 

 

def __init__(self, maps=None): 

r""" 

Return the pullback obtained from the morphisms ``maps``. 

 

See :class:`PullbackOfSimplicialSets` for more information. 

 

INPUT: 

 

- ``maps`` -- a list or tuple of morphisms of simplicial sets 

 

EXAMPLES:: 

 

sage: eta = simplicial_sets.HopfMap() 

sage: S3 = eta.domain() 

sage: S2 = eta.codomain() 

sage: c = Hom(S2,S2).constant_map() 

sage: S2.pullback(eta, c).is_finite() 

True 

 

sage: B = simplicial_sets.ClassifyingSpace(groups.misc.MultiplicativeAbelian([2])) 

sage: one = Hom(B,B).identity() 

sage: c = Hom(B,B).constant_map() 

sage: B.pullback(one, c).is_finite() 

False 

 

TESTS:: 

 

sage: P = simplicial_sets.Point() 

sage: P.pullback(P.constant_map(), P.constant_map()) 

Pullback of maps: 

Simplicial set endomorphism of Point 

Defn: Identity map 

Simplicial set endomorphism of Point 

Defn: Identity map 

""" 

# Import this here to prevent circular imports. 

from sage.homology.simplicial_set_morphism import SimplicialSetMorphism 

if maps and any(not isinstance(f, SimplicialSetMorphism) for f in maps): 

raise ValueError('the maps must be morphisms of simplicial sets') 

if not maps: 

star = AbstractSimplex(0, name='*') 

SimplicialSet_finite.__init__(self, {star: None}, base_point=star, name='Point') 

self._maps = () 

self._translation = {} 

return 

if len(maps) == 1: 

f = maps[0] 

if f.is_pointed(): 

SimplicialSet_finite.__init__(self, f.domain().face_data(), 

base_point=f.domain().base_point()) 

else: 

SimplicialSet_finite.__init__(self, f.domain().face_data()) 

self._maps = (f,) 

return 

codomain = maps[0].codomain() 

if any(codomain != f.codomain() for f in maps[1:]): 

raise ValueError('the codomains of the maps must be equal') 

# Now construct the pullback by constructing the product and only 

# keeping the appropriate simplices. 

domains = [f.domain() for f in maps] 

nondegen = [X.nondegenerate_simplices() for X in domains] 

data_factors = [X.face_data() for X in domains] 

# data: dictionary to construct the new simplicial set. 

data = {} 

# translate: keep track of the nondegenerate simplices in the 

# new simplicial set for computing faces: keys are tuples of 

# pairs (sigma, degens), with sigma a nondegenerate simplex in 

# one of the factors, degens the tuple of applied 

# degeneracies. The associated value is the actual simplex in 

# the product. 

translate = {} 

for simplices in itertools.product(*nondegen): 

dims = [_.dimension() for _ in simplices] 

dim_min = min(dims) 

dim_max = max(dims) 

sum_dims = sum(dims) 

for d in range(dim_max, sum_dims + 1): 

S = Set(range(d)) 

# Is there a way to speed up the following? Given the 

# tuple dims=(n_1, n_2, ..., n_k) and given d between 

# max(dims) and sum(dims), we are trying to construct 

# k-tuples of subsets (D_1, D_2, ..., D_k) of range(d) 

# such that the intersection of all of the D_i's is 

# empty. 

for I in itertools.product(*[S.subsets(d - _) for _ in dims]): 

if set.intersection(*[set(_) for _ in I]): 

# To get a nondegenerate face, can't have a 

# degeneracy in common for all the factors. 

continue 

degens = [tuple(sorted(_, reverse=True)) for _ in I] 

 

sigma = simplices[0].apply_degeneracies(*degens[0]) 

target = maps[0](sigma) 

if any(target != f(tau.apply_degeneracies(*degen)) 

for (f, tau, degen) in zip(maps[1:], simplices[1:], degens[1:])): 

continue 

 

simplex_factors = tuple(zip(simplices, tuple(degens))) 

s = '(' + ', '.join(['{}'.format(_[0].apply_degeneracies(*_[1])) 

for _ in simplex_factors]) + ')' 

ls = '(' + ', '.join(['{}'.format(latex(_[0].apply_degeneracies(*_[1]))) 

for _ in simplex_factors]) + ')' 

simplex = AbstractSimplex(d, name=s, latex_name=ls) 

translate[simplex_factors] = simplex 

# Now compute the faces of simplex. 

if d == 0: 

# It's a vertex, so it has no faces. 

faces = None 

else: 

faces = [] 

for i in range(d+1): 

# Compute d_i on simplex. 

# 

# face_degens: tuple of pairs (J, t): J is the 

# list of degeneracies to apply to the 

# corresponding entry in simplex_factors, t is 

# the face map to apply. 

face_degens = [face_degeneracies(i, _) for _ in degens] 

face_factors = [] 

new_degens = [] 

for x, Face, face_dict in zip(simplices, face_degens, data_factors): 

J = Face[0] 

t = Face[1] 

if t is None: 

face_factors.append(x.nondegenerate()) 

else: 

underlying = face_dict[x][t] 

temp_degens = underlying.degeneracies() 

underlying = underlying.nondegenerate() 

J = standardize_degeneracies(*(J + list(temp_degens))) 

face_factors.append(underlying) 

new_degens.append(J) 

 

# By the simplicial identities, s_{i_1} 

# s_{i_2} ... s_{i_n} z (if decreasing) is in 

# the image of s_{i_k} for each k. 

# 

# So find the intersection K of each J, the 

# degeneracies applied to left_face and 

# right_face. Then the face will be s_{K} 

# (s_{J'_L} left_face, s_{J'_R} right_face), 

# where you get J'_L from J_L by pulling out K 

# from J_L. 

# 

# J'_L is obtained as follows: for each j in 

# J_L, decrease j by q if q = #{x in K: x < j} 

K = set.intersection(*[set(J) for J in new_degens]) 

 

face_degens = [] 

for J in new_degens: 

new_J = [] 

for j in J: 

if j not in K: 

q = len([x for x in K if x < j]) 

new_J.append(j - q) 

face_degens.append(tuple(new_J)) 

K = sorted(K, reverse=True) 

underlying_face = translate[tuple(zip(tuple(face_factors), tuple(face_degens)))] 

faces.append(underlying_face.apply_degeneracies(*K)) 

data[simplex] = faces 

 

if all(f.is_pointed() for f in maps): 

basept = translate[tuple([(sset.base_point(), ()) for sset in domains])] 

if not data: 

data = {basept: None} 

SimplicialSet_finite.__init__(self, data, base_point=basept) 

else: 

SimplicialSet_finite.__init__(self, data) 

self._maps = maps 

# self._translation: tuple converted from dict. keys: tuples 

# of pairs (sigma, degens), with sigma a nondegenerate simplex 

# in one of the factors, degens the tuple of applied 

# degeneracies. The associated value is the actual simplex in 

# the product. 

self._translation = tuple(translate.items()) 

 

def structure_map(self, i): 

r""" 

Return the `i`-th projection map of the pullback. 

 

INPUT: 

 

- ``i`` -- integer 

 

If this pullback `P` was constructed as ``Y.pullback(f_0, f_1, 

...)``, where `f_i: X_i \to Y`, then there are structure maps 

`\bar{f}_i: P \to X_i`. This method constructs `\bar{f}_i`. 

 

EXAMPLES:: 

 

sage: RP5 = simplicial_sets.RealProjectiveSpace(5) 

sage: K = RP5.quotient(RP5.n_skeleton(2)) 

sage: Y = K.pullback(K.quotient_map(), K.base_point_map()) 

sage: Y.structure_map(0) 

Simplicial set morphism: 

From: Pullback of maps: 

Simplicial set morphism: 

From: RP^5 

To: Quotient: (RP^5/Simplicial set with 3 non-degenerate simplices) 

Defn: [1, f, f * f, f * f * f, f * f * f * f, f * f * f * f * f] --> [*, s_0 *, s_1 s_0 *, f * f * f, f * f * f * f, f * f * f * f * f] 

Simplicial set morphism: 

From: Point 

To: Quotient: (RP^5/Simplicial set with 3 non-degenerate simplices) 

Defn: Constant map at * 

To: RP^5 

Defn: [(1, *), (f, s_0 *), (f * f, s_1 s_0 *)] --> [1, f, f * f] 

sage: Y.structure_map(1).codomain() 

Point 

 

These maps are also accessible via ``projection_map``:: 

 

sage: Y.projection_map(1).codomain() 

Point 

""" 

if len(self._maps) == 1: 

return self.Hom(self).identity() 

f = {} 

for x in self._translation: 

f[x[1]] = x[0][i][0].apply_degeneracies(*x[0][i][1]) 

codomain = self.defining_map(i).domain() 

return self.Hom(codomain)(f) 

 

projection_map = structure_map 

 

def universal_property(self, *maps): 

r""" 

Return the map induced by ``maps``. 

 

INPUT: 

 

- ``maps`` -- maps from a simplicial set `Z` to the "factors" 

`X_i` forming the pullback. 

 

If the pullback `P` is formed by maps `f_i: X_i \to Y`, then 

given maps `g_i: Z \to X_i` such that `f_i g_i = f_j g_j` for 

all `i`, `j`, then there is a unique map `g: Z \to P` making 

the appropriate diagram commute. This constructs that map. 

 

EXAMPLES:: 

 

sage: S1 = simplicial_sets.Sphere(1) 

sage: T = S1.product(S1) 

sage: K = T.factor(0, as_subset=True) 

sage: f = S1.Hom(T)({S1.n_cells(0)[0]:K.n_cells(0)[0], S1.n_cells(1)[0]:K.n_cells(1)[0]}) 

sage: P = S1.product(T) 

sage: P.universal_property(S1.Hom(S1).identity(), f) 

Simplicial set morphism: 

From: S^1 

To: S^1 x S^1 x S^1 

Defn: [v_0, sigma_1] --> [(v_0, (v_0, v_0)), (sigma_1, (sigma_1, s_0 v_0))] 

""" 

if len(self._maps) != len(maps): 

raise ValueError('wrong number of maps specified') 

if len(self._maps) == 1: 

return maps[0] 

domain = maps[0].domain() 

if any(g.domain() != domain for g in maps[1:]): 

raise ValueError('the maps do not all have the same codomain') 

composite = self._maps[0] * maps[0] 

if any(f*g != composite for f,g in zip(self._maps[1:], maps[1:])): 

raise ValueError('the maps are not compatible') 

data = {} 

translate = dict(self._translation) 

for sigma in domain.nondegenerate_simplices(): 

target = tuple([(f(sigma).nondegenerate(), tuple(f(sigma).degeneracies())) 

for f in maps]) 

# If there any degeneracies in common, remove them: the 

# dictionary "translate" has nondegenerate simplices as 

# its keys. 

in_common = set.intersection(*[set(_[1]) for _ in target]) 

if in_common: 

target = tuple((tau, tuple(sorted(set(degens).difference(in_common), 

reverse=True))) 

for tau, degens in target) 

in_common = sorted(in_common, reverse=True) 

data[sigma] = translate[target].apply_degeneracies(*in_common) 

return domain.Hom(self)(data) 

 

class Factors(object): 

""" 

Classes which inherit from this should define a ``_factors`` 

attribute for their instances, and this class accesses that 

attribute. This is used by :class:`ProductOfSimplicialSets`, 

:class:`WedgeOfSimplicialSets`, and 

:class:`DisjointUnionOfSimplicialSets`. 

""" 

def factors(self): 

""" 

Return the factors involved in this construction of simplicial sets. 

 

EXAMPLES:: 

 

sage: S2 = simplicial_sets.Sphere(2) 

sage: S3 = simplicial_sets.Sphere(3) 

sage: S2.wedge(S3).factors() == (S2, S3) 

True 

sage: S2.product(S3).factors()[0] 

S^2 

""" 

return self._factors 

 

def factor(self, i): 

r""" 

Return the $i$-th factor of this construction of simplicial sets. 

 

INPUT: 

 

- ``i`` -- integer, the index of the factor 

 

EXAMPLES:: 

 

sage: S2 = simplicial_sets.Sphere(2) 

sage: S3 = simplicial_sets.Sphere(3) 

sage: K = S2.disjoint_union(S3) 

sage: K.factor(0) 

S^2 

sage: B = simplicial_sets.ClassifyingSpace(groups.misc.MultiplicativeAbelian([2])) 

sage: X = B.wedge(S3, B) 

sage: X.factor(1) 

S^3 

sage: X.factor(2) 

Classifying space of Multiplicative Abelian group isomorphic to C2 

""" 

return self.factors()[i] 

 

 

class ProductOfSimplicialSets(PullbackOfSimplicialSets, Factors): 

@staticmethod 

def __classcall__(cls, factors=None): 

""" 

TESTS:: 

 

sage: from sage.homology.simplicial_set_constructions import ProductOfSimplicialSets 

sage: S2 = simplicial_sets.Sphere(2) 

sage: ProductOfSimplicialSets([S2, S2]) == ProductOfSimplicialSets((S2, S2)) 

True 

""" 

if factors: 

return super(ProductOfSimplicialSets, cls).__classcall__(cls, factors=tuple(factors)) 

return super(ProductOfSimplicialSets, cls).__classcall__(cls) 

 

def __init__(self, factors=None): 

r""" 

Return the product of simplicial sets. 

 

INPUT: 

 

- ``factors`` -- a list or tuple of simplicial sets 

 

Return the product of the simplicial sets in ``factors``. 

 

If `X` and `Y` are simplicial sets, then their product `X 

\times Y` is defined to be the simplicial set with 

`n`-simplices `X_n \times Y_n`. Therefore the simplices in 

the product have the form `(s_I \sigma, s_J \tau)`, where `s_I 

= s_{i_1} ... s_{i_p}` and `s_J = s_{j_1} ... s_{j_q}` are 

composites of degeneracy maps, written in decreasing order. 

Such a simplex is nondegenerate if the indices `I` and `J` are 

disjoint. Therefore if `\sigma` and `\tau` are nondegenerate 

simplices of dimensions `m` and `n`, in the product they will 

lead to nondegenerate simplices up to dimension `m+n`, and no 

further. 

 

This extends in the more or less obvious way to products with 

more than two factors: with three factors, a simplex `(s_I 

\sigma, s_J \tau, s_K \rho)` is nondegenerate if `I \cap J 

\cap K` is empty, etc. 

 

If a simplicial set is constructed as a product, the factors 

are recorded and are accessible via the method 

:meth:`Factors.factors`. If it is constructed as a product and then 

copied, this information is lost. 

 

EXAMPLES:: 

 

sage: from sage.homology.simplicial_set import AbstractSimplex, SimplicialSet 

sage: v = AbstractSimplex(0, name='v') 

sage: w = AbstractSimplex(0, name='w') 

sage: e = AbstractSimplex(1, name='e') 

sage: X = SimplicialSet({e: (v, w)}) 

sage: square = X.product(X) 

 

``square`` is now the standard triangulation of the square: 4 

vertices, 5 edges (the four on the border plus the diagonal), 

2 triangles:: 

 

sage: square.f_vector() 

[4, 5, 2] 

 

sage: S1 = simplicial_sets.Sphere(1) 

sage: T = S1.product(S1) 

sage: T.homology(reduced=False) 

{0: Z, 1: Z x Z, 2: Z} 

 

Since ``S1`` is pointed, so is ``T``:: 

 

sage: S1.is_pointed() 

True 

sage: S1.base_point() 

v_0 

sage: T.is_pointed() 

True 

sage: T.base_point() 

(v_0, v_0) 

 

sage: S2 = simplicial_sets.Sphere(2) 

sage: S3 = simplicial_sets.Sphere(3) 

sage: Z = S2.product(S3) 

sage: Z.homology() 

{0: 0, 1: 0, 2: Z, 3: Z, 4: 0, 5: Z} 

 

Products involving infinite simplicial sets:: 

 

sage: B = simplicial_sets.ClassifyingSpace(groups.misc.MultiplicativeAbelian([2])) 

sage: B.rename('RP^oo') 

sage: X = B.product(B) 

sage: X 

RP^oo x RP^oo 

sage: X.n_cells(1) 

[(f, f), (f, s_0 1), (s_0 1, f)] 

sage: X.homology(range(3), base_ring=GF(2)) 

{0: Vector space of dimension 0 over Finite Field of size 2, 

1: Vector space of dimension 2 over Finite Field of size 2, 

2: Vector space of dimension 3 over Finite Field of size 2} 

sage: Y = B.product(S2) 

sage: Y.homology(range(5), base_ring=GF(2)) 

{0: Vector space of dimension 0 over Finite Field of size 2, 

1: Vector space of dimension 1 over Finite Field of size 2, 

2: Vector space of dimension 2 over Finite Field of size 2, 

3: Vector space of dimension 2 over Finite Field of size 2, 

4: Vector space of dimension 2 over Finite Field of size 2} 

""" 

PullbackOfSimplicialSets.__init__(self, [space.constant_map() 

for space in factors]) 

self._factors = factors 

 

def n_skeleton(self, n): 

""" 

Return the `n`-skeleton of this simplicial set. 

 

That is, the simplicial set generated by all nondegenerate 

simplices of dimension at most `n`. 

 

INPUT: 

 

- ``n`` -- the dimension 

 

In the finite case, this returns the ordinary `n`-skeleton. In 

the infinite case, it computes the `n`-skeleton of the product 

of the `n`-skeleta of the factors. 

 

EXAMPLES:: 

 

sage: S2 = simplicial_sets.Sphere(2) 

sage: S3 = simplicial_sets.Sphere(3) 

sage: S2.product(S3).n_skeleton(2) 

Simplicial set with 2 non-degenerate simplices 

sage: B = simplicial_sets.ClassifyingSpace(groups.misc.MultiplicativeAbelian([2])) 

sage: X = B.product(B) 

sage: X.n_skeleton(2) 

Simplicial set with 13 non-degenerate simplices 

""" 

n_skel = SimplicialSet_finite.n_skeleton 

if self.is_finite(): 

n_skel = SimplicialSet_finite.n_skeleton 

return n_skel(self, n) 

start, skel = self._n_skeleton 

if start == n: 

return skel 

elif start > n: 

return skel.n_skeleton(n) 

ans = n_skel(ProductOfSimplicialSets_finite([X.n_skeleton(n) for X in self._factors]), n) 

self._n_skeleton = (n, ans) 

return ans 

 

def factor(self, i, as_subset=False): 

r""" 

Return the $i$-th factor of the product. 

 

INPUT: 

 

- ``i`` -- integer, the index of the factor 

 

- ``as_subset`` -- boolean, optional (default ``False``) 

 

If ``as_subset`` is ``True``, return the $i$-th factor as a 

subsimplicial set of the product, identifying it with its 

product with the base point in each other factor. As a 

subsimplicial set, it comes equipped with an inclusion 

map. This option will raise an error if any factor does not 

have a base point. 

 

If ``as_subset`` is ``False``, return the $i$-th factor in 

its original form as a simplicial set. 

 

EXAMPLES:: 

 

sage: S2 = simplicial_sets.Sphere(2) 

sage: S3 = simplicial_sets.Sphere(3) 

sage: K = S2.product(S3) 

sage: K.factor(0) 

S^2 

 

sage: K.factor(0, as_subset=True) 

Simplicial set with 2 non-degenerate simplices 

sage: K.factor(0, as_subset=True).homology() 

{0: 0, 1: 0, 2: Z} 

 

sage: K.factor(0) is S2 

True 

sage: K.factor(0, as_subset=True) is S2 

False 

""" 

if as_subset: 

if any(not _.is_pointed() for _ in self.factors()): 

raise ValueError('"as_subset=True" is only valid ' 

'if each factor is pointed') 

 

basept_factors = [sset.base_point() for sset in self.factors()] 

basept_factors = basept_factors[:i] + basept_factors[i+1:] 

to_factors = dict((v,k) for k,v in self._translation) 

simps = [] 

for x in self.nondegenerate_simplices(): 

simplices = [sigma[0] for sigma in to_factors[x]] 

if simplices[:i] + simplices[i+1:] == basept_factors: 

simps.append(x) 

return self.subsimplicial_set(simps) 

return self.factors()[i] 

 

def _repr_(self): 

""" 

Print representation 

 

EXAMPLES:: 

 

sage: S2 = simplicial_sets.Sphere(2) 

sage: K = simplicial_sets.KleinBottle() 

sage: B = simplicial_sets.ClassifyingSpace(groups.misc.MultiplicativeAbelian([2])) 

sage: S2.product(S2) 

S^2 x S^2 

sage: S2.product(K, B) 

S^2 x Klein bottle x Classifying space of Multiplicative Abelian group isomorphic to C2 

""" 

return ' x '.join([str(X) for X in self._factors]) 

 

def _latex_(self): 

""" 

LaTeX representation 

 

EXAMPLES:: 

 

sage: S2 = simplicial_sets.Sphere(2) 

sage: latex(S2.product(S2)) 

S^{2} \times S^{2} 

sage: RPoo = simplicial_sets.RealProjectiveSpace(Infinity) 

sage: latex(S2.product(RPoo, S2)) 

S^{2} \times RP^{\infty} \times S^{2} 

""" 

return ' \\times '.join([latex(X) for X in self._factors]) 

 

 

class ProductOfSimplicialSets_finite(ProductOfSimplicialSets, PullbackOfSimplicialSets_finite): 

r""" 

The product of finite simplicial sets. 

 

When the factors are all finite, there are more methods available 

for the resulting product, as compared to products with infinite 

factors: projection maps, the wedge as a subcomplex, and the fat 

wedge as a subcomplex. See :meth:`projection_map`, 

:meth:`wedge_as_subset`, and :meth:`fat_wedge_as_subset` 

""" 

def __init__(self, factors=None): 

r""" 

Return the product of finite simplicial sets. 

 

See :class:`ProductOfSimplicialSets` for more information. 

 

EXAMPLES:: 

 

sage: from sage.homology.simplicial_set import AbstractSimplex, SimplicialSet 

sage: v = AbstractSimplex(0, name='v') 

sage: e = AbstractSimplex(1) 

sage: X = SimplicialSet({e: (v, v)}) 

sage: W = X.product(X, X) 

sage: W.homology() 

{0: 0, 1: Z x Z x Z, 2: Z x Z x Z, 3: Z} 

sage: W.is_pointed() 

False 

 

sage: X = X.set_base_point(v) 

sage: w = AbstractSimplex(0, name='w') 

sage: f = AbstractSimplex(1) 

sage: Y = SimplicialSet({f: (v,w)}, base_point=w) 

sage: Z = Y.product(X) 

sage: Z.is_pointed() 

True 

sage: Z.base_point() 

(w, v) 

""" 

PullbackOfSimplicialSets_finite.__init__(self, [space.constant_map() 

for space in factors]) 

self._factors = tuple([f.domain() for f in self._maps]) 

 

def projection_map(self, i): 

""" 

Return the map projecting onto the $i$-th factor. 

 

INPUT: 

 

- ``i`` -- integer, the index of the projection map 

 

EXAMPLES:: 

 

sage: T = simplicial_sets.Torus() 

sage: f_0 = T.projection_map(0) 

sage: f_1 = T.projection_map(1) 

sage: m_0 = f_0.induced_homology_morphism().to_matrix(1) # matrix in dim 1 

sage: m_1 = f_1.induced_homology_morphism().to_matrix(1) 

sage: m_0.rank() 

1 

sage: m_0 == m_1 

False 

""" 

return self.structure_map(i) 

 

def wedge_as_subset(self): 

""" 

Return the wedge as a subsimplicial set of this product of pointed 

simplicial sets. 

 

This will raise an error if any factor is not pointed. 

 

EXAMPLES:: 

 

sage: from sage.homology.simplicial_set import AbstractSimplex, SimplicialSet 

sage: v = AbstractSimplex(0, name='v') 

sage: e = AbstractSimplex(1, name='e') 

sage: w = AbstractSimplex(0, name='w') 

sage: f = AbstractSimplex(1, name='f') 

sage: X = SimplicialSet({e: (v, v)}, base_point=v) 

sage: Y = SimplicialSet({f: (w, w)}, base_point=w) 

sage: P = X.product(Y) 

sage: W = P.wedge_as_subset() 

sage: W.nondegenerate_simplices() 

[(v, w), (e, s_0 w), (s_0 v, f)] 

sage: W.homology() 

{0: 0, 1: Z x Z} 

""" 

basept_factors = [sset.base_point() for sset in self.factors()] 

to_factors = dict((v,k) for k,v in self._translation) 

simps = [] 

for x in self.nondegenerate_simplices(): 

simplices = to_factors[x] 

not_base_pt = 0 

for sigma, star in zip(simplices, basept_factors): 

if not_base_pt > 1: 

continue 

if sigma[0].nondegenerate() != star: 

not_base_pt += 1 

if not_base_pt <= 1: 

simps.append(x) 

return self.subsimplicial_set(simps) 

 

def fat_wedge_as_subset(self): 

""" 

Return the fat wedge as a subsimplicial set of this product of 

pointed simplicial sets. 

 

The fat wedge consists of those terms where at least one 

factor is the base point. Thus with two factors this is the 

ordinary wedge, but with more factors, it is larger. 

 

EXAMPLES:: 

 

sage: S1 = simplicial_sets.Sphere(1) 

sage: X = S1.product(S1, S1) 

sage: W = X.fat_wedge_as_subset() 

sage: W.homology() 

{0: 0, 1: Z x Z x Z, 2: Z x Z x Z} 

""" 

basept_factors = [sset.base_point() for sset in self.factors()] 

to_factors = dict((v,k) for k,v in self._translation) 

N = len(basept_factors) 

simps = [] 

for x in self.nondegenerate_simplices(): 

simplices = to_factors[x] 

combined = zip(simplices, basept_factors) 

if any(sigma[0] == pt for (sigma,pt) in combined): 

simps.append(x) 

return self.subsimplicial_set(simps) 

 

 

class PushoutOfSimplicialSets(SimplicialSet_arbitrary, UniqueRepresentation): 

@staticmethod 

def __classcall_private__(cls, maps=None, vertex_name=None): 

""" 

TESTS:: 

 

sage: from sage.homology.simplicial_set_constructions import PushoutOfSimplicialSets 

sage: S2 = simplicial_sets.Sphere(2) 

sage: one = S2.Hom(S2).identity() 

sage: PushoutOfSimplicialSets([one, one]) == PushoutOfSimplicialSets((one, one)) 

True 

""" 

if maps: 

return super(PushoutOfSimplicialSets, cls).__classcall__(cls, maps=tuple(maps), 

vertex_name=vertex_name) 

return super(PushoutOfSimplicialSets, cls).__classcall__(cls, vertex_name=vertex_name) 

 

def __init__(self, maps=None, vertex_name=None): 

r""" 

Return the pushout obtained from the morphisms ``maps``. 

 

INPUT: 

 

- ``maps`` -- a list or tuple of morphisms of simplicial sets 

- ``vertex_name`` -- optional, default ``None`` 

 

If only a single map `f: X \to Y` is given, then return 

`Y`. If no maps are given, return the empty simplicial 

set. Otherwise, given a simplicial set `X` and maps `f_i: X 

\to Y_i` for `0 \leq i \leq m`, construct the pushout `P`: see 

:wikipedia:`Pushout_(category_theory)`. This is constructed as 

pushouts of sets for each set of `n`-simplices, so `P_n` is 

the disjoint union of the sets `(Y_i)_n`, with elements 

`f_i(x)` identified for `n`-simplex `x` in `X`. 

 

Simplices in the pushout are given names as follows: if a 

simplex comes from a single `Y_i`, it inherits its 

name. Otherwise it must come from a simplex (or several) in 

`X`, and then it inherits one of those names, and it should be 

the first alphabetically. For example, if vertices `v`, `w`, 

and `z` in `X` are glued together, then the resulting vertex 

in the pushout will be called `v`. 

 

Base points are taken care of automatically: if each of the 

maps `f_i` is pointed, so is the pushout. If `X` is a point or 

if `X` is nonempty and any of the spaces `Y_i` is a point, use 

those for the base point. In all of these cases, if 

``vertex_name`` is ``None``, generate the name of the base 

point automatically; otherwise, use ``vertex_name`` for its 

name. 

 

In all other cases, the pushout is not pointed. 

 

EXAMPLES:: 

 

sage: from sage.homology.simplicial_set import AbstractSimplex, SimplicialSet 

sage: v = AbstractSimplex(0, name='v') 

sage: a = AbstractSimplex(0, name='a') 

sage: b = AbstractSimplex(0, name='b') 

sage: c = AbstractSimplex(0, name='c') 

sage: e0 = AbstractSimplex(1, name='e_0') 

sage: e1 = AbstractSimplex(1, name='e_1') 

sage: e2 = AbstractSimplex(1, name='e_2') 

sage: X = SimplicialSet({e2: (b, a)}) 

sage: Y0 = SimplicialSet({e2: (b,a), e0: (c,b), e1: (c,a)}) 

sage: Y1 = simplicial_sets.Simplex(0) 

sage: f0_data = {a:a, b:b, e2: e2} 

sage: v = Y1.n_cells(0)[0] 

sage: f1_data = {a:v, b:v, e2:v.apply_degeneracies(0)} 

sage: f0 = X.Hom(Y0)(f0_data) 

sage: f1 = X.Hom(Y1)(f1_data) 

sage: P = X.pushout(f0, f1) 

sage: P.nondegenerate_simplices() 

[a, c, e_0, e_1] 

 

There are defining maps `f_i: X \to Y_i` and structure maps 

`\bar{f}_i: Y_i \to P`; the latter are only implemented in 

Sage when each `Y_i` is finite. :: 

 

sage: P.defining_map(0) == f0 

True 

sage: P.structure_map(1) 

Simplicial set morphism: 

From: 0-simplex 

To: Pushout of maps: 

Simplicial set morphism: 

From: Simplicial set with 3 non-degenerate simplices 

To: Simplicial set with 6 non-degenerate simplices 

Defn: [a, b, e_2] --> [a, b, e_2] 

Simplicial set morphism: 

From: Simplicial set with 3 non-degenerate simplices 

To: 0-simplex 

Defn: Constant map at (0,) 

Defn: Constant map at a 

sage: P.structure_map(0).domain() == Y0 

True 

sage: P.structure_map(0).codomain() == P 

True 

 

An inefficient way of constructing a suspension for an 

unpointed set: take the pushout of two copies of the inclusion 

map `X \to CX`:: 

 

sage: T = simplicial_sets.Torus() 

sage: T = T.unset_base_point() 

sage: CT = T.cone() 

sage: inc = CT.base_as_subset().inclusion_map() 

sage: P = T.pushout(inc, inc) 

sage: P.homology() 

{0: 0, 1: 0, 2: Z x Z, 3: Z} 

sage: len(P.nondegenerate_simplices()) 

20 

 

It is more efficient to construct the suspension as the 

quotient `CX/X`:: 

 

sage: len(CT.quotient(CT.base_as_subset()).nondegenerate_simplices()) 

8 

 

It is more efficient still if the original simplicial set has 

a base point:: 

 

sage: T = simplicial_sets.Torus() 

sage: len(T.suspension().nondegenerate_simplices()) 

6 

 

sage: S1 = simplicial_sets.Sphere(1) 

sage: pt = simplicial_sets.Point() 

sage: bouquet = pt.pushout(S1.base_point_map(), S1.base_point_map(), S1.base_point_map()) 

sage: bouquet.homology(1) 

Z x Z x Z 

""" 

# Import this here to prevent circular imports. 

from sage.homology.simplicial_set_morphism import SimplicialSetMorphism 

if maps and any(not isinstance(f, SimplicialSetMorphism) for f in maps): 

raise ValueError('the maps must be morphisms of simplicial sets') 

Cat = SimplicialSets() 

if maps: 

if all(f.codomain().is_finite() for f in maps): 

Cat = Cat.Finite() 

if all(f.is_pointed() for f in maps): 

Cat = Cat.Pointed() 

Parent.__init__(self, category=Cat) 

self._maps = maps 

self._n_skeleton = (-1, Empty()) 

self._vertex_name = vertex_name 

 

def n_skeleton(self, n): 

""" 

Return the `n`-skeleton of this simplicial set. 

 

That is, the simplicial set generated by all nondegenerate 

simplices of dimension at most `n`. 

 

INPUT: 

 

- ``n`` -- the dimension 

 

The `n`-skeleton of the pushout is computed as the pushout 

of the `n`-skeleta of the component simplicial sets. 

 

EXAMPLES:: 

 

sage: B = simplicial_sets.ClassifyingSpace(groups.misc.MultiplicativeAbelian([2])) 

sage: K = B.n_skeleton(3) 

sage: Q = K.pushout(K.inclusion_map(), K.constant_map()) 

sage: Q.n_skeleton(5).homology() 

{0: 0, 1: 0, 2: 0, 3: 0, 4: Z, 5: Z} 

 

Of course, computing the `n`-skeleton and then taking homology 

need not yield the same answer as asking for homology through 

dimension `n`, since the latter computation will use the 

`(n+1)`-skeleton:: 

 

sage: Q.homology(range(6)) 

{0: 0, 1: 0, 2: 0, 3: 0, 4: Z, 5: C2} 

""" 

if self.is_finite(): 

maps = self._maps 

if maps: 

domain = SimplicialSet_finite.n_skeleton(maps[0].domain(), n) 

codomains = [SimplicialSet_finite.n_skeleton(f.codomain(), n) for f in maps] 

new_maps = [f.n_skeleton(n, domain, c) for (f, c) in zip(maps, codomains)] 

return PushoutOfSimplicialSets_finite(new_maps, 

vertex_name=self._vertex_name) 

return PushoutOfSimplicialSets_finite(maps, 

vertex_name=self._vertex_name) 

start, skel = self._n_skeleton 

if start == n: 

return skel 

elif start > n: 

return skel.n_skeleton(n) 

ans = PushoutOfSimplicialSets_finite([f.n_skeleton(n) for f in self._maps], 

vertex_name=self._vertex_name) 

self._n_skeleton = (n, ans) 

return ans 

 

def defining_map(self, i): 

r""" 

Return the `i`-th map defining the pushout. 

 

INPUT: 

 

- ``i`` -- integer 

 

If this pushout was constructed as ``X.pushout(f_0, f_1, ...)``, 

this returns `f_i`. 

 

EXAMPLES:: 

 

sage: S1 = simplicial_sets.Sphere(1) 

sage: T = simplicial_sets.Torus() 

sage: X = S1.wedge(T) # a pushout 

sage: X.defining_map(0) 

Simplicial set morphism: 

From: Point 

To: S^1 

Defn: Constant map at v_0 

sage: X.defining_map(1).domain() 

Point 

sage: X.defining_map(1).codomain() 

Torus 

""" 

return self._maps[i] 

 

def _repr_(self): 

""" 

Print representation 

 

EXAMPLES:: 

 

sage: S2 = simplicial_sets.Sphere(2) 

sage: S3 = simplicial_sets.Sphere(3) 

sage: pt = simplicial_sets.Point() 

sage: pt.pushout(S2.base_point_map(), S3.base_point_map()) 

Pushout of maps: 

Simplicial set morphism: 

From: Point 

To: S^2 

Defn: Constant map at v_0 

Simplicial set morphism: 

From: Point 

To: S^3 

Defn: Constant map at v_0 

""" 

if not self._maps: 

return 'Empty simplicial set' 

s = 'Pushout of maps:' 

for f in self._maps: 

t = '\n' + str(f) 

s += t.replace('\n', '\n ') 

return s 

 

 

class PushoutOfSimplicialSets_finite(PushoutOfSimplicialSets, SimplicialSet_finite): 

""" 

The pushout of finite simplicial sets obtained from ``maps``. 

 

When the simplicial sets involved are all finite, there are more 

methods available to the resulting pushout, as compared to case 

when some of the components are infinite: the structure maps to the 

pushout and the pushout's universal property: see 

:meth:`structure_map` and :meth:`universal_property`. 

""" 

@staticmethod 

def __classcall_private__(cls, maps=None, vertex_name=None): 

""" 

TESTS:: 

 

sage: from sage.homology.simplicial_set_constructions import PushoutOfSimplicialSets_finite 

sage: S2 = simplicial_sets.Sphere(2) 

sage: one = S2.Hom(S2).identity() 

sage: PushoutOfSimplicialSets_finite([one, one]) == PushoutOfSimplicialSets_finite((one, one)) 

True 

""" 

if maps: 

return super(PushoutOfSimplicialSets_finite, cls).__classcall__(cls, maps=tuple(maps), 

vertex_name=vertex_name) 

return super(PushoutOfSimplicialSets_finite, cls).__classcall__(cls, vertex_name=vertex_name) 

 

def __init__(self, maps=None, vertex_name=None): 

r""" 

Return the pushout obtained from the morphisms ``maps``. 

 

See :class:`PushoutOfSimplicialSets` for more information. 

 

INPUT: 

 

- ``maps`` -- a list or tuple of morphisms of simplicial sets 

- ``vertex_name`` -- optional, default ``None`` 

 

EXAMPLES:: 

 

sage: from sage.homology.simplicial_set_constructions import PushoutOfSimplicialSets_finite 

sage: T = simplicial_sets.Torus() 

sage: S2 = simplicial_sets.Sphere(2) 

sage: PushoutOfSimplicialSets_finite([T.base_point_map(), S2.base_point_map()]).n_cells(0)[0] 

* 

sage: PushoutOfSimplicialSets_finite([T.base_point_map(), S2.base_point_map()], vertex_name='v').n_cells(0)[0] 

v 

""" 

# Import this here to prevent circular imports. 

from sage.homology.simplicial_set_morphism import SimplicialSetMorphism 

if maps and any(not isinstance(f, SimplicialSetMorphism) for f in maps): 

raise ValueError('the maps must be morphisms of simplicial sets') 

if not maps: 

SimplicialSet_finite.__init__(self, {}) 

self._maps = () 

self._structure = () 

return 

domain = maps[0].domain() 

if len(maps) == 1: 

# f: X --> Y 

f = maps[0] 

codomain = f.codomain() 

if f.is_pointed(): 

base_point=codomain.base_point() 

if vertex_name is not None: 

base_point.rename(vertex_name) 

SimplicialSet_finite.__init__(self, codomain.face_data(), 

base_point=base_point) 

elif len(domain.nondegenerate_simplices()) == 1: 

# X is a point. 

base_point = f(domain().n_cells(0)[0]) 

if vertex_name is not None: 

base_point.rename(vertex_name) 

SimplicialSet_finite.__init__(self, codomain.face_data(), 

base_point=base_point) 

elif len(codomain.nondegenerate_simplices()) == 1: 

# Y is a point. 

base_point = codomain.n_cells(0)[0] 

if vertex_name is not None: 

base_point.rename(vertex_name) 

SimplicialSet_finite.__init__(self, codomain.face_data(), 

base_point=base_point) 

else: 

SimplicialSet_finite.__init__(self, codomain.face_data()) 

self._maps = (f,) 

self._structure = (f,) 

return 

if any(domain != f.domain() for f in maps[1:]): 

raise ValueError('the domains of the maps must be equal') 

# Data to define the pushout: 

data = {} 

codomains = [f.codomain() for f in maps] 

# spaces: indexed list of spaces. Entries are of the form 

# (space, int) where int=-1 for the domain, and for the 

# codomains, int is the corresponding index. 

spaces = [(Y,i-1) for (i,Y) in enumerate([domain] + codomains)] 

# Dictionaries to translate from simplices in domain, 

# codomains to simplices in the pushout. The keys are of the 

# form (space, int). int=-1 for the domain, and for the 

# codomains, int is the corresponding index. 

_to_P = {Y:{} for Y in spaces} 

max_dim = max(Y.dimension() for Y in codomains) 

for n in range(1 + max_dim): 

# Now we impose an equivalence relation on the simplices, 

# setting x equivalent to f_i(x) for each simplex x in X 

# and each defining map f_i. We do this by constructing a 

# graph and finding its connected components: the vertices 

# of the graph are the n-cells of X and the Y_i, and 

# there are edges from x to f_i(x). 

vertices = [] 

for (Y,i) in spaces: 

vertices.extend([(cell,i) for cell in Y.n_cells(n)]) 

edges = [] 

for x in domain.n_cells(n): 

edges.extend([[(x,-1), (f(x),i)] for (i,f) in enumerate(maps)]) 

G = Graph([vertices, edges], format='vertices_and_edges') 

data[n] = [set(_) for _ in G.connected_components()] 

# data is now a dictionary indexed by dimension, and data[n] 

# consists of sets of n-simplices of the domain and the 

# codomains, each set an equivalence class of n-simplices 

# under the gluing. So if any element of one of those sets is 

# degenerate, we can throw the whole thing away. Otherwise, we 

# can choose a representative to compute the faces. 

simplices = {} 

for dim in sorted(data.keys()): 

for s in data[dim]: 

degenerate = any(sigma[0].is_degenerate() for sigma in s) 

if degenerate: 

# Identify the degeneracies involved. 

degens = [] 

for (sigma,j) in s: 

if len(sigma.degeneracies()) > len(degens): 

degens = sigma.degeneracies() 

underlying = sigma 

space = spaces[j+1] 

old = _to_P[space][sigma.nondegenerate()] 

for (sigma,j) in s: 

# Now update the _to_P[space] dictionaries. 

space = spaces[j+1] 

_to_P[space][sigma] = old.apply_degeneracies(*degens) 

else: # nondegenerate 

if len(s) == 1: 

name = str(list(s)[0][0]) 

latex_name = latex(list(s)[0][0]) 

else: 

# Choose a name from a simplex in domain. 

for (sigma,j) in sorted(s): 

if j == -1: 

name = str(sigma) 

latex_name = latex(sigma) 

break 

new = AbstractSimplex(dim, name=name, 

latex_name=latex_name) 

if dim == 0: 

faces = None 

for (sigma,j) in s: 

space = spaces[j+1] 

_to_P[space][sigma] = new 

if dim > 0: 

faces = [_to_P[space][tau.nondegenerate()].apply_degeneracies(*tau.degeneracies()) 

for tau in space[0].faces(sigma)] 

simplices[new] = faces 

 

some_Y_is_pt = False 

if len(domain.nondegenerate_simplices()) > 1: 

# Only investigate this if X is not empty and not a point. 

for (Y,i) in spaces: 

if len(Y.nondegenerate_simplices()) == 1: 

some_Y_is_pt = True 

break 

if len(domain.nondegenerate_simplices()) == 1: 

# X is a point. 

base_point = _to_P[(domain,-1)][domain.n_cells(0)[0]] 

if vertex_name is not None: 

base_point.rename(vertex_name) 

SimplicialSet_finite.__init__(self, simplices, base_point=base_point) 

elif some_Y_is_pt: 

# We found (Y,i) above. 

base_point = _to_P[(Y,i)][Y.n_cells(0)[0]] 

if vertex_name is not None: 

base_point.rename(vertex_name) 

SimplicialSet_finite.__init__(self, simplices, base_point=base_point) 

elif all(f.is_pointed() for f in maps): 

pt = _to_P[(codomains[0],0)][codomains[0].base_point()] 

if any(_to_P[(Y,i)][Y.base_point()] != pt for (Y,i) in spaces[2:]): 

raise ValueError('something unexpected went wrong ' 

'with base points') 

base_point = _to_P[(domain,-1)][domain.base_point()] 

if vertex_name is not None: 

base_point.rename(vertex_name) 

SimplicialSet_finite.__init__(self, simplices, base_point=base_point) 

else: 

SimplicialSet_finite.__init__(self, simplices) 

# The relevant maps: 

self._maps = maps 

self._structure = tuple([Y.Hom(self)(_to_P[(Y,i)]) 

for (Y,i) in spaces[1:]]) 

self._vertex_name = vertex_name 

 

def structure_map(self, i): 

r""" 

Return the $i$-th structure map of the pushout. 

 

INPUT: 

 

- ``i`` -- integer 

 

If this pushout `Z` was constructed as ``X.pushout(f_0, f_1, ...)``, 

where `f_i: X \to Y_i`, then there are structure maps 

`\bar{f}_i: Y_i \to Z`. This method constructs `\bar{f}_i`. 

 

EXAMPLES:: 

 

sage: S1 = simplicial_sets.Sphere(1) 

sage: T = simplicial_sets.Torus() 

sage: X = S1.disjoint_union(T) # a pushout 

sage: X.structure_map(0) 

Simplicial set morphism: 

From: S^1 

To: Disjoint union: (S^1 u Torus) 

Defn: [v_0, sigma_1] --> [v_0, sigma_1] 

sage: X.structure_map(1).domain() 

Torus 

sage: X.structure_map(1).codomain() 

Disjoint union: (S^1 u Torus) 

""" 

return self._structure[i] 

 

def universal_property(self, *maps): 

r""" 

Return the map induced by ``maps`` 

 

INPUT: 

 

- ``maps`` -- maps "factors" `Y_i` forming the pushout to a 

fixed simplicial set `Z`. 

 

If the pushout `P` is formed by maps `f_i: X \to Y_i`, then 

given maps `g_i: Y_i \to Z` such that `g_i f_i = g_j f_j` for 

all `i`, `j`, then there is a unique map `g: P \to Z` making 

the appropriate diagram commute. This constructs that map. 

 

EXAMPLES:: 

 

sage: from sage.homology.simplicial_set import AbstractSimplex, SimplicialSet 

sage: v = AbstractSimplex(0, name='v') 

sage: w = AbstractSimplex(0, name='w') 

sage: x = AbstractSimplex(0, name='x') 

sage: evw = AbstractSimplex(1, name='vw') 

sage: evx = AbstractSimplex(1, name='vx') 

sage: ewx = AbstractSimplex(1, name='wx') 

sage: X = SimplicialSet({evw: (w, v), evx: (x, v)}) 

sage: Y_0 = SimplicialSet({evw: (w, v), evx: (x, v), ewx: (x, w)}) 

sage: Y_1 = SimplicialSet({evx: (x, v)}) 

 

sage: f_0 = Hom(X, Y_0)({v:v, w:w, x:x, evw:evw, evx:evx}) 

sage: f_1 = Hom(X, Y_1)({v:v, w:v, x:x, evw:v.apply_degeneracies(0), evx:evx}) 

sage: P = X.pushout(f_0, f_1) 

 

sage: one = Hom(Y_1, Y_1).identity() 

sage: g = Hom(Y_0, Y_1)({v:v, w:v, x:x, evw:v.apply_degeneracies(0), evx:evx, ewx:evx}) 

sage: P.universal_property(g, one) 

Simplicial set morphism: 

From: Pushout of maps: 

Simplicial set morphism: 

From: Simplicial set with 5 non-degenerate simplices 

To: Simplicial set with 6 non-degenerate simplices 

Defn: [v, w, x, vw, vx] --> [v, w, x, vw, vx] 

Simplicial set morphism: 

From: Simplicial set with 5 non-degenerate simplices 

To: Simplicial set with 3 non-degenerate simplices 

Defn: [v, w, x, vw, vx] --> [v, v, x, s_0 v, vx] 

To: Simplicial set with 3 non-degenerate simplices 

Defn: [v, x, vx, wx] --> [v, x, vx, vx] 

""" 

codomain = maps[0].codomain() 

if any(g.codomain() != codomain for g in maps[1:]): 

raise ValueError('the maps do not all have the same codomain') 

composite = maps[0] * self._maps[0] 

if any(g*f != composite for g,f in zip(maps[1:], self._maps[1:])): 

raise ValueError('the maps are not compatible') 

data = {} 

for i,g in enumerate(maps): 

f_i_dict = self.structure_map(i)._dictionary 

for sigma in f_i_dict: 

tau = f_i_dict[sigma] 

# For sigma_i in Y_i, define the map G by 

# G(\bar{f}_i)(sigma_i) = g_i(sigma_i). 

if tau not in data: 

data[tau] = g(sigma) 

return self.Hom(codomain)(data) 

 

 

class QuotientOfSimplicialSet(PushoutOfSimplicialSets): 

def __init__(self, inclusion, vertex_name='*'): 

r""" 

Return the quotient of a simplicial set by a subsimplicial set. 

 

INPUT: 

 

- ``inclusion`` -- inclusion map of a subcomplex (= 

subsimplicial set) of a simplicial set 

- ``vertex_name`` -- optional, default ``'*'`` 

 

A subcomplex `A` comes equipped with the inclusion map `A \to 

X` to its ambient complex `X`, and this constructs the 

quotient `X/A`, collapsing `A` to a point. The resulting point 

is called ``vertex_name``, which is ``'*'`` by default. 

 

When the simplicial sets involved are finite, there is a 

:meth:`QuotientOfSimplicialSet_finite.quotient_map` method available. 

 

EXAMPLES:: 

 

sage: RP5 = simplicial_sets.RealProjectiveSpace(5) 

sage: RP2 = RP5.n_skeleton(2) 

sage: RP5_2 = RP5.quotient(RP2) 

sage: RP5_2 

Quotient: (RP^5/Simplicial set with 3 non-degenerate simplices) 

sage: RP5_2.quotient_map() 

Simplicial set morphism: 

From: RP^5 

To: Quotient: (RP^5/Simplicial set with 3 non-degenerate simplices) 

Defn: [1, f, f * f, f * f * f, f * f * f * f, f * f * f * f * f] --> [*, s_0 *, s_1 s_0 *, f * f * f, f * f * f * f, f * f * f * f * f] 

""" 

subcomplex = inclusion.domain() 

PushoutOfSimplicialSets.__init__(self, [inclusion, 

subcomplex.constant_map()], 

vertex_name=vertex_name) 

 

ambient = inclusion.codomain() 

if ambient.is_pointed() and ambient.is_finite(): 

if ambient.base_point() not in subcomplex: 

self._basepoint = self.structure_map(0)(ambient.base_point()) 

 

def ambient(self): 

""" 

Return the ambient space. 

 

That is, if this quotient is `K/L`, return `K`. 

 

EXAMPLES:: 

 

sage: RP5 = simplicial_sets.RealProjectiveSpace(5) 

sage: RP2 = RP5.n_skeleton(2) 

sage: RP5_2 = RP5.quotient(RP2) 

sage: RP5_2.ambient() 

RP^5 

 

sage: B = simplicial_sets.ClassifyingSpace(groups.misc.MultiplicativeAbelian([2])) 

sage: K = B.n_skeleton(3) 

sage: Q = B.quotient(K) 

sage: Q.ambient() 

Classifying space of Multiplicative Abelian group isomorphic to C2 

""" 

return self._maps[0].codomain() 

 

def subcomplex(self): 

""" 

Return the subcomplex space associated to this quotient. 

 

That is, if this quotient is `K/L`, return `L`. 

 

EXAMPLES:: 

 

sage: RP5 = simplicial_sets.RealProjectiveSpace(5) 

sage: RP2 = RP5.n_skeleton(2) 

sage: RP5_2 = RP5.quotient(RP2) 

sage: RP5_2.subcomplex() 

Simplicial set with 3 non-degenerate simplices 

 

sage: B = simplicial_sets.ClassifyingSpace(groups.misc.MultiplicativeAbelian([2])) 

sage: K = B.n_skeleton(3) 

sage: Q = B.quotient(K) 

sage: Q.subcomplex() 

Simplicial set with 4 non-degenerate simplices 

""" 

return self._maps[0].domain() 

 

def n_skeleton(self, n): 

""" 

Return the `n`-skeleton of this simplicial set. 

 

That is, the simplicial set generated by all nondegenerate 

simplices of dimension at most `n`. 

 

INPUT: 

 

- ``n`` -- the dimension 

 

The `n`-skeleton of the quotient is computed as the quotient 

of the `n`-skeleta. 

 

EXAMPLES:: 

 

sage: B = simplicial_sets.ClassifyingSpace(groups.misc.MultiplicativeAbelian([2])) 

sage: K = B.n_skeleton(3) 

sage: Q = B.quotient(K) 

sage: Q.n_skeleton(6) 

Quotient: (Simplicial set with 7 non-degenerate simplices/Simplicial set with 4 non-degenerate simplices) 

sage: Q.n_skeleton(6).homology() 

{0: 0, 1: 0, 2: 0, 3: 0, 4: Z, 5: C2, 6: 0} 

""" 

if self.is_finite(): 

ambient = SimplicialSet_finite.n_skeleton(self.ambient(), n) 

subcomplex = SimplicialSet_finite.n_skeleton(self.subcomplex(), n) 

subcomplex = ambient.subsimplicial_set(subcomplex.nondegenerate_simplices()) 

return QuotientOfSimplicialSet_finite(subcomplex.inclusion_map(), 

vertex_name=self._vertex_name) 

start, skel = self._n_skeleton 

if start == n: 

return skel 

elif start > n: 

return skel.n_skeleton(n) 

ambient = self.ambient().n_skeleton(n) 

subcomplex = ambient.subsimplicial_set(self.subcomplex().nondegenerate_simplices(n)) 

ans = QuotientOfSimplicialSet_finite(subcomplex.inclusion_map(), 

vertex_name=self._vertex_name) 

self._n_skeleton = (n, ans) 

return ans 

 

def _repr_(self): 

""" 

Print representation 

 

EXAMPLES:: 

 

sage: T = simplicial_sets.Torus() 

sage: T.quotient(T.n_skeleton(1)) 

Quotient: (Torus/Simplicial set with 4 non-degenerate simplices) 

""" 

return 'Quotient: ({}/{})'.format(self.ambient(), self.subcomplex()) 

 

def _latex_(self): 

""" 

LaTeX representation 

 

EXAMPLES:: 

 

sage: RPoo = simplicial_sets.RealProjectiveSpace(Infinity) 

sage: RP3 = RPoo.n_skeleton(3) 

sage: RP3.rename_latex('RP^{3}') 

sage: latex(RPoo.quotient(RP3)) 

RP^{\infty} / RP^{3} 

""" 

return '{} / {}'.format(latex(self.ambient()), latex(self.subcomplex())) 

 

 

class QuotientOfSimplicialSet_finite(QuotientOfSimplicialSet, 

PushoutOfSimplicialSets_finite): 

""" 

The quotient of finite simplicial sets. 

 

When the simplicial sets involved are finite, there is a 

:meth:`quotient_map` method available. 

""" 

def __init__(self, inclusion, vertex_name='*'): 

r""" 

Return the quotient of a simplicial set by a subsimplicial set. 

 

See :class:`QuotientOfSimplicialSet` for more information. 

 

EXAMPLES:: 

 

sage: RP5 = simplicial_sets.RealProjectiveSpace(5) 

sage: RP2 = RP5.n_skeleton(2) 

sage: RP5_2 = RP5.quotient(RP2) 

sage: RP5_2 

Quotient: (RP^5/Simplicial set with 3 non-degenerate simplices) 

sage: RP5_2.quotient_map() 

Simplicial set morphism: 

From: RP^5 

To: Quotient: (RP^5/Simplicial set with 3 non-degenerate simplices) 

Defn: [1, f, f * f, f * f * f, f * f * f * f, f * f * f * f * f] --> [*, s_0 *, s_1 s_0 *, f * f * f, f * f * f * f, f * f * f * f * f] 

""" 

subcomplex = inclusion.domain() 

PushoutOfSimplicialSets_finite.__init__(self, [inclusion, 

subcomplex.constant_map()], 

vertex_name=vertex_name) 

ambient = inclusion.codomain() 

if ambient.is_pointed(): 

if ambient.base_point() not in subcomplex: 

self._basepoint = self.structure_map(0)(ambient.base_point()) 

 

def quotient_map(self): 

""" 

Return the quotient map from the original simplicial set to the 

quotient. 

 

EXAMPLES:: 

 

sage: K = simplicial_sets.Simplex(1) 

sage: S1 = K.quotient(K.n_skeleton(0)) 

sage: q = S1.quotient_map() 

sage: q 

Simplicial set morphism: 

From: 1-simplex 

To: Quotient: (1-simplex/Simplicial set with 2 non-degenerate simplices) 

Defn: [(0,), (1,), (0, 1)] --> [*, *, (0, 1)] 

sage: q.domain() == K 

True 

sage: q.codomain() == S1 

True 

""" 

return self.structure_map(0) 

 

 

class SmashProductOfSimplicialSets_finite(QuotientOfSimplicialSet_finite, 

Factors): 

@staticmethod 

def __classcall__(cls, factors=None): 

""" 

TESTS:: 

 

sage: from sage.homology.simplicial_set_constructions import SmashProductOfSimplicialSets_finite as Smash 

sage: S2 = simplicial_sets.Sphere(2) 

sage: Smash([S2, S2]) == Smash((S2, S2)) 

True 

""" 

if factors: 

return super(SmashProductOfSimplicialSets_finite, cls).__classcall__(cls, factors=tuple(factors)) 

return super(SmashProductOfSimplicialSets_finite, cls).__classcall__(cls) 

 

def __init__(self, factors=None): 

r""" 

Return the smash product of finite pointed simplicial sets. 

 

INPUT: 

 

- ``factors`` -- a list or tuple of simplicial sets 

 

Return the smash product of the simplicial sets in 

``factors``: the smash product `X \wedge Y` is defined to be 

the quotient `(X \times Y) / (X \vee Y)`, where `X \vee Y` is 

the wedge sum. 

 

Each element of ``factors`` must be finite and pointed. (As of 

July 2016, constructing the wedge as a subcomplex of the 

product is only possible in Sage for finite simplicial sets.) 

 

EXAMPLES:: 

 

sage: T = simplicial_sets.Torus() 

sage: S2 = simplicial_sets.Sphere(2) 

sage: T.smash_product(S2).homology() == T.suspension(2).homology() 

True 

""" 

if any(not space.is_pointed() for space in factors): 

raise ValueError('the simplicial sets must be pointed') 

prod = ProductOfSimplicialSets_finite(factors) 

wedge = prod.wedge_as_subset() 

QuotientOfSimplicialSet_finite.__init__(self, wedge.inclusion_map()) 

self._factors = factors 

 

def _repr_(self): 

""" 

Print representation 

 

EXAMPLES:: 

 

sage: RP4 = simplicial_sets.RealProjectiveSpace(4) 

sage: S1 = simplicial_sets.Sphere(1) 

sage: S1.smash_product(RP4, S1) 

Smash product: (S^1 ^ RP^4 ^ S^1) 

""" 

s = 'Smash product: (' 

s += ' ^ '.join([str(X) for X in self._factors]) 

s += ')' 

return s 

 

def _latex_(self): 

""" 

LaTeX representation 

 

EXAMPLES:: 

 

sage: RP4 = simplicial_sets.RealProjectiveSpace(4) 

sage: S1 = simplicial_sets.Sphere(1) 

sage: latex(S1.smash_product(RP4, S1)) 

S^{1} \wedge RP^{4} \wedge S^{1} 

""" 

return ' \\wedge '.join([latex(X) for X in self._factors]) 

 

 

class WedgeOfSimplicialSets(PushoutOfSimplicialSets, Factors): 

@staticmethod 

def __classcall__(cls, factors=None): 

""" 

TESTS:: 

 

sage: from sage.homology.simplicial_set_constructions import WedgeOfSimplicialSets 

sage: S2 = simplicial_sets.Sphere(2) 

sage: WedgeOfSimplicialSets([S2, S2]) == WedgeOfSimplicialSets((S2, S2)) 

True 

""" 

if factors: 

return super(WedgeOfSimplicialSets, cls).__classcall__(cls, factors=tuple(factors)) 

return super(WedgeOfSimplicialSets, cls).__classcall__(cls) 

 

def __init__(self, factors=None): 

r""" 

Return the wedge sum of pointed simplicial sets. 

 

INPUT: 

 

- ``factors`` -- a list or tuple of simplicial sets 

 

Return the wedge of the simplicial sets in ``factors``: the 

wedge sum `X \vee Y` is formed by taking the disjoint 

union of `X` and `Y` and identifying their base points. In 

this construction, the new base point is renamed '*'. 

 

The wedge comes equipped with maps to and from each factor, or 

actually, maps from each factor, and maps to simplicial sets 

isomorphic to each factor. The codomains of the latter maps 

are quotients of the wedge, not identical to the original 

factors. 

 

EXAMPLES:: 

 

sage: CP2 = simplicial_sets.ComplexProjectiveSpace(2) 

sage: K = simplicial_sets.KleinBottle() 

sage: W = CP2.wedge(K) 

sage: W.homology() 

{0: 0, 1: Z x C2, 2: Z, 3: 0, 4: Z} 

 

sage: W.inclusion_map(1) 

Simplicial set morphism: 

From: Klein bottle 

To: Wedge: (CP^2 v Klein bottle) 

Defn: [Delta_{0,0}, Delta_{1,0}, Delta_{1,1}, Delta_{1,2}, Delta_{2,0}, Delta_{2,1}] --> [*, Delta_{1,0}, Delta_{1,1}, Delta_{1,2}, Delta_{2,0}, Delta_{2,1}] 

 

sage: W.projection_map(0).domain() 

Wedge: (CP^2 v Klein bottle) 

sage: W.projection_map(0).codomain() # copy of CP^2 

Quotient: (Wedge: (CP^2 v Klein bottle)/Simplicial set with 6 non-degenerate simplices) 

sage: W.projection_map(0).codomain().homology() 

{0: 0, 1: 0, 2: Z, 3: 0, 4: Z} 

 

An error occurs if any of the factors is not pointed:: 

 

sage: CP2.wedge(simplicial_sets.Simplex(1)) 

Traceback (most recent call last): 

... 

ValueError: the simplicial sets must be pointed 

""" 

if any(not space.is_pointed() for space in factors): 

raise ValueError('the simplicial sets must be pointed') 

PushoutOfSimplicialSets.__init__(self, [space.base_point_map() 

for space in factors]) 

if factors: 

vertices = PushoutOfSimplicialSets_finite([space.n_skeleton(0).base_point_map() 

for space in factors]) 

self._basepoint = vertices.base_point() 

self.base_point().rename('*') 

self._factors = factors 

 

summands = Factors.factors 

summand = Factors.factor 

 

def _repr_(self): 

""" 

Print representation 

 

EXAMPLES:: 

 

sage: K = simplicial_sets.KleinBottle() 

sage: K.wedge(K, K) 

Wedge: (Klein bottle v Klein bottle v Klein bottle) 

""" 

s = 'Wedge: (' 

s += ' v '.join([str(X) for X in self._factors]) 

s += ')' 

return s 

 

def _latex_(self): 

""" 

LaTeX representation 

 

EXAMPLES:: 

 

sage: RP4 = simplicial_sets.RealProjectiveSpace(4) 

sage: S1 = simplicial_sets.Sphere(1) 

sage: latex(S1.wedge(RP4, S1)) 

S^{1} \vee RP^{4} \vee S^{1} 

""" 

return ' \\vee '.join([latex(X) for X in self._factors]) 

 

 

class WedgeOfSimplicialSets_finite(WedgeOfSimplicialSets, PushoutOfSimplicialSets_finite): 

""" 

The wedge sum of finite pointed simplicial sets. 

""" 

def __init__(self, factors=None): 

r""" 

Return the wedge sum of finite pointed simplicial sets. 

 

INPUT: 

 

- ``factors`` -- a tuple of simplicial sets 

 

If there are no factors, a point is returned. 

 

See :class:`WedgeOfSimplicialSets` for more information. 

 

EXAMPLES:: 

 

sage: from sage.homology.simplicial_set_constructions import WedgeOfSimplicialSets_finite 

sage: K = simplicial_sets.Simplex(3) 

sage: WedgeOfSimplicialSets_finite((K,K)) 

Traceback (most recent call last): 

... 

ValueError: the simplicial sets must be pointed 

""" 

if not factors: 

# An empty wedge is a point, constructed as a pushout. 

PushoutOfSimplicialSets_finite.__init__(self, [Point().identity()]) 

else: 

if any(not space.is_pointed() for space in factors): 

raise ValueError('the simplicial sets must be pointed') 

PushoutOfSimplicialSets_finite.__init__(self, [space.base_point_map() 

for space in factors]) 

self.base_point().rename('*') 

self._factors = factors 

 

def inclusion_map(self, i): 

""" 

Return the inclusion map of the $i$-th factor. 

 

EXAMPLES:: 

 

sage: S1 = simplicial_sets.Sphere(1) 

sage: S2 = simplicial_sets.Sphere(2) 

sage: W = S1.wedge(S2, S1) 

sage: W.inclusion_map(1) 

Simplicial set morphism: 

From: S^2 

To: Wedge: (S^1 v S^2 v S^1) 

Defn: [v_0, sigma_2] --> [*, sigma_2] 

sage: W.inclusion_map(0).domain() 

S^1 

sage: W.inclusion_map(2).domain() 

S^1 

""" 

return self.structure_map(i) 

 

def projection_map(self, i): 

""" 

Return the projection map onto the $i$-th factor. 

 

EXAMPLES:: 

 

sage: S1 = simplicial_sets.Sphere(1) 

sage: S2 = simplicial_sets.Sphere(2) 

sage: W = S1.wedge(S2, S1) 

sage: W.projection_map(1) 

Simplicial set morphism: 

From: Wedge: (S^1 v S^2 v S^1) 

To: Quotient: (Wedge: (S^1 v S^2 v S^1)/Simplicial set with 3 non-degenerate simplices) 

Defn: [*, sigma_1, sigma_1, sigma_2] --> [*, s_0 *, s_0 *, sigma_2] 

sage: W.projection_map(1).image().homology(1) 

0 

sage: W.projection_map(1).image().homology(2) 

Z 

""" 

m = len(self._factors) 

simplices = ([self.inclusion_map(j).image().nondegenerate_simplices() 

for j in range(i)] 

+ [self.inclusion_map(j).image().nondegenerate_simplices() 

for j in range(i+1,m)]) 

return self.quotient(list(itertools.chain(*simplices))).quotient_map() 

 

 

class DisjointUnionOfSimplicialSets(PushoutOfSimplicialSets, Factors): 

@staticmethod 

def __classcall__(cls, factors=None): 

""" 

TESTS:: 

 

sage: from sage.homology.simplicial_set_constructions import DisjointUnionOfSimplicialSets 

sage: from sage.homology.simplicial_set_examples import Empty 

sage: S2 = simplicial_sets.Sphere(2) 

sage: DisjointUnionOfSimplicialSets([S2, S2]) == DisjointUnionOfSimplicialSets((S2, S2)) 

True 

sage: DisjointUnionOfSimplicialSets([S2, Empty(), S2, Empty()]) == DisjointUnionOfSimplicialSets((S2, S2)) 

True 

""" 

if factors: 

# Discard any empty factors. 

factors = [F for F in factors if F != Empty()] 

if factors: 

return super(DisjointUnionOfSimplicialSets, cls).__classcall__(cls, factors=tuple(factors)) 

return super(DisjointUnionOfSimplicialSets, cls).__classcall__(cls) 

 

def __init__(self, factors=None): 

r""" 

Return the disjoint union of simplicial sets. 

 

INPUT: 

 

- ``factors`` -- a list or tuple of simplicial sets 

 

Discard any factors which are empty and return the disjoint 

union of the remaining simplicial sets in ``factors``. The 

disjoint union comes equipped with a map from each factor, as 

long as all of the factors are finite. 

 

EXAMPLES:: 

 

sage: CP2 = simplicial_sets.ComplexProjectiveSpace(2) 

sage: K = simplicial_sets.KleinBottle() 

sage: W = CP2.disjoint_union(K) 

sage: W.homology() 

{0: Z, 1: Z x C2, 2: Z, 3: 0, 4: Z} 

 

sage: W.inclusion_map(1) 

Simplicial set morphism: 

From: Klein bottle 

To: Disjoint union: (CP^2 u Klein bottle) 

Defn: [Delta_{0,0}, Delta_{1,0}, Delta_{1,1}, Delta_{1,2}, Delta_{2,0}, Delta_{2,1}] --> [Delta_{0,0}, Delta_{1,0}, Delta_{1,1}, Delta_{1,2}, Delta_{2,0}, Delta_{2,1}] 

""" 

PushoutOfSimplicialSets.__init__(self, [space._map_from_empty_set() 

for space in factors]) 

self._factors = factors 

self._n_skeleton = (-1, Empty()) 

 

def n_skeleton(self, n): 

""" 

Return the `n`-skeleton of this simplicial set. 

 

That is, the simplicial set generated by all nondegenerate 

simplices of dimension at most `n`. 

 

INPUT: 

 

- ``n`` -- the dimension 

 

The `n`-skeleton of the disjoint union is computed as the 

disjoint union of the `n`-skeleta of the component simplicial 

sets. 

 

EXAMPLES:: 

 

sage: B = simplicial_sets.ClassifyingSpace(groups.misc.MultiplicativeAbelian([2])) 

sage: T = simplicial_sets.Torus() 

sage: X = B.disjoint_union(T) 

sage: X.n_skeleton(3).homology() 

{0: Z, 1: Z x Z x C2, 2: Z, 3: Z} 

""" 

if self.is_finite(): 

return DisjointUnionOfSimplicialSets_finite(tuple([X.n_skeleton(n) 

for X in self._factors])) 

start, skel = self._n_skeleton 

if start == n: 

return skel 

elif start > n: 

return skel.n_skeleton(n) 

ans = DisjointUnionOfSimplicialSets_finite(tuple([X.n_skeleton(n) 

for X in self._factors])) 

self._n_skeleton = (n, ans) 

return ans 

 

summands = Factors.factors 

summand = Factors.factor 

 

def _repr_(self): 

""" 

Print representation 

 

EXAMPLES:: 

 

sage: T = simplicial_sets.Torus() 

sage: RP3 = simplicial_sets.RealProjectiveSpace(3) 

sage: T.disjoint_union(T, RP3) 

Disjoint union: (Torus u Torus u RP^3) 

""" 

s = 'Disjoint union: (' 

s += ' u '.join([str(X) for X in self._factors]) 

s += ')' 

return s 

 

def _latex_(self): 

""" 

LaTeX representation 

 

EXAMPLES:: 

 

sage: RP4 = simplicial_sets.RealProjectiveSpace(4) 

sage: S1 = simplicial_sets.Sphere(1) 

sage: latex(S1.disjoint_union(RP4, S1)) 

S^{1} \amalg RP^{4} \amalg S^{1} 

""" 

return ' \\amalg '.join([latex(X) for X in self._factors]) 

 

 

class DisjointUnionOfSimplicialSets_finite(DisjointUnionOfSimplicialSets, 

PushoutOfSimplicialSets_finite): 

""" 

The disjoint union of finite simplicial sets. 

""" 

def __init__(self, factors=None): 

r""" 

Return the disjoint union of finite simplicial sets. 

 

INPUT: 

 

- ``factors`` -- a tuple of simplicial sets 

 

Return the disjoint union of the simplicial sets in 

``factors``. The disjoint union comes equipped with a map 

from each factor. If there are no factors, this returns the 

empty simplicial set. 

 

EXAMPLES:: 

 

sage: from sage.homology.simplicial_set_constructions import DisjointUnionOfSimplicialSets_finite 

sage: from sage.homology.simplicial_set_examples import Empty 

sage: S = simplicial_sets.Sphere(4) 

sage: DisjointUnionOfSimplicialSets_finite((S,S,S)) 

Disjoint union: (S^4 u S^4 u S^4) 

sage: DisjointUnionOfSimplicialSets_finite([Empty(), Empty()]) == Empty() 

True 

""" 

if not factors: 

PushoutOfSimplicialSets_finite.__init__(self) 

else: 

PushoutOfSimplicialSets_finite.__init__(self, [space._map_from_empty_set() 

for space in factors]) 

self._factors = factors 

 

def inclusion_map(self, i): 

""" 

Return the inclusion map of the $i$-th factor. 

 

EXAMPLES:: 

 

sage: S1 = simplicial_sets.Sphere(1) 

sage: S2 = simplicial_sets.Sphere(2) 

sage: W = S1.disjoint_union(S2, S1) 

sage: W.inclusion_map(1) 

Simplicial set morphism: 

From: S^2 

To: Disjoint union: (S^1 u S^2 u S^1) 

Defn: [v_0, sigma_2] --> [v_0, sigma_2] 

sage: W.inclusion_map(0).domain() 

S^1 

sage: W.inclusion_map(2).domain() 

S^1 

""" 

return self.structure_map(i) 

 

 

class ConeOfSimplicialSet(SimplicialSet_arbitrary, UniqueRepresentation): 

def __init__(self, base): 

r""" 

Return the unreduced cone on a finite simplicial set. 

 

INPUT: 

 

- ``base`` -- return the cone on this simplicial set. 

 

Add a point `*` (which will become the base point) and for 

each simplex `\sigma` in ``base``, add both `\sigma` and a 

simplex made up of `*` and `\sigma` (topologically, form the 

join of `*` and `\sigma`). 

 

EXAMPLES:: 

 

sage: from sage.homology.simplicial_set import AbstractSimplex, SimplicialSet 

sage: v = AbstractSimplex(0, name='v') 

sage: e = AbstractSimplex(1, name='e') 

sage: X = SimplicialSet({e: (v, v)}) 

sage: CX = X.cone() # indirect doctest 

sage: CX.nondegenerate_simplices() 

[*, v, (v,*), e, (e,*)] 

sage: CX.base_point() 

* 

""" 

Cat = SimplicialSets().Pointed() 

if base.is_finite(): 

Cat = Cat.Finite() 

Parent.__init__(self, category=Cat) 

star = AbstractSimplex(0, name='*') 

self._base = base 

self._basepoint = star 

self._n_skeleton = (-1, Empty()) 

 

def n_skeleton(self, n): 

""" 

Return the `n`-skeleton of this simplicial set. 

 

That is, the simplicial set generated by all nondegenerate 

simplices of dimension at most `n`. 

 

INPUT: 

 

- ``n`` -- the dimension 

 

In the case when the cone is infinite, the `n`-skeleton of the 

cone is computed as the `n`-skeleton of the cone of the 

`n`-skeleton. 

 

EXAMPLES:: 

 

sage: B = simplicial_sets.ClassifyingSpace(groups.misc.MultiplicativeAbelian([2])) 

sage: X = B.disjoint_union(B) 

sage: CX = B.cone() 

sage: CX.n_skeleton(3).homology() 

{0: 0, 1: 0, 2: 0, 3: Z} 

""" 

if self.is_finite(): 

return SimplicialSet_finite.n_skeleton(self, n) 

start, skel = self._n_skeleton 

if start == n: 

return skel 

elif start > n: 

return skel.n_skeleton(n) 

ans = ConeOfSimplicialSet_finite(self._base.n_skeleton(n)).n_skeleton(n) 

self._n_skeleton = (n, ans) 

self._basepoint = ans.base_point() 

return ans 

 

def _repr_(self): 

""" 

Print representation 

 

EXAMPLES:: 

 

sage: simplicial_sets.Simplex(3).cone() 

Cone of 3-simplex 

""" 

return 'Cone of {}'.format(self._base) 

 

def _latex_(self): 

""" 

LaTeX representation 

 

EXAMPLES:: 

 

sage: latex(simplicial_sets.Simplex(3).cone()) 

C \Delta^{3} 

""" 

return 'C {}'.format(latex(self._base)) 

 

 

class ConeOfSimplicialSet_finite(ConeOfSimplicialSet, SimplicialSet_finite): 

def __init__(self, base): 

r""" 

Return the unreduced cone on a finite simplicial set. 

 

INPUT: 

 

- ``base`` -- return the cone on this simplicial set. 

 

Add a point `*` (which will become the base point) and for 

each simplex `\sigma` in ``base``, add both `\sigma` and a 

simplex made up of `*` and `\sigma` (topologically, form the 

join of `*` and `\sigma`). 

 

EXAMPLES:: 

 

sage: from sage.homology.simplicial_set import AbstractSimplex, SimplicialSet 

sage: v = AbstractSimplex(0, name='v') 

sage: e = AbstractSimplex(1, name='e') 

sage: X = SimplicialSet({e: (v, v)}) 

sage: CX = X.cone() # indirect doctest 

sage: CX.nondegenerate_simplices() 

[*, v, (v,*), e, (e,*)] 

sage: CX.base_point() 

* 

""" 

star = AbstractSimplex(0, name='*') 

data = {} 

data[star] = None 

# Dictionary for translating old simplices to new: keys are 

# old simplices, corresponding value is the new simplex 

# (sigma, *). 

new_simplices = {'cone': star} 

for sigma in base.nondegenerate_simplices(): 

new = AbstractSimplex(sigma.dimension()+1, 

name='({},*)'.format(sigma), 

latex_name='({},*)'.format(latex(sigma))) 

if sigma.dimension() == 0: 

data[sigma] = None 

data[new] = (star, sigma) 

else: 

sigma_faces = base.face_data()[sigma] 

data[sigma] = sigma_faces 

new_faces = [new_simplices[face.nondegenerate()].apply_degeneracies(*face.degeneracies()) 

for face in sigma_faces] 

data[new] = (new_faces + [sigma]) 

new_simplices[sigma] = new 

SimplicialSet_finite.__init__(self, data, base_point=star) 

# self._base: original simplicial set. 

self._base = base 

# self._joins: dictionary, each key is a simplex sigma in 

# base, the corresponding value is the new simplex (sigma, *) 

# in the cone. Also, one other key is 'cone', and the value is 

# the cone vertex. This is used in the suspension class to 

# construct the suspension of a morphism. It could be used to 

# construct the cone of a morphism, also, although cones of 

# morphisms are not yet implemented. 

self._joins = new_simplices 

 

def base_as_subset(self): 

""" 

If this is the cone `CX` on `X`, return `X` as a subsimplicial set. 

 

EXAMPLES:: 

 

sage: X = simplicial_sets.RealProjectiveSpace(4).unset_base_point() 

sage: Y = X.cone() 

sage: Y.base_as_subset() 

Simplicial set with 5 non-degenerate simplices 

sage: Y.base_as_subset() == X 

True 

""" 

X = self._base 

return self.subsimplicial_set(X.nondegenerate_simplices()) 

 

def map_from_base(self): 

r""" 

If this is the cone `CX` on `X`, return the inclusion map from `X`. 

 

EXAMPLES:: 

 

sage: X = simplicial_sets.Simplex(2).n_skeleton(1) 

sage: Y = X.cone() 

sage: Y.map_from_base() 

Simplicial set morphism: 

From: Simplicial set with 6 non-degenerate simplices 

To: Cone of Simplicial set with 6 non-degenerate simplices 

Defn: [(0,), (1,), (2,), (0, 1), (0, 2), (1, 2)] --> [(0,), (1,), (2,), (0, 1), (0, 2), (1, 2)] 

""" 

return self.base_as_subset().inclusion_map() 

 

 

class ReducedConeOfSimplicialSet(QuotientOfSimplicialSet): 

def __init__(self, base): 

r""" 

Return the reduced cone on a simplicial set. 

 

INPUT: 

 

- ``base`` -- return the cone on this simplicial set. 

 

Start with the unreduced cone: take ``base`` and add a point 

`*` (which will become the base point) and for each simplex 

`\sigma` in ``base``, add both `\sigma` and a simplex made up 

of `*` and `\sigma` (topologically, form the join of `*` and 

`\sigma`). 

 

Now reduce: take the quotient by the 1-simplex connecting the 

old base point to the new one. 

 

EXAMPLES:: 

 

sage: from sage.homology.simplicial_set import AbstractSimplex, SimplicialSet 

sage: v = AbstractSimplex(0, name='v') 

sage: e = AbstractSimplex(1, name='e') 

sage: X = SimplicialSet({e: (v, v)}) 

sage: X = X.set_base_point(v) 

sage: CX = X.cone() # indirect doctest 

sage: CX.nondegenerate_simplices() 

[*, e, (e,*)] 

""" 

C = ConeOfSimplicialSet(base) 

edge_faces = sorted([C.n_skeleton(1).base_point(), base.base_point()]) 

for t in C.n_cells(1): 

edge_faces = sorted([C.base_point(), base.base_point()]) 

if sorted(C.faces(t)) == edge_faces: 

edge = t 

break 

inc = C.subsimplicial_set([edge]).inclusion_map() 

QuotientOfSimplicialSet.__init__(self, inc) 

self._base = base 

self._n_skeleton = (-1, Empty()) 

 

def n_skeleton(self, n): 

""" 

Return the `n`-skeleton of this simplicial set. 

 

That is, the simplicial set generated by all nondegenerate 

simplices of dimension at most `n`. 

 

INPUT: 

 

- ``n`` -- the dimension 

 

In the case when the cone is infinite, the `n`-skeleton of the 

cone is computed as the `n`-skeleton of the cone of the 

`n`-skeleton. 

 

EXAMPLES:: 

 

sage: B = simplicial_sets.ClassifyingSpace(groups.misc.MultiplicativeAbelian([2])) 

sage: B.cone().n_skeleton(3).homology() 

{0: 0, 1: 0, 2: 0, 3: Z} 

""" 

if self.is_finite(): 

return SimplicialSet_finite.n_skeleton(self, n) 

start, skel = self._n_skeleton 

if start == n: 

return skel 

elif start > n: 

return skel.n_skeleton(n) 

ans = ReducedConeOfSimplicialSet_finite(self._base.n_skeleton(n)).n_skeleton(n) 

self._n_skeleton = (n, ans) 

return ans 

 

def _repr_(self): 

""" 

Print representation 

 

EXAMPLES:: 

 

sage: X = simplicial_sets.Sphere(4) 

sage: X.cone() 

Reduced cone of S^4 

""" 

return 'Reduced cone of {}'.format(self._base) 

 

def _latex_(self): 

""" 

LaTeX representation 

 

EXAMPLES:: 

 

sage: latex(simplicial_sets.Sphere(4).cone()) 

C S^{4} 

""" 

return 'C {}'.format(latex(self._base)) 

 

 

class ReducedConeOfSimplicialSet_finite(ReducedConeOfSimplicialSet, 

QuotientOfSimplicialSet_finite): 

def __init__(self, base): 

r""" 

Return the reduced cone on a simplicial set. 

 

INPUT: 

 

- ``base`` -- return the cone on this simplicial set. 

 

Start with the unreduced cone: take ``base`` and add a point 

`*` (which will become the base point) and for each simplex 

`\sigma` in ``base``, add both `\sigma` and a simplex made up 

of `*` and `\sigma` (topologically, form the join of `*` and 

`\sigma`). 

 

Now reduce: take the quotient by the 1-simplex connecting the 

old base point to the new one. 

 

EXAMPLES:: 

 

sage: from sage.homology.simplicial_set import AbstractSimplex, SimplicialSet 

sage: v = AbstractSimplex(0, name='v') 

sage: e = AbstractSimplex(1, name='e') 

sage: X = SimplicialSet({e: (v, v)}) 

sage: X = X.set_base_point(v) 

sage: CX = X.cone() # indirect doctest 

sage: CX.nondegenerate_simplices() 

[*, e, (e,*)] 

""" 

C = ConeOfSimplicialSet_finite(base) 

edge_faces = sorted([C.base_point(), base.base_point()]) 

for t in C.n_cells(1): 

if sorted(C.faces(t)) == edge_faces: 

edge = t 

break 

inc = C.subsimplicial_set([edge]).inclusion_map() 

QuotientOfSimplicialSet_finite.__init__(self, inc) 

self._base = base 

q = self.quotient_map() 

self._joins = {sigma:q(C._joins[sigma]) for sigma in C._joins} 

 

def map_from_base(self): 

r""" 

If this is the cone `\tilde{C}X` on `X`, return the map from `X`. 

 

The map is defined to be the composite `X \to CX \to 

\tilde{C}X`. This is used by the 

:class:`SuspensionOfSimplicialSet_finite` class to construct 

the reduced suspension: take the quotient of the reduced cone 

by the image of `X` therein. 

 

EXAMPLES:: 

 

sage: S3 = simplicial_sets.Sphere(3) 

sage: CS3 = S3.cone() 

sage: CS3.map_from_base() 

Simplicial set morphism: 

From: S^3 

To: Reduced cone of S^3 

Defn: [v_0, sigma_3] --> [*, sigma_3] 

""" 

quotient_map = self.quotient_map() 

unreduced = quotient_map.domain() 

temp_map = unreduced.map_from_base() 

X = self._base 

incl = X.Hom(unreduced)(temp_map._dictionary) 

return quotient_map * incl 

 

 

class SuspensionOfSimplicialSet(SimplicialSet_arbitrary, UniqueRepresentation): 

def __init__(self, base): 

r""" 

Return the (reduced) suspension of a simplicial set. 

 

INPUT: 

 

- ``base`` -- return the suspension of this simplicial set. 

 

If this simplicial set ``X=base`` is not pointed, or if it is 

itself an unreduced suspension, return the unreduced 

suspension: the quotient `CX/X`, where `CX` is the (ordinary, 

unreduced) cone on `X`. If `X` is pointed, then use the 

reduced cone instead, and so return the reduced suspension. 

 

We use `S` to denote unreduced suspension, `\Sigma` for 

reduced suspension. 

 

EXAMPLES:: 

 

sage: B = simplicial_sets.ClassifyingSpace(groups.misc.MultiplicativeAbelian([2])) 

sage: B.suspension() 

Sigma(Classifying space of Multiplicative Abelian group isomorphic to C2) 

sage: B.suspension().n_skeleton(3).homology() 

{0: 0, 1: 0, 2: C2, 3: 0} 

 

If ``X`` is finite, the suspension comes with a quotient map 

from the cone:: 

 

sage: S3 = simplicial_sets.Sphere(3) 

sage: S4 = S3.suspension() 

sage: S4.quotient_map() 

Simplicial set morphism: 

From: Reduced cone of S^3 

To: Sigma(S^3) 

Defn: [*, sigma_3, (sigma_3,*)] --> [*, s_2 s_1 s_0 *, (sigma_3,*)] 

 

TESTS:: 

 

sage: S3.suspension() == S3.suspension() 

True 

sage: S3.suspension() == simplicial_sets.Sphere(3).suspension() 

False 

sage: B.suspension() == B.suspension() 

True 

""" 

Cat = SimplicialSets() 

if base.is_finite(): 

Cat = Cat.Finite() 

reduced = (base.is_pointed() 

and (not hasattr(base, '_reduced') 

or (hasattr(base, '_reduced') and base._reduced))) 

if reduced: 

Cat = Cat.Pointed() 

Parent.__init__(self, category=Cat) 

self._reduced = reduced 

self._base = base 

self._n_skeleton = (-1, Empty()) 

 

def n_skeleton(self, n): 

""" 

Return the `n`-skeleton of this simplicial set. 

 

That is, the simplicial set generated by all nondegenerate 

simplices of dimension at most `n`. 

 

INPUT: 

 

- ``n`` -- the dimension 

 

In the case when the suspension is infinite, the `n`-skeleton 

of the suspension is computed as the `n`-skeleton of the 

suspension of the `n`-skeleton. 

 

EXAMPLES:: 

 

sage: B = simplicial_sets.ClassifyingSpace(groups.misc.MultiplicativeAbelian([2])) 

sage: SigmaB = B.suspension() 

sage: SigmaB.n_skeleton(4).homology(base_ring=GF(2)) 

{0: Vector space of dimension 0 over Finite Field of size 2, 

1: Vector space of dimension 0 over Finite Field of size 2, 

2: Vector space of dimension 1 over Finite Field of size 2, 

3: Vector space of dimension 1 over Finite Field of size 2, 

4: Vector space of dimension 1 over Finite Field of size 2} 

""" 

if self.is_finite(): 

return SimplicialSet_finite.n_skeleton(self, n) 

start, skel = self._n_skeleton 

if start == n: 

return skel 

elif start > n: 

return skel.n_skeleton(n) 

ans = SuspensionOfSimplicialSet_finite(self._base.n_skeleton(n)).n_skeleton(n) 

self._n_skeleton = (n, ans) 

return ans 

 

def __repr_or_latex__(self, output_type=None): 

r""" 

Print representation, for either :meth:`_repr_` or :meth:`_latex_`. 

 

INPUT: 

 

- ``output_type`` -- either ``"latex"`` for LaTeX output or 

anything else for ``str`` output. 

 

We use `S` to denote unreduced suspension, `\Sigma` for 

reduced suspension. 

 

EXAMPLES: 

 

sage: T = simplicial_sets.Torus() 

sage: K = T.suspension(10) 

sage: K.__repr_or_latex__() 

'Sigma^10(Torus)' 

sage: K.__repr_or_latex__('latex') 

'\\Sigma^{10}(S^{1} \\times S^{1})' 

""" 

latex_output = (output_type == 'latex') 

base = self._base 

if self._reduced: 

# Reduced suspension. 

if latex_output: 

symbol = '\\Sigma' 

else: 

symbol = 'Sigma' 

else: 

# Unreduced suspension. 

symbol = 'S' 

idx = 1 

while isinstance(base, SuspensionOfSimplicialSet): 

idx += 1 

base = base._base 

if latex_output: 

base = latex(base) 

exp = '^{{{}}}' 

else: 

exp = '^{}' 

if idx > 1: 

return ('{}' + exp + '({})').format(symbol, idx, base) 

else: 

return ('{}({})').format(symbol, base) 

 

def _repr_(self): 

r""" 

Print representation 

 

We use `S` to denote unreduced suspension, `\Sigma` for 

reduced suspension. 

 

EXAMPLES: 

 

sage: S2 = simplicial_sets.Sphere(2) 

sage: S2.suspension(3) 

Sigma^3(S^2) 

sage: K = simplicial_sets.Simplex(2) 

sage: K.suspension(3) 

S^3(2-simplex) 

sage: K.suspension() 

S(2-simplex) 

""" 

return self.__repr_or_latex__() 

 

def _latex_(self): 

r""" 

LaTeX representation 

 

We use `S` to denote unreduced suspension, `\Sigma` for 

reduced suspension. 

 

EXAMPLES: 

 

sage: S2 = simplicial_sets.Sphere(2) 

sage: latex(S2.suspension(3)) 

\Sigma^{3}(S^{2}) 

sage: K = simplicial_sets.Simplex(2) 

sage: latex(K.suspension(3)) 

S^{3}(\Delta^{2}) 

sage: latex(K.suspension()) 

S(\Delta^{2}) 

""" 

return self.__repr_or_latex__('latex') 

 

 

class SuspensionOfSimplicialSet_finite(SuspensionOfSimplicialSet, 

QuotientOfSimplicialSet_finite): 

""" 

The (reduced) suspension of a finite simplicial set. 

 

See :class:`SuspensionOfSimplicialSet` for more information. 

""" 

def __init__(self, base): 

r""" 

INPUT: 

 

- ``base`` -- return the suspension of this finite simplicial set. 

 

See :class:`SuspensionOfSimplicialSet` for more information. 

 

EXAMPLES:: 

 

sage: X = simplicial_sets.Sphere(3) 

sage: X.suspension(2) 

Sigma^2(S^3) 

sage: Y = X.unset_base_point() 

sage: Y.suspension(2) 

S^2(Simplicial set with 2 non-degenerate simplices) 

""" 

self._base = base 

reduced = (base.is_pointed() 

and (not hasattr(base, '_reduced') 

or (hasattr(base, '_reduced') and base._reduced))) 

if reduced: 

C = ReducedConeOfSimplicialSet_finite(base) 

subcomplex = C.map_from_base().image() 

else: 

C = ConeOfSimplicialSet_finite(base) 

subcomplex = C.base_as_subset() 

QuotientOfSimplicialSet_finite.__init__(self, subcomplex.inclusion_map()) 

self._reduced = reduced 

# self._suspensions: dictionary, each key is a simplex sigma 

# in base, the corresponding value is the new simplex (sigma, *) 

# in S(base). Another key is 'cone', and its value is the cone 

# vertex in C(base). This is used to construct the suspension of a 

# morphism. 

q = self.quotient_map() 

self._suspensions = {sigma: q(C._joins[sigma]) for sigma in C._joins}