You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
❌ Patch coverage is 98.86364% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.56%. Comparing base (54aca98) to head (395b5a3). ⚠️ Report is 1 commits behind head on main.
Added src/rules/subsetsum_closestvectorproblem.rs with the SubsetSum -> ClosestVectorProblem<i32> reduction, direct solution extraction, required #[reduction(overhead = ...)] metadata, and a canonical example-db witness.
Registered the new rule in src/rules/mod.rs.
Added src/unit_tests/rules/subsetsum_closestvectorproblem.rs covering the closed-loop round trip, basis/target structure, the issue’s two minimizers, an unsatisfiable instance, and overflow behavior for coefficients that do not fit in i32.
Documented the reduction in docs/paper/reductions.typ with a worked example loaded from the exported example fixture.
Added the Lagarias-Odlyzko (1985) and Coster et al. (1992) bibliography entries in docs/paper/references.bib.
Deviations from Plan
The plan referenced make regenerate-fixtures, but this repo does not define that target. I used the actual fixture export path: cargo run --features "example-db" --example export_examples.
The issue describes an arbitrary-integer Subset Sum source, but the existing ClosestVectorProblem variants in this repo are i32 and f64. To keep this PR scoped to a rule (not a model extension), the implementation targets ClosestVectorProblem<i32> and fails fast if any size or target does not fit in i32.
Open Questions
If we want this reduction to support arbitrarily large Subset Sum coefficients without a guard, ClosestVectorProblem likely needs a wider exact-integer variant in a separate follow-up.
Blacklisted autogenerated files absent from PR diff
PASS
13
Deterministic file whitelist
FAIL — docs/paper/references.bib is outside the current rule-PR whitelist
Build Status
make test: PASS
make clippy: PASS
make paper: PASS
Semantic Review
extract_solution correctness: OK — the CVP bounds are binary, so the target config is already the source selection vector.
Overhead accuracy: OK — reduce_to() emits n basis vectors, each of ambient dimension n + 1; verified from the generated bundle JSON and the exported reduction graph.
Example quality: OK — the canonical example, unit tests, CLI bundle, and paper example all agree on the (3,7,1,8) / 11 witness.
Paper quality: ISSUE — docs/paper/reductions.typ states the reduction for arbitrary ZZ^+ sizes/targets, but the implementation only works when every coefficient fits in i32.
ISSUE — src/rules/subsetsum_closestvectorproblem.rs:29-55 narrows BigUint inputs to i32 and panics on larger valid instances
3
Solution extraction matches
OK
4
Correctness preserved
ISSUE — the registered rule is not total for the repo's SubsetSum model (Vec<BigUint>, BigUint)
5
Overhead expressions match
OK
6
Example matches
OK
Summary
12/13 structural checks passed
4/6 issue compliance checks passed
src/rules/subsetsum_closestvectorproblem.rs:29-55 makes the reduction partial over valid SubsetSum inputs by panicking when a coefficient exceeds i32.
docs/paper/reductions.typ:4215-4225 overclaims the supported numeric domain relative to the implementation.
docs/paper/references.bib is outside the current rule-PR whitelist.
Quality Check
Quality Review
Design Principles
DRY: OK — the reduction is small and self-contained, with no duplicated logic across the touched files.
KISS: OK — basis construction and solution extraction are direct.
HC/LC: OK — rule logic, tests, and paper/documentation remain separated.
Test Quality
Naive test detection: ISSUE
src/unit_tests/rules/subsetsum_closestvectorproblem.rs:72-78 codifies the large-coefficient path as an expected panic, so the test suite currently blesses a user-visible crash instead of requiring a recoverable unsupported-input error or a total reduction.
Issues
Critical (Must Fix)
Valid large-BigUintSubsetSum inputs crash the advertised rule. Reproduced with pred reduce big_subsetsum.json --to ClosestVectorProblem, where big_subsetsum.json contains sizes = [2147483648] and target = 1. The CLI panics at src/rules/subsetsum_closestvectorproblem.rs:32.
Important (Should Fix)
docs/paper/reductions.typ:4215-4225 does not disclose the i32 restriction, so the paper theorem currently states a stronger result than the code implements.
docs/paper/references.bib trips the current rule-PR whitelist.
Minor (Nice to Have)
None.
Summary
One critical correctness issue: valid large-BigUint inputs crash the rule through the CLI.
One documentation mismatch: the paper states unrestricted integer coefficients.
One process exception: bibliography edits are outside the current rule whitelist.
Agentic Feature Tests
Feature Test Report: problemreductions
Date: 2026-03-21 Project type: Rust library + CLI Features tested:SubsetSum -> ClosestVectorProblem Profile: ephemeral Use Case: A downstream CLI user discovers the new rule from the catalog, materializes the canonical example, reduces it, and solves it end-to-end. Expected Outcome: The new rule is discoverable in pred, canonical examples round-trip correctly, and unsupported inputs are handled without crashing. Verdict: fail Critical Issues: 1
Summary
Feature
Discoverable
Setup
Works
Expected Outcome Met
Doc Quality
SubsetSum -> ClosestVectorProblem
yes
yes
partial
no
partial
Per-Feature Details
SubsetSum -> ClosestVectorProblem
Role: CLI user validating a new direct reduction rule.
Use Case: Discover the rule, create the canonical example, reduce it, and solve both source and target through pred.
What they tried:
pred list --rules
pred show SubsetSum
pred show ClosestVectorProblem
pred create --example SubsetSum --to ClosestVectorProblem
pred create --example SubsetSum --to ClosestVectorProblem --example-side target
pred solve subsetsum.json --solver brute-force
pred reduce subsetsum.json --to ClosestVectorProblem
pred solve subsetsum_to_cvp.bundle.json --solver brute-force
pred reduce big_subsetsum.json --to ClosestVectorProblem
Discoverability: Yes — the rule appears in pred list --rules, and both endpoints show the edge in pred show.
Setup: Yes — no extra setup beyond the existing workspace build was needed.
Functionality: Partial — the canonical example creation, reduction, target solve, and bundle solve all worked. A valid large-BigUint source instance crashed pred reduce.
Expected vs Actual: Partial — the happy path works, but the advertised rule is unusable for the full SubsetSum domain.
Blocked steps: None.
Friction points: Unsupported numeric range is neither surfaced in pred show nor returned as a handled CLI error.
Doc suggestions: Either constrain the documented domain to i32-fit inputs everywhere or widen the target representation so the rule remains total.
Expected vs Actual Outcome
Canonical example flow: achieved.
Large valid SubsetSum flow: not achieved; pred reduce panicked at src/rules/subsetsum_closestvectorproblem.rs:32.
Issues Found
Critical: pred reduce panics on valid SubsetSum JSON with coefficient 2147483648, producing a crash instead of a recoverable error.
Suggestions
Replace the expect(...)-based narrowing in the reduction with a recoverable validation path or support a wider exact target representation.
Align the paper text and CLI-facing docs with the actual supported numeric domain.
If bibliography edits are expected for rule PRs, update scripts/pipeline_checks.py accordingly; otherwise split the bib change.
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
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
Add the plan and implementation for the SubsetSum to ClosestVectorProblem reduction.
Fixes #125