Repository navigation
Expand file tree
/
Copy pathsetmath.tex
More file actions
1788 lines (1545 loc) · 99.2 KB
/
Copy pathsetmath.tex
File metadata and controls
1788 lines (1545 loc) · 99.2 KB
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
\chapter{集合论 (Set theory)}
\label{cha:set-math}
\index{集合|(set|(}%
我们将集合理解为具有特别简单的同伦特征的类型,参见\cref{sec:basics-sets}。这种理解与Zermelo--Fraenkel\index{集合论!Zermelo--Fraenkel(set theory!Zermelo--Fraenkel)}集合论中的集合完全不同,后者形成了一个包含复杂嵌套隶属关系的累积层次结构。对于许多数学目的,同伦理论中的集合与Zermelo--Fraenkel集合一样好用,但它们之间存在重要差异。
我们在本章开始于\cref{sec:piw-pretopos},展示了范畴$\uset$具有通常集合范畴的(大部分)性质。
\index{数学!构造性(mathematics!constructive)}%
\index{数学!预测性(mathematics!predicative)}%
在构造性、预测性、单值性基础上,它是一个``$\Pi\mathsf{W}$-前拓扑(pretopos)'';而如果我们假设命题的缩放
\index{命题!缩放(propositional!resizing)}%
(\cref{subsec:prop-subsets}),它是一个初等拓扑(elementary topos)\index{拓扑(topos)},如果我们假设\LEM{}和\choice{},那么它是Lawvere的\emph{集合范畴的初等理论}的模型\index{Lawvere}。
\index{集合范畴的初等理论(Elementary Theory of the Category of Sets)}%
这足以确保在同伦类型论中的集合行为类似于大多数数学家在集合论之外使用的集合。
在本章的其余部分,我们研究了一些传统上属于“集合论”的主题。在\cref{sec:cardinals,sec:ordinals,sec:wellorderings}中,我们研究了基数和序数。这些通常在集合论中使用全局隶属关系来定义,但我们将看到,单值性公理使得一种同样方便、更具“结构性”的方法成为可能。
最后,在\cref{sec:cumulative-hierarchy}中,我们考虑在同伦类型论内部构建一个具有二元隶属关系的类似于Zermelo--Fraenkel集合论的累积层次结构的可能性。这结合了高阶归纳类型与代数集合论领域的思想。
\index{代数集合论(algebraic set theory)}%
\index{集合论!代数(algebraic)}%
在本章中,我们将经常使用\cref{subsec:prop-trunc}中描述的传统逻辑符号。除了\cref{cha:basics,cha:logic}的基本理论外,我们还使用了\cref{sec:colimits,sec:set-quotients}中关于余极限和商集的高阶归纳类型,以及\cref{cha:hlevels}中关于截断的某些理论,特别是在\cref{sec:image-factorization}中提到的因子分解系统在$n=-1$的情况。在\cref{sec:ordinals}中,我们使用了一个归纳族(\cref{sec:generalizations})来描述良序性,在\cref{sec:cumulative-hierarchy}中,我们使用了一个更复杂的高阶归纳类型来呈现累积层次结构。
\section{集合范畴 (The category of sets)}
\label{sec:piw-pretopos}
回顾在\cref{cha:category-theory}中,我们定义了范畴\uset由所有$0$-类型(在某个宇宙\UU中)及其之间的映射组成,并且观察到它是一个范畴(不仅仅是一个预范畴)。我们将依次考虑\uset所具有的结构层次。
\subsection{极限和余极限 (Limits and colimits)}
\label{subsec:limits-sets}
\index{极限!集合的(limit!of sets)}%
\index{余极限!集合的(colimit!of sets)}%
由于集合在积下是封闭的,\cref{thm:prod-ump}中的积的泛性质立即表明\uset具有有限积。实际上,无穷积也同样容易从等价式中得出:
\[ \Parens{X\to \prd{a:A} B(a)} \eqvsym \Parens{\prd{a:A} (X\to B(a))}.\]
我们在\cref{ex:pullback}中看到,$f:A\to C$和$g:B\to C$的拉回可以定义为$\sm{a:A}{b:B} f(a)=g(b)$;如果$A,B,C$都是集合,则它是一个集合并继承了正确的泛性质。因此,\uset在显然的意义上是一个\emph{完备}范畴。
\index{范畴!完备的(category!complete)}%
\index{完备!范畴(complete!category)}%
由于集合在$+$下是封闭的并包含\emptyt,\uset具有有限余积。同样,由于$\sm{a:A}B(a)$是一个集合,当且仅当$A$和每个$B(a)$是集合时,它在\uset中产生了族$B$的余积。最后,我们在\cref{sec:pushouts}中证明了$n$-类型中的推出存在,这特别包括了\uset。因此,\uset也是\emph{余完备的}。
\index{范畴!余完备的(category!cocomplete)}%
\index{余完备范畴(cocomplete category)}%
\subsection{像 (Images)}
\label{sec:image}
接下来,我们展示\uset是一个\define{正则范畴 (regular category)},即:
\indexdef{范畴!正则的(category!regular)}%
\indexdef{正则!范畴(regular!category)}%
%
\begin{enumerate}
\item \uset是有限完备的。\label{item:reg1}
\item 任何函数$f : A \to B$的核对偶$\proj1,\proj2: (\sm{x,y:A} f(x)= f(y)) \to A$具有余等化子。\label{item:reg2}
\indexdef{核!对偶(kernel!pair)}
\item 正则满态射的拉回再次是正则满态射。\label{item:reg3}
\end{enumerate}
%
回想一个\define{正则满态射 (regular epimorphism)}
\indexdef{满态射!正则的(epimorphism!regular)}%
\indexdef{正则!满态射(regular!epimorphism)}%
是某对映射的余等化子。因此在\ref{item:reg3}中,余等化子的拉回需要再次是余等化子,但不一定是被拉回对偶的。
\index{集合余等化子(set-coequalizer)}%
\index{像(image)}%
$f:A\to B$的核对偶的余等化子的明显候选者是$f$的\emph{像},如\cref{sec:image-factorization}中定义的那样。回想我们定义了$\im(f)\defeq \sm{b:B} \brck{\hfib f b}$,并且定义了$\tilde{f}:A\to\im(f)$和$i_f:\im(f)\to B$,如下所示:
\begin{align*}
\tilde{f} & \defeq \lam{a} \Pairr{f(a),\,\bproj{\pairr{a,\refl{f(a)}}}}\\
i_f & \defeq \proj1
\end{align*}
它们构成了一个图:
\begin{equation*}
\xymatrix{
**[l]{\sm{x,y:A} f(x)= f(y)}
\ar@<0.25em>[r]^{\proj1}
\ar@<-0.25em>[r]_{\proj2}
&
{A}
\ar[r]^(0.4){\tilde{f}}
\ar[rd]_{f}
&
{\im(f)}
\ar@{..>}[d]^{i_f}
\\ & &
B
}
\end{equation*}
回想一个函数$f:A\to B$称为\emph{满射 (surjective)},如果
\index{函数!满射(function!surjective)}%
\narrowequation{\fall{b:B}\brck{\hfib f b},}
或者等价地$\fall{b:B} \exis{a:A} f(a)=b$。我们还说过,两个集合之间的函数$f:A\to B$称为\emph{单射 (injective)},如果
\index{函数!单射(function!injective)}%
$\fall{a,a':A} (f(a) = f(a')) \Rightarrow (a=a')$,或者等价地,如果它的每个纤维是一个简单命题。由于这些是在\cref{cha:hlevels}意义上的$(-1)$-连通和$(-1)$-截断映射,一般理论表明,上述$\tilde f$是满射而$i_f$是单射,并且这种因子分解在拉回下是稳定的。
我们现在将单射性和满射性与适当的范畴理论概念进行比较。首先我们观察到范畴中的单态射和满态射有一个略微更强的等价公式。
\begin{lem}\label{thm:mono}
对于范畴$A$中的一个态射$f:\hom_A(a,b)$,以下条件是等价的。
\begin{enumerate}
\item $f$是一个\define{单态射 (monomorphism)}:
\indexdef{单态射(monomorphism)}%
对于所有$x:A$和${g,h:\hom_A(x,a)}$,如果$f\circ g = f\circ h$,则$g=h$。\label{item:mono1}
\item (如果$A$有拉回)对角线映射$a\to a\times_b a$是一个同构。\label{item:mono4}
\item 对于所有$x:A$和$k:\hom_A(x,b)$,类型$\sm{h:\hom_A(x,a)} (k = f\circ h)$是一个简单命题。\label{item:mono2}
\item 对于所有$x:A$和${g:\hom_A(x,a)}$,类型$\sm{h:\hom_A(x,a)} (f\circ g = f\circ h)$是一个收缩的。\label{item:mono3}
\end{enumerate}
\end{lem}
\begin{proof}
条件~\ref{item:mono1}和~\ref{item:mono4}的等价性是标准范畴论。现在考虑$\hom_A(x,a)$和$\hom_A(x,b)$之间的函数$(f\circ \blank )$。条件~\ref{item:mono1}表示它是单射,而~\ref{item:mono2}表示它的纤维是简单命题;因此它们是等价的。~\ref{item:mono2}通过取$k\defeq f\circ g$并记住被占用的简单命题是收缩的来隐含~\ref{item:mono3}。最后,~\ref{item:mono3}隐含~\ref{item:mono1},因为如果$p:f\circ g= f\circ h$,那么$(g,\refl{})$和$(h,p)$都包含在~\ref{item:mono3}中的类型中,因此是相等的,所以$g=h$。
\end{proof}
\begin{lem}\label{thm:inj-mono}
集合之间的一个函数$f:A\to B$是单射的当且仅当它是\uset中的单态射\index{单态射(monomorphism)}。
\end{lem}
\begin{proof}
留给读者。
\end{proof}
当然,\define{满态射 (epimorphism)}
\indexdef{满态射(epimorphism)}%
\indexsee{满态射(epi)}{满态射(epimorphism)}%
是在对偶范畴中的单态射。我们现在展示,在\uset中,满态射正是满射,同时也正是余等化子(正则满态射)。
两个集合$A$和$B$之间的$f,g:A\to B$的余等化子在$\uset$中定义为一般(同伦)余等化子的$0$-截断。为了清楚起见,我们可以将其称为\define{集合余等化子 (set-coequalizer)}。
\indexdef{集合余等化子(set-coequalizer)}%
\indexsee{集合余等化子(coequalizer!of sets)}{set-coequalizer}%
它的泛性质方便地表达如下。
\begin{lem}
\index{集合余等化子的泛性质(universal!property!of set-coequalizer)}%
设$f,g:A\to B$为两个集合$A$和$B$之间的函数。{集合余}等化子$c_{f,g}:B\to Q$具有如下性质:对于任意集合$C$和任意$h:B\to C$,满足$h\circ f = h\circ g$,类型
\begin{equation*}
\sm{k:Q\to C} (k\circ c_{f,g} = h)
\end{equation*}
是收缩的。
\end{lem}
\begin{lem}\label{epis-surj}
对于集合之间的任意函数$f:A\to B$,以下条件是等价的:
\begin{enumerate}
\item $f$是一个满态射。
\item 考虑推出图
\begin{equation*}
\xymatrix{
{A}
\ar[r]^{f}
\ar[d]
&
{B}
\ar[d]^{\iota}
\\
{\unit}
\ar[r]_{t}
&
{C_f}
}
\end{equation*}
在$\uset$中定义了映射锥\index{映射锥(cone!of a function)}。那么类型$C_f$是收缩的。
\item $f$是满射。
\end{enumerate}
\end{lem}
\begin{proof}
设$f:A\to B$为一个集合之间的函数,假设它是一个满态射;我们证明$C_f$是收缩的。$C_f$的构造器$\unit\to C_f$给了我们一个元素$t:C_f$。我们需要证明
\begin{equation*}
\prd{x:C_f} x= t.
\end{equation*}
请注意$x= t$是一个简单命题,因此我们可以对$C_f$进行归纳。当然,当$x$为$t$时,我们有$\refl{t}:t=t$,所以足以找到
\begin{align*}
I_0 & : \prd{b:B} \iota(b)= t\\
I_1 & : \prd{a:A} \opp{\alpha_1(a)} \ct I_0(f(a))=\refl{t}
\end{align*}
其中$\iota:B\to C_f$和$\alpha_1:\prd{a:A} \iota(f(a))= t$是$C_f$的其他构造器。请注意$\alpha_1$是$\iota\circ f$到$\mathsf{const}_t\circ f$的一个同伦,因此我们可以找到元素
\begin{equation*}
\pairr{\iota,\refl{\iota\circ f}},\pairr{\mathsf{const}_t,\alpha_1}:
\sm{h:B\to C_f} \iota\circ f \htpy h\circ f.
\end{equation*}
通过\cref{thm:mono}\ref{item:mono3}的对偶(以及函数扩展性),我们有一条路径
\begin{equation*}
\gamma:\pairr{\iota,\refl{\iota\circ f}}=\pairr{\mathsf{const}_t,\alpha_1}.
\end{equation*}
因此,我们可以定义$I_0(b)\defeq \happly(\projpath1(\gamma),b):\iota(b)=t$。
我们还有
\[\projpath2(\gamma) : \trans{\projpath1(\gamma)}{\refl{\iota\circ f}} = \alpha_1。 \]
此传输涉及$f$的前置,它与$\happly$一起工作。因此,从路径类型中的传输我们得到$I_0(f(a)) = \alpha_1(a)$,对于任何$a:A$,这给了我们$I_1$。
现在假设$C_f$是收缩的;我们证明$f$是满射。我们首先通过$C_f$上的递归构造一个类型族$P:C_f\to\prop$,这是有效的,因为\prop是一个集合。在点构造器上,我们定义
\begin{align*}
P(t) & \defeq \unit\\
P(\iota(b)) & \defeq \brck{\hfiber{f}b}.
\end{align*}
为了完成$P$的构造,我们还需要为所有$a:A$给出一条路径
\narrowequation{\brck{\hfiber{f}{f(a)}} =_\prop \unit。}
然而,$\brck{\hfiber{f}{f(a)}}$是由$(f(a),\refl{f(a)})$居住的。由于它是一个简单命题,这意味着它是收缩的——因此是等价的,因此与\unit相等。这完成了$P$的定义。现在,由于$C_f$被假设为收缩的,因此$P(x)$对于任何$x:C_f$都是等价于$P(t)$的。特别是,$P(\iota(b))\jdeq \brck{\hfiber{f}b}$等价于$P(t)\jdeq \unit$,对于每个$b:B$,因此是收缩的。因此,$f$是满射。
最后,假设$f:A\to B$是满射,并考虑一个集合$C$和两个函数$g,h:B\to C$,它们具有$g\circ f = h\circ f$的性质。由于$f$被假设为满射,因此对于所有$b:B$,类型$\brck{\hfib f b}$是收缩的。因此我们有以下等价:
\begin{align*}
\prd{b:B} (g(b)= h(b))
& \eqvsym \prd{b:B} \Parens{\brck{\hfib f b} \to (g(b)= h(b))}\\
& \eqvsym \prd{b:B} \Parens{\hfib f b \to (g(b)= h(b))}\\
& \eqvsym \prd{b:B}{a:A}{p:f(a)= b} g(b)= h(b)\\
& \eqvsym \prd{a:A} g(f(a))= h(f(a))。
\end{align*}
使用在第二行中的事实,即$g(b)=h(b)$是一个简单命题,因为$C$是一个集合。但根据假设,有该类型的一个元素。
\end{proof}
\begin{thm}\label{thm:set_regular}\label{lem:images_are_coequalizers}
范畴$\uset$是正则的。此外,集合之间的满射是正则满态射。
\end{thm}
\begin{proof}
这是范畴论中的一个标准引理,即范畴是正则的,只要它承认有限极限和稳定于拉回的正交因子分解系统\index{正交因子分解系统(orthogonal factorization system)} $(\mathcal{E},\mathcal{M})$,其中$\mathcal{M}$是单态射,在这种情况下,$\mathcal{E}$自动由正则满态射组成。
(参见例如\cite[A1.3.4]{elephant})。
因子分解系统的存在性在\cref{thm:orth-fact}中得到证明。
\end{proof}
\begin{lem}\label{lem:pb_of_coeq_is_coeq}
在\uset中,正则满态射的拉回是正则满态射。
\end{lem}
\begin{proof}
我们在\cref{thm:stable-images}中展示了,$n$-连通函数的拉回是$n$-连通的。通过\cref{lem:images_are_coequalizers},当$n=-1$时应用这一结论就足够了。
\end{proof}
\indexdef{子集的像(image!of a subset)}
\uset作为正则范畴的一个后果是,我们有了“像”运算作用于子集。也就是说,给定$f:A\to B$,任何子集$P:\power A$(即谓词$P:A\to \prop$)都有一个\define{像 (image)},它是$B$的一个子集。这可以直接定义为$\setof{ y:B | \exis{x:A} f(x)=y \land P(x)}$,或间接地定义为复合函数
\[ \setof{ x:A | P(x) } \to A \xrightarrow{f} B的像。]
\symlabel{subset-image}
我们有时也会使用常见的记号$\setof{f(x) | P(x)}$来表示$P$的像。
\subsection{商 (Quotients)}\label{subsec:quotients}
\index{集合商(set-quotient|(}%
现在我们知道$\uset$是正则的,要表明$\uset$是精确的,我们需要证明每个等价关系都是有效的。
\index{有效!等价关系(effective!equivalence relation|(}%
\index{关系!有效等价(effective equivalence|(}%
换句话说,给定等价关系$R:A\to A\to\prop$,存在一个对偶的余等化子$c_R$,并且$\proj1$和$\proj2$形成$c_R$的核对偶。
我们已经在\cref{sec:set-quotients}中看到了两个构造集合按等价关系$R:A\to A\to\prop$的商的方法。第一个可以描述为
\[ \proj1,\proj2:\Parens{\sm{x,y:A} R(x,y)} \to A的集合余}等化子。]
其商的一个重要性质如下。
\begin{defn}
一个关系$R:A\to A\to\prop$被称为\define{有效的 (effective)},
\indexdef{有效!关系(effective!relation)}
\indexdef{有效!等价关系(effective!equivalence relation)}%
\indexdef{关系!有效等价(effective equivalence)}%
如果方框
\begin{equation*}
\xymatrix{
{\sm{x,y:A} R (x,y)}
\ar[r]^(0.7){\proj1}
\ar[d]_{\proj2}
&
{A}
\ar[d]^{c_R}
\\
{A}
\ar[r]_{c_R}
&
{A/R}
}
\end{equation*}
是一个拉回。
\end{defn}
由于$c_R$和它本身的标准拉回是$\sm{x,y:A} (c_R(x)=c_R(y))$,通过\cref{thm:total-fiber-equiv},这相当于要求$c_R(x)=c_R(y)$的典型转换是一个纤维等价。
\begin{lem}\label{lem:sets_exact}
假设$\pairr{A,R}$是一个等价关系。那么对于任何$x,y:A$,有一个等价关系
\begin{equation*}
(c_R(x)= c_R(y))\eqvsym R(x,y)。
\end{equation*}
换句话说,等价关系是有效的。
\end{lem}
\begin{proof}
我们首先通过对$A/R$进行双重归纳将$R$扩展为一个关系$\widetilde{R}:A/R\to A/R\to\prop$,然后我们将证明它与$A/R$上的恒等类型等价。我们定义$\widetilde{R}(c_R(x),c_R(y)) \defeq R(x,y)$。对于$r:R(x,x')$和$s:R(y,y')$,$R$的传递性和对称性给出了$R(x,y)$到$R(x',y')$的一个等价关系。这完成了$\widetilde{R}$的定义。
现在要证明对于每个$w,w':A/R$,$\widetilde{R}(w,w')\eqvsym (w= w')$。
方向$(w=w')\to \widetilde{R}(w,w')$通过传输一次我们证明了$\widetilde{R}$是反射的,这是一种简单的归纳。
另一个方向$\widetilden{R}(w,w')\to (w= w')$是一个简单命题,因此由于$c_R:A\to A/R$是满射,只需要假设$w$和$w'$是$c_R(x)$和$c_R(y)$形式的。但在这种情况下,我们有典型映射$\widetilden{R}(c_R(x),c_R(y)) \defeq R(x,y) \to (c_R(x)=c_R(y))$。(再次注意到编码解码方法的出现。\index{编码解码方法(encode-decode method)})
\end{proof}
第二个商的构造是作为$R$的等价类的集合(它的幂集的子集):
\[ A\sslash R \defeq \setof{ P:A\to\prop | P \text{ is an equivalence class of } R}。]
这需要命题缩放\index{命题缩放(propositional resizing)}\index{非预测性商(impredicative!quotient)}\index{缩放(resizing)}来保持在与$A$和$R$相同的宇宙中。
注意,如果我们将$R$视为$A$到$A\to \prop$的函数,那么$A\sslash R$等价于\cref{sec:image}中构造的$\im(R)$。现在在\cref{lem:images_are_coequalizers}中我们已经证明了图像是
余等化子。特别是,我们立即得到余等化子图
\begin{equation*}
\xymatrix{
**[l]{\sm{x,y:A} R (x)= R (y)}
\ar@<0.25em>[r]^{\proj1}
\ar@<-0.25em>[r]_{\proj2}
&
{A}
\ar[r]
&
{A \sslash R。}
}
\end{equation*}
我们可以用这个来给出另一个证明,即任何等价关系是有效的,并且两个商的定义是一致的。
\begin{thm}\label{prop:kernels_are_effective}
对于任意两个集合之间的函数$f:A\to B$,
关系$\ker(f):A\to A\to\prop$由
$\ker(f,x,y)\defeq (f(x)= f(y))$给出是有效的。
\end{thm}
\begin{proof}
我们将使用$\proj1,\proj2: (\sm{x,y:A} f(x)= f(y))\to A$的余等化子$\im(f)$。
注意,函数
\[c_f\defeq\lam{a} \Parens{f(a),\brck{\pairr{a,\refl{f(a)}}}}
: A \to \im(f)
\]
的核对偶由两个投影
\begin{equation*}
\proj1,\proj2:\Parens{\sm{x,y:A} c_f(x)= c_f(y)}\to A。
\end{equation*}
对于任何$x,y:A$,我们有等价
\begin{align*}
(c_f(x)= c_f(y))
& \eqvsym \Parens{\sm{p:f(x)= f(y)} \trans{p}{\brck{\pairr{x,\refl{f(x)}}}} =\brck{\pairr{y,\refl{f(y)}}}}\\
& \eqvsym (f(x)= f(y)),
\end{align*}
其中最后一个等价关系成立,因为
$\brck{\hfiber{f}b}$对于任何$b:B$来说是一个简单命题。
因此,我们得到
\begin{equation*}
\Parens{\sm{x,y:A} c_f(x)= c_f(y)}\eqvsym \Parens{\sm{x,y:A} f(x)= f(y)}
\end{equation*}
并且我们可以得出结论,对于任何函数$f$,$\ker f$是一个有效的关系。
\end{proof}
\begin{thm}
等价关系是有效的,并且$A/R \eqvsym A\sslash R$。
\end{thm}
\begin{proof}
我们需要分析余等化子图
\begin{equation*}
\xymatrix{
**[l]{\sm{x,y:A} R (x)= R (y)}
\ar@<0.25em>[r]^{\proj1}
\ar@<-0.25em>[r]_{\proj2}
&
{A}
\ar[r]
&
{A \sslash R}
}
\end{equation*}
通过单值化公理,类型$R(x) = R(y)$等价于从$R(x)$到$R(y)$的同伦类型,并且进一步等价于
\narrowequation{\prd{z:A} R (x,z)\eqvsym R (y,z)}。
由于$R$是一个等价关系,后者空间等价于$R(x,y)$。总之,我们得到$(R(x) = R(y)) \eqvsym R(x,y)$,因此$R$是有效的,因为它等价于一个有效的关系。此外,图
\begin{equation*}
\xymatrix{
**[l]{\sm{x,y:A} R(x, y)}
\ar@<0.25em>[r]^{\proj1}
\ar@<-0.25em>[r]_{\proj2}
&
{A}
\ar[r]
&
{A \sslash R。}
}
\end{equation*}
是一个余等化子图。由于余等化子是等价的,因此可以得出$A/R \eqvsym A\sslash R$。
\end{proof}
我们通过提到商的第三种可能的构造来结束本节。考虑一个以$A$为对象的预范畴,其同态集为$R$;此预范畴的Rezk完成\index{完成!Rezk}(参见\cref{sec:rezk})的对象类型将是该等价关系的商。读者可以检查详细信息。
\index{有效!等价关系|)}%
\index{关系!有效等价|)}%
\index{集合商|)}%
\subsection{\texorpdfstring{$\uset$}{Set}是一个\texorpdfstring{$\Pi\mathsf{W}$}{ΠW}-前拓扑范畴}
\label{subsec:piw}
\index{结构化!集合论|(}%
所谓的\emph{$\Pi\mathsf{W}$-前拓扑范畴} \index{PiW-pretopos@$\Pi\mathsf{W}$-pretopos}%
\indexsee{前拓扑范畴}{$\Pi\mathsf{W}$-pretopos}是一种局部笛卡尔闭范畴
\index{局部笛卡尔闭范畴(locally cartesian closed category)}%
\index{范畴!局部笛卡尔闭(locally cartesian closed)}%
具有不相交的有限上积,有效等价关系,以及多项式自函子的初始代数的范畴——这被认为是一种“预测性”的拓扑概念,即“预测性集合”的范畴,可用于构造数学
\index{数学!构造性}%
就像通常的集合范畴对于经典数学
\index{数学!经典}%
的用途一样。
通常,在构造性类型论中,求助于“集合体”——一种精确补全——的外部构造来获得具有此类闭包性质的范畴。
\index{集合体}\index{补全!精确}%
特别是,良好行为的商在数学中通常涉及(非构造性)幂集的许多构造中是必需的。值得注意的是,统一基础通过更高归纳类型(higher inductive types)提供了这些内部构造,而无需此类外部构造。这代表了我们方法的强大优势,我们将在后续示例中看到。
\begin{thm}
\index{PiW-pretopos@$\Pi\mathsf{W}$-pretopos}
范畴$\uset$是一个$\Pi\mathsf{W}$-前拓扑范畴。
\end{thm}
\begin{proof}
我们有一个初始对象
\index{初始!集合}%
$\emptyt$和有限、不相交的上积$A+B$。这些在拉回时保持稳定,原因很简单,因为拉回有一个右伴随\index{伴随!函子}。事实上,$\uset$是局部笛卡尔闭的,因为对于集合之间的任何映射$f:A\to B$,使用“纤维化替换”\index{纤维化替换(fibrant replacement)}$\sm{a:A}f(a)=b$等价于$A$(在$B$上),并且我们有该替换的依赖函数类型。
我们刚刚展示了$\uset$是正则的(\cref{thm:set_regular}),并且商是有效的(\cref{lem:sets_exact})。因此,我们有一个局部笛卡尔闭前拓扑范畴。最后,由于$n$-类型在\cref{ex:ntypes-closed-under-wtypes}中通过多项式自函子的初始代数(\cref{thm:w-hinit})构成,我们看到$\uset$是一个$\Pi\mathsf{W}$-前拓扑范畴。
\end{proof}
\index{拓扑|(}
人们自然会想知道,有什么(如果有的话)阻止$\uset$成为一个(基本)拓扑?
除了已经提到的结构,拓扑还具有一个\emph{子对象分类器}:
\indexdef{子对象分类器(subobject classifier)}%
\index{分类器!子对象(classifier!subobject)}%
\index{幂集(power set)}%
这是一个指示对象,用于分类(等价类的)单态射(monomorphisms)。实际上,在具有子对象分类器的情况下,事情变得稍微简单一些:仅需要笛卡尔闭包即可获得余积。
在同伦类型论中,单值化公理表明,类型$\prop \defeq \sm{X:\UU}\isprop(X)$确实分类单态射(通过类似于\cref{sec:object-classification}的论证),但通常它与周围的宇宙$\UU$一样大。因此,它在某种意义上是一个“集合”,因为它是一个$0$-类型,但它不是“小的”,因为它不是$\UU$的对象,因此不是范畴$\uset$的对象。然而,如果我们假设一种适当形式的命题缩放(见\cref{subsec:prop-subsets}),那么我们可以找到$\prop$的一个小版本,使得$\uset$成为一个基本的拓扑范畴。
\begin{thm}\label{thm:settopos}
\index{命题!缩放(propositional resizing)}%
如果存在一个类型$\Omega:\UU$,包含所有简单命题,那么范畴$\uset_\UU$是一个基本拓扑范畴。
\end{thm}
\index{拓扑|)}
一个足够的条件是排中律,在“简单命题”形式中,我们称之为 \LEM{};因为在这种情况下,我们有 $\prop = \bool$,这是“小的”,并且可以分类所有的简单命题。此外,拓扑理论中一个众所周知的充分条件是选择公理,这是经典\index{数学!经典} 集合论中经常假设的公理。在下一节中,我们将简要探讨这些条件在我们环境下的关系。
\index{结构化!集合论|)}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{选择公理蕴含排中律}
\label{subsec:emacinsets}
我们从以下引理开始。
\begin{lem}\label{prop:trunc_of_prop_is_set}
如果 $A$ 是一个简单命题,那么其悬挂 $\susp(A)$ 是一个集合,并且 $A$ 等价于 $\id[\susp(A)]{\north}{\south}$。
\end{lem}
\begin{proof}
为了证明 $\susp(A)$ 是一个集合,我们定义一个族 $P:\susp(A)\to\susp(A)\to\type$,使得对于每个 $x,y:\susp(A)$,$P(x,y)$ 是一个简单命题,并且它等价于 $\susp(A)$ 上的同一类型 $\idtypevar{\susp(A)}$。
%
我们做以下定义:
\begin{align*}
P(\north,\north) & \defeq \unit &
P(\south,\north) & \defeq A\\
P(\north,\south) & \defeq A &
P(\south,\south) & \defeq \unit。
\end{align*}
我们需要检查定义是否保持路径。对于任何 $a : A$,有一个子午线 $\merid(a) : \north = \south$,因此我们应该有
%
\begin{equation*}
P(\north, \north) = P(\north, \south) = P(\south, \north) = P(\south, \south)。
\end{equation*}
%
但由于 $A$ 由 $a$ 占据,它等价于 $\unit$,因此我们有
%
\begin{equation*}
P(\north, \north) \eqvsym P(\north, \south) \eqvsym P(\south, \north) \eqvsym P(\south, \south)。
\end{equation*}
%
单值化公理将这些转换为所需的相等性。此外,$P(x,y)$ 对于所有 $x, y : \susp(A)$ 是一个简单命题,这通过对 $x$ 和 $y$ 的归纳以及简单命题是一个简单命题这一事实来证明。
注意,$P$ 是一个自反关系。因此,我们可以应用 \cref{thm:h-set-refrel-in-paths-sets},因此只需构造 $\tau : \prd{x,y:\susp(A)}P(x,y)\to(x=y)$。我们通过双重归纳来实现。当 $x$ 是 $\north$ 时,我们定义 $\tau(\north)$ 为
%
\begin{equation*}
\tau(\north,\north,u) \defeq \refl{\north}
\qquad\text{以及}\qquad
\tau(\north,\south,a) \defeq \merid(a)。
\end{equation*}
%
如果 $A$ 由 $a$ 占据,那么 $\merid(a) : \north = \south$,因此我们还需要
\narrowequation{
\trans{\merid(a)}{\tau(\north, \north)} = \tau(\north, \south)。
}
通过函数外延性,我们使用以下事实来完成这一步:
%
\begin{multline*}
\trans{\merid(a)}{\tau(\north,\north,x)} =
\tau(\north,\north,x) \ct \opp{\merid(a)} \jdeq \\
\refl{\north} \ct \merid(a) =
\merid(a) =
\merid(x) \jdeq
\tau(\north, \south, x)。
\end{multline*}
以对称的方式,我们可以通过以下方式定义 $\tau(\south)$:
%
\begin{equation*}
\tau(\south,\north, a) \defeq \opp{\merid(a)}
\qquad\text{以及}\qquad
\tau(\south,\south, u) \defeq \refl{\south}。
\end{equation*}
%
为了完成 $\tau$ 的构造,我们需要检查 $\trans{\merid(a)}{\tau(\north)} = \tau(\south)$,对于任何 $a : A$。验证过程与上述类似,通过对 $\tau$ 的第二个参数的归纳来进行。
因此,通过 \cref{thm:h-set-refrel-in-paths-sets} 我们得出 $\susp(A)$ 是一个集合,并且对于所有 $x,y:\susp(A)$ 有 $P(x,y) \eqvsym (\id{x}{y})$。取 $x\defeq \north$ 和 $y\defeq \south$ 即可得到所需的 $A \eqvsym (\id[\susp(A)]\north\south)$。
\end{proof}
\begin{thm}[Diaconescu 定理]\label{thm:1surj_to_surj_to_pem}
\index{选择公理(axiom of choice)}%
\index{排中律(excluded middle)}%
\index{Diaconescu's theorem(迪亚孔涅斯库定理)}\index{theorem!Diaconescu's(迪亚孔涅斯库定理)}%
选择公理蕴含排中律。
\end{thm}
\begin{proof}
我们使用在 \cref{thm:ac-epis-split} 中给出的选择公理的等价形式。考虑一个简单命题 $A$。定义一个函数 $f:\bool\to\susp(A)$,其定义为 $f(\bfalse) \defeq \north$ 和 $f(\btrue) \defeq \south$。这个函数是满射的。实际上,我们有 $\pairr{\bfalse,\refl{\north}} : \hfiber{f}{\north}$ 和 $\pairr{\btrue,\refl{\south}} :\hfiber{f}{\south}$。由于 $\bbrck{\hfiber{f}{x}}$ 是一个简单命题,通过归纳法可以得出所需的满射性。
根据 \cref{prop:trunc_of_prop_is_set},悬挂 $\susp(A)$ 是一个集合,因此根据选择公理,存在一个从 $\susp(A)$ 到 $\bool$ 的截面 $g: \susp(A) \to \bool$。由于 $\bool$ 上的相等性是可判定的,我们得到
\begin{equation*}
(g(f(\bfalse))= g(f(\btrue))) +
\lnot (g(f(\bfalse))= g(f(\btrue))),
\end{equation*}
并且,由于 $g$ 是 $f$ 的一个截面,因此是单射,
\begin{equation*}
(f(\bfalse) = f(\btrue)) +
\lnot (f(\bfalse) = f(\btrue))。
\end{equation*}
最后,由于 $(f(\bfalse)=f(\btrue)) = (\north=\south) = A$ 根据 \cref{prop:trunc_of_prop_is_set},我们有 $A+\neg A$。
\end{proof}
% This conclusion needs only \LEM{}, see \cref{ex:lemnm}.
% \begin{cor}\label{cor:ACtoLEM0}
% If the axiom of choice \choice{} holds then $\brck{A + \neg A}$ for every set $A$.
% \end{cor}
% \begin{proof}
% There is a surjection
% \[
% A + \neg A \epi \brck{A} + \brck{\neg A} \epi
% \brck{(\brck{A} + \brck{\neg A})} = \brck{A} \vee \brck{\neg A} = \brck{A} \vee \neg \brck{A} = \unit,
% \]
% %
% where in the last step excluded middle is available as a consequence of the axiom of choice.
% Again by the axiom of choice there merely exists a section of the surjection, but this
% is none other than an inhabitant of $A + \neg A$. Therefore $\brck{A+\neg A}$.
% \end{proof}
\index{denial(否定)}
\begin{thm}\label{thm:ETCS}
\index{Elementary Theory of the Category of Sets(集合范畴的初等理论)}%
\index{category!well-pointed(范畴!良好定点)}%
如果选择公理成立,则类别 $\uset$ 是一个带选择的良好定点布尔初等拓扑。
\end{thm}
\begin{proof}
由于 \choice{} 蕴含 \LEM{},通过 \cref{thm:settopos} 以及后面的注释,我们可以得到一个带选择的布尔初等拓扑。我们将良好定点性的证明留给读者作为练习 (\cref{ex:well-pointed})。
\end{proof}
\begin{rmk}
定理中提到的关于范畴的条件被称为 Lawvere 用于“集合范畴的初等理论”的公理~\cite{lawvere:etcs-long}。
\end{rmk}
\section{基数 (Cardinal numbers)}
\label{sec:cardinals}
\begin{defn}\label{defn:card}
\define{基数类型 (type of cardinal numbers)}
\indexdef{type!of cardinal numbers}%
\indexdef{cardinal number}%
\indexsee{number!cardinal}{cardinal number}%
是集合类型 (\set) 的 0-截断:
\[ \card \defeq \pizero{\set} \]
因此,一个 \define{基数 (cardinal number)},或称 \define{基数 (cardinal)},是 $\card\jdeq \pizero\set$ 的一个元素。
技术上,当然每个宇宙 \type 都有一个单独的基数类型 $\card_\UU$ 。
\end{defn}
%\begin{rmk}
% , but with these conventions we can state theorems beginning with ``for all cardinal numbers\dots''\ and give them exactly the same sort of meaning as those beginning ``for all types\dots''.
%\end{rmk}
和通常的截断一样,如果 $A$ 是一个集合,那么 $\cd{A}$ 表示其在从集合类型到 0-截断 $\trunc0\set \jdeq \card$ 的标准映射下的像;我们称 $\cd{A}$ 为 $A$ 的 \define{基数 (cardinality)}\indexdef{cardinality}。
根据定义,\card 是一个集合。
它还继承了来自 \set 的半环结构。
\begin{defn}
\define{基数加法 (cardinal addition)}
\indexdef{addition!of cardinal numbers}%
\index{cardinal number!addition of}%
的运算定义为截断上的归纳:
\[ (\blank+\blank) : \card \to \card \to \card \]
定义为:
\[ \cd{A} + \cd{B} \defeq \cd{A+B}.\]
\end{defn}
\begin{proof}
由于 $\card\to\card$ 是一个集合,要为所有 $\alpha:\card$ 定义 $(\alpha+\blank):\card\to\card$,通过归纳,只需要假设 $\alpha$ 是某个 $A:\set$ 的 $\cd{A}$。
现在我们想要定义 $(\cd{A}+\blank) :\card\to\card$,即我们想要为所有 $\beta:\card$ 定义 $\cd{A}+\beta :\card$。
然而,由于 \card 是一个集合,通过归纳,只需要假设 $\beta$ 是某个 $B:\set$ 的 $\cd{B}$。
但是现在我们可以定义 $\cd{A}+\cd{B}$ 为 $\cd{A+B}$。
\end{proof}
\begin{defn}
类似地,\define{基数乘法 (cardinal multiplication)}
\indexdef{multiplication!of cardinal numbers}%
\index{cardinal number!multiplication of}%
的运算定义为截断上的归纳:
\[ (\blank\cdot\blank) : \card \to \card \to \card \]
定义为:
\[ \cd{A} \cdot \cd{B} \defeq \cd{A\times B} \]
\end{defn}
\begin{lem}\label{card:semiring}
\card 是一个交换半环 (commutative semiring)\index{semiring},即对于 $\alpha,\beta,\gamma:\card$ 我们有以下性质。
\begin{align*}
(\alpha+\beta)+\gamma &= \alpha+(\beta+\gamma)\\
\alpha+0 &= \alpha\\
\alpha + \beta &= \beta + \alpha\\
(\alpha \cdot \beta) \cdot \gamma &= \alpha \cdot (\beta\cdot\gamma)\\
\alpha \cdot 1 &= \alpha\\
\alpha\cdot\beta &= \beta\cdot\alpha\\
\alpha\cdot(\beta+\gamma) &= \alpha\cdot\beta + \alpha\cdot\gamma
\end{align*}
其中 $0 \defeq \cd{\emptyt}$ 且 $1\defeq\cd{\unit}$。
\end{lem}
\begin{proof}
我们证明乘法的交换性,即 $\alpha\cdot\beta = \beta\cdot\alpha$;其他性质的证明完全类似。
由于 \card 是一个集合,类型 $\alpha\cdot\beta = \beta\cdot\alpha$ 是一个纯命题,并且特别地是一个集合。
因此,通过截断上的归纳,只需要假设 $\alpha$ 和 $\beta$ 分别是某些 $A,B:\set$ 的 $\cd{A}$ 和 $\cd{B}$。
现在 $\cd{A}\cdot \cd{B} \jdeq \cd{A\times B}$ 和 $\cd{B}\cdot\cd{A} \jdeq \cd{B\times A}$,所以只需要证明 $A\times B = B\times A$。
最后,通过同一性原理 (univalence),只需要给出一个等价 $A\times B \eqvsym B\times A$。
这很简单:取 $(a,b) \mapsto (b,a)$ 及其显然的逆映射即可。
\end{proof}
\begin{defn}
\define{基数指数 (cardinal exponentiation)} 的运算同样定义为截断上的归纳:
\indexdef{exponentiation, of cardinal numbers}%
\index{cardinal number!exponentiation of}%
\[ \cd{A}^{\cd{B}} \defeq \cd{B\to A}. \]
\end{defn}
\begin{lem}\label{card:exp}
对于 $\alpha,\beta,\gamma:\card$ 我们有以下性质:
\begin{align*}
\alpha^0 &= 1\\
1^\alpha &= 1\\
\alpha^1 &= \alpha\\
\alpha^{\beta+\gamma} &= \alpha^\beta \cdot \alpha^\gamma\\
\alpha^{\beta\cdot \gamma} &= (\alpha^{\beta})^\gamma\\
(\alpha\cdot\beta)^\gamma &= \alpha^\gamma \cdot \beta^\gamma
\end{align*}
\end{lem}
\begin{proof}
证明与 \cref{card:semiring} 类似。
\end{proof}
\begin{defn}
\define{基数不等式 (cardinal inequality)}
\index{order!non-strict}%
\index{cardinal number!inequality of}%
的关系定义为截断上的归纳:
\symlabel{inj}
\[ \cd{A} \le \cd{B} \defeq \brck{\inj(A,B)} \]
其中 $\inj(A,B)$ 是从 $A$ 到 $B$ 的单射 (injections) 的类型。
\index{function!injective}%
换句话说,$\cd{A} \le \cd{B}$ 意味着从 $A$ 到 $B$ 仅仅存在一个单射。
\end{defn}
\begin{lem}
基数不等式是一个预序 (preorder),即对于 $\alpha,\beta:\card$ 我们有:
\index{preorder!of cardinal numbers}%
\begin{gather*}
\alpha \le \alpha\\
(\alpha \le \beta) \to (\beta\le\gamma) \to (\alpha\le\gamma)
\end{gather*}
\end{lem}
\begin{proof}
同前,通过截断上的归纳。
例如,类型 $(\alpha \le \beta) \to (\beta\le\gamma) \to (\alpha\le\gamma)$ 是一个纯命题,因此通过 0-截断上的归纳,我们可以假设 $\alpha$、$\beta$ 和 $\gamma$ 分别是 $\cd{A}$、$\cd{B}$ 和 $\cd{C}$。
现在,由于 $\cd{A} \le \cd{C}$ 是一个纯命题,通过 $(-1)$-截断上的归纳,我们可以假设给定了从 $A$ 到 $B$ 的单射 $f$ 和从 $B$ 到 $C$ 的单射 $g$。
但是,$g\circ f$ 是从 $A$ 到 $C$ 的一个单射,因此 $\cd{A} \le \cd{C}$ 成立。
反身性 (reflexivity) 更容易证明。
\end{proof}
我们还可以证明基数不等式与半环运算的兼容性。
\begin{lem}\label{thm:injsurj}
\index{function!injective}%
\index{function!surjective}%
考虑以下命题:
\begin{enumerate}
\item 存在从 $A$ 到 $B$ 的一个单射。\label{item:cle-inj}
\item 存在从 $B$ 到 $A$ 的一个满射。\label{item:cle-surj}
\end{enumerate}
那么,在假设排中律 (excluded middle) 的情况下:
\index{excluded middle}%
\index{axiom!of choice}%
\begin{itemize}
\item 给定 $a_0:A$,我们有 \ref{item:cle-inj}$\to$\ref{item:cle-surj}。
\item 因此,如果 $A$ 是居留 (merely inhabited) 的,我们有 \ref{item:cle-inj} $\to$ 仅仅存在 \ref{item:cle-surj}。
\item 假设选择公理 (axiom of choice),我们有 \ref{item:cle-surj} $\to$ 仅仅存在 \ref{item:cle-inj}。
\end{itemize}
\end{lem}
\begin{proof}
如果 $f:A\to B$ 是一个单射,则定义 $g:B\to A$ 如下。
由于 $f$ 是单射,因此 $f$ 在 $b$ 处的纤维是一个纯命题。
因此,根据排中律,要么存在 $a:A$ 满足 $f(a)=b$,要么不存在。
在第一种情况下,定义 $g(b)\defeq a$;否则设定 $g(b)\defeq a_0$。
那么对于任何 $a:A$,我们有 $a = g(f(a))$,所以 $g$ 是满射。
第二条是通过截断上的归纳得到的。
对于第三条,如果 $g:B\to A$ 是满射,那么根据选择公理,仅仅存在一个函数 $f:A\to B$ 满足对所有的 $a$ 有 $g(f(a)) = a$。
但此时 $f$ 必然是单射。
\end{proof}
\begin{thm}[Schroeder--Bernstein (施罗德–贝尔斯坦定理)]
\index{theorem!Schroeder--Bernstein}%
\index{Schroeder--Bernstein theorem}%
在假设排中律的情况下,对于集合 $A$ 和 $B$ 我们有:
\[ \inj(A,B) \to \inj(B,A) \to (A\cong B) \]
\end{thm}
\begin{proof}
常见的“来回反复 (back-and-forth)”论证在此仍然适用。
注意,这实际上构造了一个同构 $A\cong B$(假设排中律,以便我们可以决定给定元素是属于循环、无限链、从 $A$ 开始的链,还是从 $B$ 开始的链)。
\end{proof}
\begin{cor}
在假设排中律的情况下,基数不等式是一个偏序 (partial order),即对于 $\alpha,\beta:\card$ 我们有:
\[ (\alpha\le\beta) \to (\beta\le\alpha) \to (\alpha=\beta). \]
\end{cor}
\begin{proof}
由于 $\alpha=\beta$ 是一个纯命题,通过截断上的归纳,我们可以假设 $\alpha$ 和 $\beta$ 分别是 $\cd{A}$ 和 $\cd{B}$,并且我们有从 $A$ 到 $B$ 的单射 $f$ 和从 $B$ 到 $A$ 的单射 $g$。
但根据施罗德–贝尔斯坦定理,我们得到了一个同构 $A\cong B$,因此得到了一个等式 $\cd{A}=\cd{B}$。
\end{proof}
最后,我们可以重现康托尔 (Cantor) 定理,证明对于每个基数,都存在一个更大的基数。
\begin{thm}[康托尔定理 (Cantor's theorem)]
\index{Cantor's theorem}%
\index{theorem!Cantor's}%
对于 $A:\set$,不存在满射 $A \to (A\to \bool)$。
\end{thm}
\begin{proof}
假设 $f:A \to (A\to \bool)$ 是任意一个函数,定义 $g:A\to \bool$ 为 $g(a) \defeq \neg f(a)(a)$。
如果 $g = f(a_0)$,那么 $g(a_0) = f(a_0)(a_0)$ 但 $g(a_0) = \neg f(a_0)(a_0)$,这就矛盾了。
因此,$f$ 不是满射。
\end{proof}
\begin{cor}
在假设排中律的情况下,对于任意 $\alpha:\card$,存在一个基数 $\beta$ 使得 $\alpha\le\beta$ 且 $\alpha\neq\beta$。
\end{cor}
\begin{proof}
令 $\beta = 2^\alpha$。
现在我们想要证明一个纯命题,所以通过归纳我们可以假设 $\alpha$ 是 $\cd{A}$,因此 $\beta\jdeq \cd{A\to \bool}$。
在排中律的帮助下,我们定义了一个函数 $f:A\to (A\to \bool)$,定义为:
\[f(a)(a') \defeq
\begin{cases}
\btrue &\quad a=a'\\
\bfalse &\quad a\neq a'.
\end{cases}
\]
如果 $f(a)=f(a')$,那么 $f(a')(a) = f(a)(a) = \btrue$,所以 $a=a'$;因此 $f$ 是单射。
因此,$\alpha \jdeq \cd{A} \le \cd{A\to \bool} \jdeq 2^\alpha$。
另一方面,如果 $2^\alpha \le \alpha$,那么我们将有一个单射 $(A\to\bool)\to A$。
根据 \cref{thm:injsurj},由于我们有 $(\lam{x} \bfalse):A\to \bool$ 和排中律,那么就会有一个从 $A$ 到 $(A\to \bool)$ 的满射,这与康托尔定理相矛盾。
\end{proof}
\section{序数 (Ordinal numbers)}
\label{sec:ordinals}
\index{ordinal|(}%
\begin{defn}\label{defn:accessibility}
设 $A$ 为一个集合,且
\[(\blank<\blank):A\to A\to \prop\]
是 $A$ 上的一个二元关系。
我们通过归纳定义 $a:A$ 的元素对 $<$ 是 \define{可达 (accessible)} 的:
\indexdef{accessibility}%
\indexsee{accessible}{accessibility}%
\begin{itemize}
\item 如果对所有 $b<a$ 的 $b$ 都是可达的,则 $a$ 是可达的。
\end{itemize}
我们写作 $\acc(a)$ 表示 $a$ 是可达的。
\end{defn}
乍一看,这样的归纳定义似乎无法成立,但如果 $a$ 具有这样一个性质,即不存在 $b$ 使得 $b<a$,那么 $a$ 是可达的,这实际上是成立的。
注意,这是一个类型族的归纳定义,类似于在 \cref{sec:generalizations} 中考虑的向量类型。
更确切地说,它只有一个构造器,记为 $\acc_<$,其类型为
\[ \acc_< : \prd{a:A} \Parens{\prd{b:A} (b<a) \to \acc(b)} \to \acc(a). \]
\index{induction principle!for accessibility}%
$\acc$ 的归纳原理表明,对于任意 $P:\prd{a:A} \acc(a) \to \type$,如果我们有
\[f:\prd{a:A}{h:\prd{b:A} (b<a) \to \acc(b)}
\Parens{\prd{b:A}{l:b<a} P(b,h(b,l))} \to
P(a,\acc_<(a,h)),
\]
那么我们就有通过归纳定义的 $g:\prd{a:A}{c:\acc(a)} P(a,c)$,其中
\[g(a,\acc_<(a,h)) \jdeq f(a,\,h,\,\lam{b}{l} g(b,h(b,l))).\]
这个公式很繁琐,但通常我们只在 $P:A\to\type$ 只依赖于 $A$ 时使用它的简化形式。
在这种情况下,$f$ 的第二和第三个参数可以合并,因此我们要证明的是
\[f:\prd{a:A} \Parens{\prd{b:A} (b<a) \to \acc(b) \times P(b)}
\to P(a).
\]
也就是说,我们假设每个 $b<a$ 都是可达的,且 $g(b):P(b)$ 已定义,然后从这些定义 $g(a):P(a)$。
省略 $P$ 的第二个参数是通过以下引理来证明的,这也是我们唯一一次使用归纳原理的更一般形式。
\begin{lem}
可达性 (Accessibility)\index{accessibility} 是一个纯属性。
\end{lem}
\begin{proof}
我们必须证明,对于任意 $a:A$ 和 $s_1,s_2:\acc(a)$,有 $s_1=s_2$。
我们通过 $s_1$ 的归纳来证明这一点,其归纳假设为
\[P_1(a,s_1) \defeq \prd{s_2:\acc(a)} (s_1=s_2)。 \]
因此,我们必须证明,对于任意 $a:A$ 和 ${h_1:\prd{b:A} (b<a) \to \acc(b)}$ 以及
\[ k_1:{\prd{b:A}{l:b<a}{t:\acc(b)} h_1(b,l) = t},\]
我们有 $\acc_<(a,h) = s_2$ 对于任意 $s_2:\acc(a)$。
我们将这个陈述视为 $\prd{a:A}{s_2:\acc(a)} P_2(a,s_2)$,其中
\[P_2(a,s_2) \defeq
\prd{h_1 : \cdots } %{h_1:\prd{b:A} (b<a) \to \acc(b)}
{k_1 : \cdots} % \Parens{\prd{b:A}{l:b<a}{t:\acc(b)} h_1(b,l) = t} \to
(\acc_<(a,h_1) = s_2);
\]
因此,我们可以通过 $s_2$ 的归纳来证明它。
因此,我们假设 $h_2 : \prd{b:A} (b<a) \to \acc(b)$,并且 $k_2$ 具有一个复杂但无关紧要的类型,
% \begin{narrowmultline*}
% k_2:\prd{b:A}{l:b<a}
% \prd{h_1:\prd{b':A} (b'<b) \to \acc(b')}
% \narrowbreak
% \Parens{\prd{b':A}{l':b'<b}{t':\acc(b')} h_1(b',l') = t'} \to
% (\acc_<(b,h_1) = h_2(b,l)).
% \end{narrowmultline*}
并且必须证明,对于任意类型为上述类型的 $h_1$ 和 $k_1$,
我们有 $\acc_<(a,h_1) = \acc_<(a,h_2)$。
根据函数外延性 (function extensionality),只需证明 $h_1(b,l) = h_2(b,l)$ 对于所有 $b:A$ 和 $l:b<a$。
这是由 $k_1$ 推出的。
\end{proof}
\begin{defn}
集合 $A$ 上的二元关系 $<$ 是 \define{良基 (well-founded)} 的
\indexdef{relation!well-founded}%
\indexdef{well-founded!relation}%
如果 $A$ 的每个元素都是可达的。
\end{defn}
良基性的意义在于,对于 $P:A\to \type$,我们可以使用 $\acc$ 的归纳原理得出 $\prd{a:A} \acc(a) \to P(a)$,然后应用良基性得出 $\prd{a:A} P(a)$。
换句话说,如果从 $\fall{b:A} (b<a) \to P(b)$ 我们可以证明 $P(a)$,那么 $\fall{a:A} P(a)$ 成立。
这称为 \define{良基归纳 (well-founded induction)}\indexdef{well-founded!induction}。
\begin{lem}
良基性是一个纯属性。
\end{lem}
\begin{proof}
$<$ 的良基性是类型 $\prd{a:A} \acc(a)$,它是一个纯命题,因为每个 $\acc(a)$ 是一个纯命题。
\end{proof}
\begin{eg}\label{thm:nat-wf}
也许最为熟悉的良基关系是自然数 \nat 上的通常的严格排序。
要证明这是良基的,我们必须证明对于每个 $n:\nat$,$n$ 是可达的。
\index{strong!induction}%
这只是从 \nat 上的普通归纳得出的“强归纳” (strong induction) 的常规证明。
具体来说,我们通过对 $n:\nat$ 的归纳证明 $k\le n$ 的所有 $k$ 都是可达的。
基本情况只是 $0$ 是可达的,这在逻辑上成立,因为没有任何元素严格小于 $0$。
对于归纳步骤,我们假设 $k\le n$ 的所有 $k$ 都是可达的,这就是说,对于所有 $k<n+1$,因此根据定义 $n+1$ 也是可达的。
\nat 上的一个不同关系也可以是良基的,即设定仅 $n < \suc(n)$ 对于所有 $n:\nat$。
这个关系的良基性几乎正是 \nat 的普通归纳原理。
\end{eg}
\begin{eg}\label{thm:wtype-wf}
设 $A:\set$ 且 $B : A \to \set$ 是集合的一个族。
回忆 \cref{sec:w-types} 中的 $W$-类型 $\wtype{a:A} B(a)$ 是由单个构造器归纳生成的
\begin{itemize}
\item $\supp : \prd{a:A} (B(a) \to \wtype{x:A} B(x)) \to \wtype{x:A} B(x)$
\end{itemize}
我们通过其第二个参数递归地定义 $\wtype{x:A} B(x)$ 上的关系 $<$:
\begin{itemize}
\item 对于任意 $a:A$ 和 $f:B(a) \to \wtype{x:A} B(x)$,我们定义 $w<\supp(a,f)$ 表示仅存在一个 $b:B(a)$ 使得 $w = f(b)$。
\end{itemize}
现在我们使用 $\wtype{x:A}B(x)$ 的通常归纳原理证明对该关系的每个 $w:\wtype{x:A} B(x)$ 是可达的。
这意味着我们假设给定了 $a:A$ 和 $f:B(a) \to \wtype{x:A} B(x)$,以及一个提升 $f' : \prd{b:B(a)} \acc(f(b))$。
但根据 $<$ 的定义,对于所有 $w<\supp(a,f)$,我们有 $\acc(w)$;因此 $\supp(a,f)$ 是可达的。
\end{eg}
良基性允许我们通过递归定义函数,并通过归纳证明陈述,例如以下内容。
回忆 \cref{subsec:prop-subsets} 中 $\power B$ 表示幂集 $\power B \defeq (B\to\prop)$。
\begin{lem}\label{thm:wfrec}
假设 $B$ 是一个集合,并且我们有一个函数
\[ g : \power B \to B \]
那么,如果 $<$ 是 $A$ 上的一个良基关系,那么存在一个函数 $f:A\to B$,使得对所有 $a:A$ 我们有
\begin{equation*}
f(a) = g\Big(\setof{ f(a') | a'<a }\Big)。
\end{equation*}
\end{lem}
\noindent
(我们使用了 \cref{sec:image} 中关于子集的像的记法。)
\begin{proof}
我们首先定义,对于每个 $a:A$ 和 $s:\acc(a)$,一个元素 $\bar f(a,s):B$。
根据归纳假设,我们假设 $s$ 是一个函数,将每个 $a'<a$ 分配给一个证据 $s(a'):\acc(a')$,并且对每个这样的 $a'$,我们有一个元素 $\bar f(a',s(a')):B$。
在这种情况下,我们定义
\begin{equation*}
\bar f(a,s) \defeq g\Big(\setof{ \bar f(a',s(a')) | a'<a }\Big)。
\end{equation*}
现在,由于 $<$ 是良基的,我们有一个函数 $w:\prd{a:A} \acc(a)$。
因此,我们可以定义 $f(a)\defeq \bar f (a,w(a))$。
\end{proof}
在经典逻辑中,良基性有一个更为人所熟知的重新表述。在以下内容中,我们说一个子集 $B: \power A$ 是\define{非空的 (nonempty)} \indexdef{nonempty subset},如果它不等于空子集 $(\lam{x}\bot) : \power X$。我们留给读者验证,在假设排中律的前提下,这与单纯的可居住性是等价的,即满足条件 $\exis{x:A} x\in B$。
\begin{lem}\label{thm:wfmin}
\index{excluded middle}%
假设排中律,$<$ 是良基的当且仅当每个非空子集 $B: \power A$ 都仅有一个最小元素。
\end{lem}
\begin{proof}
首先假设 $<$ 是良基的,并假设 $B\subseteq A$ 是一个没有最小元素的子集。
也就是说,对于任何 $a:A$ 使得 $a\in B$,仅存在一个 $b:A$ 使得 $b<a$ 且 $b\in B$。
我们断言,对于任意 $a:A$ 和 $s:\acc(a)$,我们有 $a\notin B$。
通过归纳,我们可以假设 $s$ 是一个函数,将每个 $a'<a$ 分配给一个证明 $s(a'):\acc(a')$,并且对每个这样的 $a'$,我们有 $a'\notin B$。
如果 $a\in B$,那么根据假设,必然存在一个 $b<a$ 且 $b\in B$,这与假设矛盾。
因此,$a\notin B$;这完成了归纳。
由于 $<$ 是良基的,我们有 $a\notin B$ 对所有 $a:A$ 成立,即 $B$ 是空的。
现在假设每个非空子集都仅有一个最小元素。
设 $B = \setof{ a:A | \neg \acc(a) }$。
那么,如果 $B$ 是非空的,它仅有一个最小元素。
因此,仅存在一个 $a:A$ 使得 $a\in B$,并且对所有 $b<a$,我们有 $\acc(b)$。
但是根据定义(以及对截断的归纳),$a$ 是仅可达的,因此是可达的,这与 $a\in B$ 矛盾。
因此,$B$ 是空的,所以 $<$ 是良基的。
\end{proof}
\begin{defn}
集合 $A$ 上的良基关系 $<$ 是\define{外延 (extensional)} 的
\indexdef{relation!extensional}%
\indexdef{extensional!relation}%
如果对于任意 $a,b:A$,我们有
\[ \Parens{\fall{c:A} (c<a) \Leftrightarrow (c<b)} \to (a=b)。 \]
\end{defn}
注意,由于 $A$ 是一个集合,外延性是一个纯属性。
这种“外延性”的概念与函数外延性 (function extensionality) 无关,也与等式类型的外延性无关。
\index{axiom!of extensionality}%
相反,它是经典集合论中外延公理的“局部”对应。
\begin{thm}
外延良基关系的类型是一个集合。
\end{thm}
\begin{proof}
根据公理 (univalence axiom),如果 $(A,<)$ 是外延和良基的,并且 $f:(A,<) \cong (A,<)$,那么我们必须证明 $f=\idfunc[A]$。
\index{automorphism!of extensional well-founded relations}%
我们通过对 $<$ 进行归纳来证明对于所有 $a:A$,$f(a)=a$。
归纳假设是,对于所有 $a'<a$,我们有 $f(a')=a'$。
现在,由于 $A$ 是外延的,为了得出 $f(a)=a$,我们只需证明
\[\fall{c:A}(c<f(a)) \Leftrightarrow (c<a)。\]
但是,由于 $f$ 是一个自同构,我们有 $(c<a) \Leftrightarrow (f(c)<f(a))$。
但 $c<a$ 意味着根据归纳假设 $f(c)=c$,因此 $(c<a) \to (c<f(a))$。
另一方面,如果 $c<f(a)$,那么 $f^{-1}(c)<a$,因此 $c = f(f^{-1}(c)) = f^{-1}(c)$ 再次根据归纳假设;因此 $c<a$。
因此,我们有 $(c<a) \Leftrightorrow (c<f(a))$ 对于任意 $c:A$,所以 $f(a)=a$。
\end{proof}
\begin{defn}\label{def:simulation}
如果 $(A,<)$ 和 $(B,<)$ 是外延良基的关系,$f:A\to B$ 是一个\define{模拟 (simulation)}
\indexdef{simulation}%
\indexsee{function!simulation}{simulation}%
如果满足以下条件:
\begin{enumerate}
\item 如果 $a<a'$,那么 $f(a)<f(a')$,并且\label{item:sim1}
\item 对于所有 $a:A$ 和 $b:B$,如果 $b<f(a)$,那么仅存在一个 $a'<a$ 使得 $f(a')=b$。\label{item:sim2}
\end{enumerate}
\end{defn}
\begin{lem}
任何模拟都是单射的。
\end{lem}
\begin{proof}
我们通过双重良基归纳证明,对于任意 $a,b:A$,如果 $f(a)=f(b)$,那么 $a=b$。
归纳假设对于 $a:A$ 表示,对于任意 $a'<a$ 和任意 $b:B$,如果 $f(a')=f(b)$,那么 $a=b$。
内部归纳假设对于 $b:A$ 表示,对于任意 $b'<b$,如果 $f(a)=f(b')$,那么 $a=b'$。
假设 $f(a)=f(b)$;我们必须证明 $a=b$。
根据外延性,为了证明 $f(a)=b$,我们只需证明 $\fall{c:A}(c<a) \Leftrightarrow (c<b)$。
但是,由于 $f$ 是一个模拟,如果 $c<a$,那么我们有 $f(c)<f(a)$ 根据 \cref{def:simulation}\ref{item:sim1}。
因此 $f(c)<f(b)$,所以根据 \cref{def:simulation}\ref{item:sim2},仅存在一个 $c':A$ 使得 $c'<b$ 且 $f(c)=f(c')$。
根据归纳假设 $a$,我们有 $c=c'$,因此 $c<b$。
对称的论证也是对称的。
\end{proof}
特别地,这意味着在 \cref{def:simulation}\ref{item:sim2} 中可以去掉“仅”一词而不改变意义。
\begin{cor}
如果 $f:A\to B$ 是一个模拟,那么对于所有 $a:A$ 和 $b:B$,如果 $b<f(a)$,那么\emph{必然}存在一个 $a'<a$ 使得 $f(a')=b$。
\end{cor}
\begin{proof}
由于 $f$ 是单射的,$\sm{a:A} (f(a)=b)$ 是一个纯命题。
\end{proof}
我们说一个子集 $C :\power B$ 是\define{初始段 (initial segment)} \indexdef{initial!segment} \indexsee{segment, initial}{initial segment},如果 $c\in C$ 并且 $b<c$,那么 $b\in C$。模拟的像必须是一个初始段,而任何初始段的包含是一个模拟。因此,根据公理 (univalence axiom),每个 $A\to B$ 的模拟\emph{等同于} $B$ 的某个初始段的包含。
\begin{thm}
对于一个集合 $A$,设 $P(A)$ 为 $A$ 上的外延良基关系的类型。
如果 $\mathord{<_A} : P(A)$ 和 $\mathord{<_B} : P(B)$ 并且 $f:A\to B$,令 $H_{\mathord{<_A}\mathord{<_B}}(f)$ 是 $f$ 是一个模拟的纯命题。
那么 $(P,H)$ 是一个标准的结构概念,属于 \uset 中的结构,见 \cref{sec:sip}。
\end{thm}
\begin{proof}
我们留给读者验证,恒等是模拟,并且模拟的复合也是模拟。
因此,我们有了一个结构的概念。