Repository navigation
Preserve acyclic LP selections with SCC-local rank constraints - #369
Open
TheDarkLightX wants to merge 1 commit into
Open
TheDarkLightX wants to merge 1 commit into
TheDarkLightX wants to merge 1 commit into
Conversation
Replace graph-wide cycle pruning with exact selected-edge acyclicity rows. Add regression/oracle tests, iterative SCC checks, guarded decoding, and an optional pinned Lean proof of the abstract encoding. Assisted-by: OpenAI Codex
TheDarkLightX
marked this pull request as ready for review
October 4, 2026 00:27
This branch has not been deployed
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.
Fixes #207.
This preserves every acyclic class-consistent selection instead of removing e-nodes using graph-wide cycle breaking. On current main (
73975c9), the new three-class back-edge regression returns cost 10 instead of 1; the independent small-graph oracle also finds cost 8 instead of 7 for graph 60. The original issue/comment examples are retained as coverage, but already pass current main on this build.Encoding
Compute SCCs of the full possible-edge graph with iterative Kosaraju. Direct self-loop nodes are disabled. For a component of size m > 1, each class gets a continuous rank in [0, m − 1]. Every possible intra-component edge has:
rank(parent) − rank(child) − m × selected(node) ≥ 1 − mWhen selected, the parent rank is at least one larger. When unselected, M = m makes the constraint redundant even at the extreme bounds. Cross-component edges need no rank constraints; singleton components need no rank variables. Existing activation, root, and one-node-per-active-class constraints remain.
The decoder uses a binary threshold and an explicit visiting stack, so small numerical residues do not select nodes and a cyclic or missing incumbent cannot cause an infinite reconstruction loop.
Formal evidence and its boundary
Optional pinned Lean proof and replay instructions establish:
Lean 4.30.0-rc2 and the pinned Mathlib revision check both SCC soundness/completeness theorems. No unfinished proofs or new axioms; reported dependencies are only
propext,Classical.choice, andQuot.sound.This verifies the exact mathematical encoding. Rust model construction, Kosaraju, reconstruction, good_lp/CBC, floating-point tolerances, and solver optimality are tested/reviewed boundaries, not formally verified implementations. The proof also does not claim a complete rooted-objective/RecExpr refinement theorem. Rooted optimality requires finite nonnegative costs and an optimal backend result. Negative costs remain accepted with their existing disconnected-selection limitation documented.
Validation
makepassed: default release, std-clock release, LP, explanations, no-default-features, formatting, all-feature docs, and deadlinksAn additional, non-required
cargo test --release --all-featuresrun fails the existingpattern::Patterndoctest's order assertion ([1,3] versus [3,1]). The same isolated failure reproduces on untouched main; this PR leaves that unrelated example unchanged.Performance
Reproducible benchmark fixture, exact lock, protocol, and raw samples are kept on a separate fork evidence branch, outside this PR's diff.
Synthetic Linux/CBC 2.10.12 medians, baseline → SCC:
These are small synthetic measurements, not application-scale guarantees. In three independent five-second attempts, both variants returned the same suboptimal incumbents for shared100 (63.4 versus optimum 61) and shared500 (361.8 versus 301), all with TimeLimit status. Exact modeling can cost more, and time-limited results need not be optimal.
Assisted-by: OpenAI Codex (implementation, proof development, testing, and write-up).