【文章标题】:MathKernel: 一个具备证据感知能力的多引擎数学内核及MCP服务器

【文章正文】: An evidence-aware multi-engine mathematics kernel — usable both as a Python library (mathkernel) and as an MCP server (mathkernel-mcp) — so applications and LLMs can do advanced mathematics while preserving assumptions, provenance, and claim-specific evidence. 一个具备证据感知能力的多引擎数学内核——既可作为Python库(mathkernel)使用,也可作为MCP服务器(mathkernel-mcp)运行——使得应用程序和大型语言模型能够进行高级数学运算,同时保留假设、来源和特定声明证据。

The LLM interprets intent; the MathKernel establishes mathematical evidence. 大型语言模型负责解析意图;MathKernel则负责建立数学证据。

Mathematical results carry an explicit trust level, an engine tag, and a derivation trail. Exact computation, checked certificates, symbolic results, certified enclosures, empirical evidence, and formal proofs are distinct claims. Exact arithmetic alone is not a formal proof; approximate-input ancestry must not silently disappear. 数学结果携带明确的信任级别、引擎标签和推导轨迹。精确计算、验证证书、符号结果、认证包围、经验证据和形式证明是不同的声明类型。仅凭精确算术不能构成形式证明;近似输入的来源绝不能无声消失。

LLMs are good at mathematical intent and bad at mathematical arithmetic. MathKernel inverts the division of labor: the model parses, plans, and interprets; the kernel computes and records claim-specific evidence. Some claims use independent certificates or cross-checks; others are exact computations in one engine. Engine agreement alone is not a proof, and a single trust label does not replace the evidence bundle. 大型语言模型擅长数学意图解析却不擅长数学运算。MathKernel扭转了这种分工:模型负责解析、规划和解释;内核则负责计算并记录特定声明证据。某些声明使用独立证书或交叉验证;其他则是单一引擎中的精确计算。仅引擎一致并不构成证明,单一信任标签也无法替代证据包。

MathKernel is a typed orchestration layer rather than a single solver. The public facade owns parsing, contexts, object identity, persistence, evidence composition, resource policy and derivation tracking; domain adapters own the actual mathematics. Presentation layers sit downstream and cannot silently change the claim being made. MathKernel是一个类型化编排层而非单一求解器。公共门面层负责解析、上下文、对象标识、持久化、证据组合、资源策略和推导追踪;领域适配器则负责实际数学运算。呈现层位于下游,不能无声改变正在进行的声明。

Python / MCP | v MathKernel facade |— parser + contexts + typed objects |— execution/evidence contract |— persistence + derivation graph | +—> symbolic / exact / certified / formal / numerical engines | +—> MathResult and derived mathematical objects | +—> MultimodalProjection |—> mathkernel-viz |—> mathkernel-sonify +—> unified portable artifacts Python/MCP | v MathKernel门面层 |— 解析器 + 上下文 + 类型化对象 |— 执行/证据契约 |— 持久化 + 推导图 | +—> 符号/精确/认证/形式/数值引擎 | +—> MathResult及派生数学对象 | +—> 多模态投射 |—> mathkernel可视化 |—> mathkernel声效化 +—> 统一便携制品

This separation is deliberate: a renderer may present evidence, but it does not create stronger mathematical evidence merely by producing a polished plot or audio artifact. 这种分离是刻意的:渲染器可以呈现证据,但仅通过生成精美的图表或音频制品并不会创造更强的数学证据。

DomainCompute surfaceEnginesVerification / evidence ceiling
领域计算表面引擎验证/证据上限
Symbolic algebraparse, substitute, simplify/expand/factor, solve, systemsSymPySYMBOLIC; input ancestry may lower it
符号代数解析、替换、简化/展开/因式分解、求解、方程组SymPy符号级;输入来源可能降低等级
Calculusdifferentiation, integration, limits, series, sums, productsSymPySYMBOLIC + conditions
微积分微分、积分、极限、级数、求和、乘积SymPy符号级+条件验证
Integral transformsLaplace/Fourier/Mellin/bilateral Z, inverses, ROC and property obligationstyped transform adapter + SymPySYMBOLIC; NUMERIC for approximate ancestry
积分变换拉普拉斯/傅里叶/梅林/双边Z变换、逆变换、收敛域及属性约束类型化变换适配器+SymPy符号级;近似输入源为数值级
Complex analysisbranches/domains, zeros/singularities, residues, Laurent series, contours, argument principle, continuation, conformal mapstyped complex adapter + SymPySYMBOLIC defining identities; EXACT winding certificates only for exact geometry, ancestry-capped otherwise
复分析分支/定义域、零点/奇点、留数、洛朗级数、围道、辐角原理、延拓、共形映射类型化复数适配器+SymPy符号定义恒等式;仅精确几何有精确环绕证书,其他受限于输入源
Continuous probabilitytyped univariate/joint/conditional distributions, transformations, marginals, Bayes, covariance, divergence, order statisticstyped probability adapter + SymPySYMBOLIC normalization/identity evidence; mathematical nonexistence retained
连续概率类型化单变量/联合/条件分布、变换、边缘分布、贝叶斯、协方差、散度、顺序统计量类型化概率适配器+SymPy符号归一化/恒等证据;保留数学不存在性
Exact graphstyped simple/directed/weighted/multi graphs, traversal, components, shortest paths, MST, max-flow/min-cut, bipartite matching, Euler trails, coloring, topological sort, cycles, centrality, isomorphismdeterministic exact graph algorithms over Fraction + njit CSR traversal kernelsEXACT witness certificates; NP-hard optimality is OPTIMUM/CANDIDATE/IMPOSSIBLE/UNKNOWN, never heuristic nonexistence
精确图论类型化简单/有向/加权/多重图、遍历、连通分量、最短路径、最小生成树、最大流/最小割、二分图匹配、欧拉迹、着色、拓扑排序、环、中心性、同构基于Fraction的确定性精确图算法+njit CSR遍历内核精确见证证书;NP难问题最优解为OPTIMUM/CANDIDATE/IMPOSSIBLE/UNKNOWN,永不使用启发式不存在判定
Exact combinatoricscombinatorial classes, exact counts, lazy generation, ordinary/exponential generating functions, recurrencesexact integer/ Fraction enumeration + SymPy + checked njit recurrence kernelsEXACT counts and recurrence/coefficient checks
精确组合数学组合类、精确计数、惰性生成、普通/指数生成函数、递推关系精确整数/Fraction枚举+SymPy+验证型njit递推内核精确计数及递推/系数验证
Finite algebrafinite groups, permutation groups, abelian groups, homomorphisms, Z/nZ, GF(p^m), modules, Smith/Hermite normal formsexact algebra + SymPy combinatorics + njit Cayley/GF(p)[x] kernelsEXACT axiom, homomorphism, irreducibility, and normal-form certificates
有限代数有限群、置换群、阿贝尔群、同态、Z/nZ、GF(p^m)、模、史密斯/埃尔米特范式精确代数+SymPy组合数学+njit凯莱/GF(p)[x]内核精确公理、同态、不可约性及范式证书
Linear algebradeterminant, inverse, multiply, rank, RREF, eigenvalues, exact solvesSymPyEXACT for exact arithmetic; otherwise ancestry-capped
线性代数行列式、逆矩阵、乘法、秩、行最简形、特征值、精确求解SymPy精确算术时为EXACT;否则受限于输入源
Reasoningobligation-DAG planning, equivalence, counterexamplesSymPy + Z3 + LeanSYMBOLIC / EXACT / FORMAL by verifier
推理义务有向无环图规划、等价性、反例SymPy+Z3+Lean验证器决定的SYMBOLIC/EXACT/FORMAL
Certified numericsarbitrary-precision evaluation and interval enclosuresmpmath + mpmath.ivCERTIFIED NUMERIC or NUMERIC
认证数值任意精度求值和区间包围mpmath+mpmath.ivCERTIFIED NUMERIC或NUMERIC
Integersarbitrary precision, gcd/lcm, primality, factorization, CRT, modular arithmeticexact + numba batchEXACT
整数任意精度、最大公约数/最小公倍数、素数性、因式分解、中国剩余定理、模运算精确+numba批处理EXACT
Code generationTypeScript/Python/Rust emission, typecheck, symbolic round-trip, sandboxcompilers + SymPySYMBOLIC verification; never stronger than source
代码生成TypeScript/Python/Rust输出、类型检查、符号往返、沙箱编译器+SymPy符号验证;强度不超过源代码
Binary fieldsGF(2^m) arithmetic/construction and Rabin irreducibil
二元域GF(2^m)算术/构造及Rabin不可约性