Skip to content

Commit 67626f0

Browse files
authored
Merge pull request #73776 from slavapestov/update-generics-docs
docs: Update generics.tex
2 parents 446ff7b + d489ad3 commit 67626f0

31 files changed

+6149
-5306
lines changed

docs/Generics/chapters/generic-environments.tex renamed to docs/Generics/chapters/archetypes.tex

Lines changed: 38 additions & 40 deletions
Large diffs are not rendered by default.

docs/Generics/chapters/basic-operation.tex

Lines changed: 54 additions & 53 deletions
Large diffs are not rendered by default.

docs/Generics/chapters/building-generic-signatures.tex

Lines changed: 1026 additions & 865 deletions
Large diffs are not rendered by default.

docs/Generics/chapters/class-inheritance.tex

Lines changed: 639 additions & 22 deletions
Large diffs are not rendered by default.

docs/Generics/chapters/compilation-model.tex

Lines changed: 50 additions & 49 deletions
Large diffs are not rendered by default.

docs/Generics/chapters/completion.tex

Lines changed: 98 additions & 98 deletions
Large diffs are not rendered by default.

docs/Generics/chapters/concrete-conformances.tex

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
\begin{document}
44

5-
\chapter{Concrete Conformances}\label{concrete conformances}
5+
\chapter[]{Concrete Conformances}\label{concrete conformances}
66

77
\ifWIP
88
TODO:
@@ -15,7 +15,7 @@ \chapter{Concrete Conformances}\label{concrete conformances}
1515
\end{itemize}
1616
\fi
1717

18-
\section{Type Witnesses}\label{rqm type witnesses}
18+
\section[]{Type Witnesses}\label{rqm type witnesses}
1919

2020
\IndexTwoFlag{debug-requirement-machine}{concretize-nested-types}
2121

@@ -29,7 +29,7 @@ \section{Type Witnesses}\label{rqm type witnesses}
2929
\end{itemize}
3030
\fi
3131

32-
\section{Recursive Conformances}
32+
\section[]{Recursive Conformances}
3333

3434
\ifWIP
3535
TODO:
@@ -46,11 +46,13 @@ \section{Recursive Conformances}
4646

4747
\IndexFlag{enable-requirement-machine-opaque-archetypes}
4848

49-
\section{Concrete Contraction}\label{concrete contraction}
49+
\section[]{Concrete Contraction}\label{concrete contraction}
5050

5151
\IndexFlag{disable-requirement-machine-concrete-contraction}
5252
\IndexTwoFlag{debug-requirement-machine}{concrete-contraction}
5353

54+
\IndexDefinition{concrete contraction}
55+
5456
\ifWIP
5557
TODO:
5658
\begin{itemize}
@@ -63,6 +65,6 @@ \section{Concrete Contraction}\label{concrete contraction}
6365
\end{itemize}
6466
\fi
6567

66-
\section{Source Code Reference}
68+
\section[]{Source Code Reference}
6769

68-
\end{document}
70+
\end{document}

docs/Generics/chapters/conformance-paths.tex

Lines changed: 115 additions & 103 deletions
Large diffs are not rendered by default.

docs/Generics/chapters/conformances.tex

Lines changed: 91 additions & 99 deletions
Large diffs are not rendered by default.

docs/Generics/chapters/declarations.tex

Lines changed: 859 additions & 262 deletions
Large diffs are not rendered by default.

docs/Generics/chapters/derived-requirements-summary.tex

Lines changed: 77 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,84 @@
55
\chapter{Derived Requirements Summary}\label{derived summary}
66

77
\index{$\vdash$}
8-
\IndexStep{GenSig}
9-
\IndexStep{ReqSig}
10-
\IndexStep{AssocType}
11-
\IndexStep{Conf}
12-
\IndexStep{Equiv}
13-
\IndexStep{Same}
14-
\IndexStep{Member}
15-
\IndexStep{Concrete}
168

9+
Let $G$ be a \index{generic signature!summary}generic signature. We generate the theory of~$G$ by repeated application of inference rules, starting from a finite set of elementary statements. A derivation proves that some element belongs to this set by giving a list of derivation steps where the assumptions in each step are conclusions of previous steps. Nomenclature:
10+
\begin{center}
11+
\begin{tabular}{ll}
12+
\toprule
13+
\textbf{Symbol}&\textbf{Description}\\
14+
\midrule
15+
\texttt{T}, \texttt{U}, and \texttt{V}&\index{type parameter!summary}type parameters\\
16+
\texttt{Self.U} and \texttt{Self.V}&type parameters rooted in the \index{protocol Self type!summary}protocol \texttt{Self} type\\
17+
\texttt{X}&a concrete type\\
18+
\texttt{C}&a concrete \index{class type!summary}class type\\
19+
$\Xprime$ and $\Cprime$&obtained from \texttt{X} and \texttt{C} by replacing \texttt{Self} with \texttt{T}\\
20+
\texttt{P} and \texttt{Q}&protocols\\
21+
\texttt{A}&the name of an \index{associated type declaration!summary}associated type of \texttt{P}\\
22+
\texttt{[P]A}&an associated type declaration of \texttt{P}\\
23+
\texttt{T.[P]A} and \texttt{T.A}&\index{bound dependent member type!summary}bound and \index{unbound dependent member type!summary}unbound dependent member type\\
24+
$\ConfReq{T}{P}$&a \index{conformance requirement!summary}conformance requirement\\
25+
$\SameReq{T}{U}$&a \index{same-type requirement!summary}same-type requirement between type parameters\\
26+
$\SameReq{T}{X}$&a concrete same-type requirement\\
27+
$\ConfReq{T}{C}$&a \index{superclass requirement!summary}superclass requirement\\
28+
$\ConfReq{T}{AnyObject}$&a \index{layout requirement!summary}layout requirement\\
29+
$\ConfReq{Self.U}{Q}_\texttt{P}$&an \index{associated requirement!summary}associated requirement of protocol \texttt{P}\\
30+
\bottomrule
31+
\end{tabular}
32+
\end{center}
33+
See \index{derived requirement!summary}\index{valid type parameter!summary}\SecRef{derived req} and \SecRef{type params} for details.
34+
35+
\index{elementary derivation step!summary}\paragraph{Elementary statements.}
36+
For \IndexStepTwo{Generic}{summary}each generic parameter \ttgp{d}{i} of~$G$:
37+
\begin{gather*}
38+
\GenericStepDef
39+
\end{gather*}
40+
For \IndexStepTwo{Conf}{summary}\IndexStepTwo{Same}{summary}\IndexStepTwo{Concrete}{summary}\IndexStepTwo{Super}{summary}\IndexStepTwo{Layout}{summary}each explicit requirement of~$G$ by \index{requirement kind!summary}kind:
41+
\begin{gather*}
42+
\ConfStepDef\\
43+
\SameStepDef\\
44+
\ConcreteStepDef\\
45+
\SuperStepDef\\
46+
\LayoutStepDef
47+
\end{gather*}
48+
49+
\index{requirement signature!summary}
50+
\paragraph{Requirement signatures.}
51+
Assume $G\vdash\ConfReq{T}{P}$. For \IndexStepTwo{AssocName}{summary}\IndexStepTwo{AssocDecl}{summary}\IndexStepTwo{AssocBind}{summary}each associated type~\texttt{A} of~\texttt{P}:
52+
\begin{gather*}
53+
\AssocNameStepDef\\
54+
\AssocDeclStepDef\\
55+
\AssocBindStepDef
56+
\end{gather*}
57+
For each \IndexStepTwo{AssocConf}{summary}\IndexStepTwo{AssocSame}{summary}\IndexStepTwo{AssocConcrete}{summary}\IndexStepTwo{AssocSuper}{summary}\IndexStepTwo{AssocLayout}{summary}associated requirement of~\texttt{P} by kind:
58+
\begin{gather*}
59+
\AssocConfStepDef\\
60+
\AssocSameStepDef\\
61+
\AssocConcreteStepDef\\
62+
\AssocSuperStepDef\\
63+
\AssocLayoutStepDef
64+
\end{gather*}
65+
66+
\paragraph{Equivalence.}
67+
Same-type requirements \IndexStepTwo{Reflex}{summary}\IndexStepTwo{Sym}{summary}\IndexStepTwo{Trans}{summary}generate an equivalence relation:
68+
\begin{gather*}
69+
\ReflexStepDef\\
70+
\SymStepDef\\
71+
\TransStepDef
72+
\end{gather*}
73+
74+
\paragraph{Compatibility.}
75+
A derived conformance, superclass or layout requirement \IndexStepTwo{SameConf}{summary}\IndexStepTwo{SameSuper}{summary}\IndexStepTwo{SameLayout}{summary}\IndexStepTwo{SameName}{summary}\IndexStepTwo{SameDecl}{summary}applies to all type parameters in an equivalence class:
76+
\begin{gather*}
77+
\SameConfStepDef\\
78+
\SameConcreteStepDef\\
79+
\SameSuperStepDef\\
80+
\SameLayoutStepDef
81+
\end{gather*}
82+
If two type parameters are equivalent, so are \IndexStepTwo{SameName}{summary}\IndexStepTwo{SameDecl}{summary}all corresponding member types:
1783
\begin{gather*}
18-
\vdash\ConfReq{T}{P}\tag{\textsc{GenSig}}\\
19-
\vdash\ConfReq{T}{C}\\
20-
\vdash\ConfReq{T}{AnyObject}\\
21-
\vdash\FormalReq{T == U}\\[\medskipamount]
22-
\ConfReq{T}{P}\vdash\texttt{T.A}\tag{\textsc{AssocType}}\\
23-
\ConfReq{T}{P}\vdash\texttt{T.[P]A}\\
24-
\ConfReq{T}{P}\vdash\FormalReq{T.[P]A == T.A}\\[\medskipamount]
25-
\vdash\ConfReq{Self.U}{Q}_\texttt{P}\tag{\textsc{ReqSig}}\\
26-
\vdash\ConfReq{Self.U}{C}_\texttt{P}\\
27-
\vdash\ConfReq{Self.U}{AnyObject}_\texttt{P}\\
28-
\vdash\FormalReq{Self.U == Self.V}_\texttt{P}\\[\medskipamount]
29-
\ConfReq{T}{P},\,\ConfReq{Self.U}{Q}\vdash\ConfReq{T.U}{Q}\tag{\textsc{Conf}}\\
30-
\ConfReq{T}{P},\,\ConfReq{Self.U}{C}\vdash\ConfReq{T.U}{C}\\
31-
\ConfReq{T}{P},\,\ConfReq{Self.U}{AnyObject}\vdash\ConfReq{T.U}{AnyObject}\\
32-
\ConfReq{T}{P},\,\FormalReq{Self.U == Self.V}\vdash\FormalReq{T.U == T.V}\\[\medskipamount]
33-
\texttt{T}\vdash\FormalReq{T == T}\tag{\textsc{Equiv}}\\
34-
\FormalReq{T == U}\vdash\FormalReq{U == T}\\
35-
\FormalReq{T == U},\,\FormalReq{U == V}\vdash\FormalReq{T == V}\\[\medskipamount]
36-
\ConfReq{U}{P},\,\FormalReq{T == U}\vdash\ConfReq{T}{P}\tag{\textsc{Same}}\\
37-
\ConfReq{U}{C},\,\FormalReq{T == U}\vdash\ConfReq{T}{C}\\
38-
\ConfReq{U}{AnyObject},\,\FormalReq{T == U}\vdash\ConfReq{T}{AnyObject}\\[\medskipamount]
39-
\ConfReq{U}{P},\,\FormalReq{T == U}\vdash\FormalReq{T.A == U.A}\tag{\textsc{Member}}\\
40-
\ConfReq{U}{P},\,\FormalReq{T == U}\vdash\FormalReq{T.[P]A == U.[P]A}\\[\medskipamount]
41-
\FormalReq{T == U}\vdash\FormalReq{G<T> == G<U>}\qquad\mbox{(arbitrary type constructor \texttt{G<>})}\tag{\textsc{Concrete}}\\
42-
\FormalReq{G<T> == G<U>}\vdash\FormalReq{T == U}\qquad\mbox{(arbitrary type constructor \texttt{G<>})}
84+
\SameNameStepDef\\
85+
\SameDeclStepDef
4386
\end{gather*}
4487

45-
\end{document}
88+
\end{document}

0 commit comments

Comments
 (0)