math-skill 2.1.0 → 3.0.1

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 (244) hide show
  1. package/README.en-US.md +165 -198
  2. package/README.md +165 -198
  3. package/agents/math-critic.en.md +28 -26
  4. package/agents/math-critic.md +33 -33
  5. package/commands/ask.en.md +10 -0
  6. package/commands/ask.md +3 -10
  7. package/design-patterns/attention/equivariant-attention.en.md +72 -0
  8. package/design-patterns/attention/equivariant-attention.md +72 -0
  9. package/design-patterns/attention/geometry-aware-attention.en.md +73 -0
  10. package/design-patterns/attention/geometry-aware-attention.md +72 -0
  11. package/design-patterns/attention/information-bottleneck-attention.en.md +72 -0
  12. package/design-patterns/attention/information-bottleneck-attention.md +72 -0
  13. package/design-patterns/attention/projection-attention.en.md +68 -0
  14. package/design-patterns/attention/projection-attention.md +68 -0
  15. package/design-patterns/attention/spectral-attention.en.md +71 -0
  16. package/design-patterns/attention/spectral-attention.md +71 -0
  17. package/design-patterns/compression/leverage-score-selection.en.md +71 -0
  18. package/design-patterns/compression/leverage-score-selection.md +71 -0
  19. package/design-patterns/compression/low-rank-kv-cache.en.md +60 -0
  20. package/design-patterns/compression/low-rank-kv-cache.md +60 -0
  21. package/design-patterns/compression/spectral-token-pruning.en.md +61 -0
  22. package/design-patterns/compression/spectral-token-pruning.md +61 -0
  23. package/design-patterns/compression/topology-preserving-compression.en.md +64 -0
  24. package/design-patterns/compression/topology-preserving-compression.md +64 -0
  25. package/design-patterns/loss/constraint-penalty.en.md +67 -0
  26. package/design-patterns/loss/constraint-penalty.md +78 -0
  27. package/design-patterns/loss/contrastive-loss.en.md +59 -0
  28. package/design-patterns/loss/contrastive-loss.md +68 -0
  29. package/design-patterns/loss/information-bottleneck-loss.en.md +69 -0
  30. package/design-patterns/loss/information-bottleneck-loss.md +74 -0
  31. package/design-patterns/loss/orthogonality-loss.en.md +56 -0
  32. package/design-patterns/loss/orthogonality-loss.md +60 -0
  33. package/design-patterns/loss/variational-loss.en.md +61 -0
  34. package/design-patterns/loss/variational-loss.md +71 -0
  35. package/design-patterns/representation/equivariant-split.en.md +87 -0
  36. package/design-patterns/representation/equivariant-split.md +89 -0
  37. package/design-patterns/representation/manifold-representation.en.md +85 -0
  38. package/design-patterns/representation/manifold-representation.md +87 -0
  39. package/design-patterns/representation/shared-private-decomposition.en.md +84 -0
  40. package/design-patterns/representation/shared-private-decomposition.md +86 -0
  41. package/design-patterns/representation/subspace-alignment.en.md +90 -0
  42. package/design-patterns/representation/subspace-alignment.md +92 -0
  43. package/design-patterns/routing/graph-routing.en.md +79 -0
  44. package/design-patterns/routing/graph-routing.md +81 -0
  45. package/design-patterns/routing/moe-routing.en.md +85 -0
  46. package/design-patterns/routing/moe-routing.md +87 -0
  47. package/design-patterns/routing/optimal-transport-routing.en.md +68 -0
  48. package/design-patterns/routing/optimal-transport-routing.md +72 -0
  49. package/design-patterns/routing/spectral-clustering-routing.en.md +88 -0
  50. package/design-patterns/routing/spectral-clustering-routing.md +90 -0
  51. package/knowledge-base/differential-geometry/connection.en.md +51 -0
  52. package/knowledge-base/differential-geometry/connection.md +51 -0
  53. package/knowledge-base/differential-geometry/curvature.en.md +49 -0
  54. package/knowledge-base/differential-geometry/curvature.md +49 -0
  55. package/knowledge-base/differential-geometry/geodesic.en.md +51 -0
  56. package/knowledge-base/differential-geometry/geodesic.md +51 -0
  57. package/knowledge-base/differential-geometry/manifold.en.md +47 -0
  58. package/knowledge-base/differential-geometry/manifold.md +47 -0
  59. package/knowledge-base/differential-geometry/metric-tensor.en.md +50 -0
  60. package/knowledge-base/differential-geometry/metric-tensor.md +50 -0
  61. package/knowledge-base/differential-geometry/tangent-space.en.md +48 -0
  62. package/knowledge-base/differential-geometry/tangent-space.md +48 -0
  63. package/knowledge-base/information-geometry/fisher-metric.en.md +56 -0
  64. package/knowledge-base/information-geometry/fisher-metric.md +56 -0
  65. package/knowledge-base/information-geometry/natural-gradient.en.md +54 -0
  66. package/knowledge-base/information-geometry/natural-gradient.md +54 -0
  67. package/knowledge-base/lie-theory/equivariance.en.md +54 -0
  68. package/knowledge-base/lie-theory/equivariance.md +54 -0
  69. package/knowledge-base/lie-theory/group-action.en.md +51 -0
  70. package/knowledge-base/lie-theory/group-action.md +51 -0
  71. package/knowledge-base/lie-theory/lie-algebra.en.md +51 -0
  72. package/knowledge-base/lie-theory/lie-algebra.md +51 -0
  73. package/knowledge-base/lie-theory/lie-group.en.md +51 -0
  74. package/knowledge-base/lie-theory/lie-group.md +51 -0
  75. package/knowledge-base/lie-theory/representation.en.md +52 -0
  76. package/knowledge-base/lie-theory/representation.md +52 -0
  77. package/knowledge-base/matrix-analysis/low-rank-approximation.en.md +49 -0
  78. package/knowledge-base/matrix-analysis/low-rank-approximation.md +49 -0
  79. package/knowledge-base/matrix-analysis/matrix-perturbation.en.md +49 -0
  80. package/knowledge-base/matrix-analysis/matrix-perturbation.md +49 -0
  81. package/knowledge-base/matrix-analysis/positive-semidefinite.en.md +50 -0
  82. package/knowledge-base/matrix-analysis/positive-semidefinite.md +50 -0
  83. package/knowledge-base/matrix-analysis/projection.en.md +47 -0
  84. package/knowledge-base/matrix-analysis/projection.md +47 -0
  85. package/knowledge-base/matrix-analysis/spectral-decomposition.en.md +48 -0
  86. package/knowledge-base/matrix-analysis/spectral-decomposition.md +48 -0
  87. package/knowledge-base/optimization/constrained-optimization.en.md +53 -0
  88. package/knowledge-base/optimization/constrained-optimization.md +53 -0
  89. package/knowledge-base/optimization/convex-optimization.en.md +50 -0
  90. package/knowledge-base/optimization/convex-optimization.md +50 -0
  91. package/knowledge-base/optimization/lagrangian-duality.en.md +50 -0
  92. package/knowledge-base/optimization/lagrangian-duality.md +50 -0
  93. package/knowledge-base/optimization/proximal-method.en.md +52 -0
  94. package/knowledge-base/optimization/proximal-method.md +52 -0
  95. package/knowledge-base/optimization/riemannian-optimization.en.md +51 -0
  96. package/knowledge-base/optimization/riemannian-optimization.md +51 -0
  97. package/knowledge-base/overview.en.md +29 -218
  98. package/knowledge-base/overview.md +29 -220
  99. package/knowledge-base/probability/concentration-inequality.en.md +45 -0
  100. package/knowledge-base/probability/concentration-inequality.md +45 -0
  101. package/knowledge-base/probability/entropy.en.md +47 -0
  102. package/knowledge-base/probability/entropy.md +47 -0
  103. package/knowledge-base/probability/fisher-information.en.md +48 -0
  104. package/knowledge-base/probability/fisher-information.md +48 -0
  105. package/knowledge-base/probability/information-bottleneck.en.md +49 -0
  106. package/knowledge-base/probability/information-bottleneck.md +49 -0
  107. package/knowledge-base/probability/kl-divergence.en.md +51 -0
  108. package/knowledge-base/probability/kl-divergence.md +51 -0
  109. package/knowledge-base/topology/euler-characteristic.en.md +54 -0
  110. package/knowledge-base/topology/euler-characteristic.md +54 -0
  111. package/knowledge-base/topology/fundamental-group.en.md +52 -0
  112. package/knowledge-base/topology/fundamental-group.md +52 -0
  113. package/knowledge-base/topology/persistent-homology.en.md +54 -0
  114. package/knowledge-base/topology/persistent-homology.md +54 -0
  115. package/lenses/algorithmic.en.md +49 -0
  116. package/lenses/algorithmic.md +49 -0
  117. package/lenses/axiomatization.en.md +48 -0
  118. package/lenses/axiomatization.md +48 -0
  119. package/lenses/categorical.en.md +48 -0
  120. package/lenses/categorical.md +48 -0
  121. package/lenses/causal.en.md +49 -0
  122. package/lenses/causal.md +49 -0
  123. package/lenses/duality.en.md +47 -0
  124. package/lenses/duality.md +47 -0
  125. package/lenses/game.en.md +50 -0
  126. package/lenses/game.md +50 -0
  127. package/lenses/geometric.en.md +53 -0
  128. package/lenses/geometric.md +53 -0
  129. package/lenses/local-to-global.en.md +52 -0
  130. package/lenses/local-to-global.md +52 -0
  131. package/lenses/perturbation.en.md +51 -0
  132. package/lenses/perturbation.md +51 -0
  133. package/lenses/probabilistic.en.md +48 -0
  134. package/lenses/probabilistic.md +48 -0
  135. package/lenses/projection.en.md +50 -0
  136. package/lenses/projection.md +50 -0
  137. package/lenses/spectral.en.md +52 -0
  138. package/lenses/spectral.md +52 -0
  139. package/lenses/symmetry.en.md +49 -0
  140. package/lenses/symmetry.md +49 -0
  141. package/lenses/topological.en.md +48 -0
  142. package/lenses/topological.md +48 -0
  143. package/lenses/variational.en.md +48 -0
  144. package/lenses/variational.md +48 -0
  145. package/package.json +9 -3
  146. package/references/agentic-workflow.en.md +1 -1
  147. package/references/agentic-workflow.md +1 -1
  148. package/references/books/abstract-algebra.en.md +124 -0
  149. package/references/books/abstract-algebra.md +22 -22
  150. package/references/books/algebraic-geometry-rising-sea.en.md +171 -0
  151. package/references/books/algebraic-geometry-rising-sea.md +11 -11
  152. package/references/books/differential-geometry.en.md +140 -0
  153. package/references/books/differential-geometry.md +19 -19
  154. package/references/books/matrix-analysis.en.md +146 -0
  155. package/references/books/matrix-analysis.md +10 -10
  156. package/references/books/micro-lie-theory.en.md +116 -0
  157. package/references/books/micro-lie-theory.md +17 -17
  158. package/references/books/optimization-ml.en.md +163 -0
  159. package/references/books/optimization-ml.md +7 -8
  160. package/references/books/smooth-manifolds.en.md +105 -0
  161. package/references/books/smooth-manifolds.md +14 -14
  162. package/references/gpu-friendly-math.en.md +23 -10
  163. package/references/gpu-friendly-math.md +17 -4
  164. package/references/inspiration.en.md +1 -1
  165. package/references/inspiration.md +2 -2
  166. package/skills/math-research-activator/SKILL.en.md +195 -114
  167. package/skills/math-research-activator/SKILL.md +194 -119
  168. package/skills/math-research-activator/original-texts.en.md +9 -9
  169. package/skills/math-research-activator/original-texts.md +11 -11
  170. package/commands/abstraction.md +0 -11
  171. package/commands/algorithmic-thinking.md +0 -11
  172. package/commands/axiomatization.md +0 -11
  173. package/commands/causal-inference.md +0 -11
  174. package/commands/discrete-combinatorial.md +0 -11
  175. package/commands/game-theory.md +0 -11
  176. package/commands/induction-analogy.md +0 -11
  177. package/commands/information-theory.md +0 -11
  178. package/commands/logic-deduction.md +0 -11
  179. package/commands/modeling.md +0 -11
  180. package/commands/optimization.md +0 -11
  181. package/commands/probability-statistics.md +0 -11
  182. package/commands/symmetry-invariance.md +0 -11
  183. package/commands/topological-thinking.md +0 -11
  184. package/commands/transformation.md +0 -11
  185. package/skills/abstraction/SKILL.en.md +0 -117
  186. package/skills/abstraction/SKILL.md +0 -121
  187. package/skills/abstraction/original-texts.en.md +0 -163
  188. package/skills/abstraction/original-texts.md +0 -175
  189. package/skills/algorithmic-thinking/SKILL.en.md +0 -132
  190. package/skills/algorithmic-thinking/SKILL.md +0 -138
  191. package/skills/algorithmic-thinking/original-texts.en.md +0 -253
  192. package/skills/algorithmic-thinking/original-texts.md +0 -256
  193. package/skills/axiomatization/SKILL.en.md +0 -144
  194. package/skills/axiomatization/SKILL.md +0 -151
  195. package/skills/axiomatization/original-texts.en.md +0 -154
  196. package/skills/axiomatization/original-texts.md +0 -160
  197. package/skills/causal-inference/SKILL.en.md +0 -147
  198. package/skills/causal-inference/SKILL.md +0 -151
  199. package/skills/causal-inference/original-texts.en.md +0 -136
  200. package/skills/causal-inference/original-texts.md +0 -167
  201. package/skills/discrete-combinatorial/SKILL.en.md +0 -124
  202. package/skills/discrete-combinatorial/SKILL.md +0 -131
  203. package/skills/discrete-combinatorial/original-texts.en.md +0 -184
  204. package/skills/discrete-combinatorial/original-texts.md +0 -185
  205. package/skills/game-theory/SKILL.en.md +0 -117
  206. package/skills/game-theory/SKILL.md +0 -123
  207. package/skills/game-theory/original-texts.en.md +0 -131
  208. package/skills/game-theory/original-texts.md +0 -131
  209. package/skills/induction-analogy/SKILL.en.md +0 -145
  210. package/skills/induction-analogy/SKILL.md +0 -152
  211. package/skills/induction-analogy/original-texts.en.md +0 -140
  212. package/skills/induction-analogy/original-texts.md +0 -154
  213. package/skills/information-theory/SKILL.en.md +0 -134
  214. package/skills/information-theory/SKILL.md +0 -140
  215. package/skills/information-theory/original-texts.en.md +0 -127
  216. package/skills/information-theory/original-texts.md +0 -127
  217. package/skills/logic-deduction/SKILL.en.md +0 -130
  218. package/skills/logic-deduction/SKILL.md +0 -135
  219. package/skills/logic-deduction/original-texts.en.md +0 -160
  220. package/skills/logic-deduction/original-texts.md +0 -173
  221. package/skills/modeling/SKILL.en.md +0 -135
  222. package/skills/modeling/SKILL.md +0 -139
  223. package/skills/modeling/original-texts.en.md +0 -162
  224. package/skills/modeling/original-texts.md +0 -165
  225. package/skills/optimization/SKILL.en.md +0 -129
  226. package/skills/optimization/SKILL.md +0 -135
  227. package/skills/optimization/original-texts.en.md +0 -167
  228. package/skills/optimization/original-texts.md +0 -168
  229. package/skills/probability-statistics/SKILL.en.md +0 -146
  230. package/skills/probability-statistics/SKILL.md +0 -151
  231. package/skills/probability-statistics/original-texts.en.md +0 -191
  232. package/skills/probability-statistics/original-texts.md +0 -193
  233. package/skills/symmetry-invariance/SKILL.en.md +0 -135
  234. package/skills/symmetry-invariance/SKILL.md +0 -139
  235. package/skills/symmetry-invariance/original-texts.en.md +0 -206
  236. package/skills/symmetry-invariance/original-texts.md +0 -221
  237. package/skills/topological-thinking/SKILL.en.md +0 -124
  238. package/skills/topological-thinking/SKILL.md +0 -128
  239. package/skills/topological-thinking/original-texts.en.md +0 -134
  240. package/skills/topological-thinking/original-texts.md +0 -164
  241. package/skills/transformation/SKILL.en.md +0 -120
  242. package/skills/transformation/SKILL.md +0 -124
  243. package/skills/transformation/original-texts.en.md +0 -204
  244. package/skills/transformation/original-texts.md +0 -216
@@ -0,0 +1,171 @@
1
+ # Algebraic Geometry (The Rising Sea)
2
+
3
+ > *The Rising Sea: Foundations of Algebraic Geometry*, Ravi Vakil, Princeton University Press, 2025 edition (ISBN 978-0-691-26866-8).
4
+ > The title is taken from Grothendieck's "rising tide" (la mer monte) metaphor: rather than attacking nut-like problems head-on, let the waters of abstraction (categories, sheaves, cohomology) slowly rise, silently submerging and dissolving the problems.
5
+ > This file distills this "rising-tide abstraction" into activatable algorithmic structures for AI/GPU -- taking only the most transferable skeleton, not restating the original proofs.
6
+
7
+ ## Overview
8
+
9
+ This book builds modern Grothendieck-school algebraic geometry from scratch across roughly 30 chapters: the core is to **translate geometric objects into commutative algebra**, then use **sheaves + cohomology** to measure "whether local data can be glued into global data."
10
+
11
+ For AI, what is truly transferable is not elliptic curves or divisors, but three pieces of abstract machinery:
12
+
13
+ - **Sheaves = local data + consistent gluing** -- the ontology of geometry-aware aggregation on graphs.
14
+ - **Cohomology = obstruction measure for global consistency** -- an algebraic criterion for hallucination/inconsistency.
15
+ - **Categories = unified interface for different constructions** -- gathering heterogeneous operators into a single set of adjoint relationships.
16
+
17
+ In one sentence: **sheaves govern "how to assemble local into global," cohomology governs "what goes wrong when assembly fails," and categories govern "saying all of this in one unified language."**
18
+
19
+ ### Actual Chapter Map
20
+
21
+ By the book's chapter numbers (`*`/`**` denote advanced sections):
22
+
23
+ - **Part I Preliminaries**
24
+ - **Sec. 1 Just Enough Category Theory to Be Dangerous**: Sec. 1.1 categories and functors, Sec. 1.2 universal properties, Sec. 1.3 limits and colimits, Sec. 1.4 adjoints, Sec. 1.5 abelian categories, Sec. 1.6* spectral sequences.
25
+ - **Sec. 2 Sheaves**: Sec. 2.1 motivation (sheaf of smooth functions), Sec. 2.2 sheaf and presheaf definitions, Sec. 2.3 morphisms, Sec. 2.4 stalks & sheafification, Sec. 2.5 sheaf on a base, Sec. 2.6 OX-modules form an abelian category, Sec. 2.7 inverse image sheaf.
26
+ - **Part II Schemes**: Sec. 3 sets and topological spaces of affine schemes (Zariski topology, generic point), Sec. 4 structure sheaf and scheme definition, Sec. 5 properties of schemes, Sec. 6 quasicoherent sheaves.
27
+ - **Part III Morphisms of Schemes**: Sec. 7 morphisms of schemes (Sec. 7.7 Grassmannian first construction), Sec. 8 various finiteness morphisms (Sec. 8.4 Chevalley's theorem and elimination theory), Sec. 9 closed embeddings, Sec. 10 fiber products and base change (Sec. 10.6 Segre embedding), Sec. 11 separated and proper morphisms, varieties.
28
+ - **Part IV "Geometric" Properties of Schemes**: Sec. 12 dimension, Sec. 13 regularity and smoothness (Sec. 13.1 Zariski tangent space).
29
+ - **Part V Quasicoherent Sheaves on Schemes and Applications**: Sec. 14 vector bundles "=" locally free sheaves, Sec. 15 line bundles, maps to projective space, and divisors (Sec. 15.4 line bundles and Weil divisors), Sec. 16 line bundle properties (Sec. 16.2 ample/very ample, Sec. 16.4 Grassmannian as moduli space), Sec. 17 projective morphisms and relative Spec/Proj.
30
+ - **Sec. 18 Cech Cohomology of Quasicoherent Sheaves**: Sec. 18.1 desired properties, Sec. 18.2 definition and proofs, Sec. 18.3 cohomology of line bundles on projective space, Sec. 18.4 Riemann-Roch and arithmetic genus, Sec. 18.5 Serre duality first glimpse.
31
+ - Sec. 19 applications: curves, Sec. 20* intersection theory glimpse, Sec. 21 differentials, Sec. 22 Riemann-Hurwitz formula.
32
+ - **Part VI More Cohomological Tools**: **Sec. 23 Derived functors (Sec. 23.5 Cech cohomology agrees with derived-functor cohomology)**, Sec. 24 flatness, Sec. 25 cohomology and base change.
33
+
34
+ > Note: **Tropical geometry** is the "skeletonization" of algebraic geometry over the tropical/min-plus semiring, the tropicalization of the projective varieties in Sec. 15-17; the book does not have a dedicated chapter for it. The "tropical gating" below draws on this as a mathematical source, and references are **not tied to specific chapter numbers** (to avoid fabrication).
35
+
36
+ ## Core Structures Transferable to AI/Infra
37
+
38
+ First the overview mapping, then detailed expansion:
39
+
40
+ | Mathematical concept (book section) | AI/ML correspondence | Engineering implementation |
41
+ |---|---|---|
42
+ | Sheaf (Sec. 2) | Geometry-aware information aggregation on graphs | Node = section, edge = transformation in message passing |
43
+ | Restriction map (Sec. 2.3, 14) | Directional feature transformation on edges | One low-rank linear map per edge = small GEMM |
44
+ | Sheaf Laplacian (Sec. 2, 14) | Geometric attention/diffusion operator | Propagation on L = delta^T delta |
45
+ | Cohomology H^0/H^1 (Sec. 18, 23) | Global consistency / hallucination criterion | Cech H^1 regularizer |
46
+ | Category + adjoint (Sec. 1.3-1.4) | Unified operator interface | pullback = alignment, pushforward = aggregation |
47
+ | Grassmannian + Plucker (Sec. 7.7, 16.4) | Subspace compression encoding | Plucker coordinate block summaries to compress KV-Cache |
48
+ | Flatness (Sec. 24) | Smooth distribution transition criterion | Fiber without jumps -> no rank collapse signal |
49
+
50
+ **1. Sheaf -> geometry-aware information aggregation on graphs** (Sec. 2)
51
+
52
+ - **Ontology**: a sheaf systematically assigns "to each open set/node a data space (stalk/section) + restriction maps along inclusion relations + a gluing axiom (local consistency implies global gluing)."
53
+ - **Mapping**: node features = sections, edges = restriction maps, message passing = enforcing consistency of adjacent sections under restrictions.
54
+ - **Implementation**: this is precisely the ontology of **cellular sheaf diffusion / sheaf neural networks**; standard GNNs are the "trivial sheaf" special case -- the sheaf structure injects directional geometric inductive bias into every edge.
55
+
56
+ **2. Restriction map -> one low-rank linear transformation per edge** (Sec. 2.3, 14)
57
+
58
+ - **Ontology**: each edge carries a learned linear map F(U) -> F(V).
59
+ - **Operator**: this defines the **sheaf Laplacian** L = delta^T delta (where delta is the coboundary operator); diffusion/attention is propagation on L; when all restriction maps are identity, this reduces to the standard graph Laplacian.
60
+ - **Implementation**: each edge map is low-rank -> a sequence of **small GEMMs**, naturally landing on Tensor Cores; the rank is a tunable expressivity knob.
61
+
62
+ **3. Cohomology -> global consistency / hallucination criterion** (Sec. 18, 23)
63
+
64
+ - **H^0** = global sections: all locally consistent data that can truly be glued into a global solution.
65
+ - **H^1** = **gluing obstruction**: pairwise locally consistent yet unable to assemble globally -- i.e., "self-consistent contradictions." Formally H^1 = ker delta^1 / im delta^0.
66
+ - **Criterion**: gives hallucination an **algebraic criterion** -- H^1 != 0 <=> the model is locally confident but globally conflicting.
67
+ - **Computability boundary**: **Cech cohomology (Sec. 18.2)** is computed directly from the overlaps of a cover, locally and cheaply; Sec. 23.5 proves that under good conditions it agrees with the expensive derived-functor cohomology -- this boundary line determines "which cohomology can run on a GPU."
68
+
69
+ **4. Category + universal properties + adjoints -> unified abstract interface** (Sec. 1)
70
+
71
+ - **Ontology**: pullback / pushforward (f^*, f_*) are an adjoint pair (Sec. 1.4); products, coproducts, fiber products are unified as (co)limits (Sec. 1.3).
72
+ - **Implementation**: using one abstract interface to unify different operators -- **pullback = feature alignment/resampling, pushforward = aggregation/pooling** -- with the adjoint relationship automatically guaranteeing compatibility, reducing hyperparameters and alignment bugs.
73
+
74
+ **5. Proj / projective + Plucker coordinates -> subspace compression encoding** (Sec. 7.7, 16.4, 15)
75
+
76
+ - **Ontology**: the Grassmannian parameterizes "k-dimensional subspaces," embedded into projective space via the **Plucker embedding (explicitly appearing in this book)** using exterior product coordinates (Plucker coordinates).
77
+ - **Implementation**: the subspace spanned by a set of KV vectors can be summarized by a small number of Plucker/exterior-product coordinates as **block summaries**, thereby compressing the KV-Cache -- storing "the subspace" rather than individual vectors.
78
+
79
+ **6. Flatness -> geometric criterion for smooth distribution transitions** (Sec. 24)
80
+
81
+ - **Ontology**: fibers of a flat morphism vary continuously without jumps over the base.
82
+ - **Implementation**: can serve as a geometric correctness signal for "smooth distribution transfer, no rank collapse" during training/fine-tuning (somewhat theoretical; implementation requires careful validation).
83
+
84
+ ## Problem Types Suited for Activation
85
+
86
+ - **Attention and message passing on graph/set structures**: nodes carry heterogeneous feature spaces, edges carry directional transformations -> sheaf diffusion is more expressive than plain GNNs.
87
+ - **Multi-source/multi-view consistency**: multimodal, multi-agent, retrieval-augmented (RAG) local evidence to be glued into global answers -> H^0/H^1 measures consistency.
88
+ - **Hallucination / self-consistency detection and regularization**: need a differentiable penalty for "locally self-consistent but globally contradictory" -> Cech H^1 regularizer.
89
+ - **Memory compression for long-context inference**: KV subspace redundancy is high -> Plucker-style block summaries.
90
+ - **Sparse routing / gating (MoE, Top-K)**: need differentiable approximation of discrete choices -> tropical semiring piecewise-linear gating.
91
+ - **Need a framework unifying heterogeneous operators**: using the pullback/pushforward adjoint pair to unify alignment and aggregation.
92
+
93
+ ## Possible Algorithmic Inspirations
94
+
95
+ **Tropical Sheaf Attention Trilogy** (consistent with the candidate validation examples in `../gpu-friendly-math.md`):
96
+
97
+ 1. **Tropical Gating**
98
+ - Replace hard Top-K routing with **piecewise-linear** scoring on the max-plus semiring.
99
+ - Sub-differentiable (kink points need LogSumExp softening; after softening it reverts to standard softmax), tensorizable but **not Tensor Core GEMM** (max/min falls on CUDA cores) -- replacing non-differentiable discrete choices.
100
+ 2. **Cellular Sheaf Diffusion**
101
+ - Attention = diffusion on a learnable sheaf Laplacian.
102
+ - One **low-rank restriction map per edge (= small GEMM)**, injecting edge-direction geometric inductive bias into attention.
103
+ 3. **Cech Cohomology Regularizer**
104
+ - Compute first-order Cech H^1 on a **fixed finite cover** of attention maps.
105
+ - Serves as a hallucination/inconsistency penalty term; local and cheap. Differentiability requires a proxy (e.g., H^1-component projection norm ||(I - P_{im delta^0}) c||^2, differentiable via SVD/pseudoinverse, non-smooth at rank jumps), not exact Betti numbers.
106
+
107
+ **Other point inspirations:**
108
+
109
+ - **Low-rank basis KV compression (Grassmannian/Plucker perspective)**: represent each block's KV subspace by its **low-rank basis** (low-rank decomposition, kn or k(n-k) parameters) to compress memory. Note: Plucker coordinates themselves, at low rank, number C(n,k) and actually **expand** rather than compress, so the true compression comes from the low-rank basis rather than Plucker coordinates -- "Plucker" is a borrowed name. Compression ratio depends on the block's original redundancy and must be measured empirically.
110
+ - **Tropical-semiring MoE routing**: routing logits are piecewise-linear on max-plus, yielding **structured sparse** and differentiable expert selection.
111
+ - **Adjoint Pull/Push operator pair**: implementing up/downsampling and alignment/aggregation as an adjoint pair, enforcing compatibility and reducing hyperparameters.
112
+
113
+ ## GPU Friendliness Warning
114
+
115
+ > **Required reading and sole authority**: `../gpu-friendly-math.md`
116
+ > Eight-dimension scorecard: D1 Tensorization, D2 GEMM-mappability, D3 Complexity, D4 Memory/KV, D5 Low-precision stability, D6 Parallelism & communication, D7 Sparse structure, D8 Operator fusion.
117
+ > **Mathematical beauty != computable**; any dimension that is "unfriendly and not reformable" means elimination.
118
+
119
+ **Can land as GEMM / sub-quadratic (friendly [v]):**
120
+
121
+ | Construction | Dimensions hit | Notes |
122
+ |---|---|---|
123
+ | Low-rank restriction maps | D1, D2, D4 | Batched small GEMM, saturates Tensor Cores, low-rank saves memory |
124
+ | Tropical gating | D1, D3 (not D2) | Tensorizable, per-token gating is sub-quadratic; **not GEMM** (does not land on Tensor Cores); sub-differentiable, max kink points need LogSumExp softening |
125
+ | Cech H^1 regularizer (fixed cover) | D3, D8 | Locally cheap, fusible with attention kernel (FlashAttention-style) |
126
+ | Low-rank basis block summaries (Plucker perspective) | D4 | Low-rank decomposition compresses KV, large inference memory reduction (compression ratio needs empirical measurement) |
127
+
128
+ **Beautiful but not computable (unfriendly [x], prohibited from training forward pass):**
129
+
130
+ - **Derived functor cohomology for general sheaf cohomology (Sec. 23)**
131
+ - Requires injective resolutions + spectral sequences, belonging to **symbolic algebra**.
132
+ - No tensorization, no GEMM, not sub-quadratic, not differentiable -> violates D1, D2, D3, D5, D8.
133
+ - Can only be done offline, small-scale, for analysis; **use only the Cech version that agrees with it (Sec. 23.5) and restrict to fixed covers**.
134
+ - **Topological layers of Spec/Proj (Zariski topology, generic point, Sec. 3-4)**: discrete non-numerical structures, not differentiable -> violates D1. Serve only as conceptual scaffolding.
135
+ - **Ideal elimination / Groebner bases (Chevalley's theorem and elimination theory, Sec. 8.4)**: combinatorial explosion, serial, unstructured -> violates D3, D6, D7.
136
+ - **Dynamic / unstructured Cech covers**: if the cover changes with input or overlaps are irregular, H^1 computation degenerates into random gather/scatter -> violates D7. **Must use fixed finite covers + structured (block/banded) overlaps.**
137
+
138
+ ## Which Design Lens to Invoke
139
+
140
+ - **topological (primary)**: cohomology, H^1 obstructions, invariants under continuous deformation -- precisely the motivating theme of sheaf/cohomology activation.
141
+ - **categorical**: extracting the essence of message passing via "sheaf = local data + gluing," abstracting engineering operators as restriction maps.
142
+ - **duality**: tropicalization, Plucker embedding, pullback/pushforward -- using equivalence transformations to move hard-to-compute problems into computable coordinate systems.
143
+ - **symmetry**: projective invariance, gauge symmetry, sheaf covariance, constraining the model's equivariant structure.
144
+ - **axiomatization**: treating the sheaf axioms (locality + gluing) and the cohomology long exact sequence as correctness constraints, auditing "whether the required consistency is violated."
145
+
146
+ ## Anti-patterns
147
+
148
+ - **Putting abstract/derived-functor cohomology directly into the training forward pass**: symbolic computation, gradient-free, not computable -- the classic "beautiful but not computable," violating the GPU eight dimensions. Use Cech + fixed covers with differentiable proxies.
149
+ - **Introducing the full Scheme/Proj machinery to "look advanced"** when the task only needs a graph Laplacian: over-engineering, violating "Simplicity First." Ask first: "does a trivial sheaf (= standard GNN) suffice?"
150
+ - **Treating Zariski topology / generic points and other discrete structures as differentiable objects** to optimize: type error.
151
+ - **Making Cech covers dynamic with unstructured overlaps**: degenerates into random memory access, destroying GPU parallelism (D7).
152
+ - **Using the max-plus semiring as an exact semiring** without relaxing at non-differentiable points: gradient breaks, training stalls.
153
+ - **Blindly trusting H^1=0 to mean "no hallucination"**: it only guarantees local gluing consistency under the chosen cover, not factual correctness; it is a structural consistency signal, not a truth criterion.
154
+
155
+ ## Deep Dive Entry
156
+
157
+ > **Bibliographic info**: Ravi Vakil, *The Rising Sea: Foundations of Algebraic Geometry*, Princeton University Press, 2025. ISBN 978-0-691-26866-8.
158
+ >
159
+ > **Activation method**: Place `The Rising Sea Foundations of Algebraic Geometry.pdf` in the `math_book/` folder at the project root; the Agent can then automatically search the original text. The PDF is not distributed via npm/git (copyright reasons); obtain it independently.
160
+
161
+ **Full-fidelity lookup**: when the summary is insufficient to support design, have the Agent automatically retrieve the local PDF
162
+ `math_book/The Rising Sea Foundations of Algebraic Geometry.pdf`
163
+ (using `pdftotext -f <start> -l <end>` for targeted pages, **do not dump the entire book**).
164
+
165
+ Actual chapter numbers worth deep reading:
166
+
167
+ 1. **Sec. 2 Sheaves** (focus on Sec. 2.2 definitions, Sec. 2.4 stalks and sheafification, Sec. 2.5 sheaf on a base, Sec. 2.7 inverse image sheaf) -- the mathematical foundation for cellular sheaf diffusion and restriction maps.
168
+ 2. **Sec. 18 Cech Cohomology of Quasicoherent Sheaves** (Sec. 18.1 desired properties, Sec. 18.2 definition and proofs, Sec. 18.4 Riemann-Roch, Sec. 18.5 Serre duality first glimpse) -- the source and computability boundary for H^1 hallucination regularization.
169
+ 3. **Sec. 23 Derived Functors** (Sec. 23.5 Cech cohomology agrees with derived-functor cohomology) -- drawing the red line between "computable Cech vs. non-computable derived functors."
170
+ 4. **Sec. 7.7 + Sec. 16.4 Grassmannian** (together with Sec. 15 line bundles and divisors; Plucker embedding appears within this framework) -- the geometric basis for Plucker KV compression.
171
+ 5. **Sec. 1 Category Theory** (Sec. 1.3 limits/colimits, Sec. 1.4 adjoints) -- the pullback/pushforward adjoint pair and unified operator interfaces.
@@ -1,4 +1,4 @@
1
- # 🌊 代数几何(The Rising Sea)/ Algebraic Geometry
1
+ # 代数几何(The Rising Sea)/ Algebraic Geometry
2
2
 
3
3
  > 《The Rising Sea: Foundations of Algebraic Geometry》,Ravi Vakil 著,Princeton University Press,2025 年版(ISBN 978-0-691-26866-8)。
4
4
  > 书名取自 Grothendieck 的"涨潮(la mer monte)"比喻:不正面强攻坚果般的难题,而是让抽象之水(范畴、层、上同调)缓缓上涨,悄无声息地淹没并瓦解问题。
@@ -113,10 +113,10 @@
113
113
  ## GPU 友好性警告
114
114
 
115
115
  > **必读且唯一权威**:`../gpu-friendly-math.md`
116
- > 八维记分卡:①张量化 ②GEMM 可映射 ③复杂度 ④显存/KV ⑤低精度稳定 ⑥并行通信 ⑦稀疏结构 ⑧算子融合。
116
+ > 八维记分卡:①张量化 ②GEMM 可映射 ③复杂度 ④显存/KV ⑤低精度稳定 ⑥并行与通信 ⑦稀疏结构 ⑧算子融合。
117
117
  > **数学美 ≠ 可算**;任一维"不友好且不可改造"即淘汰。
118
118
 
119
- **可落 GEMM / 亚二次(友好 ✅):**
119
+ **可落 GEMM / 亚二次(友好 [v]):**
120
120
 
121
121
  | 构造 | 命中维度 | 说明 |
122
122
  |---|---|---|
@@ -125,7 +125,7 @@
125
125
  | Čech H¹ 正则(固定覆盖) | ③⑧ | 局部廉价,可与注意力 kernel 融合(FlashAttention 式)|
126
126
  | 低秩基底块摘要(Plücker 视角) | ④ | 低秩分解压缩 KV,推理显存大降(压缩率需实测) |
127
127
 
128
- **美但不可算(不友好 ❌,禁止塞进训练 forward):**
128
+ **美但不可算(不友好 [x],禁止塞进训练 forward):**
129
129
 
130
130
  - **一般层上同调的导出函子计算(derived functor cohomology,§23)**
131
131
  - 需内射分解(injective resolution)+ 谱序列(spectral sequence),属**符号代数**。
@@ -135,13 +135,13 @@
135
135
  - **理想消元 / Gröbner 基(Chevalley 定理与消元理论,§8.4)**:组合爆炸、串行、非结构化 → 违反维度③⑥⑦。
136
136
  - **动态 / 非结构化的 Čech 覆盖**:若覆盖随输入变化或交叠不规则,H¹ 计算退化为随机 gather/scatter → 违反维度⑦。**必须固定有限覆盖 + 结构化(块/带状)交叠。**
137
137
 
138
- ## 该调用哪个思想武器
138
+ ## 该调用哪个思想透镜
139
139
 
140
- - **topological-thinking(🌀 拓扑思想)** — 主力:上同调、H¹ 障碍、连续变形下的不变量,正是层/上同调激活的母题。
141
- - **abstraction(🧩 抽象化)**:用"层 = 局部数据 + 黏合"提取消息传递的本质,把工程算子抽象为限制映射。
142
- - **transformation(🔄 变换思想)**:tropicalization、Plücker 嵌入、pullback/pushforward —— 用等价转换把难算问题搬到可算坐标系。
143
- - **symmetry-invariance(⚛️ 对称与不变性)**:射影不变、规范(gauge)对称、层的协变性,约束模型的等变结构。
144
- - **axiomatization(📐 公理化)**:把层公理(局部性 + 黏合)、上同调长正合列当作正确性约束,审查"该有的一致性是否被违反"。
140
+ - **topological(拓扑透镜)** — 主力:上同调、H¹ 障碍、连续变形下的不变量,正是层/上同调激活的母题。
141
+ - **categorical(范畴化透镜)**:用"层 = 局部数据 + 黏合"提取消息传递的本质,把工程算子抽象为限制映射。
142
+ - **duality(对偶透镜)**:tropicalization、Plücker 嵌入、pullback/pushforward —— 用等价转换把难算问题搬到可算坐标系。
143
+ - **symmetry(对称与不变性)**:射影不变、规范(gauge)对称、层的协变性,约束模型的等变结构。
144
+ - **axiomatization(公理化)**:把层公理(局部性 + 黏合)、上同调长正合列当作正确性约束,审查"该有的一致性是否被违反"。
145
145
 
146
146
  ## 反模式
147
147
 
@@ -154,7 +154,7 @@
154
154
 
155
155
  ## 深挖入口
156
156
 
157
- > **📖 书目信息**:Ravi Vakil, *The Rising Sea: Foundations of Algebraic Geometry*, Princeton University Press, 2025. ISBN 978-0-691-26866-8.
157
+ > **书目信息**:Ravi Vakil, *The Rising Sea: Foundations of Algebraic Geometry*, Princeton University Press, 2025. ISBN 978-0-691-26866-8.
158
158
  >
159
159
  > **启用方式**:将 `The Rising Sea Foundations of Algebraic Geometry.pdf` 放入项目根目录的 `math_book/` 文件夹,Agent 即可自动搜索原文。PDF 不随 npm/git 分发(版权原因),需自行获取。
160
160
 
@@ -0,0 +1,140 @@
1
+ # Manifolds & Differential Geometry
2
+
3
+ > **Manifolds and Differential Geometry** -- Jeffrey M. Lee
4
+ > American Mathematical Society, *Graduate Studies in Mathematics*, Volume 107 (2009), ISBN 978-0-8218-4815-9.
5
+ > MSC: 58A05, 53C05, 22E15, 53C20, 53B30, 55R10. This file is an "activation" summary, not a verbatim transcription; for full-fidelity lookups see the "Deep-dive Entry" at the end.
6
+
7
+ ## Overview
8
+
9
+ This book is a graduate-level textbook that builds from scratch: **smooth manifold -> tensors / differential forms -> connections and curvature -> Riemannian geometry**. Its central thread is not "computing in Euclidean space" but rather **doing calculus on curved spaces**: when there are no global coordinates and no "natural" vector addition, how does one define differentiation, compare vectors at different points, and measure distance and curvature? This is precisely the language deep learning needs once the default assumption that "parameter space is flat Euclidean" is abandoned.
10
+
11
+ A remark in the preface is critically important for AI research: **a connection on a fiber bundle and a gauge field in physics are the same concept, independently discovered by mathematicians and physicists** (preface, footnote 2). This is the archetype of the "cross-domain activation" that this skill pack repeatedly emphasizes -- the structure was already there; what was missing was someone connecting it to algorithm design (gauge-equivariant networks are the product of exactly that connection).
12
+
13
+ Actual chapter map (ordered by dependency; chapter and section numbers verified against the PDF table of contents):
14
+
15
+ | Ch | Title | Hook to AI |
16
+ |----|-------|-----------|
17
+ | 1-2 | Differentiable Manifolds / The Tangent Structure | Tangent space = local linearization, the space to which gradients belong |
18
+ | 3 | Immersion and Submersion | Submanifolds, dimensionality reduction / embedding |
19
+ | 4 | Curves and Hypersurfaces in Euclidean Space | Geometric intuition source for Gauss / mean curvature |
20
+ | 5 | Lie Groups | Continuous symmetry groups, exponential map, adjoint representation -> equivariant architectures |
21
+ | 6 | Fiber Bundles (S6.1 general bundles, S6.2 vector bundles, S6.8 principal and associated bundles) | **Geometric skeleton of gauge equivariance** |
22
+ | 7 | Tensors (S7.6 Metric Tensors) | Metric tensor g = inner-product field -> Fisher metric |
23
+ | 8 | Differential Forms (S8.5 bundle-valued forms) | Antisymmetric tensors, exterior derivative, gauge field strength |
24
+ | 9 | Integration and Stokes' Theorem (S9.8 Electromagnetism) | Maxwell = instantiation of U(1) connection curvature |
25
+ | 10 | De Rham Cohomology | Global topological invariants (integral conservation laws) |
26
+ | 11 | Distributions and Frobenius' Theorem | Integrability, constraint distributions |
27
+ | 12 | Connections and Covariant Derivatives (S12.2 connection forms, S12.4 Ehresmann, S12.5/S12.10 curvature, S12.12 G-connections) | **Parallel transport + curvature** |
28
+ | 13 | Riemannian & Semi-Riemannian Geometry (S13.1 Levi-Civita, S13.2 Riemann curvature, S13.4 geodesics, S13.7 Jacobi fields, S13.11 Rauch comparison) | **Natural gradient / optimization terrain** |
29
+
30
+ ## Core Structures Transferable to AI/Infra
31
+
32
+ Each entry follows **geometric concept -> mathematical core -> AI transfer**, making it easy to plug directly into algorithm design.
33
+
34
+ - **Riemannian metric g (S7.6 / S13.1) -> Natural gradient and information geometry.**
35
+ - Core: The metric tensor assigns an inner product <u,v>_g = u^T g v to the tangent space at each point, determining "what is close to what" and which direction counts as "steepest."
36
+ - Transfer: The natural metric on a family of probability distributions is the **Fisher information matrix (Fisher-Rao metric)**; parameter space is therefore not flat Euclidean but a curved manifold. The steepest-descent direction is not nabla L but **g^{-1} nabla L (natural gradient)**, which is invariant under reparameterization.
37
+ - **Connection / covariant derivative (S12.1-S12.4) -> Parallel transport.**
38
+ - Core: Tangent spaces at different points cannot be directly added; a connection nabla specifies "how to carry a vector along a curve to another point without introducing extra rotation." The **Levi-Civita connection** is the unique one that is metric-compatible and torsion-free.
39
+ - Transfer: Correctly transporting **momentum / historical gradients / second-order state** on the parameter manifold is the origin of vector transport in Riemannian SGD/Adam.
40
+ - **Curvature (S12.5 / S13.2 / S13.7) -> Optimization terrain (loss landscape).**
41
+ - Core: Curvature = how much a vector rotates after parallel transport around a small loop; it measures "whether the space is curved and whether paths are path-dependent," and is essentially the geometric avatar of the Hessian.
42
+ - Transfer: The curvature of the loss surface determines the condition number and sharpness; **Jacobi fields / Rauch comparison theorem (S13.7 / S13.11)** describe geodesic divergence-convergence, equivalent to stability vs. divergence of optimization trajectories.
43
+ - **Geodesics and exponential map (S13.4) -> "Straight-line steps" on a manifold.**
44
+ - Core: Geodesics are locally shortest paths; the exponential map exp_p(v) maps a tangent vector v back to the endpoint of the corresponding shortest path on the manifold.
45
+ - Transfer: When doing **constrained optimization** on SPD matrices, Stiefel / Grassmann manifolds, exp_p is the exact version of a retraction; geodesic interpolation in latent space respects the data manifold better than Euclidean straight lines.
46
+ - **Fiber bundles / principal bundles + G-connections (S6.8 / S12.12 / S9.8) -> Gauge equivariance.**
47
+ - Core: A principal G-bundle packages "the arbitrary choice of local coordinate system / frame" as a group action on fibers; a connection on the bundle = gauge field, curvature = field strength.
48
+ - Transfer: Physical quantities should not depend on the choice of local frame; this "gauge freedom" is precisely the inductive bias behind **gauge-equivariant CNNs (convolution on spheres / meshes / general manifolds)**; S9.8 uses Maxwell's equations to provide a concrete example of U(1) connection curvature.
49
+ - **Lie groups and Lie algebras (S5) -> Continuous symmetry as prior.**
50
+ - Core: The exponential map exp: g -> G and the adjoint representation Ad provide the passage "infinitesimal generator -> finite transformation."
51
+ - Transfer: Encoding the symmetry group as a hard inductive bias of the network (equivariant layers, Lie-algebra-parameterized rotations / rigid-body transformations).
52
+
53
+ ## Problem Types Suited for Activation
54
+
55
+ - Optimization is **ill-conditioned / converges slowly under Euclidean assumptions**, but the underlying parameters have a natural probabilistic or geometric structure (use a metric to redefine "distance").
56
+ - Data itself lives on **non-Euclidean manifolds**: covariance / SPD matrices, rotations SO(3), directional data, graphs and meshes, spherical signals.
57
+ - Need **rigorous symmetry / equivariance guarantees**: outputs transform predictably under rotations, translations, and local gauge transformations.
58
+ - Need to explicitly model **"arbitrariness of coordinate choice"** as a symmetry (multi-view, multi-frame, sensor-pose invariance).
59
+ - Want to use **geometric quantities (curvature / geodesic distance) for regularization or diagnostics**: sharpness, generalization, trajectory stability.
60
+
61
+ ## Possible Algorithmic Inspirations
62
+
63
+ - **Natural gradient / K-FAC**: Use the Fisher metric as preconditioner; update direction = F^{-1} nabla L rather than nabla L.
64
+ - Key engineering: K-FAC approximates the per-layer Fisher as a Kronecker product **F ~ A (x) B** (A from input activations, B from output gradients); inversion reduces to inverting two small matrices, and the preconditioner application becomes a small GEMM (see scorecard below).
65
+ - **Information-geometric optimization**: View training as moving along Fisher-Rao geodesics on the distribution manifold.
66
+ - Mirror descent, Bregman divergences, and dual coordinates of exponential families are all special cases of this Hessian-metric framework; can be used to design optimizers insensitive to parameterization.
67
+ - **Riemannian optimization**: SGD/Adam on SPD / Stiefel / Grassmann / hyperbolic manifolds.
68
+ - The toolkit of three: retraction (a cheap approximation of exp), vector transport (a discrete version of parallel transport), momentum on manifolds; commonly used in metric learning, orthogonality constraints, hierarchical structure embeddings.
69
+ - **Gauge-equivariant CNN**: Introduce local gauge frames when convolving on manifolds / meshes.
70
+ - Use G-connections to align frames at neighboring points so that features are invariant to local coordinate choices; applicable to spherical signals, meshes, lattices, and other domains without global coordinates.
71
+ - **Curvature regularization / geometric perspective on SAM**: Use Hessian-vector products to estimate curvature.
72
+ - Penalize sharp minima (flat-minima preference), or use Jacobi fields to characterize trajectory divergence, providing a geometric interpretation for sharpness-aware training.
73
+ - **Geodesic interpolation and manifold augmentation**: Interpolate and sample along geodesics in latent / embedding space; respects the data manifold better than Euclidean straight lines; applicable to data augmentation and controllable generation.
74
+
75
+ ## GPU Friendliness Warning
76
+
77
+ > Evaluate item by item using the **eight-dimension scorecard** from `../gpu-friendly-math.md`. The biggest pitfall in differential geometry is "inversion and materialization of metric / curvature matrices."
78
+
79
+ - **Dimension 2 GEMM-mappability / Dimension 3 Complexity -- Inversion is the make-or-break line.** Naive natural gradient requires inverting the N x N Fisher, where N is the parameter count (~10^9); O(N^3) inversion + O(N^2) memory means **immediate disqualification**.
80
+ - **Adaptable [v]**: **K-FAC** blocks F into a Kronecker product A (x) B, exploiting (A (x) B)^{-1} = A^{-1} (x) B^{-1}; only two small factors need inversion, and applying the preconditioner to the gradient **is a GEMM**. This is the affirmative answer to "can Kronecker factorization reduce to GEMM" -- yes, and this is the only form that can scale to a cluster.
81
+ - **Dimension 4 Memory -- Do not materialize the full Hessian / full curvature tensor.** The Riemann curvature tensor is order 4; full materialization blows up memory. Use **Hessian-vector products (HVP)** to extract curvature information in O(N) via a single backward pass, avoiding N x N.
82
+ - **Dimension 5 Low-precision -- Fisher / metric matrices are often ill-conditioned.** Inversion under bf16/fp16 catastrophically amplifies errors; **must add damping (Tikhonov, F + lambda I)** and keep inversion in fp32; otherwise it violates "low-precision stability."
83
+ - **Dimension 6 Parallelism -- Parallel transport / geodesics are serial ODEs.** Integrating the connection equation along a curve is a long serial recurrence with poor parallelism; in practice, one uses **single-step retractions / closed-form parallel transport** (analytic formulas exist for specific manifolds) instead of step-by-step integration.
84
+ - **Dimension 1 Tensorization / Dimension 2 GEMM-mappability -- Group convolution can be friendly, but continuous groups require caution.** Discrete groups (e.g., C_n, octahedral group) admit group convolutions that expand into GEMM [v]; continuous Lie groups require discretization by sampling, and improper sampling can break equivariance + produce irregular gather/scatter (Dimension 7 Sparsity unfriendly).
85
+
86
+ **Natural gradient / K-FAC eight-dimension scorecard (worked example):**
87
+
88
+ | Dimension | Naive Natural Gradient (full Fisher inversion) | K-FAC (Kronecker factorization) |
89
+ |-----------|------------------------------------------------|--------------------------------|
90
+ | Dimension 1 Tensorization | [x] explicit large-matrix inverse | [v] batched small-matrix algebra |
91
+ | Dimension 2 GEMM-mappability | [x] N x N inversion, not GEMM-able | [v] A^{-1} (x) B^{-1} application = GEMM chain |
92
+ | Dimension 3 Complexity | [x] O(N^3) | [v] two small factors, sub-cubic |
93
+ | Dimension 4 Memory | [x] materialize N x N | [v] store only two small factors |
94
+ | Dimension 5 Low-precision | [x] ill-conditioned, needs fp64 | [~] add damping + fp32 inversion, adaptable |
95
+ | Dimension 6 Parallelism | [~] single large inversion hard to parallelize | [v] per-layer factors independent, parallelizable |
96
+ | Dimension 7 Sparsity | -- | [v] block-diagonal structure |
97
+ | Dimension 8 Operator fusion | [x] | [v] preconditioner can be fused into optimizer kernel |
98
+
99
+ **Conclusion**: Riemannian / information-geometric methods **become GPU-feasible only when the metric is structurally factored (Kronecker / block-diagonal / low-rank)**; exact inversion and exact parallel transport are "beautiful but incomputable" and must be adapted or eliminated.
100
+
101
+ ## Which Thinking Lens to Invoke
102
+
103
+ - **symmetry (symmetry and invariance) -- primary.** Gauge equivariance, Lie group symmetry, fiber bundles = encoding "frame / coordinate-choice invariance" as symmetry; the strongest interface between this book and DL.
104
+ - **variational -- co-primary.** Natural gradient, Riemannian SGD, curvature regularization are all "finding optima in curved constrained spaces."
105
+ - **duality**: Exponential / logarithmic maps, retractions, coordinate transformations to simplify problems.
106
+ - **geometric**: Explicitly model parameter / data spaces as manifolds, then translate back to algorithms.
107
+ - **topological**: Auxiliary -- de Rham cohomology / global invariants for conservation laws and integrability diagnostics.
108
+
109
+ Recommended combination: First `symmetry` to establish the symmetry structure -> `variational` to arrive at natural gradient / Riemannian optimization -> `duality` to handle retractions -> pass through the `../gpu-friendly-math.md` acceptance gate.
110
+
111
+ ## Anti-patterns
112
+
113
+ Each entry gives **anti-pattern -> correct approach**:
114
+
115
+ - **Materializing and exactly inverting the full Fisher / full Hessian**: O(N^3) / O(N^2), infeasible on a cluster.
116
+ - Correct approach: First apply Kronecker / block-diagonal / low-rank factorization, then invert; without factorization, don't use natural gradient.
117
+ - **Directly inverting ill-conditioned metric matrices in fp16**: Catastrophic cancellation, results are noise.
118
+ - Correct approach: Add damping F + lambda I, keep inversion in fp32, use CG / Woodbury for implicit solves when necessary.
119
+ - **Step-by-step ODE integration for parallel transport / geodesics**: Serial recurrence kills parallelism.
120
+ - Correct approach: Use closed-form retractions / vector transport (analytic formulas exist for specific manifolds), replacing the recurrence with a single step.
121
+ - **Blindly discretizing continuous groups**: Equivariance silently breaks, and irregular gather/scatter patterns are introduced.
122
+ - Correct approach: Choose discrete subgroups that can be exactly represented, or use quadrature / frequency-domain (spherical harmonics) schemes with provable error bounds.
123
+ - **Forcing manifold structure for "geometric beauty"**: For the vast majority of tasks, Euclidean approximations suffice.
124
+ - Correct approach: Before introducing Riemannian machinery, first demonstrate experimentally that the Euclidean approach is genuinely ill-conditioned (condition number / convergence curves).
125
+ - **Treating curvature regularization as a panacea**: Curvature estimation is itself expensive and noisy.
126
+ - Correct approach: First validate the benefit at small scale using HVPs, confirm the signal-to-noise ratio, then scale up.
127
+
128
+ ## Deep-dive Entry
129
+
130
+ > **Bibliographic information**: Jeffrey M. Lee, *Manifolds and Differential Geometry*, Graduate Studies in Mathematics Vol. 107, American Mathematical Society, 2009. ISBN 978-0-8218-4815-9.
131
+ >
132
+ > **Activation method**: Place `Manifolds and Differential Geometry.pdf` in the `math_book/` folder at the project root; the Agent can then automatically search the original text. The PDF is not distributed via npm/git (copyright reasons) and must be obtained separately.
133
+
134
+ > Full-fidelity lookup = have the Agent **automatically search the local PDF** `math_book/Manifolds and Differential Geometry.pdf` (locate by chapter / section number; do not paraphrase from memory). This summary provides only coordinates, not a substitute for the original text.
135
+
136
+ - **S6.8 Principal and Associated Bundles** + **S12.12 G-Connections**: Geometric foundations of gauge equivariance (principal bundle + connection = gauge field).
137
+ - **S7.6 Metric Tensors** + **S13.1 Levi-Civita Connection**: The origin of metric tensors and natural gradient / Fisher metric.
138
+ - **S13.2 Riemann Curvature Tensor** + **S13.7 Jacobi Fields**: Curvature, optimization terrain, and trajectory stability.
139
+ - **S13.4 Geodesics** + **S13.11 Rauch's Comparison Theorem**: Geodesics / retractions and convergence-divergence comparison.
140
+ - **S9.8 Electromagnetism**: Gauge field as a concrete instance of U(1) connection curvature (a historical example of cross-domain activation).
@@ -1,4 +1,4 @@
1
- # 📐 流形与微分几何 / Manifolds & Differential Geometry
1
+ # 流形与微分几何 / Manifolds & Differential Geometry
2
2
 
3
3
  > **Manifolds and Differential Geometry** — Jeffrey M. Lee
4
4
  > American Mathematical Society, *Graduate Studies in Mathematics*, Volume 107 (2009), ISBN 978-0-8218-4815-9.
@@ -77,36 +77,36 @@
77
77
  > 用 `../gpu-friendly-math.md` 的**八维记分卡**逐项评判。微分几何最大的坑是"度量 / 曲率矩阵的求逆与物化"。
78
78
 
79
79
  - **维度 2/3(GEMM 可映射 / 复杂度)—— 求逆是生死线。** 朴素自然梯度要算 N×N Fisher 的逆,N 是参数量(~10⁹),O(N³) 求逆 + O(N²) 显存,**直接出局**。
80
- - **可改造 ✅**:**K-FAC** 把 F 分块为 Kronecker 积 A⊗B,利用 (A⊗B)⁻¹ = A⁻¹⊗B⁻¹,只需对两个小因子求逆,且预条件作用到梯度上**就是 GEMM**。这就是"能否 Kronecker 因子化为 GEMM"的肯定答案——能,且这是它唯一可上集群的形态。
80
+ - **可改造 [v]**:**K-FAC** 把 F 分块为 Kronecker 积 A⊗B,利用 (A⊗B)⁻¹ = A⁻¹⊗B⁻¹,只需对两个小因子求逆,且预条件作用到梯度上**就是 GEMM**。这就是"能否 Kronecker 因子化为 GEMM"的肯定答案——能,且这是它唯一可上集群的形态。
81
81
  - **维度 4(显存)—— 不要物化全 Hessian / 全曲率张量。** Riemann 曲率张量是 4 阶,全物化爆显存。用 **Hessian-vector product(HVP)** 经一次反向以 O(N) 拿到曲率信息,避免 N×N。
82
82
  - **维度 5(低精度)—— Fisher / 度量矩阵常病态。** bf16/fp16 下求逆灾难性放大误差,**必须加阻尼(damping / Tikhonov,F+λI)** 并把求逆留在 fp32;否则违反"低精度稳定"。
83
83
  - **维度 6(并行)—— 平行移动 / 测地线是串行 ODE。** 沿曲线积分联络方程是长串行递推,并行性差;工程上用**一步 retraction / 闭式平行移动**(特定流形有解析公式)替代逐步积分。
84
- - **维度 1/2(张量化 / GEMM)—— 群卷积可友好,但连续群要当心。** 离散群(如 C_n、八面体群)的群卷积可展开成 GEMM ✅;连续李群需采样离散化,采样不当会导致等变性破缺 + 不规则 gather/scatter(维度 7 稀疏不友好)。
84
+ - **维度 1/2(张量化 / GEMM)—— 群卷积可友好,但连续群要当心。** 离散群(如 C_n、八面体群)的群卷积可展开成 GEMM [v];连续李群需采样离散化,采样不当会导致等变性破缺 + 不规则 gather/scatter(维度 7 稀疏不友好)。
85
85
 
86
86
  **自然梯度 / K-FAC 八维记分卡(worked example):**
87
87
 
88
88
  | 维度 | 朴素自然梯度(全 Fisher 求逆)| K-FAC(Kronecker 因子化)|
89
89
  |------|------------------------------|--------------------------|
90
- | 1 张量化 | 大矩阵显式逆 | 批量小矩阵代数 |
91
- | 2 GEMM | N×N 求逆无法 GEMM | A⁻¹⊗B⁻¹ 作用 = GEMM 链 |
92
- | 3 复杂度 | O(N³) | 两个小因子,亚立方 |
93
- | 4 显存 | 物化 N×N | 只存两个小因子 |
94
- | 5 低精度 | 病态、需 fp64 | ⚠️ 加阻尼 + fp32 求逆可改造 |
95
- | 6 并行 | ⚠️ 单次大求逆难并行 | 各层因子独立、可并行 |
96
- | 7 稀疏 | — | 块对角结构化 |
97
- | 8 融合 | | 预条件可融进优化器 kernel |
90
+ | 1 张量化 | [x] 大矩阵显式逆 | [v] 批量小矩阵代数 |
91
+ | 2 GEMM | [x] N×N 求逆无法 GEMM | [v] A⁻¹⊗B⁻¹ 作用 = GEMM 链 |
92
+ | 3 复杂度 | [x] O(N³) | [v] 两个小因子,亚立方 |
93
+ | 4 显存 | [x] 物化 N×N | [v] 只存两个小因子 |
94
+ | 5 低精度 | [x] 病态、需 fp64 | [~] 加阻尼 + fp32 求逆可改造 |
95
+ | 6 并行 | [~] 单次大求逆难并行 | [v] 各层因子独立、可并行 |
96
+ | 7 稀疏 | — | [v] 块对角结构化 |
97
+ | 8 融合 | [x] | [v] 预条件可融进优化器 kernel |
98
98
 
99
99
  **结论**:黎曼 / 信息几何方法**只有在度量被结构化因子化(Kronecker / 块对角 / 低秩)后才 GPU 可行**;精确求逆与精确平行移动都属于"美但不可算",须改造或淘汰。
100
100
 
101
- ## 该调用哪个思想武器
101
+ ## 该调用哪个思想透镜
102
102
 
103
- - **symmetry-invariance(⚛️ 对称与不变性)—— 首选。** 规范等变、李群对称、纤维丛 = 把"frame / 坐标选择无关"编码成对称性,是本书与 DL 最强的接口。
104
- - **optimization(⚖️ 优化)—— 并列首选。** 自然梯度、Riemannian SGD、曲率正则都是"在弯曲约束空间里找最优"。
105
- - **transformation(🔄 变换)**:指数 / 对数映射、retraction、坐标变换简化问题。
106
- - **modeling(🌉 建模)**:把参数 / 数据空间显式建模为流形,再翻译回算法。
107
- - **topological-thinking(🌀 拓扑)**:辅助——de Rham 上同调 / 整体不变量用于守恒量与可积性诊断。
103
+ - **symmetry(对称与不变性)—— 首选。** 规范等变、李群对称、纤维丛 = 把"frame / 坐标选择无关"编码成对称性,是本书与 DL 最强的接口。
104
+ - **variational(变分)—— 并列首选。** 自然梯度、Riemannian SGD、曲率正则都是"在弯曲约束空间里找最优"。
105
+ - **duality(对偶)**:指数 / 对数映射、retraction、坐标变换简化问题。
106
+ - **geometric(几何)**:把参数 / 数据空间显式建模为流形,再翻译回算法。
107
+ - **topological(拓扑)**:辅助——de Rham 上同调 / 整体不变量用于守恒量与可积性诊断。
108
108
 
109
- 组合建议:先 `symmetry-invariance` 定对称结构 → `optimization` 落到自然梯度 / Riemannian 优化 → `transformation` 处理 retraction → 过 `../gpu-friendly-math.md` 验收门。
109
+ 组合建议:先 `symmetry` 定对称结构 → `variational` 落到自然梯度 / Riemannian 优化 → `duality` 处理 retraction → 过 `../gpu-friendly-math.md` 验收门。
110
110
 
111
111
  ## 反模式
112
112
 
@@ -127,7 +127,7 @@
127
127
 
128
128
  ## 深挖入口
129
129
 
130
- > **📖 书目信息**:Jeffrey M. Lee, *Manifolds and Differential Geometry*, Graduate Studies in Mathematics Vol. 107, American Mathematical Society, 2009. ISBN 978-0-8218-4815-9.
130
+ > **书目信息**:Jeffrey M. Lee, *Manifolds and Differential Geometry*, Graduate Studies in Mathematics Vol. 107, American Mathematical Society, 2009. ISBN 978-0-8218-4815-9.
131
131
  >
132
132
  > **启用方式**:将 `Manifolds and Differential Geometry.pdf` 放入项目根目录的 `math_book/` 文件夹,Agent 即可自动搜索原文。PDF 不随 npm/git 分发(版权原因),需自行获取。
133
133