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.
- package/README.en-US.md +165 -198
- package/README.md +165 -198
- package/agents/math-critic.en.md +28 -26
- package/agents/math-critic.md +33 -33
- package/commands/ask.en.md +10 -0
- 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/agentic-workflow.en.md +1 -1
- package/references/agentic-workflow.md +1 -1
- package/references/books/abstract-algebra.en.md +124 -0
- package/references/books/abstract-algebra.md +22 -22
- package/references/books/algebraic-geometry-rising-sea.en.md +171 -0
- package/references/books/algebraic-geometry-rising-sea.md +11 -11
- package/references/books/differential-geometry.en.md +140 -0
- package/references/books/differential-geometry.md +19 -19
- package/references/books/matrix-analysis.en.md +146 -0
- package/references/books/matrix-analysis.md +10 -10
- package/references/books/micro-lie-theory.en.md +116 -0
- package/references/books/micro-lie-theory.md +17 -17
- package/references/books/optimization-ml.en.md +163 -0
- package/references/books/optimization-ml.md +7 -8
- package/references/books/smooth-manifolds.en.md +105 -0
- package/references/books/smooth-manifolds.md +14 -14
- package/references/gpu-friendly-math.en.md +23 -10
- package/references/gpu-friendly-math.md +17 -4
- package/references/inspiration.en.md +1 -1
- package/references/inspiration.md +2 -2
- package/skills/math-research-activator/SKILL.en.md +195 -114
- package/skills/math-research-activator/SKILL.md +194 -119
- 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
|
-
---
|
|
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 压缩)。
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
# Mathematical Sources and Classic Texts
|
|
2
|
-
|
|
3
|
-
## Shannon's Information Theory (1948)
|
|
4
|
-
|
|
5
|
-
> H(X) = -Sum p(x) log p(x) -- Entropy, the average uncertainty of an information source
|
|
6
|
-
> I(X;Y) = H(X) - H(X|Y) -- Mutual information, the information contribution of observing Y about X
|
|
7
|
-
> C = max_{p(x)} I(X;Y) -- Channel capacity, the upper bound on the rate of reliable communication
|
|
8
|
-
>
|
|
9
|
-
> Source coding theorem: optimal compression >= H(X) bits/symbol
|
|
10
|
-
> Channel coding theorem: when R < C, there exists a coding scheme that drives the error rate to zero
|
|
11
|
-
|
|
12
|
-
**Meaning**: Information can be precisely quantified; there exist insurmountable mathematical limits on compression and communication, not merely limits imposed by the current state of engineering. Entropy measures "average surprise" -- low-probability events carry more information when they occur. Mutual information measures "reduction in uncertainty" -- how much observing Y reduces our uncertainty about X.
|
|
13
|
-
|
|
14
|
-
**Mathematical background**: Claude Shannon founded information theory in "A Mathematical Theory of Communication" (1948). Core contributions: (1) Defined entropy H(X) = -Sum p(x) log p(x), where the choice of logarithm base determines the unit (base 2 -> bits, base e -> nats); (2) The source coding theorem proves that the average length L of an optimal prefix code satisfies L >= H(X), with equality if and only if all probabilities are powers of 2; (3) The channel coding theorem proves that when R < C there exist coding sequences such that P(error) -> 0, while for R > C, P(error) > 0 is unavoidable. Shannon's proofs use random coding arguments -- constructing a random codebook and then showing that the error rate of a "typical" code approaches zero, thereby establishing the existence of at least one such code.
|
|
15
|
-
|
|
16
|
-
## Huffman Coding (1952)
|
|
17
|
-
|
|
18
|
-
> Greedy construction of optimal prefix codes: repeatedly merge the two symbols with the smallest probabilities, building the tree bottom-up.
|
|
19
|
-
> Average code length L(Huffman) <= H(X) + 1; when probabilities are powers of 2, L = H(X).
|
|
20
|
-
|
|
21
|
-
**Meaning**: An optimal prefix code (unambiguously decodable) can be constructed exactly via a greedy algorithm, with average length approaching the entropy bound.
|
|
22
|
-
|
|
23
|
-
**Mathematical background**: David Huffman published this algorithm in 1952 as an MIT student, proving its optimality. Huffman coding is a variable-length prefix code -- more frequent symbols receive shorter codewords, and the prefix condition guarantees that no codeword is a prefix of another, enabling instantaneous decoding. When symbol probabilities are not all powers of 2, the average length of Huffman coding is strictly greater than H(X); arithmetic coding encodes an entire message as an interval and can approach the entropy bound more closely.
|
|
24
|
-
|
|
25
|
-
## Hamming Codes (1950)
|
|
26
|
-
|
|
27
|
-
> [7,4] Hamming code: 4 information bits + 3 parity bits = 7-bit codeword, minimum Hamming distance d_min = 3
|
|
28
|
-
> Can correct 1-bit errors or detect 2-bit errors
|
|
29
|
-
> General [2^r - 1, 2^r - 1 - r] Hamming code: r parity bits, minimum distance 3
|
|
30
|
-
|
|
31
|
-
**Meaning**: The first systematic construction of error-correcting codes -- a small amount of redundancy can protect information from corruption by noise.
|
|
32
|
-
|
|
33
|
-
**Mathematical background**: Richard Hamming, working at Bell Labs, designed the first systematic error-correcting code after hardware errors in early computers caused his programs to crash. Hamming distance d(x,y) = the number of positions at which two binary strings differ; a minimum distance d_min >= 2t+1 allows correction of t-bit errors. Hamming codes are perfect codes -- the sphere packing exactly fills the entire space. Subsequent developments: Reed-Solomon codes (1960) for burst error correction and CD/DVD; LDPC codes (Gallager 1962) and Turbo codes (1993) approach the Shannon limit.
|
|
34
|
-
|
|
35
|
-
## Kolmogorov Complexity (1965)
|
|
36
|
-
|
|
37
|
-
> K(x) = the length of the shortest program that outputs x (on a universal Turing machine)
|
|
38
|
-
> Kolmogorov complexity is an algorithmic measure of information -- complementary to Shannon entropy
|
|
39
|
-
>
|
|
40
|
-
> Uncomputability: K(x) is not computable in general (Chaitin's incompleteness theorem)
|
|
41
|
-
|
|
42
|
-
**Meaning**: The shortest program description length is the intrinsic information content of an object -- a more fundamental measure of information than Shannon entropy, independent of any probability distribution.
|
|
43
|
-
|
|
44
|
-
**Mathematical background**: Andrey Kolmogorov proposed algorithmic information theory in 1965, defining K(x) as the length |p| of the shortest program p that outputs x on a universal Turing machine U: K_U(x) = min{|p| : U(p) = x}. Key properties: (1) Uncomputability -- no algorithm can compute K(x) in general; (2) Invariance theorem -- the values of K_U(x) on different universal Turing machines differ by at most a constant c (depending on the choice of machine); (3) Relation to entropy -- for i.i.d. sequences, E[K(x)] is approximately nH(X) (the algorithmic analogue of Shannon entropy); (4) Chaitin's incompleteness theorem -- a formal system cannot prove K(x) > c for most x. Kolmogorov complexity is the theoretical foundation of the MDL principle.
|
|
45
|
-
|
|
46
|
-
## KL Divergence (Kullback-Leibler, 1951)
|
|
47
|
-
|
|
48
|
-
> D(P||Q) = Sum p(x) log(p(x)/q(x)) = E_P[log(p(X)/q(X))]
|
|
49
|
-
>
|
|
50
|
-
> D(P||Q) >= 0, with equality if and only if P = Q
|
|
51
|
-
> D(P||Q) is not equal to D(Q||P) -- it is asymmetric
|
|
52
|
-
> D(P||Q) is not a distance (asymmetric, does not satisfy the triangle inequality)
|
|
53
|
-
|
|
54
|
-
**Meaning**: KL divergence measures "the number of extra bits needed to encode data from distribution P using distribution Q" -- a one-directional measure of information loss.
|
|
55
|
-
|
|
56
|
-
**Mathematical background**: Solomon Kullback and Richard Leibler proposed relative entropy in 1951, defined as D(P||Q) = Sum p(x) log(p(x)/q(x)). Core properties: (1) Non-negativity D(P||Q) >= 0 (proved via Gibbs' inequality); (2) Asymmetry D(P||Q) is not equal to D(Q||P) -- the interpretation of D(P||Q) is "the expected extra length of encoding data from P using Q," and the direction cannot be interchanged; (3) Relation to mutual information: I(X;Y) = D(p(x,y)||p(x)p(y)) -- mutual information is the KL divergence between the joint distribution and the product of the marginals; (4) Relation to entropy: H(P) + D(P||Q) = Sum p(x)(-log q(x)) -- cross-entropy equals entropy plus KL divergence. The cross-entropy loss function is central to deep learning: minimizing H(P) + D(P||Q) = minimizing Sum p(x)(-log q(x)).
|
|
57
|
-
|
|
58
|
-
## Rate-Distortion Theory (Shannon, 1959)
|
|
59
|
-
|
|
60
|
-
> R(D) = min_{p(z|x): E[d(x,z)] <= D} I(X;Z)
|
|
61
|
-
>
|
|
62
|
-
> The minimum rate R(D) required under an allowed distortion D
|
|
63
|
-
> R(0) = H(X) (lossless compression), R(D_max) = 0 (maximum allowable distortion)
|
|
64
|
-
|
|
65
|
-
**Meaning**: Lossy compression has a fundamental limit given by the rate-distortion function R(D) -- lower rates require accepting greater distortion.
|
|
66
|
-
|
|
67
|
-
**Mathematical background**: Shannon extended the source coding theorem to lossy compression in 1959. The rate-distortion function R(D) is defined as the minimum of mutual information I(X;Z) subject to the constraint that expected distortion E[d(x,z)] <= D. The distortion measure d(x,z) can be Hamming distortion (binary), squared error (continuous), etc. R(D) is monotonically decreasing and convex -- greater tolerance for distortion yields lower required rate. The inverse function D(R) gives the minimum achievable distortion at a given rate. Practical applications: JPEG/MPEG compression, speech coding, and related technologies follow this theoretical framework.
|
|
68
|
-
|
|
69
|
-
## Fisher Information (1925)
|
|
70
|
-
|
|
71
|
-
> I(theta) = E[(d log f(X;theta)/d theta)^2] = -E[d^2 log f(X;theta)/d theta^2]
|
|
72
|
-
>
|
|
73
|
-
> Cramer-Rao lower bound: Var(theta_hat) >= 1/I(theta), for any unbiased estimator theta_hat
|
|
74
|
-
> Fisher information measures the information content of data about parameter theta
|
|
75
|
-
|
|
76
|
-
**Meaning**: Fisher information is the information-theoretic measure in statistical inference -- it connects information theory to the theoretical limits of parameter estimation.
|
|
77
|
-
|
|
78
|
-
**Mathematical background**: R.A. Fisher proposed the concept of information content I(theta) in 1925, measuring the discriminative power of a single observation with respect to parameter theta. Cramer (1946) and Rao (1945) independently proved the Cramer-Rao lower bound Var(theta_hat) >= 1/(nI(theta)). Key connections: (1) Fisher information and KL divergence -- I(theta) = lim_{theta' -> theta} 2D(f(x;theta)||f(x;theta'))/(theta - theta')^2, the local second-order approximation of KL divergence; (2) Fisher information and Bayesian information -- the Jeffreys prior p(theta) proportional to |I(theta)|^(1/2) makes the volume uniform under the Fisher information metric in parameter space; (3) Large-sample properties of maximum likelihood estimation -- theta_hat_MLE is asymptotically normal N(theta, 1/(nI(theta))), achieving the Cramer-Rao lower bound. Fisher information is the bridge between information theory and statistical inference.
|
|
79
|
-
|
|
80
|
-
## MDL Principle (Rissanen, 1978)
|
|
81
|
-
|
|
82
|
-
> MDL(M, D) = L(D|M) + L(M)
|
|
83
|
-
>
|
|
84
|
-
> Choose the model that minimizes "description length of data given the model + description length of the model itself"
|
|
85
|
-
> L(D|M) = -log P(D|M) (negative log-likelihood of the data)
|
|
86
|
-
> L(M) = model encoding length (complexity penalty)
|
|
87
|
-
|
|
88
|
-
**Meaning**: MDL is the information-theoretic version of Occam's razor -- a good model is both accurate (short data description) and parsimonious (short model description).
|
|
89
|
-
|
|
90
|
-
**Mathematical background**: Jorma Rissanen proposed the Minimum Description Length principle in 1978, reducing model selection to a coding problem. Relationships between MDL and other criteria: (1) MDL and BIC -- two-part MDL (L(D|M) + L(M)) is asymptotically equivalent to BIC (-2 ln L + k ln(n)) for large samples; (2) MDL and Kolmogorov complexity -- ideal MDL uses Kolmogorov complexity K(M) to measure model complexity, but K(M) is uncomputable; practical MDL approximates it with parameter encoding length. Normalized MDL (1996) uses mixture coding to handle parameters, avoiding the arbitrary-precision problem. The central insight of MDL: model selection is fundamentally data compression -- the best model is the one that compresses the data best.
|
|
91
|
-
|
|
92
|
-
## Mutual Information and Channel Capacity
|
|
93
|
-
|
|
94
|
-
> I(X;Y) = H(X) - H(X|Y) = H(Y) - H(Y|X) = H(X) + H(Y) - H(X,Y)
|
|
95
|
-
>
|
|
96
|
-
> Symmetry of mutual information: I(X;Y) = I(Y;X)
|
|
97
|
-
> Non-negativity of mutual information: I(X;Y) >= 0, with equality if and only if X and Y are independent
|
|
98
|
-
>
|
|
99
|
-
> Channel capacity C = max_{p(x)} I(X;Y)
|
|
100
|
-
> Typical set A_epsilon^n: {x^n : |-log p(x^n)/n - H(X)| < epsilon}
|
|
101
|
-
|
|
102
|
-
**Meaning**: Mutual information is a precise measure of the dependence between two random variables -- it is zero if and only if they are independent, and positive if statistical association exists. Channel capacity is the maximum of mutual information over all input distributions, defining the theoretical limit of reliable communication.
|
|
103
|
-
|
|
104
|
-
**Mathematical background**: Mutual information I(X;Y) = Sum p(x,y) log(p(x,y)/(p(x)p(y))) = D(p(x,y)||p(x)p(y)) -- the KL divergence between the joint distribution and the product of the marginals. The typical set is the key tool in Shannon's proofs of coding theorems: for an i.i.d. source X^n, typical sequences x^n satisfy |-1/n log p(x^n) - H(X)| < epsilon; the probability of the typical set approaches 1 (as n -> infinity), yet the size of the typical set is approximately 2^{nH(X)}, far smaller than the entire space 2^n (when H(X) < 1). This explains why compression to nH(X) bits suffices to cover nearly all valid sequences.
|
|
105
|
-
|
|
106
|
-
## Joint Entropy, Conditional Entropy, and Chain Rules
|
|
107
|
-
|
|
108
|
-
> H(X,Y) = H(X) + H(Y|X) -- Chain rule for joint entropy
|
|
109
|
-
> H(Y|X) = Sum p(x) H(Y|X=x) -- Conditional entropy
|
|
110
|
-
> I(X;Y) = H(X) - H(X|Y) = H(Y) - H(Y|X) -- Mutual information
|
|
111
|
-
> I(X;Y|Z) = H(X|Z) - H(X|Y,Z) -- Conditional mutual information
|
|
112
|
-
> Chain expansion of I(X1;X2;...;Xn): I(X;Y,Z) = I(X;Y) + I(X;Z|Y)
|
|
113
|
-
|
|
114
|
-
**Meaning**: The chain rule for entropy decomposes joint uncertainty into the contributions of individual variables -- enabling an understanding of the information structure of multivariate systems.
|
|
115
|
-
|
|
116
|
-
**Mathematical background**: Joint entropy H(X,Y) = -Sum p(x,y) log p(x,y) measures the total uncertainty of a pair of random variables. The chain rule H(X,Y) = H(X) + H(Y|X) states: once X is known, the additional uncertainty of Y is H(Y|X). Generalized to n variables: H(X1,...,Xn) = Sum_i H(Xi|X1,...,Xi-1). Conditional mutual information I(X;Y|Z) measures "the additional information that Y provides about X, given that Z is already known" -- a key tool in information bottleneck methods and causal inference. The chain expansion of multivariate mutual information: I(X;Y,Z) = I(X;Y) + I(X;Z|Y), showing that the joint information of Y and Z about X equals the direct information from Y plus the conditional information from Z.
|
|
117
|
-
|
|
118
|
-
## Everyday Insights from Information Theory and Coding Theory
|
|
119
|
-
|
|
120
|
-
> "The core of information theory is not about computing precise bit counts, but about cultivating the habit of mind that uncertainty is quantifiable, information has value, and fundamental limits cannot be transcended."
|
|
121
|
-
|
|
122
|
-
- Do not ignore uncertainty -- entropy H(X) quantifies it
|
|
123
|
-
- Information has direction and magnitude -- mutual information I(X;Y) measures it
|
|
124
|
-
- Compression has limits -- the source coding theorem defines them
|
|
125
|
-
- Communication has limits -- the channel coding theorem defines them
|
|
126
|
-
- Model selection has information-theoretic criteria -- AIC/BIC/MDL guide it
|
|
127
|
-
- There is an information-theoretic distance between probability distributions -- KL divergence measures it
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
# 数学出处与经典文献 / Mathematical Sources and Classic Texts
|
|
2
|
-
|
|
3
|
-
## Shannon 信息论 / Shannon's Information Theory (1948)
|
|
4
|
-
|
|
5
|
-
> H(X) = −Σ p(x) log p(x) —— 熵,信息源的平均不确定性
|
|
6
|
-
> I(X;Y) = H(X) − H(X|Y) —— 互信息,观察 Y 对 X 的信息贡献
|
|
7
|
-
> C = max_{p(x)} I(X;Y) —— 信道容量,可靠通信的速率上限
|
|
8
|
-
>
|
|
9
|
-
> 信源编码定理:最优压缩 ≥ H(X) bits/symbol
|
|
10
|
-
> 信道编码定理:R < C 时存在编码方案使误码率趋零
|
|
11
|
-
|
|
12
|
-
**含义**:信息可以被精确量化;压缩与通信存在不可逾越的数学极限,而非仅受工程水平限制。熵度量"平均惊奇"——低概率事件发生时带来的信息量更大。互信息度量"不确定性减少"——观察 Y 使我们对 X 的不确定降低了多少。
|
|
13
|
-
|
|
14
|
-
**数学背景**:Claude Shannon 在《A Mathematical Theory of Communication》(1948) 中创立信息论。核心贡献:(1) 定义熵 H(X) = −Σ p(x) log p(x),对数基底选择决定单位(基底 2 → bits,基底 e → nats);(2) 信源编码定理证明最优前缀码平均长度 L ≥ H(X),等号当且仅当所有概率为 2 的幂次时成立;(3) 信道编码定理证明 R < C 时存在编码序列使 P(error) → 0,R > C 时 P(error) > 0 不可避免。Shannon 的证明是随机编码论证——构造随机码本后证明"典型"码的误码率趋零,再指出至少存在一个这样的码。
|
|
15
|
-
|
|
16
|
-
## Huffman 编码 / Huffman Coding (1952)
|
|
17
|
-
|
|
18
|
-
> 贪心构造最优前缀码:每次合并概率最小的两个符号,自底向上建树。
|
|
19
|
-
> 平均编码长度 L(Huffman) ≤ H(X) + 1,当概率为 2 的幂次时 L = H(X)。
|
|
20
|
-
|
|
21
|
-
**含义**:最优前缀码(无歧义解码)可通过贪心算法精确构造,平均长度接近熵限。
|
|
22
|
-
|
|
23
|
-
**数学背景**:David Huffman 在 1952 年作为 MIT 学生发表此算法,证明其最优性。Huffman 编码是变长前缀码——较频繁的符号用较短的码字,保证任何码字不是另一码字的前缀(前缀条件),从而可即时解码(instantaneous decoding)。当符号概率不全是 2 的幂次时,Huffman 编码平均长度严格大于 H(X);算术编码将整个消息编码为一个区间,可更接近熵限。
|
|
24
|
-
|
|
25
|
-
## Hamming 码 / Hamming Codes (1950)
|
|
26
|
-
|
|
27
|
-
> [7,4] Hamming 码:4 位信息 + 3 位校验 = 7 位码字,最小 Hamming 距离 d_min = 3
|
|
28
|
-
> 可纠正 1 位错误或检测 2 位错误
|
|
29
|
-
> 一般 [2^r−1, 2^r−1−r] Hamming 码:r 位校验,最小距离 3
|
|
30
|
-
|
|
31
|
-
**含义**:纠错编码的第一个系统构造——少量冗余即可保护信息免受噪声损坏。
|
|
32
|
-
|
|
33
|
-
**数学背景**:Richard Hamming 在 Bell 实验室工作时,因早期计算机的硬件错误导致程序崩溃,于是设计了第一个系统化的纠错码。Hamming 距离 d(x,y) = 两个二进制串不同位置的个数;最小距离 d_min ≥ 2t+1 时可纠正 t 位错误。Hamming 码是完美码(perfect code)——球 packing 恰好填满整个空间。后续发展:Reed-Solomon 码(1960)用于突发纠错和 CD/DVD;LDPC 码(Gallager 1962)和 Turbo 码(1993)逼近 Shannon 极限。
|
|
34
|
-
|
|
35
|
-
## Kolmogorov 复杂度 / Kolmogorov Complexity (1965)
|
|
36
|
-
|
|
37
|
-
> K(x) = 输出 x 的最短程序长度(在通用 Turing 机上)
|
|
38
|
-
> Kolmogorov 复杂度是信息的算法度量——与 Shannon 熵互补
|
|
39
|
-
>
|
|
40
|
-
> 不可计算性:K(x) 不可一般计算(Chaitin 不完备定理)
|
|
41
|
-
|
|
42
|
-
**含义**:最短程序描述长度是对象的内在信息量——比 Shannon 熵更本质的信息度量,不依赖概率分布。
|
|
43
|
-
|
|
44
|
-
**数学背景**:Andrey Kolmogorov 在 1965 年提出算法信息论,定义 K(x) 为在通用 Turing 机 U 上输出 x 的最短程序 |p| 的长度:K_U(x) = min{|p| : U(p) = x}。关键性质:(1) 不可计算性——不存在算法一般地计算 K(x);(2) 不变定理——不同通用 Turing 机上的 K_U(x) 差异至多为常数 c(依赖于机器选择);(3) 与熵的关系——对 i.i.d. 序列,E[K(x)] ≈ nH(X)(Shannon 熵的算法版本);(4) Chaitin 不完备定理——形式系统不能证明 K(x) > c 对大多数 x 成立。Kolmogorov 复杂度是 MDL 原则的理论根基。
|
|
45
|
-
|
|
46
|
-
## KL 散度 / KL Divergence (Kullback-Leibler, 1951)
|
|
47
|
-
|
|
48
|
-
> D(P||Q) = Σ p(x) log(p(x)/q(x)) = E_P[log(p(X)/q(X))]
|
|
49
|
-
>
|
|
50
|
-
> D(P||Q) ≥ 0,等号当且仅当 P = Q
|
|
51
|
-
> D(P||Q) ≠ D(Q||P)——不对称
|
|
52
|
-
> D(P||Q) 不是距离(不对称、不满足三角不等式)
|
|
53
|
-
|
|
54
|
-
**含义**:KL 散度度量"用 Q 分布编码 P 分布的数据所需的额外比特数"——信息损失的单向度量。
|
|
55
|
-
|
|
56
|
-
**数学背景**:Solomon Kullback 与 Richard Leibler 在 1951 年提出相对熵(relative entropy),定义为 D(P||Q) = Σ p(x) log(p(x)/q(x))。核心性质:(1) 非负性 D(P||Q) ≥ 0(由 Gibbs 不等式证明);(2) 不对称性 D(P||Q) ≠ D(Q||P)——D(P||Q) 的解释是"用 Q 编码 P 的数据的期望额外长度",方向不可互换;(3) 与互信息的关系 I(X;Y) = D(p(x,y)||p(x)p(y))——互信息是联合分布与独立假设分布间的 KL 散度;(4) 与熵的关系 H(P) + D(P||Q) = Σ p(x)(−log q(x))——交叉熵 = 熵 + KL 散度。交叉熵损失函数是深度学习的核心:min H(P) + D(P||Q) = min Σ p(x)(−log q(x))。
|
|
57
|
-
|
|
58
|
-
## 码率-失真理论 / Rate-Distortion Theory (Shannon, 1959)
|
|
59
|
-
|
|
60
|
-
> R(D) = min_{p(z|x): E[d(x,z)]≤D} I(X;Z)
|
|
61
|
-
>
|
|
62
|
-
> 在允许失真 D 的条件下,所需的最小码率 R(D)
|
|
63
|
-
> R(0) = H(X)(无损压缩),R(D_max) = 0(最大允许失真)
|
|
64
|
-
|
|
65
|
-
**含义**:有损压缩存在码率-失真函数 R(D) 的基本极限——更低的码率需要接受更大的失真。
|
|
66
|
-
|
|
67
|
-
**数学背景**:Shannon 在 1959 年扩展信源编码定理到有损压缩情形。码率-失真函数 R(D) 定义为在期望失真 E[d(x,z)] ≤ D 的约束下最小化互信息 I(X;Z)。失真度量 d(x,z) 可选 Hamming 失真(二元)、平方误差(连续)等。R(D) 单调递减、凸函数——失真容忍越大,所需码率越低。逆函数 D(R) 给出给定码率下的最小可达失真。实际应用:JPEG/MPEG 压缩、语音编码等遵循此理论框架。
|
|
68
|
-
|
|
69
|
-
## Fisher 信息 / Fisher Information (1925)
|
|
70
|
-
|
|
71
|
-
> I(θ) = E[(∂log f(X;θ)/∂θ)²] = −E[∂²log f(X;θ)/∂θ²]
|
|
72
|
-
>
|
|
73
|
-
> Cramér-Rao 下界:Var(θ̂) ≥ 1/I(θ),对任何无偏估计量 θ̂
|
|
74
|
-
> Fisher 信息度量数据对参数 θ 的信息含量
|
|
75
|
-
|
|
76
|
-
**含义**:Fisher 信息是统计推断的信息论度量——它连接了信息论与参数估计的理论极限。
|
|
77
|
-
|
|
78
|
-
**数学背景**:R.A. Fisher 在 1925 年提出信息量概念 I(θ),度量一个观测对参数 θ 的区分能力。Cramér (1946) 与 Rao (1945) 分别独立证明了 Cramér-Rao 下界 Var(θ̂) ≥ 1/nI(θ)。关键联系:(1) Fisher 信息与 KL 散度——I(θ) = lim_{θ'→θ} 2D(f(x;θ)||f(x;θ'))/(θ−θ')²,KL 散度的局部二阶近似;(2) Fisher 信息与 Bayesian 信息——Jeffreys 先验 p(θ) ∝ |I(θ)|^(1/2) 使得参数空间中 Fisher 信息度量下的体积均匀;(3) 最大似然估计的大样本性质——θ̂_MLE 渐近正态 N(θ, 1/nI(θ)),达到 Cramér-Rao 下界。Fisher 信息是信息论与统计推断的桥梁。
|
|
79
|
-
|
|
80
|
-
## MDL 原则 / MDL Principle (Rissanen, 1978)
|
|
81
|
-
|
|
82
|
-
> MDL(M, D) = L(D|M) + L(M)
|
|
83
|
-
>
|
|
84
|
-
> 选择使"数据给定模型的描述长度 + 模型本身的描述长度"最小的模型
|
|
85
|
-
> L(D|M) = −log P(D|M)(数据的负对数似然)
|
|
86
|
-
> L(M) = 模型编码长度(复杂度惩罚)
|
|
87
|
-
|
|
88
|
-
**含义**:MDL 是信息论版本的奥卡姆剃刀——好模型既准确(数据描述短)又简约(模型描述短)。
|
|
89
|
-
|
|
90
|
-
**数学背景**:Jorma Rissanen 在 1978 年提出最小描述长度原则,将模型选择转化为编码问题。MDL 与其他准则的关系:(1) MDL 与 BIC——两参数 MDL(L(D|M)+L(M))与 BIC (−2lnL+k·ln(n)) 在大样本下等价;(3) MDL 与 Kolmogorov 复杂度——理想 MDL 用 Kolmogorov 复杂度 K(M) 庡量模型复杂度,但 K(M) 不可计算;实际 MDL 用参数编码长度近似。先验 MDL(1996)用混合编码处理参数,避免任意精度问题。MDL 的核心洞见:模型选择本质上是数据压缩——最好的模型是压缩数据最好的模型。
|
|
91
|
-
|
|
92
|
-
## 互信息与信道容量 / Mutual Information and Channel Capacity
|
|
93
|
-
|
|
94
|
-
> I(X;Y) = H(X) − H(X|Y) = H(Y) − H(Y|X) = H(X) + H(Y) − H(X,Y)
|
|
95
|
-
>
|
|
96
|
-
> 互信息的对称性:I(X;Y) = I(Y;X)
|
|
97
|
-
> 互信息的非负性:I(X;Y) ≥ 0,等号当且仅当 X,Y 独立
|
|
98
|
-
>
|
|
99
|
-
> 信道容量 C = max_{p(x)} I(X;Y)
|
|
100
|
-
> 典型集 A_ε^n:{x^n : |−log p(x^n)/n − H(X)| < ε}
|
|
101
|
-
|
|
102
|
-
**含义**:互信息是两个随机变量间依赖关系的精确度量——为零等价于独立,为正则存在统计关联。信道容量是互信息在所有输入分布上的最大值,定义可靠通信的理论极限。
|
|
103
|
-
|
|
104
|
-
**数学背景**:互信息 I(X;Y) = Σ p(x,y) log(p(x,y)/p(x)p(y)) = D(p(x,y)||p(x)p(y))——联合分布与独立假设分布间的 KL 散度。典型集是 Shannon 证明编码定理的关键工具:对 i.i.d. 信源 X^n,典型序列 x^n 满足 |−1/n log p(x^n) − H(X)| < ε;典型集的概率趋近 1(当 n→∞),但典型集的大小 ≈ 2^{nH(X)},远小于整个空间 2^n(当 H(X) < 1)。这解释了为何压缩到 nH(X) bits 即可覆盖几乎所有有效序列。
|
|
105
|
-
|
|
106
|
-
## 联合熵、条件熵与链式规则 / Joint Entropy, Conditional Entropy, and Chain Rules
|
|
107
|
-
|
|
108
|
-
> H(X,Y) = H(X) + H(Y|X) —— 联合熵链式规则
|
|
109
|
-
> H(Y|X) = Σ p(x) H(Y|X=x) —— 条件熵
|
|
110
|
-
> I(X;Y) = H(X) − H(X|Y) = H(Y) − H(Y|X) —— 互信息
|
|
111
|
-
> I(X;Y|Z) = H(X|Z) − H(X|Y,Z) —— 条件互信息
|
|
112
|
-
> I(X₁;X₂;...;Xₙ) 的链式展开:I(X;Y,Z) = I(X;Y) + I(X;Z|Y)
|
|
113
|
-
|
|
114
|
-
**含义**:熵的链式规则将联合不确定性拆解为逐个变量的贡献——理解多变量系统的信息结构。
|
|
115
|
-
|
|
116
|
-
**数学背景**:联合熵 H(X,Y) = −Σ p(x,y) log p(x,y) 度量一对随机变量的总不确定性。链式规则 H(X,Y) = H(X) + H(Y|X) 说明:知道 X 后,Y 的额外不确定性是 H(Y|X)。推广到 n 个变量:H(X₁,...,Xₙ) = Σᵢ H(Xᵢ|X₁,...,Xᵢ₋₁)。条件互信息 I(X;Y|Z) 度量"在已知 Z 的条件下,Y 对 X 的额外信息量"——这是信息瓶颈和因果推断的关键工具。多变量互信息的链式展开:I(X;Y,Z) = I(X;Y) + I(X;Z|Y),说明 Y 和 Z 对 X 的联合信息等于 Y 的直接信息加上 Z 的条件信息。
|
|
117
|
-
|
|
118
|
-
## 信息论与编码理论的日常洞见
|
|
119
|
-
|
|
120
|
-
> "信息论的核心不是计算精确的比特数,而是养成'不确定性可量化、信息有价值、极限不可逾越'的思维习惯。"
|
|
121
|
-
|
|
122
|
-
- 不要忽视不确定性——熵 H(X) 量化它
|
|
123
|
-
- 信息有方向和大小——互信息 I(X;Y) 度量它
|
|
124
|
-
- 压缩有极限——信源编码定理限定它
|
|
125
|
-
- 通信有极限——信道编码定理限定它
|
|
126
|
-
- 模型选择有信息论标准——AIC/BIC/MDL 指导它
|
|
127
|
-
- 概率分布间有信息距离——KL 散度衡量它
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: logic-deduction
|
|
3
|
-
description: |
|
|
4
|
-
Trigger when checking proof rigor, formal logic analysis, premise auditing, predicate logic verification, quantifier structure analysis, discovering logical loopholes; or doing formal derivation and proof verification for algorithm correctness or invariants.
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# 🧠 Logic Deduction
|
|
8
|
-
|
|
9
|
-
> "Logic is the house rule of mathematics — all reasoning must proceed under the supervision of formal rules."
|
|
10
|
-
>
|
|
11
|
-
> — Gödel's Completeness Theorem (1929), First-Order Logic
|
|
12
|
-
|
|
13
|
-
## Core Principle
|
|
14
|
-
|
|
15
|
-
Deriving new true propositions rigorously from true premises — every step in the chain of inference must be legitimate. Types of inference: deduction (true premises + valid rules → necessarily true conclusion, most reliable), induction (instances → general, probabilistic), abduction (observation + theory → best explanation, hypothetical).
|
|
16
|
-
|
|
17
|
-
> **Mathematical Formalization**
|
|
18
|
-
>
|
|
19
|
-
> Logical deduction has a two-layer structure: propositional logic handles truth-functional connectives (¬, ∧, ∨, →, ↔), and predicate logic adds quantifiers (∀, ∃) and individual variables on top of this foundation. Mathematical proofs live within predicate logic — propositional logic alone cannot express statements such as "for all x, if P(x) then Q(x)," and therefore cannot proof-check actual mathematical arguments.
|
|
20
|
-
>
|
|
21
|
-
> Gödel's Completeness Theorem (1929): In first-order predicate logic, all valid arguments are provable — if φ is a valid formula of first-order logic, there exists a formal proof sequence deriving φ from the empty premise set. This guarantees that the deductive power of first-order logic coincides exactly with semantic validity (soundness + completeness), but this holds only for first-order logic; second-order logic does not enjoy this property.
|
|
22
|
-
>
|
|
23
|
-
> See `original-texts.md` for detailed mathematical foundations.
|
|
24
|
-
|
|
25
|
-
## GPU-Friendliness (Cross-Cutting Check)
|
|
26
|
-
|
|
27
|
-
When logical/formal verification structures are mapped to GPU, caution is required: **symbolic reasoning is often "beautiful but not computable"** — proof search and resolution backtracking are inherently serial and difficult to tensorize. When logic is used for algorithm/invariant design, pass the eight-dimension gate of `../../references/gpu-friendly-math.md`:
|
|
28
|
-
|
|
29
|
-
- **Batch SAT/SMT solving**: Independent clauses can be batch-parallelized (friendly), but CDCL backtracking is serial.
|
|
30
|
-
- **Theorem proving (Coq/Lean)**: Tactic solvers are highly serial with complex dependency graphs — not trainable; **verify offline** and deploy only the conclusions.
|
|
31
|
-
- **Model Checking**: State-space explosion → symbolic BDDs can compress; on GPU, switch to parallel SAT / local reachability (retrofittable).
|
|
32
|
-
- **Type/invariant checking**: Used as compile-time/offline static checks with zero runtime overhead (friendly).
|
|
33
|
-
- **Anti-pattern**: Embedding resolution/natural-deduction proof search inside the training loop — non-differentiable and non-parallelizable; should be relaxed to differentiable approximations (probabilistic/neuro-symbolic logic) or proved offline with only conclusions deployed.
|
|
34
|
-
|
|
35
|
-
Eight-dimension minimum assessment (formal terminology): **Tensorization** — typically unfriendly unless clauses/states can be batch-encoded; **GEMM-Mappability** — suitable only for differentiable logic, SAT scoring, or Boolean semiring approximations; **Complexity** — must flag the exponential or undecidable boundary of proof search/model checking; **Memory & KV-Cache** — whether state spaces, proof trees, or BDDs explode; **Low-Precision Stability** — whether relaxed logic preserves semantic boundaries under fp16/bf16; **Parallelism & Communication** — whether branching search can be batched or offloaded; **Sparsity Structure** — whether the constraint graph is regular; **Operator Fusion** — whether logic loss/mask can be fused; proof search itself should never enter a kernel.
|
|
36
|
-
|
|
37
|
-
> In conjunction with `../../references/books/abstract-algebra.md` (formal systems), `../../references/books/algebraic-geometry-rising-sea.md` (category-theoretic reasoning).
|
|
38
|
-
|
|
39
|
-
## When NOT to Use
|
|
40
|
-
|
|
41
|
-
- **The premises themselves are uncertain** — first establish the truth of premises, then deduce.
|
|
42
|
-
- **A creative breakthrough is needed rather than logical verification** — deduction can only discover conclusions already implicit in existing information; it cannot generate new information.
|
|
43
|
-
- **Second-order logic problems** — Gödel's completeness covers only first-order logic; second-order validity cannot be fully axiomatized.
|
|
44
|
-
|
|
45
|
-
## When to Use
|
|
46
|
-
|
|
47
|
-
- When reading a paper or code, checking the rigor of its proofs/derivations/invariants.
|
|
48
|
-
- When suspecting logical leaps or gaps in an argument and needing to locate them formally.
|
|
49
|
-
- When verifying whether a conclusion truly follows from the premises (whether Γ ⊢ φ holds).
|
|
50
|
-
- When analyzing mathematical statements containing ∀ / ∃, verifying the correctness of quantifier reasoning.
|
|
51
|
-
- When checking the validity boundary of a second-order logic argument.
|
|
52
|
-
- When performing formal derivation and proof verification for algorithm correctness, loop invariants, or program properties.
|
|
53
|
-
|
|
54
|
-
## Method
|
|
55
|
-
|
|
56
|
-
### Step 1: Identify the Premises
|
|
57
|
-
List all premises (assumptions, known conditions, cited theorems) in the argument, annotating their status: **proven theorem** (e.g., "there are infinitely many primes"), **axiom** (e.g., ZF set theory axioms), **hypothesis** (e.g., "the Riemann Hypothesis"), **empirical fact**. Also annotate the logical level: purely propositional premises (no quantifiers) or predicate premises (containing ∀ / ∃). Premise quality determines inference quality — if the premises do not hold, the conclusion is inevitably unreliable.
|
|
58
|
-
|
|
59
|
-
### Step 2: Check the Rules of Inference
|
|
60
|
-
Verify that each step uses a valid rule of inference.
|
|
61
|
-
|
|
62
|
-
**Propositional logic rules**: Modus Ponens P→Q, P ⊢ Q; Modus Tollens P→Q, ¬Q ⊢ ¬P; Hypothetical Syllogism P→Q, Q→R ⊢ P→R; Disjunctive Syllogism P∨Q, ¬P ⊢ Q; Conjunction Introduction P, Q ⊢ P∧Q; Double Negation Elimination ¬¬P ⊢ P.
|
|
63
|
-
|
|
64
|
-
**Predicate logic rules**: Universal Instantiation (UI) ∀x P(x) ⊢ P(a); Universal Generalization (UG) P(a) holds for arbitrary a ⊢ ∀x P(x) (a must be arbitrary, not a specific constant); Existential Instantiation (EI) ∃x P(x) ⊢ P(c) (c must be a fresh name, not conflicting with existing constants); Existential Generalization (EG) P(a) ⊢ ∃x P(x).
|
|
65
|
-
|
|
66
|
-
**Other frameworks**: Resolution Principle — from (P∨Q) and (¬P∨R), resolve to (Q∨R), suitable for automated proving; Natural Deduction systems — organized symmetrically by introduction/elimination rules, more closely mirroring human reasoning habits.
|
|
67
|
-
|
|
68
|
-
### Step 3: Check for Common Fallacies
|
|
69
|
-
**Propositional logic fallacies**: Affirming the consequent P→Q, Q ⊢ P (invalid); Denying the antecedent P→Q, ¬P ⊢ ¬Q (invalid); confusing sufficient and necessary conditions; circular reasoning (the conclusion is implicitly used as a premise); straw man fallacy.
|
|
70
|
-
|
|
71
|
-
**Predicate logic fallacies**: Quantifier shift fallacy ∀x∃y R(x,y) ≠ ∃y∀x R(x,y) (the former means "each person has their own beloved," the latter means "there is someone beloved by everyone"); illegal universal generalization (inferring ∀x P(x) from P(a) for a specific a, violating UG's arbitrariness requirement); confusing free and bound variables; confusing the strength of ∀ and ∃; equivocation; false dilemma (presenting P∨Q as the only options, implicitly excluding ¬P∧¬Q).
|
|
72
|
-
|
|
73
|
-
### Step 4: Analyze Quantifier Structure
|
|
74
|
-
The nesting order of ∀ and ∃ determines logical strength:
|
|
75
|
-
- **∀∃ structure** (weaker): ∀x∃y R(x,y) — for each x, a respective y can be constructed; constructively satisfiable.
|
|
76
|
-
- **∃∀ structure** (stronger): ∃y∀x R(x,y) — there exists a uniform y that holds for all x, often requiring the Axiom of Choice.
|
|
77
|
-
|
|
78
|
-
Key points: the more nesting layers, the more carefully one must reason; adjacent quantifiers of the same type commute (∀x∀y = ∀y∀x, ∃x∃y = ∃y∃x), but quantifiers of different types do not; quantifier negation equivalences: ¬∀x P(x) ≡ ∃x ¬P(x), ¬∃x P(x) ≡ ∀x ¬P(x).
|
|
79
|
-
|
|
80
|
-
### Step 5: Verify Completeness of the Inference Chain
|
|
81
|
-
Check whether the premise set Γ can formally derive the conclusion φ: does there exist a finite sequence φ₁, φ₂, ..., φₙ = φ, where each φᵢ either belongs to Γ or follows from earlier formulas by a valid rule? If the chain is incomplete, flag the missing intermediate steps and the rules they would require. A single missing step breaks the entire chain.
|
|
82
|
-
|
|
83
|
-
### Step 6: Assess the Strength of the Conclusion
|
|
84
|
-
Logical strength classification: **necessary** (deductively valid; if premises are true, the conclusion is necessarily true), **probable** (inductively supported, probabilistic evidence), **hypothetical** (abductive, best explanation but unverified). Also assess scope: universal (∀) or existential (∃)? Conditional (→) or unconditional? Do not inflate "possible" into "necessary."
|
|
85
|
-
|
|
86
|
-
### Step 7: Select Proof Strategy
|
|
87
|
-
- **Direct proof**: Proceed step by step from premises to conclusion; the most natural approach.
|
|
88
|
-
- **Proof by contradiction**: Assume ¬φ and derive a contradiction, thereby proving φ; suited for negative conclusions or arguments difficult to construct directly.
|
|
89
|
-
- **Contrapositive proof**: Prove ¬Q → ¬P to establish P → Q; used when the contrapositive direction is easier to reason about.
|
|
90
|
-
- **Proof by exhaustion**: Verify all cases one by one; suited for finitely enumerable situations.
|
|
91
|
-
- **Constructive proof**: Directly construct an object satisfying the conditions; more informative than a pure existence proof (which merely shows ∃x P(x) without specifying x).
|
|
92
|
-
|
|
93
|
-
## Common Errors
|
|
94
|
-
|
|
95
|
-
| Error | Critique | Correct Approach |
|
|
96
|
-
|---|---|---|
|
|
97
|
-
| Confusing sufficient and necessary conditions | P → Q holding does not mean Q → P holds | Clearly distinguish sufficient, necessary, and necessary-and-sufficient conditions |
|
|
98
|
-
| Affirming the consequent fallacy | P → Q, Q ⊬ P; only Modus Ponens/Tollens are valid | Reject invalid inferences such as P→Q, Q ⊢ P |
|
|
99
|
-
| Hidden premises | Using unstated premises in the reasoning | Expose all premises and examine each one |
|
|
100
|
-
| Infinite regress | Every premise requires another premise to prove it | Find a starting point that needs no proof (axioms / empirical facts) |
|
|
101
|
-
| Quantifier shift fallacy | ∀x∃y R(x,y) ≠ ∃y∀x R(x,y); the former is weaker, the latter stronger | Strictly respect quantifier order; do not swap quantifiers of different types |
|
|
102
|
-
| Illegal universal generalization | Inferring ∀x P(x) from P(a) for a specific a, violating UG's arbitrariness requirement | UG applies only to arbitrary individuals a, not to specific constants |
|
|
103
|
-
| Confusing free and bound variables | x is bound in ∀x P(x) but free in P(x); the meanings differ | Clearly annotate the bound/free status of variables; avoid conflating them |
|
|
104
|
-
| Confusing ∀ and ∃ | "All elements satisfy P" is far stronger than "some element satisfies P" | Strictly distinguish the logical strength of universal and existential assertions |
|
|
105
|
-
| Embedding symbolic reasoning in the training loop | Proof search/resolution is inherently serial and non-differentiable — "beautiful but not computable" | Relax to differentiable approximations (probabilistic/neuro-symbolic) or prove offline and deploy only conclusions |
|
|
106
|
-
|
|
107
|
-
## Operating Procedure
|
|
108
|
-
|
|
109
|
-
When this skill is triggered, the output must contain:
|
|
110
|
-
|
|
111
|
-
1. **[Premise Inventory]** — List all premises, annotated `[proven]` / `[axiom]` / `[hypothesis]` / `[empirical]`, and annotated with logical level `[propositional]` / `[predicate]`
|
|
112
|
-
2. **[Inference Chain Reconstruction]** — Restate the reasoning process in formal logic language, annotating the inference rule used at each step (including predicate rules such as UI/UG/EI/EG)
|
|
113
|
-
3. **[Fallacy Check]** — Check for propositional and predicate logic fallacies one by one, annotating `✅ No such fallacy` or `❌ Found [specific fallacy]`
|
|
114
|
-
4. **[Quantifier Structure Analysis]** — If ∀ / ∃ nesting is present, annotate quantifier order and logical strength `∀∃ (weak)` / `∃∀ (strong)`
|
|
115
|
-
5. **[Completeness Assessment]** — Is the inference chain complete? Annotate `✅ Complete` or `⚠️ Gap: [explanation]`
|
|
116
|
-
6. **[Conclusion Strength]** — Annotate `[necessary]` / `[probable]` / `[hypothetical]`, and annotate scope `[universal]` / `[existential]` / `[conditional]`
|
|
117
|
-
7. **[Proof Strategy Assessment]** — What proof strategy does the current argument use? Is there a better strategy? Annotate `✅ Strategy appropriate` or `💡 Suggestion: [better strategy]`
|
|
118
|
-
8. **[GPU Feasibility]** (if used for algorithm/invariant verification) — Whether formal verification is conducted offline and conclusions can be deployed; whether proof search needs to be relaxed to a differentiable approximation; pass the eight-dimension gate.
|
|
119
|
-
|
|
120
|
-
**Output must never provide analysis alone without a conclusion.**
|
|
121
|
-
|
|
122
|
-
## Relations to Other Skills
|
|
123
|
-
|
|
124
|
-
- **Axiomatization**: Logical deduction is the inference engine of axiom systems; axioms provide the premises, deduction provides the derivation mechanism, and together they constitute a formal system.
|
|
125
|
-
- **Abstraction**: Formal logic is itself a highly abstract structure — stripping away specific content to retain only the form of inference.
|
|
126
|
-
- **Induction and Analogy**: Deduction and induction are complementary — deduction guarantees correctness, induction provides new premises.
|
|
127
|
-
- **Probability and Statistics**: Under uncertainty, classical logic must be extended to probabilistic logic.
|
|
128
|
-
- **Algorithmic Thinking**: Logical deduction provides the formal framework for proving algorithm correctness — verifying program properties is essentially first-order predicate reasoning.
|
|
129
|
-
- **Counterexample Thinking**: Counterexamples are the direct means of falsifying ∀ assertions, forming a dual verification system with deductive proof of truth.
|
|
130
|
-
- **Modern Math Activation**: `../../references/books/abstract-algebra.md` (formal systems), `../../references/books/algebraic-geometry-rising-sea.md` (category-theoretic reasoning).
|