Skip to content

feat(pillar): substrate-tier Pillars 12-17 + design charter#188

Merged
AdaWorldAPI merged 4 commits into
masterfrom
feat/pillar-substrate-12-to-17
May 21, 2026
Merged

feat(pillar): substrate-tier Pillars 12-17 + design charter#188
AdaWorldAPI merged 4 commits into
masterfrom
feat/pillar-substrate-12-to-17

Conversation

@AdaWorldAPI
Copy link
Copy Markdown
Owner

Pillar substrate tier (12–17): native ndarray pillars

Summary

Adds six native pillars to src/hpc/pillar/, peering with the lance-graph-migrated Pillars 6–11. Three are implemented and pass against numpy reference implementations; three are deferred with full proof-obligation docstrings, mirroring the DEFERRED convention from lance-graph/crates/jc.

The pillar set:

# Name Status Proves against Probes
12 Splat-construction rotation invariance implemented splat3d::spd3::Spd3::from_scale_quat 4096 synthetic (scale, quat) pairs; Σ=R·diag(s²)·Rᵀ SPD + trace/det/Frobenius rotation invariants
13 HHTL cascade contraction implemented dn_tree::bundle_into / cognitive HHTL cascade 256 cascades × depth 4 at lr=0.5; almost-sure contraction + per-level mean ratio CLT vs predicted (1-lr)
14 OGIT type-gate lattice closure implemented ogit_bridge::schema::OntologySchema (subClassOf semantics) 64 synthetic DAG schemas × 64 types; reflexive/antisymmetric/transitive after Floyd-Warshall closure
15 Mexican-hat / DoG unimodality deferred dragonfly Mexican-hat kernel (when it lands) DoG unimodality at κ ∈ [1.5, 3.0]
16 BTSP gating unbiasedness deferred dn_tree BTSP API (when contract-frozen) Doob optional-stopping unbiasedness of gated bundle
17 Quaternary tree balance under Zipf deferred DNTree + Zipf workload simulator (when both exist) Brent-style balance under power-law access

All six share the existing prove_runner.rs harness (SplitMix64, PillarReport, assert_psd_rate). Substrate-tier pillars are gated under the same pillar feature as 6–11. A convenience runner run_substrate_tier() runs all six in order.

Architecture rationale

crates/jc-nd was floated initially but the existing src/hpc/pillar/ module — explicitly documented as the migration target for lance-graph-jc per its module docs — is the right home: it preserves Invariant 12 ("certification is about determinism + inspectability, not repo separation"), keeps the harness types shared, and lets 12–17 sit alongside 6–11 as peer pillars rather than a parallel ecosystem.

The substrate-vs-cognitive-architecture distinction is conceptual, not structural:

  • Pillars 6–11 (migrated) test cognitive-architecture mathematics — EWA-sandwich PSD preservation, Pflug-Pichler nested distance on tree quantization, Hambly-Lyons signature uniqueness, etc.
  • Pillars 12–17 (native) test substrate-tier mathematics — splat construction invariance, bundle contraction, partial-order axioms, etc.

The full thesis is laid out in docs/pillar-substrate-charter.md.

What's tested, what's not

Tested in CI under the pillar feature:

  • Each prove_pillar_N runs deterministically and passes its pass criteria.
  • Each pillar is seed-anchored: two consecutive runs produce bit-identical reports.
  • Each pillar's SEED constant matches its declared spec value (catches accidental edits).
  • Each pillar's kernel math is unit-tested independently (e.g. Pillar 12 verifies frob_sq_sym3 against identity rotation; Pillar 13 verifies bundle_step at lr=0 and lr=1 boundary conditions; Pillar 14 verifies closure idempotence).

Sanity-checked offline against numpy references (results documented in the charter):

  • Pillar 12 max relative invariant error: 1.0e-6 in f32 across 4096 splats (budget 1e-3).
  • Pillar 13 max per-level mean-ratio deviation: 5e-3 (budget 0.02).
  • Pillar 14 axiom-check pass rate: 1.000000 across 467,399 checks.

Not tested (intentional):

  • Production code paths in splat3d, dn_tree, ogit_bridge are not coupled to pillars in this PR. The pillars re-derive their math independently, by design — drift between substrate and pillar is the failure mode pillars exist to catch.
  • Deferred pillars 15–17 emit a passed=true deferred-shape report (all-zero numeric fields). When their activation gates open, the body is replaced with the probe described in the docstring.

File-by-file changes

src/hpc/pillar/
├── mod.rs                   MODIFY  +120 lines  (register 12-17, add run_substrate_tier())
├── splat_invariants.rs      NEW     444 lines   (Pillar 12)
├── hhtl_contraction.rs      NEW     454 lines   (Pillar 13)
├── ogit_lattice.rs          NEW     462 lines   (Pillar 14)
├── mexican_hat.rs           NEW     156 lines   (Pillar 15 — deferred)
├── btsp_unbiased.rs         NEW     161 lines   (Pillar 16 — deferred)
└── tree_balance.rs          NEW     155 lines   (Pillar 17 — deferred)

docs/
└── pillar-substrate-charter.md  NEW  505 lines  (design document)

Total: ~2550 lines, of which ~500 is the design document and ~470 is deferred-pillar proof-obligation docstrings.

How to run

# All substrate-tier pillars at once
cargo test --features std,linalg,pillar \
    -p ndarray --lib hpc::pillar -- --test-threads=1

# Just one pillar
cargo test --features std,linalg,pillar \
    -p ndarray --lib hpc::pillar::splat_invariants

# Via the convenience runner
cargo test --features std,linalg,pillar \
    -p ndarray --lib hpc::pillar::tests::run_substrate_tier

Review pointers

  • Top-of-file order is the same as Pillars 6–11: //! header → SEED const → constants → kernels → probe entry → tests.
  • All seed constants follow the 0x_C{NN}{tag} mnemonic pattern (e.g. C12A_550A_D0DD for "C12A SS0AD0DD" → "Pillar 12 splat 0AD0DD").
  • PillarReport field semantics are documented per-pillar where they differ from the EWA-sandwich convention (e.g. psd_rate repurposed as "contraction preservation rate" for Pillar 13, "Sylvester SPD pass fraction" for Pillar 12; lognorm_concentration repurposed as natural log-deviation metric in each).
  • The design doc is the dilution-resistant artifact. If anything in the code is unclear, that document was meant to make the why explicit; corrections to it are welcome.

Known follow-ups (deliberately not in this PR)

  • Activate Pillar 15 when the Mexican-hat / DoG resonance kernel lands.
  • Activate Pillar 16 when the BTSP API in dn_tree is contract-frozen.
  • Activate Pillar 17 when the Zipf workload simulator and DNTree inspector methods land.
  • Future Pillar 12.1 (non-unit quaternion drift) — flagged in the charter's open-questions section.
  • Future Pillars 18+ (resonance L²-norm, Cuchiero universality on the substrate, multi-scale signature consistency, cubature construction) — sketched in the charter's "future candidate pillars" section.

Commit plan

Splittable across three commits if preferred for cleaner git reset:

  1. feat(pillar): add Pillars 12–14 (implemented) and update mod.rs
  2. feat(pillar): add Pillars 15–17 (deferred stubs with proof obligations)
  3. docs(pillar): add substrate-tier design charter

Or one commit if the unit is the conceptual addition rather than the file boundary.

claude and others added 4 commits May 21, 2026 09:49
Substrate-tier pillars native to ndarray:
- Pillar 12: Splat-construction rotation invariance.
  4096 synthetic (scale, quat) pairs; certifies Σ = R·diag(s²)·Rᵀ is SPD
  and trace/det/Frobenius rotation invariants hold within f32 precision.
- Pillar 13: HHTL cascade contraction.
  256 cascades × depth 4 at lr=0.5; certifies almost-sure d_t ≤ d_{t-1}
  AND per-level mean ratio = (1-lr) within CLT tolerance σ/√N_CASCADES.
- Pillar 14: OGIT type-gate lattice closure.
  64 synthetic DAG schemas × 64 types; certifies reflexivity +
  antisymmetry + transitivity after Floyd-Warshall closure.

mod.rs registers pillars 12-17 alongside migrated 6-11, exposes
run_substrate_tier() convenience runner, and adds tier-documenting
module docs. All pillars share existing prove_runner.rs harness.
Deferred substrate-tier pillars following the lance-graph/crates/jc
DEFERRED convention (Pillar 11 was deferred several months before sigker
landed and activated it):

- Pillar 15: Mexican-hat / DoG unimodality.
  Awaiting Mexican-hat resonance kernel in hpc::dragonfly.
  Will certify DoG kernel unimodality at κ = σ_s/σ_c ∈ [1.5, 3.0].
- Pillar 16: BTSP-gated bundling unbiasedness.
  Awaiting stable BTSP API in dn_tree.
  Will certify Doob optional-stopping unbiasedness of gated bundle.
- Pillar 17: Quaternary tree balance under Zipf access.
  Awaiting Zipf workload simulator + DNTree inspector methods.
  Will certify Brent-style depth/occupancy variance bounds.

Each stub exports its SEED constant, a prove_pillar_N() returning a
deferred-shape PillarReport (zeros + passed=true), and a full
proof-obligation docstring describing the activation plan.
Threads the unified thesis through Pillars 12-17:
- Standing-challenge framing (mathematics demands; substrate is on trial)
- Tier architecture (cognitive-architecture 6-11 vs substrate 12-17)
- Per-pillar walkthroughs (claim, why-substrate-needs, probe, criteria)
- Synthetic-only discipline
- Seven-exchange backstory as motivation
- Future candidate pillars 18+
- Open questions and known limits
CI fmt --all --check (Rust 1.95.0, rustfmt 2026-04-16) collapses
single-condition assert!(...) calls onto one line when they fit
within the configured max width. Apply the canonical formatting to
unblock the substrate-tier-12-to-17 CI gate.

No behavioral change.
@AdaWorldAPI AdaWorldAPI force-pushed the feat/pillar-substrate-12-to-17 branch from 61f3aea to 7b04487 Compare May 21, 2026 09:49
@AdaWorldAPI AdaWorldAPI merged commit eb6444f into master May 21, 2026
17 checks passed
AdaWorldAPI pushed a commit that referenced this pull request May 21, 2026
…scale_quat

Cross-validation test that runs both the pillar's
independently-derived covariance_from_scale_quat() AND the production
Spd3::from_scale_quat() on the same SplitMix64-seeded 256 (scale, quat)
pairs, then asserts upper-triangle agreement to within 1e-5 per lane.

This is the missing wire from #188's "Pillars 12-14 implemented":
the pillar files reference their production targets in docstrings but
do not cross-check against them. The PR description explicitly noted
this gap ("Production code paths in splat3d, dn_tree, ogit_bridge are
not coupled to pillars in this PR. The pillars re-derive their math
independently, by design — drift between substrate and pillar is the
failure mode pillars exist to catch.")

The cross-check below preserves that design — it adds NO coupling in
src/ — but it gates CI on production and pillar agreeing, so drift
WILL fail the build instead of silently passing both kernels.

For the other two implemented pillars in #188:
  - Pillar 13 needs `pub(crate) fn bundle_into` to be re-exported on
    `dn_tree` so a sibling cross-check can compare to production
    (currently private).
  - Pillar 14 needs a separable closure/ancestor accessor on
    `OntologySchema` (currently the closure is implicit in the
    heel→hip→leaf family-bitmap construction with no public
    point-pair `is_ancestor(t, u) -> bool` to validate against).

Both gaps require small production-side surface changes, which is a
better fit for the session that owns the pillar branch; this commit
wires only the gap that needed zero production change.
Copy link
Copy Markdown
Owner Author

Following up on the cross-coupling note in this PR's description ("Production code paths in splat3d, dn_tree, ogit_bridge are not coupled to pillars in this PR. The pillars re-derive their math independently, by design").

I wired the missing drift-check for Pillar 12 on claude/continue-ndarray-x0Oaw (commit 8cb40ca): a new test pillar_12_matches_production_spd3_from_scale_quat that runs both the pillar's covariance_from_scale_quat AND the production Spd3::from_scale_quat on 256 SplitMix64-seeded (scale, quat) pairs, asserting upper-triangle agreement to within 1e-5. Preserves the drift-detection design (no coupling in src/, only in CI tests). Passes locally.

Pillars 13 and 14 need small production-side surface changes before they can be cross-checked — these are the wires I couldn't land from my side without touching the pillar branch's domain:

Pillar 13 (HHTL contraction ↔ dn_tree::bundle_into)

The production reference at src/hpc/dn_tree.rs:108 is currently a private fn bundle_into(current, hv, lr, boost, rng) — no visibility outside the module, so a pillar-side test can't import it. Two options:

  1. Promote to pub(crate) fn bundle_into (least invasive — no public-API contract change).
  2. Have Pillar 13's drift-check exercise the public DNTree::update path and observe the resulting GraphHV's per-level contraction ratio against the predicted (1 - lr) — heavier but matches the PR description's "256 cascades × depth 4 at lr=0.5".

Option 1 is cleaner if you're comfortable widening dn_tree's pub(crate) surface.

Pillar 14 (OGIT type-gate lattice ↔ OntologySchema)

OntologySchema::from_triples at src/hpc/ogit_bridge/schema.rs:286 builds the heel→hip→leaf family bitmap during construction, but the transitive-closure operation is implicit — there's no separable pub fn is_ancestor(&self, t: &str, u: &str) -> bool or pub fn ancestors_of(&self, leaf: &str) -> impl Iterator<&str> to test against. Pillar 14 builds its own closure on synthetic DAGs and has nothing to compare to.

Minimal addition needed:

impl OntologySchema {
    /// Returns true iff `descendant` is reachable from `ancestor`
    /// via the subClassOf chain (reflexive: any class is its own
    /// ancestor). O(depth) — walks the `parent` chain.
    pub fn is_ancestor(&self, ancestor: &str, descendant: &str) -> bool { ... }
}

Then Pillar 14 can assert the four lattice axioms (reflexivity, antisymmetry, transitivity, closure-idempotence) hold on the production schema's actual closure, on top of the synthetic-DAG check it already does.

Happy to write either drift-check once the production surface lands, or you can wire them on the pillar side — whichever you'd rather.


Generated by Claude Code

@AdaWorldAPI
Copy link
Copy Markdown
Owner Author

Thanks for the careful read and the Pillar-12 drift-check on 8cb40ca — the design lands exactly as I would have written it (point-for-point upper-triangle comparison, ε = 1e-5, no production coupling, the "pillar definition wins by design" framing is the right call).

I read the production code at both cited locations to confirm the diagnosis:

  • src/hpc/dn_tree.rs:108 — confirmed fn bundle_into(...), no visibility modifier. Your Option 1 (pub(crate)) is the right pick: zero public-API contract change, just lets sibling modules see it.
  • src/hpc/ogit_bridge/schema.rs:286 — confirmed OntologySchema has EntityClass.parent: Option<Box<str>> populated by from_triples, but no closure query method. is_ancestor(&self, ancestor, descendant) -> bool walking the parent chain is the minimum.

Both surface changes landed on feat/dn-tree-ogit-surface-for-drift-checks (PR #189):

  • bundle_into: fnpub(crate) fn, docstring updated with the visibility rationale and the explicit "not part of the public API, may change without notice" disclaimer.
  • OntologySchema::is_ancestor: reflexive, walks the parent chain, defensive MAX_DEPTH = 64 guard against any cycle that might slip past upstream antisymmetry. Six unit tests covering reflexivity / direct parent / transitive chain / antisymmetry / unknown descendant / disjoint chains.

Once #189 lands you have the surfaces to write the Pillar-13 and Pillar-14 drift checks the way you wrote the Pillar-12 one. Same pattern — same SplitMix64 seed as the pillar, same point-for-point comparison, same "pillar wins by design" semantics for the assertion direction.

The four-pillar drift-check trio (12 from 8cb40ca, 13/14 from whoever lands them next, plus the implicit Pillars 15–17 once their production sides exist) closes the loop the PR description promised. Yours when you're ready.

AdaWorldAPI pushed a commit that referenced this pull request May 21, 2026
…scale_quat

Cross-validation test that runs both the pillar's
independently-derived covariance_from_scale_quat() AND the production
Spd3::from_scale_quat() on the same SplitMix64-seeded 256 (scale, quat)
pairs, then asserts upper-triangle agreement to within 1e-5 per lane.

This is the missing wire from #188's "Pillars 12-14 implemented":
the pillar files reference their production targets in docstrings but
do not cross-check against them. The PR description explicitly noted
this gap ("Production code paths in splat3d, dn_tree, ogit_bridge are
not coupled to pillars in this PR. The pillars re-derive their math
independently, by design — drift between substrate and pillar is the
failure mode pillars exist to catch.")

The cross-check below preserves that design — it adds NO coupling in
src/ — but it gates CI on production and pillar agreeing, so drift
WILL fail the build instead of silently passing both kernels.

For the other two implemented pillars in #188:
  - Pillar 13 needs `pub(crate) fn bundle_into` to be re-exported on
    `dn_tree` so a sibling cross-check can compare to production
    (currently private).
  - Pillar 14 needs a separable closure/ancestor accessor on
    `OntologySchema` (currently the closure is implicit in the
    heel→hip→leaf family-bitmap construction with no public
    point-pair `is_ancestor(t, u) -> bool` to validate against).

Both gaps require small production-side surface changes, which is a
better fit for the session that owns the pillar branch; this commit
wires only the gap that needed zero production change.
AdaWorldAPI pushed a commit that referenced this pull request May 21, 2026
…strate

Completes the substrate-tier drift-check trio for the implemented
pillars in #188 (Pillar 12 already wired in 8cb40ca on this branch
against Spd3::from_scale_quat).

Pillar 13 ↔ dn_tree::bundle_into:
  Both implementations use the same SplitMix64 algorithm (identical
  multiplier constants and shift sequence) and the same number of RNG
  draws per word at p=0.25 (n=ceil(-log2(0.25))=2). With per-trial
  re-seeding to align mask sequences across the size disparity (pillar
  16 words × 2 = 32 draws, production 3×256 words × 2 = 1536 draws),
  the first WORDS=16 u64 of production's GraphHV.channels[0] match the
  pillar's bundle_step output BIT-EXACTLY over 16 trials.

  lr=0.25 chosen because production's make_probability_mask has a
  latent infinite-recursion bug at p=0.5 exactly (p >= 0.5 recurses
  with 1.0 - 0.5 = 0.5); pillar's p > 0.5 strict comparison correctly
  falls through to the AND-cascade. Real production usage (DNConfig
  default lr=0.03 with boost up to ~30) never hits 0.5 so the bug is
  dormant. Recorded for future cleanup.

Pillar 14 ↔ OntologySchema::is_ancestor:
  Production's OntologySchema is single-parent (parent: Option<Box<str>>);
  pillar 14's synthetic schemas are multi-parent DAGs. The drift-check
  operates on the strict subset — generates a deterministic
  single-parent random tree, builds it as Turtle source, parses to
  OntologySchema, computes pillar's Floyd-Warshall closure on the same
  direct-edge boolean matrix, and asserts agreement on EVERY
  (ancestor, descendant) pair (N=8 tree → 64 pair-checks).

  Closure axes: pillar `le[i*N+j]` ≡ "i extends j" ≡ production
  `is_ancestor(types[j], types[i])`. Documented inline. The
  drift-check is gated on the `ogit_bridge` feature (the pillar itself
  is under `pillar`); both must be active.

All 132 pillar tests pass; lib fmt + clippy clean.
AdaWorldAPI pushed a commit that referenced this pull request May 21, 2026
…literals

Same canonical-fmt collapse as #188's pillar-branch hotfix: rustfmt
1.95.0 collapses multi-line function-call arguments and small array
literals when they fit within the configured max width.

No behavioral change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants