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.
- package/README.en-US.md +40 -7
- package/README.md +40 -7
- package/agents/math-critic.en.md +235 -0
- package/agents/math-critic.md +2 -0
- package/commands/abstraction.md +1 -3
- package/commands/algorithmic-thinking.md +1 -3
- package/commands/ask.md +1 -3
- package/commands/axiomatization.md +1 -3
- package/commands/causal-inference.md +1 -3
- package/commands/discrete-combinatorial.md +1 -3
- package/commands/game-theory.md +1 -3
- package/commands/induction-analogy.md +1 -3
- package/commands/information-theory.md +1 -3
- package/commands/logic-deduction.md +1 -3
- package/commands/modeling.md +1 -3
- package/commands/optimization.md +1 -3
- package/commands/probability-statistics.md +1 -3
- package/commands/symmetry-invariance.md +1 -3
- package/commands/topological-thinking.md +1 -3
- package/commands/transformation.md +1 -3
- package/knowledge-base/overview.en.md +228 -0
- package/knowledge-base/overview.md +2 -0
- package/package.json +4 -2
- package/references/agentic-workflow.en.md +53 -0
- package/references/agentic-workflow.md +2 -0
- package/references/books/abstract-algebra.md +4 -0
- package/references/books/algebraic-geometry-rising-sea.md +4 -0
- package/references/books/differential-geometry.md +4 -0
- package/references/books/matrix-analysis.md +4 -0
- package/references/books/micro-lie-theory.md +4 -0
- package/references/books/optimization-ml.md +4 -0
- package/references/books/smooth-manifolds.md +4 -0
- package/references/gpu-friendly-math.en.md +65 -0
- package/references/gpu-friendly-math.md +2 -0
- package/references/inspiration.en.md +113 -0
- package/references/inspiration.md +2 -0
- package/skills/abstraction/SKILL.en.md +117 -0
- package/skills/abstraction/SKILL.md +2 -0
- package/skills/abstraction/original-texts.en.md +163 -0
- package/skills/algorithmic-thinking/SKILL.en.md +132 -0
- package/skills/algorithmic-thinking/SKILL.md +2 -0
- package/skills/algorithmic-thinking/original-texts.en.md +253 -0
- package/skills/axiomatization/SKILL.en.md +144 -0
- package/skills/axiomatization/SKILL.md +2 -0
- package/skills/axiomatization/original-texts.en.md +154 -0
- package/skills/causal-inference/SKILL.en.md +147 -0
- package/skills/causal-inference/SKILL.md +2 -0
- package/skills/causal-inference/original-texts.en.md +136 -0
- package/skills/discrete-combinatorial/SKILL.en.md +124 -0
- package/skills/discrete-combinatorial/SKILL.md +2 -0
- package/skills/discrete-combinatorial/original-texts.en.md +184 -0
- package/skills/game-theory/SKILL.en.md +117 -0
- package/skills/game-theory/SKILL.md +2 -0
- package/skills/game-theory/original-texts.en.md +131 -0
- package/skills/induction-analogy/SKILL.en.md +145 -0
- package/skills/induction-analogy/SKILL.md +2 -0
- package/skills/induction-analogy/original-texts.en.md +140 -0
- package/skills/information-theory/SKILL.en.md +134 -0
- package/skills/information-theory/SKILL.md +2 -0
- package/skills/information-theory/original-texts.en.md +127 -0
- package/skills/logic-deduction/SKILL.en.md +130 -0
- package/skills/logic-deduction/SKILL.md +2 -0
- package/skills/logic-deduction/original-texts.en.md +160 -0
- package/skills/math-research-activator/SKILL.en.md +132 -0
- package/skills/math-research-activator/SKILL.md +2 -0
- package/skills/math-research-activator/original-texts.en.md +105 -0
- package/skills/modeling/SKILL.en.md +135 -0
- package/skills/modeling/SKILL.md +2 -0
- package/skills/modeling/original-texts.en.md +162 -0
- package/skills/optimization/SKILL.en.md +129 -0
- package/skills/optimization/SKILL.md +2 -0
- package/skills/optimization/original-texts.en.md +167 -0
- package/skills/probability-statistics/SKILL.en.md +146 -0
- package/skills/probability-statistics/SKILL.md +2 -0
- package/skills/probability-statistics/original-texts.en.md +191 -0
- package/skills/symmetry-invariance/SKILL.en.md +135 -0
- package/skills/symmetry-invariance/SKILL.md +2 -0
- package/skills/symmetry-invariance/original-texts.en.md +206 -0
- package/skills/topological-thinking/SKILL.en.md +124 -0
- package/skills/topological-thinking/SKILL.md +2 -0
- package/skills/topological-thinking/original-texts.en.md +134 -0
- package/skills/transformation/SKILL.en.md +120 -0
- package/skills/transformation/SKILL.md +2 -0
- package/skills/transformation/original-texts.en.md +204 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Mathematical Sources and Classic Texts
|
|
2
|
+
|
|
3
|
+
## Propositional Logic
|
|
4
|
+
|
|
5
|
+
**Basic inference rules**:
|
|
6
|
+
|
|
7
|
+
| Rule Name | Form | Validity |
|
|
8
|
+
|-----------|------|----------|
|
|
9
|
+
| Modus Ponens | P → Q, P ⊢ Q | Valid |
|
|
10
|
+
| Modus Tollens | P → Q, ¬Q ⊢ ¬P | Valid |
|
|
11
|
+
| Hypothetical Syllogism | P → Q, Q → R ⊢ P → R | Valid |
|
|
12
|
+
| Disjunctive Syllogism | P ∨ Q, ¬P ⊢ Q | Valid |
|
|
13
|
+
| Affirming the Consequent | P → Q, Q ⊢ P | Invalid |
|
|
14
|
+
| Denying the Antecedent | P → Q, ¬P ⊢ ¬Q | Invalid |
|
|
15
|
+
|
|
16
|
+
## Boolean Algebra (Boole, 1854)
|
|
17
|
+
|
|
18
|
+
George Boole, in *An Investigation of the Laws of Thought* (1854), established an algebraic system for propositional logic, transforming logical reasoning into algebraic computation:
|
|
19
|
+
|
|
20
|
+
> "Logic is a species of algebra whose variables take only the values 0 and 1."
|
|
21
|
+
|
|
22
|
+
The core operations of Boolean algebra — ∧ (multiplication), ∨ (addition), ¬ (complement) — satisfy algebraic properties such as distributivity and De Morgan's laws. This is the algebraic dual of propositional logic: the same inferential structure can be handled either deductively or computationally. Boolean algebra later became the mathematical foundation of digital circuit design (Shannon, 1938) and computer science.
|
|
23
|
+
|
|
24
|
+
## Frege's *Begriffsschrift* (1879)
|
|
25
|
+
|
|
26
|
+
Frege invented the first complete formal system of first-order logic, introducing quantifiers (∀, ∃) and function symbols, demonstrating that logical reasoning can be fully mechanized. This is the starting point of modern mathematical logic — henceforth, mathematical proofs had precise syntactic rules rather than relying solely on intuitive narration.
|
|
27
|
+
|
|
28
|
+
> "Can arithmetical truths be proved purely logically? The Begriffsschrift provides the instrument for this."
|
|
29
|
+
|
|
30
|
+
## Peano Axioms (1889)
|
|
31
|
+
|
|
32
|
+
Constructing the natural number system from logic:
|
|
33
|
+
|
|
34
|
+
> 1. 0 is a natural number.
|
|
35
|
+
> 2. Every natural number n has a successor S(n).
|
|
36
|
+
> 3. 0 is not the successor of any natural number.
|
|
37
|
+
> 4. Different natural numbers have different successors.
|
|
38
|
+
> 5. (Induction Axiom) If a property holds for 0, and if it holds for n then it also holds for S(n), then the property holds for all natural numbers.
|
|
39
|
+
|
|
40
|
+
This demonstrates how to construct a complete mathematical system from a minimal set of logical assumptions. The Peano axioms are a paradigm of first-order theories — a single second-order induction axiom (or a first-order induction schema) suffices to characterize the entire structure of the natural numbers.
|
|
41
|
+
|
|
42
|
+
## Russell's Paradox (1901)
|
|
43
|
+
|
|
44
|
+
> "Consider the set R of all sets that do not contain themselves: does R contain R?"
|
|
45
|
+
|
|
46
|
+
If R ∈ R, then by definition R ∉ R; if R ∉ R, then by definition R ∈ R. The contradiction is irresolvable. This paradox directly demolished Frege's naive set theory (Frege acknowledged the fundamental flaw in his system upon receiving Russell's letter), triggering the "third crisis" of the foundations of mathematics. It gave rise to:
|
|
47
|
+
|
|
48
|
+
- **ZFC Set Theory** (Zermelo-Fraenkel + Choice): Eliminates the paradox by restricting set construction rules (the Separation schema rather than unrestricted Comprehension)
|
|
49
|
+
- **Type Theory** (Russell, 1908): Prohibits self-reference through a hierarchy of types
|
|
50
|
+
- **Intuitionism** (Brouwer): Rejects treating infinite sets as completed objects
|
|
51
|
+
|
|
52
|
+
Russell's paradox profoundly reveals that the consistency of a logical system cannot be taken for granted — it must be proved or constructively guaranteed.
|
|
53
|
+
|
|
54
|
+
## ZFC as Background Logic for Mathematics
|
|
55
|
+
|
|
56
|
+
Zermelo-Fraenkel set theory with the Axiom of Choice (ZFC) is the default foundational language of contemporary mathematics — virtually all mathematical objects (numbers, functions, spaces, groups) can be defined as sets within ZFC, and all mathematical theorems can (in principle) be translated into formal proofs in ZFC.
|
|
57
|
+
|
|
58
|
+
> "Mathematicians do not write ZFC proofs in daily work, but they presuppose that all proofs can in principle be formalized in ZFC."
|
|
59
|
+
|
|
60
|
+
ZFC's nine axioms (Extensionality, Empty Set, Pairing, Union, Power Set, Infinity, Separation, Replacement, Choice) carefully circumvent Russell's paradox while preserving sufficient constructive power. The Axiom of Choice (AC) has provoked ongoing controversy — it permits non-constructive selections (as in Zorn's Lemma and the Well-Ordering Theorem), revealing its cost in counterintuitive results such as the Banach-Tarski decomposition.
|
|
61
|
+
|
|
62
|
+
## First-Order vs Higher-Order Logic
|
|
63
|
+
|
|
64
|
+
**First-Order Logic (FOL)**: Quantifiers range only over individuals (∀x, ∃x), not over predicates or functions. This is the "standard language" of mathematical logic, possessing completeness (Gödel 1929) and compactness.
|
|
65
|
+
|
|
66
|
+
**Higher-Order Logic (HOL)**: Allows quantification over predicates (∀P) and functions (∀f), offering greater expressive power at a steep cost — higher-order logic is **incomplete** (no recursively enumerable proof system can capture all valid inferences) and non-compact.
|
|
67
|
+
|
|
68
|
+
> "First-order logic is complete but limited in expressive power; higher-order logic is expressive but incomplete. This is a fundamental trade-off."
|
|
69
|
+
|
|
70
|
+
Peano Arithmetic (PA) is a first-order theory whose induction axiom is encoded as infinitely many first-order axiom schemas; the genuine Peano axioms (with second-order induction) uniquely characterize ℕ, but first-order PA has non-standard models. This connects directly to the Löwenheim-Skolem theorem.
|
|
71
|
+
|
|
72
|
+
## Gödel: Completeness (1929) vs Incompleteness (1931)
|
|
73
|
+
|
|
74
|
+
**Completeness Theorem (1929)**: The deductive system of first-order logic is complete — every logically valid formula can be formally proved.
|
|
75
|
+
|
|
76
|
+
> "In first-order logic, all logically valid formulas can be proved from the axioms through formal inference."
|
|
77
|
+
|
|
78
|
+
**Incompleteness Theorem (1931)**: Any consistent formal system that includes basic arithmetic contains undecidable propositions — neither provable nor refutable.
|
|
79
|
+
|
|
80
|
+
> "In any sufficiently strong consistent formal system T, there exists a sentence G such that T ⊬ G and T ⊬ ¬G."
|
|
81
|
+
|
|
82
|
+
The crucial distinction: the Completeness Theorem states that the **logical system itself** does not miss any valid inference; the Incompleteness Theorem states that **arithmetic theory** cannot exhaust all truths. The two are not contradictory — completeness guarantees "the inference rules are sufficient," while incompleteness reveals "arithmetical truth transcends any fixed set of axioms."
|
|
83
|
+
|
|
84
|
+
## Löwenheim-Skolem Theorem (1920, 1922)
|
|
85
|
+
|
|
86
|
+
> "If a first-order theory T has an infinite model, then T has a model of every infinite cardinality κ ≥ ℵ₀."
|
|
87
|
+
|
|
88
|
+
Downward Löwenheim-Skolem: T must have a countable model. Upward Löwenheim-Skolem: T must have models of arbitrarily large cardinality.
|
|
89
|
+
|
|
90
|
+
A startling corollary: a first-order theory **cannot control the cardinality of its models**. Even though ZFC aims to describe an uncountable universe of sets, ZFC itself has countable models (the Skolem paradox). This reveals a fundamental limitation of first-order logic's expressive power — first-order sentences cannot distinguish the "internal" and "external" perspectives on "countable" versus "uncountable."
|
|
91
|
+
|
|
92
|
+
## Tarski's Semantic Theory of Truth (1933)
|
|
93
|
+
|
|
94
|
+
> "'Snow is white' is true if and only if snow is white."
|
|
95
|
+
|
|
96
|
+
Tarski provided a formal definition of truth (the T-schema), illuminating the distinction between "truth" and "provability" in logic — "truth" is a semantic concept (dependent on models), while "provability" is a syntactic concept (dependent on proof systems). The Completeness Theorem bridges the two (in FOL, T ⊢ φ ⇔ T ⊨ φ), but in strong theories such as arithmetic they are permanently separated (Gödel's incompleteness).
|
|
97
|
+
|
|
98
|
+
Tarski also proved that a sufficiently expressive language **cannot consistently define truth within itself** — a truth definition must employ a stronger metalanguage. This, together with Russell's paradox and Gödel's incompleteness, forms a triad of impossibility results concerning self-reference.
|
|
99
|
+
|
|
100
|
+
## Gentzen's Natural Deduction and Sequent Calculus (1935)
|
|
101
|
+
|
|
102
|
+
Gerhard Gentzen, in *Investigations into Logical Deduction*, invented two entirely new proof structures:
|
|
103
|
+
|
|
104
|
+
**Natural Deduction**: Inference rules are organized around the introduction (I) and elimination (E) of each logical connective — ∧I, ∧E, →I, →E, ∀I, ∀E, etc. This captures the way mathematicians actually reason: assume a premise, derive a conclusion, then discharge the assumption (→I, i.e., conditional proof).
|
|
105
|
+
|
|
106
|
+
**Sequent Calculus**: The objects of proof are sequents Γ ⊢ Δ (assumptions on the left, conclusions on the right), and rules operate between sequents. The key breakthrough: the **Cut-Elimination Theorem** (Hauptsatz) — any proof using the Cut rule can be transformed into a cut-free proof.
|
|
107
|
+
|
|
108
|
+
> "The Hauptsatz states that all proofs can be transformed into cut-free proofs, eliminating all 'intermediate formulas'."
|
|
109
|
+
|
|
110
|
+
Cut-elimination is the central tool of proof theory: it guarantees the subformula property (every step of a cut-free proof involves only subformulas of the final conclusion), making consistency and decidability proofs possible. Gentzen's work shifted logic from an "axiomatic" to a "structural" paradigm, founding the discipline of Proof Theory.
|
|
111
|
+
|
|
112
|
+
## Turing's Halting Problem (1936)
|
|
113
|
+
|
|
114
|
+
Alan Turing, in *On Computable Numbers*, defined the Turing machine and proved:
|
|
115
|
+
|
|
116
|
+
> "There is no general algorithm that can decide whether an arbitrary Turing machine halts on an arbitrary input."
|
|
117
|
+
|
|
118
|
+
The undecidability of the halting problem is a fundamental limitation on computation and logic. Its logical essence is equivalent to Gödel's incompleteness: if the halting problem were decidable, arithmetic incompleteness could be circumvented; if arithmetic were complete, the halting problem would be decidable. The two are duals — two faces of the same wall.
|
|
119
|
+
|
|
120
|
+
A direct corollary of the halting problem: the **Entscheidungsproblem** for first-order logic is also undecidable (Church, 1936; Turing, 1936) — there is no general algorithm that can decide whether an arbitrary first-order formula is logically valid. Logical deduction can be executed, but it cannot be mechanically and fully predicted.
|
|
121
|
+
|
|
122
|
+
## Resolution and Unification (Robinson, 1965)
|
|
123
|
+
|
|
124
|
+
J. A. Robinson, in *A Machine-Oriented Logic Based on the Resolution Principle*, introduced the resolution rule:
|
|
125
|
+
|
|
126
|
+
> "Resolve P ∨ Q and ¬P ∨ R to obtain Q ∨ R."
|
|
127
|
+
|
|
128
|
+
Resolution compresses all inference into a single rule combined with the Unification algorithm — automatically finding an algebraic substitution σ that makes two terms equal, so that σ(P) = σ(P'), thereby enabling resolution on complementary literals.
|
|
129
|
+
|
|
130
|
+
Resolution-unification is the mathematical core of Automated Theorem Proving and Logic Programming (e.g., Prolog). It demonstrates that proof search in first-order logic can be unified into a single algorithmic process, although efficiency issues (search space explosion) remain a severe practical challenge.
|
|
131
|
+
|
|
132
|
+
## Curry-Howard Correspondence (1969)
|
|
133
|
+
|
|
134
|
+
> "Propositions as types, proofs as programs."
|
|
135
|
+
|
|
136
|
+
Curry (1958) first observed the correspondence between types in combinatory logic and formulas in propositional logic; Howard (1969) extended it to constructive predicate logic:
|
|
137
|
+
|
|
138
|
+
| Logic Concept | Type Theory / Programming Concept |
|
|
139
|
+
|---------------|-----------------------------------|
|
|
140
|
+
| Proposition A | Type A |
|
|
141
|
+
| A ∧ B | A × B (product type) |
|
|
142
|
+
| A ∨ B | A + B (sum type) |
|
|
143
|
+
| A → B | A → B (function type) |
|
|
144
|
+
| ∀x. P(x) | Πx:A. P(x) (dependent function type) |
|
|
145
|
+
| ∃x. P(x) | Σx:A. P(x) (dependent pair type) |
|
|
146
|
+
| Constructive proof | Executable program |
|
|
147
|
+
|
|
148
|
+
The Curry-Howard correspondence reveals a deep isomorphism between logical deduction and computation: a constructive proof is a program, and the execution of the program is proof normalization. This is the computational counterpart of Gentzen's cut-elimination — β-reduction is cut-elimination.
|
|
149
|
+
|
|
150
|
+
This correspondence became the theoretical foundation of type theory (Martin-Löf, 1972), dependently typed programming (Coq, Agda), and Homotopy Type Theory (HoTT, 2013), unifying "proof correctness" and "program correctness" into a single problem.
|
|
151
|
+
|
|
152
|
+
## Formalization of Common Logical Fallacies
|
|
153
|
+
|
|
154
|
+
| Fallacy Name | Form | Counterexample |
|
|
155
|
+
|--------------|------|----------------|
|
|
156
|
+
| Affirming the Consequent | P → Q, Q ∴ P | "If it rains, the ground is wet; the ground is wet, therefore it rained" (could be a sprinkler) |
|
|
157
|
+
| Denying the Antecedent | P → Q, ¬P ∴ ¬Q | "If it rains, the ground is wet; it did not rain, therefore the ground is not wet" (could be a sprinkler) |
|
|
158
|
+
| Begging the Question (Circular Reasoning) | P ∴ P | "This book tells the truth because the book says so" |
|
|
159
|
+
| Straw Man | Attacking P' ≠ P | A: "We should increase the education budget." B: "You want to give all the money to schools." |
|
|
160
|
+
| Slippery Slope | A → B → ... → Z, ∴ ¬A | "Allow this → that → disaster, therefore we must not allow it." |
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: math-research-activator
|
|
3
|
+
description: |
|
|
4
|
+
Auto-trigger (requires BOTH environment AND task signals): only when **designing/improving** new model architectures/operators/attention mechanisms, **analyzing** algorithm theoretical properties (complexity, convergence, expressivity), or **transferring** modern math structures (algebraic geometry, differential geometry, Lie theory, abstract algebra, matrix analysis, optimization) into algorithm/GPU co-design. Does NOT trigger for: code review, debugging, parameter tracing, refactoring, hyperparameter tuning, or loss implementation edits. Also the manual /ask entry (weapon selector).
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 🧭 Math Research Activator
|
|
8
|
+
|
|
9
|
+
> "The model already holds enough mathematics inside; what's missing is a cross-domain activation. The human picks the direction; the agent searches, enumerates, verifies."
|
|
10
|
+
|
|
11
|
+
## Core Principle
|
|
12
|
+
|
|
13
|
+
**No lengthy math tutorials.** Once triggered, immediately enter the three-step pipeline: "Diagnose → Map → GPU Screen," activating modern mathematics into algorithm/hardware design, and passing every output through the **dual acceptance gate**:
|
|
14
|
+
|
|
15
|
+
1. **Mathematically correct (beautiful in math)** — self-consistent, differentiable (or relaxable to differentiable), with correctness guarantees.
|
|
16
|
+
2. **GPU-feasible (friendly to GPU)** — see `../../references/gpu-friendly-math.md` eight dimensions.
|
|
17
|
+
|
|
18
|
+
> This is the **sole automatic entry point** of the skill pack. It loads the methodology layer (`../../references/agentic-workflow.md`, `../../references/gpu-friendly-math.md`), the book activation layer (`../../references/books/*.md`), and the 16 thinking weapons (sibling directories `../*/SKILL.md`) on demand, keeping only the minimal trigger and diagnostic logic resident at all times — progressive disclosure to save tokens.
|
|
19
|
+
|
|
20
|
+
## When to Auto-Engage
|
|
21
|
+
|
|
22
|
+
**Both the "environment signal" AND the "task signal" must be satisfied simultaneously (neither alone is sufficient):**
|
|
23
|
+
|
|
24
|
+
### Gate 0 · Exclusion Gate (evaluated first; if hit, do not engage)
|
|
25
|
+
|
|
26
|
+
The following tasks must **never** trigger this activator, regardless of what code is in the workspace:
|
|
27
|
+
- Code review / debugging / parameter-passing chain verification / interface consistency checks
|
|
28
|
+
- Refactoring, renaming, removing redundant code, dead code cleanup
|
|
29
|
+
- Build / packaging / CI / deployment / environment configuration
|
|
30
|
+
- Pure factual queries ("what does this function do," "who receives this parameter")
|
|
31
|
+
- General software engineering (file I/O, networking, data loading, logging)
|
|
32
|
+
- Training script hyperparameter tuning, hyperparameter search, experiment comparison
|
|
33
|
+
- Adding / modifying loss implementation details (as opposed to designing the mathematical structure of a new loss)
|
|
34
|
+
|
|
35
|
+
**Rule of thumb: if the task can be accomplished by "reading code → tracing call chains → reporting results," no mathematical weapon is needed.**
|
|
36
|
+
|
|
37
|
+
### Gate 1 · Environment Signal (necessary condition, not sufficient)
|
|
38
|
+
|
|
39
|
+
The workspace contains at least one of the following:
|
|
40
|
+
- Core model architecture code (not training scripts / data pipelines): attention/transformer/MoE implementations, `*.cu`/`*.cuh`/kernels, Triton/CUDA operators.
|
|
41
|
+
- Algorithm research notes / paper review documents.
|
|
42
|
+
- Design drafts or mathematical derivations for new architectures / new operators.
|
|
43
|
+
|
|
44
|
+
> The mere presence of `model.py`, `trainer.py`, `config.json`, or similar routine ML engineering files **does not constitute an environment signal**.
|
|
45
|
+
|
|
46
|
+
### Gate 2 · Task Signal (necessary condition, not sufficient)
|
|
47
|
+
|
|
48
|
+
The user's current task explicitly involves at least one of the following:
|
|
49
|
+
- **Designing or improving** a new model architecture / operator / attention mechanism (not fixing an existing implementation).
|
|
50
|
+
- **Selecting or justifying** the applicability of a mathematical structure (e.g., "should we use manifold constraints," "does this structure have equivariance").
|
|
51
|
+
- **Analyzing** theoretical properties of an algorithm (complexity lower bounds, convergence, expressivity, information bottleneck).
|
|
52
|
+
- **Transferring** a mathematical structure from some field into algorithm/GPU design.
|
|
53
|
+
|
|
54
|
+
> If the task signal is merely "code doesn't run," "parameter wasn't passed," "loss didn't take effect," or similar engineering issues, the activator does **not trigger** even if the environment signal is hit.
|
|
55
|
+
|
|
56
|
+
**When NOT to engage:**
|
|
57
|
+
- Gate 0 is hit (exclusion gate).
|
|
58
|
+
- Either Gate 1 or Gate 2 is not satisfied.
|
|
59
|
+
- The problem is not in a domain where mathematics can help.
|
|
60
|
+
|
|
61
|
+
## The Activation Loop
|
|
62
|
+
|
|
63
|
+
> See `../../references/agentic-workflow.md` for detailed working methodology (Human-in-the-Agent-Loop).
|
|
64
|
+
|
|
65
|
+
1. **Diagnose**: What is the algorithmic structure or bottleneck? (complexity? memory/KV? numerics? parallelism? expressivity?)
|
|
66
|
+
2. **Map**: Use the "Modern Math Toolbox" (below) to scan for transferable structures, **enumerating multiple candidates** (leverage the large context window — don't just give one).
|
|
67
|
+
3. **Route**: Select 1–3 thinking weapons for deeper analysis (decision tree below).
|
|
68
|
+
4. **GPU Screen**: Pass each candidate through the eight dimensions of `../../references/gpu-friendly-math.md`, rating "friendly / retrofittable / unfriendly" + adaptation recommendations.
|
|
69
|
+
5. **Dual Acceptance Gate**: Retain only candidates that are **mathematically correct AND (eight-dimension friendly or retrofittable)**.
|
|
70
|
+
6. **Track**: For complex explorations, use a markdown testplan table (template in agentic-workflow.md) to iterate toward convergence.
|
|
71
|
+
|
|
72
|
+
The eight-dimension terminology must remain consistent: **Tensorization / GEMM-Mappability / Complexity / Memory & KV-Cache / Low-Precision Stability / Parallelism & Communication / Sparsity Structure / Operator Fusion**. Do not substitute vague judgments covering only a subset of dimensions for the full eight-dimension gate.
|
|
73
|
+
|
|
74
|
+
## Weapon Routing
|
|
75
|
+
|
|
76
|
+
Match by the core characteristic of the problem (select up to 3, label primary/secondary):
|
|
77
|
+
|
|
78
|
+
1. **Multi-agent interaction** (my optimum depends on others) → `/game-theory` (primary); resource allocation + `/optimization`; information asymmetry + `/information-theory`
|
|
79
|
+
2. **Uncertainty / randomness** → `/probability-statistics` (primary); need causal rather than correlational + `/causal-inference`
|
|
80
|
+
3. **Optimization under constraints** → `/optimization` (primary); need to model first + `/modeling` (prerequisite)
|
|
81
|
+
4. **Current form is intractable, need change of perspective / simplification** → `/transformation` (primary)
|
|
82
|
+
5. **Need to extract essential structure** → `/abstraction` (primary); verify assumptions + `/axiomatization`; simplify + `/symmetry-invariance`
|
|
83
|
+
6. **Need rigorous reasoning and verification** → `/logic-deduction` (primary); verify premises + `/axiomatization`
|
|
84
|
+
7. **Finding patterns from data / experience** → `/induction-analogy` (primary); cross-domain transfer + `/abstraction`
|
|
85
|
+
8. **Building predictive / explanatory models** → `/modeling` (primary); optimization + `/optimization`; uncertainty + `/probability-statistics`
|
|
86
|
+
9. **Invariance / conservation / equivariance under change** → `/symmetry-invariance` (primary); connected structure + `/topological-thinking`
|
|
87
|
+
10. **Reducing to executable steps / evaluating feasibility and complexity** → `/algorithmic-thinking` (primary)
|
|
88
|
+
11. **Compression / encoding / information bottleneck / KV-Cache compression / quantization** → `/information-theory` (primary); representation transforms + `/transformation`; routing information gain + `/game-theory`
|
|
89
|
+
12. **Counting / enumeration / structure of finite objects** → `/discrete-combinatorial` (primary)
|
|
90
|
+
|
|
91
|
+
> **Modern math priority hint**: When the problem is "designing/improving an operator or structure," **always open the modern math toolbox first** while routing weapons — many breakthroughs come from transferring structures from algebraic geometry / differential geometry / Lie theory, rather than circling within classical tools alone.
|
|
92
|
+
|
|
93
|
+
## Modern-Math Toolbox (Layer 3 · Loaded on Demand)
|
|
94
|
+
|
|
95
|
+
Load the corresponding book activation file (`../../references/books/`) by problem type:
|
|
96
|
+
|
|
97
|
+
| Trigger Signal | Load | Typical Activation |
|
|
98
|
+
|---------|------|---------|
|
|
99
|
+
| Operator = matrix multiply / spectrum / low-rank / numerical stability | `matrix-analysis.md` | GEMM formulation, low-rank compression, spectral normalization, preconditioning |
|
|
100
|
+
| Training / convergence / optimizer / constraints | `optimization-ml.md` | Feasibility of adaptive / second-order optimization, dual solving |
|
|
101
|
+
| Symmetry / equivariance / semiring / permutation invariance | `abstract-algebra.md` | Group-equivariant layers, tropical semiring routing, finite-field encoding |
|
|
102
|
+
| Manifold constraints / latent-space geometry / differentiable structure | `smooth-manifolds.md` | Manifold optimization, Stiefel/orthogonal constraints, geodesic interpolation |
|
|
103
|
+
| Metric / curvature / natural gradient / gauge / fiber bundle | `differential-geometry.md` | Natural gradient / K-FAC, information geometry, gauge equivariance |
|
|
104
|
+
| Pose / SO(3) / SE(3) / state estimation / equivariance | `micro-lie-theory.md` | Lie group optimization, SE(3) equivariance, manifold loss |
|
|
105
|
+
| Attention / sparsity / global consistency / KV compression | `algebraic-geometry-rising-sea.md` | Sheaf attention, Čech cohomology regularization, Plücker KV, tropical gating |
|
|
106
|
+
|
|
107
|
+
## Deep-Dive Protocol
|
|
108
|
+
|
|
109
|
+
- **Light**: Read `../../references/books/<book>.md` (distilled notes, shipped with the release, self-contained).
|
|
110
|
+
- **Deep (full fidelity to original text required)**: If a local `math_book/<corresponding PDF>` exists, **let the agent search automatically** — `pdftotext "math_book/<file>.pdf" -` → grep keywords → Read the matching page. **No reliance on pre-embedded anchors.**
|
|
111
|
+
- No PDF available (e.g., npm-installed on a different machine): Stay at the distilled-notes layer, which remains self-contained and usable.
|
|
112
|
+
|
|
113
|
+
## Worked Example: Tropical Sheaf Attention
|
|
114
|
+
|
|
115
|
+
A research candidate template (see `../../references/gpu-friendly-math.md` for details): tropical gating (semiring piecewise-linear replacing Top-K) + cellular sheaf diffusion (low-rank restriction maps per edge = small GEMMs) + Čech cohomology regularization (H¹ as a structural consistency signal) + Plücker KV compression. Treat this as an exploration template for "math beautiful x GPU friendly": verify complexity, memory, low-precision stability, and kernel fusibility dimension by dimension before claiming passage through the eight-dimension gate.
|
|
116
|
+
|
|
117
|
+
## Operating Procedure
|
|
118
|
+
|
|
119
|
+
Once triggered, the output must contain:
|
|
120
|
+
1. **[Diagnosis]**: One sentence identifying the algorithmic structure/bottleneck (interaction / uncertainty / constraints / structure / dynamics / complexity / memory / numerics / parallelism).
|
|
121
|
+
2. **[Mapping]**: Enumerate transferable modern math structure candidates (>=2, annotated with source book).
|
|
122
|
+
3. **[Weapon Routing]**: 1–3 thinking weapons, labeled primary/secondary + trigger commands.
|
|
123
|
+
4. **[GPU Screen]**: Each candidate evaluated against the eight dimensions, rated "friendly / retrofittable / unfriendly" + adaptation recommendations.
|
|
124
|
+
5. **[Conclusion]**: Retain only candidates passing the dual acceptance gate; provide a testplan table when necessary.
|
|
125
|
+
|
|
126
|
+
**A conclusion must always be provided — never output analysis alone without convergence.**
|
|
127
|
+
|
|
128
|
+
## Relations
|
|
129
|
+
|
|
130
|
+
- This entry point routes all 16 thinking weapons and loads the methodology layer and book activation layer on demand.
|
|
131
|
+
- The manual entry `/ask` is equivalent to invoking this activator (weapon selector mode).
|
|
132
|
+
- Review of outputs can be delegated to `agents/math-critic.md` (including the GPU feasibility dimension) for a second pass.
|
|
@@ -5,6 +5,8 @@ description: |
|
|
|
5
5
|
English: Auto-trigger (requires BOTH environment AND task signals): only when **designing/improving** new model architectures/operators/attention mechanisms, **analyzing** algorithm theoretical properties (complexity, convergence, expressivity), or **transferring** modern math structures (algebraic geometry, differential geometry, Lie theory, abstract algebra, matrix analysis, optimization) into algorithm/GPU co-design. Does NOT trigger for: code review, debugging, parameter tracing, refactoring, hyperparameter tuning, or loss implementation edits. Also the manual /ask entry (weapon selector).
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
> **语言路由**:若用户消息为英文,请读取并遵循同目录下的 `SKILL.en.md`,按其操作规程以英文输出;中文消息则继续使用本文件。
|
|
9
|
+
|
|
8
10
|
# 🧭 数学研究激活器 / Math Research Activator
|
|
9
11
|
|
|
10
12
|
> "模型内部已有足够的数学知识,缺的只是一次跨领域的激活。人选方向,Agent 搜索、枚举、验证。"
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Intellectual Sources for the Weapon Selector
|
|
2
|
+
|
|
3
|
+
## The Tradition of Problem Classification and Tool Selection
|
|
4
|
+
|
|
5
|
+
### Pólya's Problem-Solving Heuristics
|
|
6
|
+
|
|
7
|
+
George Pólya (1887-1985) proposed the four-step problem-solving method in *How to Solve It* (1945), which laid the foundation for modern problem-solving methodology:
|
|
8
|
+
|
|
9
|
+
1. **Understanding the problem** — You must understand the problem
|
|
10
|
+
2. **Devising a plan** — Find the connection between the known and the unknown
|
|
11
|
+
3. **Carrying out the plan** — Check each step
|
|
12
|
+
4. **Looking back** — Examine the solution obtained
|
|
13
|
+
|
|
14
|
+
Pólya's central insight: **different types of problems require different problem-solving strategies**. He catalogued dozens of heuristic strategies, including:
|
|
15
|
+
- If you cannot solve the proposed problem, try to solve some related problem first
|
|
16
|
+
- Go back to definitions
|
|
17
|
+
- From the particular to the general, and from the general to the particular
|
|
18
|
+
- Consider extreme cases
|
|
19
|
+
- Reason backwards
|
|
20
|
+
- Draw a figure
|
|
21
|
+
- Introduce auxiliary elements
|
|
22
|
+
|
|
23
|
+
> "Problem solving is a practical skill, like swimming — you can learn it by imitation and practice." — Pólya
|
|
24
|
+
|
|
25
|
+
Pólya's taxonomy of heuristics provides the intellectual foundation for our weapon selector: **the core characteristics of a problem (such as "does it involve uncertain quantities," "does it exhibit symmetry," "can it be decomposed into subproblems") determine the most appropriate problem-solving method**.
|
|
26
|
+
|
|
27
|
+
### Newell & Simon's Problem Space Theory
|
|
28
|
+
|
|
29
|
+
Allen Newell and Herbert A. Simon proposed the problem space theory in *Human Problem Solving* (1972):
|
|
30
|
+
|
|
31
|
+
- **Problem Space**: The set of all possible states, including the initial state, the goal state, and the permissible operations
|
|
32
|
+
- **Search Strategy**: A method for navigating from the initial state to the goal state within the problem space
|
|
33
|
+
- **Heuristic Search**: Rather than exhaustively enumerating all states, use heuristic rules to select the directions most likely to lead toward the goal
|
|
34
|
+
|
|
35
|
+
Core insight: **the nature of the problem space determines the choice of search strategy**. If the problem space is small, exhaustive search is feasible; if it is large, heuristics are essential; if the problem space has special structure (such as monotonicity or symmetry), that structure can be exploited to accelerate the search.
|
|
36
|
+
|
|
37
|
+
> "Choosing a search strategy is the most critical decision in problem solving — the strategy determines which region of the problem space you will search." — Newell & Simon
|
|
38
|
+
|
|
39
|
+
### Schoenfeld's Strategic Decision Theory
|
|
40
|
+
|
|
41
|
+
Alan H. Schoenfeld, in *Mathematical Problem Solving* (1985), analyzed why students fail to solve problems even when they possess the necessary tools — the critical deficiency is not a lack of tools but a lack of **strategic decision-making ability**:
|
|
42
|
+
|
|
43
|
+
- **Resources**: Knowledge, skills, tools — corresponding to our 15 intellectual weapons
|
|
44
|
+
- **Heuristics**: How to use resources — corresponding to the methodological workflow for each intellectual weapon
|
|
45
|
+
- **Control**: When to use which resource — corresponding to the function of the weapon selector
|
|
46
|
+
- **Belief Systems**: Beliefs about mathematics and about oneself — affecting whether the appropriate tool is selected
|
|
47
|
+
|
|
48
|
+
Core insight: **mastery of tools ≠ ability to solve problems. The critical difference lies at the 'control' level — knowing when to deploy which tool**. This is precisely the problem the weapon selector is designed to address.
|
|
49
|
+
|
|
50
|
+
> "The students' problem is not a lack of knowledge or skill, but a lack of strategic decision-making ability — they do not know when to use which method." — Schoenfeld
|
|
51
|
+
|
|
52
|
+
### Wicked Problems Theory (Rittel & Webber)
|
|
53
|
+
|
|
54
|
+
Horst Rittel and Melvin Webber, in "Dilemmas in a General Theory of Planning" (1973), distinguished between "tame problems" and "wicked problems":
|
|
55
|
+
|
|
56
|
+
Characteristics of tame problems:
|
|
57
|
+
- Clearly defined
|
|
58
|
+
- Have clear stopping conditions
|
|
59
|
+
- Solutions can be objectively evaluated as right or wrong
|
|
60
|
+
- Domain-specific
|
|
61
|
+
|
|
62
|
+
Characteristics of wicked problems:
|
|
63
|
+
- No definitive formulation — understanding the problem is itself part of solving it
|
|
64
|
+
- No clear stopping conditions
|
|
65
|
+
- Solutions are not right or wrong, only better or worse
|
|
66
|
+
- Span multiple domains
|
|
67
|
+
|
|
68
|
+
Core insight: **wicked problems require combinations of cross-domain intellectual weapons, whereas tame problems can be solved with a single tool**. The weapon selector recommends multi-tool combinations when facing wicked problems and single-tool focus when facing tame problems.
|
|
69
|
+
|
|
70
|
+
> "Wicked problems have no right or wrong answers, only better or worse ways of dealing with them." — Rittel & Webber
|
|
71
|
+
|
|
72
|
+
### Kahneman's Dual-System Theory
|
|
73
|
+
|
|
74
|
+
Daniel Kahneman, in *Thinking, Fast and Slow* (2011), proposed the dual-system theory:
|
|
75
|
+
|
|
76
|
+
- **System 1**: Fast, intuitive, automatic — responsible for the majority of everyday decisions
|
|
77
|
+
- **System 2**: Slow, rational, deliberate — required for decisions demanding careful thought
|
|
78
|
+
|
|
79
|
+
Core insight: **not all problems require System 2-level rational analysis**. Many everyday decisions require only intuition (System 1), and forcibly deploying intellectual weapons constitutes over-analysis. The weapon selector's "inapplicable scenarios" list is grounded in this insight — simple problems do not need tools; wicked problems do.
|
|
80
|
+
|
|
81
|
+
> "Overthinking is the enemy of decision-making — some decisions are best left to intuition." — Kahneman
|
|
82
|
+
|
|
83
|
+
### Lakatos's Methodology
|
|
84
|
+
|
|
85
|
+
Imre Lakatos, in *Proofs and Refutations* (1976), demonstrated that mathematical knowledge does not grow linearly but evolves through a dialectical process of "conjecture → refutation → revision":
|
|
86
|
+
|
|
87
|
+
- **Progressive Problemshift**: Each revision gives rise to new, deeper questions
|
|
88
|
+
- **Degenerative Problemshift**: Revisions merely accommodate counterexamples without generating new insights
|
|
89
|
+
|
|
90
|
+
Core insight: **tool selection itself should be a progressive problemshift** — the initial choice may not be ideal, but through post-use reflection, the ability to choose improves progressively. The weapon selector's "combination sequencing" and "auxiliary perspectives" recommendations embody this dialectical thinking.
|
|
91
|
+
|
|
92
|
+
> "Knowledge is not truth descending from above, but conjecture continually refined through criticism and refutation." — Lakatos
|
|
93
|
+
|
|
94
|
+
## Mapping Ideas to Practice
|
|
95
|
+
|
|
96
|
+
Our weapon selector integrates all of the above intellectual traditions:
|
|
97
|
+
|
|
98
|
+
| Intellectual Source | Manifestation in the Weapon Selector |
|
|
99
|
+
|---------|-------------------|
|
|
100
|
+
| Pólya's Heuristics | 11 characteristic branches in the decision tree — each branch corresponds to a class of heuristic strategies |
|
|
101
|
+
| Newell & Simon's Problem Space | Problem characteristic dimensions — interactivity, uncertainty, constraint, structure, dynamism |
|
|
102
|
+
| Schoenfeld's Strategic Selection | The core principle that "choosing the right tool matters more than brute-force analysis" |
|
|
103
|
+
| Wicked Problems Theory | Multi-tool combination recommendations — wicked problems require cross-domain tool combinations |
|
|
104
|
+
| Kahneman's Dual System | "Inapplicable scenarios" — simple problems do not need tools; avoid over-analysis |
|
|
105
|
+
| Lakatos's Methodology | Combination sequencing advice — use the primary tool first, then supplement with auxiliary tools for additional perspectives |
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: modeling
|
|
3
|
+
description: |
|
|
4
|
+
Trigger when translating real-world problems into mathematics (reality->math->interpretation), building predictive/explanatory models, performing dimensional analysis and model selection, or establishing computable models for algorithms/operators/structures.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Modeling
|
|
8
|
+
|
|
9
|
+
> "Transforming real-world problems into mathematical problems, solving them mathematically to explain and predict reality. All models are wrong, but some are useful."
|
|
10
|
+
>
|
|
11
|
+
> -- Applied Mathematics, Mathematical Modeling
|
|
12
|
+
|
|
13
|
+
## Core Principle
|
|
14
|
+
|
|
15
|
+
**A model is a simplified representation of reality, not reality itself. A good model is not one that is "true," but one that makes accurate predictions within its domain of applicability.**
|
|
16
|
+
|
|
17
|
+
The golden cycle of modeling: (1) **Real-world problem -> Mathematical problem** (translation); (2) **Mathematical problem -> Mathematical solution** (solving); (3) **Mathematical solution -> Real-world interpretation** (back-translation); (4) **Real-world interpretation -> Experimental validation** (verification).
|
|
18
|
+
|
|
19
|
+
> **Mathematical Formalization**
|
|
20
|
+
>
|
|
21
|
+
> **Dimensional Analysis & Buckingham Pi Theorem**: Before constructing equations, one must verify dimensional consistency. If a system involves $n$ physical quantities spanning $m$ fundamental dimensions, one can construct $k=n-m$ dimensionless Pi terms, thereby reducing the number of variables and simplifying the equations; dimensionally inconsistent equations are physically inadmissible.
|
|
22
|
+
>
|
|
23
|
+
> **Model Specification**: Let the system output be $y$, with inputs $x_1,\dots,x_p$, and model $y=f(x_1,\dots,x_p;\theta)+\varepsilon$, where $f$ is the model function, $\theta$ is the parameter vector, and $\varepsilon$ is the error term. Model selection amounts to choosing the bias-variance-optimal $f$ from a candidate set $\{f_1,f_2,\dots\}$.
|
|
24
|
+
|
|
25
|
+
## GPU-Friendliness (Cross-Cutting Check)
|
|
26
|
+
|
|
27
|
+
When a model is used for **algorithm/operator/training design**, model selection and parameterization directly determine GPU viability -- pass the eight-dimensional gate in `../../references/gpu-friendly-math.md`:
|
|
28
|
+
|
|
29
|
+
- **Linear / GEMM-compatible parameterization**: $y=f(x;\theta)$ where $f$ can be expressed as dense tensor algebra or a chain of matrix multiplications (linear regression, MLP) -- friendly, fully utilizes Tensor Cores.
|
|
30
|
+
- **Low-rank parameterization**: $\theta$ uses low-rank / block structure instead of dense representation -- memory-friendly, compressible (see `../../references/books/matrix-analysis.md`).
|
|
31
|
+
- **Operator splitting / block parallelism**: PDE/ODE models decomposed by spatial/temporal blocks, serial recurrence converted to parallel scan -- amenable to adaptation.
|
|
32
|
+
- **Anti-patterns**: Model requires $O(n^2)$ dense global operations (naive full attention), data-dependent branching / scalar loops, ill-conditioned numerics requiring fp64, non-differentiable operations requiring discrete search -- "beautiful but incomputable"; switch to a tensorizable, fusible, numerically stable equivalent parameterization.
|
|
33
|
+
|
|
34
|
+
Eight-dimensional minimum assessment (formal terms): **Tensorization** -- whether model equations can be evaluated in batch; **GEMM-mappability** -- whether the parameterization can be expressed as matrix multiplication / convolution / low-rank factors; **Complexity** -- growth of state dimension, time steps, interaction terms; **Memory & KV-Cache** -- whether hidden states, activations, and caches can be compressed; **Low-precision stability** -- whether equations are ill-conditioned or require fp64; **Parallelism & communication** -- whether the dynamical system can be decomposed into blocks / scans; **Sparse structure** -- whether the coupling graph is structured; **Operator fusion** -- whether model updates and loss computation can be fused.
|
|
35
|
+
|
|
36
|
+
> Cross-reference `../../references/books/optimization-ml.md` (model parameterization and training), `matrix-analysis.md` (low-rank, condition number, compression).
|
|
37
|
+
|
|
38
|
+
## When NOT to Use
|
|
39
|
+
|
|
40
|
+
- **The problem cannot be quantified or structured** -- modeling requires well-defined variables and relationships.
|
|
41
|
+
- **Only qualitative understanding is needed** (e.g., "roughly how does this phenomenon work") -- modeling would be overly precise.
|
|
42
|
+
- **Fundamental data is lacking** -- a model without data is merely conjecture.
|
|
43
|
+
|
|
44
|
+
## When to Use
|
|
45
|
+
|
|
46
|
+
- When a real-world problem needs to be precisely formulated in mathematical language (reality -> math -> interpretation).
|
|
47
|
+
- Building predictive / explanatory models to interpret experimental data or predict new phenomena.
|
|
48
|
+
- Understanding interactions and sensitivities among factors in complex systems.
|
|
49
|
+
- Performing dimensional analysis, model selection (AIC/BIC/CV), and sensitivity analysis.
|
|
50
|
+
- **Establishing computable models for algorithms/operators/structures** and evaluating the GPU viability of their parameterizations.
|
|
51
|
+
|
|
52
|
+
## Method
|
|
53
|
+
|
|
54
|
+
### Step 1: Define the Real-World Problem
|
|
55
|
+
Describe the problem to be solved in the clearest possible language. Key questions: What are the **inputs** of the system? What are the **outputs**? Is the goal prediction, explanation, or optimization? Without clear direction, modeling goes astray.
|
|
56
|
+
|
|
57
|
+
### Step 2: State Assumptions
|
|
58
|
+
This is the most critical and most perilous step in modeling. All models require simplification, but one must **explicitly document every assumption**: Which factors are important and which can be neglected? Is the system deterministic or stochastic? Static or dynamic? Are variable relationships linear or nonlinear? Every assumption must be justified.
|
|
59
|
+
|
|
60
|
+
### Step 3: Establish Mathematical Structure / Dimensional Analysis
|
|
61
|
+
Choose a mathematical framework based on the assumptions:
|
|
62
|
+
|
|
63
|
+
| Phenomenon Characteristics | Mathematical Framework |
|
|
64
|
+
|---|---|
|
|
65
|
+
| Causal relationships among variables | ODE/PDE (ordinary/partial differential equations) |
|
|
66
|
+
| Spatial distribution and propagation | Partial differential equations (heat conduction, wave, diffusion) |
|
|
67
|
+
| Relationships among discrete objects | Graph theory |
|
|
68
|
+
| Decision-making under uncertainty | Probabilistic models |
|
|
69
|
+
| Resource allocation | Optimization models |
|
|
70
|
+
| Population behavior and interactions | Statistical models / Markov chains / Agent-based models |
|
|
71
|
+
| Classification and prediction | Function approximation / Regression |
|
|
72
|
+
|
|
73
|
+
Before constructing equations, one must verify dimensional consistency and construct $k=n-m$ dimensionless Pi terms to reduce variables and simplify equations; dimensionally inconsistent equations are physically inadmissible.
|
|
74
|
+
|
|
75
|
+
### Step 4: Solve
|
|
76
|
+
Solve the model using mathematical methods: **analytical solutions** (exact but possibly nonexistent), **numerical solutions** (approximate but always obtainable), **qualitative analysis** (seeking properties such as stability and monotonicity rather than explicit solutions).
|
|
77
|
+
|
|
78
|
+
### Step 5: Interpret and Validate
|
|
79
|
+
Translate the mathematical solution back into real-world language; compare with existing data or experimental results; perform sanity checks to verify whether predictions are reasonable. Conclusions inconsistent with reality are invalid no matter how "elegant" they may be.
|
|
80
|
+
|
|
81
|
+
### Step 6: Sensitivity Analysis and Model Selection
|
|
82
|
+
**Sensitivity analysis**: If a small perturbation in a parameter causes a large change in output, that parameter is sensitive and its precision must be carefully controlled.
|
|
83
|
+
**Bias-variance trade-off**: Simple models have high bias and low variance (underfitting); complex models have low bias and high variance (overfitting); the optimal model strikes a balance between the two.
|
|
84
|
+
**Model selection criteria**: AIC $= -2\log L + 2k$ (favors slightly more complex models, suitable for prediction); BIC $= -2\log L + k\log n$ (heavier penalty, favors parsimony, suitable for explanation); Cross-validation (CV) evaluates out-of-sample predictive performance and guards against overfitting.
|
|
85
|
+
|
|
86
|
+
### Step 7: Iterate and Improve
|
|
87
|
+
Models almost always require refinement. If predictions conflict with evidence: Which assumption is at fault? Should new factors be introduced? Should the mathematical framework be changed? When predictions disagree with reality, the response is not to abandon modeling but to revise the model.
|
|
88
|
+
|
|
89
|
+
### Step 8: Declare Scope of Applicability
|
|
90
|
+
Explicitly state the conditions under which the model is valid and those under which it fails. All models have boundaries -- a scope-of-applicability declaration is the model's "expiration label" and is the key safeguard against misuse.
|
|
91
|
+
|
|
92
|
+
## Common Errors
|
|
93
|
+
|
|
94
|
+
| Error | Critique | Correct Approach |
|
|
95
|
+
|---|---|---|
|
|
96
|
+
| Overfitting | Model is too complex, fitting noise rather than signal | Apply Occam's razor: do not multiply entities beyond necessity |
|
|
97
|
+
| Underfitting | Model is too simple to capture key phenomena | Inspect residual patterns to identify missing factors |
|
|
98
|
+
| Ignoring assumption validity | Assumptions are made for mathematical convenience rather than physical plausibility | Every assumption must be grounded in real-world justification |
|
|
99
|
+
| Extrapolating beyond the domain of applicability | Model is valid only within a certain range; beyond it, predictions fail | Explicitly declare the model's scope of applicability |
|
|
100
|
+
| Confusing correlation with causation | Relationships in a model do not imply causation | Distinguish descriptive models from causal models |
|
|
101
|
+
| Forgetting validation | Using a model immediately after construction without checking predictions | Validate with independent data |
|
|
102
|
+
| Ignoring dimensional consistency | Dimensions on both sides of an equation do not match; physically inadmissible | Perform dimensional analysis before constructing equations; construct dimensionless Pi terms |
|
|
103
|
+
| Selecting models based only on in-sample fit | In-sample error underestimates true prediction error | Use AIC/BIC or cross-validation to assess out-of-sample performance |
|
|
104
|
+
| Neglecting sensitivity analysis | Not knowing which parameters drive the results | Perform sensitivity analysis on key parameters and focus on sensitive ones |
|
|
105
|
+
| Confusing validation with model selection | Validation tests a given model; selection compares among candidates | First select a model using AIC/BIC/CV, then validate with independent data |
|
|
106
|
+
| Excessively complex model leading to incomputability | Parameterization cannot be tensorized / GEMM-mapped; $O(n^2)$ memory explosion | Choose a tensorizable, fusible, numerically stable equivalent parameterization; pass the GPU eight-dimensional gate |
|
|
107
|
+
|
|
108
|
+
## Operating Procedure
|
|
109
|
+
|
|
110
|
+
When this skill is triggered, the output must include:
|
|
111
|
+
|
|
112
|
+
1. **Problem definition**: A one-sentence description of the real-world problem to be solved
|
|
113
|
+
2. **Assumption list**: `[Assumption N]: [Content] (Plausibility: High/Medium/Low)`
|
|
114
|
+
3. **Dimensional check**: Perform dimensional analysis on key physical quantities and construct dimensionless Pi terms
|
|
115
|
+
4. **Model selection**: `[Framework]: [Choice] because [Reason]`
|
|
116
|
+
5. **Variable definitions**: Define all variables, parameters, and their physical meanings
|
|
117
|
+
6. **Solution approach**: Specify the solving method (analytical / numerical / qualitative)
|
|
118
|
+
7. **Sensitivity analysis**: Identify sensitive parameters and assess their impact on the output
|
|
119
|
+
8. **Model selection criteria**: If candidate models exist, compare them using AIC/BIC/CV and select the best
|
|
120
|
+
9. **Validation plan**: How will the model's validity be tested?
|
|
121
|
+
10. **Scope of applicability**: Explicitly state the conditions under which the model is valid and those under which it fails
|
|
122
|
+
11. **[GPU viability]** (if used for algorithm/operator/structure): Whether the model parameterization is tensorizable / GEMM-mappable, whether complexity and memory are acceptable; pass the eight-dimensional gate in `../../references/gpu-friendly-math.md`; label as friendly / retrofittable / unfriendly, with adaptation recommendations.
|
|
123
|
+
|
|
124
|
+
**Output must not consist of analysis alone without conclusions.**
|
|
125
|
+
|
|
126
|
+
## Relations to Other Skills
|
|
127
|
+
|
|
128
|
+
- **Axiomatic thinking**: The assumptions of a model are analogous to axioms; their consistency must be verified.
|
|
129
|
+
- **Abstraction**: Modeling is an application of abstraction -- abstracting from reality to a mathematical structure.
|
|
130
|
+
- **Optimization**: The objective function of many models is itself an optimization problem.
|
|
131
|
+
- **Probability and statistics**: Modeling uncertainty requires the tools of probability theory.
|
|
132
|
+
- **Transformation**: Solving a model often requires transforming it into a more tractable representation.
|
|
133
|
+
- **Algorithmic thinking**: Computational models (agent-based, cellular automata) employ algorithms as the modeling framework.
|
|
134
|
+
- **Causal inference**: Causal models (DAGs, structural causal models) explicitly distinguish causation from correlation.
|
|
135
|
+
- **Modern mathematics activation**: `../../references/books/smooth-manifolds.md` (manifold constraints / latent-space geometry), `../../references/books/differential-geometry.md` (metrics / curvature), `../../references/books/optimization-ml.md` (parameterization and training).
|
package/skills/modeling/SKILL.md
CHANGED
|
@@ -5,6 +5,8 @@ description: |
|
|
|
5
5
|
English: Trigger when translating real-world problems into mathematics (reality→math→interpretation), building predictive/explanatory models, performing dimensional analysis and model selection, or establishing computable models for algorithms/operators/structures.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
> **语言路由**:若用户消息为英文,请读取并遵循同目录下的 `SKILL.en.md`,按其操作规程以英文输出;中文消息则继续使用本文件。
|
|
9
|
+
|
|
8
10
|
# 🌉 建模思想 / Modeling
|
|
9
11
|
|
|
10
12
|
> "将现实世界的问题转化为数学问题,通过求解数学问题来解释和预测现实。所有模型都是错的,但有些是有用的。"
|