feat(engine): Phase 0 RZF engine with gating oracle suite + spec v2.2#1
Merged
Conversation
Build the zeroforce RZF engine first (per spec §15), since a subtly wrong EPT is silent and catastrophic. Math-correctness gates CI before anything is built on top. Engine (packages/zeroforce/): - engine_py: pure-Python reference Markov-chain DP (normalized weights so denominator = 1; self-loop fixed via next_mask != mask). - engine_numba: nopython JIT mirror of the reference DP. - reachability: R(v) closure + induced subgraph G[R(v)]; EPT scoped to R(v). - ranking: impact_score = n_reachable / EPT (excludes self), sink separation. - simulator: independent Monte Carlo RZF (second definition for differential). - api.compute(graph): asserts the §7.2 row-stochastic invariant on the FULL graph, runs per-seed DP on induced subgraphs, ranks. Gating tests (41 passed, pristine under -W error): - hand-computed 3-node oracle (EPT derived from first principles, trusts paper 0) - Monte Carlo differential (sim vs DP, n<=6, <2e-2) - engine parity (py vs numba, n<=10, <1e-10) - properties (directed-path depth, seed monotonicity) + invariant guards - §4.6 closed forms kept xfail(strict=False) until paper-body verified Two clarifications over the spec pseudocode, documented in the engine README: - the row-stochastic invariant is asserted on the full graph, not subgraphs (unreachable suppliers leave subgraph rows summing < 1; this is correct) - the recurrence uses the unconditional P(next) divided once by (1 - p_stay) (the prose's "P(next | flip)" plus a second division would double-divide) Spec bumped to v2.2: rename Foresight -> zeroforce; widen numpy pin to >=1.26,<3.0 with an `import numba` CI smoke test; explicit async polling contract + 5-min job timeout; Gemini Pass B retry/fallback; oracle strategy promoted to a standalone callout. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Build the zeroforce RZF engine first (per spec §15), since a subtly wrong EPT is silent and catastrophic. Math-correctness gates CI before anything is built on top.
Engine (packages/zeroforce/):
Gating tests (41 passed, pristine under -W error):
Two clarifications over the spec pseudocode, documented in the engine README:
Spec bumped to v2.2: rename Foresight -> zeroforce; widen numpy pin to