math-skill 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.en-US.md +40 -7
  2. package/README.md +40 -7
  3. package/agents/math-critic.en.md +235 -0
  4. package/agents/math-critic.md +2 -0
  5. package/commands/abstraction.md +1 -3
  6. package/commands/algorithmic-thinking.md +1 -3
  7. package/commands/ask.md +1 -3
  8. package/commands/axiomatization.md +1 -3
  9. package/commands/causal-inference.md +1 -3
  10. package/commands/discrete-combinatorial.md +1 -3
  11. package/commands/game-theory.md +1 -3
  12. package/commands/induction-analogy.md +1 -3
  13. package/commands/information-theory.md +1 -3
  14. package/commands/logic-deduction.md +1 -3
  15. package/commands/modeling.md +1 -3
  16. package/commands/optimization.md +1 -3
  17. package/commands/probability-statistics.md +1 -3
  18. package/commands/symmetry-invariance.md +1 -3
  19. package/commands/topological-thinking.md +1 -3
  20. package/commands/transformation.md +1 -3
  21. package/knowledge-base/overview.en.md +228 -0
  22. package/knowledge-base/overview.md +2 -0
  23. package/package.json +4 -2
  24. package/references/agentic-workflow.en.md +53 -0
  25. package/references/agentic-workflow.md +2 -0
  26. package/references/books/abstract-algebra.md +4 -0
  27. package/references/books/algebraic-geometry-rising-sea.md +4 -0
  28. package/references/books/differential-geometry.md +4 -0
  29. package/references/books/matrix-analysis.md +4 -0
  30. package/references/books/micro-lie-theory.md +4 -0
  31. package/references/books/optimization-ml.md +4 -0
  32. package/references/books/smooth-manifolds.md +4 -0
  33. package/references/gpu-friendly-math.en.md +65 -0
  34. package/references/gpu-friendly-math.md +2 -0
  35. package/references/inspiration.en.md +113 -0
  36. package/references/inspiration.md +2 -0
  37. package/skills/abstraction/SKILL.en.md +117 -0
  38. package/skills/abstraction/SKILL.md +2 -0
  39. package/skills/abstraction/original-texts.en.md +163 -0
  40. package/skills/algorithmic-thinking/SKILL.en.md +132 -0
  41. package/skills/algorithmic-thinking/SKILL.md +2 -0
  42. package/skills/algorithmic-thinking/original-texts.en.md +253 -0
  43. package/skills/axiomatization/SKILL.en.md +144 -0
  44. package/skills/axiomatization/SKILL.md +2 -0
  45. package/skills/axiomatization/original-texts.en.md +154 -0
  46. package/skills/causal-inference/SKILL.en.md +147 -0
  47. package/skills/causal-inference/SKILL.md +2 -0
  48. package/skills/causal-inference/original-texts.en.md +136 -0
  49. package/skills/discrete-combinatorial/SKILL.en.md +124 -0
  50. package/skills/discrete-combinatorial/SKILL.md +2 -0
  51. package/skills/discrete-combinatorial/original-texts.en.md +184 -0
  52. package/skills/game-theory/SKILL.en.md +117 -0
  53. package/skills/game-theory/SKILL.md +2 -0
  54. package/skills/game-theory/original-texts.en.md +131 -0
  55. package/skills/induction-analogy/SKILL.en.md +145 -0
  56. package/skills/induction-analogy/SKILL.md +2 -0
  57. package/skills/induction-analogy/original-texts.en.md +140 -0
  58. package/skills/information-theory/SKILL.en.md +134 -0
  59. package/skills/information-theory/SKILL.md +2 -0
  60. package/skills/information-theory/original-texts.en.md +127 -0
  61. package/skills/logic-deduction/SKILL.en.md +130 -0
  62. package/skills/logic-deduction/SKILL.md +2 -0
  63. package/skills/logic-deduction/original-texts.en.md +160 -0
  64. package/skills/math-research-activator/SKILL.en.md +132 -0
  65. package/skills/math-research-activator/SKILL.md +2 -0
  66. package/skills/math-research-activator/original-texts.en.md +105 -0
  67. package/skills/modeling/SKILL.en.md +135 -0
  68. package/skills/modeling/SKILL.md +2 -0
  69. package/skills/modeling/original-texts.en.md +162 -0
  70. package/skills/optimization/SKILL.en.md +129 -0
  71. package/skills/optimization/SKILL.md +2 -0
  72. package/skills/optimization/original-texts.en.md +167 -0
  73. package/skills/probability-statistics/SKILL.en.md +146 -0
  74. package/skills/probability-statistics/SKILL.md +2 -0
  75. package/skills/probability-statistics/original-texts.en.md +191 -0
  76. package/skills/symmetry-invariance/SKILL.en.md +135 -0
  77. package/skills/symmetry-invariance/SKILL.md +2 -0
  78. package/skills/symmetry-invariance/original-texts.en.md +206 -0
  79. package/skills/topological-thinking/SKILL.en.md +124 -0
  80. package/skills/topological-thinking/SKILL.md +2 -0
  81. package/skills/topological-thinking/original-texts.en.md +134 -0
  82. package/skills/transformation/SKILL.en.md +120 -0
  83. package/skills/transformation/SKILL.md +2 -0
  84. package/skills/transformation/original-texts.en.md +204 -0
@@ -0,0 +1,140 @@
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
@@ -0,0 +1,134 @@
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).
@@ -5,6 +5,8 @@ description: |
5
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
6
  ---
7
7
 
8
+ > **语言路由**:若用户消息为英文,请读取并遵循同目录下的 `SKILL.en.md`,按其操作规程以英文输出;中文消息则继续使用本文件。
9
+
8
10
  # 📡 信息论思想 / Information Theory
9
11
 
10
12
  > "信息是不确定性的减少——知道更多意味着怀疑更少。"
@@ -0,0 +1,127 @@
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
@@ -0,0 +1,130 @@
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).
@@ -5,6 +5,8 @@ description: |
5
5
  English: 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.
6
6
  ---
7
7
 
8
+ > **语言路由**:若用户消息为英文,请读取并遵循同目录下的 `SKILL.en.md`,按其操作规程以英文输出;中文消息则继续使用本文件。
9
+
8
10
  # 🧠 逻辑演绎 / Logic Deduction
9
11
 
10
12
  > "逻辑是数学的家规——一切推理必须在形式规则的监督下进行。"