跳转到内容

Aira Typed Field IR v0.1 契约

状态:Draft / Contract + CPU/WASM + Field ArtifactGraph + GeneralImplicit Prerequisite + Smooth Extraction Spike Gates Verified
Field IR 版本:0.1.0
Field→Mesh translation:0.2.0
Field Schema:field-ir.schema.json
Translation Schema:field-to-mesh-translation.schema.json
GeneralImplicit Analysis Schema:general-implicit-analysis.schema.json
Smooth Extraction Schema:smooth-implicit-extraction.schema.json
机器证据:field-ir-v0.1.json Field provenance 证据:artifact-graph-field-v0.2.json GeneralImplicit 前置证据:general-implicit-prerequisite-v0.1.json Smooth extraction 证据:smooth-implicit-extraction-v0.1.json

Field IR 是可序列化、可静态分析、可内容寻址的三维标量场表达式图。它不接受任意 JavaScript、shader 文本、 文件/网络调用或回调对象。相同纯数据图可以编译到 CPU/WASM evaluator、未来的 GPU preview 与显式 mesh conversion,但任何后端都必须遵守同一 kind、符号、bounds、Lipschitz 和 loss contract。

v0.1 是最小纵向样机,不是 Phase 2 的完整隐式建模语言。它证明表示边界可执行,尚不包含 smooth blend、 warp、repeat、lattice、gyroid、material field、automatic differentiation 或层级 pruning。

TypedFieldIr 是闭合对象,必填:

  • fieldVersion=0.1.0;
  • 内容寻址 fieldId=field:sha256:<digest>;
  • root;
  • 以 FieldNodeId 为键的 nodes;
  • runtime 静态推导的 nodeContracts;
  • 与 root node contract 相同的 rootContract。

图使用 canonical decimal string,禁止 JSON 浮点数、1.0/01/-0 等非规范等价拼写。node map 先按 UTF-16 code unit 排序再哈希;commutative input list 也必须去重并使用同一排序。上限为 256 nodes、深度 64。 cycle、缺失依赖、孤立 node、非规范 ID/decimal、隐藏对象字段和 contract/hash 篡改均 fail closed。

operation 输入 输出 kind surface bounds normalization order
field.sphere@1.0.0 center、radius TrueSDF center ± radius,proven 1
field.box@1.0.0 center、halfSize TrueSDF center ± halfSize,proven null
field.union@1.0.0 ≥2 fields GeneralImplicit child bounds union,proven null
field.intersection@1.0.0 ≥2 fields GeneralImplicit child bounds intersection,proven null
field.difference@1.0.0 base、≥1 subtract GeneralImplicit base bounds,proven null

box 保持 TrueSDF,但边/角不可微,所以 v0.1 不把它的正规化阶数冒充已证明。Boolean 按 AMIR 的保守规则 降级为 GeneralImplicit;min/max 组合仍保留 negative-inside、Length value、有限 proven surface bounds 与 Lipschitz upper bound 1,但不因此重新升级为 TrueSDF。

每个 node 都发布:

  • kind: TrueSDF | ConservativeDistance | GeneralImplicit;
  • valueType=Length;
  • insideSign=negative;
  • mathematicalDomain=allSpace;
  • finite surfaceBounds 与 surfaceBoundsClaim=provenUpperBound;
  • lipschitzBound 与 claim level;
  • gradientMode;
  • normalizationOrder: positive integer | null。

这些不是作者自由填写的 metadata。Core 从 node graph 重算全部 contract,并将它们一起纳入 fieldId。任何 不一致都是 FIELD_CONTRACT_MISMATCH,不能作为 warning 继续。

reference compiler 产生确定性 dependency order,逐点求值:

  • sphere:length(p-center)-radius;
  • box:标准 negative-inside box SDF;
  • union:min(children);
  • intersection:max(children);
  • difference:max(base, -min(subtract))。

半径 10 mm 球体在中心、零面和外部 2 mm 点的实际输出固定为 [-10, 0, 2]。evaluator 只接受三个有限 binary64 coordinate;NaN/Infinity 与错误 evaluation order fail closed。

convert.fieldToMesh@1.0.0 必须显式携带:

  • source/target 各自的 Revision、Evaluation、ExecutionManifest、ArtifactGraph hash、artifact ID 与 content hash;
  • source fieldId、contract hash 与 kind,以及 target buffer hashes;
  • finite meshingBounds;
  • zero isoValue、edgeLength、rootTolerance、maxCells 与 requireBoundedError;
  • adapter/kernel/sign semantics;
  • loss certificate 与 diagnostics。

v0.1 只接受 Field3D<TrueSDF> 和 zero level set。GeneralImplicit 即使能数值找零,也会返回 FIELD_MESH_KIND_UNSUPPORTED,因为当前没有为它定义 root tolerance 的距离含义。扩展接受集必须升级合同并 提供相应证据。

首版 adapter 锁定 Manifold 3.5.1 levelSet,其算法声明为 body-centered-cubic marching tetrahedra。 Manifold callback 使用 positive-inside,而 Aira 固定 negative-inside,因此 adapter 必须同时取反 field 与 iso, 并在 method/diagnostic 中记录 negate-field-and-iso;调用方不得自行猜符号。

meshing 前置条件:

  1. meshingBounds 每一轴必须以至少一个 edgeLength margin 包含 proven surfaceBounds,避免 kernel 在边界 人工封口;
  2. 以 BCC 双格保守估算 cell count,超过 maxCells 时在加载/执行 mesher 前失败;
  3. rootTolerance <= edgeLength;
  4. requireBoundedError=true 时当前直接返回 ERROR_BOUND_UNAVAILABLE。

loss claim 刻意分层:

  • 实际 mesh vertex 的 abs(fieldValue) 最大值是 measuredEstimate,名称为 field residual,不是距离证明;
  • edgeLength 和 rootTolerance 是 requestedOnly;
  • global Hausdorff 是 unknown;
  • exact dimensions 与 STEP authority 为 false;
  • face SemanticRef survival 为 unknown,禁止为三角面编造 source face identity;
  • Manifold NoError 只证明其 MeshSolid/topology 后置条件,不证明几何误差。

真实 fixture 为半径 10 mm 球体,meshing bounds 为 [-12,12]^3,root tolerance 为 0.02 mm:

edgeLength estimated BCC cells vertices triangles max vertex field residual
2 mm 3,456 662 1,320 0.000001407601 mm
1 mm 27,648 3,482 6,960 0.000008847173 mm

两档均为 NoError。重复 1 mm bake 的 translation ID、target content hash、vertex/triangle buffer hash 与实际 buffers 全部相同。细网格的 vertex field residual 没有比粗网格更小,直接证明“分辨率更细”不能被当作该 metric 单调或 global error bound。

Field ArtifactGraph 0.2.0 的真实 Boolean fixture 产生 3 个 ScalarField artifacts、1 条局部 derivation; root GeneralImplicit 发布一个 Region/zero-set,lineage 同时保留左右 primitive 和 union node origin。重复 构建的 graph hash、root artifact ID 与 Region ID 全部稳定。球体 translation 的 source/target graph hash 与 artifact locator 均由 translation endpoint 绑定;Mesh target 发布 0 个 Face,face survival 保持 unknown。

负向 Gate 固定:

  • bounded-error:ERROR_BOUND_UNAVAILABLE;
  • surface bounds margin 不足:FIELD_MESH_BOUNDS_MARGIN_INSUFFICIENT;
  • cell budget 超限:FIELD_MESH_CELL_BUDGET_EXCEEDED;
  • GeneralImplicit bake:FIELD_MESH_KIND_UNSUPPORTED。

9. GeneralImplicit zero-set 与 mesher prerequisite

Section titled “9. GeneralImplicit zero-set 与 mesher prerequisite”

GeneralImplicit 的 root 只声明 negative-inside / zero-boundary / positive-outside。其数值单位仍为 Length, 但数值大小不是到零集的欧氏距离,因此 rootTolerance、abs(fieldValue)、cell size 都不能直接解释为 geometric distance 或 global Hausdorff bound。

GeneralImplicitAnalysisCertificate 0.1.0 是前置判定合同,不是 mesh result:

  • 组合 interval evaluator 覆盖当前五种 Field op,所有 binary64 运算向外舍入;
  • octree leaf 为 excluded / regular / unresolved,每个 cell 都有稳定 ID、bounds、range 与 reason code;
  • regular 必须通过 Plantinga–Vegter gradient inner-product condition;
  • min/max 只有在一个 child 的 value interval 严格支配其他 child 时才继承其梯度;Boolean seam 不允许猜 active branch;
  • proven surface bounds 必须与 domain boundary 有严格正 margin;
  • 最大深度与 cell budget 只产生显式 unknown,不能降级成采样成功;
  • runtime 永久禁止该 prerequisite checker 把 actualIsotopy、outputTopology 或 globalHausdorff 升为 pass。

真实 fixture 的 smooth sphere 为 eligible(137 cells,120 leaves,0 unresolved);overlapping union 为 unresolved(144 unresolved leaves);identical-field difference cusp、box 也为 unresolved;domain 接触 surface bounds 为 ineligible;maxCells=1 为 budget-explicit unresolved。重复 sphere certificate 的完整内容 与 analysisId 稳定。

算法裁决因此分成两条,不再假设“一种 implicit mesher 通吃”:

  1. smooth regular zero set:当前 bounded regular-grid extraction spike 只接收本前置证书;
  2. hard min/max CSG seam 与非光滑 primitive:另行选择 feature-aware certified lane,在此之前不扩张接受集。

现有 Manifold adapter 没有接入该 checker,也没有因此扩大到 GeneralImplicit。详见 GeneralImplicit prerequisite 验证。

SmoothImplicitExtractionEvidence 0.1.0 消费完整重算后仍为 eligible 的 prerequisite certificate。它不是 通用或 production mesher;v0.1 固定 uniformDepth ≤ 6 的完整 dyadic grid,并对每个 uniform cell 再执行 同一 interval classifier。任何 unresolved cell、多个 boundary loops、非法 face crossing/degree、field 或 certificate binding 不一致都会 fail closed。

正式 evidence 同时绑定:

  • 每个 regular cell 的 proven parameterAxis、crossing/zero-corner/ambiguous-face/loop/disposition witness 与 规范 hash;
  • Float64 position buffer 和 Uint32 triangle buffer 的独立 SHA-256;
  • 运行时从 triangles 重算的 degenerate/duplicate faces、edge incidence、共享边 winding、vertex links 与 connected components;
  • 由上述整数元数据和 hash 构造的 extractionId。

中心球(depth 3)得到 110 vertices / 216 triangles;偏心球(depth 4)得到 610 / 1216。两者均为单分量 closed oriented combinatorial 2-manifold,重复运行的 extraction/buffer/witness identity 稳定。组合拓扑通过不 代表几何嵌入无自交,也没有完成当前 face-loop 构造到 Plantinga–Vegter 完整三维 regular-isotopy theorem 的 证明映射。因此合同固定:outputTopology=pass,但 actualIsotopy/globalHausdorff/selfIntersection=unknown。

当前 regular-grid constructor 对 ambiguous face 使用 orientation-fixed diagonal,使相邻 cells 的共享 face 连接一致;cell patch 使用严格 cell center 的 triangle fan,winding 只由共享边约束传播,不声称 outward。 全部 256 个 cube corner-sign case 已穷举分类:2 empty、162 single-loop(36 ambiguous)、44 multi-loop 保持不支持、48 multiple-ambiguous-face fail closed,unexpected rejection 为 0。这个 corpus 证明实现的 case partition 与 face compatibility,不证明 local fan disk 的几何嵌入、relative-boundary isotopy 或全局 self-intersection freedom。

详见 Smooth implicit extraction spike 验证。

独立 SmoothImplicitLocalPatchEvidence 0.1.0 进一步从 sealed extraction buffers 反向绑定每个 meshed cell 的 bounds、parameter axis、唯一 strict center、ordered boundary vertices、triangle range 与 patch hash。checker 把 cube edge midpoint 精确归一化为 {0,1,2}³ 整数点,验证 single simple face-loop、triangle partition 与 非相邻 face segments 无交;由凸 cell boundary 的 ray uniqueness,当前 center fan 因而是 embedded disk。 centered/off-grid 两个 fixture 分别封存 56/306 个通过 patch,bow-tie、duplicate edge、off-center、 non-midpoint 与 binding tamper 均 fail closed。

这只把 proof matrix 的 PV3D-12 升为 satisfied;localRelativeBoundaryIsotopy/globalRegularIsotopy/ globalSelfIntersection 继续为 unknown。详见 Smooth implicit local patch Gate。

独立 SmoothImplicitPvApplicabilityEvidence 0.1.0 再从 prerequisite interval checker 重算每个 regular cell 的 parameterDirection,并把它与 extraction axis、八角点 sign bits、crossing/ambiguous/loop case 和 hash 绑定。centered/off-grid 的 80/306 regular cells 全部相容,方向、sign case、certificate、Field 与 prerequisite 篡改均 fail closed。全量 256×3×2=1536 membership corpus 中只有 486 个与指定单调方向相容,但仍包含 84 个 ambiguous-face 和 48 个 two-loop memberships,因此这个证书只强化 theorem applicability,不证明 normalization 或 isotopy。详见 Smooth implicit PV theorem-applicability Gate。

独立 normalization-absence companion certificate 又给出一个更窄的可接受子集:对 exact-zero-free 的 off-grid fixture 完整检查 13,056 个 grid faces 与 13,872 条 grid edges;每个 slice 要么 value interval 排除 0,要么相应 tangential/axial derivative interval 排除 0。因此该 fixture 不需要 face-bubble 或 repeated-edge normalization。centered fixture 因 grid vertex 精确为 0 而 fail closed;symbolic perturbation、 一般 normalization 与 relative-boundary deformation 仍未见证。详见 Smooth implicit normalization-absence Gate。

Lane R 曾为此设计独立的 radial isotopy companion certificate:只接受一个 exact centered sphere 与通过 exact dyadic radial degree-one checker 的 sealed midpoint-fan mesh,从而令 actualIsotopy/globalSelfIntersection=pass,而 generic extraction 与全部被拒输入保持 unknown。

【未实现,契约已于 2026-09-08 退役】 该 companion 的 schema 与 559 行契约代码写完后从未接线: 同族的 general-implicit-analysis(9 个包外消费者)、smooth-implicit-certified-adaptive(3 个)与 smooth-implicit-extraction(2 个)都有真实调用方,只有它是 0。没有任何代码路径能产出上述 pass, 因此本节描述的是设计意图,不是当前行为;当前 actualIsotopy 在所有输入上仍为 unknown。

之后的 certified adaptive / Hausdorff companion 不改写本 v0.1 规格,而以 Field IR 0.2 的 sphere + smoothUnion 子集、exact rigid transform、2:1 octree 与 independent replay checker 补齐数值 globalHausdorff upper bound 和 adaptive claim。只有具体证书重放通过后 才返回 certified-isotopy production manifest;本 v0.1 extraction 的原 claim 继续不变。

  • Field IR/mesher 仍为 isolated spike,不进入 production AMIR operation catalog 或 Aira capability surface;
  • 当前只有 CPU/WASM evaluator,没有 WebGPU/TSL compiler;
  • representation-local Field ArtifactGraph 已实现,但 Field Region 尚未接入产品 SemanticRef/query path;
  • material/feature provenance 与 Field→Mesh face mapping 尚未实现;
  • GeneralImplicit prerequisite 与 bounded smooth extraction spike 已实现,并有 closed combinatorial output-topology evidence;legacy extraction 本身的 claim 不变;另有 uniform Freudenthal 与 Field IR 0.2 adaptive companion 在各自公开接受域内给出 isotopy/self-intersection、Hausdorff 与 adaptive 证书;
  • axis-direction / corner-sign applicability certificate 已实现;它明确证明单调相容性不能排除所有 ambiguous face 或 multi-loop case,normalization 仍为独立前置条件;
  • normalization-absence certificate 只接受 exact-zero-free 且所有 face/edge slice 可证明排除异常的子集; 它没有改变 generic actualIsotopy=unknown;
  • radial isotopy certificate 未实现(契约 2026-09-08 退役):它本应只接受 exact sphere + bounded dyadic radial degree-one mesh,但从未接线,因此它既不收窄也不放宽当前的 unknown;
  • 没有 cancellation-aware异步 chunking;同步 Manifold callback 只适用于本有界 Gate;
  • Edge 仍只是非阻塞发布兼容 smoke,不是 Field Gate 前置条件。

按 2026-08-31 后续用户裁决,Lane R 已以 uniform + adaptive companion 关闭 18 项 proof matrix。后续 Gate 只扩大证书接受域,不重开已关闭 obligation。hard min/max CSG 继续走独立非光滑算法轨;GPU authoritative path 仍未启用,production 只允许 checker 重放后对具体证书生成 capability,不替 Lane F 扩张 warp、lattice 或工业 feature catalog。