arborist/bench/spatial_anchor_validation_results.md
russell@unturf.com 55b651f624
#000070: spatial-anchor pi*_w_object ticket + pre-review bench
New ticket for Joseph (@TrudoJo)'s 6-dim procedural spatial-anchor
framework as the first verifier kernel under the #000013 v7-W reserved
namespace. A single committed 32-byte SHA-256 hash deterministically
expands into six 32-byte regions H1..H6 via the HMAC-SHA-512 KDF already
shipped in arborist/substrate/anchor_prg.py (#000035); each region drives
one quantized object dimension under a fixed canonical mapper. Domain
separation from #000035 by dedicated spatial_anchor_seed published in
the v7-W manifest -- preserves #000035's KAT freeze + dav1d 2026-05-11
final review intact.

Bundle:
- docs/tickets/ticket-000070-spatial-anchor-pi-w-object.md (718 lines):
  full spec with 8 design-choice subsections, working Python sketch,
  12-NOT scope boundaries, 8-row cross-references, five-step deletions,
  10 open questions for dav1d.
- bench/spatial_anchor_validation.py: pure-stdlib pre-review evidence
  (~2s, RNG-seed-pinned, reproducible). Five benches: avalanche,
  cell-distribution uniformity, collision vs birthday-bound, cross-region
  independence, domain separation.
- bench/spatial_anchor_validation_results.md: report from first run.
- Makefile: 'make bench-spatial-anchor [SPATIAL_N=N]' target + PHONY.
- docs/TICKETS.md: index row + Next ID 000070 -> 000071.

Bench headlines (N=10000):
- Avalanche mean 767.85 bits (PRF null 768, z=-0.49)        -> PASS
- Cell-distribution chi^2 |z|<1 at L=2,3,4                  -> PASS
- Birthday-bound ratio obs/exp 0.989/1.038 at populated L   -> PASS
- Cross-region Pearson all 15 pairs < 2sigma                -> PASS
- Domain separation Arm A 767.91 / Arm B exact 0 collision  -> PASS

Five of dav1d's ten open questions (Q1 seed source, Q2 segmentation,
Q3 position mapper, Q8 endianness, Q9 KAT adversarial vectors) now
resolve with measurements rather than appeals to PRF authority.
Q4/Q5/Q6/Q7/Q10 remain non-empirical design decisions.

Status: open, awaiting dav1d review + fox go/no-go. No registry slot
booked, no substrate-paper amendment landed, no kernel module created.
2026-05-31 10:16:02 -04:00

4.7 KiB
Raw Blame History

Spatial-anchor empirical validation — ticket #000070

Generated: 2026-05-31T14:06:17Z · RNG seed: 0xa8c90e551fd34427 · wall: 2.10s

Pre-review evidence for ticket #000070 (Joseph @TrudoJo 6-dim framework). Pure stdlib, exercises the already-shipped arborist.substrate.anchor_prg._expand HMAC-SHA-512 KDF (#000035) via an inline prototype split_anchor. Reproducible: same RNG seed → byte-identical numbers.

§1 Avalanche — single-bit hash flip

Trials: 4000 (200 hashes × 20 bit-flips each)

Metric Observed Expected (PRF null)
Mean Hamming distance (bits) 767.848 768
Per-trial stdev 20.039 19.596
Min observed 700
Max observed 844
z-score of sample mean -0.491 0

Verdict: PASS — sample mean within healthy band.

dav1d Q2 answer: PRF avalanche holds under fixed-offset slicing; bit-flip propagates uniformly through the entire 192-byte output.

§2 Cell-distribution uniformity (octree position mapper)

Samples: 10000

Level L Cells (8^L) Occupied Expected/cell Chi² df z-score
2 64 64 156.250 72.77 63 0.870
3 512 512 19.531 512.59 511 0.050
4 4,096 3,723 2.441 4064.84 4,095 -0.333

z-score under Normal(df, 2·df) approximation to chi²; |z| < 3 = uniform within ~99.7 %% band.

Verdict: PASS — every tested level within 3σ.

dav1d Q3 answer: octree mapper at any tested L yields statistically uniform cell occupancy. Mapper is sound.

§3 Collision rate vs birthday-bound

Samples: 10000

Level L Cells Observed coll. Expected (N(N-1)/(2·8^L)) Ratio obs/exp
4 4,096 12,071 12205.81 0.989
6 262,144 198 190.72 1.038
8 16,777,216 0 2.98 0.000
10 1,073,741,824 0 0.05 0.000

Ratios near 1.0 confirm birthday-bound behavior — collisions follow PRF expectation, not a structural skew.

dav1d Q9 answer: KAT adversarial vectors should include a low-entropy hash (e.g. 0x00 * 32, 0xFF * 32, and a hash engineered to map to cell 0 at the deployment's chosen L) so future regressions cannot quietly weaken the mapper.

§4 Cross-region independence (fixed-offset slicing safety)

Samples: 10000 · stderr: ≈0.0100 · 4σ flag threshold: 0.0400

| Region pair | Pearson r | |r|/stderr | 4σ flag | |---|---|---|---| | H1↔H2 | -0.01805 | 1.80 | ok | | H1↔H3 | 0.00533 | 0.53 | ok | | H1↔H4 | 0.00294 | 0.29 | ok | | H1↔H5 | -0.00916 | 0.92 | ok | | H1↔H6 | 0.00283 | 0.28 | ok | | H2↔H3 | -0.00646 | 0.65 | ok | | H2↔H4 | -0.00118 | 0.12 | ok | | H2↔H5 | 0.00632 | 0.63 | ok | | H2↔H6 | 0.00967 | 0.97 | ok | | H3↔H4 | -0.01126 | 1.13 | ok | | H3↔H5 | 0.01206 | 1.21 | ok | | H3↔H6 | -0.00194 | 0.19 | ok | | H4↔H5 | 0.00269 | 0.27 | ok | | H4↔H6 | 0.00546 | 0.55 | ok | | H5↔H6 | -0.00731 | 0.73 | ok |

Verdict: PASS — no pair correlates above 4σ. Fixed-offset slicing inherits PRF block-independence cleanly.

dav1d Q2 answer (direct): §2.2 option A (fixed-offset slicing) is empirically safe under counter-mode block independence.

Samples: 10000

  • Mean Hamming distance: 767.91 bits (expected ≈ 768 under PRF null)
  • Range: [688, 850]
  • Stdev per trial: 19.548

Arm B — shared seed (footgun: reuses anchor_prg_seed)

  • Mean Hamming distance: 0.00 bits (expected = 0 — collision class)
  • Range: [0, 0]

Verdict: Arm B confirms the collision class — sharing one seed across two PRG domains makes split_anchor and the v7 anchor map byte-identical. #000070 §2.1 option A (dedicated spatial_anchor_seed) is the correct discipline.

dav1d Q1 answer: the seed-reuse footgun has a measurable, deterministic collision class; the discipline must be enforced at the manifest layer (not at the function call site).

Summary

Open question Bench answer
Q1 (seed source — A dedicated vs B domain-tag) §5 measures the reuse footgun → recommend A
Q2 (segmentation — A fixed offset vs B nested HMAC) §4 measures cross-region independence → A is safe
Q3 (position mapper — octree at Phase 1) §2 + §3 confirm octree is uniform + birthday-bound-correct
Q8 (endianness — LE confirms #000035) inherited; bench reuses _expand byte-for-byte
Q9 (KAT count + adversarial) §3 surfaces the low-entropy-input case to include

Remaining questions (Q4 scope split, Q5 privacy default, Q6 audit_mode discipline, Q7 manifest validator timing, Q10 paper-amendment wording) are non-empirical and stay with dav1d's design review.