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.
- package/README.en-US.md +159 -200
- package/README.md +159 -200
- package/agents/math-critic.en.md +2 -2
- package/agents/math-critic.md +8 -8
- package/commands/ask.md +3 -10
- package/design-patterns/attention/equivariant-attention.en.md +72 -0
- package/design-patterns/attention/equivariant-attention.md +72 -0
- package/design-patterns/attention/geometry-aware-attention.en.md +73 -0
- package/design-patterns/attention/geometry-aware-attention.md +72 -0
- package/design-patterns/attention/information-bottleneck-attention.en.md +72 -0
- package/design-patterns/attention/information-bottleneck-attention.md +72 -0
- package/design-patterns/attention/projection-attention.en.md +68 -0
- package/design-patterns/attention/projection-attention.md +68 -0
- package/design-patterns/attention/spectral-attention.en.md +71 -0
- package/design-patterns/attention/spectral-attention.md +71 -0
- package/design-patterns/compression/leverage-score-selection.en.md +71 -0
- package/design-patterns/compression/leverage-score-selection.md +71 -0
- package/design-patterns/compression/low-rank-kv-cache.en.md +60 -0
- package/design-patterns/compression/low-rank-kv-cache.md +60 -0
- package/design-patterns/compression/spectral-token-pruning.en.md +61 -0
- package/design-patterns/compression/spectral-token-pruning.md +61 -0
- package/design-patterns/compression/topology-preserving-compression.en.md +64 -0
- package/design-patterns/compression/topology-preserving-compression.md +64 -0
- package/design-patterns/loss/constraint-penalty.en.md +67 -0
- package/design-patterns/loss/constraint-penalty.md +78 -0
- package/design-patterns/loss/contrastive-loss.en.md +59 -0
- package/design-patterns/loss/contrastive-loss.md +68 -0
- package/design-patterns/loss/information-bottleneck-loss.en.md +69 -0
- package/design-patterns/loss/information-bottleneck-loss.md +74 -0
- package/design-patterns/loss/orthogonality-loss.en.md +56 -0
- package/design-patterns/loss/orthogonality-loss.md +60 -0
- package/design-patterns/loss/variational-loss.en.md +61 -0
- package/design-patterns/loss/variational-loss.md +71 -0
- package/design-patterns/representation/equivariant-split.en.md +87 -0
- package/design-patterns/representation/equivariant-split.md +89 -0
- package/design-patterns/representation/manifold-representation.en.md +85 -0
- package/design-patterns/representation/manifold-representation.md +87 -0
- package/design-patterns/representation/shared-private-decomposition.en.md +84 -0
- package/design-patterns/representation/shared-private-decomposition.md +86 -0
- package/design-patterns/representation/subspace-alignment.en.md +90 -0
- package/design-patterns/representation/subspace-alignment.md +92 -0
- package/design-patterns/routing/graph-routing.en.md +79 -0
- package/design-patterns/routing/graph-routing.md +81 -0
- package/design-patterns/routing/moe-routing.en.md +85 -0
- package/design-patterns/routing/moe-routing.md +87 -0
- package/design-patterns/routing/optimal-transport-routing.en.md +68 -0
- package/design-patterns/routing/optimal-transport-routing.md +72 -0
- package/design-patterns/routing/spectral-clustering-routing.en.md +88 -0
- package/design-patterns/routing/spectral-clustering-routing.md +90 -0
- package/knowledge-base/differential-geometry/connection.en.md +51 -0
- package/knowledge-base/differential-geometry/connection.md +51 -0
- package/knowledge-base/differential-geometry/curvature.en.md +49 -0
- package/knowledge-base/differential-geometry/curvature.md +49 -0
- package/knowledge-base/differential-geometry/geodesic.en.md +51 -0
- package/knowledge-base/differential-geometry/geodesic.md +51 -0
- package/knowledge-base/differential-geometry/manifold.en.md +47 -0
- package/knowledge-base/differential-geometry/manifold.md +47 -0
- package/knowledge-base/differential-geometry/metric-tensor.en.md +50 -0
- package/knowledge-base/differential-geometry/metric-tensor.md +50 -0
- package/knowledge-base/differential-geometry/tangent-space.en.md +48 -0
- package/knowledge-base/differential-geometry/tangent-space.md +48 -0
- package/knowledge-base/information-geometry/fisher-metric.en.md +56 -0
- package/knowledge-base/information-geometry/fisher-metric.md +56 -0
- package/knowledge-base/information-geometry/natural-gradient.en.md +54 -0
- package/knowledge-base/information-geometry/natural-gradient.md +54 -0
- package/knowledge-base/lie-theory/equivariance.en.md +54 -0
- package/knowledge-base/lie-theory/equivariance.md +54 -0
- package/knowledge-base/lie-theory/group-action.en.md +51 -0
- package/knowledge-base/lie-theory/group-action.md +51 -0
- package/knowledge-base/lie-theory/lie-algebra.en.md +51 -0
- package/knowledge-base/lie-theory/lie-algebra.md +51 -0
- package/knowledge-base/lie-theory/lie-group.en.md +51 -0
- package/knowledge-base/lie-theory/lie-group.md +51 -0
- package/knowledge-base/lie-theory/representation.en.md +52 -0
- package/knowledge-base/lie-theory/representation.md +52 -0
- package/knowledge-base/matrix-analysis/low-rank-approximation.en.md +49 -0
- package/knowledge-base/matrix-analysis/low-rank-approximation.md +49 -0
- package/knowledge-base/matrix-analysis/matrix-perturbation.en.md +49 -0
- package/knowledge-base/matrix-analysis/matrix-perturbation.md +49 -0
- package/knowledge-base/matrix-analysis/positive-semidefinite.en.md +50 -0
- package/knowledge-base/matrix-analysis/positive-semidefinite.md +50 -0
- package/knowledge-base/matrix-analysis/projection.en.md +47 -0
- package/knowledge-base/matrix-analysis/projection.md +47 -0
- package/knowledge-base/matrix-analysis/spectral-decomposition.en.md +48 -0
- package/knowledge-base/matrix-analysis/spectral-decomposition.md +48 -0
- package/knowledge-base/optimization/constrained-optimization.en.md +53 -0
- package/knowledge-base/optimization/constrained-optimization.md +53 -0
- package/knowledge-base/optimization/convex-optimization.en.md +50 -0
- package/knowledge-base/optimization/convex-optimization.md +50 -0
- package/knowledge-base/optimization/lagrangian-duality.en.md +50 -0
- package/knowledge-base/optimization/lagrangian-duality.md +50 -0
- package/knowledge-base/optimization/proximal-method.en.md +52 -0
- package/knowledge-base/optimization/proximal-method.md +52 -0
- package/knowledge-base/optimization/riemannian-optimization.en.md +51 -0
- package/knowledge-base/optimization/riemannian-optimization.md +51 -0
- package/knowledge-base/overview.en.md +29 -218
- package/knowledge-base/overview.md +29 -220
- package/knowledge-base/probability/concentration-inequality.en.md +45 -0
- package/knowledge-base/probability/concentration-inequality.md +45 -0
- package/knowledge-base/probability/entropy.en.md +47 -0
- package/knowledge-base/probability/entropy.md +47 -0
- package/knowledge-base/probability/fisher-information.en.md +48 -0
- package/knowledge-base/probability/fisher-information.md +48 -0
- package/knowledge-base/probability/information-bottleneck.en.md +49 -0
- package/knowledge-base/probability/information-bottleneck.md +49 -0
- package/knowledge-base/probability/kl-divergence.en.md +51 -0
- package/knowledge-base/probability/kl-divergence.md +51 -0
- package/knowledge-base/topology/euler-characteristic.en.md +54 -0
- package/knowledge-base/topology/euler-characteristic.md +54 -0
- package/knowledge-base/topology/fundamental-group.en.md +52 -0
- package/knowledge-base/topology/fundamental-group.md +52 -0
- package/knowledge-base/topology/persistent-homology.en.md +54 -0
- package/knowledge-base/topology/persistent-homology.md +54 -0
- package/lenses/algorithmic.en.md +49 -0
- package/lenses/algorithmic.md +49 -0
- package/lenses/axiomatization.en.md +48 -0
- package/lenses/axiomatization.md +48 -0
- package/lenses/categorical.en.md +48 -0
- package/lenses/categorical.md +48 -0
- package/lenses/causal.en.md +49 -0
- package/lenses/causal.md +49 -0
- package/lenses/duality.en.md +47 -0
- package/lenses/duality.md +47 -0
- package/lenses/game.en.md +50 -0
- package/lenses/game.md +50 -0
- package/lenses/geometric.en.md +53 -0
- package/lenses/geometric.md +53 -0
- package/lenses/local-to-global.en.md +52 -0
- package/lenses/local-to-global.md +52 -0
- package/lenses/perturbation.en.md +51 -0
- package/lenses/perturbation.md +51 -0
- package/lenses/probabilistic.en.md +48 -0
- package/lenses/probabilistic.md +48 -0
- package/lenses/projection.en.md +50 -0
- package/lenses/projection.md +50 -0
- package/lenses/spectral.en.md +52 -0
- package/lenses/spectral.md +52 -0
- package/lenses/symmetry.en.md +49 -0
- package/lenses/symmetry.md +49 -0
- package/lenses/topological.en.md +48 -0
- package/lenses/topological.md +48 -0
- package/lenses/variational.en.md +48 -0
- package/lenses/variational.md +48 -0
- package/package.json +9 -3
- package/references/books/abstract-algebra.md +5 -5
- package/references/books/algebraic-geometry-rising-sea.md +5 -5
- package/references/books/differential-geometry.md +3 -3
- package/references/books/matrix-analysis.md +4 -4
- package/references/books/micro-lie-theory.md +3 -3
- package/references/books/optimization-ml.md +1 -1
- package/references/books/smooth-manifolds.md +3 -3
- package/references/gpu-friendly-math.en.md +8 -8
- package/references/gpu-friendly-math.md +2 -2
- package/references/inspiration.en.md +1 -1
- package/references/inspiration.md +2 -2
- package/skills/math-research-activator/SKILL.en.md +161 -106
- package/skills/math-research-activator/SKILL.md +162 -110
- package/skills/math-research-activator/original-texts.en.md +9 -9
- package/skills/math-research-activator/original-texts.md +11 -11
- package/commands/abstraction.md +0 -11
- package/commands/algorithmic-thinking.md +0 -11
- package/commands/axiomatization.md +0 -11
- package/commands/causal-inference.md +0 -11
- package/commands/discrete-combinatorial.md +0 -11
- package/commands/game-theory.md +0 -11
- package/commands/induction-analogy.md +0 -11
- package/commands/information-theory.md +0 -11
- package/commands/logic-deduction.md +0 -11
- package/commands/modeling.md +0 -11
- package/commands/optimization.md +0 -11
- package/commands/probability-statistics.md +0 -11
- package/commands/symmetry-invariance.md +0 -11
- package/commands/topological-thinking.md +0 -11
- package/commands/transformation.md +0 -11
- package/skills/abstraction/SKILL.en.md +0 -117
- package/skills/abstraction/SKILL.md +0 -121
- package/skills/abstraction/original-texts.en.md +0 -163
- package/skills/abstraction/original-texts.md +0 -175
- package/skills/algorithmic-thinking/SKILL.en.md +0 -132
- package/skills/algorithmic-thinking/SKILL.md +0 -138
- package/skills/algorithmic-thinking/original-texts.en.md +0 -253
- package/skills/algorithmic-thinking/original-texts.md +0 -256
- package/skills/axiomatization/SKILL.en.md +0 -144
- package/skills/axiomatization/SKILL.md +0 -151
- package/skills/axiomatization/original-texts.en.md +0 -154
- package/skills/axiomatization/original-texts.md +0 -160
- package/skills/causal-inference/SKILL.en.md +0 -147
- package/skills/causal-inference/SKILL.md +0 -151
- package/skills/causal-inference/original-texts.en.md +0 -136
- package/skills/causal-inference/original-texts.md +0 -167
- package/skills/discrete-combinatorial/SKILL.en.md +0 -124
- package/skills/discrete-combinatorial/SKILL.md +0 -131
- package/skills/discrete-combinatorial/original-texts.en.md +0 -184
- package/skills/discrete-combinatorial/original-texts.md +0 -185
- package/skills/game-theory/SKILL.en.md +0 -117
- package/skills/game-theory/SKILL.md +0 -123
- package/skills/game-theory/original-texts.en.md +0 -131
- package/skills/game-theory/original-texts.md +0 -131
- package/skills/induction-analogy/SKILL.en.md +0 -145
- package/skills/induction-analogy/SKILL.md +0 -152
- package/skills/induction-analogy/original-texts.en.md +0 -140
- package/skills/induction-analogy/original-texts.md +0 -154
- package/skills/information-theory/SKILL.en.md +0 -134
- package/skills/information-theory/SKILL.md +0 -140
- package/skills/information-theory/original-texts.en.md +0 -127
- package/skills/information-theory/original-texts.md +0 -127
- package/skills/logic-deduction/SKILL.en.md +0 -130
- package/skills/logic-deduction/SKILL.md +0 -135
- package/skills/logic-deduction/original-texts.en.md +0 -160
- package/skills/logic-deduction/original-texts.md +0 -173
- package/skills/modeling/SKILL.en.md +0 -135
- package/skills/modeling/SKILL.md +0 -139
- package/skills/modeling/original-texts.en.md +0 -162
- package/skills/modeling/original-texts.md +0 -165
- package/skills/optimization/SKILL.en.md +0 -129
- package/skills/optimization/SKILL.md +0 -135
- package/skills/optimization/original-texts.en.md +0 -167
- package/skills/optimization/original-texts.md +0 -168
- package/skills/probability-statistics/SKILL.en.md +0 -146
- package/skills/probability-statistics/SKILL.md +0 -151
- package/skills/probability-statistics/original-texts.en.md +0 -191
- package/skills/probability-statistics/original-texts.md +0 -193
- package/skills/symmetry-invariance/SKILL.en.md +0 -135
- package/skills/symmetry-invariance/SKILL.md +0 -139
- package/skills/symmetry-invariance/original-texts.en.md +0 -206
- package/skills/symmetry-invariance/original-texts.md +0 -221
- package/skills/topological-thinking/SKILL.en.md +0 -124
- package/skills/topological-thinking/SKILL.md +0 -128
- package/skills/topological-thinking/original-texts.en.md +0 -134
- package/skills/topological-thinking/original-texts.md +0 -164
- package/skills/transformation/SKILL.en.md +0 -120
- package/skills/transformation/SKILL.md +0 -124
- package/skills/transformation/original-texts.en.md +0 -204
- package/skills/transformation/original-texts.md +0 -216
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
# Mathematical Sources and Classic Texts
|
|
2
|
-
|
|
3
|
-
## Mathematical Induction (Pascal, 1654)
|
|
4
|
-
|
|
5
|
-
**Principle**:
|
|
6
|
-
> If P(1) holds and P(n) -> P(n+1), then P(n) holds for all positive integers n.
|
|
7
|
-
|
|
8
|
-
**Philosophical implication**: Deriving the "infinite" from the "finite" -- requiring only a base case and an inductive step.
|
|
9
|
-
|
|
10
|
-
**Classic examples**: 1+2+...+n = n(n+1)/2; Fibonacci properties; proofs in graph theory
|
|
11
|
-
|
|
12
|
-
## Strong (Complete) Induction
|
|
13
|
-
|
|
14
|
-
> If P(1)...P(k) all holding implies P(k+1), then P(n) holds for all positive integers n.
|
|
15
|
-
|
|
16
|
-
**Applicable scenarios**: When P(k+1) depends on many or even all preceding propositions, not just P(k).
|
|
17
|
-
|
|
18
|
-
**Examples**: Unique factorization theorem; Fibonacci recurrence F(n)=F(n-1)+F(n-2); Fundamental Theorem of Arithmetic
|
|
19
|
-
|
|
20
|
-
## Structural Induction
|
|
21
|
-
|
|
22
|
-
> For recursively defined structures (lists, trees, expressions): prove the property holds for base elements and is preserved under construction steps, then it holds for all instances.
|
|
23
|
-
|
|
24
|
-
**Applications in computer science**: Compiler correctness; type system safety (well-typed programs do not crash); data structure invariants (red-black tree balance); algorithm termination proofs
|
|
25
|
-
|
|
26
|
-
**Examples**: |L1 ++ L2| = |L1| + |L2|; tree height <= number of nodes
|
|
27
|
-
|
|
28
|
-
## Transfinite Induction (Cantor Ordinals)
|
|
29
|
-
|
|
30
|
-
> If P(gamma) for all gamma < beta implies P(beta), then P(alpha) holds for all ordinals alpha.
|
|
31
|
-
|
|
32
|
-
**Significance**: Induction extends beyond the natural numbers -- it applies to any well-ordered set.
|
|
33
|
-
|
|
34
|
-
**Key concepts**: Cantor ordinals omega, omega+1, omega*2, omega^2, omega^omega...; equivalence with Zorn's lemma; application: proving that every vector space has a basis
|
|
35
|
-
|
|
36
|
-
## Well-Ordering Principle
|
|
37
|
-
|
|
38
|
-
> Every nonempty subset of the natural numbers has a least element; logically equivalent to mathematical induction.
|
|
39
|
-
|
|
40
|
-
**Equivalence proofs**: Well-ordering implies induction: the set of counterexamples has a least element m, so P(m-1) holds while P(m) does not -- contradiction. Induction implies well-ordering: use induction to prove that every nonempty subset contains a least element.
|
|
41
|
-
|
|
42
|
-
**Generalization**: The Well-Ordering Theorem (Zermelo 1904) -- every set can be well-ordered; equivalent to the Axiom of Choice.
|
|
43
|
-
|
|
44
|
-
## Polya's *Mathematics and Plausible Reasoning* (1954)
|
|
45
|
-
|
|
46
|
-
> "Induction, analogy, specialization, generalization -- principal methods of discovering mathematical truths."
|
|
47
|
-
|
|
48
|
-
**Inductive pattern**: 1. Observe cases -> 2. Discover patterns -> 3. Formulate conjectures -> 4. Verify (prove or disprove)
|
|
49
|
-
|
|
50
|
-
## Mathematical Status of Analogy
|
|
51
|
-
|
|
52
|
-
> "Analogy is a tool for discovery, not for proof."
|
|
53
|
-
|
|
54
|
-
**Classic analogies**: Sound waves -> wave theory of light; Planetary orbits -> Bohr atomic model; Water flow -> electric current (voltage analogous to water pressure)
|
|
55
|
-
|
|
56
|
-
## Euler and the Basel Problem (1735)
|
|
57
|
-
|
|
58
|
-
> Euler discovered Sum(1/n^2) = pi^2/6 by inductive reasoning -- the most celebrated inductive discovery in mathematics.
|
|
59
|
-
|
|
60
|
-
**Inductive process**: Computed partial sums approximately 1.6449 -> recognized pi^2/6 -> drew an analogy between the infinite product of sin(x) and the root-coefficient relations of polynomials -> rigorous proof. Polya specifically used this to illustrate "plausible reasoning."
|
|
61
|
-
|
|
62
|
-
## Fermi Estimation
|
|
63
|
-
|
|
64
|
-
> Solve unknowns via analogy and order-of-magnitude estimation.
|
|
65
|
-
|
|
66
|
-
**Classic problem**: "How many piano tuners are there in Chicago?" Population ~3 million -> ~1 million households -> 1/20 own pianos -> ~50,000 pianos -> tuned once per year, 2 hours each -> tuner works 2000 hours/year -> approximately 50 tuners.
|
|
67
|
-
|
|
68
|
-
**Value**: Reasonable analogical estimates yield order-of-magnitude correct results.
|
|
69
|
-
|
|
70
|
-
## Mill's Five Methods (1843)
|
|
71
|
-
|
|
72
|
-
> Mill systematized inductive reasoning in *A System of Logic*.
|
|
73
|
-
|
|
74
|
-
1. **Method of Agreement**: Multiple instances share only one common circumstance -> that circumstance is likely the cause
|
|
75
|
-
2. **Method of Difference**: Two instances differ in only one circumstance -> that difference is likely the cause
|
|
76
|
-
3. **Joint Method**: Combining agreement and difference to strengthen credibility
|
|
77
|
-
4. **Method of Concomitant Variations**: A phenomenon varies as a certain circumstance varies -> causal relationship
|
|
78
|
-
5. **Method of Residues**: After subtracting the effects of known causes, remaining effects are explained by remaining causes
|
|
79
|
-
|
|
80
|
-
## Ramanujan: Intuitive Induction (1887-1920)
|
|
81
|
-
|
|
82
|
-
> Ramanujan discovered formulas via astonishing pattern recognition, often without formal proof -- a genius of intuitive induction.
|
|
83
|
-
|
|
84
|
-
**Examples**: Series for 1/pi extrapolated from a few terms to general form; mock theta functions (pattern described, proof delayed by decades). Hardy: "His intuition was almost supernatural, yet logical rigor was often lacking."
|
|
85
|
-
|
|
86
|
-
**Lesson**: Inductive discovery can far outpace proof -- the tension between intuition and rigor is a driving force of mathematical progress.
|
|
87
|
-
|
|
88
|
-
## Borwein Integrals: A Cautionary Tale (2000s)
|
|
89
|
-
|
|
90
|
-
> A pattern holds for many terms then suddenly breaks -- a profound warning about inductive reasoning.
|
|
91
|
-
|
|
92
|
-
**Phenomenon**: Integral of sin(x)/x dx = pi/2; adding sin(x/3) still gives pi/2; ... continues through sin(x/13); but upon adding sin(x/15) it suddenly deviates! Mathematical root cause: the Patel-Vitali condition.
|
|
93
|
-
|
|
94
|
-
**Lesson**: The first N cases may hold while case N+1 breaks the pattern. Inductive conclusions require theoretical support and cannot rely solely on empirical evidence.
|
|
95
|
-
|
|
96
|
-
## Lakatos's *Proofs and Refutations* (1963/1976)
|
|
97
|
-
|
|
98
|
-
> Mathematical discovery evolves through counterexamples, monster-barring, and lemma-incorporation -- not a linear "conjecture -> proof" process.
|
|
99
|
-
|
|
100
|
-
**Core concepts**: Monster-barring (modifying definitions to exclude counterexamples); Lemma-incorporation (adding the conditions of counterexamples to the premises); Concept-stretching (counterexamples driving the expansion of concepts)
|
|
101
|
-
|
|
102
|
-
**Example**: The proof history of Euler's polyhedron formula V-E+F=2 -- from Cauchy's naive proof to successive corrections for holes and tunnels.
|
|
103
|
-
|
|
104
|
-
## Hume's Problem of Induction (1739)
|
|
105
|
-
|
|
106
|
-
> "The sun has risen every day in the past; this does not logically guarantee it will rise tomorrow."
|
|
107
|
-
|
|
108
|
-
**Fundamental flaw**: Deriving the infinite from the finite always carries uncertainty.
|
|
109
|
-
|
|
110
|
-
**Scientific method's response**: Induction produces hypotheses (not theorems) -> falsifiable (Popper) -> continuously tested -> counterexamples lead to revision or abandonment
|
|
111
|
-
|
|
112
|
-
## Carnap's Inductive Logic (1950s)
|
|
113
|
-
|
|
114
|
-
> Carnap attempted to formalize and quantify inductive reasoning -- a logical foundation for inductive probability.
|
|
115
|
-
|
|
116
|
-
**Core idea**: Confirmation function c(h,e) -- the degree to which evidence e confirms hypothesis h. Inductive logic should have rigorous rules; prior probabilities should be based on logical symmetry rather than subjective belief.
|
|
117
|
-
|
|
118
|
-
**Limitations**: The system is highly sensitive to the linguistic framework -- different predicate sets yield different degrees of confirmation; Goodman's "grue paradox" further reveals the difficulties.
|
|
119
|
-
|
|
120
|
-
## Problem of Underdetermination
|
|
121
|
-
|
|
122
|
-
> Multiple analogies or theories can equally fit the same data -- data underdetermines theory choice.
|
|
123
|
-
|
|
124
|
-
**Mathematical analogy**: Finitely many data points can be fit by infinitely many functions; multiple inductive hypotheses may be simultaneously consistent with experience; theory choice requires additional criteria: simplicity, explanatory power, predictive power.
|
|
125
|
-
|
|
126
|
-
**Philosophical roots**: The Quine-Duhem thesis -- any hypothesis can be shielded from falsification by adjusting auxiliary hypotheses.
|
|
127
|
-
|
|
128
|
-
## Machine Learning as Induction
|
|
129
|
-
|
|
130
|
-
> Machine learning is the engineering of inductive reasoning -- inferring general rules from data.
|
|
131
|
-
|
|
132
|
-
**Statistical learning theory**: PAC learning (Valiant 1984) -- outputting a hypothesis with low error with high probability; generalization bounds -- the quantitative relationship between sample complexity and hypothesis class complexity; VC dimension -- a mathematical measure of "inductive capacity."
|
|
133
|
-
|
|
134
|
-
**Contrast with mathematical induction**: Mathematical induction = deterministic reasoning over an infinite domain; statistical induction = probabilistic reasoning from finite samples; generalization = the inductive leap
|
|
135
|
-
|
|
136
|
-
## Power and Limits of Analogy
|
|
137
|
-
|
|
138
|
-
**Power**: Transferring knowledge across domains (one of the most important sources of innovation); converting the unknown into the known; generating new ideas and hypotheses
|
|
139
|
-
|
|
140
|
-
**Limits**: Analogy is not proof -- conclusions require independent verification; surface similarity does not imply structural similarity; every analogy has a breaking point -- two domains can never be perfectly isomorphic
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
# 数学出处与经典文献 / Mathematical Sources and Classic Texts
|
|
2
|
-
|
|
3
|
-
## 数学归纳法 / Mathematical Induction (Pascal, 1654)
|
|
4
|
-
|
|
5
|
-
**原理**:
|
|
6
|
-
> 如果 P(1) 成立,且 P(n) → P(n+1),则 P(n) 对所有正整数 n 成立。
|
|
7
|
-
> If P(1) holds and P(n) → P(n+1), then P(n) holds for all positive integers n.
|
|
8
|
-
|
|
9
|
-
**哲学含义**:从"有限"推导"无限"——只需基础与递推两步 / Deriving "infinite" from "finite" — just base case and inductive step.
|
|
10
|
-
|
|
11
|
-
**经典案例**:1+2+...+n = n(n+1)/2;Fibonacci 性质;图论证明
|
|
12
|
-
|
|
13
|
-
## 强归纳法 / Strong (Complete) Induction
|
|
14
|
-
|
|
15
|
-
> 若 P(1)...P(k) 全部成立可推出 P(k+1),则 P(n) 对所有正整数成立。
|
|
16
|
-
> If P(1)...P(k) all holding implies P(k+1), then P(n) holds for all n.
|
|
17
|
-
|
|
18
|
-
**适用场景**:P(k+1) 依赖多个甚至全部前命题,而非仅 P(k) / When P(k+1) depends on many or all preceding propositions, not just P(k).
|
|
19
|
-
|
|
20
|
-
**案例**:唯一分解定理 / Unique factorization;Fibonacci 递推 F(n)=F(n-1)+F(n-2);算术基本定理
|
|
21
|
-
|
|
22
|
-
## 结构归纳法 / Structural Induction
|
|
23
|
-
|
|
24
|
-
> 对递归定义结构(列表、树、表达式),证明性质对基础元素成立且在递推步骤中保持,则对所有实例成立。
|
|
25
|
-
> For recursively defined structures: prove property holds for base elements and is preserved under construction steps → holds for all instances.
|
|
26
|
-
|
|
27
|
-
**计算机科学应用**:编译器正确性;类型系统安全性(良类型程序不崩溃);数据结构不变量(红黑树平衡);算法终止性证明
|
|
28
|
-
|
|
29
|
-
**案例**:|L₁ ++ L₂| = |L₁| + |L₂|;树高度 ≤ 节点数
|
|
30
|
-
|
|
31
|
-
## 超限归纳法 / Transfinite Induction (Cantor Ordinals)
|
|
32
|
-
|
|
33
|
-
> 若对所有 γ < β,P(γ) 成立可推出 P(β) 成立,则 P(α) 对所有序数 α 成立。
|
|
34
|
-
> If P(γ) for all γ < β implies P(β), then P(α) holds for all ordinals α.
|
|
35
|
-
|
|
36
|
-
**意义**:归纳超越自然数——对任意良序集成立 / Induction extends beyond naturals — applies to any well-ordered set.
|
|
37
|
-
|
|
38
|
-
**关键概念**:Cantor 序数 ω, ω+1, ω·2, ω², ω^ω...;Zorn 引理等价性;应用:证明每个向量空间都有基
|
|
39
|
-
|
|
40
|
-
## 良序原理 / Well-Ordering Principle
|
|
41
|
-
|
|
42
|
-
> 自然数的每个非空子集有最小元素,与数学归纳法逻辑等价。
|
|
43
|
-
> Every nonempty subset of naturals has a least element; logically equivalent to mathematical induction.
|
|
44
|
-
|
|
45
|
-
**等价论证**:良序→归纳:反例集有最小元 m,则 P(m-1) 成立而 P(m) 不成立,矛盾。归纳→良序:用归纳法证每个非空子集含最小元。
|
|
46
|
-
|
|
47
|
-
**推广**:良序定理(Zermelo 1904)——任何集合可良序化,与选择公理等价。
|
|
48
|
-
|
|
49
|
-
## Pólya《数学与猜想》/ *Mathematics and Plausible Reasoning* (1954)
|
|
50
|
-
|
|
51
|
-
> "归纳、类比、特例化、一般化——发现数学真理的主要方法。"
|
|
52
|
-
> "Induction, analogy, specialization, generalization—principal methods of discovering mathematical truths."
|
|
53
|
-
|
|
54
|
-
**归纳模式**:1. 观察案例 → 2. 发现模式 → 3. 提出猜想 → 4. 验证(证明或证伪)
|
|
55
|
-
|
|
56
|
-
## 类比的数学地位 / Mathematical Status of Analogy
|
|
57
|
-
|
|
58
|
-
> "类比是发现的工具,不是证明的工具。" / "Analogy is a tool for discovery, not for proof."
|
|
59
|
-
|
|
60
|
-
**经典类比**:声波→光波动理论;行星轨道→Bohr 原子模型;水流→电流(电压≈水压)
|
|
61
|
-
|
|
62
|
-
## Euler 与 Basel 问题 / Euler and the Basel Problem (1735)
|
|
63
|
-
|
|
64
|
-
> Euler 通过归纳发现 ∑1/n² = π²/6 ——数学史上最著名的归纳发现。
|
|
65
|
-
> Euler discovered ∑1/n² = π²/6 by inductive reasoning — the most celebrated inductive discovery in mathematics.
|
|
66
|
-
|
|
67
|
-
**归纳过程**:计算部分和 ≈1.6449 → 识别 π²/6 → 类比 sin(x) 无穷乘积与多项式根系数关系 → 严格证明。Pólya 专门以此说明"合情推理"。
|
|
68
|
-
|
|
69
|
-
## Fermi 方法 / Fermi Estimation
|
|
70
|
-
|
|
71
|
-
> 通过类比和数量级估计解决未知问题 / Solve unknowns via analogy and order-of-magnitude estimation.
|
|
72
|
-
|
|
73
|
-
**经典问题**:"芝加哥有多少钢琴调音师?":人口~300万→~100万户→1/20有钢琴→~5万台→每年调1次×2小时→调音师2000小时/年→≈50名调音师
|
|
74
|
-
|
|
75
|
-
**价值**:合理的类比估计可得数量级正确答案 / Reasonable analogy yields order-of-magnitude correct results.
|
|
76
|
-
|
|
77
|
-
## Mill 五种归纳方法 / Mill's Five Methods (1843)
|
|
78
|
-
|
|
79
|
-
> Mill 在《逻辑体系》中系统化归纳推理 / Mill systematized inductive reasoning in *A System of Logic*.
|
|
80
|
-
|
|
81
|
-
1. **一致法 / Agreement**:多场合仅一共同情况→该情况可能为原因
|
|
82
|
-
2. **差异法 / Difference**:两场合仅一情况不同→该差异可能为原因
|
|
83
|
-
3. **联合法 / Joint Method**:一致+差异结合,增强可信度
|
|
84
|
-
4. **共变法 / Concomitant Variations**:现象随某情况变化而变化→因果关系
|
|
85
|
-
5. **残差法 / Residue**:扣除已知原因效应后,剩余效应由剩余原因解释
|
|
86
|
-
|
|
87
|
-
## Ramanujan:直觉归纳 / Ramanujan: Intuitive Induction (1887–1920)
|
|
88
|
-
|
|
89
|
-
> Ramanujan 以惊人模式识别发现公式,常无形式证明——直觉归纳天才。
|
|
90
|
-
> Ramanujan discovered formulas via astonishing pattern recognition, often without formal proof — genius of intuitive induction.
|
|
91
|
-
|
|
92
|
-
**案例**:1/π 级数从少数项推广到一般形式;mock theta 函数(模式描述了,证明延迟数十年)。Hardy:"他的直觉近乎超自然,但逻辑常缺。"
|
|
93
|
-
|
|
94
|
-
**教训**:归纳发现可远超前于证明——直觉与严格性的张力是数学发展的动力。
|
|
95
|
-
|
|
96
|
-
## Borwein 积分:归纳警醒 / Borwein Integrals: Cautionary Tale (2000s)
|
|
97
|
-
|
|
98
|
-
> 模式持续很久然后突然断裂——归纳推理的深刻警示。
|
|
99
|
-
> A pattern holds for many terms then suddenly breaks — a profound warning about inductive reasoning.
|
|
100
|
-
|
|
101
|
-
**现象**:∫sin(x)/x dx = π/2;加入 sin(x/3) 仍 = π/2;...持续到 sin(x/13);但加入 sin(x/15) 时突然偏离!数学根源:Patel-Vital 条件。
|
|
102
|
-
|
|
103
|
-
**教训**:前 N 个案例成立,第 N+1 个可能打破模式。归纳结论需理论支撑,不能仅依赖经验 / First N cases may hold while case N+1 breaks. Inductive conclusions need theoretical support.
|
|
104
|
-
|
|
105
|
-
## Lakatos《证明与反驳》/ *Proofs and Refutations* (1963/1976)
|
|
106
|
-
|
|
107
|
-
> 数学发现不是线性"猜想→证明",而是通过反驳、怪物排除、引理嵌入不断演进。
|
|
108
|
-
> Mathematical discovery evolves through counterexamples, monster-barring, and lemma-incorporation — not linear "conjecture→proof".
|
|
109
|
-
|
|
110
|
-
**核心概念**:怪物排除 / Monster-barring(修改定义排除反例);引理嵌入 / Lemma-incorporation(将反例条件加入前提);概念拉伸 / Concept-stretching(反例推动概念扩展)
|
|
111
|
-
|
|
112
|
-
**案例**:多面体 Euler 公式 V-E+F=2 的证明生成——从 Cauchy 朴素证明到对空洞、隧道的逐步修正。
|
|
113
|
-
|
|
114
|
-
## Hume 归纳问题 / Hume's Problem of Induction (1739)
|
|
115
|
-
|
|
116
|
-
> "过去太阳每天升起,不能逻辑保证明天也会升起。"
|
|
117
|
-
> "The sun has risen every day in the past; this does not logically guarantee it will rise tomorrow."
|
|
118
|
-
|
|
119
|
-
**本质缺陷**:从有限到无限永远存在不确定性 / Deriving infinite from finite always carries uncertainty.
|
|
120
|
-
|
|
121
|
-
**科学方法解决**:归纳产假说(非定理)→ 可证伪(Popper)→ 持续检验 → 反例则修正/放弃
|
|
122
|
-
|
|
123
|
-
## Carnap 归纳逻辑 / Carnap's Inductive Logic (1950s)
|
|
124
|
-
|
|
125
|
-
> Carnap 试图形式化量化归纳推理——为归纳概率建立逻辑基础。
|
|
126
|
-
> Carnap attempted to formalize and quantify inductive reasoning — a logical foundation for inductive probability.
|
|
127
|
-
|
|
128
|
-
**核心**:确证函数 c(h,e)——证据 e 对假说 h 的确证度 / Confirmation function c(h,e): degree of confirmation. 归纳逻辑应有严格规则;先验概率基于逻辑对称性而非主观信念。
|
|
129
|
-
|
|
130
|
-
**局限**:系统对语言框架高度敏感——不同谓词集导致不同确证度;Goodman "绿蓝悖论"(grue paradox) 进一步揭示困难。
|
|
131
|
-
|
|
132
|
-
## 不充分决定 / Problem of Underdetermination
|
|
133
|
-
|
|
134
|
-
> 多个类比或理论可同等吻合同一数据——数据不充分决定理论选择。
|
|
135
|
-
> Multiple analogies or theories equally fit the same data — data underdetermines theory choice.
|
|
136
|
-
|
|
137
|
-
**数学类比**:有限数据点→无数函数可拟合;多个归纳假说可能同时与经验一致;理论选择需额外准则:简洁性、解释力、预测力。
|
|
138
|
-
|
|
139
|
-
**哲学根源**:Quine-Duhem 论题——任何假说可通过调整辅助假说免于证伪。
|
|
140
|
-
|
|
141
|
-
## 机器学习作为归纳 / Machine Learning as Induction
|
|
142
|
-
|
|
143
|
-
> 机器学习是归纳推理的工程化——从数据推断一般规律。
|
|
144
|
-
> Machine learning is the engineering of inductive reasoning — inferring general rules from data.
|
|
145
|
-
|
|
146
|
-
**统计学习理论**:PAC 学习(Valiant 1984)——以高概率输出低误差假说;泛化界限——样本复杂度与假说类复杂度定量关系;VC 维度——衡量"归纳能力"的数学指标。
|
|
147
|
-
|
|
148
|
-
**与数学归纳对比**:数学归纳=无限域确定性推理;统计归纳=有限样本概率性推理;泛化=归纳跳跃
|
|
149
|
-
|
|
150
|
-
## 类比思维的力量与局限 / Power and Limits of Analogy
|
|
151
|
-
|
|
152
|
-
**力量**:跨领域迁移知识(最重要创新来源之一);将未知转化为已知;产生新思路和假说
|
|
153
|
-
|
|
154
|
-
**局限**:类比不是证明——结论需独立验证;表面相似 ≠ 结构相似;每个类比有失效点——两个领域不可能完全同构
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: information-theory
|
|
3
|
-
description: |
|
|
4
|
-
Trigger when a problem needs to quantify uncertainty, measure information value as "information = reduction of uncertainty"; or compute entropy / mutual information / KL divergence / channel capacity, or design information criteria for compression / KV-cache compression / quantization / routing.
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# 📡 Information Theory
|
|
8
|
-
|
|
9
|
-
> "Information is reduction of uncertainty — knowing more means doubting less."
|
|
10
|
-
>
|
|
11
|
-
> — Information Theory, Coding Theory, Statistical Inference
|
|
12
|
-
|
|
13
|
-
## Core Principle
|
|
14
|
-
|
|
15
|
-
**Information is reduction of uncertainty — uncertainty is precisely quantified by entropy; compression and communication have unbreakable limits set by the entropy bound and channel capacity; information gain guides which observation to prioritize under uncertainty.**
|
|
16
|
-
|
|
17
|
-
> **Mathematical Formalization**
|
|
18
|
-
>
|
|
19
|
-
> Shannon entropy $H(X) = -\sum_x p(x)\log p(x)$ quantifies the average "surprise" of a random variable — the lower the probability of an event, the greater the surprise when it occurs; entropy is the expected value of surprise.
|
|
20
|
-
>
|
|
21
|
-
> Mutual information $I(X;Y) = H(X) - H(X|Y) = \sum_{x,y} p(x,y)\log\frac{p(x,y)}{p(x)p(y)}$ measures the reduction in uncertainty about $X$ after observing $Y$ — this is precisely the mathematical definition of "information."
|
|
22
|
-
>
|
|
23
|
-
> KL divergence $D_{KL}(P\|Q) = \sum_x p(x)\log\frac{p(x)}{q(x)}$ measures the information loss when $Q$ is used in place of $P$; it is **asymmetric**: $D(P\|Q)\neq D(Q\|P)$.
|
|
24
|
-
>
|
|
25
|
-
> Source coding theorem: The average code length of the optimal compression satisfies $\ge H(X)$ bits/symbol; compression below the entropy bound inevitably loses information.
|
|
26
|
-
>
|
|
27
|
-
> Channel coding theorem: The upper bound on the rate of reliable communication is the channel capacity $C = \max_{p(x)} I(X;Y)$; when $R<C$, there exist codes that drive the error rate to zero; when $R>C$, reliable communication is impossible.
|
|
28
|
-
>
|
|
29
|
-
> Rate-distortion function $R(D) = \min_{p(\hat{x}|x):\,\mathbb{E}[d(x,\hat{x})]\le D} I(X;\hat{X})$ gives the minimum information rate for a given distortion $D$ — the fundamental limit of lossy compression.
|
|
30
|
-
>
|
|
31
|
-
> See `original-texts.md` for detailed mathematical foundations.
|
|
32
|
-
|
|
33
|
-
## GPU-Friendliness (Cross-Cutting Check)
|
|
34
|
-
|
|
35
|
-
When information-theoretic quantities are used for **compression/pruning/quantization/KV-cache compression/routing design**, they must pass the `../../references/gpu-friendly-math.md` eight-dimension gate. Core criterion: **local, fusible entropy/KL estimation = friendly; global exact information estimation = unfriendly**.
|
|
36
|
-
|
|
37
|
-
- **Quantization calibration (per-block entropy/Hessian)**: Local, batchable via GEMM, feasible at low precision — friendly (dimensions 1/2/5).
|
|
38
|
-
- **KV-Cache compression (information bottleneck/block summary)**: Low-rank block summary compresses memory — friendly (dimension 4); Plücker-style block summaries are discussed in `../../references/books/algebraic-geometry-rising-sea.md`.
|
|
39
|
-
- **Mutual information pruning / feature selection**: Adaptable if $I(X;Y)$ is estimated using local or low-rank approximations; unfriendly if full-distribution exact estimation is required.
|
|
40
|
-
- **Information gain routing**: Global exact $I(X;Y)$ requires $O(n^2)$ memory, high precision, and is unfusable — anti-pattern; replace with continuous differentiable approximations such as softmax/tropical gating (dimensions 3/6/8).
|
|
41
|
-
- **Anti-pattern**: Computing exact entropy/mutual information over the full token distribution — memory explosion, requires fp64, serial dependencies — "beautiful but intractable."
|
|
42
|
-
|
|
43
|
-
Eight-dimension minimum criteria (formal terms): **Tensorization** checks whether entropy/KL/MI can be estimated per token/block/batch; **GEMM-mappability** checks whether compression, projection, and calibration reduce to linear algebra; **complexity** avoids full-distribution exact estimation; **memory and KV-cache** quantifies KV/activation/codebook footprint; **low-precision stability** checks log/softmax/KL dynamic range; **parallelism and communication** checks whether block-wise statistics can be reduced across devices; **sparse structure** checks whether codebooks/routing are block-structured; **operator fusion** checks whether statistics, masking, and quantization can be fused.
|
|
44
|
-
|
|
45
|
-
> Used together with `../../references/books/matrix-analysis.md` (low-rank compression), `../../references/books/abstract-algebra.md` (coding/finite fields).
|
|
46
|
-
|
|
47
|
-
## When NOT to Use
|
|
48
|
-
|
|
49
|
-
- **The problem has no probabilistic structure** (e.g., purely symbolic reasoning, logical deduction) — entropy and information gain require probability distributions; without probability there is no information theory.
|
|
50
|
-
- **Purely deterministic scenarios with no uncertainty** (e.g., mathematical problems with known exact answers) — when entropy is zero, information theory degenerates to trivial conclusions.
|
|
51
|
-
- **Qualitative judgments that need no quantification** (e.g., aesthetic evaluations, emotional judgments) — information theory quantifies uncertainty in the probabilistic sense, not semantic ambiguity.
|
|
52
|
-
|
|
53
|
-
## When to Use
|
|
54
|
-
|
|
55
|
-
- Measuring the magnitude of uncertainty (entropy $H(X)$ quantifies the "disorder" of a random variable).
|
|
56
|
-
- Comparing the value of different information sources (mutual information $I(X;Y)$ measures which observation $Y$ best reduces uncertainty about $X$).
|
|
57
|
-
- Achieving optimal data compression (the source coding theorem guarantees the optimal compression limit is $H(X)$ bits/symbol).
|
|
58
|
-
- Communicating reliably under noise (the channel coding theorem guarantees reliable transmission is feasible when $R<C$).
|
|
59
|
-
- Feature selection or model selection (mutual information screens features; AIC/BIC/MDL serve as information criteria for model selection).
|
|
60
|
-
- Bayesian model comparison (KL divergence $D(P\|Q)$ measures the information distance between distributions; Bayes factors quantify the evidence ratio between models).
|
|
61
|
-
- **Designing information criteria for compression / KV-cache compression / quantization / routing**, and evaluating their GPU feasibility.
|
|
62
|
-
|
|
63
|
-
## Method
|
|
64
|
-
|
|
65
|
-
### Step 1: Identify Source and Uncertainty
|
|
66
|
-
- What is the **random variable $X$**? — Define the information source and clarify the object of uncertainty.
|
|
67
|
-
- The **probability distribution $p(x)$** — use a probability table for discrete distributions, a density function for continuous distributions.
|
|
68
|
-
- **Compute $H(X) = -\sum p(x)\log p(x)$** — quantify the current level of uncertainty.
|
|
69
|
-
- **Identify the uncertainty to be reduced** — clarify "knowing what would reduce uncertainty?"
|
|
70
|
-
|
|
71
|
-
### Step 2: Quantify Information Gain
|
|
72
|
-
- **Compute conditional entropy $H(X|Y)$** — the residual uncertainty about $X$ after observing $Y$.
|
|
73
|
-
- **Compute mutual information $I(X;Y) = H(X) - H(X|Y)$** — the amount of information $Y$ provides about $X$.
|
|
74
|
-
- **Identify the optimal observation** — which $Y$ maximizes $I(X;Y)$? That observation is the most worth acquiring.
|
|
75
|
-
- **Chain rule** — $H(X_1,\dots,X_n) = H(X_1) + H(X_2|X_1) + \dots + H(X_n|X_1,\dots,X_{n-1})$, decomposing joint uncertainty variable by variable.
|
|
76
|
-
|
|
77
|
-
### Step 3: Choose Coding Strategy
|
|
78
|
-
- **Source coding (compression)**: Huffman coding (greedy optimal prefix code, average length approaching $H(X)$), arithmetic coding (closer to the entropy bound), universal coding (LZ77/LZ78/LZW, no prior distribution needed).
|
|
79
|
-
- **Channel coding (error correction)**: Hamming codes (minimum distance 3, corrects 1-bit errors), Reed–Solomon codes (burst error correction), LDPC/Turbo codes (approaching the Shannon limit).
|
|
80
|
-
- **Coding selection principle**: Compression needs → source coding → approach $H(X)$; noise protection needs → channel coding → approach the Shannon limit ($R\to C$).
|
|
81
|
-
|
|
82
|
-
### Step 4: Evaluate Channel Capacity
|
|
83
|
-
- **Compute channel capacity $C = \max_{p(x)} I(X;Y)$** — maximize mutual information over all input distributions.
|
|
84
|
-
- **Compare transmission rate $R$ with capacity $C$**: $R<C$ → reliable communication is feasible; $R>C$ → errors are inevitable.
|
|
85
|
-
- **Noise models**: BSC (binary symmetric channel, flip probability $p$), BEC (binary erasure channel, erasure probability $\varepsilon$), AWGN (additive white Gaussian noise channel).
|
|
86
|
-
- **Capacity formula examples**: BSC capacity $C = 1 - H(p)$; AWGN capacity $C = \frac{1}{2}\log(1 + S/N)$.
|
|
87
|
-
|
|
88
|
-
### Step 5: Apply Information Criteria
|
|
89
|
-
- **AIC (Akaike Information Criterion)**: $\text{AIC} = -2\ln L + 2k$ — favors goodness of fit, suited for prediction objectives.
|
|
90
|
-
- **BIC (Bayesian Information Criterion)**: $\text{BIC} = -2\ln L + k\ln n$ — favors parsimony, suited for explanation objectives.
|
|
91
|
-
- **KL divergence $D_{KL}(P\|Q) = \sum p(x)\log\frac{p(x)}{q(x)}$** — measures the information loss when $Q$ is used in place of $P$; note the asymmetry.
|
|
92
|
-
- **MDL principle (Minimum Description Length)**: Choose the model that minimizes "data description length + model description length" — the information-theoretic version of Occam's razor.
|
|
93
|
-
|
|
94
|
-
### Step 6: Make Information-Optimal Decision
|
|
95
|
-
- **Bayesian experimental design**: Choose the experiment that maximizes expected information gain $\max\,\mathbb{E}[I(\theta;Y)]$ — prioritize acquiring the data that most reduces uncertainty.
|
|
96
|
-
- **Minimize KL divergence**: The output distribution $Q$ of a decision should be as close as possible to the target distribution $P$, i.e., $\min D(P\|Q)$.
|
|
97
|
-
- **Maximum entropy principle**: Under known constraints, choose the distribution that maximizes $H(X)$ — fewest assumptions, most conservative inference.
|
|
98
|
-
- **Information bottleneck**: $\min I(X;T) - \beta I(T;Y)$ — when compressing $X$ into $T$, retain the maximum relevant information about $Y$.
|
|
99
|
-
|
|
100
|
-
## Common Errors
|
|
101
|
-
|
|
102
|
-
| Error | Critique | Correct Approach |
|
|
103
|
-
|-------|----------|-----------------|
|
|
104
|
-
| Equating information with bits rather than probabilistic reduction | Entropy $H(X)$ is a function of the probability distribution; bits are merely the unit of measurement | Understand information as reduction of uncertainty: $I(X;Y)=H(X)-H(X\|Y)$ |
|
|
105
|
-
| Ignoring channel capacity limits | When $R>C$, no coding scheme achieves reliable communication | Compute capacity $C=\max I(X;Y)$ and ensure $R<C$ |
|
|
106
|
-
| Confusing entropy with variance | Entropy measures the "spread" of the probability structure; variance measures the "spread" of numerical values; they are not equivalent | Use entropy for probabilistic uncertainty; use variance for numerical deviation; continuous entropy can be negative |
|
|
107
|
-
| Over-compressing below the entropy bound | Optimal compression satisfies $\ge H(X)$ bits/symbol; compression below this bound inevitably loses information | Accept the entropy bound and design codes accordingly |
|
|
108
|
-
| Ignoring the asymmetry of KL divergence | $D(P\|Q)\ne D(Q\|P)$; the direction determines the meaning | Be explicit about direction: $D(P\|Q)$ means "the extra cost of encoding $P$ using $Q$" |
|
|
109
|
-
| Equating correlation with information | Correlation $\rho$ measures only linear association; $I(X;Y)=0 \Leftrightarrow$ independence, but $\rho=0 \not\Rightarrow$ independence | Use mutual information $I(X;Y)$ to assess dependence |
|
|
110
|
-
| Forcing quantification on qualitative judgments | Information theory quantifies probabilistic uncertainty, not semantic ambiguity or subjective experience | Distinguish probabilistic uncertainty from semantic ambiguity; do not apply entropy formulas to qualitative problems |
|
|
111
|
-
| Global exact entropy / mutual information is intractable | Exact estimation of $I(X;Y)$ over the full distribution requires $O(n^2)$ memory and high precision; infeasible on GPU | Use local/sampled/low-rank estimation; pass the GPU eight-dimension gate |
|
|
112
|
-
|
|
113
|
-
## Operating Procedure
|
|
114
|
-
|
|
115
|
-
When this skill is triggered, the output must include:
|
|
116
|
-
|
|
117
|
-
1. **[Information source]: [description]** $H(X)=$ [value] — define the random variable $X$, compute its entropy, and quantify the current uncertainty.
|
|
118
|
-
2. **[Information gain]: [description]** $I(X;Y)=$ [value] — compute mutual information and identify the most valuable observation $Y$.
|
|
119
|
-
3. **[Coding strategy]: [choice]** — source coding (compression) or channel coding (error correction), stating which limit is being approached.
|
|
120
|
-
4. **[Channel capacity]: [description]** $C=$ [value] — compute channel capacity and compare transmission rate $R$ with $C$.
|
|
121
|
-
5. **[Information criterion]: [AIC/BIC/KL/MDL]** — state the chosen information criterion and the rationale.
|
|
122
|
-
6. **[Optimal decision]: [explanation]** — decision recommendation based on information gain maximization or KL divergence minimization.
|
|
123
|
-
7. **[GPU feasibility]** (if used for compression/KV-cache compression/quantization/routing) — is entropy/KL/mutual information estimation local and fusible, or global and exact? Pass the eight-dimension gate; annotate as friendly / retrofittable / unfriendly + adaptation suggestions.
|
|
124
|
-
|
|
125
|
-
**The output must not present analysis alone without a conclusion.**
|
|
126
|
-
|
|
127
|
-
## Relations to Other Skills
|
|
128
|
-
|
|
129
|
-
- **Probability and statistics**: Entropy and information gain complement probabilistic reasoning — $H(X)$ measures distributional uncertainty, and $I(X;Y)$ is the information-theoretic expression of Bayesian updating.
|
|
130
|
-
- **Optimization thinking**: Channel capacity maximization is an optimization problem — $C=\max_{p(x)} I(X;Y)$ is optimization over input distributions.
|
|
131
|
-
- **Transformation thinking**: Coding is a transformation of the information space — source coding transforms into efficient representations; channel coding transforms into noise-resistant representations.
|
|
132
|
-
- **Modeling thinking**: Information criteria guide model selection — AIC/BIC/MDL quantify the fit-complexity trade-off from an information-theoretic perspective.
|
|
133
|
-
- **Algorithmic thinking**: Compression algorithms are computational implementations — Huffman/LZ/LDPC and related algorithms are approximation implementations of information-theoretic limits.
|
|
134
|
-
- **Modern mathematics activation**: `../../references/books/matrix-analysis.md` (low-rank compression), `../../references/books/abstract-algebra.md` (coding/finite fields), `../../references/books/algebraic-geometry-rising-sea.md` (Plücker KV compression).
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: information-theory
|
|
3
|
-
description: |
|
|
4
|
-
触发:问题需量化不确定性、以"信息=不确定性的减少"度量信息价值;或需计算熵/互信息/KL 散度/信道容量,为压缩/KV 压缩/量化/路由设计信息准则时调用。
|
|
5
|
-
English: Trigger when a problem needs to quantify uncertainty, measure information value as "information = reduction of uncertainty"; or compute entropy / mutual information / KL divergence / channel capacity, or design information criteria for compression / KV-cache compression / quantization / routing.
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
> **语言路由**:若用户消息为英文,请读取并遵循同目录下的 `SKILL.en.md`,按其操作规程以英文输出;中文消息则继续使用本文件。
|
|
9
|
-
|
|
10
|
-
# 📡 信息论思想 / Information Theory
|
|
11
|
-
|
|
12
|
-
> "信息是不确定性的减少——知道更多意味着怀疑更少。"
|
|
13
|
-
> "Information is reduction of uncertainty — knowing more means doubting less."
|
|
14
|
-
>
|
|
15
|
-
> —— 信息论、编码理论、统计推断 / Information Theory, Coding Theory, Statistical Inference
|
|
16
|
-
|
|
17
|
-
## 核心原则 / Core Principle
|
|
18
|
-
|
|
19
|
-
**信息是不确定性的减少——不确定性可由熵精确量化,压缩与通信存在由熵限与信道容量刻画的不可逾越极限,信息增益则指导在不确定性下应优先获取何种观察。**
|
|
20
|
-
|
|
21
|
-
**Information is reduction of uncertainty — uncertainty is precisely quantified by entropy; compression and communication have unbreakable limits set by the entropy bound and channel capacity; information gain guides which observation to prioritize under uncertainty.**
|
|
22
|
-
|
|
23
|
-
> **数学形式化 / Mathematical Formalization**
|
|
24
|
-
>
|
|
25
|
-
> Shannon 熵 $H(X) = -\sum_x p(x)\log p(x)$ 量化随机变量的平均"惊奇度"——概率越低的事件发生时惊奇越大,熵是惊奇度的期望。
|
|
26
|
-
>
|
|
27
|
-
> 互信息 $I(X;Y) = H(X) - H(X|Y) = \sum_{x,y} p(x,y)\log\frac{p(x,y)}{p(x)p(y)}$,即观察 $Y$ 后对 $X$ 不确定性的减少——这正是"信息"的数学定义。
|
|
28
|
-
>
|
|
29
|
-
> KL 散度 $D_{KL}(P\|Q) = \sum_x p(x)\log\frac{p(x)}{q(x)}$ 衡量用 $Q$ 替代 $P$ 的信息损失,**不对称** $D(P\|Q)\neq D(Q\|P)$。
|
|
30
|
-
>
|
|
31
|
-
> 信源编码定理:最优压缩的平均编码长度 $\ge H(X)$ bits/symbol,低于熵限则必然丢失信息。
|
|
32
|
-
>
|
|
33
|
-
> 信道编码定理:可靠通信的速率上限为信道容量 $C = \max_{p(x)} I(X;Y)$;$R<C$ 时存在编码使误码率趋零,$R>C$ 时可靠通信不可能。
|
|
34
|
-
>
|
|
35
|
-
> 率失真函数 $R(D) = \min_{p(\hat{x}|x):\,\mathbb{E}[d(x,\hat{x})]\le D} I(X;\hat{X})$ 给定失真 $D$ 下的最小信息率——有损压缩的极限。
|
|
36
|
-
>
|
|
37
|
-
> 详细数学依据见 `original-texts.md`。
|
|
38
|
-
|
|
39
|
-
## GPU 友好性 / GPU-Friendliness(横切检查)
|
|
40
|
-
|
|
41
|
-
信息论量用于**压缩/剪枝/量化/KV 压缩/路由设计**时,须过 `../../references/gpu-friendly-math.md` 八维门。核心判据:**局部、可融合的熵/KL 估计 = 友好;全局精确信息估计 = 不友好**。
|
|
42
|
-
|
|
43
|
-
- **量化校准(per-block 熵/Hessian)**:局部、可批量 GEMM 化、低精度可行——友好(维度 1/2/5)。
|
|
44
|
-
- **KV-Cache 压缩(信息瓶颈/块摘要)**:低秩块摘要压缩显存——友好(维度 4);Plücker 式块摘要见 `../../references/books/algebraic-geometry-rising-sea.md`。
|
|
45
|
-
- **互信息剪枝/特征选择**:用局部或低秩近似估计 $I(X;Y)$ 则可改造;若需全分布精确估计则不友好。
|
|
46
|
-
- **信息增益路由**:全局精确 $I(X;Y)$ 需 $O(n^2)$ 显存、高精度、不可融合——反模式;改用 softmax/热带门控等连续可微近似(维度 3/6/8)。
|
|
47
|
-
- **反模式**:在完整 token 分布上精确计算熵/互信息——显存爆炸、需 fp64、串行依赖,"美但不可算"。
|
|
48
|
-
|
|
49
|
-
八维最低判定(正式术语):**张量化**看熵/KL/MI 是否可按 token/block/batch 估计;**GEMM 可映射**看压缩、投影、校准是否落线性代数;**复杂度**避免全分布精确估计;**显存与 KV-Cache**量化 KV/激活/码本占用;**低精度稳定**检查 log/softmax/KL 动态范围;**并行与通信**看分块统计是否可跨设备归约;**稀疏结构**看码本/路由是否块结构化;**算子融合**看统计、mask、量化能否融合。
|
|
50
|
-
|
|
51
|
-
> 配合 `../../references/books/matrix-analysis.md`(低秩压缩)、`../../references/books/abstract-algebra.md`(编码/有限域)。
|
|
52
|
-
|
|
53
|
-
## 不适用场景 / When NOT to Use
|
|
54
|
-
|
|
55
|
-
- **问题无概率结构**(如纯粹符号推理、逻辑演绎)——熵与信息增益需要概率分布,无概率则无信息论。
|
|
56
|
-
- **纯确定性场景无不确定性**(如已知精确答案的数学问题)——熵为零时信息论退化为平凡结论。
|
|
57
|
-
- **定性判断无需量化**(如美学评价、情感判断)——信息论量化的是概率意义上的不确定性,非语义歧义。
|
|
58
|
-
|
|
59
|
-
## 何时使用 / When to Use
|
|
60
|
-
|
|
61
|
-
- 需要度量不确定性的大小(熵 $H(X)$ 量化随机变量的"混乱程度")。
|
|
62
|
-
- 需要比较不同信息源的价值(互信息 $I(X;Y)$ 衡量哪个观察 $Y$ 最能减少关于 $X$ 的不确定性)。
|
|
63
|
-
- 需要最优数据压缩(信源编码定理保证最优压缩极限为 $H(X)$ bits/symbol)。
|
|
64
|
-
- 需要在噪声环境下可靠通信(信道编码定理保证 $R<C$ 时可靠传输可行)。
|
|
65
|
-
- 需要特征选择或模型选择(互信息筛选特征,AIC/BIC/MDL 作为信息准则选择模型)。
|
|
66
|
-
- 需要贝叶斯模型比较(KL 散度 $D(P\|Q)$ 衡量分布间信息距离,贝叶斯因子量化模型间证据比)。
|
|
67
|
-
- **为压缩 / KV-Cache 压缩 / 量化 / 路由设计信息准则**,并评估其 GPU 可行性。
|
|
68
|
-
|
|
69
|
-
## 方法流程 / Method
|
|
70
|
-
|
|
71
|
-
### 第一步:识别信息源与不确定度 / Identify Source and Uncertainty
|
|
72
|
-
- **随机变量 $X$** 是什么?——定义信息源,明确要研究的不确定性对象。
|
|
73
|
-
- **概率分布 $p(x)$**——离散分布用概率表,连续分布用密度函数。
|
|
74
|
-
- **计算 $H(X) = -\sum p(x)\log p(x)$**——量化当前不确定性水平。
|
|
75
|
-
- **识别要减少的不确定性**——明确"知道什么之后不确定性会降低?"
|
|
76
|
-
|
|
77
|
-
### 第二步:量化信息增益 / Quantify Information Gain
|
|
78
|
-
- **计算条件熵 $H(X|Y)$**——观察 $Y$ 之后 $X$ 的剩余不确定性。
|
|
79
|
-
- **计算互信息 $I(X;Y) = H(X) - H(X|Y)$**——$Y$ 对 $X$ 提供的信息量。
|
|
80
|
-
- **识别最优观察**——哪个 $Y$ 使 $I(X;Y)$ 最大?该观察最值得获取。
|
|
81
|
-
- **链式规则**——$H(X_1,\dots,X_n) = H(X_1) + H(X_2|X_1) + \dots + H(X_n|X_1,\dots,X_{n-1})$,逐变量拆解联合不确定性。
|
|
82
|
-
|
|
83
|
-
### 第三步:选择编码策略 / Choose Coding Strategy
|
|
84
|
-
- **信源编码(压缩)**:Huffman 编码(贪心最优前缀码,平均长度接近 $H(X)$)、算术编码(更接近熵限)、通用编码(LZ77/LZ78/LZW,无需已知分布)。
|
|
85
|
-
- **信道编码(纠错)**:Hamming 码(最小距离 3,纠正 1 位错)、Reed-Solomon 码(突发纠错)、LDPC/Turbo 码(逼近 Shannon 极限)。
|
|
86
|
-
- **编码选择原则**:压缩需求用信源编码→逼近 $H(X)$;噪声防护用信道编码→逼近 Shannon 极限 ($R\to C$)。
|
|
87
|
-
|
|
88
|
-
### 第四步:评估信道容量 / Evaluate Channel Capacity
|
|
89
|
-
- **计算信道容量 $C = \max_{p(x)} I(X;Y)$**——在所有输入分布上最大化互信息。
|
|
90
|
-
- **比较传输速率 $R$ 与容量 $C$**:$R<C$ → 可靠通信可行;$R>C$ → 必定出错。
|
|
91
|
-
- **噪声模型**:BSC(二元对称信道,翻转概率 $p$)、BEC(二元擦除信道,擦除概率 $\varepsilon$)、AWGN(加性白高斯噪声信道)。
|
|
92
|
-
- **容量公式示例**:BSC 容量 $C = 1 - H(p)$;AWGN 容量 $C = \frac{1}{2}\log(1 + S/N)$。
|
|
93
|
-
|
|
94
|
-
### 第五步:应用信息准则 / Apply Information Criteria
|
|
95
|
-
- **AIC(赤池信息准则)**:$\text{AIC} = -2\ln L + 2k$——偏重拟合,适合预测目标。
|
|
96
|
-
- **BIC(贝叶斯信息准则)**:$\text{BIC} = -2\ln L + k\ln n$——偏重简约,适合解释目标。
|
|
97
|
-
- **KL 散度 $D_{KL}(P\|Q) = \sum p(x)\log\frac{p(x)}{q(x)}$**——衡量用 $Q$ 替代 $P$ 的信息损失,注意不对称性。
|
|
98
|
-
- **MDL 原则(最小描述长度)**:选择使"数据描述长度 + 模型描述长度"最小的模型——信息论版本的奥卡姆剃刀。
|
|
99
|
-
|
|
100
|
-
### 第六步:做出信息最优决策 / Make Information-Optimal Decision
|
|
101
|
-
- **贝叶斯实验设计**:选择使期望信息增益 $\max\,\mathbb{E}[I(\theta;Y)]$ 最大的实验——优先获取最能减少不确定性的数据。
|
|
102
|
-
- **最小化 KL 散度**:决策输出分布 $Q$ 应尽量接近目标分布 $P$,即 $\min D(P\|Q)$。
|
|
103
|
-
- **最大熵原则**:在已知约束下选择使 $H(X)$ 最大的分布——最少假设,最保守推断。
|
|
104
|
-
- **信息瓶颈**:$\min I(X;T) - \beta I(T;Y)$——在压缩 $X$ 为 $T$ 时保留关于 $Y$ 的最大相关信息。
|
|
105
|
-
|
|
106
|
-
## 常见错误 / Common Errors
|
|
107
|
-
|
|
108
|
-
| 错误 / Error | 批评 / Critique | 正确做法 / Correct Approach |
|
|
109
|
-
|---|---|---|
|
|
110
|
-
| 把信息等同于比特而非概率减少 | 熵 $H(X)$ 是概率分布的函数,比特只是量化单位 | 理解信息为不确定性的减少 $I(X;Y)=H(X)-H(X\|Y)$ |
|
|
111
|
-
| 忽视信道容量极限 | $R>C$ 时无论何种编码都不能可靠通信 | 计算容量 $C=\max I(X;Y)$,确保 $R<C$ |
|
|
112
|
-
| 混淆熵与方差 | 熵度量概率结构的"扩散度",方差度量数值"展开度",两者不等价 | 概率不确定性用熵,数值偏差用方差;连续熵可为负 |
|
|
113
|
-
| 过度压缩低于熵限 | 最优压缩 $\ge H(X)$ bits/symbol,低于此限必然丢信息 | 接受熵限并据此设计编码 |
|
|
114
|
-
| 忽视 KL 散度不对称性 | $D(P\|Q)\ne D(Q\|P)$,方向不同含义不同 | 明确方向:$D(P\|Q)$ 用于"用 $Q$ 编码 $P$ 的额外代价" |
|
|
115
|
-
| 把相关性等同于信息 | 相关 $\rho$ 仅衡量线性关联;$I(X;Y)=0 \Leftrightarrow$ 独立,但 $\rho=0 \not\Rightarrow$ 独立 | 用互信息 $I(X;Y)$ 评估依赖关系 |
|
|
116
|
-
| 把定性判断强行量化 | 信息论量化概率不确定性,非语义歧义或主观感受 | 区分概率不确定性与语义歧义,不对定性问题套熵公式 |
|
|
117
|
-
| 全局精确熵/互信息不可算 | 在完整分布上精确估计 $I(X;Y)$ 需 $O(n^2)$ 显存与高精度,GPU 不可行 | 用局部/采样/低秩估计,过 GPU 八维门 |
|
|
118
|
-
|
|
119
|
-
## 操作规程 / Operating Procedure
|
|
120
|
-
|
|
121
|
-
当本 skill 被触发时,输出必须包含:
|
|
122
|
-
|
|
123
|
-
1. **[信息源]:[描述]** $H(X)=$ [值]——定义随机变量 $X$,计算其熵,量化当前不确定性。
|
|
124
|
-
2. **[信息增益]:[描述]** $I(X;Y)=$ [值]——计算互信息,识别最有价值的观察 $Y$。
|
|
125
|
-
3. **[编码策略]:[选择]**——信源编码(压缩)或信道编码(纠错),说明逼近哪种极限。
|
|
126
|
-
4. **[信道容量]:[描述]** $C=$ [值]——计算信道容量,比较传输速率 $R$ 与 $C$。
|
|
127
|
-
5. **[信息准则]:[AIC/BIC/KL/MDL]**——说明选择的信息准则及理由。
|
|
128
|
-
6. **[最优决策]:[说明]**——基于信息增益最大化或 KL 散度最小化的决策建议。
|
|
129
|
-
7. **[GPU 可行性]**(若用于压缩/KV 压缩/量化/路由)——熵/KL/互信息估计是局部可融合还是全局精确?过八维门,标注友好/可改造/不友好 + 改造建议。
|
|
130
|
-
|
|
131
|
-
**输出不得只给分析而无结论。**
|
|
132
|
-
|
|
133
|
-
## 与其他 skill 的关系 / Relations to Other Skills
|
|
134
|
-
|
|
135
|
-
- **概率与统计**:熵与信息增益补充概率推理——$H(X)$ 度量分布不确定性,$I(X;Y)$ 是贝叶斯更新的信息论表达。
|
|
136
|
-
- **优化思想**:信道容量最大化是优化问题——$C=\max_{p(x)} I(X;Y)$ 是输入分布上的最优化。
|
|
137
|
-
- **变换思想**:编码是信息空间的变换——信源编码变换为高效表示,信道编码变换为抗干扰表示。
|
|
138
|
-
- **建模思想**:信息准则指导模型选择——AIC/BIC/MDL 从信息论角度量化拟合与复杂度权衡。
|
|
139
|
-
- **算法思想**:压缩算法是计算实现——Huffman/LZ/LDPC 等算法是信息论极限的逼近实现。
|
|
140
|
-
- **现代数学激活**:`../../references/books/matrix-analysis.md`(低秩压缩)、`../../references/books/abstract-algebra.md`(编码/有限域)、`../../references/books/algebraic-geometry-rising-sea.md`(Plücker KV 压缩)。
|