Skip to content

E-STOP: valid CUSUM e-detector; swept collision check; honest bench - #5

Merged
SMC17 merged 1 commit into
mainfrom
fix/valid-e-detector
Nov 20, 2026
Merged

SMC17 merged 1 commit into
mainfrom
fix/valid-e-detector

Conversation

@SMC17

@SMC17 SMC17 commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Fixes #2 and #3.

Detector. The increment is now log cosh(μz) − μ²/2. Its exponential has expectation exactly 1 under N(0,1), which a new test checks numerically. It runs inside a CUSUM e-detector, which guarantees that with no shift, the mean number of steps to a false alarm is at least the threshold. Defaults: WARN 1e5, E_STOP 1e9, warm-up 256 samples.

Measured on pure noise (2,000 runs × 1,000 steps):

Before After
Runs with a false E_STOP 54.2% 0
Runs with a false WARN 99.8% 0.4%
Steps to stop a sustained 3σ shift (1,000 runs) — median 5, max 14

Rollout. Collisions are now checked against each step's segment, not just its endpoint. A regression test covers a step that jumps over an obstacle.

Bench. The rollout loop now does real work: 13 ns, where it printed 0 before.

Docs.

  • SreController's comments now match the code, and say plainly that it is a heuristic, not anytime-valid.
  • The Lean thresholds are updated, and the file checks on Lean 4.35.0.
  • README and llms.txt rewritten with the numbers above.

Tests: 8/8 on Zig 0.16.0, M2 Max.

🤖 Generated with Claude Code

…nd docs

- rt_fusion: the increment is log(cosh(mu z)) - mu^2/2, whose exponential has
  expectation exactly 1 under N(0,1), in a CUSUM e-detector (mean false-alarm run
  length >= threshold). Thresholds are 1e5 (WARN) and 1e9 (E_STOP); warm-up is 256.
  On pure noise, false E_STOP drops from 54% of 1 s runs to 0/2000; a 3-sigma
  shift is stopped in a median of 5 steps.
- world_sim: collisions are checked on each step's segment, not its endpoint.
- bench: the rollout loop is no longer optimised away (was 0 ns).
- SreController docs say what it is (heuristic, not anytime-valid) and match the
  code (1.25x, actions returned).
- Lean thresholds updated; the file checks on Lean 4.35.0.

Fixes #2, fixes #3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@SMC17

SMC17 commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

Gate report: PASS

PR head main
commit 1027826 39ff445
gate pass pass
tests passed 8 5
tests failed 0 0
tests skipped 0 0
  • zig build test --summary all exit 0

Run with python3 ops/pr_gate.py physkernel 5 from SMC17/SMC17 (8 s for the PR head).

@SMC17
SMC17 merged commit 3b6e006 into main Nov 20, 2026
1 check failed
@SMC17
SMC17 deleted the fix/valid-e-detector branch November 20, 2026 05:07
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.

Safety E-STOP fires on pure noise in 54% of 1-second runs; statistic is not an e-process

1 participant