Commit 110dd3b
committed
fix(adr-025): correct the LOD depth formula — n = 16^r (4×4), not 4-ary
Closes Codex P2 on PR #44 (now merged).
# The error
ADR-025 §2 said sample size "n ≈ 16^r for a 4-ary radix pyramid."
That is internally inconsistent: a 4-ary pyramid grows as n = 4^r,
and the cited level formula r* = ⌈log₄(C/τ)⌉ only follows from
n = 16^r. As written, an implementer of D-JC-PREDICT-LOD building
against the documented 4-ary pyramid would pick a level half as
deep as needed and leave the predicted error above tolerance.
The runtime session's original numbers were actually self-consistent
on n = 16^r (it gave n^{-1/2} = 4^{-r} and r* = ⌈log₄(C/τ)⌉, which
all agree). The only slip was my mislabeling the branching as
"4-ary" — the pyramid increases resolution ×4 in BOTH x and y per
hop, so 4 × 4 = 16 samples per level.
# The fix
Rewrite §2 with an explicit, self-checking derivation:
n = b^r
predicted_error_L = C · n^{-1/2} = C · b^{-r/2}
predicted_error_L < τ ⟹ r* = ⌈2·log_b(C/τ)⌉ (general)
helix pyramid ships b = 16 (×4 per axis = 4 × 4)
⟹ n = 16^r, n^{-1/2} = 4^{-r}
⟹ r* = ⌈2·log_16(C/τ)⌉ = ⌈log₄(C/τ)⌉ (canonical anchor)
The canonical formula r* = ⌈log₄(C/τ)⌉ and the "5-12 hop" range are
preserved (the §Consequences line now annotates it as the b = 16
reduction of r* = ⌈2·log_b(C/τ)⌉). The "4-ary radix pyramid" label
is removed.
# Implementer note added
The §2 block now carries an explicit warning: build the level
formula on the pyramid's true per-level SAMPLE growth (n = 16^r),
not its per-axis fan-out (×4). Pairing the ⌈log₄⌉ pick with a
pyramid that actually grows only n = 4^r selects a level half as
deep as that pyramid needs (a 4-ary pyramid needs ⌈log₂(C/τ)⌉,
since log₂ = 2·log₄) and leaves the error above tolerance — exactly
the failure mode Codex flagged.
# Review
Numerically re-derived and verified:
- 2·log_16(C/τ) == ⌈log₄(C/τ)⌉ across C/τ ∈ {1024, 4096, 1e5, 1.67e7}
- n^{-1/2} == 4^{-r} at b = 16
- footgun direction: applying ⌈log₄⌉ to a 4-ary pyramid picks
exactly half the needed depth (ratio 0.50 vs ⌈log₂⌉) — matches
Codex's "half as deep as needed"
- 5-12 hop band (b=16): r*=5 ⇔ C/τ~1024, r*=12 ⇔ C/τ~1.68e7
No "4-ary" mislabel remains in the doc. PII abort-guard
(word-boundary): CLEAN. cargo check --workspace --all-targets: clean
(docs-only).
https://claude.ai/code/session_01PBTGaPCSnnt6u3pjXpbLwY1 parent a806b87 commit 110dd3b
1 file changed
Lines changed: 26 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1427 | 1427 | | |
1428 | 1428 | | |
1429 | 1429 | | |
1430 | | - | |
1431 | | - | |
1432 | | - | |
1433 | | - | |
1434 | | - | |
1435 | | - | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
1436 | 1437 | | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
1437 | 1453 | | |
1438 | 1454 | | |
1439 | 1455 | | |
| |||
1520 | 1536 | | |
1521 | 1537 | | |
1522 | 1538 | | |
1523 | | - | |
1524 | | - | |
1525 | | - | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
1526 | 1543 | | |
1527 | 1544 | | |
1528 | 1545 | | |
| |||
0 commit comments