ACCC1380 commited on
Commit
65010eb
·
verified ·
1 Parent(s): 2ef0535

Sync 2 files (first: pic/proof-dependencies.py)

Browse files
chapters/pic/proof-dependencies.py CHANGED
@@ -1,13 +1,13 @@
1
- """绘制引言的证明依赖图。
2
 
3
  需要 Matplotlib 和 Noto Sans CJK SC 的 Regular、Medium 两个 OTF 字体。
4
  python proof-dependencies.py --font-dir /path/to/fonts
5
- 运行后在本文件旁生成同名 SVG。字形转为轮廓,供排版和放大阅读。
6
  """
7
 
8
  import argparse
 
9
  from dataclasses import dataclass
10
- import math
11
  from pathlib import Path
12
 
13
  import matplotlib
@@ -15,11 +15,8 @@ import matplotlib
15
  matplotlib.use("Agg")
16
  import matplotlib.pyplot as plt
17
  from matplotlib.font_manager import FontProperties
18
- from matplotlib.patches import Polygon, Rectangle
19
-
20
-
21
- WIDTH = 1760
22
- HEIGHT = 1770
23
 
24
 
25
  @dataclass(frozen=True)
@@ -29,189 +26,514 @@ class Color:
29
  border: str
30
 
31
 
32
- UPPER = Color("#184e60", "#f1f8fa", "#7398a5")
33
- LOWER = Color("#683d34", "#fcf5f1", "#bc8c7f")
34
- MAIN = Color("#183444", "#eef3f6", "#738895")
35
- ANALYTIC = Color("#30553f", "#f3f8f3", "#819e89")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
 
38
  def draw(font_dir, output, preview):
39
  regular = FontProperties(fname=font_dir / "NotoSansCJKsc-Regular.otf")
40
  medium = FontProperties(fname=font_dir / "NotoSansCJKsc-Medium.otf")
 
41
 
42
- plt.rcParams.update({
43
- "svg.fonttype": "path",
44
- "svg.hashsalt": "proof-dependencies",
45
- "mathtext.fontset": "stix",
46
- })
47
- fig = plt.figure(figsize=(WIDTH / 100, HEIGHT / 100), facecolor="#fff")
48
- ax = fig.add_axes((0, 0, 1, 1), xlim=(0, WIDTH), ylim=(HEIGHT, 0))
49
  ax.set_axis_off()
50
  fitted_text = []
51
 
52
- def write(x, y, label, size, color, *, bold=False, align="center", fit=None):
53
- item = ax.text(
54
- x, y, label, ha=align, va="center", color=color, fontsize=size,
55
- fontproperties=medium if bold else regular, zorder=5,
56
- )
57
  if fit is not None:
58
- fitted_text.append((item, fit))
59
- return item
60
 
61
- def panel(x, y, w, h, title, color):
62
- ax.add_patch(Rectangle(
63
- (x, y), w, h, facecolor=color.fill, edgecolor=color.border, lw=0.8,
64
- zorder=0,
65
  ))
66
- write(x + 22, y + 26, title, 18, color.ink, bold=True, align="left")
67
 
68
- def box(x, y, w, h, title, *details, color=MAIN, highlight=False):
69
- ax.add_patch(Rectangle(
70
- (x, y), w, h, facecolor=color.fill if highlight else "#fff",
71
- edgecolor=color.ink if highlight else color.border,
72
- lw=1.45 if highlight else 0.95, zorder=3,
73
- ))
74
- spacing = 25
75
- title_y = y + h / 2 - spacing * len(details) / 2
76
- write(x + w / 2, title_y, title, 16.6, color.ink, bold=True, fit=w - 24)
77
- for row, detail in enumerate(details, 1):
78
- write(
79
- x + w / 2, title_y + spacing * row, detail, 14, "#253942",
80
- fit=w - 20,
81
- )
82
-
83
- def arrow(*points, color=MAIN, dashed=False):
84
- *start, joint, tip = points
85
- dx, dy = tip[0] - joint[0], tip[1] - joint[1]
86
- distance = math.hypot(dx, dy)
87
- ux, uy = dx / distance, dy / distance
88
- base = (tip[0] - 11 * ux, tip[1] - 11 * uy)
89
- xs, ys = zip(*start, joint, base)
90
- ax.plot(
91
- xs, ys, color=color.ink, lw=1.12,
92
- ls=(0, (4, 3)) if dashed else "-", solid_joinstyle="round", zorder=2,
93
- )
94
- triangle = (tip, (base[0] - 4 * uy, base[1] + 4 * ux),
95
- (base[0] + 4 * uy, base[1] - 4 * ux))
96
- ax.add_patch(Polygon(triangle, closed=True, fc=color.ink, ec="none", zorder=4))
97
-
98
- write(46, 42, "证明的依赖关系", 25, MAIN.ink, bold=True, align="left")
99
- arrow((1110, 43), (1164, 43))
100
- write(1180, 43, "构造与推导", 13, MAIN.ink, align="left")
101
- arrow((1396, 43), (1450, 43), color=ANALYTIC, dashed=True)
102
- write(1466, 43, "解析估计提供的输入", 13, ANALYTIC.ink, align="left")
103
-
104
- box(471, 83, 818, 100, "辅助模数与自守数据",
105
- "同余类中的素数 $d$ 确定二次域,截断与权重确定提升数据",
106
- r"$q_0=18480q,\quad d\equiv q_0/2-1\ (\mathrm{mod}\ q_0),\quad a=xb$",
107
- highlight=True)
108
-
109
- panel(38, 220, 696, 646, "余体积与指数的上界", UPPER)
110
- panel(760, 220, 962, 646, "修正余体积的下界", LOWER)
111
-
112
- # 上界由短整性和张成维数两条支线合成。
113
- box(64, 277, 300, 90, "跷跷板恒等式", "比较两条复合提升路径", color=UPPER)
114
- box(404, 277, 304, 90, "Poincaré 二阶矩", "结合 Hecke 谱的重数比较", color=UPPER)
115
- box(64, 410, 300, 90, "导数与整除性", "无穷位的范数与有限位的赋值", color=UPPER)
116
- box(404, 546, 304, 111, "定理 B 张成维数",
117
- "用少量平移得到大维数的像", r"$|T|u\leq 5h\log(1+2b^2)$", color=UPPER, highlight=True)
118
- box(64, 546, 300, 111, "定理 A 短整源形式",
119
- "短整形式张成源空间", "控制提升平方范数和指数", color=UPPER, highlight=True)
120
- box(100, 721, 572, 113, "选出线性无关的目标形式族",
121
- r"$(1-4/b^2)h\leq n\leq h$",
122
- r"$V=n(H-m\,\mathrm{rem}+L),\ \delta=hI$", color=UPPER, highlight=True)
123
-
124
- arrow((214, 367), (214, 410), color=UPPER)
125
- arrow((214, 500), (214, 546), color=UPPER)
126
- arrow((556, 367), (556, 546), color=UPPER)
127
- arrow((214, 657), (214, 721), color=UPPER)
128
- arrow((556, 657), (556, 721), color=UPPER)
129
-
130
- # 补基的周期转移与长链行列式的高度分处两支。
131
- box(786, 277, 301, 90, "转置提升与限制", "满射性把张成族送到首端", color=LOWER)
132
- box(1107, 277, 275, 90, "Hecke 同余", "控制投影的分母", color=LOWER)
133
- box(1402, 277, 295, 90, "局部 Galois 条件", "约束同余给出的扩张类", color=LOWER)
134
- box(786, 410, 301, 90, "双网格的周期转移",
135
- r"$m^2$ 次方格交换", color=LOWER)
136
- box(1107, 410, 275, 90, "单次提升的高度界", "真提升与正交补的比较", color=LOWER)
137
- box(1402, 410, 295, 90, "正则反分圆扭曲", "控制 Selmer 群和特殊值比", color=LOWER)
138
- box(786, 546, 301, 111, "辅助形式",
139
- "具有整性与统一的范数界", "用来补全目标空间的一组基", color=LOWER)
140
- box(1189, 546, 426, 111, "长链行列式比的高度",
141
- "逐级分解,合并单次界与特殊值比",
142
- r"$Z(1)/Z(\vartheta_\iota)$", color=LOWER)
143
- box(872, 721, 726, 113, "定理 C 修正余体积下界",
144
- "用乘积公式合并补基代价和长链高度",
145
- r"$V+2\delta\geq h(H-3L)$", color=LOWER, highlight=True)
146
-
147
- arrow((786, 322), (773, 322), (773, 601), (786, 601), color=LOWER)
148
- arrow((1244, 367), (1244, 410), color=LOWER)
149
- arrow((1549, 367), (1549, 410), color=LOWER)
150
- arrow((1402, 456), (1382, 456), color=LOWER)
151
- arrow((936, 500), (936, 546), color=LOWER)
152
- arrow((1244, 500), (1244, 546), color=LOWER)
153
- arrow((1549, 500), (1549, 546), color=LOWER)
154
- arrow((936, 657), (936, 721), color=LOWER)
155
- arrow((1402, 657), (1402, 721), color=LOWER)
156
-
157
- # 共享参数进入两个估计分支,主不等式使用同一家族。
158
- arrow((880, 183), (880, 198), (386, 198), (386, 220))
159
- arrow((880, 198), (1241, 198), (1241, 220))
160
- arrow((386, 834), (386, 914), (685, 914), (685, 958), color=UPPER)
161
- arrow((1235, 834), (1235, 914), (1075, 914), (1075, 958), color=LOWER)
162
- write(880, 917, "在同一形式族上比较", 16, MAIN.ink, bold=True)
163
-
164
- box(483, 958, 794, 98, "主不等式",
165
- r"共有的主量 $hH$ 消去,得到 $m\,\mathrm{rem}\leq fa(\log b)^5$",
166
- highlight=True)
167
-
168
- panel(38, 1080, 1684, 644, "素数幂余项与零点", ANALYTIC)
169
- box(66, 1151, 360, 104, "双截断恒等式",
170
- r"以 $\Phi_a$、$\Phi_b$ 的计数还原余项",
171
- r"分离截断 $x$ 与 $x_1$", color=ANALYTIC)
172
- box(481, 1151, 798, 104, "同余类素数幂余项的单侧界",
173
- r"对每个候选素数 $d$ 与 $\varepsilon>0$,当 $y$ 充分大时",
174
- r"由 $m\geq\sqrt{x}$ 取得平方根尺度",
175
- r"$R_{d,q_0}(y)\leq y^{-1/2+\varepsilon}$", color=ANALYTIC, highlight=True)
176
- box(1334, 1151, 360, 104, "算术级数中的素数定理",
177
- r"控制大截断 $x_1$ 处的两项余项", color=ANALYTIC)
178
- box(66, 1299, 360, 99, "二次扭曲的零点密度估计",
179
- r"按待考察点的位置选取 $d$",
180
- "使扭曲族在所需区域内无零点", color=ANALYTIC)
181
- box(481, 1299, 798, 99, "Landau 单侧判据",
182
- "实轴留数非负,待考察点的留数为零",
183
- r"排除模 $q_0$ 在临界线右侧的零点,$s=1$ 单独处理", color=ANALYTIC)
184
- box(481, 1449, 798, 91, "任意模数在临界线右侧的无零性",
185
- r"经诱导特征与有限欧拉因子���模 $q_0$ 回到模 $q$", color=ANALYTIC, highlight=True)
186
- box(66, 1610, 753, 88, "关于狄利克雷 $L$ 函数临界带零点的广义黎曼猜想",
187
- r"$L(s,\chi)=0,\quad 0<\mathrm{Re}\,s<1\quad\Longrightarrow\quad\mathrm{Re}\,s=1/2$",
188
- color=ANALYTIC, highlight=True)
189
- box(941, 1610, 753, 88, r"关于 $\zeta$ 函数非平凡零点的经典黎曼猜想",
190
- r"$\zeta(s)=0,\quad s\notin\{1,-2,-4,\ldots\}\quad\Longrightarrow\quad\mathrm{Re}\,s=1/2$",
191
- color=ANALYTIC, highlight=True)
192
-
193
- arrow((880, 1056), (880, 1151))
194
- arrow((426, 1203), (481, 1203), color=ANALYTIC)
195
- arrow((1334, 1203), (1279, 1203), color=ANALYTIC, dashed=True)
196
- arrow((880, 1255), (880, 1299), color=ANALYTIC)
197
- arrow((426, 1348), (481, 1348), color=ANALYTIC, dashed=True)
198
- arrow((880, 1398), (880, 1449), color=ANALYTIC)
199
- arrow((880, 1540), (880, 1562), (442, 1562), (442, 1610), color=ANALYTIC)
200
- arrow((880, 1562), (1318, 1562), (1318, 1610), color=ANALYTIC)
201
- write(590, 1586, "对偶特征的函数方程", 14, ANALYTIC.ink)
202
- write(1152, 1586, "模 1 的无零性与完备化函数方程", 14, ANALYTIC.ink)
203
 
204
  fig.canvas.draw()
205
  renderer = fig.canvas.get_renderer()
206
- for item, limit in fitted_text:
207
- width = item.get_window_extent(renderer).width
208
- if width > limit:
209
- raise ValueError(f"方框文字宽 {width:.1f},超过 {limit}:{item.get_text()}")
210
 
211
- fig.savefig(output, metadata={"Title": "证明的依赖关系", "Date": None})
212
  if preview:
213
- fig.savefig(preview, dpi=92)
214
  plt.close(fig)
 
 
215
 
216
 
217
  def main():
 
1
+ """绘制引言的总架构图和各专题的证明依赖。
2
 
3
  需要 Matplotlib 和 Noto Sans CJK SC 的 Regular、Medium 两个 OTF 字体。
4
  python proof-dependencies.py --font-dir /path/to/fonts
5
+ 运行后在本文件旁生成同名 SVG。字形转为轮廓,可以任意放大。
6
  """
7
 
8
  import argparse
9
+ from collections import defaultdict
10
  from dataclasses import dataclass
 
11
  from pathlib import Path
12
 
13
  import matplotlib
 
15
  matplotlib.use("Agg")
16
  import matplotlib.pyplot as plt
17
  from matplotlib.font_manager import FontProperties
18
+ from matplotlib.patches import FancyArrowPatch, Rectangle
19
+ from matplotlib.path import Path as DrawingPath
 
 
 
20
 
21
 
22
  @dataclass(frozen=True)
 
26
  border: str
27
 
28
 
29
+ MAIN = Color("#173747", "#eef4f7", "#91a8b3")
30
+ DATA = Color("#554675", "#f5f2f9", "#ad9dc2")
31
+ UPPER = Color("#165365", "#eef7fa", "#86aab6")
32
+ SPECTRAL = Color("#4a521f", "#f6f7ed", "#a8ad84")
33
+ LOWER = Color("#713f37", "#fcf3ef", "#c09a8d")
34
+ ANALYTIC = Color("#315542", "#f0f7f2", "#8aa894")
35
+
36
+
37
+ @dataclass(frozen=True)
38
+ class Node:
39
+ key: str
40
+ title: str
41
+ details: tuple[str, ...] = ()
42
+ imported: bool = False
43
+
44
+
45
+ def node(key, title, *details, imported=False):
46
+ return Node(key, title, details, imported)
47
+
48
+
49
+ @dataclass(frozen=True)
50
+ class Panel:
51
+ title: str
52
+ color: Color
53
+ rows: tuple[tuple[Node, ...], ...]
54
+ links: str
55
+
56
+
57
+ # 连线记录从左侧结果流向右侧用途。每行列出的后项可以共同使用一个前项。
58
+ # 同一数学结果在不同专题再次出现时,用虚线表示专题之间的输入。
59
+ OVERVIEW = Panel(
60
+ "全局主线", MAIN,
61
+ (
62
+ (node("data", "辅助域与可容许数据", r"$q_0=18480q,\quad a=xb,\quad \sqrt{x}\leq m\leq 2\sqrt{x}$"),),
63
+ (node("short", "定理 A 短整源形式", "提升平方范数与指数"),
64
+ node("span", "定理 B 张成维数", "以少数平移张成大维数空间"),
65
+ node("aux", "辅助形式", "整性与短性保证补基"),
66
+ node("height", "长链行列式比的高度", "正则扭曲与单次提升")),
67
+ (node("upper", "同一族目标形式的上界", r"$V=n(H-m\,\mathrm{rem}+L),\quad \delta=hI$"),
68
+ node("lower", "定理 C 修正余体积下界", r"$V+2\delta\geq h(H-3L)$")),
69
+ (node("main", "主量消去", r"$m\,\mathrm{rem}\leq fa(\log b)^5$"),),
70
+ (node("remainder", "经双截断得到余项的单侧上界", r"$R_{d,q_0}(y)\leq y^{-1/2+\varepsilon}$"),),
71
+ (node("zero", "经 Landau 单侧判据排除临界线右侧的零点",
72
+ r"由诱导特征和有限欧拉因子从模 $q_0$ 回到任意模 $q$"),),
73
+ (node("dirichlet", "关于狄利克雷 $L$ 函数临界带零点的广义黎曼猜想", "对偶特征的函数方程"),
74
+ node("zeta", r"关于 $\zeta$ 函数非平凡零点的经典黎曼猜想", "模 1 的无零性与完备化函数方程")),
75
+ ),
76
+ """
77
+ data short span aux height
78
+ short upper
79
+ span upper
80
+ aux lower
81
+ height lower
82
+ upper main
83
+ lower main
84
+ main remainder
85
+ remainder zero
86
+ zero dirichlet zeta
87
+ """,
88
+ )
89
+
90
+
91
+ PANELS = (
92
+ # 单侧上界的尺度存在性、无穷位计数及余项恒等式。
93
+ Panel("辅助域、尺度与无穷位权重", DATA, (
94
+ (node("mod", "辅助模数与素数", r"$q_0=18480q,\quad d\equiv q_0/2-1\ (\mathrm{mod}\ q_0)$"),
95
+ node("x", "指定整数截断点", r"固定 $d,q_0$,令 $x$ 充分大")),
96
+ (node("fields", "虚二次域与分圆扩张", r"$K=\mathbb{Q}(\sqrt{-d}),\quad E=K(\zeta_{q_1})$"),
97
+ node("scales", "尺度窗口的存在性", r"选取截断 $x_1$、尺度 $b$ 与步数 $m$")),
98
+ (node("places", "无穷位的同余标签", r"全体 $\Phi_a$ 的标签为 $1$"),
99
+ node("sparse", "稀疏无穷位集合", r"在标签 $-1$ 的位置中选取 $\Phi_b$"),
100
+ node("magnitudes", "秩与尺度比较", r"$x^{10^6}\leq x_1,\quad x_1^{10^6}\leq b$")),
101
+ (node("weights", "由两类权重产生两处截断", r"$\kappa=b$ 或 $a/x_1$,其中 $a=xb$"),
102
+ node("level", "水平、提升特征与权的间距", "依共同数据组织各次提升")),
103
+ (node("data", "可容许数据", r"分圆域、加权无穷位、水平与 $m$ 次提升的参数"),),
104
+ ), """
105
+ mod fields
106
+ x scales
107
+ fields places sparse
108
+ scales sparse magnitudes
109
+ places weights
110
+ sparse weights
111
+ magnitudes level
112
+ fields level
113
+ weights data
114
+ level data
115
+ """),
116
+
117
+ # SeesawIdentity 与 ArchimedeanSize 给出 ShortAndEnough 所用的范数输入��
118
+ Panel("Poincaré 映射、跷跷板与无穷位范数", UPPER, (
119
+ (node("period", "Bessel 周期", "构造从源空间到行空间的 Poincaré 映射"),
120
+ node("pairs", "行、列空间与辅助下降对", "安排两条提升链及末端限制"),
121
+ node("jets", "整真空与 theta 导数", "紧标架、尺度及有理结构")),
122
+ (node("unfold", "贝塞尔商积分的陪集展开", "逐次消去中间积分"),
123
+ node("tensor", "有限平移与粘合真空", "组合系数在扭模以外保持整性"),
124
+ node("conj", "正定核的共轭估计", "把导数界变成舒尔范数界")),
125
+ (node("seesaw", "跷跷板恒等式", "从行链改到正定列链,比例因子与扭曲无关"),
126
+ node("kernel", "复合核的高阶导数展开", "将各层核的界合到末级限制")),
127
+ (node("project", "中心投影与有限群平移", "良部分的像仍受范数控制"),
128
+ node("source", "自由水平上的短整形式", "通过中心缩放平均筛出分歧源空间")),
129
+ (node("norm", "无穷位范数输入", "对所有指定平移与任意复域自同构一致"),),
130
+ ), """
131
+ period unfold
132
+ pairs unfold tensor
133
+ jets tensor conj
134
+ unfold seesaw
135
+ tensor seesaw kernel
136
+ conj kernel
137
+ seesaw project
138
+ kernel project
139
+ source norm
140
+ project norm
141
+ """),
142
+
143
+ # LocalDivisibility 区分不分裂处、例外处及水平素数 N,然后供 ShortAndEnough 使用。
144
+ Panel("有限位整除、余长度与定理 A", UPPER, (
145
+ (node("jets", "theta 乘积的整除指数", "由方向、长行删去及碰撞估计取得"),
146
+ node("marked", "例外素数的共轭配对", "选定标记位,在源端施加缩放 Hecke 算子"),
147
+ node("level", "水平素数 $N$ 处的格", r"局部换格与 $U_p$ 算子")),
148
+ (node("ordinary", "非例外不分裂素数", "逐级规范界累加有限位增益"),
149
+ node("transfer", "例外不分裂素数", "把 Hecke 作用传到提升链的数据上"),
150
+ node("nval", "水平素数处的估值", r"经 $U_p^{m/2}$ 后控制链的赋值损失")),
151
+ (node("elementary", "例外处的 Hecke 初等因子", "把像的亏损写成截断余长度"),
152
+ node("nlength", "水平素数处的余长度", r"同时控制 $U_p^{m/2}$ 条件造成的亏损")),
153
+ (node("local", "各有限位的整性与总损失", "用共同子模实现所需赋值,把局部损失加权求和"),),
154
+ (node("arch", "无穷位范数输入", "对所有指定平移及复域自同构一致", imported=True),
155
+ node("scale", "以局部增益归一化", "整性转成小指数,并降低无扭提升的范数")),
156
+ (node("short", "定理 A 短整源形式张成源空间",
157
+ r"$\|\Theta_1\mathfrak{p}_s(v)\|_\sigma^2\leq\exp(H-m\,\mathrm{rem}+L)$"),),
158
+ ), """
159
+ jets ordinary transfer
160
+ marked transfer elementary
161
+ level nval nlength
162
+ ordinary local
163
+ transfer local
164
+ nval local
165
+ elementary local
166
+ nlength local
167
+ local scale
168
+ arch short
169
+ scale short
170
+ """),
171
+
172
+ # MomentBounds/Moments 给出近等距与全群二阶矩,射影及张成在下游完成。
173
+ Panel("Bessel 估计、谱重数与定理 B", SPECTRAL, (
174
+ (node("bessel", "离散系列与实处 Bessel 核", "建立正交性、截断和平方平均界"),
175
+ node("frames", "双标架的几何与局部测度", "控制近轨道与标架相关积分"),
176
+ node("spectra", "Hecke 共同特征分解", "比较不同无穷位符号的重数")),
177
+ (node("expand", "Poincaré 平方展开", "按 Bessel 子群与块振幅组织项"),
178
+ node("mass", "目标空间的维数上界", "以定号空间上的质量与形式度估计")),
179
+ (node("sieve", "主项的局部筛法", "用局部轨道和与质量积分控制"),
180
+ node("tails", "剩余项求和", "用近项计数、格判别式及 Schur 界控制")),
181
+ (node("moments", "近等距与二阶矩控制", "良类型投影后仍满足张成判据"),),
182
+ (node("one", "一次平移增加的维数", "与已有像比较剩余目标空间"),
183
+ node("few", "维数递推引理", "将每步的增量换成平移个数的上界")),
184
+ (node("full", "少量平移在全源空间的张成", r"余下维数至多 $2h/b^2$"),
185
+ node("ramified", "分歧源空间的余维上界", "控制限制源空间时每次平移损失的维数", imported=True)),
186
+ (node("span", "定理 B 张成绝大部分目标空间",
187
+ r"$|T|u\leq5h\log(1+2b^2),\quad n\geq(1-4/b^2)h$"),),
188
+ ), """
189
+ bessel expand
190
+ frames expand tails
191
+ spectra mass
192
+ expand sieve tails
193
+ sieve moments
194
+ tails moments
195
+ mass moments
196
+ moments one
197
+ one full
198
+ few full
199
+ full span
200
+ ramified span
201
+ """),
202
+
203
+ # 正则扭曲的两个输出分别用于投影分母与链标量的高度。
204
+ Panel("一阶同余、Selmer 群与正则扭曲", LOWER, (
205
+ (node("galois", "从 Hecke 谱附加伽罗��表示", "构造主直和项与辅助位惯性关系"),
206
+ node("local", "局部晶体格与霍奇跳跃", "Kisin 格提升与局部 Tate 对偶"),
207
+ node("values", "Hecke 特殊值的代数部分", "以整测度组织扭曲后的取值")),
208
+ (node("ribet", "一阶 Ribet 关系", "把投影同余写成扩张类与关系矩阵"),
209
+ node("loss", "局部损失", "控制晶体条件下的余长度和对偶缺陷"),
210
+ node("stickel", "Stickelberger 系统", "约束扭曲值比的逐素数赋值")),
211
+ (node("selmer", "带辅助位条件的 Selmer 方程", "用长度不等式与下降法选择辅助位"),
212
+ node("twisting", "扭曲特殊值比的局部约束", "记录各个幂次须同时满足的赋值条件")),
213
+ (node("twists", "各有限位的正则扭曲族",
214
+ r"模范数与所考察的素数互素,前 $m$ 次幂同时满足两类约束"),),
215
+ (node("denom", "投影分母的总上界", "供单次提升行列式比较使用"),
216
+ node("ratio", "Hecke 值比的高度上界", "控制长链及辅助形式的标量")),
217
+ ), """
218
+ galois ribet
219
+ local loss
220
+ values stickel
221
+ ribet selmer
222
+ loss selmer
223
+ stickel twisting
224
+ selmer twists
225
+ twisting twists
226
+ ribet denom
227
+ twists denom ratio
228
+ """),
229
+
230
+ # GluingMaps 构造与扭曲无关的周期提升,LiftVolumeHeight 比较压缩行列式。
231
+ Panel("比较算子与单次提升行列式", LOWER, (
232
+ (node("first", "三次 theta 核交换", "求出第一因子的扭曲标量"),
233
+ node("false", "伪提升的下降塔", "满足真提升的 Hecke 条件却与真提升正交"),
234
+ node("products", "乘积周期的分离性", "为共同周期映射的单射性提供输入")),
235
+ (node("glue", "首因子的整性与范数", "在拼接格上构造保整的粘合映射"),
236
+ node("vanish", "伪提升的周期消失", "粘合所得像可与伪提升分离")),
237
+ (node("op", "比较算子", "以整紧标架分解,控制整性与无扭范数"),
238
+ node("period", "去扭后的周期映射", "与扭曲无关,且能分离真提升")),
239
+ (node("compression", "真提升空间的压缩行列式", "与单次提升行列式的乘积由 Hecke 值决定"),
240
+ node("regular", "正则扭曲给出的投影分母界", "在有限位逐处控制压缩算子的分母", imported=True)),
241
+ (node("eigen", "特征值控制压缩行列式", "有限位用整性,无穷位用平凡扭曲下的范数"),
242
+ node("values", "比较公式中的 Hecke 值比", "将该值比的高度与压缩行列式的高度合并")),
243
+ (node("single", "单次提升行列式比的高度", r"$Z_j(1)/Z_j(\vartheta_\iota^j)$"),),
244
+ ), """
245
+ first glue
246
+ false vanish
247
+ products period
248
+ glue op period
249
+ vanish op
250
+ op compression
251
+ period compression
252
+ compression eigen
253
+ compression values
254
+ regular eigen
255
+ eigen single
256
+ values single
257
+ """),
258
+
259
+ # ChainNorms/NormOfChain 的三角分解和 LongForms 对其取高度。
260
+ Panel("三角阵列、内积恒等式与长链高度", LOWER, (
261
+ (node("triangle", "三角阵列的提升与伴随", "沿不同索引组织各次提升"),
262
+ node("exchange", "方形交换律与局部因子", "匹配点值、傅里叶变换和扭模因子"),
263
+ node("rallis", "Rallis 内积公式", "把单步提升的 Gram 算子写成内积算子")),
264
+ (node("inner", "分块三角链的内积", "逐步比较链内积与各层内积"),
265
+ node("spectrum", "良部分与共同 Hecke 谱", "同一谱型的重数换到各级定号空间")),
266
+ (node("factor", "复合提升行列式比分解",
267
+ r"$Z(\vartheta)/Z(1)$ 为单次行列式比与显式标量的乘积"),),
268
+ (node("scalars", "扭模与 Hecke 值比的高度", "用正则扭曲给出的统一约束", imported=True),
269
+ node("single", "单次提升行列式比的高度", r"对每个 $1\leq j\leq m$ 合并", imported=True)),
270
+ (node("chain", "长链行列式比的高度", r"$Z(1)/Z(\vartheta_\iota)$ 的高度至多 $h(b+L-H)$"),),
271
+ ), """
272
+ triangle inner
273
+ exchange inner
274
+ rallis inner
275
+ inner factor
276
+ spectrum factor
277
+ factor chain
278
+ scalars chain
279
+ single chain
280
+ """),
281
+
282
+ # FirstPath/DiagonalTurns/LastPath 合在 SpanningForms,另一路得到辅助形式标量的高度。
283
+ Panel("深水平满射、双网格与补基", LOWER, (
284
+ (node("deep", "最低型的周期下界", "由实处离散系列取得深水平周期估计"),
285
+ node("path", "双网格的路径资料", "组织首列周期、边数据和双边提升"),
286
+ node("square", "一个方格的 theta 交换律", "从局部匹配得到两条短路径的比较")),
287
+ (node("vanish", "限制像的正交补为零", "从正交消失得到限制配对的满射性"),
288
+ node("turn", "单调路径与转角归纳", r"以 $m^2$ 次转角传递周期关系和标量")),
289
+ (node("onto", "转置提升与满射��制", "把定号端的张成族送到首端"),
290
+ node("last", "末路径的周期与分母", "用测试配对读出提升值并控制平方范数")),
291
+ (node("aux", "辅助形式张成目标空间",
292
+ r"共同标量化整,平凡扭曲的平方范数至多 $\exp(2x_1^2b^2)$"),),
293
+ (node("height", "正则扭曲的标量高度界", "控制补入形式的有限位代价", imported=True),
294
+ node("basis", "补入至多 $4h/b^2$ 个辅助形式", "与原目标形式族合成一组基")),
295
+ (node("complete", "补基的总损失", "同时计入复范数及有限位标量的代价"),),
296
+ ), """
297
+ deep vanish
298
+ path turn
299
+ square turn
300
+ vanish onto
301
+ turn last
302
+ onto aux
303
+ last aux
304
+ aux basis
305
+ height complete
306
+ basis complete
307
+ """),
308
+
309
+ # MainInequality 使用 ShortAndEnough 与 LongForms;OneSidedBound 再用 PrimeSums 和素数定理。
310
+ Panel("扭曲格、主量消去与双截断", ANALYTIC, (
311
+ (node("short", "定理 A 与定理 B", "从短整形式的平移像抽出一族线性无关形式", imported=True),
312
+ node("lower", "补基与长链高度", "对应辅助形式和正则扭曲两项输入", imported=True)),
313
+ (node("upper", "扭曲格的两个上界", r"$V=n(H-m\,\mathrm{rem}+L),\quad\delta=hI$"),
314
+ node("product", "乘积公式与定理 C", r"$V+2\delta\geq h(H-3L)$")),
315
+ (node("main", "在同一族形式上消去主量",
316
+ r"利用 $n\leq h\leq2n$,得到 $m\,\mathrm{rem}\leq fa(\log b)^5$"),),
317
+ (node("places", "无穷位计数与双截断恒等式", r"按 $\Phi_a,\Phi_b$ 分离 $x$ 与 $x_1$"),
318
+ node("pnt", "算术级数中的素数定理", r"大截断 $x_1$ 处两项余项各至多 $x^{-2}$")),
319
+ (node("integer", "整数截断处的单侧界", r"$m\geq\sqrt{x}$ 使主项具有平方根尺度"),),
320
+ (node("real", "任意充分大实截断处的单侧界",
321
+ r"吸收至多 $26/y$ 的取整损失,得到 $R_{d,q_0}(y)\leq y^{-1/2+\varepsilon}$"),),
322
+ ), """
323
+ short upper
324
+ lower product
325
+ upper main
326
+ product main
327
+ main integer
328
+ places integer
329
+ pnt integer
330
+ integer real
331
+ """),
332
+
333
+ # 零点判据确切使用各候选 d 的单侧界,再根据 rho 选择无零扭曲。
334
+ Panel("从单侧余项到临界线零点", ANALYTIC, (
335
+ (node("prime", "加权素数幂余项的积分变换", "特征正交与分部求和给出两族重数之差"),
336
+ node("density", "二次扭曲的零点密度估计", "依待考察点选取无零的辅助扭曲族"),
337
+ node("upper", "对每个候选素数的单侧界", r"取 $\varepsilon=\beta-1/2$,余项至多 $y^{\beta-1}$", imported=True)),
338
+ (node("residue", "留数只含原函数族的重数", r"$N(s)/(\varphi(q_0)s(1-s))$,实轴上非负"),),
339
+ (node("landau", "Landau 单侧判据", r"迫使待考察点 $\rho$ 的留数为零"),),
340
+ (node("q0", "辅助模数的无零性", r"模 $q_0$ 且 $\rho\ne1$"),
341
+ node("one", "实点 $s=1$ 的非零性", "应用狄利克雷关于非主特征的经典结论")),
342
+ (node("q", "任意模数的临界线右侧无零性", "由诱导特征与有限欧拉因子返回原模数"),),
343
+ (node("dirichlet", "广义黎曼猜想", "对偶特征的函数方程"),
344
+ node("zeta", "经典黎曼猜想", "模 1 的情形及完备化函数方程")),
345
+ ), """
346
+ prime residue
347
+ density residue
348
+ residue landau
349
+ upper landau
350
+ landau q0
351
+ q0 q
352
+ one q
353
+ q dirichlet zeta
354
+ """),
355
+ )
356
+
357
+
358
+ WIDTH = 3140
359
+ PAGE_MARGIN = 36
360
+ PANEL_GAP = 40
361
+ BOX_HEIGHT = 89
362
+ ROW_GAP = 55
363
+ PANEL_HEADER = 75
364
+ PANEL_FOOT = 26
365
+
366
+
367
+ def panel_height(panel):
368
+ return PANEL_HEADER + len(panel.rows) * (BOX_HEIGHT + ROW_GAP) - ROW_GAP + PANEL_FOOT
369
+
370
+
371
+ @dataclass(frozen=True)
372
+ class Box:
373
+ node: Node
374
+ row: int
375
+ x: float
376
+ y: float
377
+ width: float
378
+
379
+ @property
380
+ def center(self):
381
+ return self.x + self.width / 2
382
+
383
+ @property
384
+ def bottom(self):
385
+ return self.y + BOX_HEIGHT
386
+
387
+
388
+ def route(panel, boxes, x, width):
389
+ """在行间和面板边缘排线,保持箭头不穿过方框。"""
390
+ links = []
391
+ for line in panel.links.strip().splitlines():
392
+ source, *targets = line.split()
393
+ links.extend((source, target) for target in targets)
394
+ if len(set(links)) != len(links):
395
+ raise ValueError(f"{panel.title} 中有重复的连线")
396
+ outgoing = defaultdict(list)
397
+ incoming = defaultdict(list)
398
+ lanes = defaultdict(list)
399
+ for source, target in links:
400
+ a, b = boxes[source], boxes[target]
401
+ if b.row <= a.row:
402
+ raise ValueError(f"{panel.title} 的连线必须从上游指向下游:{source} → {target}")
403
+ outgoing[source].append(target)
404
+ incoming[target].append(source)
405
+ lanes[a.row].append((source, target))
406
+ for row in lanes.values():
407
+ row.sort(key=lambda pair: (boxes[pair[0]].center, boxes[pair[1]].center))
408
+ for key in boxes:
409
+ if not (outgoing[key] or incoming[key]):
410
+ raise ValueError(f"{panel.title} 中的孤立方框:{key}")
411
+
412
+ def port(box, neighbors, peer):
413
+ ordered = sorted(neighbors, key=lambda key: (boxes[key].center, boxes[key].row))
414
+ if len(ordered) == 1:
415
+ return box.center
416
+ fraction = ordered.index(peer) / (len(ordered) - 1)
417
+ return box.x + (0.22 + 0.56 * fraction) * box.width
418
+
419
+ gutters = [0, 0]
420
+ for source, target in links:
421
+ a, b = boxes[source], boxes[target]
422
+ start_x = port(a, outgoing[source], target)
423
+ end_x = port(b, incoming[target], source)
424
+ row = lanes[a.row]
425
+ start_y = a.bottom + ROW_GAP * (row.index((source, target)) + 1) / (len(row) + 1)
426
+ start, end = (start_x, a.bottom), (end_x, b.y)
427
+ if b.row == a.row + 1:
428
+ points = [start, (start_x, start_y), (end_x, start_y), end]
429
+ else:
430
+ side = int((a.center + b.center) / 2 > x + width / 2)
431
+ gutters[side] += 1
432
+ gap = 8 + 7 * gutters[side]
433
+ gutter = x + width - gap if side else x + gap
434
+ end_y = b.y - ROW_GAP * (0.32 + 0.1 * gutters[side])
435
+ points = [start, (start_x, start_y), (gutter, start_y), (gutter, end_y), (end_x, end_y), end]
436
+ yield a, b, [p for i, p in enumerate(points) if i == 0 or p != points[i - 1]]
437
 
438
 
439
  def draw(font_dir, output, preview):
440
  regular = FontProperties(fname=font_dir / "NotoSansCJKsc-Regular.otf")
441
  medium = FontProperties(fname=font_dir / "NotoSansCJKsc-Medium.otf")
442
+ plt.rcParams.update({"svg.fonttype": "path", "svg.hashsalt": "proof-dependencies", "mathtext.fontset": "stix"})
443
 
444
+ pairs = tuple(zip(PANELS[::2], PANELS[1::2], strict=True))
445
+ detail_heights = [max(map(panel_height, pair)) for pair in pairs]
446
+ total_height = 122 + panel_height(OVERVIEW) + sum(detail_heights) + (len(pairs) + 1) * PANEL_GAP
447
+ fig = plt.figure(figsize=(WIDTH / 100, total_height / 100), facecolor="white")
448
+ ax = fig.add_axes((0, 0, 1, 1), xlim=(0, WIDTH), ylim=(total_height, 0))
 
 
449
  ax.set_axis_off()
450
  fitted_text = []
451
 
452
+ def write(x, y, value, size, color, *, bold=False, align="center", fit=None):
453
+ label = ax.text(x, y, value, ha=align, va="center", fontsize=size, color=color,
454
+ fontproperties=medium if bold else regular, zorder=5)
 
 
455
  if fit is not None:
456
+ fitted_text.append((label, fit))
 
457
 
458
+ def arrow(points, color, dashed=False):
459
+ ax.add_patch(FancyArrowPatch(
460
+ path=DrawingPath(points), arrowstyle="-|>", mutation_scale=11, color=color.ink,
461
+ linewidth=1.15, linestyle=(0, (5, 3)) if dashed else "-", zorder=2,
462
  ))
 
463
 
464
+ def render(panel, left, top, width, height):
465
+ color = panel.color
466
+ ax.add_patch(Rectangle((left, top), width, height, facecolor=color.fill, edgecolor=color.border, lw=1.05))
467
+ write(left + 29, top + 34, panel.title, 22, color.ink, bold=True, align="left")
468
+
469
+ boxes = {}
470
+ inner = width - 90
471
+ for index, row in enumerate(panel.rows):
472
+ step = inner / len(row)
473
+ cap = (1100 if len(row) == 1 else 855) if panel is OVERVIEW else 990
474
+ box_width = min(step - 29, cap)
475
+ for column, item in enumerate(row):
476
+ x = left + 45 + (column + 0.5) * step - box_width / 2
477
+ y = top + PANEL_HEADER + index * (BOX_HEIGHT + ROW_GAP)
478
+ if item.key in boxes:
479
+ raise ValueError(f"{panel.title} 的重复方框:{item.key}")
480
+ boxes[item.key] = Box(item, index, x, y, box_width)
481
+
482
+ for a, b, points in route(panel, boxes, left, width):
483
+ for obstacle in boxes.values():
484
+ if obstacle in (a, b):
485
+ continue
486
+ for (x1, y1), (x2, y2) in zip(points, points[1:]):
487
+ horizontal = y1 == y2 and obstacle.y < y1 < obstacle.bottom
488
+ vertical = x1 == x2 and obstacle.x < x1 < obstacle.x + obstacle.width
489
+ if (horizontal and max(x1, x2) > obstacle.x and min(x1, x2) < obstacle.x + obstacle.width
490
+ or vertical and max(y1, y2) > obstacle.y and min(y1, y2) < obstacle.bottom):
491
+ raise ValueError(f"{panel.title} 的连线穿过 {obstacle.node.title}:{a.node.key} → {b.node.key}")
492
+ arrow(points, color, a.node.imported)
493
+
494
+ for box in boxes.values():
495
+ item = box.node
496
+ decisive = panel is OVERVIEW or box.row == len(panel.rows) - 1
497
+ ax.add_patch(Rectangle(
498
+ (box.x, box.y), box.width, BOX_HEIGHT,
499
+ facecolor=color.fill if decisive else "white",
500
+ edgecolor=color.ink if decisive else color.border,
501
+ lw=1.5 if decisive else 0.9, linestyle=(0, (5, 3)) if item.imported else "-", zorder=3,
502
+ ))
503
+ baseline = box.y + BOX_HEIGHT / 2 - 12.8 * len(item.details)
504
+ write(box.center, baseline, item.title, 18.6 if decisive else 17.3,
505
+ color.ink, bold=True, fit=box.width - 24)
506
+ for index, detail in enumerate(item.details, 1):
507
+ write(box.center, baseline + index * 25.6, detail, 14.4, MAIN.ink, fit=box.width - 22)
508
+
509
+ write(PAGE_MARGIN, 57, "证明的总架构与专题依赖", 30, MAIN.ink, bold=True, align="left")
510
+ for x, label, dashed in ((WIDTH - 880, "本图中从结论到用途的方向", False),
511
+ (WIDTH - 425, "从另一专题引入的结论", True)):
512
+ arrow([(x, 58), (x + 67, 58)], MAIN, dashed)
513
+ write(x + 80, 58, label, 15, MAIN.ink, align="left")
514
+
515
+ y = 122
516
+ render(OVERVIEW, PAGE_MARGIN, y, WIDTH - 2 * PAGE_MARGIN, panel_height(OVERVIEW))
517
+ y += panel_height(OVERVIEW) + PANEL_GAP
518
+ width = (WIDTH - 2 * PAGE_MARGIN - PANEL_GAP) / 2
519
+ for pair, height in zip(pairs, detail_heights, strict=True):
520
+ for column, panel in enumerate(pair):
521
+ render(panel, PAGE_MARGIN + column * (width + PANEL_GAP), y, width, height)
522
+ y += height + PANEL_GAP
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
523
 
524
  fig.canvas.draw()
525
  renderer = fig.canvas.get_renderer()
526
+ for label, limit in fitted_text:
527
+ extent = label.get_window_extent(renderer).width
528
+ if extent > limit:
529
+ raise ValueError(f"文字超过方框 {extent:.1f}/{limit:.1f}:{label.get_text()}")
530
 
531
+ fig.savefig(output, metadata={"Title": "证明的总架构与专题依赖", "Date": None})
532
  if preview:
533
+ fig.savefig(preview, dpi=55)
534
  plt.close(fig)
535
+ count = sum(len(row) for panel in (OVERVIEW, *PANELS) for row in panel.rows)
536
+ print(f"已绘制 {count} 个方框、{len(PANELS)} 个专题。")
537
 
538
 
539
  def main():
chapters/pic/proof-dependencies.svg CHANGED