math-skill 2.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/README.en-US.md +159 -200
  2. package/README.md +159 -200
  3. package/agents/math-critic.en.md +2 -2
  4. package/agents/math-critic.md +8 -8
  5. package/commands/ask.md +3 -10
  6. package/design-patterns/attention/equivariant-attention.en.md +72 -0
  7. package/design-patterns/attention/equivariant-attention.md +72 -0
  8. package/design-patterns/attention/geometry-aware-attention.en.md +73 -0
  9. package/design-patterns/attention/geometry-aware-attention.md +72 -0
  10. package/design-patterns/attention/information-bottleneck-attention.en.md +72 -0
  11. package/design-patterns/attention/information-bottleneck-attention.md +72 -0
  12. package/design-patterns/attention/projection-attention.en.md +68 -0
  13. package/design-patterns/attention/projection-attention.md +68 -0
  14. package/design-patterns/attention/spectral-attention.en.md +71 -0
  15. package/design-patterns/attention/spectral-attention.md +71 -0
  16. package/design-patterns/compression/leverage-score-selection.en.md +71 -0
  17. package/design-patterns/compression/leverage-score-selection.md +71 -0
  18. package/design-patterns/compression/low-rank-kv-cache.en.md +60 -0
  19. package/design-patterns/compression/low-rank-kv-cache.md +60 -0
  20. package/design-patterns/compression/spectral-token-pruning.en.md +61 -0
  21. package/design-patterns/compression/spectral-token-pruning.md +61 -0
  22. package/design-patterns/compression/topology-preserving-compression.en.md +64 -0
  23. package/design-patterns/compression/topology-preserving-compression.md +64 -0
  24. package/design-patterns/loss/constraint-penalty.en.md +67 -0
  25. package/design-patterns/loss/constraint-penalty.md +78 -0
  26. package/design-patterns/loss/contrastive-loss.en.md +59 -0
  27. package/design-patterns/loss/contrastive-loss.md +68 -0
  28. package/design-patterns/loss/information-bottleneck-loss.en.md +69 -0
  29. package/design-patterns/loss/information-bottleneck-loss.md +74 -0
  30. package/design-patterns/loss/orthogonality-loss.en.md +56 -0
  31. package/design-patterns/loss/orthogonality-loss.md +60 -0
  32. package/design-patterns/loss/variational-loss.en.md +61 -0
  33. package/design-patterns/loss/variational-loss.md +71 -0
  34. package/design-patterns/representation/equivariant-split.en.md +87 -0
  35. package/design-patterns/representation/equivariant-split.md +89 -0
  36. package/design-patterns/representation/manifold-representation.en.md +85 -0
  37. package/design-patterns/representation/manifold-representation.md +87 -0
  38. package/design-patterns/representation/shared-private-decomposition.en.md +84 -0
  39. package/design-patterns/representation/shared-private-decomposition.md +86 -0
  40. package/design-patterns/representation/subspace-alignment.en.md +90 -0
  41. package/design-patterns/representation/subspace-alignment.md +92 -0
  42. package/design-patterns/routing/graph-routing.en.md +79 -0
  43. package/design-patterns/routing/graph-routing.md +81 -0
  44. package/design-patterns/routing/moe-routing.en.md +85 -0
  45. package/design-patterns/routing/moe-routing.md +87 -0
  46. package/design-patterns/routing/optimal-transport-routing.en.md +68 -0
  47. package/design-patterns/routing/optimal-transport-routing.md +72 -0
  48. package/design-patterns/routing/spectral-clustering-routing.en.md +88 -0
  49. package/design-patterns/routing/spectral-clustering-routing.md +90 -0
  50. package/knowledge-base/differential-geometry/connection.en.md +51 -0
  51. package/knowledge-base/differential-geometry/connection.md +51 -0
  52. package/knowledge-base/differential-geometry/curvature.en.md +49 -0
  53. package/knowledge-base/differential-geometry/curvature.md +49 -0
  54. package/knowledge-base/differential-geometry/geodesic.en.md +51 -0
  55. package/knowledge-base/differential-geometry/geodesic.md +51 -0
  56. package/knowledge-base/differential-geometry/manifold.en.md +47 -0
  57. package/knowledge-base/differential-geometry/manifold.md +47 -0
  58. package/knowledge-base/differential-geometry/metric-tensor.en.md +50 -0
  59. package/knowledge-base/differential-geometry/metric-tensor.md +50 -0
  60. package/knowledge-base/differential-geometry/tangent-space.en.md +48 -0
  61. package/knowledge-base/differential-geometry/tangent-space.md +48 -0
  62. package/knowledge-base/information-geometry/fisher-metric.en.md +56 -0
  63. package/knowledge-base/information-geometry/fisher-metric.md +56 -0
  64. package/knowledge-base/information-geometry/natural-gradient.en.md +54 -0
  65. package/knowledge-base/information-geometry/natural-gradient.md +54 -0
  66. package/knowledge-base/lie-theory/equivariance.en.md +54 -0
  67. package/knowledge-base/lie-theory/equivariance.md +54 -0
  68. package/knowledge-base/lie-theory/group-action.en.md +51 -0
  69. package/knowledge-base/lie-theory/group-action.md +51 -0
  70. package/knowledge-base/lie-theory/lie-algebra.en.md +51 -0
  71. package/knowledge-base/lie-theory/lie-algebra.md +51 -0
  72. package/knowledge-base/lie-theory/lie-group.en.md +51 -0
  73. package/knowledge-base/lie-theory/lie-group.md +51 -0
  74. package/knowledge-base/lie-theory/representation.en.md +52 -0
  75. package/knowledge-base/lie-theory/representation.md +52 -0
  76. package/knowledge-base/matrix-analysis/low-rank-approximation.en.md +49 -0
  77. package/knowledge-base/matrix-analysis/low-rank-approximation.md +49 -0
  78. package/knowledge-base/matrix-analysis/matrix-perturbation.en.md +49 -0
  79. package/knowledge-base/matrix-analysis/matrix-perturbation.md +49 -0
  80. package/knowledge-base/matrix-analysis/positive-semidefinite.en.md +50 -0
  81. package/knowledge-base/matrix-analysis/positive-semidefinite.md +50 -0
  82. package/knowledge-base/matrix-analysis/projection.en.md +47 -0
  83. package/knowledge-base/matrix-analysis/projection.md +47 -0
  84. package/knowledge-base/matrix-analysis/spectral-decomposition.en.md +48 -0
  85. package/knowledge-base/matrix-analysis/spectral-decomposition.md +48 -0
  86. package/knowledge-base/optimization/constrained-optimization.en.md +53 -0
  87. package/knowledge-base/optimization/constrained-optimization.md +53 -0
  88. package/knowledge-base/optimization/convex-optimization.en.md +50 -0
  89. package/knowledge-base/optimization/convex-optimization.md +50 -0
  90. package/knowledge-base/optimization/lagrangian-duality.en.md +50 -0
  91. package/knowledge-base/optimization/lagrangian-duality.md +50 -0
  92. package/knowledge-base/optimization/proximal-method.en.md +52 -0
  93. package/knowledge-base/optimization/proximal-method.md +52 -0
  94. package/knowledge-base/optimization/riemannian-optimization.en.md +51 -0
  95. package/knowledge-base/optimization/riemannian-optimization.md +51 -0
  96. package/knowledge-base/overview.en.md +29 -218
  97. package/knowledge-base/overview.md +29 -220
  98. package/knowledge-base/probability/concentration-inequality.en.md +45 -0
  99. package/knowledge-base/probability/concentration-inequality.md +45 -0
  100. package/knowledge-base/probability/entropy.en.md +47 -0
  101. package/knowledge-base/probability/entropy.md +47 -0
  102. package/knowledge-base/probability/fisher-information.en.md +48 -0
  103. package/knowledge-base/probability/fisher-information.md +48 -0
  104. package/knowledge-base/probability/information-bottleneck.en.md +49 -0
  105. package/knowledge-base/probability/information-bottleneck.md +49 -0
  106. package/knowledge-base/probability/kl-divergence.en.md +51 -0
  107. package/knowledge-base/probability/kl-divergence.md +51 -0
  108. package/knowledge-base/topology/euler-characteristic.en.md +54 -0
  109. package/knowledge-base/topology/euler-characteristic.md +54 -0
  110. package/knowledge-base/topology/fundamental-group.en.md +52 -0
  111. package/knowledge-base/topology/fundamental-group.md +52 -0
  112. package/knowledge-base/topology/persistent-homology.en.md +54 -0
  113. package/knowledge-base/topology/persistent-homology.md +54 -0
  114. package/lenses/algorithmic.en.md +49 -0
  115. package/lenses/algorithmic.md +49 -0
  116. package/lenses/axiomatization.en.md +48 -0
  117. package/lenses/axiomatization.md +48 -0
  118. package/lenses/categorical.en.md +48 -0
  119. package/lenses/categorical.md +48 -0
  120. package/lenses/causal.en.md +49 -0
  121. package/lenses/causal.md +49 -0
  122. package/lenses/duality.en.md +47 -0
  123. package/lenses/duality.md +47 -0
  124. package/lenses/game.en.md +50 -0
  125. package/lenses/game.md +50 -0
  126. package/lenses/geometric.en.md +53 -0
  127. package/lenses/geometric.md +53 -0
  128. package/lenses/local-to-global.en.md +52 -0
  129. package/lenses/local-to-global.md +52 -0
  130. package/lenses/perturbation.en.md +51 -0
  131. package/lenses/perturbation.md +51 -0
  132. package/lenses/probabilistic.en.md +48 -0
  133. package/lenses/probabilistic.md +48 -0
  134. package/lenses/projection.en.md +50 -0
  135. package/lenses/projection.md +50 -0
  136. package/lenses/spectral.en.md +52 -0
  137. package/lenses/spectral.md +52 -0
  138. package/lenses/symmetry.en.md +49 -0
  139. package/lenses/symmetry.md +49 -0
  140. package/lenses/topological.en.md +48 -0
  141. package/lenses/topological.md +48 -0
  142. package/lenses/variational.en.md +48 -0
  143. package/lenses/variational.md +48 -0
  144. package/package.json +9 -3
  145. package/references/books/abstract-algebra.md +5 -5
  146. package/references/books/algebraic-geometry-rising-sea.md +5 -5
  147. package/references/books/differential-geometry.md +3 -3
  148. package/references/books/matrix-analysis.md +4 -4
  149. package/references/books/micro-lie-theory.md +3 -3
  150. package/references/books/optimization-ml.md +1 -1
  151. package/references/books/smooth-manifolds.md +3 -3
  152. package/references/gpu-friendly-math.en.md +8 -8
  153. package/references/gpu-friendly-math.md +2 -2
  154. package/references/inspiration.en.md +1 -1
  155. package/references/inspiration.md +2 -2
  156. package/skills/math-research-activator/SKILL.en.md +161 -106
  157. package/skills/math-research-activator/SKILL.md +162 -110
  158. package/skills/math-research-activator/original-texts.en.md +9 -9
  159. package/skills/math-research-activator/original-texts.md +11 -11
  160. package/commands/abstraction.md +0 -11
  161. package/commands/algorithmic-thinking.md +0 -11
  162. package/commands/axiomatization.md +0 -11
  163. package/commands/causal-inference.md +0 -11
  164. package/commands/discrete-combinatorial.md +0 -11
  165. package/commands/game-theory.md +0 -11
  166. package/commands/induction-analogy.md +0 -11
  167. package/commands/information-theory.md +0 -11
  168. package/commands/logic-deduction.md +0 -11
  169. package/commands/modeling.md +0 -11
  170. package/commands/optimization.md +0 -11
  171. package/commands/probability-statistics.md +0 -11
  172. package/commands/symmetry-invariance.md +0 -11
  173. package/commands/topological-thinking.md +0 -11
  174. package/commands/transformation.md +0 -11
  175. package/skills/abstraction/SKILL.en.md +0 -117
  176. package/skills/abstraction/SKILL.md +0 -121
  177. package/skills/abstraction/original-texts.en.md +0 -163
  178. package/skills/abstraction/original-texts.md +0 -175
  179. package/skills/algorithmic-thinking/SKILL.en.md +0 -132
  180. package/skills/algorithmic-thinking/SKILL.md +0 -138
  181. package/skills/algorithmic-thinking/original-texts.en.md +0 -253
  182. package/skills/algorithmic-thinking/original-texts.md +0 -256
  183. package/skills/axiomatization/SKILL.en.md +0 -144
  184. package/skills/axiomatization/SKILL.md +0 -151
  185. package/skills/axiomatization/original-texts.en.md +0 -154
  186. package/skills/axiomatization/original-texts.md +0 -160
  187. package/skills/causal-inference/SKILL.en.md +0 -147
  188. package/skills/causal-inference/SKILL.md +0 -151
  189. package/skills/causal-inference/original-texts.en.md +0 -136
  190. package/skills/causal-inference/original-texts.md +0 -167
  191. package/skills/discrete-combinatorial/SKILL.en.md +0 -124
  192. package/skills/discrete-combinatorial/SKILL.md +0 -131
  193. package/skills/discrete-combinatorial/original-texts.en.md +0 -184
  194. package/skills/discrete-combinatorial/original-texts.md +0 -185
  195. package/skills/game-theory/SKILL.en.md +0 -117
  196. package/skills/game-theory/SKILL.md +0 -123
  197. package/skills/game-theory/original-texts.en.md +0 -131
  198. package/skills/game-theory/original-texts.md +0 -131
  199. package/skills/induction-analogy/SKILL.en.md +0 -145
  200. package/skills/induction-analogy/SKILL.md +0 -152
  201. package/skills/induction-analogy/original-texts.en.md +0 -140
  202. package/skills/induction-analogy/original-texts.md +0 -154
  203. package/skills/information-theory/SKILL.en.md +0 -134
  204. package/skills/information-theory/SKILL.md +0 -140
  205. package/skills/information-theory/original-texts.en.md +0 -127
  206. package/skills/information-theory/original-texts.md +0 -127
  207. package/skills/logic-deduction/SKILL.en.md +0 -130
  208. package/skills/logic-deduction/SKILL.md +0 -135
  209. package/skills/logic-deduction/original-texts.en.md +0 -160
  210. package/skills/logic-deduction/original-texts.md +0 -173
  211. package/skills/modeling/SKILL.en.md +0 -135
  212. package/skills/modeling/SKILL.md +0 -139
  213. package/skills/modeling/original-texts.en.md +0 -162
  214. package/skills/modeling/original-texts.md +0 -165
  215. package/skills/optimization/SKILL.en.md +0 -129
  216. package/skills/optimization/SKILL.md +0 -135
  217. package/skills/optimization/original-texts.en.md +0 -167
  218. package/skills/optimization/original-texts.md +0 -168
  219. package/skills/probability-statistics/SKILL.en.md +0 -146
  220. package/skills/probability-statistics/SKILL.md +0 -151
  221. package/skills/probability-statistics/original-texts.en.md +0 -191
  222. package/skills/probability-statistics/original-texts.md +0 -193
  223. package/skills/symmetry-invariance/SKILL.en.md +0 -135
  224. package/skills/symmetry-invariance/SKILL.md +0 -139
  225. package/skills/symmetry-invariance/original-texts.en.md +0 -206
  226. package/skills/symmetry-invariance/original-texts.md +0 -221
  227. package/skills/topological-thinking/SKILL.en.md +0 -124
  228. package/skills/topological-thinking/SKILL.md +0 -128
  229. package/skills/topological-thinking/original-texts.en.md +0 -134
  230. package/skills/topological-thinking/original-texts.md +0 -164
  231. package/skills/transformation/SKILL.en.md +0 -120
  232. package/skills/transformation/SKILL.md +0 -124
  233. package/skills/transformation/original-texts.en.md +0 -204
  234. package/skills/transformation/original-texts.md +0 -216
@@ -1,256 +0,0 @@
1
- # 算法思维 — 原始文献与历史语境 / Algorithmic Thinking — Original Texts & Historical Context
2
-
3
- ---
4
-
5
- ## 1. Turing Machine (1936) / 图灵机 (1936)
6
-
7
- Alan Turing 的论文 **"On Computable Numbers, with an Application to the Entscheidungsproblem"** (1936) 定义了"可计算性"的精确数学模型——图灵机 (Turing machine)。
8
-
9
- > "The 'computable' numbers may be described briefly as the real numbers whose expressions as a decimal are calculable by finite means."
10
- > — Alan Turing, 1936
11
-
12
- **核心定义 / Core definition:**
13
- - 图灵机 $M = (Q, \Sigma, \Gamma, \delta, q_0, q_{\text{accept}}, q_{\text{reject}})$,其中 $\delta: Q \times \Gamma \to Q \times \Gamma \times \{L, R\}$ 为转移函数。
14
- - 通用图灵机 (universal Turing machine): 可模拟任意图灵机 $M$ 在输入 $w$ 上的执行,即 $U(\langle M \rangle, w) = M(w)$。
15
-
16
- **停机问题 / Halting problem:**
17
- - 停机问题 $H = \{\langle M, w \rangle : M \text{ halts on } w\}$ 是不可判定的 (undecidable)。
18
- - 证明:假设 $H$ 可判定,则构造 $D(\langle M \rangle) = \text{run } H(\langle M, \langle M \rangle \rangle)$;若 $M$ 在 $\langle M \rangle$ 上停机则 $D$ 永不停机,反之 $D$ 停机。令 $D(\langle D \rangle)$ 产生矛盾。
19
-
20
- **Entscheidungsproblem (判定问题):**
21
- - Hilbert 1928 年提出:是否存在算法判定一阶逻辑语句的有效性?
22
- - Turing 与 Church 分别独立证明:不存在。一阶逻辑的有效性是不可判定的。
23
-
24
- ---
25
-
26
- ## 2. Church-Turing Thesis / Church-Turing 论题
27
-
28
- **论题 (thesis, not theorem):**
29
- > 任何"可有效计算"的函数都是图灵可计算的。
30
- > Every "effectively calculable" function is Turing-computable.
31
-
32
- **等价表述 / Equivalent formulations:**
33
- - Church: $\lambda$-可定义函数 (lambda calculus, 1936)
34
- - Gödel–Herbrand–Kleene: 一般递归函数 (general recursive functions)
35
- - Post: Post 系统 (Post canonical systems)
36
- - 以上模型计算的函数集完全相同,佐证论题的合理性。
37
-
38
- **强 Church-Turing 论题 / Strong Church-Turing thesis:**
39
- - 任何可在物理设备上于时间 $T$ 内求解的问题,均可在图灵机上于时间 $O(T^k)$($k$ 为常数)内求解。
40
- - 即:所有合理的计算模型在多项式时间内等价。
41
- - 量子计算对此提出挑战——是否存在 $k > 1$ 的多项式加速?
42
-
43
- ---
44
-
45
- ## 3. Euclid's Algorithm (~300 BC) / 欧几里得算法 (约公元前300年)
46
-
47
- **最古老且仍在使用的算法 / The oldest algorithm still in use.**
48
-
49
- **GCD 计算 / GCD computation:**
50
- $$\gcd(a, b) = \gcd(b, a \bmod b), \quad a \bmod b \neq 0$$
51
- $$\gcd(a, 0) = a$$
52
-
53
- **终止性证明 / Termination proof:**
54
- - 每一步 $b' = a \bmod b < b$,故序列 $b_0 > b_1 > b_2 > \cdots \geq 0$ 严格递减。
55
- - 有限步内必有 $b_k = 0$,算法终止。
56
-
57
- **扩展欧几里得算法 / Extended Euclidean algorithm:**
58
- - 计算 $\gcd(a, b)$ 同时求出 $x, y$ 使得 $ax + by = \gcd(a, b)$。
59
- - 应用:模逆元 $a^{-1} \bmod m$——当 $\gcd(a, m) = 1$ 时,$ax \equiv 1 \pmod{m}$,$x = a^{-1}$。
60
-
61
- **时间复杂度:**
62
- - Lamé 定理 (1844): 欧几里得算法的步数 $\leq 5 \times$ 较小数的十进制位数,即 $O(\log \min(a, b))$。
63
-
64
- ---
65
-
66
- ## 4. Knuth — The Art of Computer Programming (1968–) / Knuth — 计算机程序设计艺术 (1968–)
67
-
68
- Donald Knuth 的多卷巨著 **TAOCP** 系统化了算法分析学科。
69
-
70
- > "The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music."
71
- > — Donald Knuth, TAOCP Vol. 1, Preface
72
-
73
- **贡献 / Contributions:**
74
- - 将 big-O 记号从数论引入计算机科学并普及。$O(f(n))$: 存在常数 $c, n_0$ 使得 $T(n) \leq c \cdot f(n)$ 对所有 $n \geq n_0$。
75
- - 系统化的算法分类体系 (sorting, searching, arithmetic, combinatorial 等)。
76
- - MMIX / MIX 混合伪机器用于算法分析的精确模型。
77
- - 卷目: Vol. 1 (Fundamental Algorithms, 1968), Vol. 2 (Seminumerical Algorithms, 1969), Vol. 3 (Sorting and Searching, 1973), Vol. 4A (Combinatorial Algorithms, 2011).
78
-
79
- ---
80
-
81
- ## 5. Cook-Levin Theorem (1971) / Cook-Levin 定理 (1971)
82
-
83
- **NP-完全性 / NP-completeness:**
84
-
85
- > "The question 'is P = NP?' is one of the most important open questions in theoretical computer science."
86
- > — Stephen Cook, 1971
87
-
88
- **Cook-Levin 定理:**
89
- - SAT (布尔可满足性问题) 是 NP-完全的 (NP-complete)。
90
- - 证明:任意 NP 语言 $L$ 的非确定图灵机 $M$ 在 $w$ 上的接受计算可编码为 SAT 公式 $\varphi_{M,w}$;$w \in L \iff \varphi_{M,w}$ 可满足。
91
- - 规约: $L \leq_p \text{SAT}$ 对所有 $L \in \text{NP}$ 成立。
92
-
93
- **Karp 的 21 个 NP-完全问题 (1972):**
94
- - Richard Karp 在 "Reducibility among Combinatorial Problems" 中证明 21 个经典问题均为 NP-完全,包括:
95
- - 3SAT, CLIQUE, VERTEX-COVER, HAM-CYCLE, TSP, SUBSET-SUM, PARTITION 等。
96
-
97
- **P vs NP:**
98
- - $\text{P} = \text{NP}$?若成立,则所有 NP 问题均有多项式时间算法。普遍猜测 $\text{P} \neq \text{NP}$。Clay 数学研究所千禧年大奖问题之一。
99
-
100
- ---
101
-
102
- ## 6. Divide-and-Conquer / 分治法
103
-
104
- **思想 / Key idea:** 将问题分解为若干子问题,递归求解,合并结果。
105
-
106
- **经典算法 / Canonical examples:**
107
- - **合并排序 (Merge sort):** $T(n) = 2T(n/2) + O(n) \Rightarrow T(n) = O(n \log n)$。稳定排序。
108
- - **快速排序 (Quicksort):** 平均 $O(n \log n)$,最坏 $O(n^2)$。Hoare (1962)。
109
- - **二分查找 (Binary search):** $T(n) = T(n/2) + O(1) \Rightarrow T(n) = O(\log n)$。有序数组前提。
110
-
111
- **主定理 / Master theorem:**
112
- $$T(n) = a\,T(n/b) + f(n)$$
113
- - 情形1: 若 $f(n) = O(n^{\log_b a - \varepsilon})$,则 $T(n) = \Theta(n^{\log_b a})$。
114
- - 情形2: 若 $f(n) = \Theta(n^{\log_b a} \log^k n)$,则 $T(n) = \Theta(n^{\log_b a} \log^{k+1} n)$。
115
- - 情形3: 若 $f(n) = \Omega(n^{\log_b a + \varepsilon})$ 且 $af(n/b) \leq cf(n)$,则 $T(n) = \Theta(f(n))$。
116
-
117
- ---
118
-
119
- ## 7. Dynamic Programming / 动态规划
120
-
121
- > "I decided to use the word 'dynamic' … it was something not even a Congressman could object to."
122
- > — Richard Bellman, on naming "dynamic programming" (1957)
123
-
124
- **核心要素 / Core principles:**
125
- 1. **最优子结构 (optimal substructure):** 最优解包含子问题的最优解。
126
- 2. **重叠子问题 (overlapping subproblems):** 不同子问题共享更小的子问题,递归会重复计算。
127
-
128
- **经典算法:**
129
- - **最短路径:** Dijkstra (1959)——单源最短路径,$O((V+E)\log V)$。
130
- - **Floyd-Warshall (1962):** 所有顶点对最短路径,$O(V^3)$。递推 $d_{ij}^{(k)} = \min(d_{ij}^{(k-1)}, d_{ik}^{(k-1)} + d_{kj}^{(k-1)})$。
131
- - **背包问题 (knapsack):** $O(nW)$ 伪多项式时间。
132
-
133
- **自底向上 vs 自顶向下 / Bottom-up vs Top-down (memoization):**
134
- - 自底向上:按子问题规模从小到大填表。
135
- - 自顶向下 + 记忆化 (memoization):递归但缓存已解子问题的结果。
136
-
137
- ---
138
-
139
- ## 8. Greedy Algorithms / 贪心算法
140
-
141
- **思想 / Key idea:** 每一步选择局部最优,期望达到全局最优。
142
-
143
- **经典算法:**
144
- - **Kruskal 最小生成树 (1956):** 按边权升序加入不形成环的边。$O(E \log E)$。贪心在 MST 问题中有效。
145
- - **Huffman 编码 (1952):** 每次合并频率最低的两个节点。最优前缀编码。
146
-
147
- **贪心何时有效 / When greedy works:**
148
- - **拟阵 (matroid) 结构:** 若问题的可行解集构成拟阵 $(E, \mathcal{I})$——即满足遗传性 (hereditary) 与交换性 (exchange property)——则贪心算法对任何权函数均给出最优解。
149
- - 交换性: 若 $A, B \in \mathcal{I}$,$|A| < |B|$,则存在 $e \in B \setminus A$ 使得 $A \cup \{e\} \in \mathcal{I}$。
150
-
151
- ---
152
-
153
- ## 9. Backtracking and Search / 回溯与搜索
154
-
155
- **深度优先搜索 (DFS) / 广度优先搜索 (BFS):**
156
- - DFS: 用栈(或递归),优先深入;用于拓扑排序、连通分量。
157
- - BFS: 用队列,优先扩展;用于最短路径(无权图)。
158
-
159
- **回溯 (backtracking):**
160
- - 系统地枚举候选解,发现不满足约束即回退。
161
- - 例: N-皇后问题、子集枚举、排列枚举。
162
-
163
- **剪枝与分支限界 / Pruning and branch-and-bound:**
164
- - 剪枝 (pruning): 利用约束提前排除不可能的分支,减少搜索空间。
165
- - 分支限界 (branch-and-bound): 对优化问题,维护当前最优解的界,剪去不可能更优的分支。常用于 TSP、整数规划。
166
-
167
- **约束满足问题 (CSP) / Constraint satisfaction:**
168
- - 变量集 + 值域 + 约束集。回溯搜索 + 约束传播 (AC-3 等)。
169
-
170
- ---
171
-
172
- ## 10. Randomized Algorithms / 随机化算法
173
-
174
- **两类 / Two types:**
175
- - **Las Vegas 算法:** 结果始终正确,运行时间随机。例:随机化 quicksort。
176
- - **Monte Carlo 算法:** 运行时间确定,结果可能错误(但错误概率可控制在任意小)。例:Miller-Rabin 素性测试。
177
-
178
- **Miller-Rabin 素性测试 (1976/1980):**
179
- - 对奇数 $n$,选取随机 $a \in \{2, \ldots, n-1\}$,检验 $a^{d} \bmod n$ 的序列是否满足 Fermat 小定理的强化条件。
180
- - 单次测试的错误概率 $\leq 1/4$;$k$ 次独立测试后错误概率 $\leq 4^{-k}$。
181
- - 时间 $O(k \log^3 n)$。
182
-
183
- **随机化快速排序 / Randomized quicksort:**
184
- - 随机选取 pivot,期望比较次数 $2n \ln n \approx 1.39 n \log_2 n$,期望运行时间 $O(n \log n)$。
185
- - 最坏 $O(n^2)$ 的概率可证明极低。
186
-
187
- ---
188
-
189
- ## 11. Decidability and Undecidability / 可判定性与不可判定性
190
-
191
- **停机问题不可判定 / Halting problem is undecidable (see §1).**
192
-
193
- **Rice 定理 (1953):**
194
- > 关于图灵机的任何非平凡语义性质都是不可判定的。
195
- > Every non-trivial semantic property of Turing machines is undecidable.
196
-
197
- - "语义性质": 仅取决于 $M$ 计算的函数,不取决于 $M$ 的结构。
198
- - "非平凡": 对某些图灵机成立,对某些不成立。
199
- - 例:"M 是否计算常数函数""M 是否在某输入上停机""M 是否计算可判定语言"——均不可判定。
200
-
201
- **Post 对应问题 / Post correspondence problem (PCP, 1946):**
202
- - 给定 domino 集合 $\{(t_1, b_1), \ldots, (t_k, b_k)\}$($t_i, b_i$ 为字符串),是否存在序列 $i_1, i_2, \ldots, i_m$ 使得 $t_{i_1} t_{i_2} \cdots t_{i_m} = b_{i_1} b_{i_2} \cdots b_{i_m}$?
203
- - PCP 是不可判定的。常用于证明其他问题的不可判定性。
204
-
205
- ---
206
-
207
- ## 12. Complexity Classes / 复杂度类
208
-
209
- | 类 / Class | 定义 / Definition | 中文说明 |
210
- |---|---|---|
211
- | **P** | $\{L : L \text{ 可在 } O(n^k) \text{ 时间内判定}\}$ | 多项式时间可判定 |
212
- | **NP** | $\{L : L \text{ 有多项式长度的验证证书}\}$ | 非确定多项式时间可判定 |
213
- | **co-NP** | $\{L : \bar{L} \in \text{NP}\}$ | NP 的补类 |
214
- | **EXP** | $\{L : L \text{ 可在 } O(2^{n^k}) \text{ 时间内判定}\}$ | 指数时间可判定 |
215
- | **R** | $\{L : L \text{ 是可判定的}\}$ | 递归语言 / 可判定语言 |
216
- | **RE** | $\{L : L \text{ 可被图灵机识别}\}$ | 递归可枚举语言 |
217
-
218
- **层次关系 / Hierarchies:**
219
- $$\text{P} \subseteq \text{NP} \subseteq \text{PSPACE} \subseteq \text{EXP} \subseteq \text{R} \subseteq \text{RE}$$
220
- $$\text{P} \neq \text{EXP} \quad (\text{time hierarchy theorem, Hartmanis–Stearns 1965})$$
221
- $$\text{R} \neq \text{RE} \quad (\text{halting problem} \in \text{RE} \setminus \text{R})$$
222
-
223
- ---
224
-
225
- ## 13. Sorting Lower Bound / 排序下界
226
-
227
- **比较排序的下界 / Lower bound for comparison-based sorting:**
228
-
229
- $$T(n) \geq \Omega(n \log n)$$
230
-
231
- **信息论论证 / Information-theoretic argument:**
232
- - $n$ 个元素的排列数 $= n!$,每次比较至多将搜索空间减半。
233
- - 决策树高度 $h$ 须满足 $2^h \geq n!$,故 $h \geq \log_2(n!) = \Omega(n \log n)$。
234
- - 由 Stirling 公式: $\log_2(n!) \approx n \log_2 n - n \log_2 e + O(\log n)$。
235
-
236
- **突破下界的方法 / Breaking the bound:**
237
- - 非比较排序可超越 $\Omega(n \log n)$:计数排序 $O(n+k)$,基数排序 $O(d(n+k))$——但要求输入有特殊结构。
238
-
239
- ---
240
-
241
- ## 14. Algorithm Design Paradigms — Summary Table / 算法设计范式总结表
242
-
243
- | 范式 / Paradigm | 核心思想 / Key Idea | 适用条件 / When to Use | 典型例子 / Canonical Example |
244
- |---|---|---|---|
245
- | 分治 / Divide-and-Conquer | 分解→递归→合并 | 问题可自然分为独立子问题 | Merge sort, Binary search |
246
- | 动态规划 / Dynamic Programming | 子问题重叠+最优子结构,填表避免重复 | 子问题重叠严重,有最优子结构 | Floyd-Warshall, Knapsack |
247
- | 贪心 / Greedy | 每步取局部最优 | 拟阵结构或可证贪心正确性 | Kruskal MST, Huffman coding |
248
- | 回溯 / Backtracking | 系统搜索+剪枝 | 搜索空间有限但巨大 | N-Queens, CSP |
249
- | 分支限界 / Branch-and-Bound | 搜索+维护上下界剪枝 | 优化问题,可计算解的界 | TSP (exact), Integer programming |
250
- | 随机化 / Randomized | 引入随机性降低期望代价或错误概率 | 需要概率保证或期望高效 | Miller-Rabin, Randomized quicksort |
251
- | 归约/规约 / Reduction | 将问题变换为已知问题 | 已有高效算法求解目标问题 | SAT → 3SAT (Cook-Levin) |
252
-
253
- ---
254
-
255
- *本文件为算法思维技能的数学参考与历史语境,涵盖从古希腊到现代计算理论的核心成果。*
256
- *This file provides mathematical references and historical context for the algorithmic-thinking skill, covering core results from ancient Greece to modern computational theory.*
@@ -1,144 +0,0 @@
1
- ---
2
- name: axiomatization
3
- description: |
4
- Trigger when examining the reasonableness of a theory's assumptions, constructing an axiom system, discovering internal contradictions, verifying consistency/independence/completeness; or defining axioms and invariants for an algorithm/operator/structure and checking their computability.
5
- ---
6
-
7
- # 📐 Axiomatization
8
-
9
- > "Starting from minimal assumptions, building through rigorous logic — examining premises matters more than checking conclusions"
10
- >
11
- > — Euclid's *Elements*, Hilbert's *Foundations of Geometry*, Axiomatic Set Theory
12
-
13
- ## Core Principle
14
-
15
- **Any theoretical system can (and should) be reduced to a set of fundamental axioms, from which all theorems in that domain can be derived through rigorous logical inference. Examining premises matters more than checking conclusions — if premises are wrong, no amount of elegant reasoning can save the conclusion.**
16
-
17
- > **Mathematical Formalization**
18
- >
19
- > The quality of an axiom system is judged by the following core criteria:
20
- >
21
- > - **Consistency**: The axioms must not contradict one another. If the axiom set is contradictory, then by the principle of explosion (*ex falso quodlibet*) any proposition can be derived, and the system collapses.
22
- > - **Independence**: No axiom should be derivable from the others.
23
- > - **Completeness**: All true propositions in the domain should be provable from the axioms (note: completeness varies with the order of the logical system; see Method).
24
- >
25
- > **Categoricity**: An axiom system is categorical if all its models are isomorphic to one another. A categorical system uniquely determines the structure of its subject — for example, the second-order Peano axioms are categorical (the unique model is the natural number structure ℕ), whereas the first-order Peano axioms are not (non-standard models exist).
26
- >
27
- > **Relative Consistency**: If all axioms of system A can be embedded as true propositions in system B, and system B is known to be consistent, then system A is consistent. This is the standard method for proving consistency — for example, the consistency of PA can be proved within ZFC (the axioms of PA are all true in ZFC), but the consistency of ZFC itself can only be relatively proved in a stronger system (e.g., ZFC + the existence of an inaccessible cardinal).
28
- >
29
- > See `original-texts.md` for detailed mathematical foundations.
30
-
31
- ## GPU-Friendliness (Cross-Cutting Check)
32
-
33
- When axiomatization is used to **define axioms and invariants for an algorithm/operator/structure**, the defined structures must pass the eight-dimension gate of `../../references/gpu-friendly-math.md` — "axiomatically self-consistent" does not mean "computable":
34
-
35
- - **Friendly**: The axiom system naturally reduces to linear algebra — group action axioms → equivariant layers = GEMM (weight sharing along orbits); ring axioms relaxed to semirings → generalized GEMM (min-plus / tropical). Passes dimensions 1/2/3.
36
- - **Adaptable**: Essentially discrete/symbolic axioms (hard Top-K, exact finite-field arithmetic, symbolic proof search) block gradients → relax the axioms: tropical semiring piecewise-linear gating, Gumbel-softmax, differentiable surrogates.
37
- - **Anti-pattern**: Invariants requiring global symbolic reasoning or exact discrete satisfaction (e.g., exact Čech cohomology, exact orbit-equality testing) → "beautiful but not computable"; switch to local/continuous approximations.
38
-
39
- Eight-dimension minimum assessment (formal terminology): **Tensorization** — whether axiom instances can be batch-checked; **GEMM-Mappability** — whether operational axioms can reduce to linear/semiring matrix multiplication; **Complexity** — whether consistency/independence checking degenerates to undecidable or exponential search; **Memory & KV-Cache** — whether invariants require a global state table; **Low-Precision Stability** — whether axioms tolerate approximate equalities; **Parallelism & Communication** — whether local axioms can be verified in blocks; **Sparsity Structure** — whether the constraint graph is structured; **Operator Fusion** — whether axiom checks can be compiled into lightweight loss/guard kernels.
40
-
41
- > In conjunction with `../../references/books/abstract-algebra.md` (group/ring/field axioms, ring→semiring relaxation) and `../../references/books/algebraic-geometry-rising-sea.md` (sheaf/category/cohomology axioms).
42
-
43
- ## When NOT to Use
44
-
45
- - **Pure factual queries** (e.g., "what is this formula") — no theoretical system needs examination.
46
- - **The user has already accepted a theoretical framework and only needs to apply it** — the axioms are already chosen.
47
- - **Empirical questions** (requiring experimental data rather than logical reasoning) — axiomatization cannot substitute for empirical evidence.
48
- - **Defaulting to classical tools in a constructive context** — if the user requires constructive proofs, the law of excluded middle or the axiom of choice should not be assumed by default.
49
-
50
- ## When to Use
51
-
52
- - When reading a paper, examining whether its theoretical assumptions are reasonable and self-consistent.
53
- - When building a theoretical framework, starting from the minimal axiom set.
54
- - When discovering contradictions or inconsistencies within a theoretical system.
55
- - When determining whether a formal system is decidable or complete.
56
- - When comparing the consequences of different axiom choices (constructive vs. classical, first-order vs. second-order).
57
- - **Defining axioms and invariants for an operator/structure** and checking their computability on GPU.
58
-
59
- ## Method
60
-
61
- ### Step 1: Identify the Axioms
62
- Find all fundamental assumptions (axioms) of the theoretical system, distinguishing: **explicit axioms** (clearly stated by the author), **implicit axioms** (unstated but actually used in the argument), **background axioms** (default assumptions of the larger framework, e.g., defaulting to ZFC).
63
-
64
- > "Every science truly matures only after it has been axiomatized." — Hilbert
65
-
66
- ### Step 2: Specify the Formal Language
67
- The expressive power of an axiom system depends on the chosen formal language; before axiomatizing, one must specify:
68
-
69
- - **First-order Logic**: Quantifiers range only over individual elements. Expressive power is limited, but it admits a complete proof theory (Gödel's Completeness Theorem: the provable coincides with the valid). Models of a first-order theory are not unique (non-categoricity), but the proof system is sound and complete.
70
- - **Second-order Logic**: Quantifiers may range over subsets and functions. Greater expressive power (can express categoricity, e.g., second-order Peano uniquely characterizes ℕ), but no complete proof system exists — its semantics cannot be fully captured by any recursive axiom set.
71
- - **Constructive / Intuitionistic Logic**: Rejects the law of excluded middle (∀P, P∨¬P). Existential proofs must provide an explicit witness: proving ∃x.φ(x) requires constructing a specific x₀ such that φ(x₀) holds. Inference rules are stricter, but all proofs are guaranteed to be computable.
72
-
73
- > Choosing a language is not merely a technical detail but a fundamental philosophical decision: first-order logic commits to an exhaustible proof system, second-order logic commits to structural uniqueness, constructive logic commits to computability.
74
-
75
- ### Step 3: Check Consistency
76
- Check whether the axioms contradict one another. If the axiom set is contradictory, then by the principle of explosion any proposition can be derived, and the system collapses. Methods:
77
-
78
- - Look for two axioms P and ¬P that hold simultaneously.
79
- - Attempt to construct a model in which all axioms are simultaneously true (model existence ⇒ consistency).
80
- - **Relative consistency proof**: Embed the axioms of system A as true propositions in system B; if B is known consistent, then A is consistent. For example, PA is consistent (the PA axioms are all true in the von Neumann natural number model within ZFC).
81
- - **Finite model method**: For weaker formal systems (propositional logic, certain finitely axiomatized weak arithmetics), construct a finite model to directly verify consistency.
82
-
83
- ### Step 4: Check Independence
84
- Check whether any axiom can be derived from the others. If so, it is not a true axiom but a theorem. Methods:
85
-
86
- - For each axiom A, construct a model in which A fails but all other axioms hold.
87
- - If such a model exists, then A is independent of the other axioms.
88
- - Classical examples: the parallel postulate is independent of the remaining axioms of Euclidean geometry (non-Euclidean geometry models); the Axiom of Choice is independent of ZF (Cohen's forcing method).
89
-
90
- ### Step 5: Assess Completeness
91
- Check whether the axiom system is strong enough to derive all important results in the domain. Completeness properties vary with the logical order and the content of the theory:
92
-
93
- - **First-order theories can be complete**: Dense Linear Order (DLO), Algebraically Closed Fields of fixed characteristic (ACF_p), and other first-order theories are complete and decidable. Completeness ≠ absence of open problems; completeness means that for every sentence φ, either φ or ¬φ is provable from the axioms.
94
- - **Scope of Gödel's Incompleteness Theorems**: Incompleteness specifically applies to first-order recursively enumerable theories containing sufficient arithmetic (PA, ZFC, etc.), in which there necessarily exist undecidable propositions (e.g., the Gödel sentence in PA, CH in ZFC).
95
- - **Decidability is an independent question**: A complete first-order theory is typically decidable (there exists an algorithm to determine whether any formula is a theorem), but an incomplete theory is not necessarily undecidable — decidability depends on whether an algorithm for deciding theorems exists, not on whether all propositions have proofs.
96
-
97
- ### Step 6: Analyze the Impact of Axiom Choice
98
- What happens to the theory if an axiom is changed or relaxed? Many branches of mathematics developed precisely through altering axioms:
99
-
100
- - Changing the parallel postulate → non-Euclidean geometries (hyperbolic geometry, elliptic geometry).
101
- - **Constructive vs. Classical**: Removing the law of excluded middle → constructive mathematics (Brouwer, Heyting), where existence proofs must provide explicit constructions; adding the Axiom of Choice → stronger classical mathematics, but yielding non-constructive proofs (e.g., the Banach-Tarski paradox).
102
- - **Zorn's Lemma, the Well-Ordering Theorem, and the Axiom of Choice**: These three are equivalent within ZF — accepting any one means accepting all; this equivalence itself is non-constructive.
103
- - Changing the induction axiom → non-standard analysis.
104
-
105
- ### Step 7: Apply and Conclude
106
- Synthesize the above analysis and give an overall assessment of the axiom system: Is it suitable for its intended domain of application? Are there axioms that need to be supplemented or revised? What are the limitations of the system (undecidable propositions, non-categoricity, lack of constructivity, etc.)?
107
-
108
- ## Common Errors
109
-
110
- | Error | Critique | Correct Approach |
111
- |---|---|---|
112
- | Confusing axioms with theorems | Treating a proposition that needs proof as a self-evident axiom | Clearly distinguish: axioms are the starting point, theorems are the endpoint |
113
- | Overlooking implicit assumptions | Using unstated assumptions in the argument, making the reasoning imprecise | Scrutinize every step of reasoning, exposing all hidden assumptions |
114
- | Accepting a contradictory axiom set | From contradictory axioms, any conclusion can be derived (principle of explosion) | Verify the consistency of the axiom set |
115
- | Treating axioms as truths | Axioms are merely conventions about starting points, not absolute truths | The value of axioms lies in the usefulness of their consequences |
116
- | Ignoring the possibility of axiom change | Assuming axioms are the only possible choice | Consider what new theories arise from changing axioms |
117
- | Confusing first-order and second-order completeness | First-order logic has a complete proof system (Gödel completeness); second-order does not; "completeness" has different meanings in each | Distinguish proof-theoretic completeness from model-theoretic completeness; specify the logical order |
118
- | Neglecting constructive obligations | Using the law of excluded middle in a constructive context, or proving only ¬¬∃x.φ(x) without providing a witness | Constructive proofs of ∃x.φ(x) must provide an explicit witness x₀; the law of excluded middle is prohibited in constructive contexts |
119
- | Assuming all incomplete theories are equally incomplete | Different incomplete theories vary enormously in the number and nature of their undecidable propositions | Analyze the specific theory: which propositions are undecidable, and what are their structural properties |
120
- | Forcing discrete/symbolic axioms into training | Essentially discrete/symbolic axiom systems are non-differentiable and non-computable | Pass the eight-dimension gate; relax to differentiable/approximate forms when necessary (tropical semiring, Gumbel-softmax) |
121
-
122
- ## Operating Procedure
123
-
124
- When this skill is triggered, the output must contain:
125
-
126
- 1. **Axiom Inventory**: `[Axiom N]: [content] (source: explicit / implicit / background)`
127
- 2. **Formal Language Specification**: `[Language type]: [first-order / second-order / constructive] (rationale: ...)`
128
- 3. **Consistency Check**: `✅ Consistent` or `❌ Contradiction found: [specific contradiction]`; if using relative consistency, note the target system of the embedding
129
- 4. **Independence Analysis**: Flag any redundant axioms `⚠️ [Axiom N] may be derivable from [Axiom M]`
130
- 5. **Completeness Assessment**: `✅ Complete` / `⚠️ Incomplete: missing [X]`; note whether Gödel's incompleteness theorems apply, and indicate decidability
131
- 6. **Axiom Change Analysis**: If a particular axiom is changed (removing excluded middle, adding/removing the Axiom of Choice), how does the theory change?
132
- 7. **Conclusion**: Overall assessment of the system's consistency, independence, completeness, categoricity, and decidability
133
- 8. **[GPU Feasibility]** (if used for algorithm/operator/structure design) — structures derived from the defined axioms and invariants pass the eight-dimension gate of `../../references/gpu-friendly-math.md`, rated friendly / retrofittable / unfriendly + adaptation recommendations
134
-
135
- **Output must never provide analysis alone without a conclusion. Every item must receive a definitive verdict — no hedging.**
136
-
137
- ## Relations to Other Skills
138
-
139
- - **Logic Deduction**: Axiomatization requires logical deduction as its inference tool; formal inference rules are the proof mechanism of the axiom system.
140
- - **Abstraction**: Axiomatization is abstraction at the highest level — reducing everything to minimal assumptions.
141
- - **Modeling**: An axiom system is itself a kind of model, whose applicability to reality must be verified; model theory directly serves consistency and independence checks.
142
- - **Induction and Analogy**: The choice of axioms is often inspired through induction and analogy.
143
- - **Algorithmic Thinking**: Formal systems and decidability are directly linked — decidable theories admit algorithmic theorem-decision procedures; undecidable theories do not.
144
- - **Modern Math Activation**: `../../references/books/abstract-algebra.md` (axiom systems / groups, rings, fields; ring→semiring relaxation), `../../references/books/algebraic-geometry-rising-sea.md` (sheaf/category/cohomology foundations).
@@ -1,151 +0,0 @@
1
- ---
2
- name: axiomatization
3
- description: |
4
- 触发:审查论文/理论的假设合理性、构建新公理系统、发现理论内部矛盾、验证相容性/独立性/完备性;或为算法/算子/结构定公理与不变量并检验其可计算性时调用。
5
- English: Trigger when examining the reasonableness of a theory's assumptions, constructing an axiom system, discovering internal contradictions, verifying consistency/independence/completeness; or defining axioms and invariants for an algorithm/operator/structure and checking their computability.
6
- ---
7
-
8
- > **语言路由**:若用户消息为英文,请读取并遵循同目录下的 `SKILL.en.md`,按其操作规程以英文输出;中文消息则继续使用本文件。
9
-
10
- # 📐 公理化思想 / Axiomatization
11
-
12
- > "从最少假设出发,用严格逻辑构建——审查前提比检查结论更重要"
13
- > "Starting from minimal assumptions, building through rigorous logic — examining premises matters more than checking conclusions"
14
- >
15
- > —— 欧几里得《几何原本》、希尔伯特《几何基础》、公理集合论
16
- > —— Euclid's *Elements*, Hilbert's *Foundations of Geometry*, Axiomatic Set Theory
17
-
18
- ## 核心原则 / Core Principle
19
-
20
- **任何理论体系都可以(且应该)被还原为一组基本公理,从这些公理出发,通过严格逻辑推理,可以推导出该领域的所有定理。审查前提比检查结论更重要——前提错了,结论再精巧也站不住脚。**
21
-
22
- **Any theoretical system can (and should) be reduced to a set of fundamental axioms, from which all theorems in that domain can be derived through rigorous logical inference. Examining premises matters more than checking conclusions — if premises are wrong, no amount of elegant reasoning can save the conclusion.**
23
-
24
- > **数学形式化 / Mathematical Formalization**
25
- >
26
- > 评判一个公理系统的质量,有以下核心标准:
27
- >
28
- > - **相容性(Consistency)**:公理之间不能互相矛盾。若公理集合矛盾,则由爆炸原理(ex falso quodlibet)可推出任意命题,体系崩溃
29
- > - **独立性(Independence)**:每条公理都不能由其他公理推导出来
30
- > - **完备性(Completeness)**:该领域的所有真命题都能从公理出发被证明(注意:完备性因逻辑系统阶数而异,见方法流程)
31
- >
32
- > **范畴性(Categoricity)**:若一个公理系统的所有模型彼此同构,则该系统是范畴的。范畴系统唯一确定其研究对象的结构——例如二阶 Peano 公理是范畴的(唯一模型为自然数结构 ℕ),而一阶 Peano 公理不是范畴的(存在非标准模型)。
33
- >
34
- > **相对一致性(Relative Consistency)**:若公理系统 A 的所有公理可嵌入为系统 B 中的真命题,且系统 B 已知相容,则系统 A 相容。这是证明相容性的标准方法——例如 PA 的相容性可在 ZFC 中证明(PA 的公理在 ZFC 中皆为真),但 ZFC 自身的相容性只能在更强的系统(如 ZFC+存在不可达基数)中相对证明。
35
- >
36
- > 详细数学依据见 `original-texts.md`
37
-
38
- ## GPU 友好性 / GPU-Friendliness(横切检查)
39
-
40
- 当公理化用于**为算法/算子/结构定公理与不变量**时,所定义的结构必须过 `../../references/gpu-friendly-math.md` 八维门——「公理自洽」不等于「可算」:
41
-
42
- - **友好**:公理系统天然落到线性代数——群作用公理 → 等变层 = GEMM(权重沿轨道共享);环公理松弛为半环 → 广义 GEMM(min-plus/热带)。过维度 1/2/3。
43
- - **可改造**:本质离散/符号的公理(硬 Top-K、精确有限域算术、符号证明搜索)阻断梯度 → 松弛公理:热带半环分段线性门控、Gumbel-softmax、可微代理。
44
- - **反模式**:不变量要求全局符号推理或精确离散满足(如精确 Čech 上同调、精确轨道相等判断)→「美但不可算」;改为局部/连续近似。
45
-
46
- 八维最低判定(正式术语):**张量化**看公理实例是否能批量检查;**GEMM 可映射**看运算公理是否能落线性/半环矩阵乘;**复杂度**看一致性/独立性检查是否退化为不可判定或指数搜索;**显存与 KV-Cache**看不变量是否需要全局状态表;**低精度稳定**看公理是否容忍近似等式;**并行与通信**看局部公理能否分块验证;**稀疏结构**看约束图是否结构化;**算子融合**看公理检查能否编译成轻量 loss/guard。
47
-
48
- > 配合 `../../references/books/abstract-algebra.md`(群/环/域公理、环→半环松弛)与 `../../references/books/algebraic-geometry-rising-sea.md`(层/范畴/上同调公理)。
49
-
50
- ## 不适用场景 / When NOT to Use
51
-
52
- - **纯粹的事实查询**(如"这个公式是什么")——没有理论体系需要审查。
53
- - **用户已接受某个理论框架,只需应用**——公理已选定。
54
- - **经验性问题**(需实验数据而非逻辑推理)——公理化不能替代实证。
55
- - **构造性语境下默认使用经典工具**——若用户要求构造性证明,不应默认排中律或选择公理。
56
-
57
- ## 何时使用 / When to Use
58
-
59
- - 阅读论文时,审查其理论基础假设是否合理、是否自洽。
60
- - 构建理论框架时,从最小公理集出发。
61
- - 发现某理论体系内部存在矛盾或不一致。
62
- - 需判断形式系统是否可判定(decidable)或是否完备。
63
- - 需比较不同公理选择的后果(构造性 vs 经典、一阶 vs 二阶)。
64
- - **为算子/结构定公理与不变量**,并检验其在 GPU 上的可计算性。
65
-
66
- ## 方法流程 / Method
67
-
68
- ### 第一步:识别公理 / Identify the Axioms
69
- 找出该理论体系的所有基本假设(公理),区分:**显式公理**(作者明确声明)、**隐式公理**(未声明但论证实际使用)、**背景公理**(默认接受的更大框架假设,如默认 ZFC)。
70
-
71
- > "每一门科学只有当它被公理化之后,才算是真正成熟了。" —— 希尔伯特
72
-
73
- ### 第二步:规定形式语言 / Specify the Formal Language
74
- 公理体系表达力取决于所选形式语言,公理化前必须明确:
75
-
76
- - **一阶逻辑(First-order Logic)**:量词只作用于个体元素。表达力有限,但拥有完备证明理论(哥德尔完备性定理:可证明的恰好是有效的)。一阶理论模型不唯一(非范畴性),但证明系统可靠且完备。
77
- - **二阶逻辑(Second-order Logic)**:量词可作用于子集和函数。表达力更强(可表达范畴性,如二阶 Peano 唯一刻画 ℕ),但不存在完备证明系统——其语义不可被任何递归公理集完全捕获。
78
- - **构造性逻辑(Constructive / Intuitionistic Logic)**:不接受排中律(∀P, P∨¬P)。存在量词证明必须给出显式见证(witness):证明 ∃x.φ(x) 必须构造出具体 x₀ 使 φ(x₀) 成立。推理规则更严格,但保证所有证明可计算。
79
-
80
- > 选择语言不仅是技术细节,而是根本性哲学决定:一阶逻辑承诺可穷尽的证明系统,二阶逻辑承诺结构唯一性,构造性逻辑承诺可计算性。
81
-
82
- ### 第三步:检验相容性 / Check Consistency
83
- 检查公理之间是否互相矛盾。若公理集合矛盾,则由爆炸原理可推出任意命题,体系崩溃。检验方法:
84
-
85
- - 寻找是否存在两个公理 P 与 ¬P 同时成立。
86
- - 尝试构造模型使所有公理同时为真(模型存在 ⇒ 相容)。
87
- - **相对一致性证明**:将系统 A 的公理嵌入为系统 B 中的真命题,若 B 已知相容则 A 相容。例如 PA 相容(PA 公理在 ZFC 的 von Neumann 自然数模型中皆为真)。
88
- - **有限模型方法**:对较弱的形式系统(命题逻辑、某些有穷公理化弱算术),可构造有限模型直接验证相容性。
89
-
90
- ### 第四步:检验独立性 / Check Independence
91
- 检查是否有某条公理可由其他公理推导出来。若存在,它不是真正的公理而是定理。检验方法:
92
-
93
- - 对每条公理 A,构造模型使 A 不成立但其他公理都成立。
94
- - 若这样的模型存在,则 A 独立于其他公理。
95
- - 经典案例:平行公理独立于欧氏几何其余公理(非欧几何模型);选择公理独立于 ZF(Cohen 力迫法)。
96
-
97
- ### 第五步:评估完备性 / Assess Completeness
98
- 检查公理体系是否足以推导出该领域所有重要结论。完备性性质因逻辑阶数和理论内容而异:
99
-
100
- - **一阶理论可以完备**:稠密线性序(DLO)、固定特征的代数封闭域(ACF_p)等一阶理论完备且可判定。完备 ≠ 不存在未决问题;完备指对每个闭公式 φ,φ 或 ¬φ 可由公理证明。
101
- - **哥德尔不完备定理的适用范围**:不完备性特指包含足够算术的一阶递归可枚举理论(PA、ZFC 等),其中必然存在不可判定命题(如 PA 中的 Gödel 句、ZFC 中的 CH)。
102
- - **可判定性(Decidability)是独立问题**:完备的一阶理论通常可判定(有算法判定任意公式是否为定理),但不完备理论未必不可判定——可判定性取决于是否存在判定定理的算法,而非是否所有命题都有证明。
103
-
104
- ### 第六步:分析公理选择的影响 / Analyze the Impact of Axiom Choice
105
- 改变或放松某条公理,理论会发生什么变化?许多数学分支的发展正是通过改变公理实现的:
106
-
107
- - 改变平行公理 → 非欧几何(双曲几何、椭圆几何)。
108
- - **构造性 vs 经典**:去除排中律 → 构造性数学(Brouwer, Heyting),存在性证明必须提供显式构造;添加选择公理 → 更强的经典数学,但产生非构造性证明(如 Banach-Tarski 分球定理)。
109
- - **Zorn 引理、良序定理与选择公理**:在 ZF 中三者等价——接受任何一个即接受全部,这一等价性本身是非构造性的。
110
- - 改变归纳公理 → 非标准分析。
111
-
112
- ### 第七步:应用与结论 / Apply and Conclude
113
- 综合以上分析,给出对该公理体系的整体评价:是否适合其预期应用领域?是否存在需补充或修改的公理?该体系的局限性是什么(不可判定命题、非范畴性、构造性缺失等)?
114
-
115
- ## 常见错误 / Common Errors
116
-
117
- | 错误 / Error | 批评 / Critique | 正确做法 / Correct Approach |
118
- |---|---|---|
119
- | 混淆公理和定理 | 把需证明的命题当作不证自明的公理 | 明确区分:公理是起点,定理是终点 |
120
- | 忽视隐式假设 | 论证中使用了未声明的假设,推理不严密 | 审查每一步推理,暴露所有隐含假设 |
121
- | 接受矛盾公理集 | 从矛盾公理可推出任意结论(爆炸原理) | 检验公理集合的相容性 |
122
- | 把公理当真理 | 公理只是选择出发点的约定,非绝对真理 | 公理的价值在于其推论的有用性 |
123
- | 忽略公理变更的可能性 | 认为公理是唯一可能的选择 | 考虑改变公理会得到什么新理论 |
124
- | 混淆一阶与二阶完备性 | 一阶有完备证明系统(哥德尔完备性),二阶没有;二者"完备"含义不同 | 区分证明论完备性与模型论完备性,明确逻辑阶数 |
125
- | 忽视构造性义务 | 构造性语境中使用排中律或仅证 ¬¬∃x.φ(x) 而不给见证 | 构造性证明须对 ∃x.φ(x) 给出显式见证 x₀;构造性语境禁用排中律 |
126
- | 假设所有不完备理论同样不完备 | 不同不完备理论的不可判定命题数量与性质差异巨大 | 分析具体理论:哪些命题不可判定、其结构性质如何 |
127
- | 把离散/符号公理硬塞进训练 | 本质离散/符号的公理系统不可微、不可算 | 过八维门,必要时松弛为可微/近似(热带半环、Gumbel-softmax) |
128
-
129
- ## 操作规程 / Operating Procedure
130
-
131
- 当本 skill 被触发时,输出必须包含:
132
-
133
- 1. **公理清单**:`[公理N]: [内容](来源:显式/隐式/背景)`
134
- 2. **形式语言规定**:`[语言类型]: [一阶/二阶/构造性](理由:...)`
135
- 3. **相容性检查**:`✅ 相容` 或 `❌ 发现矛盾:[具体矛盾]`;若用相对一致性,注明嵌入的目标系统
136
- 4. **独立性分析**:标注是否存在冗余公理 `⚠️ [公理N] 可能由 [公理M] 推出`
137
- 5. **完备性评估**:`✅ 完备` / `⚠️ 不完备:缺少 [X]`;注明是否属哥德尔不完备定理适用范围,标注可判定性
138
- 6. **公理变更分析**:若改变某条公理(去除排中律、添加/去除选择公理),理论会如何变化?
139
- 7. **结论**:对该理论体系相容性、独立性、完备性、范畴性、可判定性的综合判定
140
- 8. **[GPU 可行性]**(若用于算法/算子/结构设计)— 所定公理与不变量导出的结构过 `../../references/gpu-friendly-math.md` 八维门,标注友好/可改造/不友好 + 改造建议
141
-
142
- **输出不得只给分析而无结论。每项必须给出明确判定,不可悬置。**
143
-
144
- ## 与其他 skill 的关系 / Relations to Other Skills
145
-
146
- - **逻辑演绎**:公理化需要逻辑演绎作为推理工具;形式推理规则是公理体系的证明机制。
147
- - **抽象化**:公理化是最高层次的抽象——把一切还原为最少假设。
148
- - **建模思想**:公理体系本身也是一种模型,需检验其对现实的适用性;模型论直接服务于相容性与独立性检验。
149
- - **归纳与类比**:公理的选择往往通过归纳和类比获得灵感。
150
- - **算法思想**:形式系统与可判定性直接关联——可判定理论存在算法判定定理,不可判定理论则不存在。
151
- - **现代数学激活**:`../../references/books/abstract-algebra.md`(公理系统/群环域、环→半环松弛)、`../../references/books/algebraic-geometry-rising-sea.md`(层/范畴/上同调基础)。