fix(adr-025): inclusive acceptance (≤ τ) makes the LOD formula exact at the boundary#46
Merged
Merged
Conversation
…ct at the boundary Closes Codex P2 on PR #45 (now merged). # The edge case ADR-025 §2 derived the level formula from a STRICT acceptance `predicted_error_L < τ`, but stated the result as `r* = ⌈2·log_b(C/τ)⌉`. Those disagree at the exact-power boundary `C/τ = b^k`: - strict `<` requires the smallest integer strictly greater than 2·log_b(C/τ), i.e. ⌊2·log_b(C/τ)⌋ + 1 = 2k + 1 - the doc wrote ⌈2·log_b(C/τ)⌉ = ⌈2k⌉ = 2k At r* = 2k the predicted error is C·b^{-k} = τ exactly — equal to tolerance, not strictly below. So as written the ⌈⌉ formula selects one level too shallow at that boundary (Codex's flag). # The fix Change the acceptance to INCLUSIVE (`≤ τ` — error within tolerance), which is also Cesium SSE's own convention (`sse ≤ maximumScreenSpaceError`, already referenced by crates/cesium/src/ sse.rs). Then: C·b^{-r/2} ≤ τ ⟹ b^{r/2} ≥ C/τ ⟹ r ≥ 2·log_b(C/τ) ⟹ r* = ⌈2·log_b(C/τ)⌉ (now exact) At the boundary C/τ = b^k: r* = 2k, predicted_error = τ, accepted by ≤. The ⌈⌉ formula is the smallest integer r ≥ 2·log_b(C/τ), exactly right under inclusive acceptance. For a deployment that needs STRICTLY below tolerance, the doc now gives the alternative explicitly: r* = ⌊2·log_b(C/τ)⌋ + 1 (one level deeper at the boundary). # Also updated The decision diagram's "smallest L where predicted_error_L < tolerance" → "≤ tolerance" for consistency. # Review (numerically verified) C/tau = b^k (b=16): inclusive r* = 2k -> err/tau = 1.0000 (accepted by ≤) strict r* = 2k+1 -> err/tau = 0.2500 (< 1.0) Consistent at k ∈ {2,3,5}. Canonical anchor r* = ⌈log₄(C/τ)⌉ (the b=16 reduction) and the "5-12 hop" range are unchanged — this only tightens the acceptance predicate so the existing ⌈⌉ is exact rather than off-by-one at powers of b. PII abort-guard (word-boundary): CLEAN. cargo check: clean (docs-only). https://claude.ai/code/session_01PBTGaPCSnnt6u3pjXpbLwY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes Codex P2 on PR #45 (now merged). Fresh PR rebased on current
main(includes #45).The edge case
ADR-025 §2 derived the level formula from a strict acceptance
predicted_error_L < τbut stated the result asr* = ⌈2·log_b(C/τ)⌉. These disagree at the exact-power boundaryC/τ = b^k:<needs⌊2·log_b(C/τ)⌋ + 1 = 2k + 1⌈2·log_b(C/τ)⌉ = 2kAt
r* = 2kthe predicted error isC·b^{-k} = τexactly — equal to tolerance, not strictly below. So the⌈⌉formula selects one level too shallow at that boundary.The fix
Change the acceptance to inclusive (
≤ τ— error within tolerance), which is also Cesium SSE's own convention (sse ≤ maximumScreenSpaceError, already referenced bycrates/cesium/src/sse.rs):At
C/τ = b^k:r* = 2k,predicted_error = τ, accepted by≤. The⌈⌉formula is the smallest integerr ≥ 2·log_b(C/τ), exactly right under inclusive acceptance.For deployments needing strictly below tolerance, the doc now gives the alternative explicitly:
r* = ⌊2·log_b(C/τ)⌋ + 1(one level deeper at the boundary).The decision diagram's
predicted_error_L < tolerance→≤ tolerancefor consistency.Review (numerically verified)
The canonical anchor
r* = ⌈log₄(C/τ)⌉(the b=16 reduction) and the "5-12 hop" range are unchanged — this only tightens the acceptance predicate so the existing⌈⌉is exact rather than off-by-one at powers of b.PII abort-guard (word-boundary): CLEAN.
cargo check: clean (docs-only).https://claude.ai/code/session_01PBTGaPCSnnt6u3pjXpbLwY